EditorAssetLibraryItem::EditorAssetLibraryItem() { Ref<StyleBoxEmpty> border; border.instance(); /*border->set_default_margin(MARGIN_LEFT,5); border->set_default_margin(MARGIN_RIGHT,5); border->set_default_margin(MARGIN_BOTTOM,5); border->set_default_margin(MARGIN_TOP,5);*/ add_style_override("panel",border); HBoxContainer *hb = memnew( HBoxContainer ); add_child(hb); icon = memnew( TextureButton ); icon->set_default_cursor_shape(CURSOR_POINTING_HAND); icon->connect("pressed",this,"_asset_clicked"); hb->add_child(icon); VBoxContainer *vb = memnew( VBoxContainer ); hb->add_child(vb); vb->set_h_size_flags(SIZE_EXPAND_FILL); title = memnew( LinkButton ); title->set_text("My Awesome Addon"); title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); title->connect("pressed",this,"_asset_clicked"); vb->add_child(title); category = memnew( LinkButton ); category->set_text("Editor Tools"); category->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); title->connect("pressed",this,"_category_clicked"); vb->add_child(category); author = memnew( LinkButton ); author->set_text("Johny Tolengo"); author->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); title->connect("pressed",this,"_author_clicked"); vb->add_child(author); HBoxContainer *rating_hb = memnew( HBoxContainer ); vb->add_child(rating_hb); for(int i=0;i<5;i++) { stars[i]=memnew(TextureFrame); rating_hb->add_child(stars[i]); } price = memnew( Label ); price->set_text("Free"); vb->add_child(price); set_custom_minimum_size(Size2(250,100)); set_h_size_flags(SIZE_EXPAND_FILL); set_stop_mouse(false); }
CreateDialog::CreateDialog() { set_resizable(true); HSplitContainer *hbc = memnew(HSplitContainer); add_child(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("gui_input", 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"); }
EditorPluginSettings::EditorPluginSettings() { plugin_config_dialog = memnew(PluginConfigDialog); plugin_config_dialog->config(""); add_child(plugin_config_dialog); HBoxContainer *title_hb = memnew(HBoxContainer); title_hb->add_child(memnew(Label(TTR("Installed Plugins:")))); title_hb->add_spacer(); create_plugin = memnew(Button(TTR("Create"))); create_plugin->connect("pressed", this, "_create_clicked"); title_hb->add_child(create_plugin); update_list = memnew(Button(TTR("Update"))); update_list->connect("pressed", this, "update_plugins"); title_hb->add_child(update_list); add_child(title_hb); plugin_list = memnew(Tree); plugin_list->set_v_size_flags(SIZE_EXPAND_FILL); plugin_list->set_columns(5); plugin_list->set_column_titles_visible(true); plugin_list->set_column_title(0, TTR("Name:")); plugin_list->set_column_title(1, TTR("Version:")); plugin_list->set_column_title(2, TTR("Author:")); plugin_list->set_column_title(3, TTR("Status:")); plugin_list->set_column_title(4, TTR("Edit:")); plugin_list->set_column_expand(0, true); plugin_list->set_column_expand(1, false); plugin_list->set_column_expand(2, false); plugin_list->set_column_expand(3, false); plugin_list->set_column_expand(4, false); plugin_list->set_column_min_width(1, 100 * EDSCALE); plugin_list->set_column_min_width(2, 250 * EDSCALE); plugin_list->set_column_min_width(3, 80 * EDSCALE); plugin_list->set_column_min_width(4, 40 * EDSCALE); plugin_list->set_hide_root(true); plugin_list->connect("item_edited", this, "_plugin_activity_changed"); VBoxContainer *mc = memnew(VBoxContainer); mc->add_child(plugin_list); mc->set_v_size_flags(SIZE_EXPAND_FILL); mc->set_h_size_flags(SIZE_EXPAND_FILL); add_child(mc); updating = false; }
ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<String> &p_sections, const char **p_src[]) { ScrollContainer *sc = memnew(ScrollContainer); sc->set_name(p_name); sc->set_v_size_flags(Control::SIZE_EXPAND); VBoxContainer *vbc = memnew(VBoxContainer); vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); sc->add_child(vbc); for (int i = 0; i < p_sections.size(); i++) { const char **names_ptr = p_src[i]; if (*names_ptr) { Label *lbl = memnew(Label); lbl->set_text(p_sections[i]); vbc->add_child(lbl); ItemList *il = memnew(ItemList); il->set_max_columns(16); il->set_h_size_flags(Control::SIZE_EXPAND_FILL); il->set_same_column_width(true); il->set_auto_height(true); while (*names_ptr) { il->add_item(String::utf8(*names_ptr++), NULL, false); } vbc->add_child(il); if (il->get_item_count() == 2) { il->set_fixed_column_width(200 * EDSCALE); } HSeparator *hs = memnew(HSeparator); hs->set_modulate(Color(0, 0, 0, 0)); vbc->add_child(hs); } } return sc; }
ColorPicker::ColorPicker() : BoxContainer(true) { updating = true; edit_alpha = true; text_is_constructor = false; raw_mode_enabled = false; deferred_mode_enabled = false; changing_color = false; screen = NULL; HBoxContainer *hb_smpl = memnew(HBoxContainer); btn_pick = memnew(ToolButton); btn_pick->connect("pressed", this, "_screen_pick_pressed"); sample = memnew(TextureRect); sample->set_h_size_flags(SIZE_EXPAND_FILL); sample->connect("draw", this, "_sample_draw"); hb_smpl->add_child(sample); hb_smpl->add_child(btn_pick); add_child(hb_smpl); HBoxContainer *hb_edit = memnew(HBoxContainer); hb_edit->set_v_size_flags(SIZE_EXPAND_FILL); uv_edit = memnew(Control); uv_edit->connect("gui_input", this, "_uv_input"); uv_edit->set_mouse_filter(MOUSE_FILTER_PASS); uv_edit->set_h_size_flags(SIZE_EXPAND_FILL); uv_edit->set_v_size_flags(SIZE_EXPAND_FILL); uv_edit->set_custom_minimum_size(Size2(get_constant("sv_width"), get_constant("sv_height"))); uv_edit->connect("draw", this, "_hsv_draw", make_binds(0, uv_edit)); add_child(hb_edit); w_edit = memnew(Control); w_edit->set_custom_minimum_size(Size2(get_constant("h_width"), 0)); w_edit->set_h_size_flags(SIZE_FILL); w_edit->set_v_size_flags(SIZE_EXPAND_FILL); w_edit->connect("gui_input", this, "_w_input"); w_edit->connect("draw", this, "_hsv_draw", make_binds(1, w_edit)); hb_edit->add_child(uv_edit); hb_edit->add_child(memnew(VSeparator)); hb_edit->add_child(w_edit); VBoxContainer *vbl = memnew(VBoxContainer); add_child(vbl); add_child(memnew(HSeparator)); VBoxContainer *vbr = memnew(VBoxContainer); add_child(vbr); vbr->set_h_size_flags(SIZE_EXPAND_FILL); const char *lt[4] = { "R", "G", "B", "A" }; for (int i = 0; i < 4; i++) { HBoxContainer *hbc = memnew(HBoxContainer); labels[i] = memnew(Label(lt[i])); labels[i]->set_custom_minimum_size(Size2(get_constant("label_width"), 0)); labels[i]->set_v_size_flags(SIZE_SHRINK_CENTER); hbc->add_child(labels[i]); scroll[i] = memnew(HSlider); scroll[i]->set_v_size_flags(SIZE_SHRINK_CENTER); scroll[i]->set_focus_mode(FOCUS_NONE); hbc->add_child(scroll[i]); values[i] = memnew(SpinBox); scroll[i]->share(values[i]); hbc->add_child(values[i]); values[i]->get_line_edit()->connect("focus_entered", this, "_focus_enter"); values[i]->get_line_edit()->connect("focus_exited", this, "_focus_exit"); scroll[i]->set_min(0); scroll[i]->set_page(0); scroll[i]->set_h_size_flags(SIZE_EXPAND_FILL); scroll[i]->connect("value_changed", this, "_value_changed"); vbr->add_child(hbc); } HBoxContainer *hhb = memnew(HBoxContainer); btn_mode = memnew(CheckButton); btn_mode->set_text(TTR("Raw Mode")); btn_mode->connect("toggled", this, "set_raw_mode"); hhb->add_child(btn_mode); vbr->add_child(hhb); text_type = memnew(Button); text_type->set_flat(true); text_type->connect("pressed", this, "_text_type_toggled"); hhb->add_child(text_type); c_text = memnew(LineEdit); hhb->add_child(c_text); c_text->connect("text_entered", this, "_html_entered"); c_text->connect("focus_entered", this, "_focus_enter"); c_text->connect("focus_exited", this, "_html_focus_exit"); text_type->set_text("#"); c_text->set_h_size_flags(SIZE_EXPAND_FILL); _update_controls(); updating = false; set_pick_color(Color(1, 1, 1)); HBoxContainer *bbc = memnew(HBoxContainer); add_child(bbc); preset = memnew(TextureRect); bbc->add_child(preset); preset->connect("gui_input", this, "_preset_input"); preset->connect("draw", this, "_update_presets"); bt_add_preset = memnew(Button); bt_add_preset->set_tooltip(TTR("Add current color as a preset")); bt_add_preset->connect("pressed", this, "_add_preset_pressed"); bbc->add_child(bt_add_preset); }
SpriteFramesEditor::SpriteFramesEditor() { //add_style_override("panel", get_stylebox("panel","Panel")); split = memnew(HSplitContainer); add_child(split); VBoxContainer *vbc_animlist = memnew(VBoxContainer); split->add_child(vbc_animlist); vbc_animlist->set_custom_minimum_size(Size2(150, 0)); //vbc_animlist->set_v_size_flags(SIZE_EXPAND_FILL); VBoxContainer *sub_vb = memnew(VBoxContainer); vbc_animlist->add_margin_child(TTR("Animations"), sub_vb, true); sub_vb->set_v_size_flags(SIZE_EXPAND_FILL); HBoxContainer *hbc_animlist = memnew(HBoxContainer); sub_vb->add_child(hbc_animlist); new_anim = memnew(Button); hbc_animlist->add_child(new_anim); new_anim->connect("pressed", this, "_animation_add"); hbc_animlist->add_spacer(); remove_anim = memnew(Button); hbc_animlist->add_child(remove_anim); remove_anim->connect("pressed", this, "_animation_remove"); animations = memnew(Tree); sub_vb->add_child(animations); animations->set_v_size_flags(SIZE_EXPAND_FILL); animations->set_hide_root(true); animations->connect("cell_selected", this, "_animation_select"); animations->connect("item_edited", this, "_animation_name_edited"); animations->set_single_select_cell_editing_only_when_already_selected(true); anim_speed = memnew(SpinBox); vbc_animlist->add_margin_child(TTR("Speed (FPS):"), anim_speed); anim_speed->set_min(0); anim_speed->set_max(100); anim_speed->set_step(0.01); anim_speed->connect("value_changed", this, "_animation_fps_changed"); anim_loop = memnew(CheckButton); anim_loop->set_text(TTR("Loop")); vbc_animlist->add_child(anim_loop); anim_loop->connect("pressed", this, "_animation_loop_changed"); VBoxContainer *vbc = memnew(VBoxContainer); split->add_child(vbc); vbc->set_h_size_flags(SIZE_EXPAND_FILL); sub_vb = memnew(VBoxContainer); vbc->add_margin_child(TTR("Animation Frames"), sub_vb, true); HBoxContainer *hbc = memnew(HBoxContainer); sub_vb->add_child(hbc); //animations = memnew( ItemList ); load = memnew(Button); load->set_tooltip(TTR("Load Resource")); hbc->add_child(load); copy = memnew(Button); copy->set_text(TTR("Copy")); hbc->add_child(copy); paste = memnew(Button); paste->set_text(TTR("Paste")); hbc->add_child(paste); empty = memnew(Button); empty->set_text(TTR("Insert Empty (Before)")); hbc->add_child(empty); empty2 = memnew(Button); empty2->set_text(TTR("Insert Empty (After)")); hbc->add_child(empty2); move_up = memnew(Button); move_up->set_text(TTR("Up")); hbc->add_child(move_up); move_down = memnew(Button); move_down->set_text(TTR("Down")); hbc->add_child(move_down); _delete = memnew(Button); hbc->add_child(_delete); file = memnew(EditorFileDialog); add_child(file); tree = memnew(ItemList); tree->set_v_size_flags(SIZE_EXPAND_FILL); tree->set_icon_mode(ItemList::ICON_MODE_TOP); int thumbnail_size = 96; tree->set_max_columns(0); tree->set_icon_mode(ItemList::ICON_MODE_TOP); tree->set_fixed_column_width(thumbnail_size * 3 / 2); tree->set_max_text_lines(2); tree->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); //tree->set_min_icon_size(Size2(thumbnail_size,thumbnail_size)); tree->set_drag_forwarding(this); sub_vb->add_child(tree); dialog = memnew(AcceptDialog); add_child(dialog); load->connect("pressed", this, "_load_pressed"); _delete->connect("pressed", this, "_delete_pressed"); copy->connect("pressed", this, "_copy_pressed"); paste->connect("pressed", this, "_paste_pressed"); empty->connect("pressed", this, "_empty_pressed"); empty2->connect("pressed", this, "_empty2_pressed"); move_up->connect("pressed", this, "_up_pressed"); move_down->connect("pressed", this, "_down_pressed"); file->connect("files_selected", this, "_file_load_request"); //dialog->connect("confirmed", this,"_delete_confirm_pressed"); //tree->connect("item_selected", this,"_item_edited"); loading_scene = false; sel = -1; updating = false; edited_anim = "default"; }
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); }
ColorPicker::ColorPicker() { //edit_alpha=false; updating=true; edit_alpha=true; VBoxContainer *vbl = memnew( VBoxContainer ); add_child(vbl); mode_box = memnew( OptionButton ); mode_box->add_item("RGB"); mode_box->add_item("HSV"); mode_box->add_item("RAW"); mode_box->connect("item_selected",this,"set_mode"); color_box=memnew( Control ); color_box->set_v_size_flags(SIZE_EXPAND_FILL); vbl->add_child(color_box); color_box->connect("draw",this,"_color_box_draw"); vbl->add_child(mode_box); VBoxContainer *vbr = memnew( VBoxContainer ); add_child(vbr); vbr->set_h_size_flags(SIZE_EXPAND_FILL); for(int i=0;i<4;i++) { HBoxContainer *hbc = memnew( HBoxContainer ); labels[i]=memnew( Label ); hbc->add_child(labels[i]); scroll[i]=memnew( HSlider ); hbc->add_child(scroll[i]); values[i]=memnew( SpinBox ); scroll[i]->share(values[i]); hbc->add_child(values[i]); scroll[i]->set_min(0); scroll[i]->set_page(0); scroll[i]->set_h_size_flags(SIZE_EXPAND_FILL); scroll[i]->connect("value_changed",this,"_value_changed"); vbr->add_child(hbc); } HBoxContainer *hhb = memnew( HBoxContainer ); vbr->add_child(hhb); html_num = memnew( Label ); hhb->add_child(html_num); html = memnew( LineEdit ); hhb->add_child(html); html->connect("text_entered",this,"_html_entered"); html_num->set_text("#"); html->set_h_size_flags(SIZE_EXPAND_FILL); mode=MODE_RGB; _update_controls(); _update_color(); updating=false; }
EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); icon = memnew(TextureRect); hb->add_child(icon); VBoxContainer *vb = memnew(VBoxContainer); hb->add_child(vb); vb->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *title_hb = memnew(HBoxContainer); vb->add_child(title_hb); title = memnew(Label); title_hb->add_child(title); title->set_h_size_flags(SIZE_EXPAND_FILL); dismiss = memnew(TextureButton); dismiss->connect("pressed", this, "_close"); title_hb->add_child(dismiss); title->set_clip_text(true); vb->add_spacer(); status = memnew(Label("Idle")); vb->add_child(status); status->add_color_override("font_color", Color(0.5, 0.5, 0.5)); progress = memnew(ProgressBar); vb->add_child(progress); HBoxContainer *hb2 = memnew(HBoxContainer); vb->add_child(hb2); hb2->add_spacer(); install = memnew(Button); install->set_text("Install"); install->set_disabled(true); install->connect("pressed", this, "_install"); retry = memnew(Button); retry->set_text("Retry"); retry->connect("pressed", this, "_make_request"); hb2->add_child(retry); hb2->add_child(install); set_custom_minimum_size(Size2(250, 0)); download = memnew(HTTPRequest); add_child(download); download->connect("request_completed", this, "_http_download_completed"); download_error = memnew(AcceptDialog); add_child(download_error); download_error->set_title("Download Error"); asset_installer = memnew(EditorAssetInstaller); add_child(asset_installer); prev_status = -1; external_install = false; }
ColorPicker::ColorPicker() : BoxContainer(true) { updating = true; edit_alpha = true; text_is_constructor = false; raw_mode_enabled = false; changing_color = false; screen = NULL; HBoxContainer *hb_smpl = memnew(HBoxContainer); btn_pick = memnew(ToolButton); btn_pick->connect("pressed", this, "_screen_pick_pressed"); sample = memnew(TextureRect); sample->set_h_size_flags(SIZE_EXPAND_FILL); sample->connect("draw", this, "_sample_draw"); hb_smpl->add_child(sample); hb_smpl->add_child(btn_pick); add_child(hb_smpl); HBoxContainer *hb_edit = memnew(HBoxContainer); uv_edit = memnew(Control); uv_edit->connect("gui_input", this, "_uv_input"); uv_edit->set_mouse_filter(MOUSE_FILTER_PASS); uv_edit->set_custom_minimum_size(Size2(256, 256)); Vector<Variant> args = Vector<Variant>(); args.push_back(0); args.push_back(uv_edit); uv_edit->connect("draw", this, "_hsv_draw", args); add_child(hb_edit); w_edit = memnew(Control); //w_edit->set_ignore_mouse(false); w_edit->set_custom_minimum_size(Size2(30, 256)); w_edit->connect("gui_input", this, "_w_input"); args.clear(); args.push_back(1); args.push_back(w_edit); w_edit->connect("draw", this, "_hsv_draw", args); hb_edit->add_child(uv_edit); hb_edit->add_child(memnew(VSeparator)); hb_edit->add_child(w_edit); VBoxContainer *vbl = memnew(VBoxContainer); add_child(vbl); add_child(memnew(HSeparator)); VBoxContainer *vbr = memnew(VBoxContainer); add_child(vbr); vbr->set_h_size_flags(SIZE_EXPAND_FILL); const char *lt[4] = { "R", "G", "B", "A" }; for (int i = 0; i < 4; i++) { HBoxContainer *hbc = memnew(HBoxContainer); labels[i] = memnew(Label(lt[i])); hbc->add_child(labels[i]); scroll[i] = memnew(HSlider); hbc->add_child(scroll[i]); values[i] = memnew(SpinBox); scroll[i]->share(values[i]); hbc->add_child(values[i]); scroll[i]->set_min(0); scroll[i]->set_page(0); scroll[i]->set_h_size_flags(SIZE_EXPAND_FILL); scroll[i]->connect("value_changed", this, "_value_changed"); vbr->add_child(hbc); } HBoxContainer *hhb = memnew(HBoxContainer); btn_mode = memnew(CheckButton); btn_mode->set_text("RAW Mode"); btn_mode->connect("toggled", this, "set_raw_mode"); hhb->add_child(btn_mode); vbr->add_child(hhb); text_type = memnew(Button); text_type->set_flat(true); text_type->connect("pressed", this, "_text_type_toggled"); hhb->add_child(text_type); c_text = memnew(LineEdit); hhb->add_child(c_text); c_text->connect("text_entered", this, "_html_entered"); text_type->set_text("#"); c_text->set_h_size_flags(SIZE_EXPAND_FILL); _update_controls(); //_update_color(); updating = false; set_pick_color(Color(1, 1, 1)); HBoxContainer *bbc = memnew(HBoxContainer); add_child(bbc); preset = memnew(TextureRect); bbc->add_child(preset); //preset->set_ignore_mouse(false); preset->connect("gui_input", this, "_preset_input"); bt_add_preset = memnew(Button); bt_add_preset->set_icon(get_icon("add_preset")); bt_add_preset->set_tooltip("Add current color as a preset"); bt_add_preset->connect("pressed", this, "_add_preset_pressed"); bbc->add_child(bt_add_preset); }
CreateDialog::CreateDialog() { is_replace_mode = false; set_resizable(true); HSplitContainer *hsc = memnew(HSplitContainer); add_child(hsc); VSplitContainer *vsc = memnew(VSplitContainer); hsc->add_child(vsc); VBoxContainer *fav_vb = memnew(VBoxContainer); vsc->add_child(fav_vb); fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE); fav_vb->set_v_size_flags(SIZE_EXPAND_FILL); favorites = memnew(Tree); fav_vb->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); VBoxContainer *rec_vb = memnew(VBoxContainer); vsc->add_child(rec_vb); rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE); rec_vb->set_v_size_flags(SIZE_EXPAND_FILL); recent = memnew(Tree); rec_vb->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); hsc->add_child(vbc); vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE); 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_flat(true); 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("gui_input", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); 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"); base_type = "Object"; preferred_search_result_type = ""; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); help_bit->connect("request_hide", this, "_closed"); type_blacklist.insert("PluginScript"); // PluginScript must be initialized before use, which is not possible here type_blacklist.insert("ScriptCreateDialog"); // This is an exposed editor Node that doesn't have an Editor prefix. EDITOR_DEF("interface/editors/derive_script_globals_by_name", true); }
ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){ ppeer = Ref<PacketPeerStream>( memnew( PacketPeerStream ) ); editor=p_editor; tabs = memnew( TabContainer ); tabs->set_v_size_flags(SIZE_EXPAND_FILL); tabs->set_area_as_parent_rect(); add_child(tabs); { //debugger VBoxContainer *vbc = memnew( VBoxContainer ); vbc->set_name(TTR("Debugger")); //tabs->add_child(vbc); Control *dbg=vbc; HBoxContainer *hbc = memnew( HBoxContainer ); vbc->add_child(hbc); reason = memnew( LineEdit ); reason->set_text(""); reason->set_editable(false); hbc->add_child(reason); reason->add_color_override("font_color",Color(1,0.4,0.0,0.8)); reason->set_h_size_flags(SIZE_EXPAND_FILL); //reason->set_clip_text(true); hbc->add_child( memnew( VSeparator) ); step = memnew( Button ); hbc->add_child(step); step->set_tooltip(TTR("Step Into")); step->connect("pressed",this,"debug_step"); next = memnew( Button ); hbc->add_child(next); next->set_tooltip(TTR("Step Over")); next->connect("pressed",this,"debug_next"); hbc->add_child( memnew( VSeparator) ); dobreak = memnew( Button ); hbc->add_child(dobreak); dobreak->set_tooltip(TTR("Break")); dobreak->connect("pressed",this,"debug_break"); docontinue = memnew( Button ); hbc->add_child(docontinue); docontinue->set_tooltip(TTR("Continue")); docontinue->connect("pressed",this,"debug_continue"); //hbc->add_child( memnew( VSeparator) ); back = memnew( Button ); hbc->add_child(back); back->set_tooltip(TTR("Inspect Previous Instance")); back->hide(); forward = memnew( Button ); hbc->add_child(forward); forward->set_tooltip(TTR("Inspect Next Instance")); forward->hide(); HSplitContainer *sc = memnew( HSplitContainer ); vbc->add_child(sc); sc->set_v_size_flags(SIZE_EXPAND_FILL); stack_dump = memnew( Tree ); stack_dump->set_columns(1); stack_dump->set_column_titles_visible(true); stack_dump->set_column_title(0,TTR("Stack Frames")); stack_dump->set_h_size_flags(SIZE_EXPAND_FILL); stack_dump->set_hide_root(true); stack_dump->connect("cell_selected",this,"_stack_dump_frame_selected"); sc->add_child(stack_dump); inspector = memnew( PropertyEditor ); inspector->set_h_size_flags(SIZE_EXPAND_FILL); inspector->hide_top_label(); inspector->get_scene_tree()->set_column_title(0,TTR("Variable")); inspector->set_capitalize_paths(false); inspector->set_read_only(true); sc->add_child(inspector); server = TCP_Server::create_ref(); pending_in_queue=0; variables = memnew( ScriptEditorDebuggerVariables ); breaked=false; tabs->add_child(dbg); //tabs->move_child(vbc,0); hbc = memnew( HBoxContainer ); vbc->add_child(hbc); } { //errors error_split = memnew( HSplitContainer ); VBoxContainer *errvb = memnew( VBoxContainer ); errvb->set_h_size_flags(SIZE_EXPAND_FILL); error_list = memnew( ItemList ); errvb->add_margin_child(TTR("Errors:"),error_list,true); error_split->add_child(errvb); errvb = memnew( VBoxContainer ); errvb->set_h_size_flags(SIZE_EXPAND_FILL); error_stack = memnew( ItemList ); errvb->add_margin_child(TTR("Stack Trace (if applicable):"),error_stack,true); error_split->add_child(errvb); error_split->set_name(TTR("Errors")); tabs->add_child(error_split); } { // inquire inspect_info = memnew( HSplitContainer ); inspect_info->set_name(TTR("Remote Inspector")); tabs->add_child(inspect_info); VBoxContainer *info_left = memnew(VBoxContainer); info_left->set_h_size_flags(SIZE_EXPAND_FILL); inspect_info->add_child(info_left); inspect_scene_tree = memnew( Tree ); info_left->add_margin_child(TTR("Live Scene Tree:"),inspect_scene_tree,true); inspect_scene_tree->connect("cell_selected",this,"_scene_tree_selected"); inspect_scene_tree->connect("item_collapsed",this,"_scene_tree_folded"); // VBoxContainer *info_right = memnew(VBoxContainer); info_right->set_h_size_flags(SIZE_EXPAND_FILL); inspect_info->add_child(info_right); inspect_properties = memnew( PropertyEditor ); inspect_properties->hide_top_label(); inspect_properties->set_show_categories(true); inspect_properties->connect("object_id_selected",this,"_scene_tree_property_select_object"); info_right->add_margin_child(TTR("Remote Object Properties: "),inspect_properties,true); inspect_scene_tree_timeout=EDITOR_DEF("debugger/scene_tree_refresh_interval",1.0); inspect_edited_object_timeout=EDITOR_DEF("debugger/remote_inspect_refresh_interval",0.2); inspected_object_id=0; updating_scene_tree=false; inspected_object = memnew( ScriptEditorDebuggerInspectedObject ); inspected_object->connect("value_edited",this,"_scene_tree_property_value_edited"); } { //profiler profiler = memnew( EditorProfiler ); profiler->set_name(TTR("Profiler")); tabs->add_child(profiler); profiler->connect("enable_profiling",this,"_profiler_activate"); profiler->connect("break_request",this,"_profiler_seeked"); } { //monitors HSplitContainer *hsp = memnew( HSplitContainer ); perf_monitors = memnew(Tree); perf_monitors->set_columns(2); perf_monitors->set_column_title(0,TTR("Monitor")); perf_monitors->set_column_title(1,TTR("Value")); perf_monitors->set_column_titles_visible(true); hsp->add_child(perf_monitors); perf_monitors->set_select_mode(Tree::SELECT_MULTI); perf_monitors->connect("multi_selected",this,"_performance_select"); perf_draw = memnew( Control ); perf_draw->connect("draw",this,"_performance_draw"); hsp->add_child(perf_draw); hsp->set_name(TTR("Monitors")); hsp->set_split_offset(300); tabs->add_child(hsp); perf_max.resize(Performance::MONITOR_MAX); Map<String,TreeItem*> bases; TreeItem *root=perf_monitors->create_item(); perf_monitors->set_hide_root(true); for(int i=0;i<Performance::MONITOR_MAX;i++) { String n = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)); String base = n.get_slice("/",0); String name = n.get_slice("/",1); if (!bases.has(base)) { TreeItem *b = perf_monitors->create_item(root); b->set_text(0,base.capitalize()); b->set_editable(0,false); b->set_selectable(0,false); bases[base]=b; } TreeItem *it = perf_monitors->create_item(bases[base]); it->set_editable(0,false); it->set_selectable(0,true); it->set_text(0,name.capitalize()); perf_items.push_back(it); perf_max[i]=0; } } { //vmem inspect VBoxContainer *vmem_vb = memnew( VBoxContainer ); HBoxContainer *vmem_hb = memnew( HBoxContainer ); Label *vmlb = memnew(Label(TTR("List of Video Memory Usage by Resource:")+" ") ); vmlb->set_h_size_flags(SIZE_EXPAND_FILL); vmem_hb->add_child( vmlb ); vmem_hb->add_child( memnew(Label(TTR("Total:")+" ")) ); vmem_total = memnew( LineEdit ); vmem_total->set_editable(false); vmem_total->set_custom_minimum_size(Size2(100,1)*EDSCALE); vmem_hb->add_child(vmem_total); vmem_refresh = memnew( Button ); vmem_hb->add_child(vmem_refresh); vmem_vb->add_child(vmem_hb); vmem_refresh->connect("pressed",this,"_video_mem_request"); MarginContainer *vmmc = memnew( MarginContainer ); vmem_tree = memnew( Tree ); vmem_tree->set_v_size_flags(SIZE_EXPAND_FILL); vmem_tree->set_h_size_flags(SIZE_EXPAND_FILL); vmmc->add_child(vmem_tree); vmmc->set_v_size_flags(SIZE_EXPAND_FILL); vmem_vb->add_child(vmmc); vmem_vb->set_name(TTR("Video Mem")); vmem_tree->set_columns(4); vmem_tree->set_column_titles_visible(true); vmem_tree->set_column_title(0,TTR("Resource Path")); vmem_tree->set_column_expand(0,true); vmem_tree->set_column_expand(1,false); vmem_tree->set_column_title(1,TTR("Type")); vmem_tree->set_column_min_width(1,100); vmem_tree->set_column_expand(2,false); vmem_tree->set_column_title(2,TTR("Format")); vmem_tree->set_column_min_width(2,150); vmem_tree->set_column_expand(3,false); vmem_tree->set_column_title(3,TTR("Usage")); vmem_tree->set_column_min_width(3,80); vmem_tree->set_hide_root(true); tabs->add_child(vmem_vb); } { // misc VBoxContainer *info_left = memnew( VBoxContainer ); info_left->set_h_size_flags(SIZE_EXPAND_FILL); info_left->set_name(TTR("Misc")); tabs->add_child(info_left); clicked_ctrl = memnew( LineEdit ); info_left->add_margin_child(TTR("Clicked Control:"),clicked_ctrl); clicked_ctrl_type = memnew( LineEdit ); info_left->add_margin_child(TTR("Clicked Control Type:"),clicked_ctrl_type); live_edit_root = memnew( LineEdit ); { HBoxContainer *lehb = memnew( HBoxContainer ); Label *l = memnew( Label(TTR("Live Edit Root:")) ); lehb->add_child(l); l->set_h_size_flags(SIZE_EXPAND_FILL); le_set = memnew( Button(TTR("Set From Tree")) ); lehb->add_child(le_set); le_clear = memnew( Button(TTR("Clear")) ); lehb->add_child(le_clear); info_left->add_child(lehb); MarginContainer *mc = memnew( MarginContainer ); mc->add_child(live_edit_root); info_left->add_child(mc); le_set->set_disabled(true); le_clear->set_disabled(true); } } msgdialog = memnew( AcceptDialog ); add_child(msgdialog); log_forced_visible=false; p_editor->get_undo_redo()->set_method_notify_callback(_method_changeds,this); p_editor->get_undo_redo()->set_property_notify_callback(_property_changeds,this); live_debug=false; last_path_id=false; error_count=0; hide_on_stop=true; last_error_count=0; EditorNode::get_singleton()->get_pause_button()->connect("pressed",this,"_paused"); }
EditorFontImportDialog(EditorFontImportPlugin *p_plugin) { plugin=p_plugin; VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); HBoxContainer *hbc = memnew( HBoxContainer); vbc->add_child(hbc); VBoxContainer *vbl = memnew( VBoxContainer ); hbc->add_child(vbl); hbc->set_v_size_flags(SIZE_EXPAND_FILL); vbl->set_h_size_flags(SIZE_EXPAND_FILL); VBoxContainer *vbr = memnew( VBoxContainer ); hbc->add_child(vbr); vbr->set_h_size_flags(SIZE_EXPAND_FILL); source = memnew( LineEditFileChooser ); source->get_file_dialog()->set_access(FileDialog::ACCESS_FILESYSTEM); source->get_file_dialog()->set_mode(FileDialog::MODE_OPEN_FILE); source->get_file_dialog()->add_filter("*.ttf;TrueType"); source->get_file_dialog()->add_filter("*.otf;OpenType"); source->get_line_edit()->connect("text_entered",this,"_src_changed"); vbl->add_margin_child("Source Font:",source); font_size = memnew( SpinBox ); vbl->add_margin_child("Source Font Size:",font_size); font_size->set_min(3); font_size->set_max(256); font_size->set_val(16); font_size->connect("value_changed",this,"_font_size_changed"); dest = memnew( LineEditFileChooser ); // List<String> fl; Ref<Font> font= memnew(Font); dest->get_file_dialog()->add_filter("*.fnt ; Font" ); //ResourceSaver::get_recognized_extensions(font,&fl); //for(List<String>::Element *E=fl.front();E;E=E->next()) { // dest->get_file_dialog()->add_filter("*."+E->get()); //} vbl->add_margin_child("Dest Resource:",dest); HBoxContainer *testhb = memnew( HBoxContainer ); test_string = memnew( LineEdit ); test_string->set_text("The quick brown fox jumps over the lazy dog."); test_string->set_h_size_flags(SIZE_EXPAND_FILL); test_string->set_stretch_ratio(5); testhb->add_child(test_string); test_color = memnew( ColorPickerButton ); test_color->set_color(get_color("font_color","Label")); test_color->set_h_size_flags(SIZE_EXPAND_FILL); test_color->set_stretch_ratio(1); test_color->connect("color_changed",this,"_update_text3"); testhb->add_child(test_color); vbl->add_spacer(); vbl->add_margin_child("Test: ",testhb); HBoxContainer *upd_hb = memnew( HBoxContainer ); // vbl->add_child(upd_hb); upd_hb->add_spacer(); Button *update = memnew( Button); upd_hb->add_child(update); update->set_text("Update"); update->connect("pressed",this,"_update"); options = memnew( _EditorFontImportOptions ); prop_edit = memnew( PropertyEditor() ); vbr->add_margin_child("Options:",prop_edit,true); options->connect("changed",this,"_prop_changed"); prop_edit->hide_top_label(); Panel *panel = memnew( Panel ); vbc->add_child(panel); test_label = memnew( Label ); test_label->set_autowrap(true); panel->add_child(test_label); test_label->set_area_as_parent_rect(); panel->set_v_size_flags(SIZE_EXPAND_FILL); test_string->connect("text_changed",this,"_update_text2"); set_title("Font Import"); timer = memnew( Timer ); add_child(timer); timer->connect("timeout",this,"_update"); timer->set_wait_time(0.4); timer->set_one_shot(true); 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"); set_hide_on_ok(false); }
ColorPicker::ColorPicker() : BoxContainer(true) { updating=true; edit_alpha=true; text_is_constructor = false; raw_mode_enabled=false; changing_color=false; screen=NULL; HBoxContainer *hb_smpl = memnew( HBoxContainer ); btn_pick = memnew( ToolButton ); btn_pick->connect("pressed",this,"_screen_pick_pressed"); sample = memnew( TextureFrame ); sample->set_h_size_flags(SIZE_EXPAND_FILL); sample->connect("draw",this,"_sample_draw"); hb_smpl->add_child(sample); hb_smpl->add_child(btn_pick); add_child(hb_smpl); HBoxContainer *hb_edit = memnew( HBoxContainer ); uv_edit= memnew ( TextureFrame ); Image i(256, 256, false, Image::FORMAT_RGB); for (int y=0;y<256;y++) for (int x=0;x<256;x++) i.put_pixel(x,y,Color()); Ref<ImageTexture> t; t.instance(); t->create_from_image(i); uv_edit->set_texture(t); uv_edit->set_ignore_mouse(false); uv_edit->set_custom_minimum_size(Size2(256,256)); uv_edit->connect("input_event", this, "_uv_input"); Control *c= memnew( Control ); uv_edit->add_child(c); c->set_area_as_parent_rect(); c->set_stop_mouse(false); c->set_material(memnew ( CanvasItemMaterial )); Vector<Variant> args=Vector<Variant>(); args.push_back(0); args.push_back(c); c->connect("draw",this,"_hsv_draw",args); add_child(hb_edit); w_edit= memnew( TextureFrame ); i = Image(15, 256, false, Image::FORMAT_RGB); for (int y=0;y<256;y++) for (int x=0;x<15;x++) i.put_pixel(x,y,Color()); Ref<ImageTexture> tw; tw.instance(); tw->create_from_image(i); w_edit->set_texture(tw); w_edit->set_ignore_mouse(false); w_edit->set_custom_minimum_size(Size2(15,256)); w_edit->connect("input_event", this, "_w_input"); c= memnew( Control ); w_edit->add_child(c); c->set_area_as_parent_rect(); c->set_stop_mouse(false); c->set_material(memnew ( CanvasItemMaterial )); args.clear(); args.push_back(1); args.push_back(c); c->connect("draw",this,"_hsv_draw",args); hb_edit->add_child(uv_edit); hb_edit->add_child(memnew( VSeparator )); hb_edit->add_child(w_edit); VBoxContainer *vbl = memnew( VBoxContainer ); add_child(vbl); add_child(memnew( HSeparator )); VBoxContainer *vbr = memnew( VBoxContainer ); add_child(vbr); vbr->set_h_size_flags(SIZE_EXPAND_FILL); const char* lt[4] = {"R","G","B","A"}; for(int i=0;i<4;i++) { HBoxContainer *hbc = memnew( HBoxContainer ); labels[i]=memnew( Label(lt[i]) ); hbc->add_child(labels[i]); scroll[i]=memnew( HSlider ); hbc->add_child(scroll[i]); values[i]=memnew( SpinBox ); scroll[i]->share(values[i]); hbc->add_child(values[i]); scroll[i]->set_min(0); scroll[i]->set_page(0); scroll[i]->set_h_size_flags(SIZE_EXPAND_FILL); scroll[i]->connect("value_changed",this,"_value_changed"); vbr->add_child(hbc); } HBoxContainer *hhb = memnew( HBoxContainer ); btn_mode = memnew( CheckButton ); btn_mode->set_text("RAW Mode"); btn_mode->connect("toggled", this, "set_raw_mode"); hhb->add_child(btn_mode); vbr->add_child(hhb); text_type = memnew( Button ); text_type->set_flat(true); text_type->connect("pressed", this, "_text_type_toggled"); hhb->add_child(text_type); c_text = memnew( LineEdit ); hhb->add_child(c_text); c_text->connect("text_entered",this,"_html_entered"); text_type->set_text("#"); c_text->set_h_size_flags(SIZE_EXPAND_FILL); _update_controls(); //_update_color(); updating=false; uv_material.instance(); Ref<Shader> s_uv = get_shader("uv_editor"); uv_material->set_shader(s_uv); w_material.instance(); Ref<Shader> s_w = get_shader("w_editor"); w_material->set_shader(s_w); uv_edit->set_material(uv_material); w_edit->set_material(w_material); set_color(Color(1,1,1)); i.create(256,20,false,Image::FORMAT_RGB); for (int y=0;y<20;y++) for(int x=0;x<256;x++) if ((x/4+y/4)%2) i.put_pixel(x,y,Color(1,1,1)); else i.put_pixel(x,y,Color(0.6,0.6,0.6)); Ref<ImageTexture> t_smpl; t_smpl.instance(); t_smpl->create_from_image(i); sample->set_texture(t_smpl); HBoxContainer *bbc = memnew( HBoxContainer ); add_child(bbc); preset = memnew( TextureFrame ); bbc->add_child(preset); preset->set_ignore_mouse(false); preset->connect("input_event", this, "_preset_input"); bt_add_preset = memnew ( Button ); bt_add_preset->set_icon(get_icon("add_preset")); bt_add_preset->set_tooltip("Add current color as a preset"); bt_add_preset->connect("pressed", this, "_add_preset_pressed"); bbc->add_child(bt_add_preset); }