Edit groups on multiple nodes

Co-authored-by: Pablo Ibarz <fribarz123@gmail.com>
This commit is contained in:
kobewi
2025-08-16 17:28:23 -04:00
parent e6aa06d3de
commit 5fa0f31247
8 changed files with 154 additions and 89 deletions

View File

@ -2844,7 +2844,7 @@ void EditorNode::push_node_item(Node *p_node) {
void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) {
if (!p_object) {
InspectorDock::get_inspector_singleton()->edit(nullptr);
NodeDock::get_singleton()->set_object(nullptr);
NodeDock::get_singleton()->set_selection(Vector<Object *>());
SceneTreeDock::get_singleton()->set_selected(nullptr);
InspectorDock::get_singleton()->update(nullptr);
hide_unused_editors();
@ -2955,7 +2955,7 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
if (!current_obj) {
SceneTreeDock::get_singleton()->set_selected(nullptr);
InspectorDock::get_inspector_singleton()->edit(nullptr);
NodeDock::get_singleton()->set_object(nullptr);
NodeDock::get_singleton()->set_selection(Vector<Object *>());
InspectorDock::get_singleton()->update(nullptr);
EditorDebuggerNode::get_singleton()->clear_remote_tree_selection();
hide_unused_editors();
@ -2989,7 +2989,7 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
if (!p_skip_inspector_update) {
InspectorDock::get_inspector_singleton()->edit(current_res);
SceneTreeDock::get_singleton()->set_selected(nullptr);
NodeDock::get_singleton()->set_object(current_res);
NodeDock::get_singleton()->set_selection(Vector<Object *>{ current_res });
InspectorDock::get_singleton()->update(nullptr);
EditorDebuggerNode::get_singleton()->clear_remote_tree_selection();
ImportDock::get_singleton()->set_edit_path(current_res->get_path());
@ -3019,7 +3019,7 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
InspectorDock::get_inspector_singleton()->edit(current_node);
if (current_node->is_inside_tree()) {
NodeDock::get_singleton()->set_object(current_node);
NodeDock::get_singleton()->set_selection(Vector<Object *>{ current_node });
SceneTreeDock::get_singleton()->set_selected(current_node);
SceneTreeDock::get_singleton()->set_selection({ current_node });
InspectorDock::get_singleton()->update(current_node);
@ -3031,7 +3031,7 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
}
}
} else {
NodeDock::get_singleton()->set_object(nullptr);
NodeDock::get_singleton()->set_selection(Vector<Object *>());
SceneTreeDock::get_singleton()->set_selected(nullptr);
InspectorDock::get_singleton()->update(nullptr);
}
@ -3078,8 +3078,15 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update
EditorDebuggerNode::get_singleton()->clear_remote_tree_selection();
}
// TODO: This can be replaced by some casting operator.
Vector<Object *> nodes_as_objects;
nodes_as_objects.reserve_exact(multi_nodes.size());
for (Node *n : multi_nodes) {
nodes_as_objects.append(n);
}
InspectorDock::get_inspector_singleton()->edit(current_obj);
NodeDock::get_singleton()->set_object(nullptr);
NodeDock::get_singleton()->set_selection(nodes_as_objects);
SceneTreeDock::get_singleton()->set_selected(selected_node);
SceneTreeDock::get_singleton()->set_selection(multi_nodes);
InspectorDock::get_singleton()->update(nullptr);