diff options
-rw-r--r-- | editor/code_editor.cpp | 108 | ||||
-rw-r--r-- | editor/editor_fonts.cpp | 61 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 9 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.h | 2 | ||||
-rw-r--r-- | editor/import/scene_import_settings.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 10 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.h | 1 | ||||
-rw-r--r-- | platform/android/detect.py | 8 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 4 |
10 files changed, 121 insertions, 96 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 73059464be..a1979c7619 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1638,37 +1638,34 @@ void CodeTextEditor::_apply_settings_change() { font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); int ot_mode = EditorSettings::get_singleton()->get("interface/editor/code_font_contextual_ligatures"); - Ref<Font> fb = text_editor->get_theme_font(SNAME("font")); - Ref<FontVariation> fc = fb; - if (fc.is_null()) { - fc.instantiate(); - fc->set_base_font(fb); - } - - switch (ot_mode) { - case 1: { // Disable ligatures. - fc->set_opentype_features(Dictionary()); - } break; - case 2: { // Custom. - Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(","); - Dictionary ftrs; - for (int i = 0; i < subtag.size(); i++) { - Vector<String> subtag_a = subtag[i].split("="); - if (subtag_a.size() == 2) { - ftrs[TS->name_to_tag(subtag_a[0])] = subtag_a[1].to_int(); - } else if (subtag_a.size() == 1) { - ftrs[TS->name_to_tag(subtag_a[0])] = 1; + Ref<FontVariation> fc = text_editor->get_theme_font(SNAME("font")); + if (fc.is_valid()) { + switch (ot_mode) { + case 1: { // Disable ligatures. + Dictionary ftrs; + ftrs[TS->name_to_tag("calt")] = 0; + fc->set_opentype_features(ftrs); + } break; + case 2: { // Custom. + Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(","); + Dictionary ftrs; + for (int i = 0; i < subtag.size(); i++) { + Vector<String> subtag_a = subtag[i].split("="); + if (subtag_a.size() == 2) { + ftrs[TS->name_to_tag(subtag_a[0])] = subtag_a[1].to_int(); + } else if (subtag_a.size() == 1) { + ftrs[TS->name_to_tag(subtag_a[0])] = 1; + } } - } - fc->set_opentype_features(ftrs); - } break; - default: { // Default. - Dictionary ftrs; - ftrs[TS->name_to_tag("calt")] = 1; - fc->set_opentype_features(ftrs); - } break; + fc->set_opentype_features(ftrs); + } break; + default: { // Default. + Dictionary ftrs; + ftrs[TS->name_to_tag("calt")] = 1; + fc->set_opentype_features(ftrs); + } break; + } } - text_editor->add_theme_font_override("font", fc); text_editor->set_code_hint_draw_below(EDITOR_GET("text_editor/completion/put_callhint_tooltip_below_current_line")); @@ -1870,34 +1867,33 @@ CodeTextEditor::CodeTextEditor() { text_editor->set_v_size_flags(SIZE_EXPAND_FILL); int ot_mode = EditorSettings::get_singleton()->get("interface/editor/code_font_contextual_ligatures"); - Ref<Font> fb = text_editor->get_theme_font(SNAME("font")); - Ref<FontVariation> fc = fb; - if (fc.is_null()) { - fc.instantiate(); - fc->set_base_font(fb); - } - switch (ot_mode) { - case 1: { // Disable ligatures. - fc->set_opentype_features(Dictionary()); - } break; - case 2: { // Custom. - Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(","); - Dictionary ftrs; - for (int i = 0; i < subtag.size(); i++) { - Vector<String> subtag_a = subtag[i].split("="); - if (subtag_a.size() == 2) { - ftrs[TS->name_to_tag(subtag_a[0])] = subtag_a[1].to_int(); - } else if (subtag_a.size() == 1) { - ftrs[TS->name_to_tag(subtag_a[0])] = 1; + Ref<FontVariation> fc = text_editor->get_theme_font(SNAME("font")); + if (fc.is_valid()) { + switch (ot_mode) { + case 1: { // Disable ligatures. + Dictionary ftrs; + ftrs[TS->name_to_tag("calt")] = 0; + fc->set_opentype_features(ftrs); + } break; + case 2: { // Custom. + Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(","); + Dictionary ftrs; + for (int i = 0; i < subtag.size(); i++) { + Vector<String> subtag_a = subtag[i].split("="); + if (subtag_a.size() == 2) { + ftrs[TS->name_to_tag(subtag_a[0])] = subtag_a[1].to_int(); + } else if (subtag_a.size() == 1) { + ftrs[TS->name_to_tag(subtag_a[0])] = 1; + } } - } - fc->set_opentype_features(ftrs); - } break; - default: { // Default. - Dictionary ftrs; - ftrs[TS->name_to_tag("calt")] = 1; - fc->set_opentype_features(ftrs); - } break; + fc->set_opentype_features(ftrs); + } break; + default: { // Default. + Dictionary ftrs; + ftrs[TS->name_to_tag("calt")] = 1; + fc->set_opentype_features(ftrs); + } break; + } } text_editor->add_theme_font_override("font", fc); diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index 8deee57dc9..d58dc98f07 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -164,11 +164,6 @@ void editor_register_fonts(Ref<Theme> p_theme) { default_font_bold_msdf->set_fallbacks(fallbacks_bold); Ref<FontFile> default_font_mono = load_internal_font(_font_JetBrainsMono_Regular, _font_JetBrainsMono_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning); - { - Dictionary opentype_features_mono; - opentype_features_mono["calt"] = 0; - default_font_mono->set_opentype_feature_overrides(opentype_features_mono); // Disable contextual alternates (coding ligatures). - } default_font_mono->set_fallbacks(fallbacks); // Init base font configs and load custom fonts. @@ -276,23 +271,45 @@ void editor_register_fonts(Ref<Theme> p_theme) { EditorSettings::get_singleton()->set_manually("interface/editor/code_font", ""); mono_fc->set_base_font(default_font_mono); } + mono_fc->set_spacing(TextServer::SPACING_TOP, -EDSCALE); + mono_fc->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE); - String code_font_custom_variations = EditorSettings::get_singleton()->get("interface/editor/code_font_custom_variations"); - Dictionary variations_mono; - if (!code_font_custom_variations.is_empty()) { - Vector<String> variation_tags = code_font_custom_variations.split(","); - for (int i = 0; i < variation_tags.size(); i++) { - Vector<String> subtag_a = variation_tags[i].split("="); - if (subtag_a.size() == 2) { - variations_mono[TS->name_to_tag(subtag_a[0])] = subtag_a[1].to_float(); - } else if (subtag_a.size() == 1) { - variations_mono[TS->name_to_tag(subtag_a[0])] = 1; + Ref<FontVariation> mono_other_fc = mono_fc->duplicate(); + + // Enable contextual alternates (coding ligatures) and custom features for the source editor font. + int ot_mode = EditorSettings::get_singleton()->get("interface/editor/code_font_contextual_ligatures"); + switch (ot_mode) { + case 1: { // Disable ligatures. + Dictionary ftrs; + ftrs[TS->name_to_tag("calt")] = 0; + mono_fc->set_opentype_features(ftrs); + } break; + case 2: { // Custom. + Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(","); + Dictionary ftrs; + for (int i = 0; i < subtag.size(); i++) { + Vector<String> subtag_a = subtag[i].split("="); + if (subtag_a.size() == 2) { + ftrs[TS->name_to_tag(subtag_a[0])] = subtag_a[1].to_int(); + } else if (subtag_a.size() == 1) { + ftrs[TS->name_to_tag(subtag_a[0])] = 1; + } } - } - mono_fc->set_variation_opentype(variations_mono); + mono_fc->set_opentype_features(ftrs); + } break; + default: { // Default. + Dictionary ftrs; + ftrs[TS->name_to_tag("calt")] = 1; + mono_fc->set_opentype_features(ftrs); + } break; + } + + { + // Disable contextual alternates (coding ligatures). + Dictionary ftrs; + ftrs[TS->name_to_tag("calt")] = 0; + mono_other_fc->set_opentype_features(ftrs); } - mono_fc->set_spacing(TextServer::SPACING_TOP, -EDSCALE); - mono_fc->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE); Ref<FontVariation> italic_fc = default_fc->duplicate(); italic_fc->set_variation_transform(Transform2D(1.0, 0.2, 0.0, 1.0, 0.0, 0.0)); @@ -359,11 +376,11 @@ void editor_register_fonts(Ref<Theme> p_theme) { p_theme->set_font("source", "EditorFonts", mono_fc); p_theme->set_font_size("expression_size", "EditorFonts", (int(EDITOR_GET("interface/editor/code_font_size")) - 1) * EDSCALE); - p_theme->set_font("expression", "EditorFonts", mono_fc); + p_theme->set_font("expression", "EditorFonts", mono_other_fc); p_theme->set_font_size("output_source_size", "EditorFonts", int(EDITOR_GET("run/output/font_size")) * EDSCALE); - p_theme->set_font("output_source", "EditorFonts", mono_fc); + p_theme->set_font("output_source", "EditorFonts", mono_other_fc); p_theme->set_font_size("status_source_size", "EditorFonts", default_font_size); - p_theme->set_font("status_source", "EditorFonts", mono_fc); + p_theme->set_font("status_source", "EditorFonts", mono_other_fc); } diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index a5920ef98d..860269bfcb 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1972,7 +1972,7 @@ void ResourceImporterScene::_optimize_track_usage(AnimationPlayer *p_player, Ani } } -Node *ResourceImporterScene::pre_import(const String &p_source_file) { +Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashMap<StringName, Variant> &p_options) { Ref<EditorSceneFormatImporter> importer; String ext = p_source_file.get_extension().to_lower(); @@ -1997,8 +1997,13 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file) { ERR_FAIL_COND_V(!importer.is_valid(), nullptr); + int bake_fps = 30; + if (p_options.has(SNAME("animation/fps"))) { + bake_fps = p_options[SNAME("animation/fps")]; + } + Error err = OK; - Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, HashMap<StringName, Variant>(), 15, nullptr, &err); + Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, p_options, bake_fps, nullptr, &err); if (!scene || err != OK) { return nullptr; } diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index c143e86bd4..b77c1dccb4 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -281,7 +281,7 @@ public: void _optimize_animations(AnimationPlayer *anim, float p_max_lin_error, float p_max_ang_error, float p_max_angle); void _compress_animations(AnimationPlayer *anim, int p_page_size_kb); - Node *pre_import(const String &p_source_file); + Node *pre_import(const String &p_source_file, const HashMap<StringName, Variant> &p_options); virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) override; virtual bool has_advanced_options() const override; diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index 8ae05f046e..b682407307 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -542,12 +542,6 @@ void SceneImportSettings::open_settings(const String &p_path, bool p_for_animati scene_import_settings_data->settings = nullptr; scene_import_settings_data->path = p_path; - scene = ResourceImporterScene::get_scene_singleton()->pre_import(p_path); // Use the scene singleton here because we want to see the full thing. - if (scene == nullptr) { - EditorNode::get_singleton()->show_warning(TTR("Error opening scene")); - return; - } - // Visibility data_mode->set_tab_hidden(1, p_for_animation); data_mode->set_tab_hidden(2, p_for_animation); @@ -593,6 +587,12 @@ void SceneImportSettings::open_settings(const String &p_path, bool p_for_animati } } + scene = ResourceImporterScene::get_scene_singleton()->pre_import(p_path, defaults); // Use the scene singleton here because we want to see the full thing. + if (scene == nullptr) { + EditorNode::get_singleton()->show_warning(TTR("Error opening scene")); + return; + } + first_aabb = true; _update_scene(); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 9ff32203f7..7e525a4698 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3697,7 +3697,7 @@ void CanvasItemEditor::_draw_transform_message() { return; } - Ref<FontFile> font = get_theme_font(SNAME("font"), SNAME("Label")); + Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label")); int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); Point2 msgpos = Point2(RULER_WIDTH + 5 * EDSCALE, viewport->get_size().y - 20 * EDSCALE); viewport->draw_string(font, msgpos + Point2(1, 1), transform_message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 4ee774c3bd..7cc195201b 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -990,6 +990,10 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) { p_output.append("\n" INDENT1 OPEN_BLOCK); } + if (ienum.is_flags) { + p_output.append("\n" INDENT1 "[System.Flags]"); + } + p_output.append("\n" INDENT1 "public enum "); p_output.append(enum_proxy_name); p_output.append(" : long"); @@ -1434,6 +1438,10 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str for (const EnumInterface &ienum : itype.enums) { ERR_FAIL_COND_V(ienum.constants.is_empty(), ERR_BUG); + if (ienum.is_flags) { + output.append(MEMBER_BEGIN "[System.Flags]"); + } + output.append(MEMBER_BEGIN "public enum "); output.append(ienum.cname.operator String()); output.append(" : long"); @@ -3087,6 +3095,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { enum_proxy_cname = StringName(enum_proxy_name); } EnumInterface ienum(enum_proxy_cname); + ienum.is_flags = E.value.is_bitfield; const List<StringName> &enum_constants = E.value.constants; for (const StringName &constant_cname : enum_constants) { String constant_name = constant_cname.operator String(); @@ -3676,6 +3685,7 @@ void BindingsGenerator::_populate_global_constants() { if (enum_name != StringName()) { EnumInterface ienum(enum_name); + // TODO: ienum.is_flags is always false for core constants since they don't seem to support bitfield enums List<EnumInterface>::Element *enum_match = global_enums.find(ienum); if (enum_match) { enum_match->get().constants.push_back(iconstant); diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index 70c4f12146..1547d0ed2f 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -60,6 +60,7 @@ class BindingsGenerator { struct EnumInterface { StringName cname; List<ConstantInterface> constants; + bool is_flags = false; _FORCE_INLINE_ bool operator==(const EnumInterface &p_ienum) const { return p_ienum.cname == cname; diff --git a/platform/android/detect.py b/platform/android/detect.py index 47cfade765..2ff5bf59ea 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -96,22 +96,19 @@ def configure(env): if env["android_arch"] == "armv7": target_triple = "armv7a-linux-androideabi" - bin_utils = "arm-linux-androideabi" env.extra_suffix = ".armv7" + env.extra_suffix elif env["android_arch"] == "arm64v8": target_triple = "aarch64-linux-android" - bin_utils = target_triple env.extra_suffix = ".armv8" + env.extra_suffix elif env["android_arch"] == "x86": target_triple = "i686-linux-android" - bin_utils = target_triple env.extra_suffix = ".x86" + env.extra_suffix elif env["android_arch"] == "x86_64": target_triple = "x86_64-linux-android" - bin_utils = target_triple env.extra_suffix = ".x86_64" + env.extra_suffix target_option = ["-target", target_triple + str(get_min_sdk_version(env["ndk_platform"]))] + env.Append(ASFLAGS=[target_option, "-c"]) env.Append(CCFLAGS=target_option) env.Append(LINKFLAGS=target_option) @@ -152,13 +149,12 @@ def configure(env): toolchain_path = ndk_root + "/toolchains/llvm/prebuilt/" + host_subpath compiler_path = toolchain_path + "/bin" - bin_utils_path = toolchain_path + "/" + bin_utils + "/bin" env["CC"] = compiler_path + "/clang" env["CXX"] = compiler_path + "/clang++" env["AR"] = compiler_path + "/llvm-ar" env["RANLIB"] = compiler_path + "/llvm-ranlib" - env["AS"] = bin_utils_path + "/as" + env["AS"] = compiler_path + "/clang" # Disable exceptions and rtti on non-tools (template) builds if env["tools"]: diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 2441279797..05824d54f1 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2081,7 +2081,7 @@ Ref<Font> RichTextLabel::_find_font(Item *p_item) { fontitem = fontitem->parent; } - return Ref<FontFile>(); + return Ref<Font>(); } int RichTextLabel::_find_font_size(Item *p_item) { @@ -4002,7 +4002,7 @@ void RichTextLabel::append_text(const String &p_bbcode) { if (subtag_a.size() == 2) { if (subtag_a[0] == "name" || subtag_a[0] == "n") { String fnt = subtag_a[1]; - Ref<Font> font_data = ResourceLoader::load(fnt, "FontFile"); + Ref<Font> font_data = ResourceLoader::load(fnt, "Font"); if (font_data.is_valid()) { fc->set_base_font(font_data); } |