summaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Make `ImageLoader` take bit field flagsYuri Sizov2022-08-2314-18/+18
|
* Merge pull request #64762 from neikeq/csharp-dangling-callable-codeRémi Verschelde2022-08-232-85/+0
|\
| * C#: Remove old Callable code left dangling after switch to .NET 6Ignacio Roldán Etcheverry2022-08-232-85/+0
| |
* | Merge pull request #64758 from jtnicholl/blend_fbx_warningsRémi Verschelde2022-08-231-9/+16
|\ \
| * | Update messages for missing FBX2glTF, add similar messages for BlenderJonathan Nicholl2022-08-221-9/+16
| | |
* | | Merge pull request #63959 from KoBeWi/typo_arrrayRémi Verschelde2022-08-2312-39/+39
|\ \ \ | | | | | | | | Replace Array return types with TypedArray (part 1)
| * | | Replace Array return types with TypedArraykobewi2022-08-2212-39/+39
| |/ /
* | | Merge pull request #64729 from raulsntos/csharp-xform-operatorRémi Verschelde2022-08-237-181/+292
|\ \ \ | | | | | | | | C#: Replace `Xform` and `XformInv` with `*` operator
| * | | C#: Replace `Xform` and `XformInv` with `*` operatorRaul Santos2022-08-227-181/+292
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In cases where both `Xform`/`XformInv` and the `*` operator were implemented the `Xform`/`XformInv` methods were removed in favor of the `*` operator. - In cases where the `Xform`/`XformInv` existed but not the `*` operator, the `Xform`/`XformInv` methods were replaced with the `*` operator. - In cases where no method existed, a new `*` operator has been implemented to support the same operations that are supported in GDScript. - Fixes the `Transform.Xform` and `Transform.XformInv` with `Rect2` implementation to use a zero `Rect2` size to start expanding from (which is how it's implemented in C++).
* | | | Merge pull request #64744 from bruvzg/fix_mixed_font_color4Rémi Verschelde2022-08-232-2/+2
|\ \ \ \ | |_|_|/ |/| | | [4.x] Fix color modulation of the grayscale glyphs in font with mixed color / grayscale data.
| * | | Fix color modulation of the grayscale glyphs in font with mixed color / ↵bruvzg2022-08-222-2/+2
| | | | | | | | | | | | | | | | grayscale data.
* | | | Merge pull request #64725 from raulsntos/dotnet6-assembly-existsIgnacio Roldán Etcheverry2022-08-231-0/+4
|\ \ \ \ | |_|_|/ |/| | | Avoid trying to load non-existent assembly
| * | | Avoid trying to load non-existent assemblyRaul Santos2022-08-221-0/+4
| | |/ | |/| | | | | | | | | | | | | | | | If the project assembly does not exist, return `false` directly instead of trying to load it. This prevents the `System.InvalidOperationException` thrown for failing to locate managed application.
* | | Merge pull request #59564 from KoBeWi/FINALLY,_ULTIMATE_UNDO_REDORémi Verschelde2022-08-226-16/+18
|\ \ \
| * | | Add per-scene UndoRedokobewi2022-08-226-16/+18
| | |/ | |/|
* | | Merge pull request #64400 from aaronfranke/gltf-fix-cameraRémi Verschelde2022-08-224-62/+80
|\ \ \
| * | | GLTF: Fix orthographic cameras, internally store data in GLTF's formatAaron Franke2022-08-144-62/+80
| | | |
* | | | Merge pull request #64339 from YuriSizov/core-multilevel-validate-propertyRémi Verschelde2022-08-2212-195/+192
|\ \ \ \ | |_|/ / |/| | |
| * | | Make `_validate_property` a multilevel methodYuri Sizov2022-08-2212-195/+192
| | | |
* | | | Merge pull request #64343 from TokageItLab/priority-phRémi Verschelde2022-08-223-0/+23
|\ \ \ \ | |/ / / |/| | |
| * | | Add collision weight to PhysicsBody for penetrations must be avoidedSilc Renew2022-08-183-0/+23
| | | | | | | | | | | | | | | | Co-authored-by: Juan Linietsky <reduzio@gmail.com>
* | | | Merge pull request #64553 from RedMser/fix-property-validation-refactorRémi Verschelde2022-08-223-5/+5
|\ \ \ \
| * | | | Remove unintentional PROPERTY_USAGE_INTERNALRedMser2022-08-183-5/+5
| |/ / / | | | | | | | | | | | | | | | | The flag only matters for property definition, but was also used in _validate_property a lot.
* | | | Merge pull request #57297 from rafallus/orthogonal_indexRémi Verschelde2022-08-225-35/+131
|\ \ \ \ | | | | | | | | | | Expose `Basis::set_orthogonal_index` as a GridMap method
| * | | | Expose Basis `set_orthogonal_index` method as a GridMap functionrafallus2022-08-205-35/+131
| | | | |
* | | | | Merge pull request #37168 from theoway/ChangeNodeTypeDialogYuri Sizov2022-08-221-1/+1
|\ \ \ \ \ | |_|_|_|/ |/| | | | Changed the title of change node type dialog
| * | | | Changed the title of change node type dialogUmang Kalra2022-08-201-1/+1
| |/ / /
* | | | C#: Add module READMEIgnacio Roldán Etcheverry2022-08-221-0/+45
| | | | | | | | | | | | | | | | This should clarify development workflow with the NuGet packages.
* | | | C#: Replace P/Invoke with delegate pointersIgnacio Roldán Etcheverry2022-08-2221-738/+1312
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Moves interop functions to UnmanagedCallbacks struct that contains the function pointers and is passed to C#. - Implements UnmanagedCallbacksGenerator, a C# source generator that generates the UnmanagedCallbacks struct in C# and the body for the NativeFuncs methods (their implementation just calls the function pointer in the UnmanagedCallbacks). The generated methods are needed because .NET pins byref parameters of native calls, even if they are 'ref struct's, which don't need pinning. The generated methods use `Unsafe.AsPointer` so that we can benefit from byref parameters without suffering overhead of pinning. Co-authored-by: Raul Santos <raulsntos@gmail.com>
* | | | C#: Remove IL post-processor build dependencyIgnacio Roldán Etcheverry2022-08-226-111/+403
| | | | | | | | | | | | | | | | | | | | | | | | We were using it to workaround a limitation of `Unsafe.AsPointer` and `ref struct`s. However, we can get the same result with some tricks, since we have control over the declaration of these structs.
* | | | C#: Use custom project setting for C# project files nameIgnacio Roldán Etcheverry2022-08-2210-93/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The setting is initially assigned the name of the Godot project, but it's kept freezed to prevent issues when renaming the Godot project. The user can always rename the C# project and solution manually and change the setting to the new name.
* | | | C#: Re-introduce generic Godot Array and DictionaryIgnacio Roldán Etcheverry2022-08-2213-31/+1792
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new version does not support the following type arguments: - Generic types - Array of Godot Object (Godot.Object[]) or derived types The new implementation uses delegate pointers to call the Variant conversion methods. We do type checking only once in the static constructor to get the conversion delegates. Now, we no longer need to do type checking every time, and we no longer have to box value types. This is the best implementation I could come up with, as C# generics don't support anything similar to C++ template specializations.
* | | | C#: Array, Dictionary and marshaling refactoringIgnacio Roldán Etcheverry2022-08-2230-1723/+766
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Array and Dictionary now store `Variant` instead of `System.Object`. - Removed generic Array and Dictionary. They cause too much issues, heavily relying on reflection and very limited by the lack of a generic specialization. - Removed support for non-Godot collections. Support for them also relied heavily on reflection for marshaling. Support for them will likely be re-introduced in the future, but it will have to rely on source generators instead of reflection. - Reduced our use of reflection. The remaining usages will be moved to source generators soon. The only usage that I'm not sure yet how to replace is dynamic invocation of delegates.
* | | | C#: Add dedicated Variant struct, replacing System.ObjectIgnacio Roldán Etcheverry2022-08-2225-124/+776
| | | |
* | | | C#: Add source generator for method listIgnacio Roldán Etcheverry2022-08-2210-282/+502
| | | |
* | | | C#: Add source generator for signals as eventsIgnacio Roldán Etcheverry2022-08-2231-522/+996
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed the signal declaration signal to: ``` // The following generates a MySignal event [Signal] public delegate void MySignalEventHandler(int param); ```
* | | | C#: Refactor Array & Dictionary interface implementationsIgnacio Roldán Etcheverry2022-08-224-90/+217
| | | |
* | | | C#: Re-implement assembly reloading with ALCsIgnacio Roldán Etcheverry2022-08-2237-557/+1529
| | | |
* | | | C#: Make GodotSharp API a NuGet packageIgnacio Roldán Etcheverry2022-08-2210-40/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the past, the Godot editor distributed the API assemblies and copied them to project directories for projects to reference them. This changed with the move to .NET 5/6. Godot no longer copies the assemblies to project directories. However, the project Sdk still tried to reference them from the same location. From now on, the GodotSharp API is distributed as a NuGet package, which the Sdk can reference. Added an option to `build_assemblies.py` to copy all Godot NuGet packages to an existing local NuGet source. This will be needed during development, while packages are not published to a remote NuGet repository. This option also makes sure to remove packages of the same version installed (~/.nuget/packages). Very useful during development, when packages change, to make sure the package being used by a project is the same we just built and not one from a previous build. A local NuGet source can be created like this: ``` mkdir ~/MyLocalNuGetSource && \ dotnet nuget add source ~/MyLocalNuGetSource/ -n MyLocalNuGetSource ```
* | | | C#: Initial NativeAOT supportIgnacio Roldán Etcheverry2022-08-2210-54/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds initial support for games exported as NativeAOT shared libraries. At this moment, the NativeAOT runtime is experimental. Additionally, Godot is not trim-safe as it still makes some use of reflection. For the time being, a rd.xml file is needed to prevent code triming: ``` <Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> <Application> <Assembly Name="GodotSharp" Dynamic="Required All" /> <Assembly Name="GAME_ASSEMBLY" Dynamic="Required All" /> </Application> </Directives> ``` These are the csproj changes for publishing: ``` <PropertyGroup> <NativeLib>Shared</NativeLib> </PropertyGroup> <ItemGroup> <RdXmlFile Include="rd.xml" /> <PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-*" /> </ItemGroup> ``` More info: - https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/compiling.md - https://github.com/dotnet/runtimelab/tree/feature/NativeAOT/samples/NativeLibrary - https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/rd-xml-format.md
* | | | C#: Upgrade to .NET 6 (5.0 -> 6.0)Ignacio Roldán Etcheverry2022-08-2237-352/+231
| | | |
* | | | C#: Static marshaling for bindings and source generatorsIgnacio Roldán Etcheverry2022-08-2214-356/+1009
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we added source generators for invoking/accessing methods, properties and fields in scripts. This freed us from the overhead of reflection. However, the generated code still used our dynamic marshaling functions, which do runtime type checking and box value types. This commit changes the bindings and source generators to include 'static' marshaling. Based on the types known at compile time, now we generate the appropriate marshaling call for each type.
* | | | C#: Re-introduce exception logging and error stack traces in editorIgnacio Roldán Etcheverry2022-08-2220-228/+310
| | | | | | | | | | | | | | | | | | | | These two had been disabled while moving to .NET 5, as the previous implementation relied on Mono embedding APIs.
* | | | C#: Ensure we only create one CSharpScript per typeIgnacio Roldán Etcheverry2022-08-229-136/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, for each scripts class instance that was created from code rather than by the engine, we were constructing, configuring and assigning a new CSharpScript. This has changed now and we make sure there's only one CSharpScript associated to each type.
* | | | C#: Add source generator for properties and exports default valuesIgnacio Roldán Etcheverry2022-08-2234-766/+2175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The editor no longer needs to create temporary instances to get the default values. The initializer values of the exported properties are still evaluated at runtime. For example, in the following example, `GetInitialValue()` will be called when first looks for default values: ``` [Export] int MyValue = GetInitialValue(); ``` Exporting fields with a non-supported type now results in a compiler error rather than a runtime error when the script is used.
* | | | C#/netcore: Add base desktop game export implementationIgnacio Roldán Etcheverry2022-08-2251-1192/+1536
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This base implementation is still very barebones but it defines the path for how exporting will work (at least when embedding the .NET runtime). Many manual steps are still needed, which should be automatized in the future. For example, in addition to the API assemblies, now you also need to copy the GodotPlugins assembly to each game project.
* | | | C#: Ensure native handles are freed after switch to .NET CoreIgnacio Roldán Etcheverry2022-08-2215-32/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Finalizers are longer guaranteed to be called on exit now that we switched to .NET Core. This results in native instances leaking. The only solution I can think of so far is to keep a list of all instances alive to dispose when the AssemblyLoadContext.Unloading event is raised.
* | | | C#: Add initial implementation of source generator for script membersIgnacio Roldán Etcheverry2022-08-2220-189/+908
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the way we invoke methods and set/get properties. This first iteration rids us of runtime type checking in those cases, as it's now done at compile time. Later it will also stop needing the use of reflection. After that, we will only depend on reflection for generic Godot Array and Dictionary. We're stuck with reflection in generic collections for now as C# doesn't support generic/template specialization. This is only the initial implementation. Further iterations are coming, specially once we switch to the native extension system which completely changes the way members are accessed/invoked. For example, with the native extension system we will likely need to create `UnmanagedCallersOnly` invoke wrapper methods and return function pointers to the engine. Other kind of members, like event signals will be receiving the same treatment in the future.
* | | | C#: Code cleanup and greatly reduce use of C# pointersIgnacio Roldán Etcheverry2022-08-2251-1334/+2182
| | | |
* | | | Fix detection of .NET Sdk from snap and allow higher versionsIgnacio Roldán Etcheverry2022-08-221-17/+60
| | | |