소스 검색

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.
Steven Thompson 1 년 전
부모
커밋
9b1a1d2813
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      editor/plugins/node_3d_editor_gizmos.cpp

+ 4 - 3
editor/plugins/node_3d_editor_gizmos.cpp

@@ -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;