diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4bcf5a49e6..3f0520379a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -254,7 +254,7 @@ void EditorNode::_notification(int p_what) { get_tree()->get_root()->set_as_audio_listener_2d(false); get_tree()->set_auto_accept_quit(false); get_tree()->connect("files_dropped", this, "_dropped_files"); - property_editable_warning->set_icon(gui_base->get_icon("NodeWarning","EditorIcons")); + property_editable_warning->set_icon(gui_base->get_icon("NodeWarning", "EditorIcons")); } if (p_what == NOTIFICATION_EXIT_TREE) { @@ -1436,18 +1436,18 @@ void EditorNode::_edit_current() { EditorNode::get_singleton()->get_import_dock()->set_edit_path(current_res->get_path()); int subr_idx = current_res->get_path().find("::"); - if (subr_idx!=-1) { - String base_path=current_res->get_path().substr(0,subr_idx); - if (FileAccess::exists(base_path+".import")) { - editable_warning=TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); + if (subr_idx != -1) { + String base_path = current_res->get_path().substr(0, subr_idx); + if (FileAccess::exists(base_path + ".import")) { + editable_warning = TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); } else { - if (!get_edited_scene() || get_edited_scene()->get_filename()!=base_path) { - editable_warning=TTR("This resource belongs to a scene that was instanced or inherited.\nChanges to it will not be kept when saving the current scene."); + if (!get_edited_scene() || get_edited_scene()->get_filename() != base_path) { + editable_warning = TTR("This resource belongs to a scene that was instanced or inherited.\nChanges to it will not be kept when saving the current scene."); } } - } else if (current_res->get_path().is_resource_file()){ - if (FileAccess::exists(current_res->get_path()+".import")) { - editable_warning=TTR("This resource was imported, so it's not editable. Change it's settings in the import panel and re-import."); + } else if (current_res->get_path().is_resource_file()) { + if (FileAccess::exists(current_res->get_path() + ".import")) { + editable_warning = TTR("This resource was imported, so it's not editable. Change it's settings in the import panel and re-import."); } } } else if (is_node) { @@ -1465,10 +1465,10 @@ void EditorNode::_edit_current() { } object_menu->get_popup()->clear(); - if (get_edited_scene() && get_edited_scene()->get_filename()!=String()) { + if (get_edited_scene() && get_edited_scene()->get_filename() != String()) { String source_scene = get_edited_scene()->get_filename(); - if (FileAccess::exists(source_scene+".import")) { - editable_warning=TTR("This scene was imported, so changes to it will not be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); + if (FileAccess::exists(source_scene + ".import")) { + editable_warning = TTR("This scene was imported, so changes to it will not be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); } } @@ -1478,10 +1478,9 @@ void EditorNode::_edit_current() { node_dock->set_node(NULL); } - if (editable_warning!=String()) { + if (editable_warning != String()) { property_editable_warning->show(); //hide by default property_editable_warning_dialog->set_text(editable_warning); - } /* Take care of PLUGIN EDITOR */ @@ -3252,9 +3251,9 @@ void EditorNode::register_editor_types() { ClassDB::register_class<EditorFileSystemDirectory>(); ClassDB::register_virtual_class<ScriptEditor>(); ClassDB::register_virtual_class<EditorInterface>(); + ClassDB::register_class<EditorExportPlugin>(); // FIXME: Is this stuff obsolete, or should it be ported to new APIs? - //ClassDB::register_class<EditorExportPlugin>(); //ClassDB::register_class<EditorScenePostImport>(); //ClassDB::register_type<EditorImportExport>(); } @@ -4511,8 +4510,6 @@ void EditorNode::_bind_methods() { ClassDB::bind_method("_toggle_distraction_free_mode", &EditorNode::_toggle_distraction_free_mode); ClassDB::bind_method("_property_editable_warning_pressed", &EditorNode::_property_editable_warning_pressed); - - ClassDB::bind_method(D_METHOD("get_gui_base"), &EditorNode::get_gui_base); ClassDB::bind_method(D_METHOD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch); @@ -5273,14 +5270,13 @@ EditorNode::EditorNode() { search_bar->add_child(clear_button); clear_button->connect("pressed", this, "_clear_search_box"); - property_editable_warning = memnew (Button); + property_editable_warning = memnew(Button); property_editable_warning->set_text(TTR("Changes may be lost!")); prop_editor_base->add_child(property_editable_warning); - property_editable_warning_dialog = memnew( AcceptDialog ); + property_editable_warning_dialog = memnew(AcceptDialog); gui_base->add_child(property_editable_warning_dialog); property_editable_warning->hide(); - property_editable_warning->connect("pressed",this,"_property_editable_warning_pressed"); - + property_editable_warning->connect("pressed", this, "_property_editable_warning_pressed"); property_editor = memnew(PropertyEditor); property_editor->set_autoclear(true); @@ -5302,7 +5298,6 @@ EditorNode::EditorNode() { dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(import_dock); import_dock->set_name(TTR("Import")); - bool use_single_dock_column = (OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x < 1200); node_dock = memnew(NodeDock); |