diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-27 19:59:33 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-27 20:00:18 -0300 |
commit | 972c2ad09f6a89e45e61987c9aa89cc3716d2b2b (patch) | |
tree | 6f464d2548ab3507a7f2e4cd86d1d27135422acd /tools/editor | |
parent | 1f9812ab835e97ff07f4abba23a7915e04d306c9 (diff) |
Ask about selecting a main scene if one has not been selected.
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/editor_node.cpp | 50 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 2 |
2 files changed, 41 insertions, 11 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 35b41a8bb9..991444966d 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1161,7 +1161,11 @@ void EditorNode::_dialog_action(String p_file) { load_scene(p_file); } break; + case SETTINGS_PICK_MAIN_SCENE: { + Globals::get_singleton()->set("application/main_scene",p_file); + //would be nice to show the project manager opened with the hilighted field.. + } break; case FILE_SAVE_OPTIMIZED: { @@ -1850,9 +1854,8 @@ void EditorNode::_run(bool p_current,const String& p_custom) { current_option=-1; //accept->get_cancel()->hide(); - accept->get_ok()->set_text(TTR("I see..")); - accept->set_text(TTR("No main scene has ever been defined.\nSelect one from \"Project Settings\" under the 'application' category.")); - accept->popup_centered_minsize(); + pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in later in \"Project Settings\" under the 'application' category.")); + pick_main_scene->popup_centered_minsize(); return; } @@ -1860,9 +1863,8 @@ void EditorNode::_run(bool p_current,const String& p_custom) { current_option=-1; //accept->get_cancel()->hide(); - accept->get_ok()->set_text(TTR("I see..")); - accept->set_text(TTR("Selected scene '"+run_filename+"' does not exist.\nSelect one from \"Project Settings\" under the 'application' category.")); - accept->popup_centered_minsize(); + pick_main_scene->set_text(TTR("Selected scene '"+run_filename+"' does not exist, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category.")); + pick_main_scene->popup_centered_minsize(); return; } @@ -1871,9 +1873,8 @@ void EditorNode::_run(bool p_current,const String& p_custom) { current_option=-1; //accept->get_cancel()->hide(); - accept->get_ok()->set_text(TTR("I see..")); - accept->set_text(TTR("Selected scene '"+run_filename+"' is not a scene file.\nSelect a scene from \"Project Settings\" under the 'application' category.")); - accept->popup_centered_minsize(); + pick_main_scene->set_text(TTR("Selected scene '"+run_filename+"' is not a scene file, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category.")); + pick_main_scene->popup_centered_minsize(); return; } @@ -2791,6 +2792,30 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { file_templates->popup_centered_ratio(); } break; + case SETTINGS_PICK_MAIN_SCENE: { + + + //print_tree(); + file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + //not for now? + List<String> extensions; + ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions); + file->clear_filters(); + for(int i=0;i<extensions.size();i++) { + + file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper()); + } + + + //file->set_current_path(current_path); + Node *scene = editor_data.get_edited_scene_root(); + if (scene) { + file->set_current_path(scene->get_filename()); + }; + file->set_title(TTR("Pick a Manu Scene")); + file->popup_centered_ratio(); + + } break; case SETTINGS_ABOUT: { about->popup_centered(Size2(500,130)*EDSCALE); @@ -6456,7 +6481,7 @@ EditorNode::EditorNode() { load_error_dialog->add_child(load_errors); load_error_dialog->set_title(TTR("Load Errors")); load_error_dialog->set_child_rect(load_errors); - add_child(load_error_dialog); + gui_base->add_child(load_error_dialog); //EditorImport::add_importer( Ref<EditorImporterCollada>( memnew(EditorImporterCollada ))); @@ -6481,7 +6506,10 @@ EditorNode::EditorNode() { Node::set_human_readable_collision_renaming(true); - + pick_main_scene = memnew( ConfirmationDialog ); + gui_base->add_child(pick_main_scene); + pick_main_scene->get_ok()->set_text("Select"); + pick_main_scene->connect("confirmed",this,"_menu_option",varray(SETTINGS_PICK_MAIN_SCENE)); // Ref<ImageTexture> it = gui_base->get_icon("logo","Icons"); // OS::get_singleton()->set_icon( it->get_data() ); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 75565118bc..a0a03341fc 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -185,6 +185,7 @@ private: SETTINGS_LAYOUT_DELETE, SETTINGS_LAYOUT_DEFAULT, SETTINGS_LOAD_EXPORT_TEMPLATES, + SETTINGS_PICK_MAIN_SCENE, SETTINGS_HELP, SETTINGS_ABOUT, SOURCES_REIMPORT, @@ -287,6 +288,7 @@ private: ConfirmationDialog *confirmation; ConfirmationDialog *import_confirmation; ConfirmationDialog *open_recent_confirmation; + ConfirmationDialog *pick_main_scene; AcceptDialog *accept; AcceptDialog *about; AcceptDialog *warning; |