EditorImportAnimationOptions::EditorImportAnimationOptions() { updating=false; flags = memnew( Tree ); flags->set_hide_root(true); TreeItem *root = flags->create_item(); const char ** fname=anim_flag_names; const char ** fdescr=anim_flag_descript; while( *fname ) { TreeItem*ti = flags->create_item(root); ti->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); ti->set_text(0,*fname); ti->set_editable(0,true); ti->set_tooltip(0,*fdescr); items.push_back(ti); fname++; fdescr++; } add_margin_child("Animation Options",flags,true); }
ImportDock::ImportDock() { imported = memnew(LineEdit); imported->set_editable(false); add_child(imported); HBoxContainer *hb = memnew(HBoxContainer); add_margin_child(TTR("Import As:"), hb); import_as = memnew(OptionButton); hb->add_child(import_as); import_as->set_h_size_flags(SIZE_EXPAND_FILL); preset = memnew(MenuButton); preset->set_text(TTR("Preset..")); preset->get_popup()->connect("index_pressed", this, "_preset_selected"); hb->add_child(preset); import_opts = memnew(PropertyEditor); add_child(import_opts); import_opts->set_v_size_flags(SIZE_EXPAND_FILL); import_opts->hide_top_label(); import_opts->set_hide_script(true); hb = memnew(HBoxContainer); add_child(hb); import = memnew(Button); import->set_text(TTR("Reimport")); import->connect("pressed", this, "_reimport"); hb->add_spacer(); hb->add_child(import); hb->add_spacer(); params = memnew(ImportDockParameters); import_opts->edit(params); }
EditorAutoloadSettings::EditorAutoloadSettings() { autoload_changed = "autoload_changed"; updating_autoload = false; selected_autoload = ""; HBoxContainer *hbc = memnew( HBoxContainer ); add_child(hbc); VBoxContainer *vbc_path = memnew( VBoxContainer ); vbc_path->set_h_size_flags(SIZE_EXPAND_FILL); autoload_add_path = memnew( EditorLineEditFileChooser ); autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE); autoload_add_path->get_file_dialog()->connect("file_selected", this, "_autoload_file_callback"); vbc_path->add_margin_child(TTR("Path:"), autoload_add_path); hbc->add_child(vbc_path); VBoxContainer *vbc_name = memnew( VBoxContainer ); vbc_name->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *hbc_name = memnew( HBoxContainer ); autoload_add_name = memnew( LineEdit ); autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL); hbc_name->add_child(autoload_add_name); Button *add_autoload = memnew( Button ); add_autoload->set_text(TTR("Add")); hbc_name->add_child(add_autoload); add_autoload->connect("pressed", this, "_autoload_add"); vbc_name->add_margin_child(TTR("Node Name:"), hbc_name); hbc->add_child(vbc_name); tree = memnew( Tree ); tree->set_hide_root(true); tree->set_select_mode(Tree::SELECT_MULTI); tree->set_single_select_cell_editing_only_when_already_selected(true); tree->set_drag_forwarding(this); tree->set_columns(4); tree->set_column_titles_visible(true); tree->set_column_title(0,TTR("Name")); tree->set_column_expand(0,true); tree->set_column_min_width(0,100); tree->set_column_title(1,TTR("Path")); tree->set_column_expand(1,true); tree->set_column_min_width(1,100); tree->set_column_title(2,TTR("Singleton")); tree->set_column_expand(2,false); tree->set_column_min_width(2,80); tree->set_column_expand(3,false); tree->set_column_min_width(3,80); tree->connect("cell_selected", this, "_autoload_selected"); tree->connect("item_edited", this, "_autoload_edited"); tree->connect("button_pressed", this, "_autoload_button_pressed"); add_margin_child(TTR("List:"), tree, true); }
EditorImportTextureOptions::EditorImportTextureOptions() { updating=false; format = memnew( OptionButton ); format->add_item("Uncompressed",EditorTextureImportPlugin::IMAGE_FORMAT_UNCOMPRESSED); format->add_item("Compress Lossless (PNG)",EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_DISK_LOSSLESS); format->add_item("Compress Lossy (WebP)",EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_DISK_LOSSY); format->add_item("Compress (VRAM)",EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM); add_margin_child("Texture Format",format); quality_vb = memnew( VBoxContainer ); HBoxContainer *quality_hb = memnew(HBoxContainer); HSlider *hs = memnew( HSlider ); hs->set_h_size_flags(SIZE_EXPAND_FILL); hs->set_stretch_ratio(0.8); quality_hb->add_child(hs); quality_hb->set_h_size_flags(SIZE_EXPAND_FILL); SpinBox *sb = memnew( SpinBox ); sb->set_h_size_flags(SIZE_EXPAND_FILL); sb->set_stretch_ratio(0.2); quality_hb->add_child(sb); sb->share(hs); hs->set_min(0); hs->set_max(1.0); hs->set_step(0.01); hs->set_val(0.7); quality=hs; quality_vb->add_margin_child("Texture Compression Quality (WebP):",quality_hb); add_child(quality_vb); flags = memnew( Tree ); flags->set_hide_root(true); TreeItem *root = flags->create_item(); const char ** fname=flag_names; while( *fname ) { TreeItem*ti = flags->create_item(root); ti->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); ti->set_text(0,*fname); ti->set_editable(0,true); items.push_back(ti); fname++; } add_margin_child("Texture Options",flags,true); notice_for_2d = memnew( Label ); notice_for_2d->set_text("NOTICE: You are not forced to import textures for 2D projects. Just copy your .jpg or .png files to your project, and change export options later. Atlases can be generated on export too."); notice_for_2d->set_custom_minimum_size(Size2(0,50)); notice_for_2d->set_autowrap(true); add_child(notice_for_2d); notice_for_2d->hide(); }