Merge pull request #90183 from stevenjt/fix-gizmo-on-top-material-option

Fix gizmo on top material option having no effect
This commit is contained in:
Rémi Verschelde 2024-04-12 11:16:41 +02:00
commit 5eadb88596
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -979,10 +979,11 @@ Ref<StandardMaterial3D> EditorNode3DGizmoPlugin::get_material(const String &p_na
Ref<StandardMaterial3D> mat = materials[p_name][index];
if (current_state == ON_TOP && p_gizmo->is_selected()) {
bool on_top_mat = mat->get_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST);
if (!on_top_mat && current_state == ON_TOP && p_gizmo->is_selected()) {
mat = mat->duplicate();
mat->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true);
} else {
mat->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, false);
}
return mat;