summaryrefslogtreecommitdiff
path: root/scene/resources/visual_shader.cpp
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2020-04-06 10:25:05 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2020-04-06 12:29:50 +0300
commit8dfe6716ec7204c110a2977eb22bd74029b32c36 (patch)
tree283449664b0f27879699d013231cc00a248ef5d8 /scene/resources/visual_shader.cpp
parent1140871f7e5b627bcd5c11e073975ed21421a95c (diff)
Adds warning to the uniform name in visual shader if its equal to keyword
Diffstat (limited to 'scene/resources/visual_shader.cpp')
-rw-r--r--scene/resources/visual_shader.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index f70f54412b..310a7ef4e4 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -2164,6 +2164,17 @@ void VisualShaderNodeUniform::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "uniform_name"), "set_uniform_name", "get_uniform_name");
}
+String VisualShaderNodeUniform::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const {
+
+ List<String> keyword_list;
+ ShaderLanguage::get_keyword_list(&keyword_list);
+ if (keyword_list.find(uniform_name)) {
+ return TTR("Uniform name cannot be equal to a shader keyword. Choose another name.");
+ }
+
+ return String();
+}
+
VisualShaderNodeUniform::VisualShaderNodeUniform() {
}