You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Keep focus on the top-most node for multi-selection in scene tree
Makes behavior consistent with selecting/deselecting single nodes and fixes a regression about the focused node being lost when multi-selecting. Fixes #33332
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
#include "editor/import/resource_importer_texture.h"
|
||||
#include "editor/import/resource_importer_texture_atlas.h"
|
||||
#include "editor/import/resource_importer_wav.h"
|
||||
#include "editor/multi_node_edit.h"
|
||||
#include "editor/plugins/animation_blend_space_1d_editor.h"
|
||||
#include "editor/plugins/animation_blend_space_2d_editor.h"
|
||||
#include "editor/plugins/animation_blend_tree_editor_plugin.h"
|
||||
@@ -1742,15 +1743,37 @@ void EditorNode::_edit_current() {
|
||||
|
||||
} else {
|
||||
|
||||
Node *selected_node = NULL;
|
||||
|
||||
if (current_obj->is_class("ScriptEditorDebuggerInspectedObject")) {
|
||||
editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow.");
|
||||
capitalize = false;
|
||||
disable_folding = true;
|
||||
} else if (current_obj->is_class("MultiNodeEdit")) {
|
||||
Node *scene = get_edited_scene();
|
||||
if (scene) {
|
||||
MultiNodeEdit *multi_node_edit = Object::cast_to<MultiNodeEdit>(current_obj);
|
||||
int node_count = multi_node_edit->get_node_count();
|
||||
if (node_count > 0) {
|
||||
List<Node *> multi_nodes;
|
||||
for (int node_index = 0; node_index < node_count; ++node_index) {
|
||||
Node *node = scene->get_node(multi_node_edit->get_node(node_index));
|
||||
if (node) {
|
||||
multi_nodes.push_back(node);
|
||||
}
|
||||
}
|
||||
if (!multi_nodes.empty()) {
|
||||
// Pick the top-most node
|
||||
multi_nodes.sort_custom<Node::Comparator>();
|
||||
selected_node = multi_nodes.front()->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get_inspector()->edit(current_obj);
|
||||
node_dock->set_node(NULL);
|
||||
scene_tree_dock->set_selected(NULL);
|
||||
scene_tree_dock->set_selected(selected_node);
|
||||
inspector_dock->update(NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user