You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-31 18:41:20 +00:00
Don't use selection list as reference
This commit is contained in:
@@ -1156,7 +1156,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
break;
|
||||
}
|
||||
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (selection.size() != 1) {
|
||||
accept->set_text(vformat(TTR("Saving the branch as a scene requires selecting only one node, but you have selected %d nodes."), selection.size()));
|
||||
@@ -1217,7 +1217,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
new_scene_from_dialog->popup_file_dialog();
|
||||
} break;
|
||||
case TOOL_COPY_NODE_PATH: {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
@@ -1229,7 +1229,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_SHOW_IN_FILE_SYSTEM: {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
const Node *node = e->get();
|
||||
@@ -1239,7 +1239,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_OPEN_DOCUMENTATION: {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
for (const Node *node : selection) {
|
||||
String class_name;
|
||||
Ref<Script> script_base = node->get_script();
|
||||
@@ -1275,7 +1275,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
break;
|
||||
}
|
||||
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.size() != 1) {
|
||||
break;
|
||||
}
|
||||
@@ -1310,7 +1310,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
break;
|
||||
}
|
||||
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
@@ -1345,7 +1345,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
break;
|
||||
}
|
||||
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
@@ -1371,7 +1371,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_SCENE_OPEN: {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
@@ -1392,7 +1392,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
break;
|
||||
}
|
||||
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
@@ -1405,7 +1405,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_SCENE_OPEN_INHERITED: {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
@@ -2300,7 +2300,7 @@ void SceneTreeDock::_node_prerenamed(Node *p_node, const String &p_new_name) {
|
||||
}
|
||||
|
||||
bool SceneTreeDock::_validate_no_foreign() {
|
||||
const 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) {
|
||||
if (E != edited_scene && E->get_owner() != edited_scene) {
|
||||
@@ -2329,7 +2329,7 @@ bool SceneTreeDock::_validate_no_foreign() {
|
||||
}
|
||||
|
||||
bool SceneTreeDock::_validate_no_instance() {
|
||||
const 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) {
|
||||
if (E != edited_scene && E->is_instance()) {
|
||||
@@ -2346,7 +2346,7 @@ void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) {
|
||||
Node *new_parent = scene_root->get_node(p_path);
|
||||
ERR_FAIL_NULL(new_parent);
|
||||
|
||||
const 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()) {
|
||||
return; // Nothing to reparent.
|
||||
@@ -2629,7 +2629,7 @@ void SceneTreeDock::_shader_creation_closed() {
|
||||
}
|
||||
|
||||
void SceneTreeDock::_toggle_editable_children_from_selection() {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
|
||||
if (e) {
|
||||
@@ -2638,7 +2638,7 @@ void SceneTreeDock::_toggle_editable_children_from_selection() {
|
||||
}
|
||||
|
||||
void SceneTreeDock::_toggle_placeholder_from_selection() {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *>::Element *e = selection.front();
|
||||
|
||||
if (e) {
|
||||
@@ -3029,7 +3029,7 @@ void SceneTreeDock::_create() {
|
||||
_do_create(parent);
|
||||
|
||||
} else if (current_option == TOOL_REPLACE) {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
ERR_FAIL_COND(selection.is_empty());
|
||||
|
||||
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
|
||||
@@ -3048,7 +3048,7 @@ void SceneTreeDock::_create() {
|
||||
|
||||
ur->commit_action(false);
|
||||
} else if (current_option == TOOL_REPARENT_TO_NEW_NODE) {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
ERR_FAIL_COND(selection.is_empty());
|
||||
|
||||
// Find top level node in selection
|
||||
@@ -3407,7 +3407,7 @@ void SceneTreeDock::set_selected(Node *p_node, bool p_emit_selected) {
|
||||
}
|
||||
|
||||
void SceneTreeDock::_new_scene_from(const String &p_file) {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (selection.size() != 1) {
|
||||
accept->set_text(TTR("This operation requires a single selected node."));
|
||||
@@ -3585,7 +3585,7 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) {
|
||||
}
|
||||
|
||||
Array SceneTreeDock::_get_selection_array() {
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
TypedArray<Node> array;
|
||||
array.resize(selection.size());
|
||||
|
||||
@@ -3734,7 +3734,7 @@ void SceneTreeDock::_nodes_dragged(const Array &p_nodes, NodePath p_to, int p_ty
|
||||
return;
|
||||
}
|
||||
|
||||
const 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()) {
|
||||
return; //nothing to reparent
|
||||
@@ -3797,7 +3797,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
ERR_FAIL_COND(!EditorNode::get_singleton()->get_edited_scene());
|
||||
menu->clear(false);
|
||||
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *> full_selection = editor_selection->get_full_selected_node_list(); // Above method only returns nodes with common parent.
|
||||
|
||||
if (selection.is_empty()) {
|
||||
@@ -4183,7 +4183,7 @@ void SceneTreeDock::attach_script_to_selected(bool p_extend) {
|
||||
return;
|
||||
}
|
||||
|
||||
const 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()) {
|
||||
return;
|
||||
}
|
||||
@@ -4316,7 +4316,7 @@ List<Node *> SceneTreeDock::paste_nodes(bool p_paste_as_sibling) {
|
||||
Node *paste_parent = edited_scene;
|
||||
Node *paste_sibling = nullptr;
|
||||
|
||||
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
|
||||
const List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.size() > 0) {
|
||||
paste_parent = selection.back()->get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user