summaryrefslogtreecommitdiff
path: root/modules/mono
AgeCommit message (Collapse)Author
2022-10-30C#: Add Variant conversion callbacks for generic Godot collectionsIgnacio Roldán Etcheverry
This allows using generic Godot collections as type arguments for other generic Godot collections. This also allows generic Godot collections as parameter or return type in dynamic Callable invocations.
2022-10-30C#: Remove need for reflection to invoking callable delegatesIgnacio Roldán Etcheverry
We aim to make the C# API reflection-free, mainly for concerns about performance, and to be able to target NativeAOT in refletion-free mode, which reduces the binary size. One of the main usages of reflection still left was the dynamic invokation of callable delegates, and for some time I wasn't sure I would find an alternative solution that I'd be happy with. The new solution uses trampoline functions to invoke the delegates: ``` static void Trampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) { if (args.Count != 1) throw new ArgumentException($"Callable expected 1 arguments but received {args.Count}."); string res = ((Func<int, string>)delegateObj)( VariantConversionCallbacks.GetToManagedCallback<int>()(args[0]) ); ret = VariantConversionCallbacks.GetToVariantCallback<string>()(res); } Callable.CreateWithUnsafeTrampoline((int num) => "Foo" + num, &Trampoline); ``` Of course, this is too much boilerplate for user code. To improve this, the `Callable.From` methods were added. These are overloads that take `Action` and `Func` delegates, which covers the most common use cases: lambdas and method groups: ``` // Lambda Callable.From((int num) => "Foo" + num); // Method group string AppendNum(int num) => "Foo" + num; Callable.From(AppendNum); ``` Unfortunately, due to limitations in the C# language, implicit conversions from delegates to `Callable` are not supported. `Callable.From` does not support custom delegates. These should be uncommon, but the Godot C# API actually uses them for event signals. As such, the bindings generator was updated to generate trampoline functions for event signals. It was also optimized to use `Action` instead of a custom delegate for parameterless signals, which removes the need for the trampoline functions for those signals. The change to reflection-free invokation removes one of the last needs for `ConvertVariantToManagedObjectOfType`. The only remaining usage is from calling script constructors with parameters from the engine (`CreateManagedForGodotObjectScriptInstance`). Once that one is made reflection-free, `ConvertVariantToManagedObjectOfType` can be removed.
2022-10-22Use `.generated` suffix for generated C# codeRaul Santos
Use the `.generated` suffix instead of `_Generated` so .NET marks C# file generated by Godot source generators as generated code.
2022-10-17Merge pull request #67440 from raulsntos/dotnet/bindings-conflictsIgnacio Roldán Etcheverry
Guard against more potential conflicts in C# bindings generator
2022-10-16Add a `Plane(Vector3, Vector3)` constructor for C#Yuri Rubinsky
2022-10-15Guard against more potential conflicts in C# bindings generatorRaul Santos
2022-10-13Merge pull request #67216 from dotlogix/Bugfix/FixErrorWhenSerializingSignalsRémi Verschelde
Fix crash when serializing empty delegates in C#
2022-10-13Adding null check to prevent null reference exception when serializing ↵Alexander Schill
delegates in C#
2022-10-12Merge pull request #66952 from bruvzg/macos_net_exportRémi Verschelde
Fix macOS .NET export.
2022-10-11Use `JSON::stringify` where possibleMicky
2022-10-08C#: Generate symbols packagesRaul Santos
2022-10-07[.NET Export] Improve .NET export process.bruvzg
[macOS export] Fix incorrect file placement, search paths and architecture detection. [macOS export] Automatically detect executable files and set +x flag. [macOS export] Automatically apply "Disable Library Validation" entitlements when required. [macOS export] Remove old Mono export code. Fix folder tree creation for shared objects export. Add arch suffix to the exported .NET "data" folder name. Remove old Mono code from .NET "data" folder lookup.
2022-10-05.NET: Generate SdkPackageVersions.props from version.pyRémi Verschelde
Ensures that the versions always match the Godot version, albeit following SemVer 2.0 so inserting a dot between "beta" and the build number. For "stable" status, we omit the suffix as this would be interpreted as a pre-release build too. So we have: | Godot version | Nupkg version | | -------------- | -------------- | | 4.0.0-beta | 4.0.0-beta | | 4.0.0-beta2 | 4.0.0-beta.2 | | 4.0.0-rc1 | 4.0.0-rc.1 | | 4.0.0-stable | 4.0.0 |
2022-10-05Merge pull request #66873 from akien-mga/script-tweak-error-invalid-script-typeRémi Verschelde
GDScript/C#: Tweak error message for invalid script type for object
2022-10-04Rename Projection `matrix` to `columns`Aaron Franke
2022-10-04GDScript/C#: Tweak error message for invalid script type for objectRémi Verschelde
See #66870.
2022-10-04Merge pull request #66804 from akien-mga/core-remove-NO_SAFE_CASTRémi Verschelde
Remove unsupported `NO_SAFE_CAST`/`-fno-rtti` from Android build
2022-10-03C#: Use Span in Color to avoid string allocationsRaul Santos
2022-10-03Remove unsupported `NO_SAFE_CAST`/`-fno-rtti` from Android buildRémi Verschelde
Android was the last platform to still attempt to disable RTTI (for binary size), but both the Android editor and now the ICU library used by templates need RTTI. There could still be the possibility to support this for non-ICU template builds (i.e. without the TextServerAdvanced module), but since this isn't one of the build configurations we test regularly it's pretty risky to keep this option only for that specific use case. And our code is already littered with `dynamic_cast`s which weren't guarded with `!defined(NO_SAFE_CAST)`.
2022-10-03Merge pull request #66387 from aaronfranke/cs-basis-eulerRémi Verschelde
C#: Update Basis Euler angle code to match core
2022-10-01ManagedCallable: use delegate target instead of middleman when possiblePatrick Dawson
If the delegate target is an Object, the connected signal will be registered in that object instead of the middleman. So when that object is destroyed, the signal will be properly disconnected.
2022-09-30Merge pull request #64784 from yedpodtrzitko/yed/ci-add-mypyRémi Verschelde
ci: add Python static analysis check via mypy
2022-09-30Fix typos with codespellRémi Verschelde
Using codespell 2.3-dev from current git. And fix typo in `methods.py` for `vsproj=yes` option (still won't work though).
2022-09-30ci: add Python static analysis check via mypyJiri Suchan
2022-09-26SCons: Unify tools/target build type configurationRémi Verschelde
Implements https://github.com/godotengine/godot-proposals/issues/3371. New `target` presets ==================== The `tools` option is removed and `target` changes to use three new presets, which match the builds users are familiar with. These targets control the default optimization level and enable editor-specific and debugging code: - `editor`: Replaces `tools=yes target=release_debug`. * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2` - `template_debug`: Replaces `tools=no target=release_debug`. * Defines: `DEBUG_ENABLED`, `-O2`/`/O2` - `template_release`: Replaces `tools=no target=release`. * Defines: `-O3`/`/O2` New `dev_build` option ====================== The previous `target=debug` is now replaced by a separate `dev_build=yes` option, which can be used in combination with either of the three targets, and changes the following: - `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`), enables generating debug symbols, does not define `NDEBUG` so `assert()` works in thirdparty libraries, adds a `.dev` suffix to the binary name. Note: Unlike previously, `dev_build` defaults to off so that users who compile Godot from source get an optimized and small build by default. Engine contributors should now set `dev_build=yes` in their build scripts or IDE configuration manually. Changed binary names ==================== The name of generated binaries and object files are changed too, to follow this format: `godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]` For example: - `godot.linuxbsd.editor.dev.arm64` - `godot.windows.template_release.double.x86_64.mono.exe` Be sure to update your links/scripts/IDE config accordingly. More flexible `optimize` and `debug_symbols` options ==================================================== The optimization level and whether to generate debug symbols can be further specified with the `optimize` and `debug_symbols` options. So the default values listed above for the various `target` and `dev_build` combinations are indicative and can be replaced when compiling, e.g.: `scons p=linuxbsd target=template_debug dev_build=yes optimize=debug` will make a "debug" export template with dev-only code enabled, `-Og` optimization level for GCC/Clang, and debug symbols. Perfect for debugging complex crashes at runtime in an exported project.
2022-09-26Style: Cleanup header guards for consistencyRémi Verschelde
Fix file names for {Static,Lightmap}RaycasterEmbree.
2022-09-25C#: Update Basis Euler angle code to match coreAaron Franke
2022-09-22Merge pull request #66253 from raulsntos/dotnet/assembly-may-be-nullIgnacio Roldán Etcheverry
C#: Guard against null assemblies
2022-09-22C#: Suppress EventHandler suffix diagnostic for signalsRaul Santos
Suppress CA1711 for signal delegates because they are used in events so the naming follows the guidelines.
2022-09-22C#: Guard against null assembliesRaul Santos
A symbol's containing assembly will be null if the symbol is shared across multiple assemblies.
2022-09-22Merge pull request #66110 from Zylann/reference_get_countRémi Verschelde
get_reference_count()`
2022-09-21Rename and expose `RefCounted::get_reference_count()`Marc Gilleron
2022-09-19C#: Rename `PlusFile` to `PathJoin`Raul Santos
2022-09-19Replace File/Directory with FileAccess/DirAccesskobewi
2022-09-19Merge pull request #65879 from magian1127/4.0GenSDocRémi Verschelde
inheritdoc the "///" comment from EventHandler to the generated event
2022-09-18C#: inheritdoc the "///" comment from EventHandler to the generated eventMagian
2022-09-18Merge pull request #44143 from KoBeWi/callable_multiplayerRémi Verschelde
2022-09-18Port remaining connections to callable_mpTomasz Chabora
2022-09-18Merge pull request #65946 from antonWetzel/csharp-nd-arrayRémi Verschelde
Don't marshal multidimensional arrays
2022-09-18Merge pull request #65877 from raulsntos/dotnet/signal-delegate-docsRémi Verschelde
Add documentation to signal delegates
2022-09-17don't marshal multidimensional arraysantonWetzel
2022-09-16Make `push_nupkgs_local` absoluteRaul Santos
Ensures the `push_nupkgs_local` argument in build_assemblies.py is an absolute path so the argument can be given as a relative path and it will be converted.
2022-09-16C#: Add documentation to signal delegatesRaul Santos
2022-09-15Merge pull request #65823 from raulsntos/dotnet/signal-docsIgnacio Roldán Etcheverry
C#: Move signal documentation to the event
2022-09-15C#: Move signal documentation to the eventRaul Santos
Move signal documentation from the delegate to the event and also deprecate the event if the signal is deprecated.
2022-09-15Fix NuGet fallback folder packagesRaul Santos
- Creates a `Godot.Offline.Config` file to configurate NuGet with Godot's fallback folder. This is easier because now we can assume we can override the entire file since user config will likely be in the default `NuGet.Config` file or an additional `*.config` file. - Ensure the NuGet fallback folder is created at the same time it is added to the NuGet configuration so future builds don't fail. - Add `GodotSharp` and `GodotSharpEditor` packages to the fallback folder. - Add `.nupkg.metadata` file to packages in fallback folder. - Refer to `Godot.SourceGenerators` using the specific non-floating version since floating versions don't seem to work with fallbackPackageFolders.
2022-09-14[macOS, .NET] Fix dotnet binary detection.bruvzg
2022-09-09Merge pull request #65533 from neikeq/issue-65522Rémi Verschelde
2022-09-09Merge pull request #64373 from YeldhamDev/edscale_likes_them_floatyRémi Verschelde
2022-09-08Fix MacOS compiler flags in .NET moduleRaul Santos