Merge pull request #95954 from rakkarage/shader-material-reset

Enable revert button for `ShaderMaterial::next_pass` and `ShaderMaterial::render_priority`.
This commit is contained in:
Rémi Verschelde 2024-08-26 22:45:37 +02:00
commit 350bde0db6
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 8 additions and 0 deletions

View File

@ -379,6 +379,8 @@ bool ShaderMaterial::_property_can_revert(const StringName &p_name) const {
Variant default_value = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), *pr);
Variant current_value = get_shader_parameter(*pr);
return default_value.get_type() != Variant::NIL && default_value != current_value;
} else if (p_name == "render_priority" || p_name == "next_pass") {
return true;
}
}
return false;
@ -390,6 +392,12 @@ bool ShaderMaterial::_property_get_revert(const StringName &p_name, Variant &r_p
if (pr) {
r_property = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), *pr);
return true;
} else if (p_name == "render_priority") {
r_property = 0;
return true;
} else if (p_name == "next_pass") {
r_property = Variant();
return true;
}
}
return false;