diff options
Diffstat (limited to 'modules')
21 files changed, 154 insertions, 104 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 6294790132..3932c2377f 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -1852,13 +1852,13 @@ CSGBrush *CSGPolygon3D::_build_brush() { base_xform = path->get_global_transform(); } - Vector3 current_point = curve->interpolate_baked(0); - Vector3 next_point = curve->interpolate_baked(extrusion_step); + Vector3 current_point = curve->sample_baked(0); + Vector3 next_point = curve->sample_baked(extrusion_step); Vector3 current_up = Vector3(0, 1, 0); Vector3 direction = next_point - current_point; if (path_joined) { - Vector3 last_point = curve->interpolate_baked(curve->get_baked_length()); + Vector3 last_point = curve->sample_baked(curve->get_baked_length()); direction = next_point - last_point; } @@ -1869,7 +1869,7 @@ CSGBrush *CSGPolygon3D::_build_brush() { case PATH_ROTATION_PATH: break; case PATH_ROTATION_PATH_FOLLOW: - current_up = curve->interpolate_baked_up_vector(0); + current_up = curve->sample_baked_up_vector(0); break; } @@ -1931,9 +1931,9 @@ CSGBrush *CSGPolygon3D::_build_brush() { } } - Vector3 previous_point = curve->interpolate_baked(previous_offset); - Vector3 current_point = curve->interpolate_baked(current_offset); - Vector3 next_point = curve->interpolate_baked(next_offset); + Vector3 previous_point = curve->sample_baked(previous_offset); + Vector3 current_point = curve->sample_baked(current_offset); + Vector3 next_point = curve->sample_baked(next_offset); Vector3 current_up = Vector3(0, 1, 0); Vector3 direction = next_point - previous_point; Vector3 current_dir = (current_point - previous_point).normalized(); @@ -1956,7 +1956,7 @@ CSGBrush *CSGPolygon3D::_build_brush() { case PATH_ROTATION_PATH: break; case PATH_ROTATION_PATH_FOLLOW: - current_up = curve->interpolate_baked_up_vector(current_offset); + current_up = curve->sample_baked_up_vector(current_offset); break; } diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index 02922086f0..afb59b486c 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -318,8 +318,18 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l Color col = Color(); if (global_functions.has(word)) { // "assert" and "preload" are reserved, so highlight even if not followed by a bracket. - if (word == "assert" || word == "preload" || str[to] == '(') { + if (word == "assert" || word == "preload") { col = global_function_color; + } else { + // For other global functions, check if followed by bracket. + int k = to; + while (k < line_length && is_whitespace(str[k])) { + k++; + } + + if (str[k] == '(') { + col = global_function_color; + } } } else if (keywords.has(word)) { col = keywords[word]; @@ -668,14 +678,14 @@ void GDScriptSyntaxHighlighter::_update_cache() { if (godot_2_theme || EditorSettings::get_singleton()->is_dark_theme()) { function_definition_color = Color(0.4, 0.9, 1.0); - global_function_color = Color(0.6, 0.6, 0.9); + global_function_color = Color(0.64, 0.64, 0.96); node_path_color = Color(0.72, 0.77, 0.49); node_ref_color = Color(0.39, 0.76, 0.35); annotation_color = Color(1.0, 0.7, 0.45); string_name_color = Color(1.0, 0.76, 0.65); } else { function_definition_color = Color(0, 0.6, 0.6); - global_function_color = Color(0.4, 0.2, 0.8); + global_function_color = Color(0.36, 0.18, 0.72); node_path_color = Color(0.18, 0.55, 0); node_ref_color = Color(0.0, 0.5, 0); annotation_color = Color(0.8, 0.37, 0); diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index c8c876369f..e37ac1dc3b 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -2726,6 +2726,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod result.builtin_type = Variant::INT; result.native_type = base.native_type; result.enum_type = base.enum_type; + result.enum_values = base.enum_values; p_identifier->set_datatype(result); return; } else { diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index c18412bc63..4c908166df 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2031,8 +2031,13 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context, r_type.type.kind = GDScriptParser::DataType::NATIVE; r_type.type.native_type = p_identifier; r_type.type.is_constant = true; - r_type.type.is_meta_type = !Engine::get_singleton()->has_singleton(p_identifier); - r_type.value = Variant(); + if (Engine::get_singleton()->has_singleton(p_identifier)) { + r_type.type.is_meta_type = false; + r_type.value = Engine::get_singleton()->get_singleton_object(p_identifier); + } else { + r_type.type.is_meta_type = true; + r_type.value = Variant(); + } } return false; diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp index fd213e7b37..16461b0a6c 100644 --- a/modules/gdscript/language_server/gdscript_workspace.cpp +++ b/modules/gdscript/language_server/gdscript_workspace.cpp @@ -499,9 +499,9 @@ Error GDScriptWorkspace::parse_local_script(const String &p_path) { } String GDScriptWorkspace::get_file_path(const String &p_uri) const { - String path = p_uri; - path = path.uri_decode(); - path = path.replacen(root_uri + "/", "res://"); + String path = p_uri.uri_decode(); + String base_uri = root_uri.uri_decode(); + path = path.replacen(base_uri + "/", "res://"); return path; } diff --git a/modules/gdscript/tests/scripts/analyzer/features/property_inline.out b/modules/gdscript/tests/scripts/analyzer/features/property_inline.out index 5482592e90..63e59398ae 100644 --- a/modules/gdscript/tests/scripts/analyzer/features/property_inline.out +++ b/modules/gdscript/tests/scripts/analyzer/features/property_inline.out @@ -1,5 +1,5 @@ GDTEST_OK -null +<null> 0 1 2 diff --git a/modules/gdscript/tests/scripts/parser/features/function_many_parameters.out b/modules/gdscript/tests/scripts/parser/features/function_many_parameters.out index 3a979227d4..80df7a3d4c 100644 --- a/modules/gdscript/tests/scripts/parser/features/function_many_parameters.out +++ b/modules/gdscript/tests/scripts/parser/features/function_many_parameters.out @@ -1,2 +1,2 @@ GDTEST_OK -123456789101112131415161718192212223242526272829303132333435363738394041424344454647falsetruenull +123456789101112131415161718192212223242526272829303132333435363738394041424344454647falsetrue<null> diff --git a/modules/gdscript/tests/scripts/parser/features/str_preserves_case.out b/modules/gdscript/tests/scripts/parser/features/str_preserves_case.out index abba38e87c..867f45f0ac 100644 --- a/modules/gdscript/tests/scripts/parser/features/str_preserves_case.out +++ b/modules/gdscript/tests/scripts/parser/features/str_preserves_case.out @@ -1,4 +1,4 @@ GDTEST_OK -null +<null> true false diff --git a/modules/lightmapper_rd/lightmapper_rd.cpp b/modules/lightmapper_rd/lightmapper_rd.cpp index 2dcf644a06..5b039e65c0 100644 --- a/modules/lightmapper_rd/lightmapper_rd.cpp +++ b/modules/lightmapper_rd/lightmapper_rd.cpp @@ -670,7 +670,7 @@ LightmapperRD::BakeError LightmapperRD::_dilate(RenderingDevice *rd, Ref<RDShade return BAKE_OK; } -LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_denoiser, int p_bounces, float p_bias, int p_max_texture_size, bool p_bake_sh, GenerateProbes p_generate_probes, const Ref<Image> &p_environment_panorama, const Basis &p_environment_transform, BakeStepFunc p_step_function, void *p_bake_userdata) { +LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_denoiser, int p_bounces, float p_bias, int p_max_texture_size, bool p_bake_sh, GenerateProbes p_generate_probes, const Ref<Image> &p_environment_panorama, const Basis &p_environment_transform, BakeStepFunc p_step_function, void *p_bake_userdata, float p_exposure_normalization) { if (p_step_function) { p_step_function(0.0, RTR("Begin Bake"), p_bake_userdata, true); } @@ -1165,6 +1165,8 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d rd->compute_list_bind_uniform_set(compute_list, compute_base_uniform_set, 0); rd->compute_list_bind_uniform_set(compute_list, light_uniform_set, 1); + push_constant.environment_xform[11] = p_exposure_normalization; + for (int i = 0; i < atlas_slices; i++) { push_constant.atlas_slice = i; rd->compute_list_set_push_constant(compute_list, &push_constant, sizeof(PushConstant)); @@ -1172,6 +1174,8 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d //no barrier, let them run all together } rd->compute_list_end(); //done + + push_constant.environment_xform[11] = 0.0; } #ifdef DEBUG_TEXTURES diff --git a/modules/lightmapper_rd/lightmapper_rd.h b/modules/lightmapper_rd/lightmapper_rd.h index bf6b4399ca..b33a475dbc 100644 --- a/modules/lightmapper_rd/lightmapper_rd.h +++ b/modules/lightmapper_rd/lightmapper_rd.h @@ -241,7 +241,7 @@ public: virtual void add_omni_light(bool p_static, const Vector3 &p_position, const Color &p_color, float p_energy, float p_range, float p_attenuation, float p_size, float p_shadow_blur) override; virtual void add_spot_light(bool p_static, const Vector3 &p_position, const Vector3 p_direction, const Color &p_color, float p_energy, float p_range, float p_attenuation, float p_spot_angle, float p_spot_attenuation, float p_size, float p_shadow_blur) override; virtual void add_probe(const Vector3 &p_position) override; - virtual BakeError bake(BakeQuality p_quality, bool p_use_denoiser, int p_bounces, float p_bias, int p_max_texture_size, bool p_bake_sh, GenerateProbes p_generate_probes, const Ref<Image> &p_environment_panorama, const Basis &p_environment_transform, BakeStepFunc p_step_function = nullptr, void *p_bake_userdata = nullptr) override; + virtual BakeError bake(BakeQuality p_quality, bool p_use_denoiser, int p_bounces, float p_bias, int p_max_texture_size, bool p_bake_sh, GenerateProbes p_generate_probes, const Ref<Image> &p_environment_panorama, const Basis &p_environment_transform, BakeStepFunc p_step_function = nullptr, void *p_bake_userdata = nullptr, float p_exposure_normalization = 1.0) override; int get_bake_texture_count() const override; Ref<Image> get_bake_texture(int p_index) const override; diff --git a/modules/lightmapper_rd/lm_compute.glsl b/modules/lightmapper_rd/lm_compute.glsl index efa6cd50b4..c2557dfed3 100644 --- a/modules/lightmapper_rd/lm_compute.glsl +++ b/modules/lightmapper_rd/lm_compute.glsl @@ -434,6 +434,7 @@ void main() { imageStore(primary_dynamic, ivec3(atlas_pos, params.atlas_slice), vec4(dynamic_light, 1.0)); dynamic_light += static_light * albedo; //send for bounces + dynamic_light *= params.env_transform[2][3]; // exposure_normalization imageStore(dest_light, ivec3(atlas_pos, params.atlas_slice), vec4(dynamic_light, 1.0)); #ifdef USE_SH_LIGHTMAPS @@ -444,6 +445,7 @@ void main() { imageStore(accum_light, ivec3(atlas_pos, params.atlas_slice * 4 + 3), sh_accum[3]); #else + static_light *= params.env_transform[2][3]; // exposure_normalization imageStore(accum_light, ivec3(atlas_pos, params.atlas_slice), vec4(static_light, 1.0)); #endif diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs index 44806e8ecf..fa79c2efbc 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs @@ -130,14 +130,14 @@ namespace Godot.NativeInterop [FieldOffset(0)] public AABB* _aabb; [FieldOffset(0)] public Basis* _basis; [FieldOffset(0)] public Transform3D* _transform3D; - [FieldOffset(0)] public Vector4* _vector4; - [FieldOffset(0)] public Vector4i* _vector4i; [FieldOffset(0)] public Projection* _projection; [FieldOffset(0)] private godot_variant_data_mem _mem; // The following fields are not in the C++ union, but this is how they're stored in _mem. [FieldOffset(0)] public godot_string_name _m_string_name; [FieldOffset(0)] public godot_string _m_string; + [FieldOffset(0)] public Vector4 _m_vector4; + [FieldOffset(0)] public Vector4i _m_vector4i; [FieldOffset(0)] public Vector3 _m_vector3; [FieldOffset(0)] public Vector3i _m_vector3i; [FieldOffset(0)] public Vector2 _m_vector2; @@ -232,18 +232,6 @@ namespace Godot.NativeInterop get => _data._transform3D; } - public readonly unsafe Vector4* Vector4 - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _data._vector4; - } - - public readonly unsafe Vector4i* Vector4i - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _data._vector4i; - } - public readonly unsafe Projection* Projection { [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -266,6 +254,22 @@ namespace Godot.NativeInterop set => _data._m_string = value; } + public Vector4 Vector4 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + readonly get => _data._m_vector4; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set => _data._m_vector4 = value; + } + + public Vector4i Vector4i + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + readonly get => _data._m_vector4i; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set => _data._m_vector4i = value; + } + public Vector3 Vector3 { [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -406,6 +410,8 @@ namespace Godot.NativeInterop case Variant.Type.Rect2i: case Variant.Type.Vector3: case Variant.Type.Vector3i: + case Variant.Type.Vector4: + case Variant.Type.Vector4i: case Variant.Type.Plane: case Variant.Type.Quaternion: case Variant.Type.Color: diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs index eee19aea46..140fc167ba 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs @@ -613,9 +613,9 @@ namespace Godot.NativeInterop case Variant.Type.Transform2d: return *p_var.Transform2D; case Variant.Type.Vector4: - return *p_var.Vector4; + return p_var.Vector4; case Variant.Type.Vector4i: - return *p_var.Vector4i; + return p_var.Vector4i; case Variant.Type.Plane: return p_var.Plane; case Variant.Type.Quaternion: diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs index e84bba1179..bd00611383 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs @@ -176,10 +176,6 @@ namespace Godot.NativeInterop public static partial void godotsharp_variant_new_transform2d(out godot_variant r_dest, in Transform2D p_t2d); - public static partial void godotsharp_variant_new_vector4(out godot_variant r_dest, in Vector4 p_vec4); - - public static partial void godotsharp_variant_new_vector4i(out godot_variant r_dest, in Vector4i p_vec4i); - public static partial void godotsharp_variant_new_basis(out godot_variant r_dest, in Basis p_basis); public static partial void godotsharp_variant_new_transform3d(out godot_variant r_dest, in Transform3D p_trans); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs index 26fffc079c..9f0b55431b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs @@ -28,6 +28,10 @@ namespace Godot.NativeInterop return new godot_variant() { Vector3 = src.Vector3, Type = Variant.Type.Vector3 }; case Variant.Type.Vector3i: return new godot_variant() { Vector3i = src.Vector3i, Type = Variant.Type.Vector3i }; + case Variant.Type.Vector4: + return new godot_variant() { Vector4 = src.Vector4, Type = Variant.Type.Vector4 }; + case Variant.Type.Vector4i: + return new godot_variant() { Vector4i = src.Vector4i, Type = Variant.Type.Vector4i }; case Variant.Type.Plane: return new godot_variant() { Plane = src.Plane, Type = Variant.Type.Plane }; case Variant.Type.Quaternion: diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantConversionCallbacks.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantConversionCallbacks.cs index a13fb936e8..9cde62c7c5 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantConversionCallbacks.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantConversionCallbacks.cs @@ -74,6 +74,12 @@ internal static unsafe class VariantConversionCallbacks static godot_variant FromTransform3D(in Transform3D @transform3d) => VariantUtils.CreateFromTransform3D(@transform3d); + static godot_variant FromVector4(in Vector4 @vector4) => + VariantUtils.CreateFromVector4(@vector4); + + static godot_variant FromVector4I(in Vector4i vector4I) => + VariantUtils.CreateFromVector4i(vector4I); + static godot_variant FromAabb(in AABB @aabb) => VariantUtils.CreateFromAABB(@aabb); @@ -283,6 +289,18 @@ internal static unsafe class VariantConversionCallbacks &FromTransform3D; } + if (typeOfT == typeof(Vector4)) + { + return (delegate*<in T, godot_variant>)(delegate*<in Vector4, godot_variant>) + &FromVector4; + } + + if (typeOfT == typeof(Vector4i)) + { + return (delegate*<in T, godot_variant>)(delegate*<in Vector4i, godot_variant>) + &FromVector4I; + } + if (typeOfT == typeof(AABB)) { return (delegate*<in T, godot_variant>)(delegate*<in AABB, godot_variant>) @@ -556,6 +574,12 @@ internal static unsafe class VariantConversionCallbacks static Transform3D ToTransform3D(in godot_variant variant) => VariantUtils.ConvertToTransform3D(variant); + static Vector4 ToVector4(in godot_variant variant) => + VariantUtils.ConvertToVector4(variant); + + static Vector4i ToVector4I(in godot_variant variant) => + VariantUtils.ConvertToVector4i(variant); + static AABB ToAabb(in godot_variant variant) => VariantUtils.ConvertToAABB(variant); @@ -768,6 +792,18 @@ internal static unsafe class VariantConversionCallbacks &ToTransform3D; } + if (typeOfT == typeof(Vector4)) + { + return (delegate*<in godot_variant, T>)(delegate*<in godot_variant, Vector4>) + &ToVector4; + } + + if (typeOfT == typeof(Vector4i)) + { + return (delegate*<in godot_variant, T>)(delegate*<in godot_variant, Vector4i>) + &ToVector4I; + } + if (typeOfT == typeof(AABB)) { return (delegate*<in godot_variant, T>)(delegate*<in godot_variant, AABB>) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs index 491ccf904e..57f9ec7d95 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs @@ -37,6 +37,12 @@ namespace Godot.NativeInterop public static godot_variant CreateFromVector3i(Vector3i from) => new() { Type = Variant.Type.Vector3i, Vector3i = from }; + public static godot_variant CreateFromVector4(Vector4 from) + => new() { Type = Variant.Type.Vector4, Vector4 = from }; + + public static godot_variant CreateFromVector4i(Vector4i from) + => new() { Type = Variant.Type.Vector4i, Vector4i = from }; + public static godot_variant CreateFromRect2(Rect2 from) => new() { Type = Variant.Type.Rect2, Rect2 = from }; @@ -58,18 +64,6 @@ namespace Godot.NativeInterop return ret; } - public static godot_variant CreateFromVector4(Vector4 from) - { - NativeFuncs.godotsharp_variant_new_vector4(out godot_variant ret, from); - return ret; - } - - public static godot_variant CreateFromVector4i(Vector4i from) - { - NativeFuncs.godotsharp_variant_new_vector4i(out godot_variant ret, from); - return ret; - } - public static godot_variant CreateFromBasis(Basis from) { NativeFuncs.godotsharp_variant_new_basis(out godot_variant ret, from); @@ -386,12 +380,12 @@ namespace Godot.NativeInterop public static unsafe Vector4 ConvertToVector4(in godot_variant p_var) => p_var.Type == Variant.Type.Vector4 ? - *p_var.Vector4 : + p_var.Vector4 : NativeFuncs.godotsharp_variant_as_vector4(p_var); public static unsafe Vector4i ConvertToVector4i(in godot_variant p_var) => p_var.Type == Variant.Type.Vector4i ? - *p_var.Vector4i : + p_var.Vector4i : NativeFuncs.godotsharp_variant_as_vector4i(p_var); public static unsafe Basis ConvertToBasis(in godot_variant p_var) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Variant.cs b/modules/mono/glue/GodotSharp/GodotSharp/Variant.cs index 85ef258922..1f37694995 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Variant.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Variant.cs @@ -65,6 +65,8 @@ public partial struct Variant : IDisposable case Type.Rect2i: case Type.Vector3: case Type.Vector3i: + case Type.Vector4: + case Type.Vector4i: case Type.Plane: case Type.Quaternion: case Type.Color: diff --git a/modules/mono/glue/runtime_interop.cpp b/modules/mono/glue/runtime_interop.cpp index 529bda4c38..276701cdaa 100644 --- a/modules/mono/glue/runtime_interop.cpp +++ b/modules/mono/glue/runtime_interop.cpp @@ -548,14 +548,6 @@ void godotsharp_variant_new_transform2d(godot_variant *r_dest, const Transform2D memnew_placement(r_dest, Variant(*p_t2d)); } -void godotsharp_variant_new_vector4(godot_variant *r_dest, const Vector4 *p_vec4) { - memnew_placement(r_dest, Variant(*p_vec4)); -} - -void godotsharp_variant_new_vector4i(godot_variant *r_dest, const Vector4i *p_vec4i) { - memnew_placement(r_dest, Variant(*p_vec4i)); -} - void godotsharp_variant_new_basis(godot_variant *r_dest, const Basis *p_basis) { memnew_placement(r_dest, Variant(*p_basis)); } @@ -1319,7 +1311,7 @@ void godotsharp_object_to_string(Object *p_ptr, godot_string *r_str) { #endif // Can't call 'Object::to_string()' here, as that can end up calling 'ToString' again resulting in an endless circular loop. memnew_placement(r_str, - String("[" + p_ptr->get_class() + ":" + itos(p_ptr->get_instance_id()) + "]")); + String("<" + p_ptr->get_class() + "#" + itos(p_ptr->get_instance_id()) + ">")); } #ifdef __cplusplus @@ -1377,8 +1369,6 @@ static const void *unmanaged_callbacks[]{ (void *)godotsharp_variant_new_node_path, (void *)godotsharp_variant_new_object, (void *)godotsharp_variant_new_transform2d, - (void *)godotsharp_variant_new_vector4, - (void *)godotsharp_variant_new_vector4i, (void *)godotsharp_variant_new_basis, (void *)godotsharp_variant_new_transform3d, (void *)godotsharp_variant_new_projection, diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 8f2abda00f..abef48e2a1 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -2622,11 +2622,11 @@ Vector2 TextServerAdvanced::font_get_glyph_advance(const RID &p_font_rid, int64_ } if (fd->msdf) { - return (gl[p_glyph].advance + ea) * (double)p_size / (double)fd->msdf_source_size; + return (gl[p_glyph | mod].advance + ea) * (double)p_size / (double)fd->msdf_source_size; } else if ((fd->subpixel_positioning == SUBPIXEL_POSITIONING_DISABLED) || (fd->subpixel_positioning == SUBPIXEL_POSITIONING_AUTO && size.x > SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE)) { - return (gl[p_glyph].advance + ea).round(); + return (gl[p_glyph | mod].advance + ea).round(); } else { - return gl[p_glyph].advance + ea; + return gl[p_glyph | mod].advance + ea; } } @@ -2669,9 +2669,9 @@ Vector2 TextServerAdvanced::font_get_glyph_offset(const RID &p_font_rid, const V const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; if (fd->msdf) { - return gl[p_glyph].rect.position * (double)p_size.x / (double)fd->msdf_source_size; + return gl[p_glyph | mod].rect.position * (double)p_size.x / (double)fd->msdf_source_size; } else { - return gl[p_glyph].rect.position; + return gl[p_glyph | mod].rect.position; } } @@ -2714,9 +2714,9 @@ Vector2 TextServerAdvanced::font_get_glyph_size(const RID &p_font_rid, const Vec const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; if (fd->msdf) { - return gl[p_glyph].rect.size * (double)p_size.x / (double)fd->msdf_source_size; + return gl[p_glyph | mod].rect.size * (double)p_size.x / (double)fd->msdf_source_size; } else { - return gl[p_glyph].rect.size; + return gl[p_glyph | mod].rect.size; } } @@ -2757,7 +2757,7 @@ Rect2 TextServerAdvanced::font_get_glyph_uv_rect(const RID &p_font_rid, const Ve } const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; - return gl[p_glyph].uv_rect; + return gl[p_glyph | mod].uv_rect; } void TextServerAdvanced::font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) { @@ -2797,7 +2797,7 @@ int64_t TextServerAdvanced::font_get_glyph_texture_idx(const RID &p_font_rid, co } const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; - return gl[p_glyph].texture_idx; + return gl[p_glyph | mod].texture_idx; } void TextServerAdvanced::font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) { @@ -2837,12 +2837,12 @@ RID TextServerAdvanced::font_get_glyph_texture_rid(const RID &p_font_rid, const } const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; - ERR_FAIL_COND_V(gl[p_glyph].texture_idx < -1 || gl[p_glyph].texture_idx >= fd->cache[size]->textures.size(), RID()); + ERR_FAIL_COND_V(gl[p_glyph | mod].texture_idx < -1 || gl[p_glyph | mod].texture_idx >= fd->cache[size]->textures.size(), RID()); if (RenderingServer::get_singleton() != nullptr) { - if (gl[p_glyph].texture_idx != -1) { - if (fd->cache[size]->textures[gl[p_glyph].texture_idx].dirty) { - FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph].texture_idx]; + if (gl[p_glyph | mod].texture_idx != -1) { + if (fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].dirty) { + FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph | mod].texture_idx]; Ref<Image> img; img.instantiate(); img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata); @@ -2856,7 +2856,7 @@ RID TextServerAdvanced::font_get_glyph_texture_rid(const RID &p_font_rid, const } tex.dirty = false; } - return fd->cache[size]->textures[gl[p_glyph].texture_idx].texture->get_rid(); + return fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].texture->get_rid(); } } @@ -2885,12 +2885,12 @@ Size2 TextServerAdvanced::font_get_glyph_texture_size(const RID &p_font_rid, con } const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; - ERR_FAIL_COND_V(gl[p_glyph].texture_idx < -1 || gl[p_glyph].texture_idx >= fd->cache[size]->textures.size(), Size2()); + ERR_FAIL_COND_V(gl[p_glyph | mod].texture_idx < -1 || gl[p_glyph | mod].texture_idx >= fd->cache[size]->textures.size(), Size2()); if (RenderingServer::get_singleton() != nullptr) { - if (gl[p_glyph].texture_idx != -1) { - if (fd->cache[size]->textures[gl[p_glyph].texture_idx].dirty) { - FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph].texture_idx]; + if (gl[p_glyph | mod].texture_idx != -1) { + if (fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].dirty) { + FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph | mod].texture_idx]; Ref<Image> img; img.instantiate(); img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata); @@ -2904,7 +2904,7 @@ Size2 TextServerAdvanced::font_get_glyph_texture_size(const RID &p_font_rid, con } tex.dirty = false; } - return fd->cache[size]->textures[gl[p_glyph].texture_idx].texture->get_size(); + return fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].texture->get_size(); } } diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 8e4a4ff424..359bb056a8 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -1697,11 +1697,11 @@ Vector2 TextServerFallback::font_get_glyph_advance(const RID &p_font_rid, int64_ } if (fd->msdf) { - return (gl[p_glyph].advance + ea) * (double)p_size / (double)fd->msdf_source_size; + return (gl[p_glyph | mod].advance + ea) * (double)p_size / (double)fd->msdf_source_size; } else if ((fd->subpixel_positioning == SUBPIXEL_POSITIONING_DISABLED) || (fd->subpixel_positioning == SUBPIXEL_POSITIONING_AUTO && size.x > SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE)) { - return (gl[p_glyph].advance + ea).round(); + return (gl[p_glyph | mod].advance + ea).round(); } else { - return gl[p_glyph].advance + ea; + return gl[p_glyph | mod].advance + ea; } } @@ -1744,9 +1744,9 @@ Vector2 TextServerFallback::font_get_glyph_offset(const RID &p_font_rid, const V const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; if (fd->msdf) { - return gl[p_glyph].rect.position * (double)p_size.x / (double)fd->msdf_source_size; + return gl[p_glyph | mod].rect.position * (double)p_size.x / (double)fd->msdf_source_size; } else { - return gl[p_glyph].rect.position; + return gl[p_glyph | mod].rect.position; } } @@ -1789,9 +1789,9 @@ Vector2 TextServerFallback::font_get_glyph_size(const RID &p_font_rid, const Vec const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; if (fd->msdf) { - return gl[p_glyph].rect.size * (double)p_size.x / (double)fd->msdf_source_size; + return gl[p_glyph | mod].rect.size * (double)p_size.x / (double)fd->msdf_source_size; } else { - return gl[p_glyph].rect.size; + return gl[p_glyph | mod].rect.size; } } @@ -1832,7 +1832,7 @@ Rect2 TextServerFallback::font_get_glyph_uv_rect(const RID &p_font_rid, const Ve } const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; - return gl[p_glyph].uv_rect; + return gl[p_glyph | mod].uv_rect; } void TextServerFallback::font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) { @@ -1872,7 +1872,7 @@ int64_t TextServerFallback::font_get_glyph_texture_idx(const RID &p_font_rid, co } const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; - return gl[p_glyph].texture_idx; + return gl[p_glyph | mod].texture_idx; } void TextServerFallback::font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) { @@ -1912,12 +1912,12 @@ RID TextServerFallback::font_get_glyph_texture_rid(const RID &p_font_rid, const } const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; - ERR_FAIL_COND_V(gl[p_glyph].texture_idx < -1 || gl[p_glyph].texture_idx >= fd->cache[size]->textures.size(), RID()); + ERR_FAIL_COND_V(gl[p_glyph | mod].texture_idx < -1 || gl[p_glyph | mod].texture_idx >= fd->cache[size]->textures.size(), RID()); if (RenderingServer::get_singleton() != nullptr) { - if (gl[p_glyph].texture_idx != -1) { - if (fd->cache[size]->textures[gl[p_glyph].texture_idx].dirty) { - FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph].texture_idx]; + if (gl[p_glyph | mod].texture_idx != -1) { + if (fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].dirty) { + FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph | mod].texture_idx]; Ref<Image> img; img.instantiate(); img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata); @@ -1931,7 +1931,7 @@ RID TextServerFallback::font_get_glyph_texture_rid(const RID &p_font_rid, const } tex.dirty = false; } - return fd->cache[size]->textures[gl[p_glyph].texture_idx].texture->get_rid(); + return fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].texture->get_rid(); } } @@ -1960,12 +1960,12 @@ Size2 TextServerFallback::font_get_glyph_texture_size(const RID &p_font_rid, con } const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map; - ERR_FAIL_COND_V(gl[p_glyph].texture_idx < -1 || gl[p_glyph].texture_idx >= fd->cache[size]->textures.size(), Size2()); + ERR_FAIL_COND_V(gl[p_glyph | mod].texture_idx < -1 || gl[p_glyph | mod].texture_idx >= fd->cache[size]->textures.size(), Size2()); if (RenderingServer::get_singleton() != nullptr) { - if (gl[p_glyph].texture_idx != -1) { - if (fd->cache[size]->textures[gl[p_glyph].texture_idx].dirty) { - FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph].texture_idx]; + if (gl[p_glyph | mod].texture_idx != -1) { + if (fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].dirty) { + FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph | mod].texture_idx]; Ref<Image> img; img.instantiate(); img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata); @@ -1979,7 +1979,7 @@ Size2 TextServerFallback::font_get_glyph_texture_size(const RID &p_font_rid, con } tex.dirty = false; } - return fd->cache[size]->textures[gl[p_glyph].texture_idx].texture->get_size(); + return fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].texture->get_size(); } } |