void ConnectDialog::popup_dialog(const String &p_for_signal, bool p_advanced) { advanced->set_pressed(p_advanced); from_signal->set_text(p_for_signal); error_label->add_color_override("font_color", get_color("error_color", "Editor")); vbc_right->set_visible(p_advanced); if (p_advanced) { popup_centered(Size2(900, 500) * EDSCALE); connect_to_label->set_text("Connect to Node:"); tree->set_connect_to_script_mode(false); error_label->hide(); } else { popup_centered(Size2(700, 500) * EDSCALE); connect_to_label->set_text("Connect to Script:"); tree->set_connect_to_script_mode(true); if (!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())) { error_label->show(); } else { error_label->hide(); } } }
void show_dialog() { project_path->clear(); project_name->clear(); if (import_mode) { set_title("Import Existing Project:"); pp->set_text("Project Path: (Must exist)"); pn->set_text("Project Name:"); pn->hide(); project_name->hide(); popup_centered(Size2(500,125)); } else { set_title("Create New Project:"); pp->set_text("Project Path:"); pn->set_text("Project Name:"); pn->show(); project_name->show(); popup_centered(Size2(500,145)); } _test_path(); }
void FindReplaceDialog::popup_replace() { set_title("Replace"); bool do_selection=(text_edit->is_selection_active() && text_edit->get_selection_from_line() < text_edit->get_selection_to_line()); set_replace_selection_only(do_selection); if (!do_selection && text_edit->is_selection_active()) { search_text->set_text(text_edit->get_selection_text()); } replace_mc->show(); replace_label->show(); replace_vb->show(); popup_centered(Point2(300,300)); if (search_text->get_text()!="" && replace_text->get_text()=="") { search_text->select(0,0); replace_text->grab_focus(); } else { search_text->grab_focus(); search_text->select_all(); } error_label->set_text(""); if (prompt->is_pressed()) { skip->show(); get_ok()->set_text("Next"); selection_only->set_disabled(true); } else { skip->hide(); get_ok()->set_text("Replace"); selection_only->set_disabled(false); } }
void EditorSettingsDialog::popup_edit_settings() { if (!EditorSettings::get_singleton()) return; EditorSettings::get_singleton()->list_text_editor_themes(); // make sure we have an up to date list of themes inspector->edit(EditorSettings::get_singleton()); inspector->get_inspector()->update_tree(); search_box->select_all(); search_box->grab_focus(); _update_shortcuts(); set_process_unhandled_input(true); // Restore valid window bounds or pop up at default size. if (EditorSettings::get_singleton()->has_setting("interface/dialogs/editor_settings_bounds")) { popup(EditorSettings::get_singleton()->get("interface/dialogs/editor_settings_bounds")); } else { Size2 popup_size = Size2(900, 700) * editor_get_scale(); Size2 window_size = get_viewport_rect().size; popup_size.x = MIN(window_size.x * 0.8, popup_size.x); popup_size.y = MIN(window_size.y * 0.8, popup_size.y); popup_centered(popup_size); } _focus_current_search_box(); }
void EditorReImportDialog::popup_reimport() { if (EditorFileSystem::get_singleton()->is_scanning()) { error->set_text("Please wait for scan to complete"); error->popup_centered(Size2(250,100)); return; } tree->clear(); items.clear(); List<String> ril; EditorFileSystem::get_singleton()->get_changed_sources(&ril); TreeItem *root = tree->create_item(); for(List<String>::Element *E=ril.front();E;E=E->next()) { TreeItem *item = tree->create_item(root); item->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); item->set_metadata(0,E->get()); item->set_text(0,E->get().replace_first("res://","")); item->set_tooltip(0,E->get()); item->set_checked(0,true); item->set_editable(0,true); items.push_back(item); } popup_centered(Size2(600,400)); }
void ProjectExportDialog::popup_export() { add_preset->get_popup()->clear(); for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) { Ref<EditorExportPlatform> plat = EditorExport::get_singleton()->get_export_platform(i); add_preset->get_popup()->add_icon_item(plat->get_logo(), plat->get_name()); } _update_presets(); if (presets->get_current() >= 0) { _edit_preset(presets->get_current()); // triggers rescan for templates if newly installed } // Restore valid window bounds or pop up at default size. if (EditorSettings::get_singleton()->has_setting("interface/dialogs/export_bounds")) { popup(EditorSettings::get_singleton()->get("interface/dialogs/export_bounds")); } else { Size2 popup_size = Size2(900, 700) * editor_get_scale(); Size2 window_size = get_viewport_rect().size; popup_size.x = MIN(window_size.x * 0.8, popup_size.x); popup_size.y = MIN(window_size.y * 0.8, popup_size.y); popup_centered(popup_size); } }
void EditorSceneImportDialog::popup_import(const String &p_from) { popup_centered(Size2(700,500)); if (p_from!="") { Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_from); if (rimd.is_null()) return; int flags = rimd->get_option("flags"); for(int i=0;i<scene_flags.size();i++) { int md = scene_flags[i]->get_metadata(0); scene_flags[i]->set_checked(0,flags&md); } texture_options->set_flags(rimd->get_option("texture_flags")); texture_options->set_format(EditorTextureImportPlugin::ImageFormat(int(rimd->get_option("texture_format")))); texture_options->set_quality(rimd->get_option("texture_quality")); animation_options->set_flags(rimd->get_option("animation_flags")); script_path->set_text(rimd->get_option("post_import_script")); save_path->set_text(p_from.get_base_dir()); import_path->set_text(EditorImportPlugin::expand_source_path(rimd->get_source_path(0))); } }
void popup_import(const String& p_path) { popup_centered(Size2(400,400)); if (p_path!="") { Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_path); ERR_FAIL_COND(!rimd.is_valid()); save_path->set_text(p_path.get_base_dir()); List<String> opts; rimd->get_options(&opts); for(List<String>::Element *E=opts.front();E;E=E->next()) { options->_set(E->get(),rimd->get_option(E->get())); } String src = ""; for(int i=0;i<rimd->get_source_count();i++) { if (i>0) src+=","; src+=EditorImportPlugin::expand_source_path(rimd->get_source_path(i)); } import_path->set_text(src); } }
void EditorReImportDialog::popup_reimport() { if (EditorFileSystem::get_singleton()->is_scanning()) { error->set_text(TTR("Please wait for scan to complete")); error->popup_centered_minsize(); return; } tree->clear(); items.clear(); List<String> ril; EditorFileSystem::get_singleton()->get_changed_sources(&ril); scene_must_save=false; TreeItem *root = tree->create_item(); for(List<String>::Element *E=ril.front();E;E=E->next()) { TreeItem *item = tree->create_item(root); item->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); item->set_metadata(0,E->get()); item->set_text(0,E->get().replace_first("res://","")); item->set_tooltip(0,E->get()); item->set_checked(0,true); item->set_editable(0,true); items.push_back(item); String name = E->get(); if (EditorFileSystem::get_singleton()->get_file_type(name)=="PackedScene" && EditorNode::get_singleton()->is_scene_in_use(name)) { scene_must_save=true; } } if (scene_must_save) { if (EditorNode::get_singleton()->get_edited_scene() && EditorNode::get_singleton()->get_edited_scene()->get_filename()=="") { error->set_text(TTR("Current scene must be saved to re-import.")); error->popup_centered_minsize(); get_ok()->set_text(TTR("Re-Import")); get_ok()->set_disabled(true); return; } get_ok()->set_disabled(false); get_ok()->set_text(TTR("Save & Re-Import")); } else { get_ok()->set_text(TTR("Re-Import")); get_ok()->set_disabled(false); } popup_centered(Size2(600,400)); }
void GotoLineDialog::popup_find_line(TextEdit *p_edit) { text_editor=p_edit; line->set_text(itos(text_editor->cursor_get_line())); line->select_all(); popup_centered(Size2(180,80)); line->grab_focus(); }
void popup_import(const String& p_from) { popup_centered(Size2(400,400)); if (p_from!="") { Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_from); ERR_FAIL_COND(!rimd.is_valid()); ERR_FAIL_COND(rimd->get_source_count()!=1); _choose_file(EditorImportPlugin::expand_source_path(rimd->get_source_path(0))); _choose_save_dir(p_from.get_base_dir()); String locale = rimd->get_option("locale"); bool skip_first=rimd->get_option("skip_first"); bool compressed = rimd->get_option("compress"); int idx=-1; for(int i=0;i<items.size();i++) { String il = TranslationServer::get_all_locales()[items[i]->get_range(1)]; if (il==locale) { idx=i; break; } } if (idx!=-1) { idx=rimd->get_option("index"); } for(int i=0;i<items.size();i++) { if (i==idx) { Vector<String> locs = TranslationServer::get_all_locales(); for(int j=0;j<locs.size();j++) { if (locs[j]==locale) { items[i]->set_range(1,j); } } items[i]->set_checked(0,true); } else { items[i]->set_checked(0,false); } } ignore_first->set_pressed(skip_first); compress->set_pressed(compressed); } }
void show_dialog() { project_path->clear(); project_name->clear(); if (mode==MODE_IMPORT) { set_title(TTR("Import Existing Project")); get_ok()->set_text(TTR("Import")); pp->set_text(TTR("Project Path (Must Exist):")); pn->set_text(TTR("Project Name:")); pn->hide(); project_name->hide(); popup_centered(Size2(500,125)*EDSCALE); } else if (mode==MODE_NEW){ set_title(TTR("Create New Project")); get_ok()->set_text(TTR("Create")); pp->set_text(TTR("Project Path:")); pn->set_text(TTR("Project Name:")); pn->show(); project_name->show(); popup_centered(Size2(500,145)*EDSCALE); } else if (mode==MODE_INSTALL){ set_title(TTR("Install Project:")+" "+zip_title); get_ok()->set_text(TTR("Install")); pp->set_text(TTR("Project Path:")); pn->hide(); project_name->hide(); popup_centered(Size2(500,125)*EDSCALE); } _test_path(); }
void GroupDialog::edit() { popup_centered(Size2(600, 400)); groups->clear(); groups_root = groups->create_item(); nodes_to_add->clear(); nodes_to_remove->clear(); add_group_text->clear(); add_filter->clear(); remove_filter->clear(); _load_groups(scene_tree->get_edited_scene_root()); }
void FindReplaceDialog::popup_search() { set_title(TTR("Search")); replace_mc->hide(); replace_label->hide(); replace_vb->hide(); skip->hide(); popup_centered(Point2(300, 190)); get_ok()->set_text(TTR("Find")); search_text->grab_focus(); if (text_edit->is_selection_active() && (text_edit->get_selection_from_line() == text_edit->get_selection_to_line())) { search_text->set_text(text_edit->get_selection_text()); } search_text->select_all(); error_label->set_text(""); }
void popup_import(const String& p_path) { popup_centered(Size2(400, 100)*EDSCALE); if (p_path != "") { Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_path); ERR_FAIL_COND(!rimd.is_valid()); save_path->set_text(p_path.get_base_dir()); String src = ""; for (int i = 0; i<rimd->get_source_count(); i++) { if (i>0) src += ","; src += EditorImportPlugin::expand_source_path(rimd->get_source_path(i)); } import_path->set_text(src); } }
void EditorTextureImportDialog::popup_import(const String& p_from) { popup_centered(Size2(400,400)); if (p_from!="") { Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_from); ERR_FAIL_COND(!rimd.is_valid()); save_path->set_text(p_from.get_base_dir()); texture_options->set_format(EditorTextureImportPlugin::ImageFormat(int(rimd->get_option("format")))); texture_options->set_flags(rimd->get_option("flags")); texture_options->set_quality(rimd->get_option("quality")); String src = ""; for(int i=0;i<rimd->get_source_count();i++) { if (i>0) src+=","; src+=EditorImportPlugin::expand_source_path(rimd->get_source_path(i)); } import_path->set_text(src); } }
void Popup::popup_centered_minsize(const Size2& p_minsize) { Size2 total_minsize=p_minsize; for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); if (!c) continue; Size2 minsize = c->get_combined_minimum_size(); for(int j=0;j<2;j++) { Margin m_beg = Margin(0+j); Margin m_end = Margin(2+j); float margin_begin = c->get_margin(m_beg); float margin_end = c->get_margin(m_end); AnchorType anchor_begin = c->get_anchor(m_beg); AnchorType anchor_end = c->get_anchor(m_end); if (anchor_begin == ANCHOR_BEGIN) minsize[j]+=margin_begin; if (anchor_end == ANCHOR_END) minsize[j]+=margin_end; } total_minsize.width = MAX( total_minsize.width, minsize.width ); total_minsize.height = MAX( total_minsize.height, minsize.height ); } popup_centered( total_minsize ); }
void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) { type_list.clear(); ClassDB::get_class_list(&type_list); ScriptServer::get_global_class_list(&type_list); type_list.sort_custom<StringName::AlphCompare>(); recent->clear(); FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("create_recent." + base_type), FileAccess::READ); if (f) { TreeItem *root = recent->create_item(); while (!f->eof_reached()) { String l = f->get_line().strip_edges(); if (l != String()) { TreeItem *ti = recent->create_item(root); ti->set_text(0, l); ti->set_icon(0, _get_editor_icon(l)); } } memdelete(f); } favorites->clear(); f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("favorites." + base_type), FileAccess::READ); favorite_list.clear(); if (f) { while (!f->eof_reached()) { String l = f->get_line().strip_edges(); if (l != String()) { favorite_list.push_back(l); } } memdelete(f); } _update_favorite_list(); // Restore valid window bounds or pop up at default size. if (EditorSettings::get_singleton()->has_setting("interface/dialogs/create_new_node_bounds")) { popup(EditorSettings::get_singleton()->get("interface/dialogs/create_new_node_bounds")); } else { Size2 popup_size = Size2(900, 700) * editor_get_scale(); Size2 window_size = get_viewport_rect().size; popup_size.x = MIN(window_size.x * 0.8, popup_size.x); popup_size.y = MIN(window_size.y * 0.8, popup_size.y); popup_centered(popup_size); } if (p_dont_clear) { search_box->select_all(); } else { search_box->clear(); } search_box->grab_focus(); _update_search(); bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines"); Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color"); if (enable_rl) { search_options->add_constant_override("draw_relationship_lines", 1); search_options->add_color_override("relationship_line_color", rl_color); } else { search_options->add_constant_override("draw_relationship_lines", 0); } is_replace_mode = p_replace_mode; if (p_replace_mode) { set_title(vformat(TTR("Change %s Type"), base_type)); get_ok()->set_text(TTR("Change")); } else { set_title(vformat(TTR("Create New %s"), base_type)); get_ok()->set_text(TTR("Create")); } }