diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2020-09-09 17:40:27 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2020-09-09 19:24:55 +0300 |
commit | 14a24fa19c5f51b028352683ed547cdcb07d67d7 (patch) | |
tree | d028485e25563329144e06501ffd0e6bccd4164c /scene | |
parent | 36e2c39f0ce3ef050003e5e97f4ec7fa5fa03aab (diff) |
Improve performance for Show/Hide port preview in visual shaders
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/visual_shader.cpp | 6 | ||||
-rw-r--r-- | scene/resources/visual_shader.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 394133dd47..4ee9b22b25 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -40,6 +40,7 @@ bool VisualShaderNode::is_simple_decl() const { void VisualShaderNode::set_output_port_for_preview(int p_index) { port_preview = p_index; + emit_signal("show_port_preview", p_index); } int VisualShaderNode::get_output_port_for_preview() const { @@ -161,6 +162,7 @@ void VisualShaderNode::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "output_port_for_preview"), "set_output_port_for_preview", "get_output_port_for_preview"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_default_input_values", "get_default_input_values"); ADD_SIGNAL(MethodInfo("editor_refresh_request")); + ADD_SIGNAL(MethodInfo("show_port_preview", PropertyInfo(Variant::INT, "port_id"))); BIND_ENUM_CONSTANT(PORT_TYPE_SCALAR); BIND_ENUM_CONSTANT(PORT_TYPE_SCALAR_INT); @@ -328,6 +330,10 @@ void VisualShader::set_shader_type(Type p_type) { current_type = p_type; } +VisualShader::Type VisualShader::get_shader_type() const { + return current_type; +} + void VisualShader::set_version(const String &p_version) { version = p_version; } diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index d45029ec03..2b9115879e 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -131,6 +131,7 @@ protected: public: // internal methods void set_graph_node(Type p_type, int p_id, GraphNode *p_graph_node); void set_shader_type(Type p_type); + Type get_shader_type() const; public: void set_version(const String &p_version); |