summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2019-10-02 17:28:34 +0300
committerGitHub <noreply@github.com>2019-10-02 17:28:34 +0300
commitf9e9cc94cdfcf1bc1dd43e9d61e1394908835099 (patch)
treef9f46b65b6a48a98f84684babc71d4ee33d53d73 /scene
parenta737bceb4e40d8472762630566716c19ab89d0ec (diff)
parent31ada3b68516306c84485423fa75d103828d211d (diff)
Merge pull request #32494 from Chaosus/vs_fix_globals
Fix global code in visual shaders if two or more custom nodes are used
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/visual_shader.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 6c829e6e81..1dba0c5b09 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1148,12 +1148,16 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
global_code += vsnode->generate_global(get_mode(), type, node);
- if (!r_classes.has(vsnode->get_class_name())) {
+ String class_name = vsnode->get_class_name();
+ if (class_name == "VisualShaderNodeCustom") {
+ class_name = vsnode->get_script_instance()->get_script()->get_language()->get_global_class_name(vsnode->get_script_instance()->get_script()->get_path());
+ }
+ if (!r_classes.has(class_name)) {
global_code_per_node += vsnode->generate_global_per_node(get_mode(), type, node);
for (int i = 0; i < TYPE_MAX; i++) {
global_code_per_func[Type(i)] += vsnode->generate_global_per_func(get_mode(), Type(i), node);
}
- r_classes.insert(vsnode->get_class_name());
+ r_classes.insert(class_name);
}
}