瀏覽代碼

Redraw selected 3D gizmo on deselect

kobewi 3 年之前
父節點
當前提交
5d413eaa96
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      editor/plugins/node_3d_editor_plugin.cpp

+ 7 - 1
editor/plugins/node_3d_editor_plugin.cpp

@@ -8126,7 +8126,13 @@ void Node3DEditorPlugin::edit(Object *p_object) {
 }
 
 bool Node3DEditorPlugin::handles(Object *p_object) const {
-	return p_object->is_class("Node3D");
+	if (p_object->is_class("Node3D")) {
+		return true;
+	} else {
+		// This ensures that gizmos are cleared when selecting a non-Node3D node.
+		const_cast<Node3DEditorPlugin *>(this)->edit((Object *)nullptr);
+		return false;
+	}
 }
 
 Dictionary Node3DEditorPlugin::get_state() const {