Browse Source

Fixed Inspector update when a node is renamed

Whenever any node is renamed, EditorNode::_edit_current() is called and it resets plugins used for current edited properties. This change forces the inspector to update even though the same object is edited, to make sure all plugins are restored properly from unfolded properties/resources/etc.

Fixes #32832
PouleyKetchoupp 5 years ago
parent
commit
9c4a6cf745
1 changed files with 7 additions and 0 deletions
  1. 7 0
      editor/editor_node.cpp

+ 7 - 0
editor/editor_node.cpp

@@ -1765,6 +1765,8 @@ void EditorNode::_edit_current() {
 		return;
 	}
 
+	Object *prev_inspected_object = get_inspector()->get_edited_object();
+
 	bool capitalize = bool(EDITOR_GET("interface/inspector/capitalize_properties"));
 	bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding"));
 	bool is_resource = current_obj->is_class("Resource");
@@ -1856,6 +1858,11 @@ void EditorNode::_edit_current() {
 		inspector_dock->update(NULL);
 	}
 
+	if (current_obj == prev_inspected_object) {
+		// Make sure inspected properties are restored.
+		get_inspector()->update_tree();
+	}
+
 	inspector_dock->set_warning(editable_warning);
 
 	if (get_inspector()->is_capitalize_paths_enabled() != capitalize) {