summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-08-18 17:32:49 +0200
committerGitHub <noreply@github.com>2019-08-18 17:32:49 +0200
commitef37f00525643e391e19b79f84fc6fd15762b3be (patch)
tree1a07d13ea2e0ca5ac949dffd799b76f92d2321de /scene
parent9cd58b69164027f0429e720767265fb00c11a125 (diff)
parent808e44df6d39aaf231341c50bacc646fa1f93915 (diff)
Merge pull request #31453 from Chaosus/vs_code_preview
Added code preview to visual shader
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/visual_shader.cpp4
-rw-r--r--scene/resources/visual_shader.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 01f62c4929..f7d7c2d1bc 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1266,6 +1266,10 @@ void VisualShader::_update_shader() const {
for (int i = 0; i < default_tex_params.size(); i++) {
const_cast<VisualShader *>(this)->set_default_texture_param(default_tex_params[i].name, default_tex_params[i].param);
}
+ if (previous_code != final_code) {
+ const_cast<VisualShader *>(this)->emit_signal("changed");
+ }
+ previous_code = final_code;
}
void VisualShader::_queue_update() {
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 215b7c7d46..45beb8e6ca 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -73,6 +73,7 @@ private:
} graph[TYPE_MAX];
Shader::Mode shader_mode;
+ mutable String previous_code;
Array _get_node_connections(Type p_type) const;