From f8db8a3faa30b71dca33ced38be16d3f93f43e8a Mon Sep 17 00:00:00 2001 From: Rémi Verschelde Date: Sun, 19 Mar 2017 00:36:26 +0100 Subject: Bring that Whole New World to the Old Continent too Applies the clang-format style to the 2.1 branch as done for master in 5dbf1809c6e3e905b94b8764e99491e608122261. --- editor/scene_tree_dock.cpp | 1151 +++++++++++++++++++------------------------- 1 file changed, 505 insertions(+), 646 deletions(-) (limited to 'editor/scene_tree_dock.cpp') diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 2f88b9395..8c2aa4097 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -27,21 +27,19 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "scene_tree_dock.h" +#include "animation_editor.h" +#include "core/io/resource_saver.h" +#include "editor/plugins/animation_player_editor_plugin.h" +#include "editor/plugins/canvas_item_editor_plugin.h" +#include "editor/plugins/script_editor_plugin.h" #include "editor_node.h" +#include "editor_settings.h" #include "globals.h" +#include "multi_node_edit.h" #include "os/keyboard.h" +#include "scene/main/viewport.h" #include "scene/resources/packed_scene.h" -#include "editor_settings.h" -#include "editor/plugins/canvas_item_editor_plugin.h" #include "script_editor_debugger.h" -#include "editor/plugins/script_editor_plugin.h" -#include "core/io/resource_saver.h" -#include "multi_node_edit.h" -#include "editor/plugins/animation_player_editor_plugin.h" -#include "animation_editor.h" -#include "scene/main/viewport.h" - - void SceneTreeDock::_unhandled_key_input(InputEvent p_event) { @@ -53,51 +51,39 @@ void SceneTreeDock::_unhandled_key_input(InputEvent p_event) { if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) { _tool_selected(TOOL_NEW); - } - else if (ED_IS_SHORTCUT("scene_tree/instance_scene", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/instance_scene", p_event)) { _tool_selected(TOOL_INSTANCE); - } - else if (ED_IS_SHORTCUT("scene_tree/change_node_type", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/change_node_type", p_event)) { _tool_selected(TOOL_REPLACE); - } - else if (ED_IS_SHORTCUT("scene_tree/duplicate", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/duplicate", p_event)) { _tool_selected(TOOL_DUPLICATE); - } - else if (ED_IS_SHORTCUT("scene_tree/add_script", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/add_script", p_event)) { _tool_selected(TOOL_SCRIPT); - } - else if (ED_IS_SHORTCUT("scene_tree/move_up", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/move_up", p_event)) { _tool_selected(TOOL_MOVE_UP); - } - else if (ED_IS_SHORTCUT("scene_tree/move_down", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/move_down", p_event)) { _tool_selected(TOOL_MOVE_DOWN); - } - else if (ED_IS_SHORTCUT("scene_tree/reparent", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/reparent", p_event)) { _tool_selected(TOOL_REPARENT); - } - else if (ED_IS_SHORTCUT("scene_tree/merge_from_scene", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/merge_from_scene", p_event)) { _tool_selected(TOOL_MERGE_FROM_SCENE); - } - else if (ED_IS_SHORTCUT("scene_tree/save_branch_as_scene", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/save_branch_as_scene", p_event)) { _tool_selected(TOOL_NEW_SCENE_FROM); - } - else if (ED_IS_SHORTCUT("scene_tree/delete_no_confirm", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/delete_no_confirm", p_event)) { _tool_selected(TOOL_ERASE, true); - } - else if(ED_IS_SHORTCUT("scene_tree/copy_node_path", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/copy_node_path", p_event)) { _tool_selected(TOOL_COPY_NODE_PATH); - } - else if (ED_IS_SHORTCUT("scene_tree/delete", p_event)) { + } else if (ED_IS_SHORTCUT("scene_tree/delete", p_event)) { _tool_selected(TOOL_ERASE); } } -void SceneTreeDock::instance(const String& p_file) { +void SceneTreeDock::instance(const String &p_file) { Node *parent = scene_tree->get_selected(); if (!parent || !edited_scene) { - current_option=-1; + current_option = -1; //accept->get_cancel()->hide(); accept->get_ok()->set_text(TTR("OK :(")); accept->set_text(TTR("No parent to instance a child at.")); @@ -109,11 +95,10 @@ void SceneTreeDock::instance(const String& p_file) { Vector scenes; scenes.push_back(p_file); - _perform_instance_scenes(scenes,parent,-1); - + _perform_instance_scenes(scenes, parent, -1); } -void SceneTreeDock::instance_scenes(const Vector& p_files, Node *p_parent) { +void SceneTreeDock::instance_scenes(const Vector &p_files, Node *p_parent) { Node *parent = p_parent; @@ -132,111 +117,102 @@ void SceneTreeDock::instance_scenes(const Vector& p_files, Node *p_paren _perform_instance_scenes(p_files, parent, -1); } -void SceneTreeDock::_perform_instance_scenes(const Vector& p_files,Node* parent,int p_pos) { - - +void SceneTreeDock::_perform_instance_scenes(const Vector &p_files, Node *parent, int p_pos) { ERR_FAIL_COND(!parent); + Vector instances; - Vector instances; + bool error = false; - bool error=false; - - for(int i=0;i sdata = ResourceLoader::load(p_files[i]); if (!sdata.is_valid()) { - current_option=-1; + current_option = -1; //accept->get_cancel()->hide(); accept->get_ok()->set_text(TTR("Ugh")); - accept->set_text(vformat(TTR("Error loading scene from %s"),p_files[i])); + accept->set_text(vformat(TTR("Error loading scene from %s"), p_files[i])); accept->popup_centered_minsize(); - error=true; + error = true; break; - } - Node*instanced_scene=sdata->instance(true); + Node *instanced_scene = sdata->instance(true); if (!instanced_scene) { - current_option=-1; + current_option = -1; //accept->get_cancel()->hide(); accept->get_ok()->set_text(TTR("Ugh")); - accept->set_text(vformat(TTR("Error instancing scene from %s"),p_files[i])); + accept->set_text(vformat(TTR("Error instancing scene from %s"), p_files[i])); accept->popup_centered_minsize(); - error=true; + error = true; break; - } - if (edited_scene->get_filename()!="") { + if (edited_scene->get_filename() != "") { if (_cyclical_dependency_exists(edited_scene->get_filename(), instanced_scene)) { accept->get_ok()->set_text(TTR("Ok")); - accept->set_text(vformat(TTR("Cannot instance the scene '%s' because the current scene exists within one of its nodes."),p_files[i])); + accept->set_text(vformat(TTR("Cannot instance the scene '%s' because the current scene exists within one of its nodes."), p_files[i])); accept->popup_centered_minsize(); - error=true; + error = true; break; } } - instanced_scene->set_filename( Globals::get_singleton()->localize_path(p_files[i]) ); + instanced_scene->set_filename(Globals::get_singleton()->localize_path(p_files[i])); instances.push_back(instanced_scene); } if (error) { - for(int i=0;igenerate_instance_state(); editor_data->get_undo_redo().create_action(TTR("Instance Scene(s)")); - for(int i=0;iget_undo_redo().add_do_method(parent,"add_child",instanced_scene); - if (p_pos>=0) { - editor_data->get_undo_redo().add_do_method(parent,"move_child",instanced_scene,p_pos+i); + editor_data->get_undo_redo().add_do_method(parent, "add_child", instanced_scene); + if (p_pos >= 0) { + editor_data->get_undo_redo().add_do_method(parent, "move_child", instanced_scene, p_pos + i); } - editor_data->get_undo_redo().add_do_method(instanced_scene,"set_owner",edited_scene); - editor_data->get_undo_redo().add_do_method(editor_selection,"clear"); - editor_data->get_undo_redo().add_do_method(editor_selection,"add_node",instanced_scene); + editor_data->get_undo_redo().add_do_method(instanced_scene, "set_owner", edited_scene); + editor_data->get_undo_redo().add_do_method(editor_selection, "clear"); + editor_data->get_undo_redo().add_do_method(editor_selection, "add_node", instanced_scene); editor_data->get_undo_redo().add_do_reference(instanced_scene); - editor_data->get_undo_redo().add_undo_method(parent,"remove_child",instanced_scene); + editor_data->get_undo_redo().add_undo_method(parent, "remove_child", instanced_scene); String new_name = parent->validate_child_name(instanced_scene->get_name()); ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger(); - editor_data->get_undo_redo().add_do_method(sed,"live_debug_instance_node",edited_scene->get_path_to(parent),p_files[i],new_name); - editor_data->get_undo_redo().add_undo_method(sed,"live_debug_remove_node",NodePath(String(edited_scene->get_path_to(parent))+"/"+new_name)); + editor_data->get_undo_redo().add_do_method(sed, "live_debug_instance_node", edited_scene->get_path_to(parent), p_files[i], new_name); + editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)) + "/" + new_name)); } editor_data->get_undo_redo().commit_action(); - - } -void SceneTreeDock::_replace_with_branch_scene(const String& p_file,Node* base) { +void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) { Ref sdata = ResourceLoader::load(p_file); if (!sdata.is_valid()) { accept->get_ok()->set_text(TTR("Ugh")); - accept->set_text(vformat(TTR("Error loading scene from %s"),p_file)); + accept->set_text(vformat(TTR("Error loading scene from %s"), p_file)); accept->popup_centered_minsize(); return; } - Node *instanced_scene=sdata->instance(true); + Node *instanced_scene = sdata->instance(true); if (!instanced_scene) { accept->get_ok()->set_text(TTR("Ugh")); - accept->set_text(vformat(TTR("Error instancing scene from %s"),p_file)); + accept->set_text(vformat(TTR("Error instancing scene from %s"), p_file)); accept->popup_centered_minsize(); return; } @@ -252,17 +228,17 @@ void SceneTreeDock::_replace_with_branch_scene(const String& p_file,Node* base) scene_tree->set_selected(instanced_scene); } -bool SceneTreeDock::_cyclical_dependency_exists(const String& p_target_scene_path, Node* p_desired_node) { +bool SceneTreeDock::_cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node) { int childCount = p_desired_node->get_child_count(); - if (p_desired_node->get_filename()==p_target_scene_path) { + if (p_desired_node->get_filename() == p_target_scene_path) { return true; } - for (int i=0;iget_child(i); + for (int i = 0; i < childCount; i++) { + Node *child = p_desired_node->get_child(i); - if(_cyclical_dependency_exists(p_target_scene_path,child)) { + if (_cyclical_dependency_exists(p_target_scene_path, child)) { return true; } } @@ -270,9 +246,8 @@ bool SceneTreeDock::_cyclical_dependency_exists(const String& p_target_scene_pat return false; } - static String _get_name_num_separator() { - switch(EditorSettings::get_singleton()->get("scenetree_editor/duplicate_node_name_num_separator").operator int()) { + switch (EditorSettings::get_singleton()->get("scenetree_editor/duplicate_node_name_num_separator").operator int()) { case 0: return ""; case 1: return " "; case 2: return "_"; @@ -281,16 +256,14 @@ static String _get_name_num_separator() { return " "; } - void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { - current_option=p_tool; + current_option = p_tool; - switch(p_tool) { + switch (p_tool) { case TOOL_NEW: { - //if (!_validate_no_foreign()) // break; create_dialog->popup(true); @@ -318,11 +291,11 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { file->set_mode(EditorFileDialog::MODE_OPEN_FILE); List extensions; - ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions); + ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions); file->clear_filters(); - for(int i=0;iadd_filter("*."+extensions[i]+" ; "+extensions[i].to_upper()); + file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } //file->set_current_path(current_path); @@ -369,10 +342,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor->push_item(existing.ptr()); else { String path = selected->get_filename(); - script_create_dialog->config(selected->get_type(),path); - script_create_dialog->popup_centered(Size2(300,290)); + script_create_dialog->config(selected->get_type(), path); + script_create_dialog->popup_centered(Size2(300, 290)); //script_create_dialog->popup_centered_minsize(); - } } break; @@ -382,11 +354,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!scene_tree->get_selected()) break; + if (scene_tree->get_selected() == edited_scene) { - if (scene_tree->get_selected()==edited_scene) { - - - current_option=-1; + current_option = -1; //accept->get_cancel()->hide(); accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation can't be done on the tree root.")); @@ -394,7 +364,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } - if (!_validate_no_foreign()) break; @@ -402,14 +371,14 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { bool MOVING_UP = !MOVING_DOWN; Node *common_parent = scene_tree->get_selected()->get_parent(); - List selection = editor_selection->get_selected_node_list(); - selection.sort_custom(); // sort by index + List selection = editor_selection->get_selected_node_list(); + selection.sort_custom(); // sort by index if (MOVING_DOWN) selection.invert(); int lowest_id = common_parent->get_child_count() - 1; int highest_id = 0; - for (List::Element *E = selection.front(); E; E = E->next()) { + for (List::Element *E = selection.front(); E; E = E->next()) { int index = E->get()->get_index(); if (index > highest_id) highest_id = index; @@ -447,11 +416,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!edited_scene) break; - if (editor_selection->is_selected(edited_scene)) { - - current_option=-1; + current_option = -1; //accept->get_cancel()->hide(); accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation can't be done on the tree root.")); @@ -462,84 +429,83 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!_validate_no_foreign()) break; - List selection = editor_selection->get_selected_node_list(); - if (selection.size()==0) + List selection = editor_selection->get_selected_node_list(); + if (selection.size() == 0) break; - List reselect; + List reselect; editor_data->get_undo_redo().create_action(TTR("Duplicate Node(s)")); - editor_data->get_undo_redo().add_do_method(editor_selection,"clear"); - - Node *dupsingle=NULL; + editor_data->get_undo_redo().add_do_method(editor_selection, "clear"); + Node *dupsingle = NULL; - for (List::Element *E=selection.front();E;E=E->next()) { + for (List::Element *E = selection.front(); E; E = E->next()) { Node *node = E->get(); Node *parent = node->get_parent(); - List owned; - node->get_owned_by(node->get_owner(),&owned); + List owned; + node->get_owned_by(node->get_owner(), &owned); - Map duplimap; - Node * dup = _duplicate(node,duplimap); + Map duplimap; + Node *dup = _duplicate(node, duplimap); ERR_CONTINUE(!dup); - if (selection.size()==1) - dupsingle=dup; + if (selection.size() == 1) + dupsingle = dup; String name = node->get_name(); String nums; - for(int i=name.length()-1;i>=0;i--) { - CharType n=name[i]; - if (n>='0' && n<='9') { - nums=String::chr(name[i])+nums; + for (int i = name.length() - 1; i >= 0; i--) { + CharType n = name[i]; + if (n >= '0' && n <= '9') { + nums = String::chr(name[i]) + nums; } else { break; } } - int num=nums.to_int(); - if (num<1) - num=1; + int num = nums.to_int(); + if (num < 1) + num = 1; else num++; String nnsep = _get_name_num_separator(); - name = name.substr(0,name.length()-nums.length()).strip_edges(); - if ( name.substr(name.length()-nnsep.length(),nnsep.length()) == nnsep) { - name = name.substr(0,name.length()-nnsep.length()); + name = name.substr(0, name.length() - nums.length()).strip_edges(); + if (name.substr(name.length() - nnsep.length(), nnsep.length()) == nnsep) { + name = name.substr(0, name.length() - nnsep.length()); } String attempt = (name + nnsep + itos(num)).strip_edges(); - while(parent->has_node(attempt)) { + while (parent->has_node(attempt)) { num++; attempt = (name + nnsep + itos(num)).strip_edges(); } dup->set_name(attempt); - editor_data->get_undo_redo().add_do_method(parent,"_add_child_below_node",node, dup); - for (List::Element *F=owned.front();F;F=F->next()) { + editor_data->get_undo_redo().add_do_method(parent, "_add_child_below_node", node, dup); + for (List::Element *F = owned.front(); F; F = F->next()) { if (!duplimap.has(F->get())) { continue; } - Node *d=duplimap[F->get()]; - editor_data->get_undo_redo().add_do_method(d,"set_owner",node->get_owner()); + Node *d = duplimap[F->get()]; + editor_data->get_undo_redo().add_do_method(d, "set_owner", node->get_owner()); } - editor_data->get_undo_redo().add_do_method(editor_selection,"add_node",dup); - editor_data->get_undo_redo().add_undo_method(parent,"remove_child",dup); + editor_data->get_undo_redo().add_do_method(editor_selection, "add_node", dup); + editor_data->get_undo_redo().add_undo_method(parent, "remove_child", dup); editor_data->get_undo_redo().add_do_reference(dup); ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger(); - editor_data->get_undo_redo().add_do_method(sed,"live_debug_duplicate_node",edited_scene->get_path_to(node),attempt); - editor_data->get_undo_redo().add_undo_method(sed,"live_debug_remove_node",NodePath(String(edited_scene->get_path_to(parent))+"/"+attempt)); + editor_data->get_undo_redo().add_do_method(sed, "live_debug_duplicate_node", edited_scene->get_path_to(node), attempt); + editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)) + "/" + attempt)); //parent->add_child(dup); //reselect.push_back(dup); @@ -550,22 +516,15 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (dupsingle) editor->push_item(dupsingle); - - - - } break; case TOOL_REPARENT: { - if (!scene_tree->get_selected()) break; - if (editor_selection->is_selected(edited_scene)) { - - current_option=-1; + current_option = -1; //confirmation->get_cancel()->hide(); accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation can't be done on the tree root.")); @@ -576,23 +535,23 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!_validate_no_foreign()) break; - List nodes = editor_selection->get_selected_node_list(); - Set nodeset; - for(List::Element *E=nodes.front();E;E=E->next()) { + List nodes = editor_selection->get_selected_node_list(); + Set nodeset; + for (List::Element *E = nodes.front(); E; E = E->next()) { nodeset.insert(E->get()); } reparent_dialog->popup_centered_ratio(); - reparent_dialog->set_current( nodeset ); + reparent_dialog->set_current(nodeset); } break; case TOOL_MULTI_EDIT: { - Node*root=EditorNode::get_singleton()->get_edited_scene(); + Node *root = EditorNode::get_singleton()->get_edited_scene(); if (!root) break; - Ref mne = memnew( MultiNodeEdit ); - for (const Map::Element *E=EditorNode::get_singleton()->get_editor_selection()->get_selection().front();E;E=E->next()) { + Ref mne = memnew(MultiNodeEdit); + for (const Map::Element *E = EditorNode::get_singleton()->get_editor_selection()->get_selection().front(); E; E = E->next()) { mne->add_node(root->get_path_to(E->key())); } @@ -602,7 +561,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { case TOOL_ERASE: { - List remove_list = editor_selection->get_selected_node_list(); + List remove_list = editor_selection->get_selected_node_list(); if (remove_list.empty()) return; @@ -638,9 +597,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } - List selection = editor_selection->get_selected_node_list(); + List selection = editor_selection->get_selected_node_list(); - if (selection.size()!=1) { + if (selection.size() != 1) { accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation requires a single selected node.")); accept->popup_centered_minsize(); @@ -649,14 +608,14 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Node *tocopy = selection.front()->get(); - if (tocopy==scene){ + if (tocopy == scene) { accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("Can not perform with the root node.")); accept->popup_centered_minsize(); break; } - if (tocopy!=editor_data->get_edited_scene_root() && tocopy->get_filename()!="") { + if (tocopy != editor_data->get_edited_scene_root() && tocopy->get_filename() != "") { accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation can't be done on instanced scenes.")); accept->popup_centered_minsize(); @@ -666,17 +625,17 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { new_scene_from_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); List extensions; - Ref sd = memnew( PackedScene ); - ResourceSaver::get_recognized_extensions(sd,&extensions); + Ref sd = memnew(PackedScene); + ResourceSaver::get_recognized_extensions(sd, &extensions); new_scene_from_dialog->clear_filters(); - for(int i=0;iadd_filter("*."+extensions[i]+" ; "+extensions[i].to_upper()); + for (int i = 0; i < extensions.size(); i++) { + new_scene_from_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } String existing; if (extensions.size()) { String root_name(tocopy->get_name()); - existing=root_name+"."+extensions.front()->get().to_lower(); + existing = root_name + "." + extensions.front()->get().to_lower(); } new_scene_from_dialog->set_current_path(existing); @@ -684,11 +643,11 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { new_scene_from_dialog->set_title(TTR("Save New Scene As..")); } break; - case TOOL_COPY_NODE_PATH: { - List selection = editor_selection->get_selected_node_list(); + case TOOL_COPY_NODE_PATH: { + List selection = editor_selection->get_selected_node_list(); - if(List::Element *e = selection.front()) { - if(Node *node = e->get()) { + if (List::Element *e = selection.front()) { + if (Node *node = e->get()) { Node *root = EditorNode::get_singleton()->get_edited_scene(); NodePath path = root->get_path().rel_path_to(node->get_path()); OS::get_singleton()->set_clipboard(path); @@ -696,51 +655,48 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } } break; } - } void SceneTreeDock::_notification(int p_what) { - switch(p_what) { + switch (p_what) { case NOTIFICATION_READY: { if (!first_enter) break; - first_enter=false; + first_enter = false; - CanvasItemEditorPlugin *canvas_item_plugin = editor_data->get_editor("2D")->cast_to(); + CanvasItemEditorPlugin *canvas_item_plugin = editor_data->get_editor("2D")->cast_to(); if (canvas_item_plugin) { canvas_item_plugin->get_canvas_item_editor()->connect("item_lock_status_changed", scene_tree, "_update_tree"); canvas_item_plugin->get_canvas_item_editor()->connect("item_group_status_changed", scene_tree, "_update_tree"); scene_tree->connect("node_changed", canvas_item_plugin->get_canvas_item_editor()->get_viewport_control(), "update"); } - button_add->set_icon(get_icon("Add","EditorIcons")); - button_instance->set_icon(get_icon("Instance","EditorIcons")); + button_add->set_icon(get_icon("Add", "EditorIcons")); + button_instance->set_icon(get_icon("Instance", "EditorIcons")); - filter_icon->set_texture(get_icon("Zoom","EditorIcons")); + filter_icon->set_texture(get_icon("Zoom", "EditorIcons")); - EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed",this,"_selection_changed"); + EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", this, "_selection_changed"); } break; } } - -void SceneTreeDock::_load_request(const String& p_path) { +void SceneTreeDock::_load_request(const String &p_path) { editor->open_request(p_path); } -void SceneTreeDock::_script_open_request(const Ref