summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-05-17 22:44:15 +0200
committerkobewi <kobewi4e@gmail.com>2022-05-19 15:20:46 +0200
commit9a1054d942f80efa6780253b4c3abdf6d8fdafa2 (patch)
tree218a18fe5d9f745c1bc960f4d5c824dbf591a517 /editor/plugins
parentb9bb3de6a1680693f8698926859ee3543422c0f2 (diff)
Tweak minsize of editor ColorPickerButtons
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp4
-rw-r--r--editor/plugins/theme_editor_preview.cpp12
-rw-r--r--editor/plugins/theme_editor_preview.h7
3 files changed, 22 insertions, 1 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 10c63afa02..e7b4bac8ab 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -6949,6 +6949,10 @@ void Node3DEditor::_update_theme() {
sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
+
+ sun_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor"))));
+ environ_sky_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor"))));
+ environ_ground_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor"))));
}
void Node3DEditor::_notification(int p_what) {
diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp
index 252a19a7db..a6e34cf5e0 100644
--- a/editor/plugins/theme_editor_preview.cpp
+++ b/editor/plugins/theme_editor_preview.cpp
@@ -269,6 +269,15 @@ ThemeEditorPreview::ThemeEditorPreview() {
picker_overlay->connect("mouse_exited", callable_mp(this, &ThemeEditorPreview::_reset_picker_overlay));
}
+void DefaultThemeEditorPreview::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
+ test_color_picker_button->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor"))));
+ } break;
+ }
+}
+
DefaultThemeEditorPreview::DefaultThemeEditorPreview() {
Panel *main_panel = memnew(Panel);
preview_content->add_child(main_panel);
@@ -343,7 +352,8 @@ DefaultThemeEditorPreview::DefaultThemeEditorPreview() {
test_option_button->add_item(TTR("Many"));
test_option_button->add_item(TTR("Options"));
first_vb->add_child(test_option_button);
- first_vb->add_child(memnew(ColorPickerButton));
+ test_color_picker_button = memnew(ColorPickerButton);
+ first_vb->add_child(test_color_picker_button);
VBoxContainer *second_vb = memnew(VBoxContainer);
second_vb->set_h_size_flags(SIZE_EXPAND_FILL);
diff --git a/editor/plugins/theme_editor_preview.h b/editor/plugins/theme_editor_preview.h
index d05916afae..4d209ac788 100644
--- a/editor/plugins/theme_editor_preview.h
+++ b/editor/plugins/theme_editor_preview.h
@@ -38,6 +38,8 @@
#include "scene/gui/scroll_container.h"
#include "scene/resources/theme.h"
+class ColorPickerButton;
+
class ThemeEditorPreview : public VBoxContainer {
GDCLASS(ThemeEditorPreview, VBoxContainer);
@@ -87,6 +89,11 @@ public:
class DefaultThemeEditorPreview : public ThemeEditorPreview {
GDCLASS(DefaultThemeEditorPreview, ThemeEditorPreview);
+ ColorPickerButton *test_color_picker_button = nullptr;
+
+protected:
+ void _notification(int p_what);
+
public:
DefaultThemeEditorPreview();
};