diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0911ff98bf2..b8082fb136b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -51,12 +51,14 @@ doc_classes/* @godotengine/documentation # Editor /editor/*debugger* @godotengine/debugger +/editor/gui/ @godotengine/usability @godotengine/gui-nodes /editor/icons/ @godotengine/usability /editor/import/ @godotengine/import /editor/plugins/*2d_*.* @godotengine/2d-editor /editor/plugins/*3d_*.* @godotengine/3d-editor /editor/plugins/script_*.* @godotengine/script-editor /editor/plugins/*shader*.* @godotengine/shaders +/editor/themes/ @godotengine/usability @godotengine/gui-nodes /editor/code_editor.* @godotengine/script-editor /editor/*dock*.* @godotengine/docks /editor/*shader*.* @godotengine/shaders diff --git a/editor/SCsub b/editor/SCsub index b1a47dae451..5b36bca81ad 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -104,19 +104,6 @@ if env.editor_build: env.Run(editor_builders.make_doc_translations_header, "Generating translations header."), ) - # Fonts - flist = glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.ttf") - flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.otf")) - flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff")) - flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff2")) - flist.sort() - env.Depends("#editor/builtin_fonts.gen.h", flist) - env.CommandNoCache( - "#editor/builtin_fonts.gen.h", - flist, - env.Run(editor_builders.make_fonts_header, "Generating builtin fonts header."), - ) - env.add_source_files(env.editor_sources, "*.cpp") env.add_source_files(env.editor_sources, "register_exporters.gen.cpp") @@ -126,6 +113,7 @@ if env.editor_build: SConscript("icons/SCsub") SConscript("import/SCsub") SConscript("plugins/SCsub") + SConscript("themes/SCsub") lib = env.add_library("editor", env.editor_sources) env.Prepend(LIBS=[lib]) diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index d7302d873fa..5154d2e0e02 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -30,11 +30,11 @@ #include "editor/action_map_editor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/event_listener_line_edit.h" #include "editor/input_event_configuration_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_button.h" #include "scene/gui/separator.h" #include "scene/gui/tree.h" diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 4849a6824cf..69319d1d495 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -31,10 +31,10 @@ #include "animation_bezier_editor.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/view_panner.h" #include "scene/resources/text_line.h" diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 41a6d778601..404bfdbd7c9 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -35,7 +35,6 @@ #include "core/input/input.h" #include "editor/animation_bezier_editor.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" @@ -43,6 +42,7 @@ #include "editor/gui/scene_tree_editor.h" #include "editor/inspector_dock.h" #include "editor/plugins/animation_player_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/animation/animation_player.h" #include "scene/animation/tween.h" #include "scene/gui/check_box.h" diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 390b722b7b7..7a53f4dded4 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -32,9 +32,9 @@ #include "editor/audio_stream_preview.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/animated_sprite_2d.h" #include "scene/2d/sprite_2d.h" #include "scene/3d/sprite_3d.h" diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index d9101466fc2..76d0d401102 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -34,10 +34,10 @@ #include "core/os/keyboard.h" #include "core/string/string_builder.h" #include "core/templates/pair.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/font.h" void GotoLineDialog::popup_find_line(CodeEdit *p_edit) { diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 69908af47d6..a5af7ef134c 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -35,13 +35,13 @@ #include "editor/editor_help.h" #include "editor/editor_inspector.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/scene_tree_editor.h" #include "editor/node_dock.h" #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_scale.h" #include "plugins/script_editor_plugin.h" #include "scene/gui/button.h" #include "scene/gui/check_box.h" diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 49d997fc6aa..22801988157 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -35,9 +35,9 @@ #include "editor/editor_feature_profile.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const String &p_current_type, const String &p_current_name) { _fill_type_list(); diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index e93369179ce..af723cc731a 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -31,9 +31,9 @@ #include "editor_performance_profiler.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "main/performance.h" EditorPerformanceProfiler::Monitor::Monitor() {} diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index d54fd62e8cc..2809b873b19 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -31,9 +31,9 @@ #include "editor_profiler.h" #include "core/os/os.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/image_texture.h" void EditorProfiler::_make_metric_ptrs(Metric &m) { diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 7df942e288a..4ebed726c55 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -31,9 +31,9 @@ #include "editor_visual_profiler.h" #include "core/os/os.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/image_texture.h" void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) { diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index d926bd0f126..6cc37699764 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -44,7 +44,6 @@ #include "editor/editor_log.h" #include "editor/editor_node.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" @@ -52,6 +51,7 @@ #include "editor/plugins/canvas_item_editor_plugin.h" #include "editor/plugins/editor_debugger_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "main/performance.h" #include "scene/3d/camera_3d.h" #include "scene/debugger/scene_debugger.h" diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index a891491339a..4be6afbcff4 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -35,9 +35,9 @@ #include "core/io/resource_loader.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/margin_container.h" void DependencyEditor::_searched(const String &p_path) { diff --git a/editor/directory_create_dialog.cpp b/editor/directory_create_dialog.cpp index aacd718fdec..6f9b91731b0 100644 --- a/editor/directory_create_dialog.cpp +++ b/editor/directory_create_dialog.cpp @@ -32,8 +32,8 @@ #include "core/io/dir_access.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/gui/editor_validation_panel.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "scene/gui/line_edit.h" diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 1f9911f31e4..6c859ce2369 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -35,6 +35,7 @@ #include "core/license.gen.h" #include "core/version.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" // The metadata key used to store and retrieve the version text to copy to the clipboard. const String EditorAbout::META_TEXT_TO_COPY = "text_to_copy"; diff --git a/editor/editor_about.h b/editor/editor_about.h index 22b5f3ded0d..639dc6cc3f2 100644 --- a/editor/editor_about.h +++ b/editor/editor_about.h @@ -42,8 +42,6 @@ #include "scene/gui/texture_rect.h" #include "scene/gui/tree.h" -#include "editor/editor_scale.h" - /** * NOTE: Do not assume the EditorNode singleton to be available in this class' methods. * EditorAbout is also used from the project manager where EditorNode isn't initialized. diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index b609de9f67f..ab0816805fd 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -35,11 +35,11 @@ #include "core/io/zip_io.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" #include "editor/gui/editor_toaster.h" #include "editor/progress_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_box.h" #include "scene/gui/label.h" #include "scene/gui/link_button.h" diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index c1183c8d66f..50845b44586 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -35,12 +35,12 @@ #include "core/io/resource_saver.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/filesystem_dock.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/separator.h" #include "scene/resources/font.h" #include "servers/audio_server.h" diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 45de4a54aeb..4d5393299cd 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -33,12 +33,12 @@ #include "core/config/project_settings.h" #include "core/core_constants.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/filesystem_dock.h" #include "editor/gui/editor_file_dialog.h" #include "editor/project_settings_editor.h" +#include "editor/themes/editor_scale.h" #include "scene/main/window.h" #include "scene/resources/packed_scene.h" diff --git a/editor/editor_build_profile.cpp b/editor/editor_build_profile.cpp index 8ab8bc4a526..0677064f28e 100644 --- a/editor/editor_build_profile.cpp +++ b/editor/editor_build_profile.cpp @@ -36,10 +36,10 @@ #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" const char *EditorBuildProfile::build_option_identifiers[BUILD_OPTION_MAX] = { // This maps to SCons build options. diff --git a/editor/editor_builders.py b/editor/editor_builders.py index 90ecccbf305..25004da8773 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -3,6 +3,7 @@ All such functions are invoked in a subprocess on Windows to prevent build flakiness. """ + import os import os.path import shutil @@ -49,34 +50,6 @@ def make_doc_header(target, source, env): g.close() -def make_fonts_header(target, source, env): - dst = target[0] - - g = open(dst, "w", encoding="utf-8") - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_FONTS_H\n") - g.write("#define _EDITOR_FONTS_H\n") - - # Saving uncompressed, since FreeType will reference from memory pointer. - for i in range(len(source)): - with open(source[i], "rb") as f: - buf = f.read() - - name = os.path.splitext(os.path.basename(source[i]))[0] - - g.write("static const int _font_" + name + "_size = " + str(len(buf)) + ";\n") - g.write("static const unsigned char _font_" + name + "[] = {\n") - for j in range(len(buf)): - g.write("\t" + str(buf[j]) + ",\n") - - g.write("};\n") - - g.write("#endif") - - g.close() - - def make_translations_header(target, source, env, category): dst = target[0] diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp index ce5d8619e1e..567b686b856 100644 --- a/editor/editor_command_palette.cpp +++ b/editor/editor_command_palette.cpp @@ -31,10 +31,10 @@ #include "editor/editor_command_palette.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_toaster.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/control.h" #include "scene/gui/tree.h" diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 5f77959127c..794d1b3e10b 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -37,10 +37,10 @@ #include "core/io/resource_loader.h" #include "editor/editor_node.h" #include "editor/editor_plugin.h" -#include "editor/editor_scale.h" #include "editor/editor_undo_redo_manager.h" #include "editor/multi_node_edit.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/packed_scene.h" void EditorSelectionHistory::cleanup_history() { diff --git a/editor/editor_dock_manager.cpp b/editor/editor_dock_manager.cpp index 220ee8fc41e..dfe95047064 100644 --- a/editor/editor_dock_manager.cpp +++ b/editor/editor_dock_manager.cpp @@ -39,10 +39,10 @@ #include "scene/main/window.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/filesystem_dock.h" +#include "editor/themes/editor_scale.h" #include "editor/window_wrapper.h" EditorDockManager *EditorDockManager::singleton = nullptr; diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 5a44ae1abaa..8c64ce1c70c 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -35,10 +35,10 @@ #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = { TTRC("3D Editor"), diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 6e448d88664..74c0ef4e507 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -35,14 +35,14 @@ #include "core/object/script_language.h" #include "core/os/keyboard.h" #include "core/version.h" -#include "doc_data_compressed.gen.h" +#include "editor/doc_data_compressed.gen.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/line_edit.h" #define CONTRIBUTE_URL vformat("%s/contributing/documentation/updating_the_class_reference.html", VERSION_DOCS_URL) diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 64bd209d4df..40c26689b81 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -33,9 +33,9 @@ #include "core/os/keyboard.h" #include "editor/editor_feature_profile.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" void EditorHelpSearch::_update_results() { String term = search_box->get_text(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 6809739dc1a..b7704da063d 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -35,14 +35,14 @@ #include "editor/editor_feature_profile.h" #include "editor/editor_node.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_validation_panel.h" #include "editor/inspector_dock.h" +#include "editor/multi_node_edit.h" #include "editor/plugins/script_editor_plugin.h" -#include "multi_node_edit.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/spin_box.h" #include "scene/gui/texture_rect.h" #include "scene/property_utils.h" diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp index b007f6d5303..bad28ff43d5 100644 --- a/editor/editor_interface.cpp +++ b/editor/editor_interface.cpp @@ -35,13 +35,13 @@ #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/filesystem_dock.h" #include "editor/gui/editor_run_bar.h" #include "editor/inspector_dock.h" #include "editor/plugins/node_3d_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "main/main.h" #include "scene/gui/box_container.h" #include "scene/gui/control.h" diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp index c6f518d4c1d..e1b370f44ae 100644 --- a/editor/editor_layouts_dialog.cpp +++ b/editor/editor_layouts_dialog.cpp @@ -33,8 +33,8 @@ #include "core/io/config_file.h" #include "core/object/class_db.h" #include "core/os/keyboard.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/item_list.h" #include "scene/gui/line_edit.h" diff --git a/editor/editor_locale_dialog.cpp b/editor/editor_locale_dialog.cpp index 13b4a8c128a..f1d82557fd5 100644 --- a/editor/editor_locale_dialog.cpp +++ b/editor/editor_locale_dialog.cpp @@ -31,8 +31,8 @@ #include "editor_locale_dialog.h" #include "core/config/project_settings.h" -#include "editor/editor_scale.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_button.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 8b2d9c33864..c0c26bbfeb3 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -35,9 +35,9 @@ #include "core/version.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/center_container.h" #include "scene/gui/separator.h" #include "scene/resources/font.h" diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d201781c236..528bc0a758d 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -96,10 +96,8 @@ #include "editor/editor_resource_preview.h" #include "editor/editor_run.h" #include "editor/editor_run_native.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_settings_dialog.h" -#include "editor/editor_themes.h" #include "editor/editor_translation_parser.h" #include "editor/editor_undo_redo_manager.h" #include "editor/export/editor_export.h" @@ -158,6 +156,8 @@ #include "editor/register_exporters.h" #include "editor/scene_tree_dock.h" #include "editor/surface_upgrade_tool.h" +#include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" #include "editor/window_wrapper.h" #include @@ -469,7 +469,7 @@ void EditorNode::_select_default_main_screen_plugin() { void EditorNode::_update_theme(bool p_skip_creation) { if (!p_skip_creation) { - theme = create_custom_theme(theme); + theme = EditorThemeManager::generate_theme(theme); DisplayServer::set_early_window_clear_color_override(true, theme->get_color(SNAME("background"), EditorStringName(Editor))); } @@ -764,19 +764,7 @@ void EditorNode::_notification(int p_what) { EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); - bool theme_changed = - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/font") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_font") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/code_font") || - EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || - EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") || - EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog/thumbnail_size") || - EditorSettings::get_singleton()->check_changed_settings_in_group("run/output/font_size") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/increase_scrollbar_touch_area") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/scale_gizmo_handles"); - - if (theme_changed) { + if (EditorThemeManager::is_generated_theme_outdated()) { _update_theme(); } @@ -6438,9 +6426,8 @@ EditorNode::EditorNode() { add_child(editor_export); // Exporters might need the theme. - EditorColorMap::create(); - EditorTheme::initialize(); - theme = create_custom_theme(); + EditorThemeManager::initialize(); + theme = EditorThemeManager::generate_theme(); DisplayServer::set_early_window_clear_color_override(true, theme->get_color(SNAME("background"), EditorStringName(Editor))); register_exporters(); @@ -7500,8 +7487,7 @@ EditorNode::~EditorNode() { memdelete(editor_dock_manager); EditorSettings::destroy(); - EditorColorMap::finish(); - EditorTheme::finalize(); + EditorThemeManager::finalize(); GDExtensionEditorPlugins::editor_node_add_plugin = nullptr; GDExtensionEditorPlugins::editor_node_remove_plugin = nullptr; diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 6c38d9de586..d22e60d7b44 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -36,7 +36,7 @@ #include "core/io/file_access.h" #include "core/os/main_loop.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/margin_container.h" #include "scene/gui/tree.h" diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 404f1151f13..16f808367f9 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -37,7 +37,6 @@ #include "editor/editor_properties_array_dict.h" #include "editor/editor_properties_vector.h" #include "editor/editor_resource_picker.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" @@ -48,6 +47,7 @@ #include "editor/project_settings_editor.h" #include "editor/property_selector.h" #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/gpu_particles_2d.h" #include "scene/3d/fog_volume.h" #include "scene/3d/gpu_particles_3d.h" diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 9951e604ccd..f5b8d044445 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -34,11 +34,11 @@ #include "core/io/marshalls.h" #include "editor/editor_properties.h" #include "editor/editor_properties_vector.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_spin_slider.h" #include "editor/inspector_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/resources/packed_scene.h" diff --git a/editor/editor_quick_open.cpp b/editor/editor_quick_open.cpp index 965d0269d6f..f39872ba2c2 100644 --- a/editor/editor_quick_open.cpp +++ b/editor/editor_quick_open.cpp @@ -32,7 +32,7 @@ #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" Rect2i EditorQuickOpen::prev_rect = Rect2i(); bool EditorQuickOpen::was_showed = false; diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 977e65d78ca..27ce27591f2 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -34,7 +34,6 @@ #include "editor/editor_node.h" #include "editor/editor_quick_open.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/filesystem_dock.h" @@ -42,6 +41,7 @@ #include "editor/plugins/editor_resource_conversion_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/gui/texture_rect.h" #include "scene/resources/gradient_texture.h" diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 8a85bbde39d..1702277ebcd 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -37,9 +37,9 @@ #include "core/variant/variant_utility.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/image_texture.h" #include "servers/rendering/rendering_server_default.h" diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index 6744e799310..fd6b083c120 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -31,10 +31,10 @@ #include "editor_run_native.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/export/editor_export.h" #include "editor/export/editor_export_platform.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/image_texture.h" void EditorRunNative::_notification(int p_what) { diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index 7bf88ba94ff..8d1f97f6b16 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -31,9 +31,9 @@ #include "editor_sectioned_inspector.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" static bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style) { if (p_property_path.findn(p_filter) != -1) { diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index 33a176499d1..b88ad784568 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -38,12 +38,12 @@ #include "editor/editor_log.h" #include "editor/editor_node.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/event_listener_line_edit.h" #include "editor/input_event_configuration_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/margin_container.h" void EditorSettingsDialog::ok_pressed() { diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 855d610d72c..ee25893a30d 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -40,11 +40,11 @@ #include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/export/editor_export.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "editor_export_plugin.h" #include "scene/resources/image_texture.h" #include "scene/resources/packed_scene.h" diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp index 26ed7c46fbd..f470d4f3fd4 100644 --- a/editor/export/export_template_manager.cpp +++ b/editor/export/export_template_manager.cpp @@ -36,10 +36,10 @@ #include "core/version.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/progress_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/file_dialog.h" #include "scene/gui/menu_button.h" #include "scene/gui/separator.h" diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 2ec1363cedf..a47fdbf222c 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -35,12 +35,12 @@ #include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_properties.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/export/editor_export.h" #include "editor/gui/editor_file_dialog.h" #include "editor/import/resource_importer_texture_settings.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_box.h" #include "scene/gui/check_button.h" #include "scene/gui/item_list.h" diff --git a/editor/fbx_importer_manager.cpp b/editor/fbx_importer_manager.cpp index 5922cbf3125..7199ef38424 100644 --- a/editor/fbx_importer_manager.cpp +++ b/editor/fbx_importer_manager.cpp @@ -32,9 +32,9 @@ #include "core/config/project_settings.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/link_button.h" void FBXImporterManager::_notification(int p_what) { diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 45c74f757f0..a46dffb1f38 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -42,7 +42,6 @@ #include "editor/editor_feature_profile.h" #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_dir_dialog.h" @@ -53,6 +52,7 @@ #include "editor/scene_create_dialog.h" #include "editor/scene_tree_dock.h" #include "editor/shader_create_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/item_list.h" #include "scene/gui/label.h" #include "scene/gui/line_edit.h" diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index a81aa971f38..c708e777198 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -34,8 +34,8 @@ #include "core/io/dir_access.h" #include "core/os/os.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/check_box.h" diff --git a/editor/group_settings_editor.cpp b/editor/group_settings_editor.cpp index 42e117f4c18..634192ab504 100644 --- a/editor/group_settings_editor.cpp +++ b/editor/group_settings_editor.cpp @@ -31,13 +31,13 @@ #include "group_settings_editor.h" #include "core/config/project_settings.h" -#include "editor/editor_scale.h" +#include "editor/editor_file_system.h" +#include "editor/editor_node.h" #include "editor/editor_undo_redo_manager.h" #include "editor/filesystem_dock.h" #include "editor/gui/editor_validation_panel.h" #include "editor/scene_tree_dock.h" -#include "editor_file_system.h" -#include "editor_node.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/packed_scene.h" void GroupSettingsEditor::_notification(int p_what) { diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 77a867f34b3..723a7c89017 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -31,12 +31,12 @@ #include "groups_editor.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_validation_panel.h" #include "editor/project_settings_editor.h" #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/check_button.h" #include "scene/gui/grid_container.h" diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index 9764574d043..4d1fd1f7b7e 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -38,9 +38,9 @@ #include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/filesystem_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/center_container.h" #include "scene/gui/label.h" #include "scene/gui/margin_container.h" diff --git a/editor/gui/editor_object_selector.cpp b/editor/gui/editor_object_selector.cpp index 9acd38bcf44..c97d68fb35d 100644 --- a/editor/gui/editor_object_selector.cpp +++ b/editor/gui/editor_object_selector.cpp @@ -32,9 +32,9 @@ #include "editor/editor_data.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/multi_node_edit.h" +#include "editor/themes/editor_scale.h" Size2 EditorObjectSelector::get_minimum_size() const { Ref font = get_theme_font(SNAME("font")); diff --git a/editor/gui/editor_scene_tabs.cpp b/editor/gui/editor_scene_tabs.cpp index 7f8f2fd8a31..915b161372d 100644 --- a/editor/gui/editor_scene_tabs.cpp +++ b/editor/gui/editor_scene_tabs.cpp @@ -32,11 +32,11 @@ #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/inspector_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/panel.h" diff --git a/editor/gui/editor_spin_slider.cpp b/editor/gui/editor_spin_slider.cpp index 051e4340bc3..8401f083916 100644 --- a/editor/gui/editor_spin_slider.cpp +++ b/editor/gui/editor_spin_slider.cpp @@ -33,8 +33,8 @@ #include "core/input/input.h" #include "core/math/expression.h" #include "core/os/keyboard.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/themes/editor_scale.h" String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const { if (grabber->is_visible()) { diff --git a/editor/gui/editor_toaster.cpp b/editor/gui/editor_toaster.cpp index ac54a5a371a..48e1c56e831 100644 --- a/editor/gui/editor_toaster.cpp +++ b/editor/gui/editor_toaster.cpp @@ -30,9 +30,9 @@ #include "editor_toaster.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/gui/label.h" #include "scene/gui/panel_container.h" diff --git a/editor/gui/editor_validation_panel.cpp b/editor/gui/editor_validation_panel.cpp index 14fe05e9069..c08af1915f2 100644 --- a/editor/gui/editor_validation_panel.cpp +++ b/editor/gui/editor_validation_panel.cpp @@ -30,8 +30,8 @@ #include "editor_validation_panel.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/label.h" diff --git a/editor/gui/editor_zoom_widget.cpp b/editor/gui/editor_zoom_widget.cpp index 7d522761f34..6db4c5047eb 100644 --- a/editor/gui/editor_zoom_widget.cpp +++ b/editor/gui/editor_zoom_widget.cpp @@ -31,8 +31,8 @@ #include "editor_zoom_widget.h" #include "core/os/keyboard.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/themes/editor_scale.h" void EditorZoomWidget::_update_zoom_label() { String zoom_text; diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index 766a5072600..7e6f06bf776 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -34,7 +34,6 @@ #include "core/object/script_language.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" @@ -42,6 +41,7 @@ #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/canvas_item_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/flow_container.h" #include "scene/gui/label.h" #include "scene/gui/tab_container.h" diff --git a/editor/icons/SCsub b/editor/icons/SCsub index dd4243d7505..cbbfe1d7eaf 100644 --- a/editor/icons/SCsub +++ b/editor/icons/SCsub @@ -3,7 +3,6 @@ Import("env") import os - import editor_icons_builders @@ -23,4 +22,4 @@ for path in env.module_icons_paths: else: icon_sources += Glob(path + "/*.svg") # Custom. -env.Alias("editor_icons", [env.MakeEditorIconsBuilder("#editor/editor_icons.gen.h", icon_sources)]) +env.Alias("editor_icons", [env.MakeEditorIconsBuilder("#editor/themes/editor_icons.gen.h", icon_sources)]) diff --git a/editor/icons/editor_icons_builders.py b/editor/icons/editor_icons_builders.py index 359245b6d7f..378eb323dbe 100644 --- a/editor/icons/editor_icons_builders.py +++ b/editor/icons/editor_icons_builders.py @@ -1,4 +1,5 @@ -"""Functions used to generate source files during build time +""" +Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/editor/import/3d/scene_import_settings.cpp b/editor/import/3d/scene_import_settings.cpp index 4ecc6dedbd1..736f941aa42 100644 --- a/editor/import/3d/scene_import_settings.cpp +++ b/editor/import/3d/scene_import_settings.cpp @@ -34,10 +34,10 @@ #include "editor/editor_file_system.h" #include "editor/editor_inspector.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/3d/importer_mesh_instance_3d.h" #include "scene/animation/animation_player.h" #include "scene/resources/importer_mesh.h" diff --git a/editor/import/audio_stream_import_settings.cpp b/editor/import/audio_stream_import_settings.cpp index bc96191d334..a62ac972445 100644 --- a/editor/import/audio_stream_import_settings.cpp +++ b/editor/import/audio_stream_import_settings.cpp @@ -31,8 +31,8 @@ #include "audio_stream_import_settings.h" #include "editor/audio_stream_preview.h" #include "editor/editor_file_system.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_box.h" AudioStreamImportSettingsDialog *AudioStreamImportSettingsDialog::singleton = nullptr; diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index ad65fcebd7d..5e6ed02de91 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -36,10 +36,10 @@ #include "editor/editor_locale_dialog.h" #include "editor/editor_node.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" /*************************************************************************/ /* Settings data */ diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 7f27be99f7e..cdfc85cf6f7 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -36,10 +36,10 @@ #include "core/version.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/gui/editor_toaster.h" #include "editor/import/resource_importer_texture_settings.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/compressed_texture.h" void ResourceImporterTexture::_texture_reimport_roughness(const Ref &p_tex, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_channel) { diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 5996b459a56..0ceece263c2 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -33,10 +33,10 @@ #include "core/config/project_settings.h" #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" class ImportDockParameters : public Object { GDCLASS(ImportDockParameters, Object); diff --git a/editor/input_event_configuration_dialog.cpp b/editor/input_event_configuration_dialog.cpp index db7922233e9..0f483fcaeff 100644 --- a/editor/input_event_configuration_dialog.cpp +++ b/editor/input_event_configuration_dialog.cpp @@ -30,9 +30,9 @@ #include "editor/input_event_configuration_dialog.h" #include "core/input/input_map.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/event_listener_line_edit.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_box.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 1b413c09780..e1640af47ba 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -31,7 +31,6 @@ #include "inspector_dock.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" @@ -39,6 +38,7 @@ #include "editor/gui/editor_file_dialog.h" #include "editor/gui/editor_object_selector.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" InspectorDock *InspectorDock::singleton = nullptr; diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp index 46c6ef57126..8bdd5a31025 100644 --- a/editor/localization_editor.cpp +++ b/editor/localization_editor.cpp @@ -32,12 +32,12 @@ #include "core/config/project_settings.h" #include "core/string/translation.h" -#include "editor/editor_scale.h" #include "editor/editor_translation_parser.h" #include "editor/editor_undo_redo_manager.h" #include "editor/filesystem_dock.h" #include "editor/gui/editor_file_dialog.h" #include "editor/pot_generator.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/control.h" void LocalizationEditor::_notification(int p_what) { diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index db4f5a67e51..1e564f96c0f 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -30,9 +30,9 @@ #include "node_dock.h" -#include "connections_dialog.h" +#include "editor/connections_dialog.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" void NodeDock::show_groups() { groups_button->set_pressed(true); diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 041a121a3ad..5c2c059c983 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -35,9 +35,9 @@ #include "core/object/script_language.h" #include "editor/editor_node.h" #include "editor/editor_plugin.h" -#include "editor/editor_scale.h" #include "editor/gui/editor_validation_panel.h" #include "editor/project_settings_editor.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/grid_container.h" void PluginConfigDialog::_clear_fields() { diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index a15875fd93d..2c86314ae2f 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -34,10 +34,10 @@ #include "core/math/geometry_2d.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/gui/dialogs.h" #include "scene/gui/separator.h" diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index ed1df4b07f6..5875b46c19f 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -32,11 +32,11 @@ #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/animation/animation_blend_tree.h" #include "scene/gui/button.h" #include "scene/gui/check_box.h" diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 057170098d2..9d922f46085 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -36,11 +36,11 @@ #include "core/math/geometry_2d.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/animation/animation_blend_tree.h" #include "scene/animation/animation_player.h" #include "scene/gui/button.h" diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 5ffb89ac659..8786c4cb20d 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -36,11 +36,11 @@ #include "core/os/keyboard.h" #include "editor/editor_inspector.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/3d/skeleton_3d.h" #include "scene/animation/animation_player.h" #include "scene/gui/check_box.h" diff --git a/editor/plugins/animation_library_editor.cpp b/editor/plugins/animation_library_editor.cpp index c302226357f..58b1dbde8a2 100644 --- a/editor/plugins/animation_library_editor.cpp +++ b/editor/plugins/animation_library_editor.cpp @@ -30,11 +30,11 @@ #include "animation_library_editor.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/animation/animation_mixer.h" void AnimationLibraryEditor::set_animation_mixer(Object *p_mixer) { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index fe2ce707353..b08d2e966d6 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -36,7 +36,6 @@ #include "core/io/resource_saver.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" @@ -44,6 +43,7 @@ #include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning. #include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning. #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/animation/animation_tree.h" #include "scene/gui/separator.h" #include "scene/main/window.h" diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 0e61a7e29f6..bbfc1f2f998 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -36,10 +36,10 @@ #include "core/math/geometry_2d.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/animation/animation_blend_tree.h" #include "scene/animation/animation_player.h" #include "scene/gui/menu_button.h" diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index efee22a9a9d..7269395baf7 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -40,8 +40,8 @@ #include "core/math/delaunay_2d.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/animation/animation_blend_tree.h" #include "scene/animation/animation_player.h" #include "scene/gui/button.h" diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 36a0b46d92e..950a75c2214 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -37,11 +37,11 @@ #include "core/version.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" #include "editor/project_settings_editor.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/menu_button.h" #include "scene/resources/image_texture.h" diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index 2be95280198..9b3f24c6255 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -31,9 +31,9 @@ #include "audio_stream_editor_plugin.h" #include "editor/audio_stream_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/audio_stream_wav.h" // AudioStreamEditor diff --git a/editor/plugins/bit_map_editor_plugin.cpp b/editor/plugins/bit_map_editor_plugin.cpp index f2423cb803b..f1d86de5377 100644 --- a/editor/plugins/bit_map_editor_plugin.cpp +++ b/editor/plugins/bit_map_editor_plugin.cpp @@ -30,7 +30,7 @@ #include "bit_map_editor_plugin.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/label.h" #include "scene/gui/texture_rect.h" #include "scene/resources/image_texture.h" diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 153f1928389..38573fbaa73 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -30,12 +30,12 @@ #include "bone_map_editor_plugin.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/import/3d/post_import_plugin_skeleton_renamer.h" #include "editor/import/3d/post_import_plugin_skeleton_rest_fixer.h" #include "editor/import/3d/post_import_plugin_skeleton_track_organizer.h" #include "editor/import/3d/scene_import_settings.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/aspect_ratio_container.h" #include "scene/gui/separator.h" #include "scene/gui/texture_rect.h" diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index f16aff555c8..6c776ad9b3d 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -35,7 +35,6 @@ #include "core/os/keyboard.h" #include "editor/debugger/editor_debugger_node.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" @@ -45,6 +44,7 @@ #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/polygon_2d.h" #include "scene/2d/skeleton_2d.h" #include "scene/2d/sprite_2d.h" diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index 0688ed959ef..5b0831eeb85 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -31,11 +31,11 @@ #include "control_editor_plugin.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/canvas_item_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/grid_container.h" #include "scene/gui/separator.h" diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 72f67848365..ea32b659d73 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -36,11 +36,11 @@ #include "core/os/keyboard.h" #include "editor/editor_interface.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_spin_slider.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/flow_container.h" #include "scene/gui/menu_button.h" #include "scene/gui/popup_menu.h" diff --git a/editor/plugins/debugger_editor_plugin.cpp b/editor/plugins/debugger_editor_plugin.cpp index 41eae444f79..b9bde65f941 100644 --- a/editor/plugins/debugger_editor_plugin.cpp +++ b/editor/plugins/debugger_editor_plugin.cpp @@ -35,9 +35,9 @@ #include "editor/debugger/editor_debugger_server.h" #include "editor/debugger/editor_file_server.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/menu_button.h" DebuggerEditorPlugin::DebuggerEditorPlugin(PopupMenu *p_debug_menu) { diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 015a4915a83..90bd117543b 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -36,8 +36,8 @@ #include "core/object/script_language.h" #include "core/os/os.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/atlas_texture.h" #include "scene/resources/bit_map.h" #include "scene/resources/font.h" diff --git a/editor/plugins/editor_resource_tooltip_plugins.cpp b/editor/plugins/editor_resource_tooltip_plugins.cpp index 36852e79b58..fab8ee9f59c 100644 --- a/editor/plugins/editor_resource_tooltip_plugins.cpp +++ b/editor/plugins/editor_resource_tooltip_plugins.cpp @@ -31,7 +31,7 @@ #include "editor_resource_tooltip_plugins.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "scene/gui/texture_rect.h" diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index a0500bdb487..d7198502045 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -30,9 +30,9 @@ #include "font_config_plugin.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/import/dynamic_font_import_settings.h" +#include "editor/themes/editor_scale.h" /*************************************************************************/ /* EditorPropertyFontMetaObject */ diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index e696b900d0a..d8f9664e8d2 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -30,15 +30,15 @@ #include "gradient_editor_plugin.h" -#include "canvas_item_editor_plugin.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_spin_slider.h" -#include "node_3d_editor_plugin.h" +#include "editor/plugins/canvas_item_editor_plugin.h" +#include "editor/plugins/node_3d_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/color_picker.h" #include "scene/gui/flow_container.h" #include "scene/gui/popup.h" diff --git a/editor/plugins/gradient_texture_2d_editor_plugin.cpp b/editor/plugins/gradient_texture_2d_editor_plugin.cpp index 5952185cc0e..bb6096ea34d 100644 --- a/editor/plugins/gradient_texture_2d_editor_plugin.cpp +++ b/editor/plugins/gradient_texture_2d_editor_plugin.cpp @@ -31,9 +31,9 @@ #include "gradient_texture_2d_editor_plugin.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_spin_slider.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/flow_container.h" diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 2a712caf928..b7c44795051 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -32,9 +32,9 @@ #include "core/config/project_settings.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/3d/camera_3d.h" #include "scene/3d/light_3d.h" #include "scene/3d/mesh_instance_3d.h" diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 729ca5d7f9e..0324b1d4f74 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -31,7 +31,7 @@ #include "mesh_editor_plugin.h" #include "core/config/project_settings.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/main/viewport.h" diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index 04be44ffc89..9669f992a83 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -31,10 +31,10 @@ #include "mesh_instance_3d_editor_plugin.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/node_3d_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/3d/collision_shape_3d.h" #include "scene/3d/navigation_region_3d.h" #include "scene/3d/physics_body_3d.h" diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 0f6ea715711..455376b659e 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -32,8 +32,8 @@ #define NODE_3D_EDITOR_PLUGIN_H #include "editor/editor_plugin.h" -#include "editor/editor_scale.h" #include "editor/plugins/node_3d_editor_gizmos.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/spin_box.h" diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 6f44dfc755b..a772dba6aeb 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -34,9 +34,9 @@ #include "core/io/file_access.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/dialogs.h" #include "scene/gui/menu_button.h" diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 148ba7d7cae..e56fc94a553 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -33,11 +33,11 @@ #include "core/input/input_event.h" #include "core/math/geometry_2d.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_zoom_widget.h" #include "editor/plugins/canvas_item_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/skeleton_2d.h" #include "scene/gui/check_box.h" #include "scene/gui/dialogs.h" diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index d9f5aee82c8..9b31e40e949 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -34,10 +34,10 @@ #include "core/io/resource_loader.h" #include "editor/editor_interface.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" void ResourcePreloaderEditor::_notification(int p_what) { switch (p_what) { diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index b54a2f717d5..13928710bbc 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -31,7 +31,7 @@ #include "root_motion_editor_plugin.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "scene/3d/skeleton_3d.h" #include "scene/animation/animation_mixer.h" #include "scene/gui/button.h" diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 9a8164a3cf2..ad828016926 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -45,7 +45,6 @@ #include "editor/editor_interface.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_script.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" @@ -58,6 +57,7 @@ #include "editor/node_dock.h" #include "editor/plugins/shader_editor_plugin.h" #include "editor/plugins/text_shader_editor.h" +#include "editor/themes/editor_scale.h" #include "editor/window_wrapper.h" #include "scene/main/node.h" #include "scene/main/window.h" diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 38f3d865d45..45fb531d370 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -36,10 +36,10 @@ #include "editor/debugger/editor_debugger_node.h" #include "editor/editor_command_palette.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_toaster.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/split_container.h" diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 6d6da694052..5798ff9d99b 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -32,7 +32,6 @@ #include "editor/editor_command_palette.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/filesystem_dock.h" @@ -40,6 +39,7 @@ #include "editor/plugins/text_shader_editor.h" #include "editor/plugins/visual_shader_editor_plugin.h" #include "editor/shader_create_dialog.h" +#include "editor/themes/editor_scale.h" #include "editor/window_wrapper.h" #include "scene/gui/item_list.h" #include "scene/gui/texture_rect.h" diff --git a/editor/plugins/shader_file_editor_plugin.cpp b/editor/plugins/shader_file_editor_plugin.cpp index d68b3bde141..69ad2741142 100644 --- a/editor/plugins/shader_file_editor_plugin.cpp +++ b/editor/plugins/shader_file_editor_plugin.cpp @@ -35,9 +35,9 @@ #include "core/os/keyboard.h" #include "core/os/os.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/item_list.h" #include "scene/gui/split_container.h" #include "servers/display_server.h" diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index c816220bd29..53fdde9e142 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -34,12 +34,12 @@ #include "editor/editor_node.h" #include "editor/editor_properties.h" #include "editor/editor_properties_vector.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/animation_player_editor_plugin.h" -#include "node_3d_editor_plugin.h" +#include "editor/plugins/node_3d_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/3d/collision_shape_3d.h" #include "scene/3d/joint_3d.h" #include "scene/3d/mesh_instance_3d.h" diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp index d343f804205..c1e70704515 100644 --- a/editor/plugins/sprite_2d_editor_plugin.cpp +++ b/editor/plugins/sprite_2d_editor_plugin.cpp @@ -33,11 +33,11 @@ #include "canvas_item_editor_plugin.h" #include "core/math/geometry_2d.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_zoom_widget.h" #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/collision_polygon_2d.h" #include "scene/2d/light_occluder_2d.h" #include "scene/2d/mesh_instance_2d.h" diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index f4fa4b14bbd..3672142b359 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -35,12 +35,12 @@ #include "core/os/keyboard.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" #include "editor/scene_tree_dock.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/center_container.h" #include "scene/gui/flow_container.h" #include "scene/gui/margin_container.h" diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 9b1c208a9fa..6ecbff3bb47 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -30,7 +30,7 @@ #include "style_box_editor_plugin.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/resources/style_box_texture.h" diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp index e5b9e3854fd..98d83b6e955 100644 --- a/editor/plugins/text_shader_editor.cpp +++ b/editor/plugins/text_shader_editor.cpp @@ -32,11 +32,11 @@ #include "core/version_generated.gen.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/filesystem_dock.h" #include "editor/project_settings_editor.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/split_container.h" #include "servers/rendering/shader_preprocessor.h" #include "servers/rendering/shader_types.h" diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 9d640bf0dc4..38d9bb84f45 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_scale.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/label.h" #include "scene/gui/texture_rect.h" #include "scene/resources/animated_texture.h" diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 73de15631a0..09f6bf884e4 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -33,10 +33,10 @@ #include "core/input/input.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_box.h" #include "scene/gui/option_button.h" #include "scene/gui/panel_container.h" diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index cbe0f115d32..145ecf65bc6 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -34,12 +34,12 @@ #include "editor/editor_help.h" #include "editor/editor_node.h" #include "editor/editor_resource_picker.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" #include "editor/inspector_dock.h" #include "editor/progress_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_button.h" #include "scene/gui/color_picker.h" #include "scene/gui/item_list.h" diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index 9825be9ae88..205a5e8a206 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -34,8 +34,8 @@ #include "core/input/input.h" #include "core/math/math_funcs.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/gui/check_box.h" #include "scene/gui/check_button.h" diff --git a/editor/plugins/tiles/atlas_merging_dialog.cpp b/editor/plugins/tiles/atlas_merging_dialog.cpp index 62b4993947e..d03445b4129 100644 --- a/editor/plugins/tiles/atlas_merging_dialog.cpp +++ b/editor/plugins/tiles/atlas_merging_dialog.cpp @@ -31,9 +31,9 @@ #include "atlas_merging_dialog.h" #include "editor/editor_properties_vector.h" -#include "editor/editor_scale.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/control.h" #include "scene/gui/split_container.h" #include "scene/resources/image_texture.h" diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 039213e5452..721186ef823 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -32,15 +32,14 @@ #include "core/input/input.h" #include "core/os/keyboard.h" +#include "editor/editor_settings.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/tile_map.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "scene/gui/panel.h" #include "scene/gui/view_panner.h" -#include "editor/editor_scale.h" -#include "editor/editor_settings.h" - void TileAtlasView::gui_input(const Ref &p_event) { if (panner->gui_input(p_event)) { accept_event(); diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 8e4c26bd153..bd44c2965bf 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -37,10 +37,10 @@ #include "editor/editor_node.h" #include "editor/editor_properties.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/control.h" #include "scene/gui/label.h" diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index c0aa5b8efae..c34878b54e3 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -34,10 +34,10 @@ #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/canvas_item_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/camera_2d.h" #include "scene/gui/center_container.h" diff --git a/editor/plugins/tiles/tile_proxies_manager_dialog.cpp b/editor/plugins/tiles/tile_proxies_manager_dialog.cpp index ba431dfa2f8..4a0b5e21174 100644 --- a/editor/plugins/tiles/tile_proxies_manager_dialog.cpp +++ b/editor/plugins/tiles/tile_proxies_manager_dialog.cpp @@ -31,9 +31,9 @@ #include "tile_proxies_manager_dialog.h" #include "editor/editor_properties_vector.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/dialogs.h" #include "scene/gui/popup_menu.h" #include "scene/gui/separator.h" diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index ed6664c5283..8e65ad3b8e1 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -34,13 +34,13 @@ #include "editor/editor_inspector.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_toaster.h" #include "editor/plugins/tiles/tile_set_editor.h" #include "editor/progress_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index bdde662ce1f..c43995d167d 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -36,10 +36,10 @@ #include "editor/editor_file_system.h" #include "editor/editor_inspector.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/control.h" diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index 7f6616fe348..4895e1d2912 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -33,11 +33,11 @@ #include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" #include "editor/plugins/tiles/tile_set_editor.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/gui/item_list.h" diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp index e7e94fdefa8..057e6443d6a 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.cpp +++ b/editor/plugins/tiles/tiles_editor_plugin.cpp @@ -36,10 +36,10 @@ #include "editor/editor_interface.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/plugins/canvas_item_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/tile_map.h" #include "scene/gui/box_container.h" diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index d43c09fb595..d8d70e5b7d7 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -37,11 +37,11 @@ #include "editor/editor_file_system.h" #include "editor/editor_interface.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/filesystem_dock.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/separator.h" #define CHECK_PLUGIN_INITIALIZED() \ diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 24b76526c66..6de37172b3b 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -37,7 +37,6 @@ #include "editor/editor_node.h" #include "editor/editor_properties.h" #include "editor/editor_properties_vector.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" @@ -45,6 +44,7 @@ #include "editor/inspector_dock.h" #include "editor/plugins/curve_editor_plugin.h" #include "editor/plugins/shader_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/gui/check_box.h" #include "scene/gui/code_edit.h" diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp index c0dfc180721..ff8343fbebd 100644 --- a/editor/progress_dialog.cpp +++ b/editor/progress_dialog.cpp @@ -33,7 +33,7 @@ #include "core/os/os.h" #include "editor/editor_interface.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "main/main.h" #include "servers/display_server.h" diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index c986ce215a4..e7277bad6a5 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -42,13 +42,14 @@ #include "core/string/translation.h" #include "core/version.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" -#include "editor/editor_themes.h" #include "editor/editor_vcs_interface.h" #include "editor/gui/editor_file_dialog.h" #include "editor/plugins/asset_library_editor_plugin.h" +#include "editor/themes/editor_icons.h" +#include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme_manager.h" #include "main/main.h" #include "scene/gui/center_container.h" #include "scene/gui/check_box.h" @@ -2879,9 +2880,8 @@ ProjectManager::ProjectManager() { Control::set_root_layout_direction(pm_root_dir); Window::set_root_layout_direction(pm_root_dir); - EditorColorMap::create(); - EditorTheme::initialize(); - Ref theme = create_custom_theme(); + EditorThemeManager::initialize(); + Ref theme = EditorThemeManager::generate_theme(); DisplayServer::set_early_window_clear_color_override(true, theme->get_color(SNAME("background"), EditorStringName(Editor))); set_theme(theme); @@ -3317,8 +3317,7 @@ ProjectManager::~ProjectManager() { EditorSettings::destroy(); } - EditorColorMap::finish(); - EditorTheme::finalize(); + EditorThemeManager::finalize(); } void ProjectTag::_notification(int p_what) { diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 1b0d791ff1c..e59bb76ff43 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -33,11 +33,11 @@ #include "core/config/project_settings.h" #include "editor/editor_log.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/export/editor_export.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_button.h" #include "servers/movie_writer/movie_writer.h" diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index 87dbbd599d0..be5f3097042 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -34,7 +34,7 @@ #include "editor/doc_tools.h" #include "editor/editor_help.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/line_edit.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/tree.h" diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index a3a16dccd82..07cb96b9bcf 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -35,12 +35,11 @@ #include "core/string/print_string.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" -#include "editor/editor_themes.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "modules/regex/regex.h" #include "scene/gui/check_box.h" #include "scene/gui/check_button.h" diff --git a/editor/scene_create_dialog.cpp b/editor/scene_create_dialog.cpp index be558101cfe..ef700d83525 100644 --- a/editor/scene_create_dialog.cpp +++ b/editor/scene_create_dialog.cpp @@ -33,9 +33,9 @@ #include "core/io/dir_access.h" #include "editor/create_dialog.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_validation_panel.h" +#include "editor/themes/editor_scale.h" #include "scene/2d/node_2d.h" #include "scene/3d/node_3d.h" #include "scene/gui/box_container.h" diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 6bad5d1c2ed..9d1c0d6c62d 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -40,7 +40,6 @@ #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_quick_open.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" @@ -55,6 +54,7 @@ #include "editor/plugins/script_editor_plugin.h" #include "editor/reparent_dialog.h" #include "editor/shader_create_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/animation/animation_tree.h" #include "scene/gui/check_box.h" #include "scene/main/window.h" diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 25e17ccd2ac..1da8fa49b43 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -38,11 +38,11 @@ #include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" #include "editor/gui/editor_validation_panel.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/grid_container.h" #include "scene/gui/line_edit.h" diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp index fb91d139a75..8d77b14ab0b 100644 --- a/editor/shader_create_dialog.cpp +++ b/editor/shader_create_dialog.cpp @@ -31,9 +31,9 @@ #include "shader_create_dialog.h" #include "core/config/project_settings.h" -#include "editor/editor_scale.h" #include "editor/gui/editor_file_dialog.h" #include "editor/gui/editor_validation_panel.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/shader_include.h" #include "scene/resources/visual_shader.h" #include "servers/rendering/shader_types.h" diff --git a/editor/surface_upgrade_tool.cpp b/editor/surface_upgrade_tool.cpp index d914303b4e5..4edfb92b017 100644 --- a/editor/surface_upgrade_tool.cpp +++ b/editor/surface_upgrade_tool.cpp @@ -33,9 +33,9 @@ #include "editor/editor_file_system.h" #include "editor/editor_log.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/gui/editor_toaster.h" +#include "editor/themes/editor_scale.h" #include "scene/scene_string_names.h" #include "servers/rendering_server.h" diff --git a/editor/themes/SCsub b/editor/themes/SCsub new file mode 100644 index 00000000000..41b20f8a78f --- /dev/null +++ b/editor/themes/SCsub @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +Import("env") + +import glob +import editor_theme_builders + + +# Fonts +flist = glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.ttf") +flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.otf")) +flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff")) +flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff2")) +flist.sort() +env.Depends("#editor/themes/builtin_fonts.gen.h", flist) +env.CommandNoCache( + "#editor/themes/builtin_fonts.gen.h", + flist, + env.Run(editor_theme_builders.make_fonts_header, "Generating builtin fonts header."), +) + +env.add_source_files(env.editor_sources, "*.cpp") diff --git a/editor/themes/editor_color_map.cpp b/editor/themes/editor_color_map.cpp new file mode 100644 index 00000000000..0b3a2372447 --- /dev/null +++ b/editor/themes/editor_color_map.cpp @@ -0,0 +1,204 @@ +/**************************************************************************/ +/* editor_color_map.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "editor_color_map.h" + +HashMap EditorColorMap::color_conversion_map; +HashSet EditorColorMap::color_conversion_exceptions; + +void EditorColorMap::add_conversion_color_pair(const String p_from_color, const String p_to_color) { + color_conversion_map[Color::html(p_from_color)] = Color::html(p_to_color); +} + +void EditorColorMap::add_conversion_exception(const StringName &p_icon_name) { + color_conversion_exceptions.insert(p_icon_name); +} + +void EditorColorMap::create() { + // Some of the colors below are listed for completeness sake. + // This can be a basis for proper palette validation later. + + // Convert: FROM TO + add_conversion_color_pair("#478cbf", "#478cbf"); // Godot Blue + add_conversion_color_pair("#414042", "#414042"); // Godot Gray + + add_conversion_color_pair("#ffffff", "#414141"); // Pure white + add_conversion_color_pair("#fefefe", "#fefefe"); // Forced light color + add_conversion_color_pair("#000000", "#bfbfbf"); // Pure black + add_conversion_color_pair("#010101", "#010101"); // Forced dark color + + // Keep pure RGB colors as is, but list them for explicitness. + add_conversion_color_pair("#ff0000", "#ff0000"); // Pure red + add_conversion_color_pair("#00ff00", "#00ff00"); // Pure green + add_conversion_color_pair("#0000ff", "#0000ff"); // Pure blue + + // GUI Colors + add_conversion_color_pair("#e0e0e0", "#5a5a5a"); // Common icon color + add_conversion_color_pair("#808080", "#808080"); // GUI disabled color + add_conversion_color_pair("#b3b3b3", "#363636"); // GUI disabled light color + add_conversion_color_pair("#699ce8", "#699ce8"); // GUI highlight color + add_conversion_color_pair("#f9f9f9", "#606060"); // Scrollbar grabber highlight color + + add_conversion_color_pair("#c38ef1", "#a85de9"); // Animation + add_conversion_color_pair("#8da5f3", "#3d64dd"); // 2D + add_conversion_color_pair("#7582a8", "#6d83c8"); // 2D Abstract + add_conversion_color_pair("#fc7f7f", "#cd3838"); // 3D + add_conversion_color_pair("#b56d6d", "#be6a6a"); // 3D Abstract + add_conversion_color_pair("#8eef97", "#2fa139"); // GUI Control + add_conversion_color_pair("#76ad7b", "#64a66a"); // GUI Control Abstract + + add_conversion_color_pair("#5fb2ff", "#0079f0"); // Selection (blue) + add_conversion_color_pair("#003e7a", "#2b74bb"); // Selection (darker blue) + add_conversion_color_pair("#f7f5cf", "#615f3a"); // Gizmo (yellow) + + // Rainbow + add_conversion_color_pair("#ff4545", "#ff2929"); // Red + add_conversion_color_pair("#ffe345", "#ffe337"); // Yellow + add_conversion_color_pair("#80ff45", "#74ff34"); // Green + add_conversion_color_pair("#45ffa2", "#2cff98"); // Aqua + add_conversion_color_pair("#45d7ff", "#22ccff"); // Blue + add_conversion_color_pair("#8045ff", "#702aff"); // Purple + add_conversion_color_pair("#ff4596", "#ff2781"); // Pink + + // Audio gradients + add_conversion_color_pair("#e1da5b", "#d6cf4b"); // Yellow + + add_conversion_color_pair("#62aeff", "#1678e0"); // Frozen gradient top + add_conversion_color_pair("#75d1e6", "#41acc5"); // Frozen gradient middle + add_conversion_color_pair("#84ffee", "#49ccba"); // Frozen gradient bottom + + add_conversion_color_pair("#f70000", "#c91616"); // Color track red + add_conversion_color_pair("#eec315", "#d58c0b"); // Color track orange + add_conversion_color_pair("#dbee15", "#b7d10a"); // Color track yellow + add_conversion_color_pair("#288027", "#218309"); // Color track green + + // Other objects + add_conversion_color_pair("#ffca5f", "#fea900"); // Mesh resource (orange) + add_conversion_color_pair("#2998ff", "#68b6ff"); // Shape resource (blue) + add_conversion_color_pair("#a2d2ff", "#4998e3"); // Shape resource (light blue) + add_conversion_color_pair("#69c4d4", "#29a3cc"); // Input event highlight (light blue) + + // Animation editor tracks + // The property track icon color is set by the common icon color. + add_conversion_color_pair("#ea7940", "#bd5e2c"); // 3D Position track + add_conversion_color_pair("#ff2b88", "#bd165f"); // 3D Rotation track + add_conversion_color_pair("#eac840", "#bd9d1f"); // 3D Scale track + add_conversion_color_pair("#3cf34e", "#16a827"); // Call Method track + add_conversion_color_pair("#2877f6", "#236be6"); // Bezier Curve track + add_conversion_color_pair("#eae440", "#9f9722"); // Audio Playback track + add_conversion_color_pair("#a448f0", "#9853ce"); // Animation Playback track + add_conversion_color_pair("#5ad5c4", "#0a9c88"); // Blend Shape track + + // Control layouts + add_conversion_color_pair("#d6d6d6", "#474747"); // Highlighted part + add_conversion_color_pair("#474747", "#d6d6d6"); // Background part + add_conversion_color_pair("#919191", "#6e6e6e"); // Border part + + // TileSet editor icons + add_conversion_color_pair("#fce00e", "#aa8d24"); // New Single Tile + add_conversion_color_pair("#0e71fc", "#0350bd"); // New Autotile + add_conversion_color_pair("#c6ced4", "#828f9b"); // New Atlas + + // Variant types + add_conversion_color_pair("#41ecad", "#25e3a0"); // Variant + add_conversion_color_pair("#6f91f0", "#6d8eeb"); // bool + add_conversion_color_pair("#5abbef", "#4fb2e9"); // int/uint + add_conversion_color_pair("#35d4f4", "#27ccf0"); // float + add_conversion_color_pair("#4593ec", "#4690e7"); // String + add_conversion_color_pair("#ee5677", "#ee7991"); // AABB + add_conversion_color_pair("#e0e0e0", "#5a5a5a"); // Array + add_conversion_color_pair("#e1ec41", "#b2bb19"); // Basis + add_conversion_color_pair("#54ed9e", "#57e99f"); // Dictionary + add_conversion_color_pair("#417aec", "#6993ec"); // NodePath + add_conversion_color_pair("#55f3e3", "#12d5c3"); // Object + add_conversion_color_pair("#f74949", "#f77070"); // Plane + add_conversion_color_pair("#44bd44", "#46b946"); // Projection + add_conversion_color_pair("#ec418e", "#ec69a3"); // Quaternion + add_conversion_color_pair("#f1738f", "#ee758e"); // Rect2 + add_conversion_color_pair("#41ec80", "#2ce573"); // RID + add_conversion_color_pair("#b9ec41", "#96ce1a"); // Transform2D + add_conversion_color_pair("#f68f45", "#f49047"); // Transform3D + add_conversion_color_pair("#ac73f1", "#ad76ee"); // Vector2 + add_conversion_color_pair("#de66f0", "#dc6aed"); // Vector3 + add_conversion_color_pair("#f066bd", "#ed6abd"); // Vector4 + + // Visual shaders + add_conversion_color_pair("#77ce57", "#67c046"); // Vector funcs + add_conversion_color_pair("#ea686c", "#d95256"); // Vector transforms + add_conversion_color_pair("#eac968", "#d9b64f"); // Textures and cubemaps + add_conversion_color_pair("#cf68ea", "#c050dd"); // Functions and expressions + + // These icons should not be converted. + add_conversion_exception("EditorPivot"); + add_conversion_exception("EditorHandle"); + add_conversion_exception("Editor3DHandle"); + add_conversion_exception("EditorBoneHandle"); + add_conversion_exception("Godot"); + add_conversion_exception("Sky"); + add_conversion_exception("EditorControlAnchor"); + add_conversion_exception("DefaultProjectIcon"); + add_conversion_exception("ZoomMore"); + add_conversion_exception("ZoomLess"); + add_conversion_exception("ZoomReset"); + add_conversion_exception("LockViewport"); + add_conversion_exception("GroupViewport"); + add_conversion_exception("StatusError"); + add_conversion_exception("StatusSuccess"); + add_conversion_exception("StatusWarning"); + add_conversion_exception("OverbrightIndicator"); + add_conversion_exception("MaterialPreviewCube"); + add_conversion_exception("MaterialPreviewSphere"); + add_conversion_exception("MaterialPreviewLight1"); + add_conversion_exception("MaterialPreviewLight2"); + + // GUI + add_conversion_exception("GuiChecked"); + add_conversion_exception("GuiRadioChecked"); + add_conversion_exception("GuiIndeterminate"); + add_conversion_exception("GuiCloseCustomizable"); + add_conversion_exception("GuiGraphNodePort"); + add_conversion_exception("GuiResizer"); + add_conversion_exception("GuiMiniCheckerboard"); + + /// Code Editor. + add_conversion_exception("GuiTab"); + add_conversion_exception("GuiSpace"); + add_conversion_exception("CodeFoldedRightArrow"); + add_conversion_exception("CodeFoldDownArrow"); + add_conversion_exception("CodeRegionFoldedRightArrow"); + add_conversion_exception("CodeRegionFoldDownArrow"); + add_conversion_exception("TextEditorPlay"); + add_conversion_exception("Breakpoint"); +} + +void EditorColorMap::finish() { + color_conversion_map.clear(); + color_conversion_exceptions.clear(); +} diff --git a/editor/editor_themes.h b/editor/themes/editor_color_map.h similarity index 72% rename from editor/editor_themes.h rename to editor/themes/editor_color_map.h index 7d913ccc408..4debd37faf6 100644 --- a/editor/editor_themes.h +++ b/editor/themes/editor_color_map.h @@ -1,5 +1,5 @@ /**************************************************************************/ -/* editor_themes.h */ +/* editor_color_map.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef EDITOR_THEMES_H -#define EDITOR_THEMES_H +#ifndef EDITOR_COLOR_MAP_H +#define EDITOR_COLOR_MAP_H -#include "scene/resources/texture.h" -#include "scene/resources/theme.h" +#include "core/math/color.h" +#include "core/string/string_name.h" +#include "core/templates/hash_map.h" +#include "core/templates/hash_set.h" // The default icon theme is designed to be used for a dark theme. This map stores // Color values to convert to other colors for better readability on a light theme. @@ -55,27 +57,4 @@ public: static void finish(); }; -class EditorTheme : public Theme { - GDCLASS(EditorTheme, Theme); - - static Vector editor_theme_types; - -public: - virtual Color get_color(const StringName &p_name, const StringName &p_theme_type) const override; - virtual int get_constant(const StringName &p_name, const StringName &p_theme_type) const override; - virtual Ref get_font(const StringName &p_name, const StringName &p_theme_type) const override; - virtual int get_font_size(const StringName &p_name, const StringName &p_theme_type) const override; - virtual Ref get_icon(const StringName &p_name, const StringName &p_theme_type) const override; - virtual Ref get_stylebox(const StringName &p_name, const StringName &p_theme_type) const override; - - static void initialize(); - static void finalize(); -}; - -Ref create_editor_theme(Ref p_theme = nullptr); - -Ref create_custom_theme(Ref p_theme = nullptr); - -String get_default_project_icon(); - -#endif // EDITOR_THEMES_H +#endif // EDITOR_COLOR_MAP_H diff --git a/editor/editor_fonts.cpp b/editor/themes/editor_fonts.cpp similarity index 99% rename from editor/editor_fonts.cpp rename to editor/themes/editor_fonts.cpp index 1e1dff61b96..fc3631653cb 100644 --- a/editor/editor_fonts.cpp +++ b/editor/themes/editor_fonts.cpp @@ -30,11 +30,11 @@ #include "editor_fonts.h" -#include "builtin_fonts.gen.h" #include "core/io/dir_access.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/builtin_fonts.gen.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/font.h" Ref load_external_font(const String &p_path, TextServer::Hinting p_hinting, TextServer::FontAntialiasing p_aa, bool p_autohint, TextServer::SubpixelPositioning p_font_subpixel_positioning, bool p_msdf = false, TypedArray *r_fallbacks = nullptr) { @@ -106,7 +106,7 @@ Ref make_bold_font(const Ref &p_font, double p_embolden, Ty return font_var; } -void editor_register_fonts(Ref p_theme) { +void editor_register_fonts(const Ref &p_theme) { OS::get_singleton()->benchmark_begin_measure("EditorTheme", "Register Fonts"); Ref dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); diff --git a/editor/editor_fonts.h b/editor/themes/editor_fonts.h similarity index 97% rename from editor/editor_fonts.h rename to editor/themes/editor_fonts.h index 1705879f59c..b612797df15 100644 --- a/editor/editor_fonts.h +++ b/editor/themes/editor_fonts.h @@ -33,6 +33,6 @@ #include "scene/resources/theme.h" -void editor_register_fonts(Ref p_theme); +void editor_register_fonts(const Ref &p_theme); #endif // EDITOR_FONTS_H diff --git a/editor/themes/editor_icons.cpp b/editor/themes/editor_icons.cpp new file mode 100644 index 00000000000..bb767747f36 --- /dev/null +++ b/editor/themes/editor_icons.cpp @@ -0,0 +1,252 @@ +/**************************************************************************/ +/* editor_icons.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "editor_icons.h" + +#include "editor/editor_settings.h" +#include "editor/editor_string_names.h" +#include "editor/themes/editor_color_map.h" +#include "editor/themes/editor_icons.gen.h" +#include "editor/themes/editor_scale.h" +#include "scene/resources/image_texture.h" +#include "scene/resources/texture.h" + +#include "modules/modules_enabled.gen.h" // For svg. +#ifdef MODULE_SVG_ENABLED +#include "modules/svg/image_loader_svg.h" +#endif + +void editor_configure_icons(bool p_dark_theme) { +#ifdef MODULE_SVG_ENABLED + if (p_dark_theme) { + ImageLoaderSVG::set_forced_color_map(HashMap()); + } else { + ImageLoaderSVG::set_forced_color_map(EditorColorMap::get_color_conversion_map()); + } +#else + WARN_PRINT("SVG support disabled, editor icons won't be rendered."); +#endif +} + +// See also `generate_icon()` in `scene/theme/default_theme.cpp`. +Ref editor_generate_icon(int p_index, float p_scale, float p_saturation, const HashMap &p_convert_colors = HashMap()) { + Ref img = memnew(Image); + +#ifdef MODULE_SVG_ENABLED + // Upsample icon generation only if the editor scale isn't an integer multiplier. + // Generating upsampled icons is slower, and the benefit is hardly visible + // with integer editor scales. + const bool upsample = !Math::is_equal_approx(Math::round(p_scale), p_scale); + Error err = ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, upsample, p_convert_colors); + ERR_FAIL_COND_V_MSG(err != OK, Ref(), "Failed generating icon, unsupported or invalid SVG data in editor theme."); + if (p_saturation != 1.0) { + img->adjust_bcs(1.0, 1.0, p_saturation); + } +#else + // If the SVG module is disabled, we can't really display the UI well, but at least we won't crash. + // 16 pixels is used as it's the most common base size for Godot icons. + img = Image::create_empty(16 * p_scale, 16 * p_scale, false, Image::FORMAT_RGBA8); +#endif + + return ImageTexture::create_from_image(img); +} + +float get_gizmo_handle_scale(const String &gizmo_handle_name = "") { + const float scale_gizmo_handles_for_touch = EDITOR_GET("interface/touchscreen/scale_gizmo_handles"); + if (scale_gizmo_handles_for_touch > 1.0f) { + // The names of the icons that require additional scaling. + static HashSet gizmo_to_scale; + if (gizmo_to_scale.is_empty()) { + gizmo_to_scale.insert("EditorHandle"); + gizmo_to_scale.insert("EditorHandleAdd"); + gizmo_to_scale.insert("EditorHandleDisabled"); + gizmo_to_scale.insert("EditorCurveHandle"); + gizmo_to_scale.insert("EditorPathSharpHandle"); + gizmo_to_scale.insert("EditorPathSmoothHandle"); + } + + if (gizmo_to_scale.has(gizmo_handle_name)) { + return EDSCALE * scale_gizmo_handles_for_touch; + } + } + + return EDSCALE; +} + +void editor_register_icons(const Ref &p_theme, bool p_dark_theme, float p_icon_saturation, int p_thumb_size, bool p_only_thumbs) { + const String benchmark_key = vformat("Generate Icons (%s)", (p_only_thumbs ? "Only Thumbs" : "All")); + OS::get_singleton()->benchmark_begin_measure("EditorTheme", benchmark_key); + + // Before we register the icons, we adjust their colors and saturation. + // Most icons follow the standard rules for color conversion to follow the editor + // theme's polarity (dark/light). We also adjust the saturation for most icons, + // following the editor setting. + // Some icons are excluded from this conversion, and instead use the configured + // accent color to replace their innate accent color to match the editor theme. + // And then some icons are completely excluded from the conversion. + + // Standard color conversion map. + HashMap color_conversion_map; + // Icons by default are set up for the dark theme, so if the theme is light, + // we apply the dark-to-light color conversion map. + if (!p_dark_theme) { + for (KeyValue &E : EditorColorMap::get_color_conversion_map()) { + color_conversion_map[E.key] = E.value; + } + } + // These colors should be converted even if we are using a dark theme. + const Color error_color = p_theme->get_color(SNAME("error_color"), EditorStringName(Editor)); + const Color success_color = p_theme->get_color(SNAME("success_color"), EditorStringName(Editor)); + const Color warning_color = p_theme->get_color(SNAME("warning_color"), EditorStringName(Editor)); + color_conversion_map[Color::html("#ff5f5f")] = error_color; + color_conversion_map[Color::html("#5fff97")] = success_color; + color_conversion_map[Color::html("#ffdd65")] = warning_color; + + // The names of the icons to exclude from the standard color conversion. + HashSet conversion_exceptions = EditorColorMap::get_color_conversion_exceptions(); + + // The names of the icons to exclude when adjusting for saturation. + HashSet saturation_exceptions; + saturation_exceptions.insert("DefaultProjectIcon"); + saturation_exceptions.insert("Godot"); + saturation_exceptions.insert("Logo"); + + // Accent color conversion map. + // It is used on some icons (checkbox, radio, toggle, etc.), regardless of the dark + // or light mode. + HashMap accent_color_map; + HashSet accent_color_icons; + + const Color accent_color = p_theme->get_color(SNAME("accent_color"), EditorStringName(Editor)); + accent_color_map[Color::html("699ce8")] = accent_color; + if (accent_color.get_luminance() > 0.75) { + accent_color_map[Color::html("ffffff")] = Color(0.2, 0.2, 0.2); + } + + accent_color_icons.insert("GuiChecked"); + accent_color_icons.insert("GuiRadioChecked"); + accent_color_icons.insert("GuiIndeterminate"); + accent_color_icons.insert("GuiToggleOn"); + accent_color_icons.insert("GuiToggleOnMirrored"); + accent_color_icons.insert("PlayOverlay"); + + // Generate icons. + if (!p_only_thumbs) { + for (int i = 0; i < editor_icons_count; i++) { + Ref icon; + + const String &editor_icon_name = editor_icons_names[i]; + if (accent_color_icons.has(editor_icon_name)) { + icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), 1.0, accent_color_map); + } else { + float saturation = p_icon_saturation; + if (saturation_exceptions.has(editor_icon_name)) { + saturation = 1.0; + } + + if (conversion_exceptions.has(editor_icon_name)) { + icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), saturation); + } else { + icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), saturation, color_conversion_map); + } + } + + p_theme->set_icon(editor_icon_name, EditorStringName(EditorIcons), icon); + } + } + + // Generate thumbnail icons with the given thumbnail size. + // See editor\icons\editor_icons_builders.py for the code that determines which icons are thumbnails. + if (p_thumb_size >= 64) { + const float scale = (float)p_thumb_size / 64.0 * EDSCALE; + for (int i = 0; i < editor_bg_thumbs_count; i++) { + const int index = editor_bg_thumbs_indices[i]; + Ref icon; + + if (accent_color_icons.has(editor_icons_names[index])) { + icon = editor_generate_icon(index, scale, 1.0, accent_color_map); + } else { + float saturation = p_icon_saturation; + if (saturation_exceptions.has(editor_icons_names[index])) { + saturation = 1.0; + } + + if (conversion_exceptions.has(editor_icons_names[index])) { + icon = editor_generate_icon(index, scale, saturation); + } else { + icon = editor_generate_icon(index, scale, saturation, color_conversion_map); + } + } + + p_theme->set_icon(editor_icons_names[index], EditorStringName(EditorIcons), icon); + } + } else { + const float scale = (float)p_thumb_size / 32.0 * EDSCALE; + for (int i = 0; i < editor_md_thumbs_count; i++) { + const int index = editor_md_thumbs_indices[i]; + Ref icon; + + if (accent_color_icons.has(editor_icons_names[index])) { + icon = editor_generate_icon(index, scale, 1.0, accent_color_map); + } else { + float saturation = p_icon_saturation; + if (saturation_exceptions.has(editor_icons_names[index])) { + saturation = 1.0; + } + + if (conversion_exceptions.has(editor_icons_names[index])) { + icon = editor_generate_icon(index, scale, saturation); + } else { + icon = editor_generate_icon(index, scale, saturation, color_conversion_map); + } + } + + p_theme->set_icon(editor_icons_names[index], EditorStringName(EditorIcons), icon); + } + } + OS::get_singleton()->benchmark_end_measure("EditorTheme", benchmark_key); +} + +void editor_copy_icons(const Ref &p_theme, const Ref &p_old_theme) { + for (int i = 0; i < editor_icons_count; i++) { + p_theme->set_icon(editor_icons_names[i], EditorStringName(EditorIcons), p_old_theme->get_icon(editor_icons_names[i], EditorStringName(EditorIcons))); + } +} + +// Returns the SVG code for the default project icon. +String get_default_project_icon() { + // FIXME: This icon can probably be predefined in editor_icons.gen.h so we don't have to look up. + for (int i = 0; i < editor_icons_count; i++) { + if (strcmp(editor_icons_names[i], "DefaultProjectIcon") == 0) { + return String(editor_icons_sources[i]); + } + } + return String(); +} diff --git a/editor/themes/editor_icons.h b/editor/themes/editor_icons.h new file mode 100644 index 00000000000..2094ebf27c1 --- /dev/null +++ b/editor/themes/editor_icons.h @@ -0,0 +1,42 @@ +/**************************************************************************/ +/* editor_icons.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef EDITOR_ICONS_H +#define EDITOR_ICONS_H + +#include "scene/resources/theme.h" + +void editor_configure_icons(bool p_dark_theme); +void editor_register_icons(const Ref &p_theme, bool p_dark_theme, float p_icon_saturation, int p_thumb_size, bool p_only_thumbs = false); +void editor_copy_icons(const Ref &p_theme, const Ref &p_old_theme); + +String get_default_project_icon(); + +#endif // EDITOR_ICONS_H diff --git a/editor/editor_scale.cpp b/editor/themes/editor_scale.cpp similarity index 100% rename from editor/editor_scale.cpp rename to editor/themes/editor_scale.cpp diff --git a/editor/editor_scale.h b/editor/themes/editor_scale.h similarity index 100% rename from editor/editor_scale.h rename to editor/themes/editor_scale.h diff --git a/editor/themes/editor_theme.cpp b/editor/themes/editor_theme.cpp new file mode 100644 index 00000000000..ab7c808303d --- /dev/null +++ b/editor/themes/editor_theme.cpp @@ -0,0 +1,131 @@ +/**************************************************************************/ +/* editor_theme.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "editor_theme.h" + +#include "editor/editor_string_names.h" +#include "scene/theme/theme_db.h" + +Vector EditorTheme::editor_theme_types; + +// TODO: Refactor these and corresponding Theme methods to use the bool get_xxx(r_value) pattern internally. + +// Keep in sync with Theme::get_color. +Color EditorTheme::get_color(const StringName &p_name, const StringName &p_theme_type) const { + if (color_map.has(p_theme_type) && color_map[p_theme_type].has(p_name)) { + return color_map[p_theme_type][p_name]; + } else { + if (editor_theme_types.has(p_theme_type)) { + WARN_PRINT(vformat("Trying to access a non-existing editor theme color '%s' in '%s'.", p_name, p_theme_type)); + } + return Color(); + } +} + +// Keep in sync with Theme::get_constant. +int EditorTheme::get_constant(const StringName &p_name, const StringName &p_theme_type) const { + if (constant_map.has(p_theme_type) && constant_map[p_theme_type].has(p_name)) { + return constant_map[p_theme_type][p_name]; + } else { + if (editor_theme_types.has(p_theme_type)) { + WARN_PRINT(vformat("Trying to access a non-existing editor theme constant '%s' in '%s'.", p_name, p_theme_type)); + } + return 0; + } +} + +// Keep in sync with Theme::get_font. +Ref EditorTheme::get_font(const StringName &p_name, const StringName &p_theme_type) const { + if (font_map.has(p_theme_type) && font_map[p_theme_type].has(p_name) && font_map[p_theme_type][p_name].is_valid()) { + return font_map[p_theme_type][p_name]; + } else if (has_default_font()) { + if (editor_theme_types.has(p_theme_type)) { + WARN_PRINT(vformat("Trying to access a non-existing editor theme font '%s' in '%s'.", p_name, p_theme_type)); + } + return default_font; + } else { + if (editor_theme_types.has(p_theme_type)) { + WARN_PRINT(vformat("Trying to access a non-existing editor theme font '%s' in '%s'.", p_name, p_theme_type)); + } + return ThemeDB::get_singleton()->get_fallback_font(); + } +} + +// Keep in sync with Theme::get_font_size. +int EditorTheme::get_font_size(const StringName &p_name, const StringName &p_theme_type) const { + if (font_size_map.has(p_theme_type) && font_size_map[p_theme_type].has(p_name) && (font_size_map[p_theme_type][p_name] > 0)) { + return font_size_map[p_theme_type][p_name]; + } else if (has_default_font_size()) { + if (editor_theme_types.has(p_theme_type)) { + WARN_PRINT(vformat("Trying to access a non-existing editor theme font size '%s' in '%s'.", p_name, p_theme_type)); + } + return default_font_size; + } else { + if (editor_theme_types.has(p_theme_type)) { + WARN_PRINT(vformat("Trying to access a non-existing editor theme font size '%s' in '%s'.", p_name, p_theme_type)); + } + return ThemeDB::get_singleton()->get_fallback_font_size(); + } +} + +// Keep in sync with Theme::get_icon. +Ref EditorTheme::get_icon(const StringName &p_name, const StringName &p_theme_type) const { + if (icon_map.has(p_theme_type) && icon_map[p_theme_type].has(p_name) && icon_map[p_theme_type][p_name].is_valid()) { + return icon_map[p_theme_type][p_name]; + } else { + if (editor_theme_types.has(p_theme_type)) { + WARN_PRINT(vformat("Trying to access a non-existing editor theme icon '%s' in '%s'.", p_name, p_theme_type)); + } + return ThemeDB::get_singleton()->get_fallback_icon(); + } +} + +// Keep in sync with Theme::get_stylebox. +Ref EditorTheme::get_stylebox(const StringName &p_name, const StringName &p_theme_type) const { + if (style_map.has(p_theme_type) && style_map[p_theme_type].has(p_name) && style_map[p_theme_type][p_name].is_valid()) { + return style_map[p_theme_type][p_name]; + } else { + if (editor_theme_types.has(p_theme_type)) { + WARN_PRINT(vformat("Trying to access a non-existing editor theme stylebox '%s' in '%s'.", p_name, p_theme_type)); + } + return ThemeDB::get_singleton()->get_fallback_stylebox(); + } +} + +void EditorTheme::initialize() { + editor_theme_types.append(EditorStringName(Editor)); + editor_theme_types.append(EditorStringName(EditorFonts)); + editor_theme_types.append(EditorStringName(EditorIcons)); + editor_theme_types.append(EditorStringName(EditorStyles)); +} + +void EditorTheme::finalize() { + editor_theme_types.clear(); +} diff --git a/editor/themes/editor_theme.h b/editor/themes/editor_theme.h new file mode 100644 index 00000000000..41a60fdf963 --- /dev/null +++ b/editor/themes/editor_theme.h @@ -0,0 +1,53 @@ +/**************************************************************************/ +/* editor_theme.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef EDITOR_THEME_H +#define EDITOR_THEME_H + +#include "scene/resources/theme.h" + +class EditorTheme : public Theme { + GDCLASS(EditorTheme, Theme); + + static Vector editor_theme_types; + +public: + virtual Color get_color(const StringName &p_name, const StringName &p_theme_type) const override; + virtual int get_constant(const StringName &p_name, const StringName &p_theme_type) const override; + virtual Ref get_font(const StringName &p_name, const StringName &p_theme_type) const override; + virtual int get_font_size(const StringName &p_name, const StringName &p_theme_type) const override; + virtual Ref get_icon(const StringName &p_name, const StringName &p_theme_type) const override; + virtual Ref get_stylebox(const StringName &p_name, const StringName &p_theme_type) const override; + + static void initialize(); + static void finalize(); +}; + +#endif // EDITOR_THEME_H diff --git a/editor/themes/editor_theme_builders.py b/editor/themes/editor_theme_builders.py new file mode 100644 index 00000000000..19b346db58b --- /dev/null +++ b/editor/themes/editor_theme_builders.py @@ -0,0 +1,41 @@ +""" +Functions used to generate source files during build time + +All such functions are invoked in a subprocess on Windows to prevent build flakiness. + +""" + +import os +from platform_methods import subprocess_main + + +def make_fonts_header(target, source, env): + dst = target[0] + + g = open(dst, "w", encoding="utf-8") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _EDITOR_FONTS_H\n") + g.write("#define _EDITOR_FONTS_H\n") + + # Saving uncompressed, since FreeType will reference from memory pointer. + for i in range(len(source)): + with open(source[i], "rb") as f: + buf = f.read() + + name = os.path.splitext(os.path.basename(source[i]))[0] + + g.write("static const int _font_" + name + "_size = " + str(len(buf)) + ";\n") + g.write("static const unsigned char _font_" + name + "[] = {\n") + for j in range(len(buf)): + g.write("\t" + str(buf[j]) + ",\n") + + g.write("};\n") + + g.write("#endif") + + g.close() + + +if __name__ == "__main__": + subprocess_main(globals()) diff --git a/editor/editor_themes.cpp b/editor/themes/editor_theme_manager.cpp similarity index 83% rename from editor/editor_themes.cpp rename to editor/themes/editor_theme_manager.cpp index da5eecfb735..5a67531f861 100644 --- a/editor/editor_themes.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* editor_themes.cpp */ +/* editor_theme_manager.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,299 +28,26 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#include "editor_themes.h" +#include "editor_theme_manager.h" #include "core/error/error_macros.h" #include "core/io/resource_loader.h" -#include "editor/editor_fonts.h" -#include "editor/editor_icons.gen.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_color_map.h" +#include "editor/themes/editor_fonts.h" +#include "editor/themes/editor_icons.h" +#include "editor/themes/editor_scale.h" +#include "editor/themes/editor_theme.h" #include "scene/resources/image_texture.h" #include "scene/resources/style_box_flat.h" #include "scene/resources/style_box_line.h" #include "scene/resources/style_box_texture.h" -#include "scene/theme/theme_db.h" +#include "scene/resources/texture.h" -#include "modules/modules_enabled.gen.h" // For svg. -#ifdef MODULE_SVG_ENABLED -#include "modules/svg/image_loader_svg.h" -#endif +// Helper methods. -HashMap EditorColorMap::color_conversion_map; -HashSet EditorColorMap::color_conversion_exceptions; - -void EditorColorMap::add_conversion_color_pair(const String p_from_color, const String p_to_color) { - color_conversion_map[Color::html(p_from_color)] = Color::html(p_to_color); -} - -void EditorColorMap::add_conversion_exception(const StringName &p_icon_name) { - color_conversion_exceptions.insert(p_icon_name); -} - -void EditorColorMap::create() { - // Some of the colors below are listed for completeness sake. - // This can be a basis for proper palette validation later. - - // Convert: FROM TO - add_conversion_color_pair("#478cbf", "#478cbf"); // Godot Blue - add_conversion_color_pair("#414042", "#414042"); // Godot Gray - - add_conversion_color_pair("#ffffff", "#414141"); // Pure white - add_conversion_color_pair("#fefefe", "#fefefe"); // Forced light color - add_conversion_color_pair("#000000", "#bfbfbf"); // Pure black - add_conversion_color_pair("#010101", "#010101"); // Forced dark color - - // Keep pure RGB colors as is, but list them for explicitness. - add_conversion_color_pair("#ff0000", "#ff0000"); // Pure red - add_conversion_color_pair("#00ff00", "#00ff00"); // Pure green - add_conversion_color_pair("#0000ff", "#0000ff"); // Pure blue - - // GUI Colors - add_conversion_color_pair("#e0e0e0", "#5a5a5a"); // Common icon color - add_conversion_color_pair("#808080", "#808080"); // GUI disabled color - add_conversion_color_pair("#b3b3b3", "#363636"); // GUI disabled light color - add_conversion_color_pair("#699ce8", "#699ce8"); // GUI highlight color - add_conversion_color_pair("#f9f9f9", "#606060"); // Scrollbar grabber highlight color - - add_conversion_color_pair("#c38ef1", "#a85de9"); // Animation - add_conversion_color_pair("#8da5f3", "#3d64dd"); // 2D - add_conversion_color_pair("#7582a8", "#6d83c8"); // 2D Abstract - add_conversion_color_pair("#fc7f7f", "#cd3838"); // 3D - add_conversion_color_pair("#b56d6d", "#be6a6a"); // 3D Abstract - add_conversion_color_pair("#8eef97", "#2fa139"); // GUI Control - add_conversion_color_pair("#76ad7b", "#64a66a"); // GUI Control Abstract - - add_conversion_color_pair("#5fb2ff", "#0079f0"); // Selection (blue) - add_conversion_color_pair("#003e7a", "#2b74bb"); // Selection (darker blue) - add_conversion_color_pair("#f7f5cf", "#615f3a"); // Gizmo (yellow) - - // Rainbow - add_conversion_color_pair("#ff4545", "#ff2929"); // Red - add_conversion_color_pair("#ffe345", "#ffe337"); // Yellow - add_conversion_color_pair("#80ff45", "#74ff34"); // Green - add_conversion_color_pair("#45ffa2", "#2cff98"); // Aqua - add_conversion_color_pair("#45d7ff", "#22ccff"); // Blue - add_conversion_color_pair("#8045ff", "#702aff"); // Purple - add_conversion_color_pair("#ff4596", "#ff2781"); // Pink - - // Audio gradients - add_conversion_color_pair("#e1da5b", "#d6cf4b"); // Yellow - - add_conversion_color_pair("#62aeff", "#1678e0"); // Frozen gradient top - add_conversion_color_pair("#75d1e6", "#41acc5"); // Frozen gradient middle - add_conversion_color_pair("#84ffee", "#49ccba"); // Frozen gradient bottom - - add_conversion_color_pair("#f70000", "#c91616"); // Color track red - add_conversion_color_pair("#eec315", "#d58c0b"); // Color track orange - add_conversion_color_pair("#dbee15", "#b7d10a"); // Color track yellow - add_conversion_color_pair("#288027", "#218309"); // Color track green - - // Other objects - add_conversion_color_pair("#ffca5f", "#fea900"); // Mesh resource (orange) - add_conversion_color_pair("#2998ff", "#68b6ff"); // Shape resource (blue) - add_conversion_color_pair("#a2d2ff", "#4998e3"); // Shape resource (light blue) - add_conversion_color_pair("#69c4d4", "#29a3cc"); // Input event highlight (light blue) - - // Animation editor tracks - // The property track icon color is set by the common icon color. - add_conversion_color_pair("#ea7940", "#bd5e2c"); // 3D Position track - add_conversion_color_pair("#ff2b88", "#bd165f"); // 3D Rotation track - add_conversion_color_pair("#eac840", "#bd9d1f"); // 3D Scale track - add_conversion_color_pair("#3cf34e", "#16a827"); // Call Method track - add_conversion_color_pair("#2877f6", "#236be6"); // Bezier Curve track - add_conversion_color_pair("#eae440", "#9f9722"); // Audio Playback track - add_conversion_color_pair("#a448f0", "#9853ce"); // Animation Playback track - add_conversion_color_pair("#5ad5c4", "#0a9c88"); // Blend Shape track - - // Control layouts - add_conversion_color_pair("#d6d6d6", "#474747"); // Highlighted part - add_conversion_color_pair("#474747", "#d6d6d6"); // Background part - add_conversion_color_pair("#919191", "#6e6e6e"); // Border part - - // TileSet editor icons - add_conversion_color_pair("#fce00e", "#aa8d24"); // New Single Tile - add_conversion_color_pair("#0e71fc", "#0350bd"); // New Autotile - add_conversion_color_pair("#c6ced4", "#828f9b"); // New Atlas - - // Variant types - add_conversion_color_pair("#41ecad", "#25e3a0"); // Variant - add_conversion_color_pair("#6f91f0", "#6d8eeb"); // bool - add_conversion_color_pair("#5abbef", "#4fb2e9"); // int/uint - add_conversion_color_pair("#35d4f4", "#27ccf0"); // float - add_conversion_color_pair("#4593ec", "#4690e7"); // String - add_conversion_color_pair("#ee5677", "#ee7991"); // AABB - add_conversion_color_pair("#e0e0e0", "#5a5a5a"); // Array - add_conversion_color_pair("#e1ec41", "#b2bb19"); // Basis - add_conversion_color_pair("#54ed9e", "#57e99f"); // Dictionary - add_conversion_color_pair("#417aec", "#6993ec"); // NodePath - add_conversion_color_pair("#55f3e3", "#12d5c3"); // Object - add_conversion_color_pair("#f74949", "#f77070"); // Plane - add_conversion_color_pair("#44bd44", "#46b946"); // Projection - add_conversion_color_pair("#ec418e", "#ec69a3"); // Quaternion - add_conversion_color_pair("#f1738f", "#ee758e"); // Rect2 - add_conversion_color_pair("#41ec80", "#2ce573"); // RID - add_conversion_color_pair("#b9ec41", "#96ce1a"); // Transform2D - add_conversion_color_pair("#f68f45", "#f49047"); // Transform3D - add_conversion_color_pair("#ac73f1", "#ad76ee"); // Vector2 - add_conversion_color_pair("#de66f0", "#dc6aed"); // Vector3 - add_conversion_color_pair("#f066bd", "#ed6abd"); // Vector4 - - // Visual shaders - add_conversion_color_pair("#77ce57", "#67c046"); // Vector funcs - add_conversion_color_pair("#ea686c", "#d95256"); // Vector transforms - add_conversion_color_pair("#eac968", "#d9b64f"); // Textures and cubemaps - add_conversion_color_pair("#cf68ea", "#c050dd"); // Functions and expressions - - // These icons should not be converted. - add_conversion_exception("EditorPivot"); - add_conversion_exception("EditorHandle"); - add_conversion_exception("Editor3DHandle"); - add_conversion_exception("EditorBoneHandle"); - add_conversion_exception("Godot"); - add_conversion_exception("Sky"); - add_conversion_exception("EditorControlAnchor"); - add_conversion_exception("DefaultProjectIcon"); - add_conversion_exception("ZoomMore"); - add_conversion_exception("ZoomLess"); - add_conversion_exception("ZoomReset"); - add_conversion_exception("LockViewport"); - add_conversion_exception("GroupViewport"); - add_conversion_exception("StatusError"); - add_conversion_exception("StatusSuccess"); - add_conversion_exception("StatusWarning"); - add_conversion_exception("OverbrightIndicator"); - add_conversion_exception("MaterialPreviewCube"); - add_conversion_exception("MaterialPreviewSphere"); - add_conversion_exception("MaterialPreviewLight1"); - add_conversion_exception("MaterialPreviewLight2"); - - // GUI - add_conversion_exception("GuiChecked"); - add_conversion_exception("GuiRadioChecked"); - add_conversion_exception("GuiIndeterminate"); - add_conversion_exception("GuiCloseCustomizable"); - add_conversion_exception("GuiGraphNodePort"); - add_conversion_exception("GuiResizer"); - add_conversion_exception("GuiMiniCheckerboard"); - - /// Code Editor. - add_conversion_exception("GuiTab"); - add_conversion_exception("GuiSpace"); - add_conversion_exception("CodeFoldedRightArrow"); - add_conversion_exception("CodeFoldDownArrow"); - add_conversion_exception("CodeRegionFoldedRightArrow"); - add_conversion_exception("CodeRegionFoldDownArrow"); - add_conversion_exception("TextEditorPlay"); - add_conversion_exception("Breakpoint"); -} - -void EditorColorMap::finish() { - color_conversion_map.clear(); - color_conversion_exceptions.clear(); -} - -Vector EditorTheme::editor_theme_types; - -// TODO: Refactor these and corresponding Theme methods to use the bool get_xxx(r_value) pattern internally. - -// Keep in sync with Theme::get_color. -Color EditorTheme::get_color(const StringName &p_name, const StringName &p_theme_type) const { - if (color_map.has(p_theme_type) && color_map[p_theme_type].has(p_name)) { - return color_map[p_theme_type][p_name]; - } else { - if (editor_theme_types.has(p_theme_type)) { - WARN_PRINT(vformat("Trying to access a non-existing editor theme color '%s' in '%s'.", p_name, p_theme_type)); - } - return Color(); - } -} - -// Keep in sync with Theme::get_constant. -int EditorTheme::get_constant(const StringName &p_name, const StringName &p_theme_type) const { - if (constant_map.has(p_theme_type) && constant_map[p_theme_type].has(p_name)) { - return constant_map[p_theme_type][p_name]; - } else { - if (editor_theme_types.has(p_theme_type)) { - WARN_PRINT(vformat("Trying to access a non-existing editor theme constant '%s' in '%s'.", p_name, p_theme_type)); - } - return 0; - } -} - -// Keep in sync with Theme::get_font. -Ref EditorTheme::get_font(const StringName &p_name, const StringName &p_theme_type) const { - if (font_map.has(p_theme_type) && font_map[p_theme_type].has(p_name) && font_map[p_theme_type][p_name].is_valid()) { - return font_map[p_theme_type][p_name]; - } else if (has_default_font()) { - if (editor_theme_types.has(p_theme_type)) { - WARN_PRINT(vformat("Trying to access a non-existing editor theme font '%s' in '%s'.", p_name, p_theme_type)); - } - return default_font; - } else { - if (editor_theme_types.has(p_theme_type)) { - WARN_PRINT(vformat("Trying to access a non-existing editor theme font '%s' in '%s'.", p_name, p_theme_type)); - } - return ThemeDB::get_singleton()->get_fallback_font(); - } -} - -// Keep in sync with Theme::get_font_size. -int EditorTheme::get_font_size(const StringName &p_name, const StringName &p_theme_type) const { - if (font_size_map.has(p_theme_type) && font_size_map[p_theme_type].has(p_name) && (font_size_map[p_theme_type][p_name] > 0)) { - return font_size_map[p_theme_type][p_name]; - } else if (has_default_font_size()) { - if (editor_theme_types.has(p_theme_type)) { - WARN_PRINT(vformat("Trying to access a non-existing editor theme font size '%s' in '%s'.", p_name, p_theme_type)); - } - return default_font_size; - } else { - if (editor_theme_types.has(p_theme_type)) { - WARN_PRINT(vformat("Trying to access a non-existing editor theme font size '%s' in '%s'.", p_name, p_theme_type)); - } - return ThemeDB::get_singleton()->get_fallback_font_size(); - } -} - -// Keep in sync with Theme::get_icon. -Ref EditorTheme::get_icon(const StringName &p_name, const StringName &p_theme_type) const { - if (icon_map.has(p_theme_type) && icon_map[p_theme_type].has(p_name) && icon_map[p_theme_type][p_name].is_valid()) { - return icon_map[p_theme_type][p_name]; - } else { - if (editor_theme_types.has(p_theme_type)) { - WARN_PRINT(vformat("Trying to access a non-existing editor theme icon '%s' in '%s'.", p_name, p_theme_type)); - } - return ThemeDB::get_singleton()->get_fallback_icon(); - } -} - -// Keep in sync with Theme::get_stylebox. -Ref EditorTheme::get_stylebox(const StringName &p_name, const StringName &p_theme_type) const { - if (style_map.has(p_theme_type) && style_map[p_theme_type].has(p_name) && style_map[p_theme_type][p_name].is_valid()) { - return style_map[p_theme_type][p_name]; - } else { - if (editor_theme_types.has(p_theme_type)) { - WARN_PRINT(vformat("Trying to access a non-existing editor theme stylebox '%s' in '%s'.", p_name, p_theme_type)); - } - return ThemeDB::get_singleton()->get_fallback_stylebox(); - } -} - -void EditorTheme::initialize() { - editor_theme_types.append(EditorStringName(Editor)); - editor_theme_types.append(EditorStringName(EditorFonts)); - editor_theme_types.append(EditorStringName(EditorIcons)); - editor_theme_types.append(EditorStringName(EditorStyles)); -} - -void EditorTheme::finalize() { - editor_theme_types.clear(); -} - -// Editor theme generatior. - -static Ref make_stylebox(Ref p_texture, float p_left, float p_top, float p_right, float p_bottom, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1, bool p_draw_center = true) { +Ref make_stylebox(Ref p_texture, float p_left, float p_top, float p_right, float p_bottom, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1, bool p_draw_center = true) { Ref style(memnew(StyleBoxTexture)); style->set_texture(p_texture); style->set_texture_margin_individual(p_left * EDSCALE, p_top * EDSCALE, p_right * EDSCALE, p_bottom * EDSCALE); @@ -329,13 +56,13 @@ static Ref make_stylebox(Ref p_texture, float p_left return style; } -static Ref make_empty_stylebox(float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) { +Ref make_empty_stylebox(float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) { Ref style(memnew(StyleBoxEmpty)); style->set_content_margin_individual(p_margin_left * EDSCALE, p_margin_top * EDSCALE, p_margin_right * EDSCALE, p_margin_bottom * EDSCALE); return style; } -static Ref make_flat_stylebox(Color p_color, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1, int p_corner_width = 0) { +Ref make_flat_stylebox(Color p_color, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1, int p_corner_width = 0) { Ref style(memnew(StyleBoxFlat)); style->set_bg_color(p_color); // Adjust level of detail based on the corners' effective sizes. @@ -347,7 +74,7 @@ static Ref make_flat_stylebox(Color p_color, float p_margin_left = return style; } -static Ref make_line_stylebox(Color p_color, int p_thickness = 1, float p_grow_begin = 1, float p_grow_end = 1, bool p_vertical = false) { +Ref make_line_stylebox(Color p_color, int p_thickness = 1, float p_grow_begin = 1, float p_grow_end = 1, bool p_vertical = false) { Ref style(memnew(StyleBoxLine)); style->set_color(p_color); style->set_grow_begin(p_grow_begin); @@ -357,189 +84,7 @@ static Ref make_line_stylebox(Color p_color, int p_thickness = 1, return style; } -// See also `generate_icon()` in `scene/theme/default_theme.cpp`. -static Ref editor_generate_icon(int p_index, float p_scale, float p_saturation, const HashMap &p_convert_colors = HashMap()) { - Ref img = memnew(Image); - -#ifdef MODULE_SVG_ENABLED - // Upsample icon generation only if the editor scale isn't an integer multiplier. - // Generating upsampled icons is slower, and the benefit is hardly visible - // with integer editor scales. - const bool upsample = !Math::is_equal_approx(Math::round(p_scale), p_scale); - Error err = ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, upsample, p_convert_colors); - ERR_FAIL_COND_V_MSG(err != OK, Ref(), "Failed generating icon, unsupported or invalid SVG data in editor theme."); - if (p_saturation != 1.0) { - img->adjust_bcs(1.0, 1.0, p_saturation); - } -#else - // If the SVG module is disabled, we can't really display the UI well, but at least we won't crash. - // 16 pixels is used as it's the most common base size for Godot icons. - img = Image::create_empty(16 * p_scale, 16 * p_scale, false, Image::FORMAT_RGBA8); -#endif - - return ImageTexture::create_from_image(img); -} - -float get_gizmo_handle_scale(const String &gizmo_handle_name = "") { - const float scale_gizmo_handles_for_touch = EDITOR_GET("interface/touchscreen/scale_gizmo_handles"); - if (scale_gizmo_handles_for_touch > 1.0f) { - // The names of the icons that require additional scaling. - static HashSet gizmo_to_scale; - if (gizmo_to_scale.is_empty()) { - gizmo_to_scale.insert("EditorHandle"); - gizmo_to_scale.insert("EditorHandleAdd"); - gizmo_to_scale.insert("EditorHandleDisabled"); - gizmo_to_scale.insert("EditorCurveHandle"); - gizmo_to_scale.insert("EditorPathSharpHandle"); - gizmo_to_scale.insert("EditorPathSmoothHandle"); - } - - if (gizmo_to_scale.has(gizmo_handle_name)) { - return EDSCALE * scale_gizmo_handles_for_touch; - } - } - - return EDSCALE; -} - -void editor_register_and_generate_icons(Ref p_theme, bool p_dark_theme, float p_icon_saturation, int p_thumb_size, bool p_only_thumbs = false) { - const String benchmark_key = vformat("Generate Icons (%s)", (p_only_thumbs ? "Only Thumbs" : "All")); - OS::get_singleton()->benchmark_begin_measure("EditorTheme", benchmark_key); - - // Before we register the icons, we adjust their colors and saturation. - // Most icons follow the standard rules for color conversion to follow the editor - // theme's polarity (dark/light). We also adjust the saturation for most icons, - // following the editor setting. - // Some icons are excluded from this conversion, and instead use the configured - // accent color to replace their innate accent color to match the editor theme. - // And then some icons are completely excluded from the conversion. - - // Standard color conversion map. - HashMap color_conversion_map; - // Icons by default are set up for the dark theme, so if the theme is light, - // we apply the dark-to-light color conversion map. - if (!p_dark_theme) { - for (KeyValue &E : EditorColorMap::get_color_conversion_map()) { - color_conversion_map[E.key] = E.value; - } - } - // These colors should be converted even if we are using a dark theme. - const Color error_color = p_theme->get_color(SNAME("error_color"), EditorStringName(Editor)); - const Color success_color = p_theme->get_color(SNAME("success_color"), EditorStringName(Editor)); - const Color warning_color = p_theme->get_color(SNAME("warning_color"), EditorStringName(Editor)); - color_conversion_map[Color::html("#ff5f5f")] = error_color; - color_conversion_map[Color::html("#5fff97")] = success_color; - color_conversion_map[Color::html("#ffdd65")] = warning_color; - - // The names of the icons to exclude from the standard color conversion. - HashSet conversion_exceptions = EditorColorMap::get_color_conversion_exceptions(); - - // The names of the icons to exclude when adjusting for saturation. - HashSet saturation_exceptions; - saturation_exceptions.insert("DefaultProjectIcon"); - saturation_exceptions.insert("Godot"); - saturation_exceptions.insert("Logo"); - - // Accent color conversion map. - // It is used on some icons (checkbox, radio, toggle, etc.), regardless of the dark - // or light mode. - HashMap accent_color_map; - HashSet accent_color_icons; - - const Color accent_color = p_theme->get_color(SNAME("accent_color"), EditorStringName(Editor)); - accent_color_map[Color::html("699ce8")] = accent_color; - if (accent_color.get_luminance() > 0.75) { - accent_color_map[Color::html("ffffff")] = Color(0.2, 0.2, 0.2); - } - - accent_color_icons.insert("GuiChecked"); - accent_color_icons.insert("GuiRadioChecked"); - accent_color_icons.insert("GuiIndeterminate"); - accent_color_icons.insert("GuiToggleOn"); - accent_color_icons.insert("GuiToggleOnMirrored"); - accent_color_icons.insert("PlayOverlay"); - - // Generate icons. - if (!p_only_thumbs) { - for (int i = 0; i < editor_icons_count; i++) { - Ref icon; - - const String &editor_icon_name = editor_icons_names[i]; - if (accent_color_icons.has(editor_icon_name)) { - icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), 1.0, accent_color_map); - } else { - float saturation = p_icon_saturation; - if (saturation_exceptions.has(editor_icon_name)) { - saturation = 1.0; - } - - if (conversion_exceptions.has(editor_icon_name)) { - icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), saturation); - } else { - icon = editor_generate_icon(i, get_gizmo_handle_scale(editor_icon_name), saturation, color_conversion_map); - } - } - - p_theme->set_icon(editor_icon_name, EditorStringName(EditorIcons), icon); - } - } - - // Generate thumbnail icons with the given thumbnail size. - // See editor\icons\editor_icons_builders.py for the code that determines which icons are thumbnails. - if (p_thumb_size >= 64) { - const float scale = (float)p_thumb_size / 64.0 * EDSCALE; - for (int i = 0; i < editor_bg_thumbs_count; i++) { - const int index = editor_bg_thumbs_indices[i]; - Ref icon; - - if (accent_color_icons.has(editor_icons_names[index])) { - icon = editor_generate_icon(index, scale, 1.0, accent_color_map); - } else { - float saturation = p_icon_saturation; - if (saturation_exceptions.has(editor_icons_names[index])) { - saturation = 1.0; - } - - if (conversion_exceptions.has(editor_icons_names[index])) { - icon = editor_generate_icon(index, scale, saturation); - } else { - icon = editor_generate_icon(index, scale, saturation, color_conversion_map); - } - } - - p_theme->set_icon(editor_icons_names[index], EditorStringName(EditorIcons), icon); - } - } else { - const float scale = (float)p_thumb_size / 32.0 * EDSCALE; - for (int i = 0; i < editor_md_thumbs_count; i++) { - const int index = editor_md_thumbs_indices[i]; - Ref icon; - - if (accent_color_icons.has(editor_icons_names[index])) { - icon = editor_generate_icon(index, scale, 1.0, accent_color_map); - } else { - float saturation = p_icon_saturation; - if (saturation_exceptions.has(editor_icons_names[index])) { - saturation = 1.0; - } - - if (conversion_exceptions.has(editor_icons_names[index])) { - icon = editor_generate_icon(index, scale, saturation); - } else { - icon = editor_generate_icon(index, scale, saturation, color_conversion_map); - } - } - - p_theme->set_icon(editor_icons_names[index], EditorStringName(EditorIcons), icon); - } - } - OS::get_singleton()->benchmark_end_measure("EditorTheme", benchmark_key); -} - -Ref create_editor_theme(const Ref p_theme) { - OS::get_singleton()->benchmark_begin_measure("EditorTheme", "Create Editor Theme"); - Ref theme = memnew(EditorTheme); - +static void populate_editor_theme(const Ref &theme, const Ref &p_old_theme) { // Controls may rely on the scale for their internal drawing logic. theme->set_default_base_scale(EDSCALE); @@ -630,14 +175,6 @@ Ref create_editor_theme(const Ref p_theme) { // Colors bool dark_theme = EditorSettings::get_singleton()->is_dark_theme(); -#ifdef MODULE_SVG_ENABLED - if (dark_theme) { - ImageLoaderSVG::set_forced_color_map(HashMap()); - } else { - ImageLoaderSVG::set_forced_color_map(EditorColorMap::get_color_conversion_map()); - } -#endif - // Ensure base colors are in the 0..1 luminance range to avoid 8-bit integer overflow or text rendering issues. // Some places in the editor use 8-bit integer colors. const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast).clamp(); @@ -757,16 +294,16 @@ Ref create_editor_theme(const Ref p_theme) { // Otherwise, regenerate them. Also check if we need to regenerate "thumb" icons. bool keep_old_icons = false; bool regenerate_thumb_icons = true; - if (p_theme != nullptr) { + if (p_old_theme != nullptr) { // We check editor scale, theme dark/light mode, icon saturation, and accent color. // That doesn't really work as expected, since theme constants are integers, and scales are floats. // So this check will never work when changing between 100-199% values. - const float prev_scale = (float)p_theme->get_constant(SNAME("scale"), EditorStringName(Editor)); - const bool prev_dark_theme = (bool)p_theme->get_constant(SNAME("dark_theme"), EditorStringName(Editor)); - const Color prev_accent_color = p_theme->get_color(SNAME("accent_color"), EditorStringName(Editor)); - const float prev_icon_saturation = p_theme->get_color(SNAME("icon_saturation"), EditorStringName(Editor)).r; - const float prev_gizmo_handle_scale = (float)p_theme->get_constant(SNAME("gizmo_handle_scale"), EditorStringName(Editor)); + const float prev_scale = (float)p_old_theme->get_constant(SNAME("scale"), EditorStringName(Editor)); + const bool prev_dark_theme = (bool)p_old_theme->get_constant(SNAME("dark_theme"), EditorStringName(Editor)); + const Color prev_accent_color = p_old_theme->get_color(SNAME("accent_color"), EditorStringName(Editor)); + const float prev_icon_saturation = p_old_theme->get_color(SNAME("icon_saturation"), EditorStringName(Editor)).r; + const float prev_gizmo_handle_scale = (float)p_old_theme->get_constant(SNAME("gizmo_handle_scale"), EditorStringName(Editor)); keep_old_icons = (Math::is_equal_approx(prev_scale, EDSCALE) && Math::is_equal_approx(prev_gizmo_handle_scale, gizmo_handle_scale) && @@ -774,24 +311,19 @@ Ref create_editor_theme(const Ref p_theme) { prev_accent_color == accent_color && prev_icon_saturation == icon_saturation); - const double prev_thumb_size = (double)p_theme->get_constant(SNAME("thumb_size"), EditorStringName(Editor)); + const double prev_thumb_size = (double)p_old_theme->get_constant(SNAME("thumb_size"), EditorStringName(Editor)); regenerate_thumb_icons = !Math::is_equal_approx(prev_thumb_size, thumb_size); } -#ifndef MODULE_SVG_ENABLED - WARN_PRINT("SVG support disabled, editor icons won't be rendered."); -#endif - + editor_configure_icons(dark_theme); if (keep_old_icons) { - for (int i = 0; i < editor_icons_count; i++) { - theme->set_icon(editor_icons_names[i], EditorStringName(EditorIcons), p_theme->get_icon(editor_icons_names[i], EditorStringName(EditorIcons))); - } + editor_copy_icons(theme, p_old_theme); } else { - editor_register_and_generate_icons(theme, dark_theme, icon_saturation, thumb_size, false); + editor_register_icons(theme, dark_theme, icon_saturation, thumb_size, false); } if (regenerate_thumb_icons) { - editor_register_and_generate_icons(theme, dark_theme, icon_saturation, thumb_size, true); + editor_register_icons(theme, dark_theme, icon_saturation, thumb_size, true); } // Register editor fonts. @@ -2366,16 +1898,22 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("folded_code_region_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/folded_code_region_color")); theme->set_color("search_result_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/search_result_color")); theme->set_color("search_result_border_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/search_result_border_color")); +} - OS::get_singleton()->benchmark_end_measure("EditorTheme", "Create Editor Theme"); +Ref EditorThemeManager::_create_base_theme(const Ref &p_old_theme) { + OS::get_singleton()->benchmark_begin_measure("EditorTheme", "Create Base Theme"); + Ref theme = memnew(EditorTheme); + populate_editor_theme(theme, p_old_theme); + + OS::get_singleton()->benchmark_end_measure("EditorTheme", "Create Base Theme"); return theme; } -Ref create_custom_theme(const Ref p_theme) { - Ref theme = create_editor_theme(p_theme); +Ref EditorThemeManager::generate_theme(const Ref &p_old_theme) { + OS::get_singleton()->benchmark_begin_measure("EditorTheme", "Generate Theme"); - OS::get_singleton()->benchmark_begin_measure("EditorTheme", "Create Custom Theme"); + Ref theme = _create_base_theme(p_old_theme); const String custom_theme_path = EDITOR_GET("interface/theme/custom_theme"); if (!custom_theme_path.is_empty()) { @@ -2385,18 +1923,35 @@ Ref create_custom_theme(const Ref p_theme) { } } - OS::get_singleton()->benchmark_end_measure("EditorTheme", "Create Custom Theme"); + OS::get_singleton()->benchmark_end_measure("EditorTheme", "Generate Theme"); return theme; } -/** - * Returns the SVG code for the default project icon. - */ -String get_default_project_icon() { - for (int i = 0; i < editor_icons_count; i++) { - if (strcmp(editor_icons_names[i], "DefaultProjectIcon") == 0) { - return String(editor_icons_sources[i]); - } - } - return String(); +bool EditorThemeManager::is_generated_theme_outdated() { + // This list includes settings used by files in the editor/themes folder. + // Note that the editor scale is purposefully omitted because it cannot be changed + // without a restart, so there is no point regenerating the theme. + + // TODO: We can use this information more intelligently to do partial theme updates and speed things up. + return + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/code_font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || + EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") || + EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog/thumbnail_size") || + EditorSettings::get_singleton()->check_changed_settings_in_group("run/output/font_size") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/increase_scrollbar_touch_area") || + EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/scale_gizmo_handles"); +} + +void EditorThemeManager::initialize() { + EditorColorMap::create(); + EditorTheme::initialize(); +} + +void EditorThemeManager::finalize() { + EditorColorMap::finish(); + EditorTheme::finalize(); } diff --git a/editor/themes/editor_theme_manager.h b/editor/themes/editor_theme_manager.h new file mode 100644 index 00000000000..bd06aeba0d5 --- /dev/null +++ b/editor/themes/editor_theme_manager.h @@ -0,0 +1,48 @@ +/**************************************************************************/ +/* editor_theme_manager.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef EDITOR_THEME_MANAGER_H +#define EDITOR_THEME_MANAGER_H + +#include "scene/resources/theme.h" + +class EditorThemeManager { + + static Ref _create_base_theme(const Ref &p_old_theme = nullptr); + +public: + static Ref generate_theme(const Ref &p_old_theme = nullptr); + static bool is_generated_theme_outdated(); + + static void initialize(); + static void finalize(); +}; + +#endif // EDITOR_THEME_MANAGER_H diff --git a/editor/window_wrapper.cpp b/editor/window_wrapper.cpp index aec4005ce53..a085c2e44f1 100644 --- a/editor/window_wrapper.cpp +++ b/editor/window_wrapper.cpp @@ -31,10 +31,10 @@ #include "window_wrapper.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/progress_dialog.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "scene/gui/panel.h" diff --git a/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp b/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp index 56e4bfbb321..fee81563755 100644 --- a/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp +++ b/modules/gltf/editor/editor_scene_exporter_gltf_plugin.cpp @@ -37,9 +37,9 @@ #include "editor/editor_file_system.h" #include "editor/editor_inspector.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/gui/editor_file_dialog.h" #include "editor/import/3d/scene_import_settings.h" +#include "editor/themes/editor_scale.h" String SceneExporterGLTFPlugin::get_name() const { return "ConvertGLTF2"; diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp index 24dab16b90a..46367820635 100644 --- a/modules/gltf/editor/editor_scene_importer_blend.cpp +++ b/modules/gltf/editor/editor_scene_importer_blend.cpp @@ -38,10 +38,10 @@ #include "core/config/project_settings.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" #include "main/main.h" #include "scene/gui/line_edit.h" diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index 225138dfb39..b8902694c9e 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -36,11 +36,11 @@ #include "core/input/input.h" #include "core/os/keyboard.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/node_3d_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/3d/camera_3d.h" #include "scene/gui/dialogs.h" #include "scene/gui/label.h" diff --git a/modules/mono/editor/editor_internal_calls.cpp b/modules/mono/editor/editor_internal_calls.cpp index fc99f3ceda1..322078423ff 100644 --- a/modules/mono/editor/editor_internal_calls.cpp +++ b/modules/mono/editor/editor_internal_calls.cpp @@ -43,10 +43,10 @@ #include "editor/debugger/editor_debugger_node.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/gui/editor_run_bar.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "main/main.h" #ifdef UNIX_ENABLED diff --git a/modules/multiplayer/editor/editor_network_profiler.cpp b/modules/multiplayer/editor/editor_network_profiler.cpp index a53eefc4521..a45e5ffdc0b 100644 --- a/modules/multiplayer/editor/editor_network_profiler.cpp +++ b/modules/multiplayer/editor/editor_network_profiler.cpp @@ -31,9 +31,9 @@ #include "editor_network_profiler.h" #include "core/os/os.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" +#include "editor/themes/editor_scale.h" void EditorNetworkProfiler::_bind_methods() { ADD_SIGNAL(MethodInfo("enable_profiling", PropertyInfo(Variant::BOOL, "enable"))); diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp index eab1f5d51d7..2e3df732e28 100644 --- a/modules/multiplayer/editor/replication_editor.cpp +++ b/modules/multiplayer/editor/replication_editor.cpp @@ -33,13 +33,13 @@ #include "../multiplayer_synchronizer.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/scene_tree_editor.h" #include "editor/inspector_dock.h" #include "editor/property_selector.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/dialogs.h" #include "scene/gui/separator.h" #include "scene/gui/tree.h" diff --git a/modules/noise/editor/noise_editor_plugin.cpp b/modules/noise/editor/noise_editor_plugin.cpp index 91e9f7d477b..917fa0cd15e 100644 --- a/modules/noise/editor/noise_editor_plugin.cpp +++ b/modules/noise/editor/noise_editor_plugin.cpp @@ -36,7 +36,7 @@ #include "../noise_texture_2d.h" #include "editor/editor_inspector.h" -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/gui/texture_rect.h" diff --git a/modules/openxr/editor/openxr_action_map_editor.cpp b/modules/openxr/editor/openxr_action_map_editor.cpp index dacf2840466..15468a1c671 100644 --- a/modules/openxr/editor/openxr_action_map_editor.cpp +++ b/modules/openxr/editor/openxr_action_map_editor.cpp @@ -32,9 +32,9 @@ #include "core/config/project_settings.h" #include "editor/editor_node.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/themes/editor_scale.h" // TODO implement redo/undo system diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 2cc1f41b3eb..653e7bfe6fa 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -45,9 +45,9 @@ #include "editor/editor_log.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/import/resource_importer_texture_settings.h" +#include "editor/themes/editor_scale.h" #include "main/splash.gen.h" #include "scene/resources/image_texture.h" diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp index 6943f0c6372..d35819c34dd 100644 --- a/platform/ios/export/export_plugin.cpp +++ b/platform/ios/export/export_plugin.cpp @@ -38,11 +38,11 @@ #include "core/string/translation.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/export/editor_export.h" #include "editor/import/resource_importer_texture_settings.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "modules/modules_enabled.gen.h" // For mono and svg. #ifdef MODULE_SVG_ENABLED diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp index 64efcffae3b..773b124c6af 100644 --- a/platform/linuxbsd/export/export_plugin.cpp +++ b/platform/linuxbsd/export/export_plugin.cpp @@ -36,9 +36,9 @@ #include "core/config/project_settings.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/export/editor_export.h" +#include "editor/themes/editor_scale.h" #include "modules/modules_enabled.gen.h" // For svg. #ifdef MODULE_SVG_ENABLED diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index c3470820103..7ed78db6f89 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -42,9 +42,9 @@ #include "drivers/png/png_driver_common.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/import/resource_importer_texture_settings.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/image_texture.h" #include "modules/modules_enabled.gen.h" // For svg and regex. diff --git a/platform/web/export/export_plugin.cpp b/platform/web/export/export_plugin.cpp index ee170280e22..9ffb776c299 100644 --- a/platform/web/export/export_plugin.cpp +++ b/platform/web/export/export_plugin.cpp @@ -34,11 +34,11 @@ #include "run_icon_svg.gen.h" #include "core/config/project_settings.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/export/editor_export.h" #include "editor/import/resource_importer_texture_settings.h" +#include "editor/themes/editor_scale.h" #include "scene/resources/image_texture.h" #include "modules/modules_enabled.gen.h" // For mono and svg. diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp index 418f38c127a..6cdd370bfef 100644 --- a/platform/windows/export/export_plugin.cpp +++ b/platform/windows/export/export_plugin.cpp @@ -37,9 +37,9 @@ #include "core/io/image_loader.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_string_names.h" #include "editor/export/editor_export.h" +#include "editor/themes/editor_scale.h" #include "modules/modules_enabled.gen.h" // For svg. #ifdef MODULE_SVG_ENABLED diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index a0e7e4cf253..282d14da5d5 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -34,7 +34,7 @@ #include "scene/main/timer.h" #ifdef TOOLS_ENABLED -#include "editor/editor_scale.h" +#include "editor/themes/editor_scale.h" #endif #ifdef TOOLS_ENABLED diff --git a/scene/theme/default_theme.cpp b/scene/theme/default_theme.cpp index 2a1894e690f..005a88d3917 100644 --- a/scene/theme/default_theme.cpp +++ b/scene/theme/default_theme.cpp @@ -78,7 +78,7 @@ static Ref sb_expand(Ref p_sbox, float p_left, float return p_sbox; } -// See also `editor_generate_icon()` in `editor/editor_themes.cpp`. +// See also `editor_generate_icon()` in `editor/themes/editor_icons.cpp`. static Ref generate_icon(int p_index) { Ref img = memnew(Image); diff --git a/scene/theme/default_theme_builders.py b/scene/theme/default_theme_builders.py index 0455d6d2466..b8bb579d1c3 100644 --- a/scene/theme/default_theme_builders.py +++ b/scene/theme/default_theme_builders.py @@ -1,8 +1,10 @@ -"""Functions used to generate source files during build time +""" +Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. """ + import os import os.path from platform_methods import subprocess_main diff --git a/scene/theme/icons/default_theme_icons_builders.py b/scene/theme/icons/default_theme_icons_builders.py index c4d132294c5..c915c52cbdc 100644 --- a/scene/theme/icons/default_theme_icons_builders.py +++ b/scene/theme/icons/default_theme_icons_builders.py @@ -1,4 +1,5 @@ -"""Functions used to generate source files during build time +""" +Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/tests/servers/test_text_server.h b/tests/servers/test_text_server.h index 0f23929e1e0..334c642d26d 100644 --- a/tests/servers/test_text_server.h +++ b/tests/servers/test_text_server.h @@ -33,7 +33,7 @@ #ifdef TOOLS_ENABLED -#include "editor/builtin_fonts.gen.h" +#include "editor/themes/builtin_fonts.gen.h" #include "servers/text_server.h" #include "tests/test_macros.h"