EditorHelpSearch::EditorHelpSearch(EditorNode *p_editor) { editor=p_editor; VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); HBoxContainer *sb_hb = memnew( HBoxContainer); search_box = memnew( LineEdit ); sb_hb->add_child(search_box); search_box->set_h_size_flags(SIZE_EXPAND_FILL); Button *sb = memnew( Button("Search")); sb->connect("pressed",this,"_update_search"); sb_hb->add_child(sb); vbc->add_margin_child("Search:",sb_hb); search_box->connect("text_changed",this,"_text_changed"); search_box->connect("input_event",this,"_sbox_input"); search_options = memnew( Tree ); vbc->add_margin_child("Matches:",search_options,true); get_ok()->set_text("View"); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); set_title("Search Classes"); // search_options->set_hide_root(true); }
ReparentDialog::ReparentDialog() { set_title(TTR("Reparent Node")); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); tree = memnew( SceneTreeEditor(false) ); tree->set_show_enabled_subscene(true); vbc->add_margin_child(TTR("Reparent Location (Select new Parent):"),tree,true); tree->get_scene_tree()->connect("item_activated",this,"_reparent"); //Label *label = memnew( Label ); //label->set_pos( Point2( 15,8) ); //label->set_text("Reparent Location (Select new Parent):"); keep_transform = memnew( CheckBox ); keep_transform->set_text(TTR("Keep Global Transform")); keep_transform->set_pressed(true); vbc->add_child(keep_transform); //vbc->add_margin_child("Options:",node_only);; //cancel->connect("pressed", this,"_cancel"); get_ok()->set_text(TTR("Reparent")); }
EditorMeshImportDialog(EditorMeshImportPlugin *p_plugin) { plugin=p_plugin; set_title(TTR("Single Mesh Import")); set_hide_on_ok(false); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); HBoxContainer *hbc = memnew( HBoxContainer ); vbc->add_margin_child(TTR("Source Mesh(es):"),hbc); import_path = memnew( LineEdit ); import_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(import_path); Button * import_choose = memnew( Button ); import_choose->set_text(" .. "); hbc->add_child(import_choose); import_choose->connect("pressed", this,"_browse"); hbc = memnew( HBoxContainer ); vbc->add_margin_child(TTR("Target Path:"),hbc); save_path = memnew( LineEdit ); save_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(save_path); Button * save_choose = memnew( Button ); save_choose->set_text(" .. "); hbc->add_child(save_choose); save_choose->connect("pressed", this,"_browse_target"); file_select = memnew( EditorFileDialog ); file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES); file_select->add_filter("*.obj ; Wavefront OBJ"); add_child(file_select); file_select->connect("files_selected", this,"_choose_files"); save_select = memnew( EditorDirDialog ); add_child(save_select); save_select->connect("dir_selected", this,"_choose_save_dir"); get_ok()->connect("pressed", this,"_import"); get_ok()->set_text(TTR("Import")); error_dialog = memnew( AcceptDialog ); add_child(error_dialog); options = memnew( _EditorMeshImportOptions ); option_editor = memnew( PropertyEditor ); option_editor->hide_top_label(); vbc->add_margin_child(TTR("Options:"),option_editor,true); }
PropertySelector::PropertySelector() { VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); search_box = memnew( LineEdit ); vbc->add_margin_child(TTR("Search:"),search_box); search_box->connect("text_changed",this,"_text_changed"); search_box->connect("input_event",this,"_sbox_input"); search_options = memnew( Tree ); vbc->add_margin_child(TTR("Matches:"),search_options,true); get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); search_options->connect("cell_selected",this,"_item_selected"); search_options->set_hide_root(true); search_options->set_hide_folding(true); help_bit = memnew( EditorHelpBit ); vbc->add_margin_child(TTR("Description:"),help_bit); help_bit->connect("request_hide",this,"_closed"); }
NewProjectDialog() { VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); Label* l = memnew(Label); l->set_text("Project Path:"); vb->add_child(l); pp=l; project_path = memnew( LineEdit ); MarginContainer *mc = memnew( MarginContainer ); vb->add_child(mc); HBoxContainer *pphb = memnew( HBoxContainer ); mc->add_child(pphb); pphb->add_child(project_path); project_path->set_h_size_flags(SIZE_EXPAND_FILL); Button* browse = memnew( Button ); pphb->add_child(browse); browse->set_text("Browse"); browse->connect("pressed", this,"_browse_path"); l = memnew(Label); l->set_text("Project Name:"); l->set_pos(Point2(5,50)); vb->add_child(l); pn=l; project_name = memnew( LineEdit ); mc = memnew( MarginContainer ); vb->add_child(mc); mc->add_child(project_name); project_name->set_text("New Game Project"); l = memnew(Label); l->set_text("That's a BINGO!"); vb->add_child(l); error=l; l->add_color_override("font_color",Color(1,0.4,0.3,0.8)); l->set_align(Label::ALIGN_CENTER); get_ok()->set_text("Create"); DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); project_path->set_text(d->get_current_dir()); memdelete(d); fdialog = memnew( FileDialog ); add_child(fdialog); fdialog->set_access(FileDialog::ACCESS_FILESYSTEM); project_name->connect("text_changed", this,"_text_changed"); project_path->connect("text_changed", this,"_path_text_changed"); fdialog->connect("dir_selected", this,"_path_selected"); fdialog->connect("file_selected", this,"_file_selected"); set_hide_on_ok(false); import_mode=false; }
OrphanResourcesDialog::OrphanResourcesDialog(){ VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); files = memnew( Tree ); files->set_columns(2); files->set_column_titles_visible(true); files->set_column_min_width(1,100); files->set_column_expand(0,true); files->set_column_expand(1,false); files->set_column_title(0,"Resource"); files->set_column_title(1,TTR("Owns")); files->set_hide_root(true); vbc->add_margin_child(TTR("Resources Without Explicit Ownership:"),files,true); set_title(TTR("Orphan Resource Explorer")); delete_confirm = memnew( ConfirmationDialog ); delete_confirm->set_text(TTR("Delete selected files?")); get_ok()->set_text(TTR("Delete")); add_child(delete_confirm); dep_edit = memnew( DependencyEditor ); add_child(dep_edit); files->connect("button_pressed",this,"_button_pressed"); delete_confirm->connect("confirmed",this,"_delete_confirm"); set_hide_on_ok(false); }
DependencyEditorOwners::DependencyEditorOwners() { owners = memnew( ItemList ); add_child(owners); set_child_rect(owners); }
CreateDialog::CreateDialog() { HSplitContainer *hbc = memnew(HSplitContainer); add_child(hbc); set_child_rect(hbc); VBoxContainer *lvbc = memnew(VBoxContainer); hbc->add_child(lvbc); lvbc->set_custom_minimum_size(Size2(150, 0) * EDSCALE); favorites = memnew(Tree); lvbc->add_margin_child(TTR("Favorites:"), favorites, true); favorites->set_hide_root(true); favorites->set_hide_folding(true); favorites->connect("cell_selected", this, "_favorite_selected"); favorites->connect("item_activated", this, "_favorite_activated"); favorites->set_drag_forwarding(this); recent = memnew(Tree); lvbc->add_margin_child(TTR("Recent:"), recent, true); recent->set_hide_root(true); recent->set_hide_folding(true); recent->connect("cell_selected", this, "_history_selected"); recent->connect("item_activated", this, "_history_activated"); VBoxContainer *vbc = memnew(VBoxContainer); hbc->add_child(vbc); vbc->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *search_hb = memnew(HBoxContainer); search_box = memnew(LineEdit); search_box->set_h_size_flags(SIZE_EXPAND_FILL); search_hb->add_child(search_box); favorite = memnew(Button); favorite->set_toggle_mode(true); search_hb->add_child(favorite); favorite->connect("pressed", this, "_favorite_toggled"); vbc->add_margin_child(TTR("Search:"), search_hb); search_box->connect("text_changed", this, "_text_changed"); search_box->connect("input_event", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Create")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated", this, "_confirmed"); search_options->connect("cell_selected", this, "_item_selected"); // search_options->set_hide_root(true); base_type = "Object"; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); help_bit->connect("request_hide", this, "_closed"); }
EditorReImportDialog::EditorReImportDialog() { tree = memnew( Tree ); add_child(tree); tree->set_hide_root(true); set_child_rect(tree); set_title("Re-Import Changed Resources"); error = memnew( AcceptDialog); add_child(error); }
SceneTreeDialog::SceneTreeDialog() { set_title(TTR("Select a Node")); tree = memnew( SceneTreeEditor(false,false) ); add_child(tree); set_child_rect(tree); tree->get_scene_tree()->connect("item_activated",this,"_select"); }
EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { VBoxContainer *vbox = memnew( VBoxContainer ); add_child(vbox); set_child_rect(vbox); HBoxContainer *hbox = memnew( HBoxContainer); vbox->add_child(hbox); vbox->add_constant_override("separation",15); VBoxContainer *desc_vbox = memnew( VBoxContainer ); hbox->add_child(desc_vbox); hbox->add_constant_override("separation",15); item = memnew( EditorAssetLibraryItem ); desc_vbox->add_child(item); desc_vbox->set_custom_minimum_size(Size2(300,0)); PanelContainer * desc_bg = memnew( PanelContainer ); desc_vbox->add_child(desc_bg); desc_bg->set_v_size_flags(SIZE_EXPAND_FILL); description = memnew( RichTextLabel ); description->connect("meta_clicked",this,"_link_click"); //desc_vbox->add_child(description); desc_bg->add_child(description); desc_bg->add_style_override("panel",get_stylebox("normal","TextEdit")); preview = memnew( TextureFrame ); preview->set_custom_minimum_size(Size2(640,345)); hbox->add_child(preview); PanelContainer * previews_bg = memnew( PanelContainer ); vbox->add_child(previews_bg); previews_bg->set_custom_minimum_size(Size2(0,85)); previews_bg->add_style_override("panel",get_stylebox("normal","TextEdit")); previews = memnew( ScrollContainer ); previews_bg->add_child(previews); previews->set_enable_v_scroll(false); previews->set_enable_h_scroll(true); preview_hb = memnew( HBoxContainer ); preview_hb->set_v_size_flags(SIZE_EXPAND_FILL); previews->add_child(preview_hb); get_ok()->set_text("Install"); get_cancel()->set_text("Close"); }
DependencyRemoveDialog::DependencyRemoveDialog() { VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); text = memnew( Label ); vb->add_child(text); owners = memnew( Tree ); owners->set_hide_root(true); vb->add_child(owners); owners->set_v_size_flags(SIZE_EXPAND_FILL); get_ok()->set_text(TTR("Remove")); }
EditorHelpIndex::EditorHelpIndex() { VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); class_list = memnew( Tree ); vbc->add_margin_child("Class List: ",class_list,true); class_list->set_v_size_flags(SIZE_EXPAND_FILL); class_list->connect("item_activated",this,"_tree_item_selected"); get_ok()->set_text("Open"); }
DependencyEditorOwners::DependencyEditorOwners(EditorNode *p_editor) { editor = p_editor; file_options = memnew(PopupMenu); add_child(file_options); file_options->connect("item_pressed", this, "_file_option"); owners = memnew(ItemList); owners->set_select_mode(ItemList::SELECT_SINGLE); owners->connect("item_rmb_selected", this, "_list_rmb_select"); owners->connect("item_activated", this, "_select_file"); owners->set_allow_rmb_select(true); add_child(owners); set_child_rect(owners); }
ConnectionsDialog::ConnectionsDialog(EditorNode *p_editor) { editor=p_editor; set_title("Edit Connections.."); set_hide_on_ok(false); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); tree = memnew( Tree ); tree->set_columns(1); tree->set_select_mode(Tree::SELECT_ROW); tree->set_hide_root(true); vbc->add_margin_child("Connections:",tree,true); // add_child(tree); connect_dialog = memnew( ConnectDialog ); connect_dialog->set_as_toplevel(true); add_child(connect_dialog); remove_confirm = memnew( ConfirmationDialog ); remove_confirm->set_as_toplevel(true); add_child(remove_confirm); /* node_only->set_anchor( MARGIN_TOP, ANCHOR_END ); node_only->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); node_only->set_anchor( MARGIN_RIGHT, ANCHOR_END ); node_only->set_begin( Point2( 20,51) ); node_only->set_end( Point2( 10,44) ); */ remove_confirm->connect("confirmed", this,"_remove_confirm"); connect_dialog->connect("connected", this,"_connect"); tree->connect("item_selected", this,"_something_selected"); get_cancel()->set_text("Close"); }
EditorQuickOpen::EditorQuickOpen() { VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); search_box = memnew( LineEdit ); vbc->add_margin_child("Search:",search_box); search_box->connect("text_changed",this,"_text_changed"); search_box->connect("input_event",this,"_sbox_input"); search_options = memnew( Tree ); vbc->add_margin_child("Matches:",search_options,true); get_ok()->set_text("Open"); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); search_options->set_hide_root(true); }
EditorAssetInstaller::EditorAssetInstaller() { VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); tree = memnew( Tree ); vb->add_margin_child("Package Contents:",tree,true); tree->connect("item_edited",this,"_item_edited"); error = memnew( AcceptDialog) ; add_child(error); get_ok()->set_text("Install"); set_title("Package Installer"); updating=false; set_hide_on_ok(true); }
DependencyErrorDialog::DependencyErrorDialog() { VBoxContainer *vb = memnew(VBoxContainer); add_child(vb); set_child_rect(vb); files = memnew(Tree); files->set_hide_root(true); vb->add_margin_child(TTR("Scene failed to load due to missing dependencies:"), files, true); files->set_v_size_flags(SIZE_EXPAND_FILL); get_ok()->set_text(TTR("Open Anyway")); text = memnew(Label); vb->add_child(text); text->set_text(TTR("Which action should be taken?")); fdep = add_button(TTR("Fix Dependencies"), true, "fixdeps"); set_title(TTR("Errors loading!")); }
CreateDialog::CreateDialog() { VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); search_box = memnew( LineEdit ); vbc->add_margin_child(TTR("Search:"),search_box); search_box->connect("text_changed",this,"_text_changed"); search_box->connect("input_event",this,"_sbox_input"); search_options = memnew( Tree ); vbc->add_margin_child(TTR("Matches:"),search_options,true); get_ok()->set_text(TTR("Create")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); // search_options->set_hide_root(true); base_type="Object"; }
CreateDialog::CreateDialog() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); set_child_rect(vbc); get_ok()->set_text("Create"); tree = memnew(Tree); vbc->add_margin_child("Type:", tree, true); //tree->set_hide_root(true); filter = memnew(LineEdit); vbc->add_margin_child("Filter:", filter); base = "Node"; set_as_toplevel(true); tree->connect("item_activated", this, "_create"); filter->connect("text_changed", this, "_text_changed"); }
DependencyEditor::DependencyEditor() { VBoxContainer *vb = memnew( VBoxContainer ); vb->set_name(TTR("Dependencies")); add_child(vb); set_child_rect(vb); tree = memnew( Tree ); tree->set_columns(2); tree->set_column_titles_visible(true); tree->set_column_title(0,"Resource"); tree->set_column_title(1,"Path"); tree->set_hide_root(true); tree->connect("button_pressed",this,"_load_pressed"); HBoxContainer *hbc = memnew( HBoxContainer ); Label *label = memnew( Label(TTR("Dependencies:"))); hbc->add_child(label); hbc->add_spacer(); fixdeps = memnew( Button(TTR("Fix Broken"))); hbc->add_child(fixdeps); fixdeps->connect("pressed",this,"_fix_all"); vb->add_child(hbc); MarginContainer *mc = memnew( MarginContainer ); mc->set_v_size_flags(SIZE_EXPAND_FILL); mc->add_child(tree); vb->add_child(mc); set_title(TTR("Dependency Editor")); search = memnew( EditorFileDialog ); search->connect("file_selected",this,"_searched"); search->set_mode(EditorFileDialog::MODE_OPEN_FILE); search->set_title(TTR("Search Replacement Resource:")); add_child(search); }
EditorSubScene::EditorSubScene() { set_title("Select Sub-Scene.."); VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); HBoxContainer *hb = memnew( HBoxContainer ); path = memnew( LineEdit ); path->connect("text_entered",this,"_path_changed"); hb->add_child(path); path->set_h_size_flags(SIZE_EXPAND_FILL); Button *b = memnew( Button ); b->set_text(" .. "); hb->add_child(b); b->connect("pressed",this,"_path_browse"); vb->add_margin_child("Scene Path:",hb); tree = memnew( Tree ); tree->set_v_size_flags(SIZE_EXPAND_FILL); vb->add_margin_child("Import From Node:",tree)->set_v_size_flags(SIZE_EXPAND_FILL); file_dialog = memnew( FileDialog ); List<String> extensions; ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions); for(List<String>::Element *E = extensions.front();E;E=E->next() ) { file_dialog->add_filter("*."+E->get()); } file_dialog->set_mode(FileDialog::MODE_OPEN_FILE); add_child(file_dialog); file_dialog->connect("file_selected",this,"_path_selected"); scene=NULL; set_hide_on_ok(false); }
EditorHelpIndex::EditorHelpIndex() { VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); search_box = memnew( LineEdit ); vbc->add_margin_child(TTR("Search:"), search_box); search_box->set_h_size_flags(SIZE_EXPAND_FILL); register_text_enter(search_box); search_box->connect("text_changed", this, "_text_changed"); search_box->connect("input_event", this, "_sbox_input"); class_list = memnew( Tree ); vbc->add_margin_child(TTR("Class List:")+" ", class_list, true); class_list->set_v_size_flags(SIZE_EXPAND_FILL); class_list->connect("item_activated",this,"_tree_item_selected"); get_ok()->set_text(TTR("Open")); }
EditorTranslationImportDialog(EditorTranslationImportPlugin *p_plugin) { plugin=p_plugin; set_title(TTR("Import Translation")); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); VBoxContainer *csvb = memnew( VBoxContainer ); HBoxContainer *hbc = memnew( HBoxContainer ); csvb->add_child(hbc); vbc->add_margin_child(TTR("Source CSV:"),csvb); import_path = memnew( LineEdit ); import_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(import_path); ignore_first = memnew( CheckButton ); ignore_first->set_text(TTR("Ignore First Row")); csvb->add_child(ignore_first); Button * import_choose = memnew( Button ); import_choose->set_text(" .. "); hbc->add_child(import_choose); import_choose->connect("pressed", this,"_browse"); VBoxContainer *tcomp = memnew( VBoxContainer); hbc = memnew( HBoxContainer ); tcomp->add_child(hbc); vbc->add_margin_child(TTR("Target Path:"),tcomp); save_path = memnew( LineEdit ); save_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(save_path); Button * save_choose = memnew( Button ); save_choose->set_text(" .. "); hbc->add_child(save_choose); save_choose->connect("pressed", this,"_browse_target"); compress = memnew( CheckButton); compress->set_pressed(true); compress->set_text(TTR("Compress")); tcomp->add_child(compress); add_to_project = memnew( CheckButton); add_to_project->set_pressed(true); add_to_project->set_text(TTR("Add to Project (engine.cfg)")); tcomp->add_child(add_to_project); file_select = memnew(EditorFileDialog); file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM); add_child(file_select); file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE); file_select->connect("file_selected", this,"_choose_file"); file_select->add_filter("*.csv ; Translation CSV"); save_select = memnew( EditorDirDialog ); add_child(save_select); // save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR); save_select->connect("dir_selected", this,"_choose_save_dir"); get_ok()->connect("pressed", this,"_import"); get_ok()->set_text(TTR("Import")); error_dialog = memnew ( ConfirmationDialog ); add_child(error_dialog); error_dialog->get_ok()->set_text(TTR("Accept")); // error_dialog->get_cancel()->hide(); set_hide_on_ok(false); columns = memnew( Tree ); vbc->add_margin_child(TTR("Import Languages:"),columns,true); }
EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSceneImportPlugin *p_plugin) { editor=p_editor; plugin=p_plugin; set_title("Import 3D Scene"); HBoxContainer *import_hb = memnew( HBoxContainer ); add_child(import_hb); set_child_rect(import_hb); VBoxContainer *vbc = memnew( VBoxContainer ); import_hb->add_child(vbc); vbc->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *hbc = memnew( HBoxContainer ); vbc->add_margin_child("Source Scene:",hbc); import_path = memnew( LineEdit ); import_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(import_path); Button * import_choose = memnew( Button ); import_choose->set_text(" .. "); hbc->add_child(import_choose); import_choose->connect("pressed", this,"_browse"); hbc = memnew( HBoxContainer ); vbc->add_margin_child("Target Scene:",hbc); save_path = memnew( LineEdit ); save_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(save_path); Button * save_choose = memnew( Button ); save_choose->set_text(" .. "); hbc->add_child(save_choose); save_choose->connect("pressed", this,"_browse_target"); texture_action = memnew( OptionButton ); texture_action->add_item("Same as Target Scene"); texture_action->add_item("Shared"); texture_action->select(0); vbc->add_margin_child("Target Texture Folder:",texture_action); import_options = memnew( Tree ); vbc->set_v_size_flags(SIZE_EXPAND_FILL); vbc->add_margin_child("Options:",import_options,true); file_select = memnew(FileDialog); file_select->set_access(FileDialog::ACCESS_FILESYSTEM); add_child(file_select); file_select->set_mode(FileDialog::MODE_OPEN_FILE); file_select->connect("file_selected", this,"_choose_file"); save_select = memnew(EditorDirDialog); add_child(save_select); //save_select->set_mode(FileDialog::MODE_SAVE_FILE); save_select->connect("dir_selected", this,"_choose_save_file"); get_ok()->connect("pressed", this,"_import"); get_ok()->set_text("Import"); TreeItem *root = import_options->create_item(NULL); import_options->set_hide_root(true); TreeItem *importopts = import_options->create_item(root); importopts->set_text(0,"Import:"); const FlagInfo* fn=scene_flag_names; while(fn->text) { TreeItem *opt = import_options->create_item(importopts); opt->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); opt->set_checked(0,true); opt->set_editable(0,true); opt->set_text(0,fn->text); opt->set_metadata(0,fn->value); scene_flags.push_back(opt); fn++; } hbc = memnew( HBoxContainer ); vbc->add_margin_child("Post-Process Script:",hbc); script_path = memnew( LineEdit ); script_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(script_path); Button * script_choose = memnew( Button ); script_choose->set_text(" .. "); hbc->add_child(script_choose); script_choose->connect("pressed", this,"_browse_script"); script_select = memnew(FileDialog); add_child(script_select); for(int i=0;i<ScriptServer::get_language_count();i++) { ScriptLanguage *sl=ScriptServer::get_language(i); String ext = sl->get_extension(); if (ext=="") continue; script_select->add_filter("*."+ext+" ; "+sl->get_name()); } script_select->set_mode(FileDialog::MODE_OPEN_FILE); script_select->connect("file_selected", this,"_choose_script"); error_dialog = memnew ( ConfirmationDialog ); add_child(error_dialog); error_dialog->get_ok()->set_text("Accept"); // error_dialog->get_cancel()->hide(); set_hide_on_ok(false); GLOBAL_DEF("import/shared_textures","res://"); Globals::get_singleton()->set_custom_property_info("import/shared_textures",PropertyInfo(Variant::STRING,"import/shared_textures",PROPERTY_HINT_DIR)); import_hb->add_constant_override("separation",30); VBoxContainer *ovb = memnew( VBoxContainer); ovb->set_h_size_flags(SIZE_EXPAND_FILL); import_hb->add_child(ovb); texture_options = memnew( EditorImportTextureOptions ); ovb->add_child(texture_options); texture_options->set_v_size_flags(SIZE_EXPAND_FILL); //animation_options->set_flags(EditorImport:: texture_options->set_format(EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM); texture_options->set_flags( EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA | EditorTextureImportPlugin::IMAGE_FLAG_REPEAT | EditorTextureImportPlugin::IMAGE_FLAG_FILTER ); animation_options = memnew( EditorImportAnimationOptions ); ovb->add_child(animation_options); animation_options->set_v_size_flags(SIZE_EXPAND_FILL); animation_options->set_flags(EditorSceneAnimationImportPlugin::ANIMATION_DETECT_LOOP|EditorSceneAnimationImportPlugin::ANIMATION_KEEP_VALUE_TRACKS|EditorSceneAnimationImportPlugin::ANIMATION_OPTIMIZE); confirm_import = memnew( ConfirmationDialog ); add_child(confirm_import); VBoxContainer *cvb = memnew( VBoxContainer ); confirm_import->add_child(cvb); confirm_import->set_child_rect(cvb); PanelContainer *pc = memnew( PanelContainer ); pc->add_style_override("panel",get_stylebox("normal","TextEdit")); //ec->add_child(pc); missing_files = memnew( RichTextLabel ); cvb->add_margin_child("The Following Files are Missing:",pc,true); pc->add_child(missing_files); confirm_import->get_ok()->set_text("Import Anyway"); confirm_import->get_cancel()->set_text("Cancel"); confirm_import->connect("popup_hide",this,"_dialog_hid"); confirm_import->connect("confirmed",this,"_import_confirm"); confirm_import->set_hide_on_ok(false); add_button("Import & Open",!OS::get_singleton()->get_swap_ok_cancel())->connect("pressed",this,"_open_and_import"); confirm_open = memnew( ConfirmationDialog ); add_child(confirm_open); confirm_open->set_text("Edited scene has not been saved, open imported scene anyway?"); confirm_open->connect("confirmed",this,"_import",varray(true)); wip_import=NULL; wip_blocked=false; wip_open=false; //texture_options->set_format(EditorImport::IMAGE_FORMAT_C); }
ScriptCreateDialog::ScriptCreateDialog() { /* SNAP DIALOG */ VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); class_name = memnew( LineEdit ); VBoxContainer *vb2 = memnew( VBoxContainer ); vb2->add_child(class_name); class_name->connect("text_changed", this,"_class_name_changed"); error_label = memnew(Label); error_label->set_text("valid chars: a-z A-Z 0-9 _"); error_label->set_align(Label::ALIGN_CENTER); vb2->add_child(error_label); vb->add_margin_child(TTR("Class Name:"),vb2); parent_name = memnew( LineEdit ); vb->add_margin_child(TTR("Inherits:"),parent_name); parent_name->connect("text_changed", this,"_class_name_changed"); language_menu = memnew( OptionButton ); vb->add_margin_child(TTR("Language"),language_menu); for(int i=0;i<ScriptServer::get_language_count();i++) { language_menu->add_item(ScriptServer::get_language(i)->get_name()); } editor_settings = EditorSettings::get_singleton(); String last_selected_language = editor_settings->get_last_selected_language(); if (last_selected_language != "") for (int i = 0; i < language_menu->get_item_count(); i++) if (language_menu->get_item_text(i) == last_selected_language) { language_menu->select(i); break; } else language_menu->select(0); language_menu->connect("item_selected",this,"_lang_changed"); //parent_name->set_text(); vb2 = memnew( VBoxContainer ); path_vb = memnew( VBoxContainer ); vb2->add_child(path_vb); HBoxContainer *hbc = memnew( HBoxContainer ); file_path = memnew( LineEdit ); file_path->connect("text_changed",this,"_path_changed"); hbc->add_child(file_path); file_path->set_h_size_flags(SIZE_EXPAND_FILL); Button *b = memnew( Button ); b->set_text(" .. "); b->connect("pressed",this,"_browse_path"); hbc->add_child(b); path_vb->add_child(hbc); path_error_label = memnew( Label ); path_vb->add_child( path_error_label ); path_error_label->set_text(TTR("Error!")); path_error_label->set_align(Label::ALIGN_CENTER); internal = memnew( CheckButton ); internal->set_text(TTR("Built-In Script")); vb2->add_child(internal); internal->connect("pressed",this,"_built_in_pressed"); vb->add_margin_child(TTR("Path:"),vb2); set_size(Size2(200,150)); set_hide_on_ok(false); set_title(TTR("Attach Node Script")); file_browse = memnew( EditorFileDialog ); file_browse->connect("file_selected",this,"_file_selected"); add_child(file_browse); get_ok()->set_text(TTR("Create")); alert = memnew( AcceptDialog ); add_child(alert); _lang_changed(0); create_new=true; }
FileDialog::FileDialog() { show_hidden_files=true; VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); mode=MODE_SAVE_FILE; set_title("Save a File"); dir = memnew(LineEdit); HBoxContainer *pathhb = memnew( HBoxContainer ); pathhb->add_child(dir); dir->set_h_size_flags(SIZE_EXPAND_FILL); drives = memnew( OptionButton ); pathhb->add_child(drives); drives->connect("item_selected",this,"_select_drive"); makedir = memnew( Button ); makedir->set_text("Create Folder"); makedir->connect("pressed",this,"_make_dir"); pathhb->add_child(makedir); vbc->add_margin_child("Path:",pathhb); tree = memnew(Tree); tree->set_hide_root(true); vbc->add_margin_child("Directories & Files:",tree,true); file = memnew(LineEdit); //add_child(file); vbc->add_margin_child("File:",file); filter = memnew( OptionButton ); //add_child(filter); vbc->add_margin_child("Filter:",filter); filter->set_clip_text(true);//too many extensions overflow it dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES); access=ACCESS_RESOURCES; _update_drives(); connect("confirmed", this,"_action_pressed"); //cancel->connect("pressed", this,"_cancel_pressed"); tree->connect("cell_selected", this,"_tree_selected",varray(),CONNECT_DEFERRED); tree->connect("item_activated", this,"_tree_db_selected",varray()); dir->connect("text_entered", this,"_dir_entered"); file->connect("text_entered", this,"_file_entered"); filter->connect("item_selected", this,"_filter_selected"); confirm_save = memnew( ConfirmationDialog ); confirm_save->set_as_toplevel(true); add_child(confirm_save); confirm_save->connect("confirmed", this,"_save_confirm_pressed"); makedialog = memnew( ConfirmationDialog ); makedialog->set_title("Create Folder"); VBoxContainer *makevb= memnew( VBoxContainer ); makedialog->add_child(makevb); makedialog->set_child_rect(makevb); makedirname = memnew( LineEdit ); makevb->add_margin_child("Name:",makedirname); add_child(makedialog); makedialog->register_text_enter(makedirname); makedialog->connect("confirmed",this,"_make_dir_confirm"); mkdirerr = memnew( AcceptDialog ); mkdirerr->set_text("Could not create folder."); add_child(mkdirerr); exterr = memnew( AcceptDialog ); exterr->set_text("Must use a valid extension."); add_child(exterr); //update_file_list(); update_filters(); update_dir(); set_hide_on_ok(false); vbox=vbc; invalidated=true; if (register_func) register_func(this); }
ProjectSettings::ProjectSettings(EditorData *p_data) { singleton=this; set_title("Project Settings (engine.cfg)"); undo_redo=&p_data->get_undo_redo(); data=p_data; TabContainer *tab_container = memnew( TabContainer ); add_child(tab_container); set_child_rect(tab_container); //tab_container->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 15 ); //tab_container->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 15 ); //tab_container->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 15 ); //tab_container->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); Control *props_base = memnew( Control ); tab_container->add_child(props_base); props_base->set_name("General"); globals_editor = memnew( PropertyEditor ); props_base->add_child(globals_editor); globals_editor->set_area_as_parent_rect(); globals_editor->hide_top_label(); globals_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 ); globals_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); globals_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 ); globals_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 ); globals_editor->set_capitalize_paths(false); globals_editor->get_tree()->connect("cell_selected",this,"_item_selected"); globals_editor->connect("property_toggled",this,"_item_checked"); globals_editor->connect("property_edited",this,"_settings_prop_edited"); Label *l = memnew( Label ); props_base->add_child(l); l->set_pos(Point2(6,5)); l->set_text("Category:"); l = memnew( Label ); l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); props_base->add_child(l); l->set_begin(Point2(0.21,5)); l->set_text("Property:"); l = memnew( Label ); l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); props_base->add_child(l); l->set_begin(Point2(0.51,5)); l->set_text("Type:"); category = memnew( LineEdit ); props_base->add_child(category); category->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); category->set_begin( Point2(5,25) ); category->set_end( Point2(0.20,26) ); category->connect("text_entered",this,"_item_adds"); property = memnew( LineEdit ); props_base->add_child(property); property->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); property->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); property->set_begin( Point2(0.21,25) ); property->set_end( Point2(0.50,26) ); property->connect("text_entered",this,"_item_adds"); type = memnew( OptionButton ); props_base->add_child(type); type->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); type->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); type->set_begin( Point2(0.51,25) ); type->set_end( Point2(0.70,26) ); type->add_item("bool"); type->add_item("int"); type->add_item("float"); type->add_item("string"); Button *add = memnew( Button ); props_base->add_child(add); add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); add->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); add->set_begin( Point2(0.71,25) ); add->set_end( Point2(0.85,26) ); add->set_text("Add"); add->connect("pressed",this,"_item_add"); Button *del = memnew( Button ); props_base->add_child(del); del->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); del->set_anchor(MARGIN_RIGHT,ANCHOR_END); del->set_begin( Point2(0.86,25) ); del->set_end( Point2(5,26) ); del->set_text("Del"); del->connect("pressed",this,"_item_del"); Button *save = memnew( Button ); props_base->add_child(save); save->set_anchor(MARGIN_LEFT,ANCHOR_END); save->set_anchor(MARGIN_RIGHT,ANCHOR_END); save->set_anchor(MARGIN_TOP,ANCHOR_END); save->set_anchor(MARGIN_BOTTOM,ANCHOR_END); save->set_begin( Point2(80,28) ); save->set_end( Point2(10,20) ); save->set_text("Save"); save->connect("pressed",this,"_save"); popup_platform = memnew( MenuButton ); popup_platform->set_text("Copy To Platform.."); popup_platform->set_disabled(true); props_base->add_child(popup_platform); popup_platform->set_anchor(MARGIN_LEFT,ANCHOR_BEGIN); popup_platform->set_anchor(MARGIN_RIGHT,ANCHOR_BEGIN); popup_platform->set_anchor(MARGIN_TOP,ANCHOR_END); popup_platform->set_anchor(MARGIN_BOTTOM,ANCHOR_END); popup_platform->set_begin( Point2(10,28) ); popup_platform->set_end( Point2(150,20) ); List<StringName> ep; EditorImportExport::get_singleton()->get_export_platforms(&ep); ep.sort_custom<StringName::AlphCompare>(); for(List<StringName>::Element *E=ep.front();E;E=E->next()) { popup_platform->get_popup()->add_item( E->get() ); } popup_platform->get_popup()->connect("item_pressed",this,"_copy_to_platform"); get_ok()->set_text("Close"); set_hide_on_ok(true); message = memnew( ConfirmationDialog ); add_child(message); // message->get_cancel()->hide(); message->set_hide_on_ok(true); Control *input_base = memnew( Control ); input_base->set_name("Input Map"); input_base->set_area_as_parent_rect();; tab_container->add_child(input_base); l = memnew( Label ); input_base->add_child(l); l->set_pos(Point2(6,5)); l->set_text("Action:"); action_name = memnew( LineEdit ); action_name->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); action_name->set_begin( Point2(5,25) ); action_name->set_end( Point2(0.85,26) ); input_base->add_child(action_name); action_name->connect("text_entered",this,"_action_adds"); add = memnew( Button ); input_base->add_child(add); add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); add->set_begin( Point2(0.86,25) ); add->set_anchor(MARGIN_RIGHT,ANCHOR_END); add->set_end( Point2(5,26) ); add->set_text("Add"); add->connect("pressed",this,"_action_add"); input_editor = memnew( Tree ); input_base->add_child(input_editor); input_editor->set_area_as_parent_rect(); input_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 ); input_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); input_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 ); input_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 ); input_editor->connect("item_edited",this,"_action_persist_toggle"); input_editor->connect("button_pressed",this,"_action_button_pressed"); popup_add = memnew( PopupMenu ); add_child(popup_add); popup_add->connect("item_pressed",this,"_add_item"); press_a_key = memnew( ConfirmationDialog ); press_a_key->set_focus_mode(FOCUS_ALL); add_child(press_a_key); l = memnew( Label ); l->set_text("Press a Key.."); l->set_area_as_parent_rect(); l->set_align(Label::ALIGN_CENTER); l->set_margin(MARGIN_TOP,20); l->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,30); press_a_key_label=l; press_a_key->add_child(l); press_a_key->connect("input_event",this,"_wait_for_key"); press_a_key->connect("confirmed",this,"_press_a_key_confirm"); device_input=memnew( ConfirmationDialog ); add_child(device_input); device_input->get_ok()->set_text("Add"); device_input->connect("confirmed",this,"_device_input_add"); l = memnew( Label ); l->set_text("Device:"); l->set_pos(Point2(15,10)); device_input->add_child(l); l = memnew( Label ); l->set_text("Index:"); l->set_pos(Point2(90,10)); device_input->add_child(l); device_index_label=l; device_id = memnew( SpinBox ); device_id->set_pos(Point2(20,30)); device_id->set_size(Size2(70,10)); device_id->set_val(0); device_input->add_child(device_id); device_index = memnew( OptionButton ); device_index->set_pos(Point2(95,30)); device_index->set_size(Size2(300,10)); device_index->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,10); device_input->add_child(device_index); save = memnew( Button ); input_base->add_child(save); save->set_anchor(MARGIN_LEFT,ANCHOR_END); save->set_anchor(MARGIN_RIGHT,ANCHOR_END); save->set_anchor(MARGIN_TOP,ANCHOR_END); save->set_anchor(MARGIN_BOTTOM,ANCHOR_END); save->set_begin( Point2(80,28) ); save->set_end( Point2(10,20) ); save->set_text("Save"); save->connect("pressed",this,"_save"); setting=false; //translations TabContainer *translations = memnew( TabContainer ); translations->set_name("Localization"); tab_container->add_child(translations); { VBoxContainer *tvb = memnew( VBoxContainer ); translations->add_child(tvb); tvb->set_name("Translations"); HBoxContainer *thb = memnew( HBoxContainer); tvb->add_child(thb); thb->add_child( memnew( Label("Translations:"))); thb->add_spacer(); Button *addtr = memnew( Button("Add..") ); addtr->connect("pressed",this,"_translation_file_open"); thb->add_child(addtr); MarginContainer *tmc = memnew( MarginContainer ); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_list = memnew( Tree ); translation_list->set_v_size_flags(SIZE_EXPAND_FILL); tmc->add_child(translation_list); translation_file_open=memnew( FileDialog ); add_child(translation_file_open); translation_file_open->set_mode(FileDialog::MODE_OPEN_FILE); translation_file_open->connect("file_selected",this,"_translation_add"); } { VBoxContainer *tvb = memnew( VBoxContainer ); translations->add_child(tvb); tvb->set_name("Remaps"); HBoxContainer *thb = memnew( HBoxContainer); tvb->add_child(thb); thb->add_child( memnew( Label("Resources:"))); thb->add_spacer(); Button *addtr = memnew( Button("Add..") ); addtr->connect("pressed",this,"_translation_res_file_open"); thb->add_child(addtr); MarginContainer *tmc = memnew( MarginContainer ); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap = memnew( Tree ); translation_remap->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap->connect("cell_selected",this,"_translation_res_select"); tmc->add_child(translation_remap); translation_remap->connect("button_pressed",this,"_translation_res_delete"); translation_res_file_open=memnew( FileDialog ); add_child(translation_res_file_open); translation_res_file_open->set_mode(FileDialog::MODE_OPEN_FILE); translation_res_file_open->connect("file_selected",this,"_translation_res_add"); thb = memnew( HBoxContainer); tvb->add_child(thb); thb->add_child( memnew( Label("Remaps by Locale:"))); thb->add_spacer(); addtr = memnew( Button("Add..") ); addtr->connect("pressed",this,"_translation_res_option_file_open"); translation_res_option_add_button=addtr; thb->add_child(addtr); tmc = memnew( MarginContainer ); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap_options = memnew( Tree ); translation_remap_options->set_v_size_flags(SIZE_EXPAND_FILL); tmc->add_child(translation_remap_options); translation_remap_options->set_columns(2); translation_remap_options->set_column_title(0,"Path"); translation_remap_options->set_column_title(1,"Locale"); translation_remap_options->set_column_titles_visible(true); translation_remap_options->set_column_expand(0,true); translation_remap_options->set_column_expand(1,false); translation_remap_options->set_column_min_width(1,200); translation_remap_options->connect("item_edited",this,"_translation_res_option_changed"); translation_remap_options->connect("button_pressed",this,"_translation_res_option_delete"); translation_res_option_file_open=memnew( FileDialog ); add_child(translation_res_option_file_open); translation_res_option_file_open->set_mode(FileDialog::MODE_OPEN_FILE); translation_res_option_file_open->connect("file_selected",this,"_translation_res_option_add"); } { VBoxContainer *avb = memnew( VBoxContainer ); tab_container->add_child(avb); avb->set_name("AutoLoad"); HBoxContainer *ahb = memnew( HBoxContainer); avb->add_child(ahb); VBoxContainer *avb_name = memnew( VBoxContainer ); avb_name->set_h_size_flags(SIZE_EXPAND_FILL); autoload_add_name = memnew(LineEdit); avb_name->add_margin_child("Node Name:",autoload_add_name); ahb->add_child(avb_name); VBoxContainer *avb_path = memnew( VBoxContainer ); avb_path->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *ahb_path = memnew( HBoxContainer ); autoload_add_path = memnew(LineEdit); autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); ahb_path->add_child(autoload_add_path); Button *browseaa = memnew( Button("..") ); ahb_path->add_child(browseaa); browseaa->connect("pressed",this,"_autoload_file_open"); Button *addaa = memnew( Button("Add") ); ahb_path->add_child(addaa); addaa->connect("pressed",this,"_autoload_add"); avb_path->add_margin_child("Path:",ahb_path); ahb->add_child(avb_path); autoload_list = memnew( Tree ); autoload_list->set_v_size_flags(SIZE_EXPAND_FILL); avb->add_margin_child("List:",autoload_list,true); autoload_file_open=memnew( FileDialog ); add_child(autoload_file_open); autoload_file_open->set_mode(FileDialog::MODE_OPEN_FILE); autoload_file_open->connect("file_selected",this,"_autoload_file_callback"); autoload_list->set_columns(2); autoload_list->set_column_titles_visible(true); autoload_list->set_column_title(0,"name"); autoload_list->set_column_title(1,"path"); autoload_list->connect("button_pressed",this,"_autoload_delete"); } timer = memnew( Timer ); timer->set_wait_time(1.5); timer->connect("timeout",Globals::get_singleton(),"save"); timer->set_one_shot(true); add_child(timer); updating_translations=false; /* Control * es = memnew( Control ); es->set_name("Export"); tab_container->add_child(es); export_settings = memnew( ProjectExportSettings ); es->add_child(export_settings); export_settings->set_area_as_parent_rect(); export_settings->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); */ }
FindReplaceDialog::FindReplaceDialog() { set_self_opacity(0.8); VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); search_text = memnew( LineEdit ); vb->add_margin_child("Search",search_text); search_text->connect("text_entered", this,"_search_text_entered"); //search_text->set_self_opacity(0.7); replace_label = memnew( Label); replace_label->set_text("Replace By"); vb->add_child(replace_label); replace_mc= memnew( MarginContainer); vb->add_child(replace_mc); replace_text = memnew( LineEdit ); replace_text->set_anchor( MARGIN_RIGHT, ANCHOR_END ); replace_text->set_begin( Point2(15,132) ); replace_text->set_end( Point2(15,135) ); //replace_text->set_self_opacity(0.7); replace_mc->add_child(replace_text); replace_text->connect("text_entered", this,"_replace_text_entered"); MarginContainer *opt_mg = memnew( MarginContainer ); vb->add_child(opt_mg); VBoxContainer *svb = memnew( VBoxContainer); opt_mg->add_child(svb); svb ->add_child(memnew(Label)); whole_words = memnew( CheckButton ); whole_words->set_text("Whole Words"); svb->add_child(whole_words); case_sensitive = memnew( CheckButton ); case_sensitive->set_text("Case Sensitive"); svb->add_child(case_sensitive); backwards = memnew( CheckButton ); backwards->set_text("Backwards"); svb->add_child(backwards); opt_mg = memnew( MarginContainer ); vb->add_child(opt_mg); VBoxContainer *rvb = memnew( VBoxContainer); opt_mg->add_child(rvb); replace_vb=rvb; // rvb ->add_child(memnew(HSeparator)); rvb ->add_child(memnew(Label)); prompt = memnew( CheckButton ); prompt->set_text("Prompt On Replace"); rvb->add_child(prompt); prompt->connect("pressed", this,"_prompt_changed"); selection_only = memnew( CheckButton ); selection_only->set_text("Selection Only"); rvb->add_child(selection_only); int margin = get_constant("margin","Dialogs"); int button_margin = get_constant("button_margin","Dialogs"); skip = memnew( Button ); skip->set_anchor( MARGIN_LEFT, ANCHOR_END ); skip->set_anchor( MARGIN_TOP, ANCHOR_END ); skip->set_anchor( MARGIN_RIGHT, ANCHOR_END ); skip->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); skip->set_begin( Point2( 70, button_margin ) ); skip->set_end( Point2( 10, margin ) ); skip->set_text("Skip"); add_child(skip); skip->connect("pressed", this,"_skip_pressed"); error_label = memnew( Label ); error_label->set_align(Label::ALIGN_CENTER); error_label->add_color_override("font_color",Color(1,0.4,0.3)); error_label->add_color_override("font_color_shadow",Color(0,0,0,0.2)); error_label->add_constant_override("shadow_as_outline",1); vb->add_child(error_label); set_hide_on_ok(false); }
EditorSampleImportDialog(EditorSampleImportPlugin *p_plugin) { plugin=p_plugin; set_title("Import Audio Samples"); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); HBoxContainer *hbc = memnew( HBoxContainer ); vbc->add_margin_child("Source Sample(s):",hbc); import_path = memnew( LineEdit ); import_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(import_path); Button * import_choose = memnew( Button ); import_choose->set_text(" .. "); hbc->add_child(import_choose); import_choose->connect("pressed", this,"_browse"); hbc = memnew( HBoxContainer ); vbc->add_margin_child("Target Path:",hbc); save_path = memnew( LineEdit ); save_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(save_path); Button * save_choose = memnew( Button ); save_choose->set_text(" .. "); hbc->add_child(save_choose); save_choose->connect("pressed", this,"_browse_target"); file_select = memnew(FileDialog); file_select->set_access(FileDialog::ACCESS_FILESYSTEM); add_child(file_select); file_select->set_mode(FileDialog::MODE_OPEN_FILES); file_select->connect("files_selected", this,"_choose_files"); file_select->add_filter("*.wav ; MS Waveform"); save_select = memnew( EditorDirDialog ); add_child(save_select); // save_select->set_mode(FileDialog::MODE_OPEN_DIR); save_select->connect("dir_selected", this,"_choose_save_dir"); get_ok()->connect("pressed", this,"_import"); get_ok()->set_text("Import"); error_dialog = memnew ( ConfirmationDialog ); add_child(error_dialog); error_dialog->get_ok()->set_text("Accept"); // error_dialog->get_cancel()->hide(); set_hide_on_ok(false); options = memnew( _EditorSampleImportOptions ); option_editor = memnew( PropertyEditor ); option_editor->hide_top_label(); vbc->add_margin_child("Options:",option_editor,true); }