summaryrefslogtreecommitdiff
path: root/editor/scene_tree_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r--editor/scene_tree_dock.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index b36275322a..5cb02782ad 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -233,7 +233,7 @@ void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, N
}
editor_data->get_undo_redo().commit_action();
- editor->push_item(instances[instances.size() - 1]);
+ _push_item(instances[instances.size() - 1]);
for (int i = 0; i < instances.size(); i++) {
emit_signal(SNAME("node_created"), instances[i]);
}
@@ -750,7 +750,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().commit_action();
if (dupsingle) {
- editor->push_item(dupsingle);
+ _push_item(dupsingle);
}
} break;
case TOOL_REPARENT: {
@@ -854,7 +854,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
mne->add_node(root->get_path_to(E.key));
}
- EditorNode::get_singleton()->push_item(mne.ptr());
+ _push_item(mne.ptr());
} break;
@@ -1164,7 +1164,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Object *obj = ObjectDB::get_instance(subresources[idx]);
ERR_FAIL_COND(!obj);
- editor->push_item(obj);
+ _push_item(obj);
}
}
}
@@ -1368,6 +1368,12 @@ void SceneTreeDock::_script_open_request(const Ref<Script> &p_script) {
editor->edit_resource(p_script);
}
+void SceneTreeDock::_push_item(Object *p_object) {
+ if (!Input::get_singleton()->is_key_pressed(Key::ALT)) {
+ editor->push_item(p_object);
+ }
+}
+
void SceneTreeDock::_node_selected() {
Node *node = scene_tree->get_selected();
@@ -1379,7 +1385,7 @@ void SceneTreeDock::_node_selected() {
restore_script_editor_on_drag = true;
}
- editor->push_item(node);
+ _push_item(node);
}
void SceneTreeDock::_node_renamed() {
@@ -1950,7 +1956,7 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
editor_data->get_undo_redo().commit_action();
- editor->push_item(p_script.operator->());
+ _push_item(p_script.operator->());
_update_script_button();
}
@@ -2098,7 +2104,7 @@ void SceneTreeDock::_delete_confirm(bool p_cut) {
editor->get_viewport_control()->update();
}
- editor->push_item(nullptr);
+ _push_item(nullptr);
// Fixes the EditorHistory from still offering deleted notes
EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
@@ -2142,9 +2148,9 @@ void SceneTreeDock::_selection_changed() {
//automatically turn on multi-edit
_tool_selected(TOOL_MULTI_EDIT);
} else if (selection_size == 1) {
- editor->push_item(editor_selection->get_selection().front()->key());
+ _push_item(editor_selection->get_selection().front()->key());
} else if (selection_size == 0) {
- editor->push_item(nullptr);
+ _push_item(nullptr);
}
_update_script_button();
@@ -2180,7 +2186,7 @@ void SceneTreeDock::_do_create(Node *p_parent) {
}
editor_data->get_undo_redo().commit_action();
- editor->push_item(c);
+ _push_item(c);
editor_selection->clear();
editor_selection->add_node(child);
if (Object::cast_to<Control>(c)) {
@@ -2338,7 +2344,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
memdelete(default_oldnode);
}
- editor->push_item(nullptr);
+ _push_item(nullptr);
//reconnect signals
List<MethodInfo> sl;
@@ -2382,7 +2388,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
}
newnode->set_name(newname);
- editor->push_item(newnode);
+ _push_item(newnode);
if (p_remove_old) {
memdelete(n);