summaryrefslogtreecommitdiff
path: root/scene/resources/shader.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:41:43 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 21:57:34 +0200
commit0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch)
tree198d4ff7665d89307f6ca2469fa38620a9eb1672 /scene/resources/shader.cpp
parent07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff)
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'scene/resources/shader.cpp')
-rw-r--r--scene/resources/shader.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 341139e1c4..4ca8032d65 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -80,8 +80,9 @@ void Shader::get_param_list(List<PropertyInfo> *p_params) const {
params_cache[pi.name] = E->get().name;
if (p_params) {
//small little hack
- if (pi.type == Variant::_RID)
+ if (pi.type == Variant::_RID) {
pi.type = Variant::OBJECT;
+ }
p_params->push_back(pi);
}
}
@@ -106,10 +107,11 @@ void Shader::set_default_texture_param(const StringName &p_param, const Ref<Text
}
Ref<Texture2D> Shader::get_default_texture_param(const StringName &p_param) const {
- if (default_textures.has(p_param))
+ if (default_textures.has(p_param)) {
return default_textures[p_param];
- else
+ } else {
return Ref<Texture2D>();
+ }
}
void Shader::get_default_texture_param_list(List<StringName> *r_textures) const {
@@ -163,8 +165,9 @@ Shader::~Shader() {
////////////
RES ResourceFormatLoaderShader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
- if (r_error)
+ if (r_error) {
*r_error = ERR_FILE_CANT_OPEN;
+ }
Ref<Shader> shader;
shader.instance();
@@ -176,8 +179,9 @@ RES ResourceFormatLoaderShader::load(const String &p_path, const String &p_origi
shader->set_code(str);
- if (r_error)
+ if (r_error) {
*r_error = OK;
+ }
return shader;
}
@@ -192,8 +196,9 @@ bool ResourceFormatLoaderShader::handles_type(const String &p_type) const {
String ResourceFormatLoaderShader::get_resource_type(const String &p_path) const {
String el = p_path.get_extension().to_lower();
- if (el == "shader")
+ if (el == "shader") {
return "Shader";
+ }
return "";
}