diff options
author | jsjtxietian <jsjtxietian@outlook.com> | 2024-01-19 12:32:44 +0800 |
---|---|---|
committer | jsjtxietian <jsjtxietian@outlook.com> | 2024-01-25 11:54:23 +0800 |
commit | ff089f8cea5ac874f1d81f73c6ac83a1b4715858 (patch) | |
tree | 77470bdac458e9b3034de61939d38cdc622317c3 | |
parent | 6fea273ed3df7d4be9674d35aae698731fa823ea (diff) | |
download | redot-engine-ff089f8cea5ac874f1d81f73c6ac83a1b4715858.tar.gz |
Check is the ref shader valid in visual shader's update_option_menu
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 4 | ||||
-rw-r--r-- | scene/resources/visual_shader.h | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 89fff008ea..bc02232b35 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1791,7 +1791,7 @@ void VisualShaderEditor::_update_options_menu() { } Ref<VisualShaderNodeParameterRef> parameter_ref = Object::cast_to<VisualShaderNodeParameterRef>(vsn.ptr()); - if (parameter_ref.is_valid()) { + if (parameter_ref.is_valid() && parameter_ref->is_shader_valid()) { check_result = -1; if (members_input_port_type != VisualShaderNode::PORT_TYPE_MAX) { diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 41660767ab..2ed859617a 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -3591,6 +3591,10 @@ String VisualShaderNodeParameterRef::get_output_port_name(int p_port) const { return ""; } +bool VisualShaderNodeParameterRef::is_shader_valid() const { + return shader_rid.is_valid(); +} + void VisualShaderNodeParameterRef::set_shader_rid(const RID &p_shader_rid) { shader_rid = p_shader_rid; } diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index 7faebb86ab..d4d77e7609 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -640,6 +640,7 @@ public: virtual PortType get_output_port_type(int p_port) const override; virtual String get_output_port_name(int p_port) const override; + bool is_shader_valid() const; void set_shader_rid(const RID &p_shader); void set_parameter_name(const String &p_name); |