Skip to content

Commit 7c9d931

Browse files
authored
Merge pull request godotengine#87085 from YuriSizov/editor-improved-theme-flexibility
Refactor editor theme generation and add spacing presets
2 parents 311f766 + 952fd43 commit 7c9d931

173 files changed

Lines changed: 3357 additions & 2693 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ doc_classes/* @godotengine/documentation
5151
# Editor
5252

5353
/editor/*debugger* @godotengine/debugger
54+
/editor/gui/ @godotengine/usability @godotengine/gui-nodes
5455
/editor/icons/ @godotengine/usability
5556
/editor/import/ @godotengine/import
5657
/editor/plugins/*2d_*.* @godotengine/2d-editor
5758
/editor/plugins/*3d_*.* @godotengine/3d-editor
5859
/editor/plugins/script_*.* @godotengine/script-editor
5960
/editor/plugins/*shader*.* @godotengine/shaders
61+
/editor/themes/ @godotengine/usability @godotengine/gui-nodes
6062
/editor/code_editor.* @godotengine/script-editor
6163
/editor/*dock*.* @godotengine/docks
6264
/editor/*shader*.* @godotengine/shaders

doc/classes/EditorSettings.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,12 +662,16 @@
662662
<member name="interface/theme/accent_color" type="Color" setter="" getter="">
663663
The color to use for "highlighted" user interface elements in the editor (pressed and hovered items).
664664
</member>
665-
<member name="interface/theme/additional_spacing" type="float" setter="" getter="">
666-
The spacing to add for buttons and list items in the editor (in pixels). Increasing this value is useful to improve usability on touch screens, at the cost of reducing the amount of usable screen real estate.
665+
<member name="interface/theme/additional_spacing" type="int" setter="" getter="">
666+
The extra spacing to add to various GUI elements in the editor (in pixels). Increasing this value is useful to improve usability on touch screens, at the cost of reducing the amount of usable screen real estate.
667+
See also [member interface/theme/spacing_preset].
667668
</member>
668669
<member name="interface/theme/base_color" type="Color" setter="" getter="">
669670
The base color to use for user interface elements in the editor. Secondary colors (such as darker/lighter variants) are derived from this color.
670671
</member>
672+
<member name="interface/theme/base_spacing" type="int" setter="" getter="">
673+
The base spacing used by various GUI elements in the editor (in pixels). See also [member interface/theme/spacing_preset].
674+
</member>
671675
<member name="interface/theme/border_size" type="int" setter="" getter="">
672676
The border size to use for interface elements (in pixels).
673677
</member>
@@ -699,6 +703,9 @@
699703
<member name="interface/theme/relationship_line_opacity" type="float" setter="" getter="">
700704
The opacity to use when drawing relationship lines in the editor's [Tree]-based GUIs (such as the Scene tree dock).
701705
</member>
706+
<member name="interface/theme/spacing_preset" type="String" setter="" getter="">
707+
The editor theme spacing preset to use. See also [member interface/theme/base_spacing] and [member interface/theme/additional_spacing].
708+
</member>
702709
<member name="interface/touchscreen/enable_long_press_as_right_click" type="bool" setter="" getter="">
703710
If [code]true[/code], long press on touchscreen is treated as right click.
704711
[b]Note:[/b] Defaults to [code]true[/code] on touchscreen devices.

editor/SCsub

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,6 @@ if env.editor_build:
104104
env.Run(editor_builders.make_doc_translations_header, "Generating translations header."),
105105
)
106106

107-
# Fonts
108-
flist = glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.ttf")
109-
flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.otf"))
110-
flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff"))
111-
flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff2"))
112-
flist.sort()
113-
env.Depends("#editor/builtin_fonts.gen.h", flist)
114-
env.CommandNoCache(
115-
"#editor/builtin_fonts.gen.h",
116-
flist,
117-
env.Run(editor_builders.make_fonts_header, "Generating builtin fonts header."),
118-
)
119-
120107
env.add_source_files(env.editor_sources, "*.cpp")
121108
env.add_source_files(env.editor_sources, "register_exporters.gen.cpp")
122109

@@ -126,6 +113,7 @@ if env.editor_build:
126113
SConscript("icons/SCsub")
127114
SConscript("import/SCsub")
128115
SConscript("plugins/SCsub")
116+
SConscript("themes/SCsub")
129117

130118
lib = env.add_library("editor", env.editor_sources)
131119
env.Prepend(LIBS=[lib])

editor/action_map_editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030

3131
#include "editor/action_map_editor.h"
3232

33-
#include "editor/editor_scale.h"
3433
#include "editor/editor_settings.h"
3534
#include "editor/editor_string_names.h"
3635
#include "editor/event_listener_line_edit.h"
3736
#include "editor/input_event_configuration_dialog.h"
37+
#include "editor/themes/editor_scale.h"
3838
#include "scene/gui/check_button.h"
3939
#include "scene/gui/separator.h"
4040
#include "scene/gui/tree.h"

editor/animation_bezier_editor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#include "animation_bezier_editor.h"
3232

3333
#include "editor/editor_node.h"
34-
#include "editor/editor_scale.h"
3534
#include "editor/editor_settings.h"
3635
#include "editor/editor_string_names.h"
3736
#include "editor/editor_undo_redo_manager.h"
37+
#include "editor/themes/editor_scale.h"
3838
#include "scene/gui/view_panner.h"
3939
#include "scene/resources/text_line.h"
4040

@@ -334,7 +334,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
334334
}
335335
}
336336

337-
Color dc = get_theme_color(SNAME("disabled_font_color"), EditorStringName(Editor));
337+
Color dc = get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor));
338338

339339
Ref<Texture2D> remove = get_editor_theme_icon(SNAME("Remove"));
340340
float remove_hpos = limit - hsep - remove->get_width();

editor/animation_track_editor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
#include "core/input/input.h"
3636
#include "editor/animation_bezier_editor.h"
3737
#include "editor/editor_node.h"
38-
#include "editor/editor_scale.h"
3938
#include "editor/editor_settings.h"
4039
#include "editor/editor_string_names.h"
4140
#include "editor/editor_undo_redo_manager.h"
4241
#include "editor/gui/editor_spin_slider.h"
4342
#include "editor/gui/scene_tree_editor.h"
4443
#include "editor/inspector_dock.h"
4544
#include "editor/plugins/animation_player_editor_plugin.h"
45+
#include "editor/themes/editor_scale.h"
4646
#include "scene/animation/animation_player.h"
4747
#include "scene/animation/tween.h"
4848
#include "scene/gui/check_box.h"
@@ -1921,7 +1921,7 @@ void AnimationTrackEdit::_notification(int p_what) {
19211921
Color linecolor = color;
19221922
linecolor.a = 0.2;
19231923

1924-
Color dc = get_theme_color(SNAME("disabled_font_color"), EditorStringName(Editor));
1924+
Color dc = get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor));
19251925

19261926
// NAMES AND ICONS //
19271927

editor/animation_track_editor_plugins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232

3333
#include "editor/audio_stream_preview.h"
3434
#include "editor/editor_resource_preview.h"
35-
#include "editor/editor_scale.h"
3635
#include "editor/editor_string_names.h"
3736
#include "editor/editor_undo_redo_manager.h"
37+
#include "editor/themes/editor_scale.h"
3838
#include "scene/2d/animated_sprite_2d.h"
3939
#include "scene/2d/sprite_2d.h"
4040
#include "scene/3d/sprite_3d.h"

editor/code_editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
#include "core/os/keyboard.h"
3535
#include "core/string/string_builder.h"
3636
#include "core/templates/pair.h"
37-
#include "editor/editor_scale.h"
3837
#include "editor/editor_settings.h"
3938
#include "editor/editor_string_names.h"
4039
#include "editor/plugins/script_editor_plugin.h"
40+
#include "editor/themes/editor_scale.h"
4141
#include "scene/resources/font.h"
4242

4343
void GotoLineDialog::popup_find_line(CodeEdit *p_edit) {

editor/connections_dialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
#include "editor/editor_help.h"
3636
#include "editor/editor_inspector.h"
3737
#include "editor/editor_node.h"
38-
#include "editor/editor_scale.h"
3938
#include "editor/editor_settings.h"
4039
#include "editor/editor_string_names.h"
4140
#include "editor/editor_undo_redo_manager.h"
4241
#include "editor/gui/scene_tree_editor.h"
4342
#include "editor/node_dock.h"
4443
#include "editor/scene_tree_dock.h"
44+
#include "editor/themes/editor_scale.h"
4545
#include "plugins/script_editor_plugin.h"
4646
#include "scene/gui/button.h"
4747
#include "scene/gui/check_box.h"

editor/create_dialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
#include "editor/editor_feature_profile.h"
3636
#include "editor/editor_node.h"
3737
#include "editor/editor_paths.h"
38-
#include "editor/editor_scale.h"
3938
#include "editor/editor_settings.h"
4039
#include "editor/editor_string_names.h"
40+
#include "editor/themes/editor_scale.h"
4141

4242
void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const String &p_current_type, const String &p_current_name) {
4343
_fill_type_list();
@@ -306,7 +306,7 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String
306306

307307
r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type));
308308
if (!instantiable) {
309-
r_item->set_custom_color(0, search_options->get_theme_color(SNAME("disabled_font_color"), EditorStringName(Editor)));
309+
r_item->set_custom_color(0, search_options->get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor)));
310310
}
311311

312312
HashMap<String, DocData::ClassDoc>::Iterator class_doc = EditorHelp::get_doc_data()->class_list.find(p_type);

0 commit comments

Comments
 (0)