diff options
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 21 | ||||
-rw-r--r-- | editor/plugins/resource_preloader_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/sample_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/sample_library_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 70 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/texture_editor_plugin.cpp | 18 | ||||
-rw-r--r-- | editor/plugins/texture_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 38 | ||||
-rw-r--r-- | editor/plugins/theme_editor_plugin.cpp | 59 | ||||
-rw-r--r-- | editor/plugins/theme_editor_plugin.h | 3 |
13 files changed, 118 insertions, 104 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 82b03d3a19..c4e79bf263 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -31,10 +31,10 @@ #include "editor/animation_editor.h" #include "editor/editor_settings.h" -#include "project_settings.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/keyboard.h" +#include "project_settings.h" void AnimationPlayerEditor::_node_removed(Node *p_node) { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 4c4cd88dfb..a809a68c23 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -176,7 +176,6 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2 &mouse_pos) { for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { Node2D *n2d = E->get()->cast_to<Node2D>(); - if (n2d && n2d->edit_has_pivot()) { Vector2 offset = n2d->edit_get_pivot(); @@ -1736,11 +1735,9 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { } Ref<InputEventKey> k = p_event; - if (k.is_valid()) { - if (k->is_pressed() && drag == DRAG_NONE) { - + // Move the object with the arrow keys KeyMoveMODE move_mode = MOVE_VIEW_BASE; if (k->get_alt()) move_mode = MOVE_LOCAL_BASE; if (k->get_control() || k->get_metakey()) move_mode = MOVE_LOCAL_WITH_ROT; @@ -1773,13 +1770,23 @@ void CanvasItemEditor::_viewport_draw() { RID ci = viewport->get_canvas_item(); if (snap_show_grid) { + //Draw the grid Size2 s = viewport->get_size(); int last_cell; Transform2D xform = transform.affine_inverse(); + Vector2 grid_offset; + if (snap_relative && snap_grid && get_item_count() > 0) { + Vector2 topleft = _find_topleftmost_point(); + grid_offset.x = fmod(topleft.x, snap_step.x); + grid_offset.y = fmod(topleft.y, snap_step.y); + } else { + grid_offset = snap_offset; + } + if (snap_step.x != 0) { for (int i = 0; i < s.width; i++) { - int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(i, 0)).x - snap_offset.x) / snap_step.x)); + int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(i, 0)).x - grid_offset.x) / snap_step.x)); if (i == 0) last_cell = cell; if (last_cell != cell) @@ -1790,7 +1797,7 @@ void CanvasItemEditor::_viewport_draw() { if (snap_step.y != 0) { for (int i = 0; i < s.height; i++) { - int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(0, i)).y - snap_offset.y) / snap_step.y)); + int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(0, i)).y - grid_offset.y) / snap_step.y)); if (i == 0) last_cell = cell; if (last_cell != cell) @@ -2383,6 +2390,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { snap_grid = !snap_grid; int idx = edit_menu->get_popup()->get_item_index(SNAP_USE); edit_menu->get_popup()->set_item_checked(idx, snap_grid); + viewport->update(); } break; case SNAP_SHOW_GRID: { snap_show_grid = !snap_show_grid; @@ -2399,6 +2407,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { snap_relative = !snap_relative; int idx = edit_menu->get_popup()->get_item_index(SNAP_RELATIVE); edit_menu->get_popup()->set_item_checked(idx, snap_relative); + viewport->update(); } break; case SNAP_USE_PIXEL: { snap_pixel = !snap_pixel; diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 463b6360ad..2703da12fe 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -30,8 +30,8 @@ #include "resource_preloader_editor_plugin.h" #include "editor/editor_settings.h" -#include "project_settings.h" #include "io/resource_loader.h" +#include "project_settings.h" void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) { } diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp index 0b99ab5460..739a8abb53 100644 --- a/editor/plugins/sample_editor_plugin.cpp +++ b/editor/plugins/sample_editor_plugin.cpp @@ -31,8 +31,8 @@ #if 0 #include "editor/editor_settings.h" -#include "project_settings.h" #include "io/resource_loader.h" +#include "project_settings.h" diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp index 04c805165f..5ccfde15ff 100644 --- a/editor/plugins/sample_library_editor_plugin.cpp +++ b/editor/plugins/sample_library_editor_plugin.cpp @@ -32,8 +32,8 @@ #include "sample_library_editor_plugin.h" #include "editor/editor_settings.h" -#include "project_settings.h" #include "io/resource_loader.h" +#include "project_settings.h" #include "sample_editor_plugin.h" #include "scene/main/viewport.h" diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index fef7f07abb..77c540b746 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2229,7 +2229,7 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts); ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script:Script"))); - ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::STRING, "script:String"))); + ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::OBJECT, "script:Script"))); } ScriptEditor::ScriptEditor(EditorNode *p_editor) { diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index ef7ed5f7f6..2d77bfb2c1 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1563,13 +1563,13 @@ void SpatialEditorViewport::_update_freelook(real_t delta) { Vector3 right = camera->get_transform().basis.xform(Vector3(1, 0, 0)); Vector3 up = camera->get_transform().basis.xform(Vector3(0, 1, 0)); - int key_left = ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A)->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); - int key_right = ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D)->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); - int key_forward = ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W)->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); - int key_backwards = ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S)->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); - int key_up = ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q)->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); - int key_down = ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E)->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); - int key_speed_modifier = ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT)->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); + int key_left = ED_GET_SHORTCUT("spatial_editor/freelook_left")->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); + int key_right = ED_GET_SHORTCUT("spatial_editor/freelook_right")->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); + int key_forward = ED_GET_SHORTCUT("spatial_editor/freelook_forward")->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); + int key_backwards = ED_GET_SHORTCUT("spatial_editor/freelook_backwards")->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); + int key_up = ED_GET_SHORTCUT("spatial_editor/freelook_up")->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); + int key_down = ED_GET_SHORTCUT("spatial_editor/freelook_down")->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); + int key_speed_modifier = ED_GET_SHORTCUT("spatial_editor/freelook_speed_modifier")->get_shortcut()->cast_to<InputEventKey>()->get_scancode(); Vector3 velocity; bool pressed = false; @@ -2424,6 +2424,14 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_selection_with_view"), VIEW_ALIGN_SELECTION_WITH_VIEW); view_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A); + ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D); + ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W); + ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S); + ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q); + ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E); + ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT); + preview_camera = memnew(Button); preview_camera->set_toggle_mode(true); preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, 90); @@ -3134,7 +3142,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) { xform_scale[i]->set_text("1"); } - xform_dialog->popup_centered(Size2(200, 200)); + xform_dialog->popup_centered(Size2(320, 240) * EDSCALE); } break; case MENU_VIEW_USE_1_VIEWPORT: { @@ -3956,55 +3964,59 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { xform_dialog = memnew(ConfirmationDialog); xform_dialog->set_title(TTR("Transform Change")); add_child(xform_dialog); + + VBoxContainer *xform_vbc = memnew(VBoxContainer); + xform_dialog->add_child(xform_vbc); + Label *l = memnew(Label); l->set_text(TTR("Translate:")); - l->set_position(Point2(5, 5)); - xform_dialog->add_child(l); + xform_vbc->add_child(l); + + HBoxContainer *xform_hbc = memnew(HBoxContainer); + xform_vbc->add_child(xform_hbc); for (int i = 0; i < 3; i++) { xform_translate[i] = memnew(LineEdit); - xform_translate[i]->set_position(Point2(15 + i * 60, 22)); - xform_translate[i]->set_size(Size2(50, 12)); - xform_dialog->add_child(xform_translate[i]); + xform_translate[i]->set_h_size_flags(SIZE_EXPAND_FILL); + xform_hbc->add_child(xform_translate[i]); } l = memnew(Label); l->set_text(TTR("Rotate (deg.):")); - l->set_position(Point2(5, 45)); - xform_dialog->add_child(l); + xform_vbc->add_child(l); + + xform_hbc = memnew(HBoxContainer); + xform_vbc->add_child(xform_hbc); for (int i = 0; i < 3; i++) { xform_rotate[i] = memnew(LineEdit); - xform_rotate[i]->set_position(Point2(15 + i * 60, 62)); - xform_rotate[i]->set_size(Size2(50, 22)); - xform_dialog->add_child(xform_rotate[i]); + xform_rotate[i]->set_h_size_flags(SIZE_EXPAND_FILL); + xform_hbc->add_child(xform_rotate[i]); } l = memnew(Label); l->set_text(TTR("Scale (ratio):")); - l->set_position(Point2(5, 85)); - xform_dialog->add_child(l); + xform_vbc->add_child(l); + + xform_hbc = memnew(HBoxContainer); + xform_vbc->add_child(xform_hbc); for (int i = 0; i < 3; i++) { xform_scale[i] = memnew(LineEdit); - xform_scale[i]->set_position(Point2(15 + i * 60, 102)); - xform_scale[i]->set_size(Size2(50, 22)); - xform_dialog->add_child(xform_scale[i]); + xform_scale[i]->set_h_size_flags(SIZE_EXPAND_FILL); + xform_hbc->add_child(xform_scale[i]); } l = memnew(Label); l->set_text(TTR("Transform Type")); - l->set_position(Point2(5, 125)); - xform_dialog->add_child(l); + xform_vbc->add_child(l); xform_type = memnew(OptionButton); - xform_type->set_anchor(MARGIN_RIGHT, ANCHOR_END); - xform_type->set_begin(Point2(15, 142)); - xform_type->set_end(Point2(15, 75)); + xform_type->set_h_size_flags(SIZE_EXPAND_FILL); xform_type->add_item(TTR("Pre")); xform_type->add_item(TTR("Post")); - xform_dialog->add_child(xform_type); + xform_vbc->add_child(xform_type); xform_dialog->connect("confirmed", this, "_xform_dialog_action"); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index fa80894f7b..6a010062f2 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -30,8 +30,8 @@ #include "sprite_frames_editor_plugin.h" #include "editor/editor_settings.h" -#include "project_settings.h" #include "io/resource_loader.h" +#include "project_settings.h" #include "scene/3d/sprite_3d.h" void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) { diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 70a1227c52..57c27a8a7e 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -30,8 +30,8 @@ #include "texture_editor_plugin.h" #include "editor/editor_settings.h" -#include "project_settings.h" #include "io/resource_loader.h" +#include "project_settings.h" void TextureEditor::_gui_input(Ref<InputEvent> p_event) { } @@ -102,14 +102,24 @@ void TextureEditor::_notification(int p_what) { } } +void TextureEditor::_changed_callback(Object *p_changed, const char *p_prop) { + + if (!is_visible()) + return; + update(); +} + void TextureEditor::edit(Ref<Texture> p_texture) { + if (!texture.is_null()) + texture->remove_change_receptor(this); + texture = p_texture; - if (!texture.is_null()) + if (!texture.is_null()) { + texture->add_change_receptor(this); update(); - else { - + } else { hide(); } } diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h index 9382983538..13f8dd7fbd 100644 --- a/editor/plugins/texture_editor_plugin.h +++ b/editor/plugins/texture_editor_plugin.h @@ -43,6 +43,7 @@ class TextureEditor : public Control { protected: void _notification(int p_what); void _gui_input(Ref<InputEvent> p_event); + void _changed_callback(Object *p_changed, const char *p_prop); static void _bind_methods(); public: diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 8a7dcea393..4cd18b090a 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -617,38 +617,24 @@ void TextureRegionEditor::_bind_methods() { } void TextureRegionEditor::edit(Object *p_obj) { - if (node_sprite && node_sprite->is_connected("texture_changed", this, "_edit_region")) - node_sprite->disconnect("texture_changed", this, "_edit_region"); - if (node_patch9 && node_patch9->is_connected("texture_changed", this, "_edit_region")) - node_patch9->disconnect("texture_changed", this, "_edit_region"); - if (obj_styleBox.is_valid() && obj_styleBox->is_connected("texture_changed", this, "_edit_region")) - obj_styleBox->disconnect("texture_changed", this, "_edit_region"); - if (atlas_tex.is_valid() && atlas_tex->is_connected("atlas_changed", this, "_edit_region")) - atlas_tex->disconnect("atlas_changed", this, "_edit_region"); + if (node_sprite) + node_sprite->remove_change_receptor(this); + if (node_patch9) + node_patch9->remove_change_receptor(this); + if (obj_styleBox.is_valid()) + obj_styleBox->remove_change_receptor(this); + if (atlas_tex.is_valid()) + atlas_tex->remove_change_receptor(this); if (p_obj) { node_sprite = p_obj->cast_to<Sprite>(); node_patch9 = p_obj->cast_to<NinePatchRect>(); if (p_obj->cast_to<StyleBoxTexture>()) obj_styleBox = Ref<StyleBoxTexture>(p_obj->cast_to<StyleBoxTexture>()); - if (p_obj->cast_to<AtlasTexture>()) { + if (p_obj->cast_to<AtlasTexture>()) atlas_tex = Ref<AtlasTexture>(p_obj->cast_to<AtlasTexture>()); - atlas_tex->connect("atlas_changed", this, "_edit_region"); - } else { - p_obj->connect("texture_changed", this, "_edit_region"); - } p_obj->add_change_receptor(this); - p_obj->connect("tree_exited", this, "_node_removed", varray(p_obj), CONNECT_ONESHOT); _edit_region(); } else { - if (node_sprite) - node_sprite->disconnect("tree_exited", this, "_node_removed"); - else if (node_patch9) - node_patch9->disconnect("tree_exited", this, "_node_removed"); - else if (obj_styleBox.is_valid()) - obj_styleBox->disconnect("tree_exited", this, "_node_removed"); - else if (atlas_tex.is_valid()) - atlas_tex->disconnect("tree_exited", this, "_node_removed"); - node_sprite = NULL; node_patch9 = NULL; obj_styleBox = Ref<StyleBoxTexture>(NULL); @@ -658,9 +644,11 @@ void TextureRegionEditor::edit(Object *p_obj) { } void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_prop) { - if ((String)p_prop == "region_rect") { + + if (!is_visible()) + return; + if (p_prop == StringName("atlas") || p_prop == StringName("texture")) _edit_region(); - } } void TextureRegionEditor::_edit_region() { diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index a83ea70508..f5bb9d4a35 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -493,11 +493,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { Ref<Theme> base_theme; - type_select->show(); - type_select_label->show(); name_select_label->show(); - name_edit->show(); - name_menu->show(); + name_hbc->show(); + type_select_label->show(); + type_select->show(); if (p_option == POPUP_ADD) { //add @@ -515,11 +514,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { base_theme = Theme::get_default(); - type_select->hide(); name_select_label->hide(); + name_hbc->hide(); type_select_label->hide(); - name_edit->hide(); - name_menu->hide(); + type_select->hide(); } else if (p_option == POPUP_REMOVE) { @@ -537,11 +535,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { base_theme = Theme::get_default(); - type_select->hide(); name_select_label->hide(); + name_hbc->hide(); type_select_label->hide(); - name_edit->hide(); - name_menu->hide(); + type_select->hide(); } popup_mode = p_option; @@ -832,48 +829,46 @@ ThemeEditor::ThemeEditor() { add_del_dialog->hide(); add_child(add_del_dialog); + VBoxContainer *dialog_vbc = memnew(VBoxContainer); + add_del_dialog->add_child(dialog_vbc); + Label *l = memnew(Label); - l->set_position(Point2(5, 5) * EDSCALE); l->set_text(TTR("Type:")); - add_del_dialog->add_child(l); - dtype_select_label = l; + dialog_vbc->add_child(l); + + type_hbc = memnew(HBoxContainer); + dialog_vbc->add_child(type_hbc); type_edit = memnew(LineEdit); - type_edit->set_position(Point2(5, 25) * EDSCALE); - type_edit->set_size(Point2(150, 5) * EDSCALE); - add_del_dialog->add_child(type_edit); + type_edit->set_h_size_flags(SIZE_EXPAND_FILL); + type_hbc->add_child(type_edit); type_menu = memnew(MenuButton); - type_menu->set_position(Point2(160, 25) * EDSCALE); - type_menu->set_size(Point2(30, 5) * EDSCALE); type_menu->set_text(".."); - add_del_dialog->add_child(type_menu); + type_hbc->add_child(type_menu); type_menu->get_popup()->connect("id_pressed", this, "_type_menu_cbk"); l = memnew(Label); - l->set_position(Point2(200, 5) * EDSCALE); l->set_text(TTR("Name:")); - add_del_dialog->add_child(l); + dialog_vbc->add_child(l); name_select_label = l; + name_hbc = memnew(HBoxContainer); + dialog_vbc->add_child(name_hbc); + name_edit = memnew(LineEdit); - name_edit->set_position(Point2(200, 25) * EDSCALE); - name_edit->set_size(Point2(150, 5) * EDSCALE); - add_del_dialog->add_child(name_edit); + name_edit->set_h_size_flags(SIZE_EXPAND_FILL); + name_hbc->add_child(name_edit); name_menu = memnew(MenuButton); - name_menu->set_position(Point2(360, 25) * EDSCALE); - name_menu->set_size(Point2(30, 5) * EDSCALE); name_menu->set_text(".."); - - add_del_dialog->add_child(name_menu); + name_hbc->add_child(name_menu); name_menu->get_popup()->connect("about_to_show", this, "_name_menu_about_to_show"); name_menu->get_popup()->connect("id_pressed", this, "_name_menu_cbk"); type_select_label = memnew(Label); - type_select_label->set_position(Point2(400, 5) * EDSCALE); type_select_label->set_text(TTR("Data Type:")); - add_del_dialog->add_child(type_select_label); + dialog_vbc->add_child(type_select_label); type_select = memnew(OptionButton); type_select->add_item(TTR("Icon")); @@ -881,10 +876,8 @@ ThemeEditor::ThemeEditor() { type_select->add_item(TTR("Font")); type_select->add_item(TTR("Color")); type_select->add_item(TTR("Constant")); - type_select->set_position(Point2(400, 25) * EDSCALE); - type_select->set_size(Point2(80, 5) * EDSCALE); - add_del_dialog->add_child(type_select); + dialog_vbc->add_child(type_select); add_del_dialog->get_ok()->connect("pressed", this, "_dialog_cbk"); diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h index 6db01c6246..a75b83e76a 100644 --- a/editor/plugins/theme_editor_plugin.h +++ b/editor/plugins/theme_editor_plugin.h @@ -54,14 +54,15 @@ class ThemeEditor : public Control { MenuButton *theme_menu; ConfirmationDialog *add_del_dialog; + HBoxContainer *type_hbc; MenuButton *type_menu; LineEdit *type_edit; + HBoxContainer *name_hbc; MenuButton *name_menu; LineEdit *name_edit; OptionButton *type_select; Label *type_select_label; Label *name_select_label; - Label *dtype_select_label; enum PopupMode { POPUP_ADD, |