diff options
author | lawnjelly <lawnjelly@gmail.com> | 2023-05-17 16:22:26 +0100 |
---|---|---|
committer | lawnjelly <lawnjelly@gmail.com> | 2023-06-06 15:36:51 +0100 |
commit | b69c8b47916e4b3511c1aeff254ebfa6deef37ba (patch) | |
tree | 121f1601353f788375749abd834bfb5515afa843 /editor | |
parent | 543750a1b3f5696f9ba8e91cb49dc7db05d2ae62 (diff) | |
download | redot-engine-b69c8b47916e4b3511c1aeff254ebfa6deef37ba.tar.gz |
Single Compilation Unit build.
Adds support for simple SCU build (DEV_ENABLED only).
This speeds up compilation by compiling multiple cpp files within a single translation unit.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/SCsub | 5 | ||||
-rw-r--r-- | editor/editor_about.cpp | 2 | ||||
-rw-r--r-- | editor/editor_about.h | 2 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 8 | ||||
-rw-r--r-- | editor/editor_inspector.h | 1 | ||||
-rw-r--r-- | editor/editor_node.cpp | 16 | ||||
-rw-r--r-- | editor/editor_quick_open.cpp | 4 | ||||
-rw-r--r-- | editor/editor_quick_open.h | 3 | ||||
-rw-r--r-- | editor/editor_scale.cpp | 12 | ||||
-rw-r--r-- | editor/editor_scale.h | 11 | ||||
-rw-r--r-- | editor/plugins/text_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/text_editor.h | 2 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/project_manager.cpp | 16 |
14 files changed, 49 insertions, 39 deletions
diff --git a/editor/SCsub b/editor/SCsub index 20bfa78c72..b1a47dae45 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -29,9 +29,8 @@ if env.editor_build: reg_exporters_inc = '#include "register_exporters.h"\n\n' reg_exporters = "void register_exporters() {\n" for e in env.platform_exporters: - # Glob all .cpp files in export folder - files = Glob("#platform/" + e + "/export/" + "*.cpp") - env.add_source_files(env.editor_sources, files) + # Add all .cpp files in export folder + env.add_source_files(env.editor_sources, "../platform/" + e + "/export/" + "*.cpp") reg_exporters += "\tregister_" + e + "_exporter();\n" reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n' diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 25bca2a099..a4147acade 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -36,7 +36,7 @@ #include "core/version.h" // The metadata key used to store and retrieve the version text to copy to the clipboard. -static const String META_TEXT_TO_COPY = "text_to_copy"; +const String EditorAbout::META_TEXT_TO_COPY = "text_to_copy"; void EditorAbout::_theme_changed() { const Ref<Font> font = get_theme_font(SNAME("source"), SNAME("EditorFonts")); diff --git a/editor/editor_about.h b/editor/editor_about.h index a49887c260..0bc863e3c1 100644 --- a/editor/editor_about.h +++ b/editor/editor_about.h @@ -51,6 +51,8 @@ class EditorAbout : public AcceptDialog { GDCLASS(EditorAbout, AcceptDialog); + static const String META_TEXT_TO_COPY; + private: void _license_tree_selected(); void _version_button_pressed(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index c138637fc9..3f6db778c5 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -46,14 +46,14 @@ #include "scene/property_utils.h" #include "scene/resources/packed_scene.h" -static bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style) { +bool EditorInspector::_property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style) { if (p_property_path.findn(p_filter) != -1) { return true; } - const Vector<String> sections = p_property_path.split("/"); - for (int i = 0; i < sections.size(); i++) { - if (p_filter.is_subsequence_ofn(EditorPropertyNameProcessor::get_singleton()->process_name(sections[i], p_style))) { + const Vector<String> prop_sections = p_property_path.split("/"); + for (int i = 0; i < prop_sections.size(); i++) { + if (p_filter.is_subsequence_ofn(EditorPropertyNameProcessor::get_singleton()->process_name(prop_sections[i], p_style))) { return true; } } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 1ce31e59ac..a5737b7dc6 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -512,6 +512,7 @@ class EditorInspector : public ScrollContainer { void _property_deleted(const String &p_path); void _property_checked(const String &p_path, bool p_checked); void _property_pinned(const String &p_path, bool p_pinned); + bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style); void _resource_selected(const String &p_path, Ref<Resource> p_resource); void _property_selected(const String &p_path, int p_focusable); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4cf48a41b0..e0863a5e56 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6760,28 +6760,28 @@ EditorNode::EditorNode() { switch (display_scale) { case 0: // Try applying a suitable display scale automatically. - editor_set_scale(EditorSettings::get_singleton()->get_auto_display_scale()); + EditorScale::set_scale(EditorSettings::get_singleton()->get_auto_display_scale()); break; case 1: - editor_set_scale(0.75); + EditorScale::set_scale(0.75); break; case 2: - editor_set_scale(1.0); + EditorScale::set_scale(1.0); break; case 3: - editor_set_scale(1.25); + EditorScale::set_scale(1.25); break; case 4: - editor_set_scale(1.5); + EditorScale::set_scale(1.5); break; case 5: - editor_set_scale(1.75); + EditorScale::set_scale(1.75); break; case 6: - editor_set_scale(2.0); + EditorScale::set_scale(2.0); break; default: - editor_set_scale(EDITOR_GET("interface/editor/custom_display_scale")); + EditorScale::set_scale(EDITOR_GET("interface/editor/custom_display_scale")); break; } } diff --git a/editor/editor_quick_open.cpp b/editor/editor_quick_open.cpp index c7c41a6ed0..f75ab875e4 100644 --- a/editor/editor_quick_open.cpp +++ b/editor/editor_quick_open.cpp @@ -34,8 +34,8 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" -static Rect2i prev_rect = Rect2i(); -static bool was_showed = false; +Rect2i EditorQuickOpen::prev_rect = Rect2i(); +bool EditorQuickOpen::was_showed = false; void EditorQuickOpen::popup_dialog(const String &p_base, bool p_enable_multi, bool p_dont_clear) { base_type = p_base; diff --git a/editor/editor_quick_open.h b/editor/editor_quick_open.h index 4b63a226c2..2b64efb151 100644 --- a/editor/editor_quick_open.h +++ b/editor/editor_quick_open.h @@ -39,6 +39,9 @@ class EditorQuickOpen : public ConfirmationDialog { GDCLASS(EditorQuickOpen, ConfirmationDialog); + static Rect2i prev_rect; + static bool was_showed; + LineEdit *search_box = nullptr; Tree *search_options = nullptr; String base_type; diff --git a/editor/editor_scale.cpp b/editor/editor_scale.cpp index 45ea9a4d5b..0670e98e2c 100644 --- a/editor/editor_scale.cpp +++ b/editor/editor_scale.cpp @@ -30,14 +30,12 @@ #include "editor_scale.h" -#include "core/os/os.h" +float EditorScale::_scale = 1.0f; -static float scale = 1.0; - -void editor_set_scale(float p_scale) { - scale = p_scale; +void EditorScale::set_scale(float p_scale) { + _scale = p_scale; } -float editor_get_scale() { - return scale; +float EditorScale::get_scale() { + return _scale; } diff --git a/editor/editor_scale.h b/editor/editor_scale.h index 0183625610..b3583fdcee 100644 --- a/editor/editor_scale.h +++ b/editor/editor_scale.h @@ -31,9 +31,14 @@ #ifndef EDITOR_SCALE_H #define EDITOR_SCALE_H -void editor_set_scale(float p_scale); -float editor_get_scale(); +class EditorScale { + static float _scale; -#define EDSCALE (editor_get_scale()) +public: + static void set_scale(float p_scale); + static float get_scale(); +}; + +#define EDSCALE (EditorScale::get_scale()) #endif // EDITOR_SCALE_H diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 7a76e4f989..92ee468bc2 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -481,7 +481,7 @@ void TextEditor::_convert_case(CodeTextEditor::CaseStyle p_case) { code_editor->convert_case(p_case); } -static ScriptEditorBase *create_editor(const Ref<Resource> &p_resource) { +ScriptEditorBase *TextEditor::create_editor(const Ref<Resource> &p_resource) { if (Object::cast_to<TextFile>(*p_resource) || Object::cast_to<JSON>(*p_resource)) { return memnew(TextEditor); } diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index 0c218e9e0c..d1aa2a9047 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -38,6 +38,8 @@ class TextEditor : public ScriptEditorBase { GDCLASS(TextEditor, ScriptEditorBase); + static ScriptEditorBase *create_editor(const Ref<Resource> &p_resource); + private: CodeTextEditor *code_editor = nullptr; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index d631958ce9..8fbbd81e1d 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -4982,7 +4982,7 @@ void VisualShaderEditor::_preview_size_changed() { preview_vbox->set_custom_minimum_size(preview_window->get_size()); } -static ShaderLanguage::DataType _get_global_shader_uniform_type(const StringName &p_variable) { +static ShaderLanguage::DataType _visual_shader_editor_get_global_shader_uniform_type(const StringName &p_variable) { RS::GlobalShaderParameterType gvt = RS::get_singleton()->global_shader_parameter_get_type(p_variable); return (ShaderLanguage::DataType)RS::global_shader_uniform_type_get_shader_datatype(gvt); } @@ -5001,7 +5001,7 @@ void VisualShaderEditor::_update_preview() { info.functions = ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(visual_shader->get_mode())); info.render_modes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(visual_shader->get_mode())); info.shader_types = ShaderTypes::get_singleton()->get_types(); - info.global_shader_uniform_type_func = _get_global_shader_uniform_type; + info.global_shader_uniform_type_func = _visual_shader_editor_get_global_shader_uniform_type; ShaderLanguage sl; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 994fc8c8e9..5380d106d3 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2763,28 +2763,28 @@ ProjectManager::ProjectManager() { switch (display_scale) { case 0: // Try applying a suitable display scale automatically. - editor_set_scale(EditorSettings::get_singleton()->get_auto_display_scale()); + EditorScale::set_scale(EditorSettings::get_singleton()->get_auto_display_scale()); break; case 1: - editor_set_scale(0.75); + EditorScale::set_scale(0.75); break; case 2: - editor_set_scale(1.0); + EditorScale::set_scale(1.0); break; case 3: - editor_set_scale(1.25); + EditorScale::set_scale(1.25); break; case 4: - editor_set_scale(1.5); + EditorScale::set_scale(1.5); break; case 5: - editor_set_scale(1.75); + EditorScale::set_scale(1.75); break; case 6: - editor_set_scale(2.0); + EditorScale::set_scale(2.0); break; default: - editor_set_scale(EDITOR_GET("interface/editor/custom_display_scale")); + EditorScale::set_scale(EDITOR_GET("interface/editor/custom_display_scale")); break; } EditorFileDialog::get_icon_func = &ProjectManager::_file_dialog_get_icon; |