summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorYuri Roubinski <chaosus89@gmail.com>2019-08-18 12:29:22 +0300
committerYuri Roubinski <chaosus89@gmail.com>2019-08-18 17:28:19 +0300
commit808e44df6d39aaf231341c50bacc646fa1f93915 (patch)
treecbac19a024d6d8007b1ae4d780bf13bdcb536e44 /scene
parentcc9f2a2d8bf36e7244e7291ad7fdb32a3e3f2ef2 (diff)
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 389011c095..f6424b1920 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1249,6 +1249,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 a89e3295fc..951bd6f668 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;