|
@@ -35,7 +35,7 @@
|
|
|
#include "tools/editor/plugins/canvas_item_editor_plugin.h"
|
|
|
#include "script_editor_debugger.h"
|
|
|
#include "tools/editor/plugins/script_editor_plugin.h"
|
|
|
-
|
|
|
+#include "multi_node_edit.h"
|
|
|
void SceneTreeDock::_unhandled_key_input(InputEvent p_event) {
|
|
|
|
|
|
|
|
@@ -449,6 +449,19 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|
|
reparent_dialog->popup_centered_ratio();
|
|
|
reparent_dialog->set_current( nodeset );
|
|
|
|
|
|
+ } break;
|
|
|
+ case TOOL_MULTI_EDIT: {
|
|
|
+
|
|
|
+ Node*root=EditorNode::get_singleton()->get_edited_scene();
|
|
|
+ if (!root)
|
|
|
+ break;
|
|
|
+ Ref<MultiNodeEdit> mne = memnew( MultiNodeEdit );
|
|
|
+ for (const Map<Node*,Object*>::Element *E=EditorNode::get_singleton()->get_editor_selection()->get_selection().front();E;E=E->next()) {
|
|
|
+ mne->add_node(root->get_path_to(E->key()));
|
|
|
+ }
|
|
|
+
|
|
|
+ EditorNode::get_singleton()->push_item(mne.ptr());
|
|
|
+
|
|
|
} break;
|
|
|
case TOOL_ERASE: {
|
|
|
|
|
@@ -507,6 +520,7 @@ void SceneTreeDock::_notification(int p_what) {
|
|
|
"MoveDown",
|
|
|
"Duplicate",
|
|
|
"Reparent",
|
|
|
+ "MultiNodeEdit",
|
|
|
"Remove",
|
|
|
};
|
|
|
|
|
@@ -515,6 +529,8 @@ void SceneTreeDock::_notification(int p_what) {
|
|
|
for(int i=0;i<TOOL_BUTTON_MAX;i++)
|
|
|
tool_buttons[i]->set_icon(get_icon(button_names[i],"EditorIcons"));
|
|
|
|
|
|
+ EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed",this,"_selection_changed");
|
|
|
+
|
|
|
} break;
|
|
|
}
|
|
|
}
|
|
@@ -1075,9 +1091,19 @@ void SceneTreeDock::_update_tool_buttons() {
|
|
|
tool_buttons[TOOL_DUPLICATE]->set_disabled(disable_root);
|
|
|
tool_buttons[TOOL_REPARENT]->set_disabled(disable_root);
|
|
|
tool_buttons[TOOL_ERASE]->set_disabled(disable);
|
|
|
+ tool_buttons[TOOL_MULTI_EDIT]->set_disabled(EditorNode::get_singleton()->get_editor_selection()->get_selection().size()<2);
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+void SceneTreeDock::_selection_changed() {
|
|
|
+
|
|
|
+ tool_buttons[TOOL_MULTI_EDIT]->set_disabled(EditorNode::get_singleton()->get_editor_selection()->get_selection().size()<2);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
void SceneTreeDock::_create() {
|
|
|
|
|
|
|
|
@@ -1262,6 +1288,7 @@ void SceneTreeDock::_bind_methods() {
|
|
|
ObjectTypeDB::bind_method(_MD("_delete_confirm"),&SceneTreeDock::_delete_confirm);
|
|
|
ObjectTypeDB::bind_method(_MD("_node_prerenamed"),&SceneTreeDock::_node_prerenamed);
|
|
|
ObjectTypeDB::bind_method(_MD("_import_subscene"),&SceneTreeDock::_import_subscene);
|
|
|
+ ObjectTypeDB::bind_method(_MD("_selection_changed"),&SceneTreeDock::_selection_changed);
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("instance"),&SceneTreeDock::instance);
|
|
|
}
|
|
@@ -1364,6 +1391,12 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
|
|
|
|
|
|
hbc_bottom->add_spacer();
|
|
|
|
|
|
+ tb = memnew( ToolButton );
|
|
|
+ tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MULTI_EDIT, false));
|
|
|
+ tb->set_tooltip("Multi-Edit Selected Nodes");
|
|
|
+ hbc_bottom->add_child(tb);
|
|
|
+ tool_buttons[TOOL_MULTI_EDIT]=tb;
|
|
|
+
|
|
|
tb = memnew( ToolButton );
|
|
|
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_ERASE, false));
|
|
|
tb->set_tooltip("Erase Selected Node(s)");
|