mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 13:49:54 +00:00
Merge pull request #112615 from YeldhamDev/inspector_props_size_fix
Fix issues with property height in the inspector
This commit is contained in:
commit
8437869434
14 changed files with 171 additions and 93 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/math/expression.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/string/translation_server.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/settings/editor_settings.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "scene/theme/theme_db.h"
|
||||
|
|
@ -464,6 +465,7 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||
case NOTIFICATION_TRANSLATION_CHANGED:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("inspector_property_height"), EditorStringName(Editor))));
|
||||
_update_value_input_stylebox();
|
||||
} break;
|
||||
|
||||
|
|
@ -516,17 +518,6 @@ LineEdit *EditorSpinSlider::get_line_edit() {
|
|||
return value_input;
|
||||
}
|
||||
|
||||
Size2 EditorSpinSlider::get_minimum_size() const {
|
||||
Ref<StyleBox> sb = get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"));
|
||||
Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("LineEdit"));
|
||||
int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("LineEdit"));
|
||||
|
||||
Size2 ms = sb->get_minimum_size();
|
||||
ms.height += font->get_height(font_size);
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
void EditorSpinSlider::set_control_state(ControlState p_state) {
|
||||
control_state = p_state;
|
||||
queue_redraw();
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ public:
|
|||
void setup_and_show() { _focus_entered(); }
|
||||
LineEdit *get_line_edit();
|
||||
|
||||
virtual Size2 get_minimum_size() const override;
|
||||
EditorSpinSlider();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -219,10 +219,7 @@ Size2 EditorProperty::get_minimum_size() const {
|
|||
return Vector2();
|
||||
}
|
||||
|
||||
Size2 ms;
|
||||
int separation = 4 * EDSCALE;
|
||||
ms.height = label.is_empty() ? 0 : theme_cache.font->get_height(theme_cache.font_size) + separation;
|
||||
|
||||
Size2 ms = Size2(0, theme_cache.inspector_property_height);
|
||||
for (int i = 0; i < get_child_count(); i++) {
|
||||
Control *c = as_sortable_control(get_child(i));
|
||||
if (!c) {
|
||||
|
|
@ -316,7 +313,7 @@ void EditorProperty::_notification(int p_what) {
|
|||
{
|
||||
int child_room = size.width * (1.0 - split_ratio);
|
||||
int separation = 4 * EDSCALE;
|
||||
int height = label.is_empty() ? 0 : theme_cache.font->get_height(theme_cache.font_size) + separation;
|
||||
int height = theme_cache.inspector_property_height;
|
||||
int half_padding = theme_cache.padding / 2;
|
||||
bool no_children = true;
|
||||
|
||||
|
|
@ -1982,8 +1979,6 @@ void EditorInspectorSection::_notification(int p_what) {
|
|||
|
||||
bg_color = theme_cache.prop_subsection;
|
||||
bg_color.a /= level;
|
||||
|
||||
vbox->add_theme_constant_override("separation", theme_cache.vertical_separation);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_SORT_CHILDREN: {
|
||||
|
|
@ -2546,6 +2541,7 @@ EditorInspectorSection::EditorInspectorSection() {
|
|||
set_focus_mode(FOCUS_ACCESSIBILITY);
|
||||
|
||||
vbox = memnew(VBoxContainer);
|
||||
vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
|
||||
dropping_unfold_timer = memnew(Timer);
|
||||
dropping_unfold_timer->set_wait_time(EDITOR_GET("interface/editor/dragging_hover_wait_seconds"));
|
||||
|
|
@ -3557,7 +3553,7 @@ void EditorInspector::initialize_section_theme(EditorInspectorSection::ThemeCach
|
|||
}
|
||||
|
||||
p_cache.horizontal_separation = p_control->get_theme_constant(SNAME("h_separation"), SNAME("EditorInspectorSection"));
|
||||
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("v_separation"), SNAME("EditorInspector"));
|
||||
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("separation"), SNAME("EditorPropertyContainer"));
|
||||
p_cache.inspector_margin = p_control->get_theme_constant(SNAME("inspector_margin"), EditorStringName(Editor));
|
||||
p_cache.indent_size = p_control->get_theme_constant(SNAME("indent_size"), SNAME("EditorInspectorSection"));
|
||||
p_cache.key_padding_size = int(EDITOR_GET("interface/theme/base_spacing")) * 2;
|
||||
|
|
@ -3596,7 +3592,7 @@ void EditorInspector::initialize_category_theme(EditorInspectorCategory::ThemeCa
|
|||
}
|
||||
|
||||
p_cache.horizontal_separation = p_control->get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
||||
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("v_separation"), SNAME("EditorInspector"));
|
||||
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("separation"), SNAME("EditorPropertyContainer"));
|
||||
p_cache.class_icon_size = p_control->get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor));
|
||||
|
||||
p_cache.font_color = p_control->get_theme_color(SceneStringName(font_color), SNAME("Tree"));
|
||||
|
|
@ -3644,8 +3640,9 @@ void EditorInspector::initialize_property_theme(EditorProperty::ThemeCache &p_ca
|
|||
p_cache.font_size = p_control->get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
|
||||
p_cache.font_offset = p_control->get_theme_constant(SNAME("font_offset"), SNAME("EditorProperty"));
|
||||
p_cache.horizontal_separation = p_control->get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
||||
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("v_separation"), SNAME("EditorProperty"));
|
||||
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("separation"), SNAME("EditorPropertyContainer"));
|
||||
p_cache.padding = int(EDITOR_GET("interface/theme/base_spacing")) * 2;
|
||||
p_cache.inspector_property_height = p_control->get_theme_constant(SNAME("inspector_property_height"), EditorStringName(Editor));
|
||||
|
||||
p_cache.property_color = p_control->get_theme_color(SNAME("property_color"), SNAME("EditorProperty"));
|
||||
p_cache.readonly_property_color = p_control->get_theme_color(SNAME("readonly_color"), SNAME("EditorProperty"));
|
||||
|
|
@ -3807,7 +3804,7 @@ bool EditorInspector::_is_property_disabled_by_feature_profile(const StringName
|
|||
}
|
||||
|
||||
void EditorInspector::_add_section_in_tree(EditorInspectorSection *p_section, VBoxContainer *p_current_vbox) {
|
||||
// Place adjacent sections in their own vbox with 0 separation
|
||||
// Place adjacent sections in their own vbox with a theme-specific separation.
|
||||
VBoxContainer *container = nullptr;
|
||||
if (p_current_vbox->get_child_count() > 0) {
|
||||
Node *last_child = p_current_vbox->get_child(-1);
|
||||
|
|
@ -3815,7 +3812,7 @@ void EditorInspector::_add_section_in_tree(EditorInspectorSection *p_section, VB
|
|||
}
|
||||
if (!container) {
|
||||
container = memnew(VBoxContainer);
|
||||
container->add_theme_constant_override("separation", theme_cache.vertical_separation);
|
||||
container->set_theme_type_variation(SNAME("EditorInspectorContainer"));
|
||||
p_current_vbox->add_child(container);
|
||||
}
|
||||
container->add_child(p_section);
|
||||
|
|
@ -3919,13 +3916,15 @@ void EditorInspector::update_tree() {
|
|||
bool sub_inspectors_enabled = EDITOR_GET("interface/inspector/open_resources_in_current_inspector");
|
||||
|
||||
if (!valid_plugins.is_empty()) {
|
||||
begin_vbox->show();
|
||||
|
||||
// Get the lists of editors to add the beginning.
|
||||
for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
|
||||
ped->parse_begin(object);
|
||||
_parse_added_editors(begin_vbox, nullptr, ped);
|
||||
}
|
||||
|
||||
// Show if any of the editors were added to the beginning.
|
||||
if (begin_vbox->get_child_count() > 0) {
|
||||
begin_vbox->show();
|
||||
}
|
||||
}
|
||||
|
||||
StringName doc_name;
|
||||
|
|
@ -4217,7 +4216,7 @@ void EditorInspector::update_tree() {
|
|||
// Recreate the category vbox if it was reset.
|
||||
if (category_vbox == nullptr) {
|
||||
category_vbox = memnew(VBoxContainer);
|
||||
category_vbox->add_theme_constant_override("separation", theme_cache.vertical_separation);
|
||||
category_vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
category_vbox->hide();
|
||||
main_vbox->add_child(category_vbox);
|
||||
}
|
||||
|
|
@ -4684,6 +4683,8 @@ void EditorInspector::update_tree() {
|
|||
String tooltip;
|
||||
VBoxContainer *parent_vbox = favorites_vbox;
|
||||
if (!section_name.is_empty()) {
|
||||
favorites_groups_vbox->show();
|
||||
|
||||
if (is_localized) {
|
||||
label = EditorPropertyNameProcessor::get_singleton()->translate_group_name(section_name);
|
||||
tooltip = section_name;
|
||||
|
|
@ -4785,6 +4786,10 @@ void EditorInspector::update_tree() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (favorites_vbox->get_child_count() > 0) {
|
||||
favorites_vbox->show();
|
||||
}
|
||||
}
|
||||
|
||||
// Show a separator if there's no category to clearly divide the properties.
|
||||
|
|
@ -4863,9 +4868,11 @@ void EditorInspector::_clear(bool p_hide_plugins) {
|
|||
}
|
||||
|
||||
favorites_section->hide();
|
||||
favorites_vbox->hide();
|
||||
while (favorites_vbox->get_child_count()) {
|
||||
memdelete(favorites_vbox->get_child(0));
|
||||
}
|
||||
favorites_groups_vbox->hide();
|
||||
while (favorites_groups_vbox->get_child_count()) {
|
||||
memdelete(favorites_groups_vbox->get_child(0));
|
||||
}
|
||||
|
|
@ -5648,19 +5655,11 @@ void EditorInspector::_notification(int p_what) {
|
|||
break;
|
||||
}
|
||||
|
||||
theme_cache.vertical_separation = get_theme_constant(SNAME("v_separation"), SNAME("EditorInspector"));
|
||||
theme_cache.prop_subsection = get_theme_color(SNAME("prop_subsection"), EditorStringName(Editor));
|
||||
theme_cache.icon_add = get_editor_theme_icon(SNAME("Add"));
|
||||
|
||||
initialize_section_theme(section_theme_cache, this);
|
||||
initialize_category_theme(category_theme_cache, this);
|
||||
initialize_property_theme(property_theme_cache, this);
|
||||
|
||||
base_vbox->add_theme_constant_override("separation", theme_cache.vertical_separation);
|
||||
begin_vbox->add_theme_constant_override("separation", theme_cache.vertical_separation);
|
||||
favorites_section->add_theme_constant_override("separation", theme_cache.vertical_separation);
|
||||
favorites_groups_vbox->add_theme_constant_override("separation", theme_cache.vertical_separation);
|
||||
main_vbox->add_theme_constant_override("separation", theme_cache.vertical_separation);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_READY: {
|
||||
|
|
@ -5893,14 +5892,17 @@ EditorInspector::EditorInspector() {
|
|||
object = nullptr;
|
||||
|
||||
base_vbox = memnew(VBoxContainer);
|
||||
base_vbox->set_theme_type_variation(SNAME("EditorInspectorContainer"));
|
||||
base_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
add_child(base_vbox);
|
||||
|
||||
begin_vbox = memnew(VBoxContainer);
|
||||
begin_vbox->set_theme_type_variation(SNAME("EditorInspectorContainer"));
|
||||
base_vbox->add_child(begin_vbox);
|
||||
begin_vbox->hide();
|
||||
|
||||
favorites_section = memnew(VBoxContainer);
|
||||
favorites_section->set_theme_type_variation(SNAME("EditorInspectorContainer"));
|
||||
base_vbox->add_child(favorites_section);
|
||||
favorites_section->hide();
|
||||
|
||||
|
|
@ -5910,15 +5912,20 @@ EditorInspector::EditorInspector() {
|
|||
favorites_section->add_child(favorites_category);
|
||||
|
||||
favorites_vbox = memnew(VBoxContainer);
|
||||
favorites_vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
favorites_section->add_child(favorites_vbox);
|
||||
favorites_vbox->hide();
|
||||
favorites_groups_vbox = memnew(VBoxContainer);
|
||||
favorites_groups_vbox->set_theme_type_variation(SNAME("EditorInspectorContainer"));
|
||||
favorites_section->add_child(favorites_groups_vbox);
|
||||
favorites_groups_vbox->hide();
|
||||
|
||||
favorites_separator = memnew(HSeparator);
|
||||
favorites_section->add_child(favorites_separator);
|
||||
favorites_separator->hide();
|
||||
|
||||
main_vbox = memnew(VBoxContainer);
|
||||
main_vbox->set_theme_type_variation(SNAME("EditorInspectorContainer"));
|
||||
base_vbox->add_child(main_vbox);
|
||||
|
||||
set_horizontal_scroll_mode(SCROLL_MODE_DISABLED);
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ class EditorProperty : public Container {
|
|||
int horizontal_separation = 0;
|
||||
int vertical_separation = 0;
|
||||
int padding = 0;
|
||||
int inspector_property_height = 0;
|
||||
|
||||
Color property_color;
|
||||
Color readonly_property_color;
|
||||
|
|
@ -701,9 +702,7 @@ class EditorInspector : public ScrollContainer {
|
|||
static int inspector_plugin_count;
|
||||
|
||||
struct ThemeCache {
|
||||
int vertical_separation = 0;
|
||||
Color prop_subsection;
|
||||
Ref<Texture2D> icon_add;
|
||||
} theme_cache;
|
||||
|
||||
EditorInspectorSection::ThemeCache section_theme_cache;
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ EditorPropertyVariant::EditorPropertyVariant() {
|
|||
|
||||
edit_button = memnew(Button);
|
||||
edit_button->set_flat(true);
|
||||
edit_button->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit_button->set_accessibility_name(TTRC("Edit"));
|
||||
edit_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyVariant::_popup_edit_menu));
|
||||
content->add_child(edit_button);
|
||||
|
|
@ -409,6 +410,7 @@ EditorPropertyMultilineText::EditorPropertyMultilineText(bool p_expression) :
|
|||
open_big_text = memnew(Button);
|
||||
open_big_text->set_accessibility_name(TTRC("Open Text Edit Dialog"));
|
||||
open_big_text->set_flat(true);
|
||||
open_big_text->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
open_big_text->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyMultilineText::_open_big_text));
|
||||
hb->add_child(open_big_text);
|
||||
big_text_dialog = nullptr;
|
||||
|
|
@ -558,6 +560,7 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() {
|
|||
option_button->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
option_button->set_clip_text(true);
|
||||
option_button->set_flat(true);
|
||||
option_button->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
option_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
default_layout->add_child(option_button);
|
||||
option_button->connect(SceneStringName(item_selected), callable_mp(this, &EditorPropertyTextEnum::_option_selected));
|
||||
|
|
@ -565,6 +568,7 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() {
|
|||
edit_button = memnew(Button);
|
||||
edit_button->set_accessibility_name(TTRC("Edit"));
|
||||
edit_button->set_flat(true);
|
||||
edit_button->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit_button->hide();
|
||||
default_layout->add_child(edit_button);
|
||||
edit_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyTextEnum::_edit_custom_value));
|
||||
|
|
@ -578,12 +582,14 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() {
|
|||
accept_button = memnew(Button);
|
||||
accept_button->set_accessibility_name(TTRC("Accept Custom Value Edit"));
|
||||
accept_button->set_flat(true);
|
||||
accept_button->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit_custom_layout->add_child(accept_button);
|
||||
accept_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyTextEnum::_custom_value_accepted));
|
||||
|
||||
cancel_button = memnew(Button);
|
||||
cancel_button->set_accessibility_name(TTRC("Cancel Custom Value Edit"));
|
||||
cancel_button->set_flat(true);
|
||||
cancel_button->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit_custom_layout->add_child(cancel_button);
|
||||
cancel_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyTextEnum::_custom_value_canceled));
|
||||
|
||||
|
|
@ -647,6 +653,7 @@ EditorPropertyLocale::EditorPropertyLocale() {
|
|||
locale_edit = memnew(Button);
|
||||
locale_edit->set_accessibility_name(TTRC("Edit"));
|
||||
locale_edit->set_clip_text(true);
|
||||
locale_edit->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
locale_hb->add_child(locale_edit);
|
||||
add_focusable(locale);
|
||||
dialog = nullptr;
|
||||
|
|
@ -818,11 +825,13 @@ EditorPropertyPath::EditorPropertyPath() {
|
|||
toggle_uid->set_accessibility_name(TTRC("Toggle Display UID"));
|
||||
toggle_uid->set_tooltip_text(TTRC("Toggles displaying between path and UID.\nThe UID is the actual value of this property."));
|
||||
toggle_uid->set_pressed(false);
|
||||
toggle_uid->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
path_hb->add_child(toggle_uid);
|
||||
add_focusable(toggle_uid);
|
||||
toggle_uid->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyPath::_toggle_uid_display));
|
||||
|
||||
path_edit = memnew(Button);
|
||||
path_edit->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
path_edit->set_accessibility_name(TTRC("Edit"));
|
||||
path_hb->add_child(path_edit);
|
||||
add_focusable(path);
|
||||
|
|
@ -861,6 +870,7 @@ void EditorPropertyClassName::_dialog_created() {
|
|||
EditorPropertyClassName::EditorPropertyClassName() {
|
||||
property = memnew(Button);
|
||||
property->set_clip_text(true);
|
||||
property->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
add_child(property);
|
||||
add_focusable(property);
|
||||
property->set_text(selected_type);
|
||||
|
|
@ -955,6 +965,7 @@ EditorPropertyEnum::EditorPropertyEnum() {
|
|||
options = memnew(OptionButton);
|
||||
options->set_clip_text(true);
|
||||
options->set_flat(true);
|
||||
options->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
add_child(options);
|
||||
add_focusable(options);
|
||||
|
|
@ -1622,6 +1633,7 @@ void EditorPropertyObjectID::setup(const String &p_base_type) {
|
|||
|
||||
EditorPropertyObjectID::EditorPropertyObjectID() {
|
||||
edit = memnew(Button);
|
||||
edit->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit->set_accessibility_name(TTRC("Edit"));
|
||||
add_child(edit);
|
||||
add_focusable(edit);
|
||||
|
|
@ -1648,6 +1660,7 @@ void EditorPropertySignal::update_property() {
|
|||
|
||||
EditorPropertySignal::EditorPropertySignal() {
|
||||
edit = memnew(Button);
|
||||
edit->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit->set_accessibility_name(TTRC("Edit"));
|
||||
add_child(edit);
|
||||
add_focusable(edit);
|
||||
|
|
@ -1668,6 +1681,7 @@ void EditorPropertyCallable::update_property() {
|
|||
|
||||
EditorPropertyCallable::EditorPropertyCallable() {
|
||||
edit = memnew(Button);
|
||||
edit->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit->set_accessibility_name(TTRC("Edit"));
|
||||
add_child(edit);
|
||||
add_focusable(edit);
|
||||
|
|
@ -2390,6 +2404,7 @@ EditorPropertyQuaternion::EditorPropertyQuaternion() {
|
|||
warning = memnew(Button);
|
||||
warning->set_text(TTR("Temporary Euler may be changed implicitly!"));
|
||||
warning->set_clip_text(true);
|
||||
warning->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
warning->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyQuaternion::_warning_pressed));
|
||||
warning_dialog = memnew(AcceptDialog);
|
||||
add_child(warning_dialog);
|
||||
|
|
@ -2419,6 +2434,7 @@ EditorPropertyQuaternion::EditorPropertyQuaternion() {
|
|||
edit_button->set_accessibility_name(TTRC("Edit"));
|
||||
edit_button->set_flat(true);
|
||||
edit_button->set_toggle_mode(true);
|
||||
edit_button->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
default_layout->add_child(edit_button);
|
||||
edit_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyQuaternion::_edit_custom_value));
|
||||
|
||||
|
|
@ -2897,14 +2913,6 @@ void EditorPropertyColor::_popup_closed() {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorPropertyColor::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
picker->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), EditorStringName(Editor))));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void EditorPropertyColor::update_property() {
|
||||
picker->set_pick_color(get_edited_property_display_value());
|
||||
const Color color = picker->get_pick_color();
|
||||
|
|
@ -2938,6 +2946,7 @@ EditorPropertyColor::EditorPropertyColor() {
|
|||
picker = memnew(ColorPickerButton);
|
||||
add_child(picker);
|
||||
picker->set_flat(true);
|
||||
picker->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
picker->connect("color_changed", callable_mp(this, &EditorPropertyColor::_color_changed));
|
||||
picker->connect("picker_created", callable_mp(this, &EditorPropertyColor::_picker_created), CONNECT_ONE_SHOT);
|
||||
}
|
||||
|
|
@ -3246,6 +3255,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() {
|
|||
assign = memnew(Button);
|
||||
assign->set_accessibility_name(TTRC("Assign Node"));
|
||||
assign->set_flat(true);
|
||||
assign->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
assign->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
assign->set_clip_text(true);
|
||||
assign->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
|
|
|
|||
|
|
@ -669,7 +669,6 @@ class EditorPropertyColor : public EditorProperty {
|
|||
|
||||
protected:
|
||||
virtual void _set_read_only(bool p_read_only) override;
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
virtual void update_property() override;
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ void EditorPropertyArray::_create_new_property_slot() {
|
|||
reorder_button->set_button_icon(get_editor_theme_icon(SNAME("TripleBar")));
|
||||
reorder_button->set_default_cursor_shape(Control::CURSOR_MOVE);
|
||||
reorder_button->set_disabled(is_read_only());
|
||||
reorder_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
reorder_button->set_theme_type_variation(SNAME("EditorInspectorFlatButton"));
|
||||
reorder_button->connect(SceneStringName(gui_input), callable_mp(this, &EditorPropertyArray::_reorder_button_gui_input));
|
||||
reorder_button->connect(SNAME("button_up"), callable_mp(this, &EditorPropertyArray::_reorder_button_up));
|
||||
reorder_button->connect(SNAME("button_down"), callable_mp(this, &EditorPropertyArray::_reorder_button_down).bind(idx));
|
||||
|
|
@ -332,14 +332,14 @@ void EditorPropertyArray::_create_new_property_slot() {
|
|||
edit_btn->set_accessibility_name(TTRC("Edit"));
|
||||
edit_btn->set_button_icon(get_editor_theme_icon(SNAME("Edit")));
|
||||
edit_btn->set_disabled(is_read_only());
|
||||
edit_btn->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
edit_btn->set_theme_type_variation(SNAME("EditorInspectorFlatButton"));
|
||||
edit_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_change_type).bind(edit_btn, idx));
|
||||
} else {
|
||||
remove_btn = memnew(Button);
|
||||
remove_btn->set_accessibility_name(TTRC("Remove"));
|
||||
remove_btn->set_button_icon(get_editor_theme_icon(SNAME("Remove")));
|
||||
remove_btn->set_disabled(is_read_only());
|
||||
remove_btn->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
remove_btn->set_theme_type_variation(SNAME("EditorInspectorFlatButton"));
|
||||
remove_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_remove_pressed).bind(idx));
|
||||
}
|
||||
property_vbox->add_child(hbox);
|
||||
|
|
@ -442,6 +442,7 @@ void EditorPropertyArray::update_property() {
|
|||
set_bottom_editor(container);
|
||||
|
||||
VBoxContainer *vbox = memnew(VBoxContainer);
|
||||
vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
container->add_child(vbox);
|
||||
|
||||
HBoxContainer *hbox = memnew(HBoxContainer);
|
||||
|
|
@ -462,6 +463,7 @@ void EditorPropertyArray::update_property() {
|
|||
hbox->add_child(size_slider);
|
||||
|
||||
property_vbox = memnew(VBoxContainer);
|
||||
property_vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
property_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbox->add_child(property_vbox);
|
||||
|
||||
|
|
@ -974,6 +976,7 @@ EditorPropertyArray::EditorPropertyArray() {
|
|||
edit->set_accessibility_name(TTRC("Edit"));
|
||||
edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
edit->set_clip_text(true);
|
||||
edit->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_edit_pressed));
|
||||
edit->set_toggle_mode(true);
|
||||
SET_DRAG_FORWARDING_CD(edit, EditorPropertyArray);
|
||||
|
|
@ -1089,14 +1092,14 @@ void EditorPropertyDictionary::_create_new_property_slot(int p_idx) {
|
|||
edit_btn->set_accessibility_name(TTRC("Edit"));
|
||||
edit_btn->set_button_icon(get_editor_theme_icon(SNAME("Edit")));
|
||||
edit_btn->set_disabled(is_read_only());
|
||||
edit_btn->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
edit_btn->set_theme_type_variation(SNAME("EditorInspectorFlatButton"));
|
||||
edit_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyDictionary::_change_type).bind(edit_btn, slots.size()));
|
||||
} else if (p_idx >= 0) {
|
||||
remove_btn = memnew(Button);
|
||||
remove_btn->set_accessibility_name(TTRC("Remove"));
|
||||
remove_btn->set_button_icon(get_editor_theme_icon(SNAME("Remove")));
|
||||
remove_btn->set_disabled(is_read_only());
|
||||
remove_btn->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
remove_btn->set_theme_type_variation(SNAME("EditorInspectorFlatButton"));
|
||||
remove_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyDictionary::_remove_pressed).bind(slots.size()));
|
||||
}
|
||||
|
||||
|
|
@ -1301,9 +1304,11 @@ void EditorPropertyDictionary::update_property() {
|
|||
set_bottom_editor(container);
|
||||
|
||||
VBoxContainer *vbox = memnew(VBoxContainer);
|
||||
vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
container->add_child(vbox);
|
||||
|
||||
property_vbox = memnew(VBoxContainer);
|
||||
property_vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
property_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbox->add_child(property_vbox);
|
||||
|
||||
|
|
@ -1319,6 +1324,7 @@ void EditorPropertyDictionary::update_property() {
|
|||
property_vbox->add_child(add_panel);
|
||||
add_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("DictionaryAddItem")));
|
||||
VBoxContainer *add_vbox = memnew(VBoxContainer);
|
||||
add_vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
add_panel->add_child(add_vbox);
|
||||
|
||||
_create_new_property_slot(EditorPropertyDictionaryObject::NEW_KEY_INDEX);
|
||||
|
|
@ -1539,6 +1545,7 @@ EditorPropertyDictionary::EditorPropertyDictionary() {
|
|||
edit->set_accessibility_name(TTRC("Edit"));
|
||||
edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
edit->set_clip_text(true);
|
||||
edit->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyDictionary::_edit_pressed));
|
||||
edit->set_toggle_mode(true);
|
||||
add_child(edit);
|
||||
|
|
@ -1636,9 +1643,11 @@ void EditorPropertyLocalizableString::update_property() {
|
|||
set_bottom_editor(container);
|
||||
|
||||
VBoxContainer *vbox = memnew(VBoxContainer);
|
||||
vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
container->add_child(vbox);
|
||||
|
||||
property_vbox = memnew(VBoxContainer);
|
||||
property_vbox->set_theme_type_variation(SNAME("EditorPropertyContainer"));
|
||||
property_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbox->add_child(property_vbox);
|
||||
|
||||
|
|
@ -1750,6 +1759,7 @@ EditorPropertyLocalizableString::EditorPropertyLocalizableString() {
|
|||
edit->set_accessibility_name(TTRC("Edit"));
|
||||
edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
edit->set_clip_text(true);
|
||||
edit->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyLocalizableString::_edit_pressed));
|
||||
edit->set_toggle_mode(true);
|
||||
add_child(edit);
|
||||
|
|
|
|||
|
|
@ -1434,6 +1434,7 @@ EditorResourcePicker::EditorResourcePicker(bool p_hide_assign_button_controls) {
|
|||
make_unique_button->set_tooltip_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
make_unique_button->set_button_mask(MouseButtonMask::LEFT | MouseButtonMask::RIGHT);
|
||||
make_unique_button->set_action_mode(BaseButton::ACTION_MODE_BUTTON_PRESS);
|
||||
make_unique_button->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
add_child(make_unique_button);
|
||||
make_unique_button->connect(SceneStringName(pressed), callable_mp(this, &EditorResourcePicker::_on_unique_button_pressed));
|
||||
|
||||
|
|
@ -1443,6 +1444,7 @@ EditorResourcePicker::EditorResourcePicker(bool p_hide_assign_button_controls) {
|
|||
assign_button->set_accessibility_name(TTRC("Assign Resource"));
|
||||
assign_button->set_expand_icon(true);
|
||||
assign_button->set_clip_text(true);
|
||||
assign_button->set_theme_type_variation(SNAME("EditorInspectorButton"));
|
||||
assign_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
SET_DRAG_FORWARDING_GCD(assign_button, EditorResourcePicker);
|
||||
add_child(assign_button);
|
||||
|
|
@ -1462,13 +1464,13 @@ EditorResourcePicker::EditorResourcePicker(bool p_hide_assign_button_controls) {
|
|||
}
|
||||
|
||||
quick_load_button = memnew(Button);
|
||||
quick_load_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
quick_load_button->set_theme_type_variation(SNAME("EditorInspectorFlatButton"));
|
||||
quick_load_button->set_tooltip_text(TTRC("Quick Load"));
|
||||
add_child(quick_load_button);
|
||||
quick_load_button->connect(SceneStringName(pressed), callable_mp(this, &EditorResourcePicker::_edit_menu_cbk).bind(OBJ_MENU_QUICKLOAD));
|
||||
|
||||
edit_button = memnew(Button);
|
||||
edit_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
edit_button->set_theme_type_variation(SNAME("EditorInspectorFlatButton"));
|
||||
edit_button->set_toggle_mode(true);
|
||||
edit_button->set_action_mode(BaseButton::ACTION_MODE_BUTTON_PRESS);
|
||||
edit_button->set_accessibility_name(TTRC("Edit"));
|
||||
|
|
|
|||
|
|
@ -8888,9 +8888,9 @@ void Node3DEditor::_update_theme() {
|
|||
sun_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title_font"), SNAME("Window")));
|
||||
environ_title->add_theme_font_override(SceneStringName(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"), EditorStringName(Editor))));
|
||||
environ_sky_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), EditorStringName(Editor))));
|
||||
environ_ground_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), EditorStringName(Editor))));
|
||||
sun_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("inspector_property_height"), EditorStringName(Editor))));
|
||||
environ_sky_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("inspector_property_height"), EditorStringName(Editor))));
|
||||
environ_ground_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("inspector_property_height"), EditorStringName(Editor))));
|
||||
|
||||
context_toolbar_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("ContextualToolbar"), EditorStringName(EditorStyles)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ ThemeEditorPreview::ThemeEditorPreview() {
|
|||
void DefaultThemeEditorPreview::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
test_color_picker_button->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), EditorStringName(Editor))));
|
||||
test_color_picker_button->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("inspector_property_height"), EditorStringName(Editor))));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ uint32_t EditorThemeManager::ThemeConfiguration::hash() {
|
|||
hash = hash_murmur3_one_32(class_icon_size, hash);
|
||||
hash = hash_murmur3_one_32((int)enable_touch_optimizations, hash);
|
||||
hash = hash_murmur3_one_float(gizmo_handle_scale, hash);
|
||||
hash = hash_murmur3_one_32(color_picker_button_height, hash);
|
||||
hash = hash_murmur3_one_32(inspector_property_height, hash);
|
||||
hash = hash_murmur3_one_float(subresource_hue_tint, hash);
|
||||
|
||||
hash = hash_murmur3_one_float(default_contrast, hash);
|
||||
|
|
@ -168,7 +168,7 @@ Ref<EditorTheme> EditorThemeManager::_create_base_theme(const Ref<EditorTheme> &
|
|||
OS::get_singleton()->benchmark_begin_measure(get_benchmark_key(), "Create Base Theme");
|
||||
|
||||
Ref<EditorTheme> theme = memnew(EditorTheme);
|
||||
ThemeConfiguration config = _create_theme_config(theme);
|
||||
ThemeConfiguration config = _create_theme_config();
|
||||
theme->set_generated_hash(config.hash());
|
||||
theme->set_generated_fonts_hash(config.hash_fonts());
|
||||
theme->set_generated_icons_hash(config.hash_icons());
|
||||
|
|
@ -235,7 +235,7 @@ Ref<EditorTheme> EditorThemeManager::_create_base_theme(const Ref<EditorTheme> &
|
|||
return theme;
|
||||
}
|
||||
|
||||
EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config(const Ref<EditorTheme> &p_theme) {
|
||||
EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config() {
|
||||
ThemeConfiguration config;
|
||||
|
||||
// Basic properties.
|
||||
|
|
@ -264,7 +264,6 @@ EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config(
|
|||
config.class_icon_size = 16 * EDSCALE;
|
||||
config.enable_touch_optimizations = EDITOR_GET("interface/touchscreen/enable_touch_optimizations");
|
||||
config.gizmo_handle_scale = EDITOR_GET("interface/touchscreen/scale_gizmo_handles");
|
||||
config.color_picker_button_height = 28 * EDSCALE;
|
||||
config.subresource_hue_tint = EDITOR_GET("docks/property_editor/subresource_hue_tint");
|
||||
config.dragging_hover_wait_msec = (float)EDITOR_GET("interface/editor/dragging_hover_wait_seconds") * 1000;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public:
|
|||
int class_icon_size = 16;
|
||||
bool enable_touch_optimizations = false;
|
||||
float gizmo_handle_scale = 1.0;
|
||||
int color_picker_button_height = 28;
|
||||
int inspector_property_height = 28;
|
||||
float subresource_hue_tint = 0.0;
|
||||
float dragging_hover_wait_msec = 0;
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ public:
|
|||
|
||||
private:
|
||||
static Ref<EditorTheme> _create_base_theme(const Ref<EditorTheme> &p_old_theme = nullptr);
|
||||
static ThemeConfiguration _create_theme_config(const Ref<EditorTheme> &p_theme);
|
||||
static ThemeConfiguration _create_theme_config();
|
||||
|
||||
static void _populate_text_editor_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
|
||||
static void _populate_visual_shader_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
|
||||
|
|
|
|||
|
|
@ -225,7 +225,6 @@ void ThemeClassic::populate_shared_styles(const Ref<EditorTheme> &p_theme, Edito
|
|||
|
||||
p_theme->set_constant("thumb_size", EditorStringName(Editor), p_config.thumb_size);
|
||||
p_theme->set_constant("class_icon_size", EditorStringName(Editor), p_config.class_icon_size);
|
||||
p_theme->set_constant("color_picker_button_height", EditorStringName(Editor), p_config.color_picker_button_height);
|
||||
p_theme->set_constant("gizmo_handle_scale", EditorStringName(Editor), p_config.gizmo_handle_scale);
|
||||
|
||||
p_theme->set_constant("base_margin", EditorStringName(Editor), p_config.base_margin);
|
||||
|
|
@ -1998,8 +1997,13 @@ void ThemeClassic::populate_editor_styles(const Ref<EditorTheme> &p_theme, Edito
|
|||
editor_inspector_panel->set_content_margin_all(0);
|
||||
p_theme->set_stylebox(SceneStringName(panel), "EditorInspector", editor_inspector_panel);
|
||||
|
||||
// Vertical separation between inspector categories and sections.
|
||||
p_theme->set_constant("v_separation", "EditorInspector", 0);
|
||||
// Vertical separation between inspector areas.
|
||||
p_theme->set_type_variation("EditorInspectorContainer", "VBoxContainer");
|
||||
p_theme->set_constant("separation", "EditorInspectorContainer", 0);
|
||||
|
||||
// Vertical separation between inspector properties.
|
||||
p_theme->set_type_variation("EditorPropertyContainer", "VBoxContainer");
|
||||
p_theme->set_constant("separation", "EditorPropertyContainer", p_config.increased_margin * EDSCALE);
|
||||
|
||||
// EditorProperty.
|
||||
|
||||
|
|
@ -2015,7 +2019,6 @@ void ThemeClassic::populate_editor_styles(const Ref<EditorTheme> &p_theme, Edito
|
|||
p_theme->set_stylebox("bg_selected", "EditorProperty", style_property_bg);
|
||||
p_theme->set_stylebox("child_bg", "EditorProperty", style_property_child_bg);
|
||||
p_theme->set_constant("font_offset", "EditorProperty", 8 * EDSCALE);
|
||||
p_theme->set_constant("v_separation", "EditorProperty", p_config.increased_margin * EDSCALE);
|
||||
|
||||
const Color property_color = p_config.font_color.lerp(Color(0.5, 0.5, 0.5), 0.5);
|
||||
const Color readonly_color = property_color.lerp(p_config.dark_icon_and_font ? Color(0, 0, 0) : Color(1, 1, 1), 0.25);
|
||||
|
|
@ -2032,6 +2035,13 @@ void ThemeClassic::populate_editor_styles(const Ref<EditorTheme> &p_theme, Edito
|
|||
style_property_group_note->set_bg_color(property_group_note_color);
|
||||
p_theme->set_stylebox("bg_group_note", "EditorProperty", style_property_group_note);
|
||||
|
||||
// Make the height for properties uniform.
|
||||
Ref<StyleBoxFlat> inspector_button_style = p_theme->get_stylebox(CoreStringName(normal), SNAME("Button"));
|
||||
Ref<Font> font = p_theme->get_font(SceneStringName(font), SNAME("LineEdit"));
|
||||
int font_size = p_theme->get_font_size(SceneStringName(font_size), SNAME("LineEdit"));
|
||||
p_config.inspector_property_height = inspector_button_style->get_minimum_size().height + font->get_height(font_size);
|
||||
p_theme->set_constant("inspector_property_height", EditorStringName(Editor), p_config.inspector_property_height);
|
||||
|
||||
// EditorInspectorSection.
|
||||
|
||||
Color inspector_section_color = p_config.font_color.lerp(Color(0.5, 0.5, 0.5), 0.35);
|
||||
|
|
@ -2392,8 +2402,8 @@ void ThemeClassic::populate_editor_styles(const Ref<EditorTheme> &p_theme, Edito
|
|||
p_theme->set_color("playback_color", "GraphStateMachine", p_config.font_color);
|
||||
p_theme->set_color("playback_background_color", "GraphStateMachine", p_config.font_color * Color(1, 1, 1, 0.3));
|
||||
}
|
||||
}
|
||||
|
||||
// TileSet editor.
|
||||
p_theme->set_stylebox("expand_panel", "TileSetEditor", p_config.tree_panel_style);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,6 @@ void ThemeModern::populate_shared_styles(const Ref<EditorTheme> &p_theme, Editor
|
|||
|
||||
p_theme->set_constant("thumb_size", EditorStringName(Editor), p_config.thumb_size);
|
||||
p_theme->set_constant("class_icon_size", EditorStringName(Editor), p_config.class_icon_size);
|
||||
p_theme->set_constant("color_picker_button_height", EditorStringName(Editor), p_config.color_picker_button_height);
|
||||
p_theme->set_constant("gizmo_handle_scale", EditorStringName(Editor), p_config.gizmo_handle_scale);
|
||||
|
||||
p_theme->set_constant("base_margin", EditorStringName(Editor), p_config.base_margin);
|
||||
|
|
@ -548,8 +547,8 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
|
|||
// CheckBox.
|
||||
{
|
||||
Ref<StyleBoxFlat> checkbox_style = p_config.panel_container_style->duplicate();
|
||||
Ref<StyleBoxFlat> checkbox_style_normal = p_config.base_style->duplicate();
|
||||
checkbox_style_normal->set_content_margin_individual(p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 0.5 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 0.5 * EDSCALE);
|
||||
checkbox_style->set_content_margin_individual(p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 0.75 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 0.75 * EDSCALE);
|
||||
Ref<StyleBoxFlat> checkbox_style_normal = checkbox_style->duplicate();
|
||||
checkbox_style_normal->set_draw_center(false);
|
||||
|
||||
p_theme->set_stylebox(CoreStringName(normal), "CheckBox", checkbox_style_normal);
|
||||
|
|
@ -838,7 +837,7 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
|
|||
{
|
||||
Ref<StyleBoxFlat> text_editor_style = p_config.base_style->duplicate();
|
||||
text_editor_style->set_bg_color(p_config.surface_lower_color);
|
||||
text_editor_style->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 0.75 * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 0.75 * EDSCALE);
|
||||
text_editor_style->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, ((p_config.base_margin * 0.75) + 1) * EDSCALE, p_config.base_margin * 2 * EDSCALE, ((p_config.base_margin * 0.75) + 1) * EDSCALE);
|
||||
if (p_config.draw_extra_borders) {
|
||||
text_editor_style->set_border_width_all(Math::round(EDSCALE));
|
||||
text_editor_style->set_border_color(p_config.extra_border_color_1);
|
||||
|
|
@ -1860,14 +1859,6 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
|
|||
p_theme->set_stylebox(SceneStringName(panel), "EditorAbout", p_config.window_complex_style);
|
||||
p_theme->set_stylebox(SceneStringName(panel), "ThemeItemEditorDialog", p_config.window_complex_style);
|
||||
|
||||
// InspectorActionButton.
|
||||
p_theme->set_type_variation("InspectorActionButton", "Button");
|
||||
p_theme->set_constant("h_separation", "InspectorActionButton", p_config.base_margin * 2 * EDSCALE);
|
||||
p_theme->set_stylebox(CoreStringName(normal), "InspectorActionButton", p_config.button_style);
|
||||
p_theme->set_stylebox(SceneStringName(hover), "InspectorActionButton", p_config.button_style_hover);
|
||||
p_theme->set_stylebox(SceneStringName(pressed), "InspectorActionButton", p_config.button_style_pressed);
|
||||
p_theme->set_stylebox("disabled", "InspectorActionButton", p_config.button_style_disabled);
|
||||
|
||||
// Buttons in material previews.
|
||||
{
|
||||
const Color dim_light_color = p_config.icon_normal_color.darkened(0.24);
|
||||
|
|
@ -1945,8 +1936,13 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
|
|||
// Panel.
|
||||
p_theme->set_stylebox(SceneStringName(panel), "EditorInspector", p_config.base_empty_style);
|
||||
|
||||
// Vertical separation between inspector categories and sections.
|
||||
p_theme->set_constant("v_separation", "EditorInspector", Math::ceil(p_config.base_margin * 0.5 * EDSCALE));
|
||||
// Vertical separation between inspector areas.
|
||||
p_theme->set_type_variation("EditorInspectorContainer", "VBoxContainer");
|
||||
p_theme->set_constant("separation", "EditorInspectorContainer", Math::ceil(p_config.base_margin * 0.5 * EDSCALE));
|
||||
|
||||
// Vertical separation between inspector properties.
|
||||
p_theme->set_type_variation("EditorPropertyContainer", "VBoxContainer");
|
||||
p_theme->set_constant("separation", "EditorPropertyContainer", p_config.base_margin * 0.5 * EDSCALE);
|
||||
|
||||
// EditorProperty.
|
||||
|
||||
|
|
@ -1965,7 +1961,6 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
|
|||
p_theme->set_stylebox("bg_selected", "EditorProperty", style_property_bg_selected);
|
||||
p_theme->set_stylebox("child_bg", "EditorProperty", style_property_child_bg);
|
||||
p_theme->set_constant("font_offset", "EditorProperty", 8 * EDSCALE);
|
||||
p_theme->set_constant("v_separation", "EditorProperty", p_config.increased_margin * EDSCALE);
|
||||
|
||||
const Color property_color = p_config.font_color.lerp(Color(0.5, 0.5, 0.5), 0.5);
|
||||
const Color readonly_color = property_color.lerp(p_config.dark_icon_and_font ? Color(0, 0, 0) : Color(1, 1, 1), 0.25);
|
||||
|
|
@ -2105,6 +2100,63 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
|
|||
p_theme->set_type_variation("ObjectSelectorMargin", "MarginContainer");
|
||||
p_theme->set_constant("margin_left", "ObjectSelectorMargin", p_config.base_margin * 2 * EDSCALE);
|
||||
p_theme->set_constant("margin_right", "ObjectSelectorMargin", p_config.base_margin * 2.5 * EDSCALE);
|
||||
|
||||
// EditorInspectorButton.
|
||||
|
||||
p_theme->set_type_variation("EditorInspectorButton", "Button");
|
||||
Ref<StyleBoxFlat> style_line = p_theme->get_stylebox(CoreStringName(normal), SNAME("LineEdit"));
|
||||
float vertical_margin = style_line->get_content_margin(SIDE_TOP);
|
||||
|
||||
Ref<StyleBoxFlat> style_inspector_button = p_config.button_style->duplicate();
|
||||
style_inspector_button->set_content_margin(SIDE_TOP, vertical_margin);
|
||||
style_inspector_button->set_content_margin(SIDE_BOTTOM, vertical_margin);
|
||||
|
||||
Ref<StyleBoxFlat> style_inspector_button_hover = p_config.button_style_hover->duplicate();
|
||||
style_inspector_button_hover->set_content_margin(SIDE_TOP, vertical_margin);
|
||||
style_inspector_button_hover->set_content_margin(SIDE_BOTTOM, vertical_margin);
|
||||
|
||||
Ref<StyleBoxFlat> style_inspector_button_pressed = p_config.button_style_pressed->duplicate();
|
||||
style_inspector_button_pressed->set_content_margin(SIDE_TOP, vertical_margin);
|
||||
style_inspector_button_pressed->set_content_margin(SIDE_BOTTOM, vertical_margin);
|
||||
|
||||
Ref<StyleBoxFlat> style_inspector_button_disabled = p_config.button_style_disabled->duplicate();
|
||||
style_inspector_button_disabled->set_content_margin(SIDE_TOP, vertical_margin);
|
||||
style_inspector_button_disabled->set_content_margin(SIDE_BOTTOM, vertical_margin);
|
||||
|
||||
p_theme->set_stylebox(CoreStringName(normal), "EditorInspectorButton", style_inspector_button);
|
||||
p_theme->set_stylebox(SceneStringName(hover), "EditorInspectorButton", style_inspector_button_hover);
|
||||
p_theme->set_stylebox(SceneStringName(pressed), "EditorInspectorButton", style_inspector_button_pressed);
|
||||
p_theme->set_stylebox("hover_pressed", "EditorInspectorButton", style_inspector_button_pressed);
|
||||
p_theme->set_stylebox("disabled", "EditorInspectorButton", style_inspector_button_disabled);
|
||||
|
||||
// Make the height for properties uniform.
|
||||
Ref<StyleBoxFlat> inspector_button_style = p_theme->get_stylebox(CoreStringName(normal), SNAME("EditorInspectorButton"));
|
||||
Ref<Font> font = p_theme->get_font(SceneStringName(font), SNAME("LineEdit"));
|
||||
int font_size = p_theme->get_font_size(SceneStringName(font_size), SNAME("LineEdit"));
|
||||
p_config.inspector_property_height = inspector_button_style->get_minimum_size().height + font->get_height(font_size);
|
||||
p_theme->set_constant("inspector_property_height", EditorStringName(Editor), p_config.inspector_property_height);
|
||||
|
||||
// EditorInspectorFlatButton.
|
||||
|
||||
p_theme->set_type_variation("EditorInspectorFlatButton", "FlatButton");
|
||||
|
||||
Ref<StyleBoxFlat> inspector_flat_button_hover = p_config.flat_button_hover->duplicate();
|
||||
inspector_flat_button_hover->set_content_margin(SIDE_TOP, vertical_margin);
|
||||
inspector_flat_button_hover->set_content_margin(SIDE_BOTTOM, vertical_margin);
|
||||
|
||||
Ref<StyleBoxFlat> inspector_flat_button_pressed = p_config.flat_button_pressed->duplicate();
|
||||
inspector_flat_button_pressed->set_content_margin(SIDE_TOP, vertical_margin);
|
||||
inspector_flat_button_pressed->set_content_margin(SIDE_BOTTOM, vertical_margin);
|
||||
|
||||
p_theme->set_stylebox(CoreStringName(normal), "EditorInspectorFlatButton", p_config.base_empty_wide_style);
|
||||
p_theme->set_stylebox(SceneStringName(hover), "EditorInspectorFlatButton", p_config.flat_button_hover);
|
||||
p_theme->set_stylebox(SceneStringName(pressed), "EditorInspectorFlatButton", p_config.flat_button_pressed);
|
||||
p_theme->set_stylebox("hover_pressed", "EditorInspectorFlatButton", p_config.flat_button_pressed);
|
||||
p_theme->set_stylebox("disabled", "EditorInspectorFlatButton", p_config.base_empty_wide_style);
|
||||
|
||||
// InspectorActionButton.
|
||||
p_theme->set_type_variation("InspectorActionButton", "Button");
|
||||
p_theme->set_constant("h_separation", "InspectorActionButton", p_config.base_margin * 2 * EDSCALE);
|
||||
}
|
||||
|
||||
// Animation Editor.
|
||||
|
|
@ -2363,6 +2415,7 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
|
|||
p_theme->set_color("playback_color", "GraphStateMachine", p_config.font_color);
|
||||
p_theme->set_color("playback_background_color", "GraphStateMachine", p_config.font_color * Color(1, 1, 1, 0.3));
|
||||
}
|
||||
}
|
||||
|
||||
// TileSet editor.
|
||||
// This editor is using Tree panel for the panel container of expanded view, while the theme
|
||||
|
|
@ -2371,4 +2424,3 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
|
|||
tile_expand_style->set_corner_radius_all(0);
|
||||
p_theme->set_stylebox("expand_panel", "TileSetEditor", tile_expand_style);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue