Skip to content

Commit

Permalink
Fix gizmo on top material option having no effect
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stevenjt committed Apr 3, 2024
1 parent 29b3d9e commit 9b1a1d2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions editor/plugins/node_3d_editor_gizmos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9b1a1d2

Please sign in to comment.