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.
This commit is contained in:
Steven Thompson 2024-04-03 20:05:17 +01:00
parent 29b3d9e9e5
commit 9b1a1d2813

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;