diff --git a/modules/mono/build_scripts/build_assemblies.py b/modules/mono/build_scripts/build_assemblies.py index 9f88b0575ed..2a1ecba3323 100755 --- a/modules/mono/build_scripts/build_assemblies.py +++ b/modules/mono/build_scripts/build_assemblies.py @@ -229,7 +229,7 @@ def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, pre core_src_dir = os.path.abspath(os.path.join(sln, os.pardir, "GodotSharp", "bin", build_config)) editor_src_dir = os.path.abspath(os.path.join(sln, os.pardir, "GodotSharpEditor", "bin", build_config)) - plugins_src_dir = os.path.abspath(os.path.join(sln, os.pardir, "GodotPlugins", "bin", build_config, "net6.0")) + plugins_src_dir = os.path.abspath(os.path.join(sln, os.pardir, "GodotPlugins", "bin", build_config, "net7.0")) if not os.path.isdir(editor_api_dir): assert not os.path.isfile(editor_api_dir) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Godot.SourceGenerators.Sample.csproj b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Godot.SourceGenerators.Sample.csproj index fc887313d5e..5152b383ead 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Godot.SourceGenerators.Sample.csproj +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Godot.SourceGenerators.Sample.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 11 diff --git a/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj b/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj index f692f26a8b0..37563e0cc8e 100644 --- a/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj @@ -1,7 +1,7 @@  {639E48BD-44E5-4091-8EDD-22D36DC0768D} - net6.0 + net7.0 10 enable diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj index 5547ffcf192..9a73a7f81d4 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj @@ -1,7 +1,7 @@  {A8CDAD94-C6D4-4B19-A7E7-76C53CC92984} - net6.0 + net7.0 10 enable diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs index 04ea46e9ef3..dd74a0d5233 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs @@ -22,13 +22,7 @@ namespace GodotTools.ProjectEditor root.Sdk = GodotSdkAttrValue; var mainGroup = root.AddPropertyGroup(); - mainGroup.AddProperty("TargetFramework", "net6.0"); - - var net7 = mainGroup.AddProperty("TargetFramework", "net7.0"); - net7.Condition = " '$(GodotTargetPlatform)' == 'android' "; - - var net8 = mainGroup.AddProperty("TargetFramework", "net8.0"); - net8.Condition = " '$(GodotTargetPlatform)' == 'ios' "; + mainGroup.AddProperty("TargetFramework", "net8.0"); mainGroup.AddProperty("EnableDynamicLoading", "true"); diff --git a/modules/mono/editor/GodotTools/GodotTools.Shared/GodotTools.Shared.csproj b/modules/mono/editor/GodotTools/GodotTools.Shared/GodotTools.Shared.csproj index 7c19fabaf6e..e916980f15f 100644 --- a/modules/mono/editor/GodotTools/GodotTools.Shared/GodotTools.Shared.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.Shared/GodotTools.Shared.csproj @@ -1,8 +1,8 @@ - - - net6.0 - - false - - + + + net8.0 + + false + + diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj index 96d2c5c75f2..a8deeb2fea2 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj +++ b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj @@ -1,7 +1,7 @@  {27B00618-A6F2-4828-B922-05CAEB08C286} - net6.0 + net7.0 true 10 enable diff --git a/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs b/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs index 08e293afcc2..3d6a5b4662a 100644 --- a/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs +++ b/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs @@ -172,11 +172,7 @@ using Godot.NativeInterop; { var parameter = callback.Parameters[i]; - AppendRefKind(source, parameter.RefKind); - source.Append(' '); - source.Append(parameter.Type.FullQualifiedNameIncludeGlobal()); - source.Append(' '); - source.Append(parameter.Name); + source.Append(parameter.DeclaringSyntaxReferences[0].GetSyntax().ToString()); if (parameter.RefKind == RefKind.Out) { diff --git a/modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj b/modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj index 1e60743fb1e..1deccbc09d9 100644 --- a/modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj +++ b/modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 10 enable true diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs index 555aebcd831..6e34c2bfbfc 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs @@ -173,7 +173,7 @@ namespace Godot.NativeInterop internal readonly unsafe godot_variant* GetUnsafeAddress() => (godot_variant*)Unsafe.AsPointer(ref Unsafe.AsRef(in _typeField)); - // Variant.Type is generated as an enum of type long, so we can't use for the field as it must only take 32-bits. + // Variant.Type is generated as an enum of type long, so we can't use for the field as it must only take 32-bits. (the native enum actually has no fixed underlying type so it is only at least 6 bits long) private int _typeField; // There's padding here diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs index 54efaad3c84..69ea567c990 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs @@ -268,7 +268,7 @@ namespace Godot.NativeInterop // Callable - public static godot_callable ConvertCallableToNative(in Callable p_managed_callable) + public static godot_callable ConvertCallableToNative(scoped in Callable p_managed_callable) { if (p_managed_callable.Delegate != null) { @@ -333,7 +333,7 @@ namespace Godot.NativeInterop // Signal - public static godot_signal ConvertSignalToNative(in Signal p_managed_signal) + public static godot_signal ConvertSignalToNative(scoped in Signal p_managed_signal) { ulong ownerId = p_managed_signal.Owner.GetInstanceId(); godot_string_name name; @@ -432,12 +432,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_byte_array ConvertSystemArrayToNativePackedByteArray(Span p_array) + public static godot_packed_byte_array ConvertSystemArrayToNativePackedByteArray(scoped Span p_array) { return ConvertSystemArrayToNativePackedByteArray((ReadOnlySpan)p_array); } - public static unsafe godot_packed_byte_array ConvertSystemArrayToNativePackedByteArray(ReadOnlySpan p_array) + public static unsafe godot_packed_byte_array ConvertSystemArrayToNativePackedByteArray(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_byte_array(); @@ -460,12 +460,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_int32_array ConvertSystemArrayToNativePackedInt32Array(Span p_array) + public static godot_packed_int32_array ConvertSystemArrayToNativePackedInt32Array(scoped Span p_array) { return ConvertSystemArrayToNativePackedInt32Array((ReadOnlySpan)p_array); } - public static unsafe godot_packed_int32_array ConvertSystemArrayToNativePackedInt32Array(ReadOnlySpan p_array) + public static unsafe godot_packed_int32_array ConvertSystemArrayToNativePackedInt32Array(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_int32_array(); @@ -488,12 +488,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_int64_array ConvertSystemArrayToNativePackedInt64Array(Span p_array) + public static godot_packed_int64_array ConvertSystemArrayToNativePackedInt64Array(scoped Span p_array) { return ConvertSystemArrayToNativePackedInt64Array((ReadOnlySpan)p_array); } - public static unsafe godot_packed_int64_array ConvertSystemArrayToNativePackedInt64Array(ReadOnlySpan p_array) + public static unsafe godot_packed_int64_array ConvertSystemArrayToNativePackedInt64Array(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_int64_array(); @@ -516,13 +516,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_float32_array ConvertSystemArrayToNativePackedFloat32Array(Span p_array) + public static godot_packed_float32_array ConvertSystemArrayToNativePackedFloat32Array(scoped Span p_array) { return ConvertSystemArrayToNativePackedFloat32Array((ReadOnlySpan)p_array); } - public static unsafe godot_packed_float32_array ConvertSystemArrayToNativePackedFloat32Array( - ReadOnlySpan p_array) + public static unsafe godot_packed_float32_array ConvertSystemArrayToNativePackedFloat32Array(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_float32_array(); @@ -545,13 +544,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_float64_array ConvertSystemArrayToNativePackedFloat64Array(Span p_array) + public static godot_packed_float64_array ConvertSystemArrayToNativePackedFloat64Array(scoped Span p_array) { return ConvertSystemArrayToNativePackedFloat64Array((ReadOnlySpan)p_array); } - public static unsafe godot_packed_float64_array ConvertSystemArrayToNativePackedFloat64Array( - ReadOnlySpan p_array) + public static unsafe godot_packed_float64_array ConvertSystemArrayToNativePackedFloat64Array(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_float64_array(); @@ -573,12 +571,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_string_array ConvertSystemArrayToNativePackedStringArray(Span p_array) + public static godot_packed_string_array ConvertSystemArrayToNativePackedStringArray(scoped Span p_array) { return ConvertSystemArrayToNativePackedStringArray((ReadOnlySpan)p_array); } - public static godot_packed_string_array ConvertSystemArrayToNativePackedStringArray(ReadOnlySpan p_array) + public static godot_packed_string_array ConvertSystemArrayToNativePackedStringArray(scoped ReadOnlySpan p_array) { godot_packed_string_array dest = new godot_packed_string_array(); @@ -612,13 +610,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_vector2_array ConvertSystemArrayToNativePackedVector2Array(Span p_array) + public static godot_packed_vector2_array ConvertSystemArrayToNativePackedVector2Array(scoped Span p_array) { return ConvertSystemArrayToNativePackedVector2Array((ReadOnlySpan)p_array); } - public static unsafe godot_packed_vector2_array ConvertSystemArrayToNativePackedVector2Array( - ReadOnlySpan p_array) + public static unsafe godot_packed_vector2_array ConvertSystemArrayToNativePackedVector2Array(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_vector2_array(); @@ -641,13 +638,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_vector3_array ConvertSystemArrayToNativePackedVector3Array(Span p_array) + public static godot_packed_vector3_array ConvertSystemArrayToNativePackedVector3Array(scoped Span p_array) { return ConvertSystemArrayToNativePackedVector3Array((ReadOnlySpan)p_array); } - public static unsafe godot_packed_vector3_array ConvertSystemArrayToNativePackedVector3Array( - ReadOnlySpan p_array) + public static unsafe godot_packed_vector3_array ConvertSystemArrayToNativePackedVector3Array(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_vector3_array(); @@ -670,13 +666,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_vector4_array ConvertSystemArrayToNativePackedVector4Array(Span p_array) + public static godot_packed_vector4_array ConvertSystemArrayToNativePackedVector4Array(scoped Span p_array) { return ConvertSystemArrayToNativePackedVector4Array((ReadOnlySpan)p_array); } - public static unsafe godot_packed_vector4_array ConvertSystemArrayToNativePackedVector4Array( - ReadOnlySpan p_array) + public static unsafe godot_packed_vector4_array ConvertSystemArrayToNativePackedVector4Array(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_vector4_array(); @@ -699,12 +694,12 @@ namespace Godot.NativeInterop return array; } - public static godot_packed_color_array ConvertSystemArrayToNativePackedColorArray(Span p_array) + public static godot_packed_color_array ConvertSystemArrayToNativePackedColorArray(scoped Span p_array) { return ConvertSystemArrayToNativePackedColorArray((ReadOnlySpan)p_array); } - public static unsafe godot_packed_color_array ConvertSystemArrayToNativePackedColorArray(ReadOnlySpan p_array) + public static unsafe godot_packed_color_array ConvertSystemArrayToNativePackedColorArray(scoped ReadOnlySpan p_array) { if (p_array.IsEmpty) return new godot_packed_color_array(); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs index 47998c8017c..8c2bc7941b3 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs @@ -101,10 +101,10 @@ namespace Godot.NativeInterop internal static partial void godotsharp_internal_reload_registered_script(IntPtr scriptPtr); - internal static partial void godotsharp_array_filter_godot_objects_by_native(in godot_string_name p_native_name, - in godot_array p_input, out godot_array r_output); + internal static partial void godotsharp_array_filter_godot_objects_by_native(scoped in godot_string_name p_native_name, + scoped in godot_array p_input, out godot_array r_output); - internal static partial void godotsharp_array_filter_godot_objects_by_non_native(in godot_array p_input, + internal static partial void godotsharp_array_filter_godot_objects_by_non_native(scoped in godot_array p_input, out godot_array r_output); public static partial void godotsharp_ref_new_from_ref_counted_ptr(out godot_ref r_dest, @@ -113,15 +113,15 @@ namespace Godot.NativeInterop public static partial void godotsharp_ref_destroy(ref godot_ref p_instance); public static partial void godotsharp_string_name_new_from_string(out godot_string_name r_dest, - in godot_string p_name); + scoped in godot_string p_name); public static partial void godotsharp_node_path_new_from_string(out godot_node_path r_dest, - in godot_string p_name); + scoped in godot_string p_name); public static partial void - godotsharp_string_name_as_string(out godot_string r_dest, in godot_string_name p_name); + godotsharp_string_name_as_string(out godot_string r_dest, scoped in godot_string_name p_name); - public static partial void godotsharp_node_path_as_string(out godot_string r_dest, in godot_node_path p_np); + public static partial void godotsharp_node_path_as_string(out godot_string r_dest, scoped in godot_node_path p_np); public static partial godot_packed_byte_array godotsharp_packed_byte_array_new_mem_copy(byte* p_src, int p_length); @@ -156,10 +156,10 @@ namespace Godot.NativeInterop public static partial void godotsharp_callable_new_with_delegate(IntPtr p_delegate_handle, IntPtr p_trampoline, IntPtr p_object, out godot_callable r_callable); - internal static partial godot_bool godotsharp_callable_get_data_for_marshalling(in godot_callable p_callable, + internal static partial godot_bool godotsharp_callable_get_data_for_marshalling(scoped in godot_callable p_callable, out IntPtr r_delegate_handle, out IntPtr r_trampoline, out IntPtr r_object, out godot_string_name r_name); - internal static partial godot_variant godotsharp_callable_call(in godot_callable p_callable, + internal static partial godot_variant godotsharp_callable_call(scoped in godot_callable p_callable, godot_variant** p_args, int p_arg_count, out godot_variant_call_error p_call_error); internal static partial void godotsharp_callable_call_deferred(in godot_callable p_callable, @@ -180,58 +180,58 @@ namespace Godot.NativeInterop // variant.h public static partial void - godotsharp_variant_new_string_name(out godot_variant r_dest, in godot_string_name p_s); + godotsharp_variant_new_string_name(out godot_variant r_dest, scoped in godot_string_name p_s); - public static partial void godotsharp_variant_new_copy(out godot_variant r_dest, in godot_variant p_src); + public static partial void godotsharp_variant_new_copy(out godot_variant r_dest, scoped in godot_variant p_src); - public static partial void godotsharp_variant_new_node_path(out godot_variant r_dest, in godot_node_path p_np); + public static partial void godotsharp_variant_new_node_path(out godot_variant r_dest, scoped in godot_node_path p_np); public static partial void godotsharp_variant_new_object(out godot_variant r_dest, IntPtr p_obj); - public static partial void godotsharp_variant_new_transform2d(out godot_variant r_dest, in Transform2D p_t2d); + public static partial void godotsharp_variant_new_transform2d(out godot_variant r_dest, scoped in Transform2D p_t2d); - public static partial void godotsharp_variant_new_basis(out godot_variant r_dest, in Basis p_basis); + public static partial void godotsharp_variant_new_basis(out godot_variant r_dest, scoped in Basis p_basis); - public static partial void godotsharp_variant_new_transform3d(out godot_variant r_dest, in Transform3D p_trans); + public static partial void godotsharp_variant_new_transform3d(out godot_variant r_dest, scoped in Transform3D p_trans); - public static partial void godotsharp_variant_new_projection(out godot_variant r_dest, in Projection p_proj); + public static partial void godotsharp_variant_new_projection(out godot_variant r_dest, scoped in Projection p_proj); - public static partial void godotsharp_variant_new_aabb(out godot_variant r_dest, in Aabb p_aabb); + public static partial void godotsharp_variant_new_aabb(out godot_variant r_dest, scoped in Aabb p_aabb); public static partial void godotsharp_variant_new_dictionary(out godot_variant r_dest, - in godot_dictionary p_dict); + scoped in godot_dictionary p_dict); - public static partial void godotsharp_variant_new_array(out godot_variant r_dest, in godot_array p_arr); + public static partial void godotsharp_variant_new_array(out godot_variant r_dest, scoped in godot_array p_arr); public static partial void godotsharp_variant_new_packed_byte_array(out godot_variant r_dest, - in godot_packed_byte_array p_pba); + scoped in godot_packed_byte_array p_pba); public static partial void godotsharp_variant_new_packed_int32_array(out godot_variant r_dest, - in godot_packed_int32_array p_pia); + scoped in godot_packed_int32_array p_pia); public static partial void godotsharp_variant_new_packed_int64_array(out godot_variant r_dest, - in godot_packed_int64_array p_pia); + scoped in godot_packed_int64_array p_pia); public static partial void godotsharp_variant_new_packed_float32_array(out godot_variant r_dest, - in godot_packed_float32_array p_pra); + scoped in godot_packed_float32_array p_pra); public static partial void godotsharp_variant_new_packed_float64_array(out godot_variant r_dest, - in godot_packed_float64_array p_pra); + scoped in godot_packed_float64_array p_pra); public static partial void godotsharp_variant_new_packed_string_array(out godot_variant r_dest, - in godot_packed_string_array p_psa); + scoped in godot_packed_string_array p_psa); public static partial void godotsharp_variant_new_packed_vector2_array(out godot_variant r_dest, - in godot_packed_vector2_array p_pv2a); + scoped in godot_packed_vector2_array p_pv2a); public static partial void godotsharp_variant_new_packed_vector3_array(out godot_variant r_dest, - in godot_packed_vector3_array p_pv3a); + scoped in godot_packed_vector3_array p_pv3a); public static partial void godotsharp_variant_new_packed_vector4_array(out godot_variant r_dest, - in godot_packed_vector4_array p_pv4a); + scoped in godot_packed_vector4_array p_pv4a); public static partial void godotsharp_variant_new_packed_color_array(out godot_variant r_dest, - in godot_packed_color_array p_pca); + scoped in godot_packed_color_array p_pca); public static partial godot_bool godotsharp_variant_as_bool(in godot_variant p_self); @@ -239,7 +239,7 @@ namespace Godot.NativeInterop public static partial double godotsharp_variant_as_float(in godot_variant p_self); - public static partial godot_string godotsharp_variant_as_string(in godot_variant p_self); + public static partial godot_string godotsharp_variant_as_string(scoped in godot_variant p_self); public static partial Vector2 godotsharp_variant_as_vector2(in godot_variant p_self); @@ -273,45 +273,45 @@ namespace Godot.NativeInterop public static partial Color godotsharp_variant_as_color(in godot_variant p_self); - public static partial godot_string_name godotsharp_variant_as_string_name(in godot_variant p_self); + public static partial godot_string_name godotsharp_variant_as_string_name(scoped in godot_variant p_self); - public static partial godot_node_path godotsharp_variant_as_node_path(in godot_variant p_self); + public static partial godot_node_path godotsharp_variant_as_node_path(scoped in godot_variant p_self); public static partial Rid godotsharp_variant_as_rid(in godot_variant p_self); - public static partial godot_callable godotsharp_variant_as_callable(in godot_variant p_self); + public static partial godot_callable godotsharp_variant_as_callable(scoped in godot_variant p_self); - public static partial godot_signal godotsharp_variant_as_signal(in godot_variant p_self); + public static partial godot_signal godotsharp_variant_as_signal(scoped in godot_variant p_self); - public static partial godot_dictionary godotsharp_variant_as_dictionary(in godot_variant p_self); + public static partial godot_dictionary godotsharp_variant_as_dictionary(scoped in godot_variant p_self); - public static partial godot_array godotsharp_variant_as_array(in godot_variant p_self); + public static partial godot_array godotsharp_variant_as_array(scoped in godot_variant p_self); - public static partial godot_packed_byte_array godotsharp_variant_as_packed_byte_array(in godot_variant p_self); + public static partial godot_packed_byte_array godotsharp_variant_as_packed_byte_array(scoped in godot_variant p_self); - public static partial godot_packed_int32_array godotsharp_variant_as_packed_int32_array(in godot_variant p_self); + public static partial godot_packed_int32_array godotsharp_variant_as_packed_int32_array(scoped in godot_variant p_self); - public static partial godot_packed_int64_array godotsharp_variant_as_packed_int64_array(in godot_variant p_self); + public static partial godot_packed_int64_array godotsharp_variant_as_packed_int64_array(scoped in godot_variant p_self); public static partial godot_packed_float32_array godotsharp_variant_as_packed_float32_array( - in godot_variant p_self); + scoped in godot_variant p_self); public static partial godot_packed_float64_array godotsharp_variant_as_packed_float64_array( - in godot_variant p_self); + scoped in godot_variant p_self); public static partial godot_packed_string_array godotsharp_variant_as_packed_string_array( - in godot_variant p_self); + scoped in godot_variant p_self); public static partial godot_packed_vector2_array godotsharp_variant_as_packed_vector2_array( - in godot_variant p_self); + scoped in godot_variant p_self); public static partial godot_packed_vector3_array godotsharp_variant_as_packed_vector3_array( - in godot_variant p_self); + scoped in godot_variant p_self); public static partial godot_packed_vector4_array godotsharp_variant_as_packed_vector4_array( in godot_variant p_self); - public static partial godot_packed_color_array godotsharp_variant_as_packed_color_array(in godot_variant p_self); + public static partial godot_packed_color_array godotsharp_variant_as_packed_color_array(scoped in godot_variant p_self); public static partial godot_bool godotsharp_variant_equals(in godot_variant p_a, in godot_variant p_b); @@ -322,17 +322,17 @@ namespace Godot.NativeInterop // string_name.h public static partial void godotsharp_string_name_new_copy(out godot_string_name r_dest, - in godot_string_name p_src); + scoped in godot_string_name p_src); // node_path.h - public static partial void godotsharp_node_path_new_copy(out godot_node_path r_dest, in godot_node_path p_src); + public static partial void godotsharp_node_path_new_copy(out godot_node_path r_dest, scoped in godot_node_path p_src); // array.h public static partial void godotsharp_array_new(out godot_array r_dest); - public static partial void godotsharp_array_new_copy(out godot_array r_dest, in godot_array p_src); + public static partial void godotsharp_array_new_copy(out godot_array r_dest, scoped in godot_array p_src); public static partial godot_variant* godotsharp_array_ptrw(ref godot_array p_self); @@ -341,7 +341,7 @@ namespace Godot.NativeInterop public static partial void godotsharp_dictionary_new(out godot_dictionary r_dest); public static partial void godotsharp_dictionary_new_copy(out godot_dictionary r_dest, - in godot_dictionary p_src); + scoped in godot_dictionary p_src); // destroy functions @@ -389,8 +389,7 @@ namespace Godot.NativeInterop public static partial int godotsharp_array_binary_search(ref godot_array p_self, int p_index, int p_count, in godot_variant p_value); - public static partial void - godotsharp_array_duplicate(ref godot_array p_self, godot_bool p_deep, out godot_array r_dest); + public static partial void godotsharp_array_duplicate(scoped ref godot_array p_self, godot_bool p_deep, out godot_array r_dest); public static partial void godotsharp_array_fill(ref godot_array p_self, in godot_variant p_value); @@ -410,11 +409,11 @@ namespace Godot.NativeInterop public static partial godot_bool godotsharp_array_is_typed(ref godot_array p_self); - public static partial void godotsharp_array_max(ref godot_array p_self, out godot_variant r_value); + public static partial void godotsharp_array_max(scoped ref godot_array p_self, out godot_variant r_value); - public static partial void godotsharp_array_min(ref godot_array p_self, out godot_variant r_value); + public static partial void godotsharp_array_min(scoped ref godot_array p_self, out godot_variant r_value); - public static partial void godotsharp_array_pick_random(ref godot_array p_self, out godot_variant r_value); + public static partial void godotsharp_array_pick_random(scoped ref godot_array p_self, out godot_variant r_value); public static partial godot_bool godotsharp_array_recursive_equal(ref godot_array p_self, in godot_array p_other); @@ -426,7 +425,7 @@ namespace Godot.NativeInterop public static partial void godotsharp_array_shuffle(ref godot_array p_self); - public static partial void godotsharp_array_slice(ref godot_array p_self, int p_start, int p_end, + public static partial void godotsharp_array_slice(scoped ref godot_array p_self, int p_start, int p_end, int p_step, godot_bool p_deep, out godot_array r_dest); public static partial void godotsharp_array_sort(ref godot_array p_self); @@ -435,20 +434,20 @@ namespace Godot.NativeInterop // Dictionary - public static partial godot_bool godotsharp_dictionary_try_get_value(ref godot_dictionary p_self, - in godot_variant p_key, + public static partial godot_bool godotsharp_dictionary_try_get_value(scoped ref godot_dictionary p_self, + scoped in godot_variant p_key, out godot_variant r_value); public static partial void godotsharp_dictionary_set_value(ref godot_dictionary p_self, in godot_variant p_key, in godot_variant p_value); - public static partial void godotsharp_dictionary_keys(ref godot_dictionary p_self, out godot_array r_dest); + public static partial void godotsharp_dictionary_keys(scoped ref godot_dictionary p_self, out godot_array r_dest); - public static partial void godotsharp_dictionary_values(ref godot_dictionary p_self, out godot_array r_dest); + public static partial void godotsharp_dictionary_values(scoped ref godot_dictionary p_self, out godot_array r_dest); public static partial int godotsharp_dictionary_count(ref godot_dictionary p_self); - public static partial void godotsharp_dictionary_key_value_pair_at(ref godot_dictionary p_self, int p_index, + public static partial void godotsharp_dictionary_key_value_pair_at(scoped ref godot_dictionary p_self, int p_index, out godot_variant r_key, out godot_variant r_value); public static partial void godotsharp_dictionary_add(ref godot_dictionary p_self, in godot_variant p_key, @@ -459,7 +458,7 @@ namespace Godot.NativeInterop public static partial godot_bool godotsharp_dictionary_contains_key(ref godot_dictionary p_self, in godot_variant p_key); - public static partial void godotsharp_dictionary_duplicate(ref godot_dictionary p_self, godot_bool p_deep, + public static partial void godotsharp_dictionary_duplicate(scoped ref godot_dictionary p_self, godot_bool p_deep, out godot_dictionary r_dest); public static partial void godotsharp_dictionary_merge(ref godot_dictionary p_self, in godot_dictionary p_dictionary, godot_bool p_overwrite); @@ -496,20 +495,20 @@ namespace Godot.NativeInterop public static partial void godotsharp_dictionary_get_typed_value_script(ref godot_dictionary p_self, out godot_variant r_dest); - public static partial void godotsharp_dictionary_to_string(ref godot_dictionary p_self, out godot_string r_str); + public static partial void godotsharp_dictionary_to_string(scoped ref godot_dictionary p_self, out godot_string r_str); // StringExtensions - public static partial void godotsharp_string_simplify_path(in godot_string p_self, + public static partial void godotsharp_string_simplify_path(scoped in godot_string p_self, out godot_string r_simplified_path); - public static partial void godotsharp_string_to_camel_case(in godot_string p_self, + public static partial void godotsharp_string_to_camel_case(scoped in godot_string p_self, out godot_string r_camel_case); - public static partial void godotsharp_string_to_pascal_case(in godot_string p_self, + public static partial void godotsharp_string_to_pascal_case(scoped in godot_string p_self, out godot_string r_pascal_case); - public static partial void godotsharp_string_to_snake_case(in godot_string p_self, + public static partial void godotsharp_string_to_snake_case(scoped in godot_string p_self, out godot_string r_snake_case); // NodePath @@ -517,18 +516,18 @@ namespace Godot.NativeInterop public static partial void godotsharp_node_path_get_as_property_path(in godot_node_path p_self, ref godot_node_path r_dest); - public static partial void godotsharp_node_path_get_concatenated_names(in godot_node_path p_self, + public static partial void godotsharp_node_path_get_concatenated_names(scoped in godot_node_path p_self, out godot_string r_names); - public static partial void godotsharp_node_path_get_concatenated_subnames(in godot_node_path p_self, + public static partial void godotsharp_node_path_get_concatenated_subnames(scoped in godot_node_path p_self, out godot_string r_subnames); - public static partial void godotsharp_node_path_get_name(in godot_node_path p_self, int p_idx, + public static partial void godotsharp_node_path_get_name(scoped in godot_node_path p_self, int p_idx, out godot_string r_name); public static partial int godotsharp_node_path_get_name_count(in godot_node_path p_self); - public static partial void godotsharp_node_path_get_subname(in godot_node_path p_self, int p_idx, + public static partial void godotsharp_node_path_get_subname(scoped in godot_node_path p_self, int p_idx, out godot_string r_subname); public static partial int godotsharp_node_path_get_subname_count(in godot_node_path p_self); @@ -541,11 +540,11 @@ namespace Godot.NativeInterop // GD, etc - internal static partial void godotsharp_bytes_to_var(in godot_packed_byte_array p_bytes, + internal static partial void godotsharp_bytes_to_var(scoped in godot_packed_byte_array p_bytes, godot_bool p_allow_objects, out godot_variant r_ret); - internal static partial void godotsharp_convert(in godot_variant p_what, int p_type, + internal static partial void godotsharp_convert(scoped in godot_variant p_what, int p_type, out godot_variant r_ret); internal static partial int godotsharp_hash(in godot_variant p_var); @@ -582,12 +581,12 @@ namespace Godot.NativeInterop internal static partial void godotsharp_weakref(IntPtr p_obj, out godot_ref r_weak_ref); - internal static partial void godotsharp_str_to_var(in godot_string p_str, out godot_variant r_ret); + internal static partial void godotsharp_str_to_var(scoped in godot_string p_str, out godot_variant r_ret); - internal static partial void godotsharp_var_to_bytes(in godot_variant p_what, godot_bool p_full_objects, + internal static partial void godotsharp_var_to_bytes(scoped in godot_variant p_what, godot_bool p_full_objects, out godot_packed_byte_array r_bytes); - internal static partial void godotsharp_var_to_str(in godot_variant p_var, out godot_string r_ret); + internal static partial void godotsharp_var_to_str(scoped in godot_variant p_var, out godot_string r_ret); internal static partial void godotsharp_err_print_error(in godot_string p_function, in godot_string p_file, int p_line, in godot_string p_error, in godot_string p_message = default, godot_bool p_editor_notify = godot_bool.False, godot_error_handler_type p_type = godot_error_handler_type.ERR_HANDLER_ERROR); 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 9f237e4d00c..b885893de02 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs @@ -6,7 +6,7 @@ namespace Godot.NativeInterop { public static partial class NativeFuncs { - public static godot_variant godotsharp_variant_new_copy(in godot_variant src) + public static godot_variant godotsharp_variant_new_copy(scoped in godot_variant src) { switch (src.Type) { @@ -48,7 +48,7 @@ namespace Godot.NativeInterop return ret; } - public static godot_string_name godotsharp_string_name_new_copy(in godot_string_name src) + public static godot_string_name godotsharp_string_name_new_copy(scoped in godot_string_name src) { if (src.IsEmpty) return default; @@ -56,7 +56,7 @@ namespace Godot.NativeInterop return ret; } - public static godot_node_path godotsharp_node_path_new_copy(in godot_node_path src) + public static godot_node_path godotsharp_node_path_new_copy(scoped in godot_node_path src) { if (src.IsEmpty) return default; @@ -70,7 +70,7 @@ namespace Godot.NativeInterop return ret; } - public static godot_array godotsharp_array_new_copy(in godot_array src) + public static godot_array godotsharp_array_new_copy(scoped in godot_array src) { godotsharp_array_new_copy(out godot_array ret, src); return ret; @@ -82,7 +82,7 @@ namespace Godot.NativeInterop return ret; } - public static godot_dictionary godotsharp_dictionary_new_copy(in godot_dictionary src) + public static godot_dictionary godotsharp_dictionary_new_copy(scoped in godot_dictionary src) { godotsharp_dictionary_new_copy(out godot_dictionary ret, src); return ret; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs index 222ded68956..5ff9969cfd4 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs @@ -117,159 +117,144 @@ namespace Godot.NativeInterop public static godot_variant CreateFromString(string? from) => CreateFromStringTakingOwnershipOfDisposableValue(Marshaling.ConvertStringToNative(from)); - public static godot_variant CreateFromPackedByteArray(in godot_packed_byte_array from) + public static godot_variant CreateFromPackedByteArray(scoped in godot_packed_byte_array from) { NativeFuncs.godotsharp_variant_new_packed_byte_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedInt32Array(in godot_packed_int32_array from) + public static godot_variant CreateFromPackedInt32Array(scoped in godot_packed_int32_array from) { NativeFuncs.godotsharp_variant_new_packed_int32_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedInt64Array(in godot_packed_int64_array from) + public static godot_variant CreateFromPackedInt64Array(scoped in godot_packed_int64_array from) { NativeFuncs.godotsharp_variant_new_packed_int64_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedFloat32Array(in godot_packed_float32_array from) + public static godot_variant CreateFromPackedFloat32Array(scoped in godot_packed_float32_array from) { NativeFuncs.godotsharp_variant_new_packed_float32_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedFloat64Array(in godot_packed_float64_array from) + public static godot_variant CreateFromPackedFloat64Array(scoped in godot_packed_float64_array from) { NativeFuncs.godotsharp_variant_new_packed_float64_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedStringArray(in godot_packed_string_array from) + public static godot_variant CreateFromPackedStringArray(scoped in godot_packed_string_array from) { NativeFuncs.godotsharp_variant_new_packed_string_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedVector2Array(in godot_packed_vector2_array from) + public static godot_variant CreateFromPackedVector2Array(scoped in godot_packed_vector2_array from) { NativeFuncs.godotsharp_variant_new_packed_vector2_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedVector3Array(in godot_packed_vector3_array from) + public static godot_variant CreateFromPackedVector3Array(scoped in godot_packed_vector3_array from) { NativeFuncs.godotsharp_variant_new_packed_vector3_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedVector4Array(in godot_packed_vector4_array from) + public static godot_variant CreateFromPackedVector4Array(scoped in godot_packed_vector4_array from) { NativeFuncs.godotsharp_variant_new_packed_vector4_array(out godot_variant ret, from); return ret; } - public static godot_variant CreateFromPackedColorArray(in godot_packed_color_array from) + public static godot_variant CreateFromPackedColorArray(scoped in godot_packed_color_array from) { NativeFuncs.godotsharp_variant_new_packed_color_array(out godot_variant ret, from); return ret; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedByteArray(Span from) + public static godot_variant CreateFromPackedByteArray(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedByteArray(from); return CreateFromPackedByteArray(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedInt32Array(Span from) + public static godot_variant CreateFromPackedInt32Array(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedInt32Array(from); return CreateFromPackedInt32Array(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedInt64Array(Span from) + public static godot_variant CreateFromPackedInt64Array(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedInt64Array(from); return CreateFromPackedInt64Array(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedFloat32Array(Span from) + public static godot_variant CreateFromPackedFloat32Array(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedFloat32Array(from); return CreateFromPackedFloat32Array(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedFloat64Array(Span from) + public static godot_variant CreateFromPackedFloat64Array(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedFloat64Array(from); return CreateFromPackedFloat64Array(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedStringArray(Span from) + public static godot_variant CreateFromPackedStringArray(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedStringArray(from); return CreateFromPackedStringArray(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedVector2Array(Span from) + public static godot_variant CreateFromPackedVector2Array(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedVector2Array(from); return CreateFromPackedVector2Array(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedVector3Array(Span from) + public static godot_variant CreateFromPackedVector3Array(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedVector3Array(from); return CreateFromPackedVector3Array(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedVector4Array(Span from) + public static godot_variant CreateFromPackedVector4Array(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedVector4Array(from); return CreateFromPackedVector4Array(nativePackedArray); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_variant CreateFromPackedColorArray(Span from) + public static godot_variant CreateFromPackedColorArray(scoped Span from) { using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedColorArray(from); return CreateFromPackedColorArray(nativePackedArray); } - public static godot_variant CreateFromSystemArrayOfStringName(Span from) - { - if (from == null) - return default; - using var fromGodot = new Collections.Array(from); - return CreateFromArray((godot_array)fromGodot.NativeValue); - } + public static godot_variant CreateFromSystemArrayOfStringName(scoped Span from) + => CreateFromArray(new Collections.Array(from)); - public static godot_variant CreateFromSystemArrayOfNodePath(Span from) - { - if (from == null) - return default; - using var fromGodot = new Collections.Array(from); - return CreateFromArray((godot_array)fromGodot.NativeValue); - } + public static godot_variant CreateFromSystemArrayOfNodePath(scoped Span from) + => CreateFromArray(new Collections.Array(from)); - public static godot_variant CreateFromSystemArrayOfRid(Span from) - { - if (from == null) - return default; - using var fromGodot = new Collections.Array(from); - return CreateFromArray((godot_array)fromGodot.NativeValue); - } + public static godot_variant CreateFromSystemArrayOfRid(scoped Span from) + => CreateFromArray(new Collections.Array(from)); public static godot_variant CreateFromSystemArrayOfGodotObject(GodotObject[]? from) { @@ -279,7 +264,7 @@ namespace Godot.NativeInterop return CreateFromArray((godot_array)fromGodot.NativeValue); } - public static godot_variant CreateFromArray(godot_array from) + public static godot_variant CreateFromArray(scoped in godot_array from) { NativeFuncs.godotsharp_variant_new_array(out godot_variant ret, from); return ret; @@ -293,7 +278,7 @@ namespace Godot.NativeInterop public static godot_variant CreateFromArray<[MustBeVariant] T>(Array? from) => from != null ? CreateFromArray((godot_array)((Collections.Array)from).NativeValue) : default; - public static godot_variant CreateFromDictionary(godot_dictionary from) + public static godot_variant CreateFromDictionary(scoped in godot_dictionary from) { NativeFuncs.godotsharp_variant_new_dictionary(out godot_variant ret, from); return ret; @@ -307,7 +292,7 @@ namespace Godot.NativeInterop public static godot_variant CreateFromDictionary<[MustBeVariant] TKey, [MustBeVariant] TValue>(Dictionary? from) => from != null ? CreateFromDictionary((godot_dictionary)((Dictionary)from).NativeValue) : default; - public static godot_variant CreateFromStringName(godot_string_name from) + public static godot_variant CreateFromStringName(scoped in godot_string_name from) { NativeFuncs.godotsharp_variant_new_string_name(out godot_variant ret, from); return ret; @@ -317,7 +302,7 @@ namespace Godot.NativeInterop public static godot_variant CreateFromStringName(StringName? from) => from != null ? CreateFromStringName((godot_string_name)from.NativeValue) : default; - public static godot_variant CreateFromNodePath(godot_node_path from) + public static godot_variant CreateFromNodePath(scoped in godot_node_path from) { NativeFuncs.godotsharp_variant_new_node_path(out godot_variant ret, from); return ret; @@ -510,7 +495,7 @@ namespace Godot.NativeInterop } } - public static godot_string_name ConvertToNativeStringName(in godot_variant p_var) + public static godot_string_name ConvertToNativeStringName(scoped in godot_variant p_var) => p_var.Type == Variant.Type.StringName ? NativeFuncs.godotsharp_string_name_new_copy(p_var.StringName) : NativeFuncs.godotsharp_variant_as_string_name(p_var); @@ -519,7 +504,7 @@ namespace Godot.NativeInterop public static StringName ConvertToStringName(in godot_variant p_var) => StringName.CreateTakingOwnershipOfDisposableValue(ConvertToNativeStringName(p_var)); - public static godot_node_path ConvertToNativeNodePath(in godot_variant p_var) + public static godot_node_path ConvertToNativeNodePath(scoped in godot_variant p_var) => p_var.Type == Variant.Type.NodePath ? NativeFuncs.godotsharp_node_path_new_copy(p_var.NodePath) : NativeFuncs.godotsharp_variant_as_node_path(p_var); @@ -529,7 +514,7 @@ namespace Godot.NativeInterop => NodePath.CreateTakingOwnershipOfDisposableValue(ConvertToNativeNodePath(p_var)); [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_callable ConvertToNativeCallable(in godot_variant p_var) + public static godot_callable ConvertToNativeCallable(scoped in godot_variant p_var) => NativeFuncs.godotsharp_variant_as_callable(p_var); [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -540,7 +525,7 @@ namespace Godot.NativeInterop } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static godot_signal ConvertToNativeSignal(in godot_variant p_var) + public static godot_signal ConvertToNativeSignal(scoped in godot_variant p_var) => NativeFuncs.godotsharp_variant_as_signal(p_var); [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -550,7 +535,7 @@ namespace Godot.NativeInterop return Marshaling.ConvertSignalToManaged(signal); } - public static godot_array ConvertToNativeArray(in godot_variant p_var) + public static godot_array ConvertToNativeArray(scoped in godot_variant p_var) => p_var.Type == Variant.Type.Array ? NativeFuncs.godotsharp_array_new_copy(p_var.Array) : NativeFuncs.godotsharp_variant_as_array(p_var); @@ -563,7 +548,7 @@ namespace Godot.NativeInterop public static Array ConvertToArray<[MustBeVariant] T>(in godot_variant p_var) => Array.CreateTakingOwnershipOfDisposableValue(ConvertToNativeArray(p_var)); - public static godot_dictionary ConvertToNativeDictionary(in godot_variant p_var) + public static godot_dictionary ConvertToNativeDictionary(scoped in godot_variant p_var) => p_var.Type == Variant.Type.Dictionary ? NativeFuncs.godotsharp_dictionary_new_copy(p_var.Dictionary) : NativeFuncs.godotsharp_variant_as_dictionary(p_var); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs index 2897cc4199e..a5ef11404f4 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs @@ -12,8 +12,10 @@ public partial class VariantUtils internal static class GenericConversion { - public static unsafe godot_variant ToVariant(in T from) => + public static unsafe godot_variant ToVariant(scoped in T from) => +#pragma warning disable CS9088 // the delegate pointer cannot be marked scoped, but it should be ToVariantCb != null ? ToVariantCb(from) : throw UnsupportedType(); +#pragma warning restore CS9088 public static unsafe T FromVariant(in godot_variant variant) => FromVariantCb != null ? FromVariantCb(variant) : throw UnsupportedType(); @@ -31,7 +33,7 @@ public partial class VariantUtils } [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] - public static godot_variant CreateFrom<[MustBeVariant] T>(in T from) + public static godot_variant CreateFrom<[MustBeVariant] T>(scoped in T from) { [MethodImpl(MethodImplOptions.AggressiveInlining)] static TTo UnsafeAs(in T f) => Unsafe.As(ref Unsafe.AsRef(f)); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj index 5aa68559d80..09516cc893e 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj +++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj @@ -4,11 +4,11 @@ bin/$(Configuration) false Godot - net6.0 + net7.0 $(OutputPath)/$(AssemblyName).xml false true - 10 + 11 Recommended diff --git a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj index 715c1a4d51d..fcc6bd7a4da 100644 --- a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj +++ b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj @@ -4,7 +4,7 @@ bin/$(Configuration) false Godot - net6.0 + net7.0 $(OutputPath)/$(AssemblyName).xml false true