Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if the ref shader is valid in visual shader's _update_option_menu #87356

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editor/plugins/visual_shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions scene/resources/visual_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions scene/resources/visual_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ class VisualShaderNodeParameterRef : public VisualShaderNode {
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);
Expand Down
Loading