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.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 16a0576af4..c62e9cbe5f 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -61,14 +61,18 @@ void SceneTreeDock::_quick_open() {
}
void SceneTreeDock::_input(Ref<InputEvent> p_event) {
+ ERR_FAIL_COND(p_event.is_null());
+
Ref<InputEventMouseButton> mb = p_event;
- if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+ if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
restore_script_editor_on_drag = false; //lost chance
}
}
void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
+ ERR_FAIL_COND(p_event.is_null());
+
if (get_focus_owner() && get_focus_owner()->is_text_field()) {
return;
}
@@ -608,7 +612,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
List<Node *> selection = editor_selection->get_selected_node_list();
selection.sort_custom<Node::Comparator>(); // sort by index
if (MOVING_DOWN) {
- selection.invert();
+ selection.reverse();
}
int lowest_id = common_parent->get_child_count() - 1;
@@ -685,7 +689,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().add_do_method(editor_selection, "clear");
Node *dupsingle = nullptr;
- List<Node *> editable_children;
selection.sort_custom<Node::Comparator>();
@@ -701,10 +704,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Map<const Node *, Node *> duplimap;
Node *dup = node->duplicate_from_editor(duplimap);
- if (EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(node)) {
- editable_children.push_back(dup);
- }
-
ERR_CONTINUE(!dup);
if (selection.size() == 1) {
@@ -739,11 +738,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (dupsingle) {
editor->push_item(dupsingle);
}
-
- for (List<Node *>::Element *E = editable_children.back(); E; E = E->prev()) {
- _toggle_editable_children(E->get());
- }
-
} break;
case TOOL_REPARENT: {
if (!profile_allow_editing) {
@@ -907,7 +901,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *scene = editor_data->get_edited_scene_root();
if (!scene) {
- accept->set_text(TTR("This operation can't be done without a scene."));
+ accept->set_text(TTR("Saving the branch as a scene requires having a scene open in the editor."));
accept->popup_centered();
break;
}
@@ -915,7 +909,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
List<Node *> selection = editor_selection->get_selected_node_list();
if (selection.size() != 1) {
- accept->set_text(TTR("This operation requires a single selected node."));
+ accept->set_text(vformat(TTR("Saving the branch as a scene requires selecting only one node, but you have selected %d nodes."), selection.size()));
accept->popup_centered();
break;
}
@@ -923,13 +917,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *tocopy = selection.front()->get();
if (tocopy == scene) {
- accept->set_text(TTR("Can not perform with the root node."));
+ accept->set_text(TTR("Can't save the root node branch as an instanced scene.\nTo create an editable copy of the current scene, duplicate it using the FileSystem dock context menu\nor create an inherited scene using Scene > New Inherited Scene... instead."));
accept->popup_centered();
break;
}
if (tocopy != editor_data->get_edited_scene_root() && tocopy->get_filename() != "") {
- accept->set_text(TTR("This operation can't be done on instanced scenes."));
+ accept->set_text(TTR("Can't save the branch of an already instanced scene.\nTo create a variation of a scene, you can make an inherited scene based on the instanced scene using Scene > New Inherited Scene... instead."));
accept->popup_centered();
break;
}
@@ -1394,7 +1388,7 @@ void SceneTreeDock::fill_path_renames(Node *p_node, Node *p_new_parent, List<Pai
base_path.push_back(n->get_name());
n = n->get_parent();
}
- base_path.invert();
+ base_path.reverse();
Vector<StringName> new_base_path;
if (p_new_parent) {
@@ -1404,7 +1398,7 @@ void SceneTreeDock::fill_path_renames(Node *p_node, Node *p_new_parent, List<Pai
n = n->get_parent();
}
- new_base_path.invert();
+ new_base_path.reverse();
}
_fill_path_renames(base_path, new_base_path, p_node, p_renames);
@@ -1590,7 +1584,7 @@ void SceneTreeDock::_node_prerenamed(Node *p_node, const String &p_new_name) {
base_path.push_back(n->get_name());
n = n->get_parent();
}
- base_path.invert();
+ base_path.reverse();
Vector<StringName> new_base_path = base_path;
base_path.push_back(p_node->get_name());