mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Merge pull request #109515 from precup/speedy-selections
Speed up large selections in the editor
This commit is contained in:
@@ -831,8 +831,12 @@ List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool p_retrieve_lo
|
||||
|
||||
if (p_remove_canvas_item_if_parent_in_selection) {
|
||||
List<CanvasItem *> filtered_selection;
|
||||
HashSet<const Node *> nodes_in_selection;
|
||||
for (CanvasItem *E : selection) {
|
||||
if (!selection.find(E->get_parent())) {
|
||||
nodes_in_selection.insert(E);
|
||||
}
|
||||
for (CanvasItem *E : selection) {
|
||||
if (!nodes_in_selection.has(E->get_parent())) {
|
||||
filtered_selection.push_back(E);
|
||||
}
|
||||
}
|
||||
@@ -2616,7 +2620,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
_find_canvas_items_in_rect(Rect2(bsfrom, bsto - bsfrom), scene, &selitems);
|
||||
if (selitems.size() == 1 && editor_selection->get_top_selected_node_list().is_empty()) {
|
||||
if (selitems.size() == 1 && editor_selection->get_selection().is_empty()) {
|
||||
EditorNode::get_singleton()->push_item(selitems.front()->get());
|
||||
}
|
||||
for (CanvasItem *E : selitems) {
|
||||
@@ -2834,7 +2838,7 @@ void CanvasItemEditor::_update_lock_and_group_button() {
|
||||
bool all_locked = true;
|
||||
bool all_group = true;
|
||||
bool has_canvas_item = false;
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.is_empty()) {
|
||||
all_locked = false;
|
||||
all_group = false;
|
||||
@@ -4673,7 +4677,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
|
||||
case LOCK_SELECTED: {
|
||||
undo_redo->create_action(TTR("Lock Selected"));
|
||||
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
for (Node *E : selection) {
|
||||
CanvasItem *ci = Object::cast_to<CanvasItem>(E);
|
||||
if (!ci || !ci->is_inside_tree()) {
|
||||
@@ -4692,7 +4696,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
|
||||
case UNLOCK_SELECTED: {
|
||||
undo_redo->create_action(TTR("Unlock Selected"));
|
||||
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
for (Node *E : selection) {
|
||||
CanvasItem *ci = Object::cast_to<CanvasItem>(E);
|
||||
if (!ci || !ci->is_inside_tree()) {
|
||||
@@ -4711,7 +4715,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
|
||||
case GROUP_SELECTED: {
|
||||
undo_redo->create_action(TTR("Group Selected"));
|
||||
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
for (Node *E : selection) {
|
||||
CanvasItem *ci = Object::cast_to<CanvasItem>(E);
|
||||
if (!ci || !ci->is_inside_tree()) {
|
||||
@@ -4730,7 +4734,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
|
||||
case UNGROUP_SELECTED: {
|
||||
undo_redo->create_action(TTR("Ungroup Selected"));
|
||||
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
for (Node *E : selection) {
|
||||
CanvasItem *ci = Object::cast_to<CanvasItem>(E);
|
||||
if (!ci || !ci->is_inside_tree()) {
|
||||
@@ -6354,7 +6358,7 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p
|
||||
return;
|
||||
}
|
||||
|
||||
List<Node *> selected_nodes = EditorNode::get_singleton()->get_editor_selection()->get_top_selected_node_list();
|
||||
const List<Node *> &selected_nodes = EditorNode::get_singleton()->get_editor_selection()->get_top_selected_node_list();
|
||||
Node *root_node = EditorNode::get_singleton()->get_edited_scene();
|
||||
if (selected_nodes.size() > 0) {
|
||||
Node *selected_node = selected_nodes.front()->get();
|
||||
|
||||
Reference in New Issue
Block a user