diff options
Diffstat (limited to 'tools/editor/editor_node.cpp')
-rw-r--r-- | tools/editor/editor_node.cpp | 98 |
1 files changed, 73 insertions, 25 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 8048f2573e..a137b6cd34 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -41,6 +41,7 @@ #include "scene/resources/packed_scene.h" #include "editor_settings.h" #include "io_plugins/editor_import_collada.h" +#include "io_plugins/editor_scene_importer_fbxconv.h" #include "globals.h" #include <stdio.h> #include "object_type_db.h" @@ -78,6 +79,7 @@ #include "plugins/path_editor_plugin.h" #include "plugins/rich_text_editor_plugin.h" #include "plugins/collision_polygon_editor_plugin.h" +#include "plugins/collision_polygon_2d_editor_plugin.h" #include "plugins/script_editor_plugin.h" #include "plugins/path_2d_editor_plugin.h" #include "plugins/particles_editor_plugin.h" @@ -85,25 +87,30 @@ #include "plugins/animation_tree_editor_plugin.h" #include "plugins/tile_set_editor_plugin.h" #include "plugins/animation_player_editor_plugin.h" +#include "plugins/baked_light_editor_plugin.h" +#include "plugins/polygon_2d_editor_plugin.h" // end #include "tools/editor/io_plugins/editor_texture_import_plugin.h" #include "tools/editor/io_plugins/editor_scene_import_plugin.h" #include "tools/editor/io_plugins/editor_font_import_plugin.h" #include "tools/editor/io_plugins/editor_sample_import_plugin.h" #include "tools/editor/io_plugins/editor_translation_import_plugin.h" +#include "tools/editor/io_plugins/editor_mesh_import_plugin.h" + EditorNode *EditorNode::singleton=NULL; void EditorNode::_update_title() { + String appname = Globals::get_singleton()->get("application/name"); + String title = appname.empty()?String(VERSION_FULL_NAME):String(_MKSTR(VERSION_NAME) + String(" - ") + appname); String edited = edited_scene?edited_scene->get_filename():String(); - - String title = edited.empty()?String(VERSION_FULL_NAME):String(_MKSTR(VERSION_NAME) + String(" - ")+edited.get_file()); + if (!edited.empty()) + title+=" - " + String(edited.get_file()); if (unsaved_cache) title+=" (*)"; - OS::get_singleton()->set_window_title(title); } @@ -114,7 +121,10 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) { switch(p_event.key.scancode) { - case KEY_F1: _editor_select(3); break; + case KEY_F1: + if (!p_event.key.mod.shift && !p_event.key.mod.command) + _editor_select(3); + break; case KEY_F2: _editor_select(0); break; case KEY_F3: _editor_select(1); break; case KEY_F4: _editor_select(2); break; @@ -301,6 +311,10 @@ void EditorNode::_notification(int p_what) { } */ + if (bool(EDITOR_DEF("resources/auto_reload_modified_images",true))) { + + _menu_option_confirm(DEPENDENCY_LOAD_CHANGED_IMAGES,true); + } EditorFileSystem::get_singleton()->scan_sources(); @@ -723,6 +737,7 @@ void EditorNode::_save_scene(String p_file) { flg|=ResourceSaver::FLAG_COMPRESS; if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + flg|=ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS; err = ResourceSaver::save(p_file,sdata,flg); @@ -1311,6 +1326,7 @@ void EditorNode::_edit_current() { /* Take care of PLUGIN EDITOR */ + EditorPlugin *main_plugin = editor_data.get_editor(current_obj); if (main_plugin) { @@ -1561,8 +1577,8 @@ void EditorNode::_cleanup_scene() { editor_history.clear(); _hide_top_editors(); animation_editor->cleanup(); - resources_dock->cleanup(); property_editor->edit(NULL); + resources_dock->cleanup(); scene_import_metadata.unref(); set_edited_scene(NULL); if (scene) { @@ -1588,6 +1604,8 @@ void EditorNode::_cleanup_scene() { } } + + _update_title(); } @@ -1981,7 +1999,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { confirmation->popup_centered(Size2(300,70)); break; } - + + _menu_option_confirm(RUN_STOP,true); get_scene()->quit(); } break; @@ -2192,8 +2211,9 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_DEPLOY_DUMB_CLIENTS: { - bool ischecked = fileserver_menu->get_popup()->is_item_checked( fileserver_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS)); - fileserver_menu->get_popup()->set_item_checked( fileserver_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked); + bool ischecked = fileserver_menu->get_popup()->is_item_checked( fileserver_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS)); + fileserver_menu->get_popup()->set_item_checked( fileserver_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked); + run_native->set_deploy_dumb(!ischecked); } break; case SETTINGS_UPDATE_ALWAYS: { @@ -2239,9 +2259,9 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { reimport_dialog->popup_reimport(); } break; - case DEPENDENCY_UPDATE_LOCAL: { + case DEPENDENCY_LOAD_CHANGED_IMAGES: { + - /* List<Ref<Resource> > cached; ResourceCache::get_cached_resources(&cached); @@ -2249,6 +2269,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { if (!E->get()->can_reload_from_file()) continue; + if (!FileAccess::exists(E->get()->get_path())) + continue; uint64_t mt = FileAccess::get_modified_time(E->get()->get_path()); if (mt!=E->get()->get_last_modified_time()) { E->get()->reload_from_file(); @@ -2256,15 +2278,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } - sources_button->get_popup()->set_item_disabled(sources_button->get_popup()->get_item_index(DEPENDENCY_UPDATE_LOCAL),true); - - - if (sources_button->get_popup()->is_item_disabled(sources_button->get_popup()->get_item_index(DEPENDENCY_UPDATE_IMPORTED))) - sources_button->set_icon(gui_base->get_icon("DependencyOk","EditorIcons")); - else - sources_button->set_icon(gui_base->get_icon("DependencyChanged","EditorIcons")); - - */ } break; case DEPENDENCY_UPDATE_IMPORTED: { @@ -2723,10 +2736,10 @@ Error EditorNode::load_scene(const String& p_scene) { } */ set_edited_scene(new_scene); - scene_tree_dock->set_selected(new_scene); + _get_scene_metadata(); + scene_tree_dock->set_selected(new_scene, true); property_editor->edit(new_scene); scene_import_metadata = sdata->get_import_metadata(); - _get_scene_metadata(); editor_data.get_undo_redo().clear_history(); saved_version=editor_data.get_undo_redo().get_version(); @@ -2752,7 +2765,7 @@ Error EditorNode::load_scene(const String& p_scene) { top_pallete->set_current_tab(0); //always go to scene - //push_item(new_scene); + push_item(new_scene); return OK; } @@ -3042,6 +3055,33 @@ void EditorNode::_load_error_notify(void* p_ud,const String& p_text) { } + +bool EditorNode::_find_scene_in_use(Node* p_node,const String& p_path) const { + + if (p_node->get_filename()==p_path) { + return true; + } + + for(int i=0;i<p_node->get_child_count();i++) { + + if (_find_scene_in_use(p_node->get_child(i),p_path)) { + return true; + } + } + + return false; +} + + +bool EditorNode::is_scene_in_use(const String& p_path) { + + Node *es = get_edited_scene(); + if (es) + return _find_scene_in_use(es,p_path); + return false; + +} + void EditorNode::register_editor_types() { ObjectTypeDB::register_type<EditorPlugin>(); @@ -3208,6 +3248,7 @@ Error EditorNode::export_platform(const String& p_platform, const String& p_path } + EditorNode::EditorNode() { EditorHelp::generate_doc(); //before any editor classes are crated @@ -3463,7 +3504,7 @@ EditorNode::EditorNode() { p->add_separator(); p->add_item("Project Settings",RUN_SETTINGS); p->add_separator(); - p->add_item("Quit to Project List",RUN_PROJECT_MANAGER); + p->add_item("Quit to Project List",RUN_PROJECT_MANAGER,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_Q); p->add_item("Quit",FILE_QUIT,KEY_MASK_CMD+KEY_Q); recent_scenes = memnew( PopupMenu ); @@ -3609,7 +3650,7 @@ EditorNode::EditorNode() { p->set_item_tooltip(p->get_item_index(RUN_FILE_SERVER),"Enable/Disable the File Server."); p->add_separator(); p->add_check_item("Deploy Dumb Clients",RUN_DEPLOY_DUMB_CLIENTS); - p->set_item_checked( p->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),true ); + //p->set_item_checked( p->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),true ); p->set_item_tooltip(p->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),"Deploy dumb clients when the File Server is active."); p->connect("item_pressed",this,"_menu_option"); @@ -4011,8 +4052,11 @@ EditorNode::EditorNode() { Ref<EditorSceneImportPlugin> _scene_import = memnew(EditorSceneImportPlugin(this) ); Ref<EditorSceneImporterCollada> _collada_import = memnew( EditorSceneImporterCollada); _scene_import->add_importer(_collada_import); + Ref<EditorSceneImporterFBXConv> _fbxconv_import = memnew( EditorSceneImporterFBXConv); + _scene_import->add_importer(_fbxconv_import); editor_import_export->add_import_plugin( _scene_import); editor_import_export->add_import_plugin( Ref<EditorSceneAnimationImportPlugin>( memnew(EditorSceneAnimationImportPlugin(this)))); + editor_import_export->add_import_plugin( Ref<EditorMeshImportPlugin>( memnew(EditorMeshImportPlugin(this)))); editor_import_export->add_import_plugin( Ref<EditorFontImportPlugin>( memnew(EditorFontImportPlugin(this)))); editor_import_export->add_import_plugin( Ref<EditorSampleImportPlugin>( memnew(EditorSampleImportPlugin(this)))); editor_import_export->add_import_plugin( Ref<EditorTranslationImportPlugin>( memnew(EditorTranslationImportPlugin(this)))); @@ -4045,12 +4089,15 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( ItemListEditorPlugin(this) ) ); add_editor_plugin( memnew( RichTextEditorPlugin(this) ) ); add_editor_plugin( memnew( CollisionPolygonEditorPlugin(this) ) ); + add_editor_plugin( memnew( CollisionPolygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( TileSetEditorPlugin(this) ) ); add_editor_plugin( memnew( TileMapEditorPlugin(this) ) ); add_editor_plugin( memnew( SpriteFramesEditorPlugin(this) ) ); add_editor_plugin( memnew( Particles2DEditorPlugin(this) ) ); add_editor_plugin( memnew( Path2DEditorPlugin(this) ) ); add_editor_plugin( memnew( PathEditorPlugin(this) ) ); + add_editor_plugin( memnew( BakedLightEditorPlugin(this) ) ); + add_editor_plugin( memnew( Polygon2DEditorPlugin(this) ) ); for(int i=0;i<EditorPlugins::get_plugin_count();i++) add_editor_plugin( EditorPlugins::create(i,this) ); @@ -4061,7 +4108,7 @@ EditorNode::EditorNode() { import_menu->get_popup()->add_separator(); - import_menu->get_popup()->add_item("Import Settings",SETTINGS_IMPORT); + import_menu->get_popup()->add_item("Re-Import..",SETTINGS_IMPORT); editor_plugin_screen=NULL; editor_plugin_over=NULL; @@ -4163,6 +4210,7 @@ EditorNode::EditorNode() { EditorSettings::get_singleton()->enable_plugins(); Node::set_human_readable_collision_renaming(true); + // Ref<ImageTexture> it = gui_base->get_icon("logo","Icons"); // OS::get_singleton()->set_icon( it->get_data() ); |