Skip to content

Commit 9b1a1d2

Browse files
committed
Fix gizmo on top material option having no effect
Update get_material function in EditorNode3DGizmoPlugin so that it enables the disable depth test flag on duplicate versions of the gizmo materials if the flag is not already set and the gizmo is set to use the 'x-ray' visibility state.
1 parent 29b3d9e commit 9b1a1d2

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)