Skip to content

Commit 5eadb88

Browse files
committed
Merge pull request godotengine#90183 from stevenjt/fix-gizmo-on-top-material-option
Fix gizmo on top material option having no effect
2 parents a95893c + 9b1a1d2 commit 5eadb88

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

editor/plugins/node_3d_editor_gizmos.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,11 @@ Ref<StandardMaterial3D> EditorNode3DGizmoPlugin::get_material(const String &p_na
979979

980980
Ref<StandardMaterial3D> mat = materials[p_name][index];
981981

982-
if (current_state == ON_TOP && p_gizmo->is_selected()) {
982+
bool on_top_mat = mat->get_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST);
983+
984+
if (!on_top_mat && current_state == ON_TOP && p_gizmo->is_selected()) {
985+
mat = mat->duplicate();
983986
mat->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true);
984-
} else {
985-
mat->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, false);
986987
}
987988

988989
return mat;

0 commit comments

Comments
 (0)