summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-08-22Merge pull request #64711 from YeldhamDev/itemlist_scroll_fixRémi Verschelde
2022-08-22Merge pull request #64642 from aaronfranke/mesh-cleanupRémi Verschelde
2022-08-22Merge pull request #64618 from bruvzg/fix_menu_min_sizeRémi Verschelde
2022-08-22Merge pull request #63602 from TokageItLab/cubic-interp-timeRémi Verschelde
2022-08-22Merge pull request #63486 from TokageItLab/init-posesRémi Verschelde
2022-08-22Merge pull request #64343 from TokageItLab/priority-phRémi Verschelde
2022-08-22Merge pull request #64462 from and3rson/convert3to4-fix-connect-argsRémi Verschelde
2022-08-22Merge pull request #64553 from RedMser/fix-property-validation-refactorRémi Verschelde
2022-08-22Merge pull request #57297 from rafallus/orthogonal_indexRémi Verschelde
Expose `Basis::set_orthogonal_index` as a GridMap method
2022-08-22Merge pull request #64496 from KoBeWi/proxXxiesYuri Sizov
Use false as default for use_proxies argument
2022-08-22Merge pull request #64694 from Mickeon/fix-settings-functionYuri Sizov
Properly refer to functions definition color in description
2022-08-22Merge pull request #37168 from theoway/ChangeNodeTypeDialogYuri Sizov
Changed the title of change node type dialog
2022-08-22Merge pull request #64670 from Mickeon/fix-label-visibile-percentYuri Sizov
Clamp Label's `percent_visible` properly between 0 and 1.0
2022-08-22Use false as default for use_proxies argumentkobewi
2022-08-22Merge pull request #54549 from KoBeWi/fastcellsYuri Sizov
Add a method to get TileData from a cell
2022-08-22Merge pull request #64385 from paulloz/raycast-collider-ridRémi Verschelde
2022-08-22Clamp Label's `percent_visible` properly between 0 and 1.0Micky
Also applies to RichTextLabel
2022-08-22Merge pull request #64089 from neikeq/dotnet6Rémi Verschelde
2022-08-22Merge pull request #64656 from Erveon/patch-1Yuri Rubinsky
2022-08-22Expose the collider RID in Raycast nodesPaul Joannon
Create and expose the method `get_collider_rid` in `RayCast2D` and `Raycast3D`. This method returns the `RID` of the first object that the ray intersects, or an empty `RID` if no object is intersecting the fay (i.e. `is_colliding` returns `false`).
2022-08-22C#: Add module READMEIgnacio Roldán Etcheverry
This should clarify development workflow with the NuGet packages.
2022-08-22C#: Replace P/Invoke with delegate pointersIgnacio Roldán Etcheverry
- 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>
2022-08-22C#: Remove IL post-processor build dependencyIgnacio Roldán Etcheverry
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.
2022-08-22C#: Use custom project setting for C# project files nameIgnacio Roldán Etcheverry
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.
2022-08-22C#: Re-introduce generic Godot Array and DictionaryIgnacio Roldán Etcheverry
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.
2022-08-22C#: Array, Dictionary and marshaling refactoringIgnacio Roldán Etcheverry
- 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.
2022-08-22C#: Add dedicated Variant struct, replacing System.ObjectIgnacio Roldán Etcheverry
2022-08-22C#: Add source generator for method listIgnacio Roldán Etcheverry
2022-08-22C#: Add source generator for signals as eventsIgnacio Roldán Etcheverry
Changed the signal declaration signal to: ``` // The following generates a MySignal event [Signal] public delegate void MySignalEventHandler(int param); ```
2022-08-22C#: Refactor Array & Dictionary interface implementationsIgnacio Roldán Etcheverry
2022-08-22C#: Re-implement assembly reloading with ALCsIgnacio Roldán Etcheverry
2022-08-22C#: Make GodotSharp API a NuGet packageIgnacio Roldán Etcheverry
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 ```
2022-08-22C#: Initial NativeAOT supportIgnacio Roldán Etcheverry
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
2022-08-22C#: Upgrade to .NET 6 (5.0 -> 6.0)Ignacio Roldán Etcheverry
2022-08-22C#: Static marshaling for bindings and source generatorsIgnacio Roldán Etcheverry
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.
2022-08-22C#: Re-introduce exception logging and error stack traces in editorIgnacio Roldán Etcheverry
These two had been disabled while moving to .NET 5, as the previous implementation relied on Mono embedding APIs.
2022-08-22C#: Ensure we only create one CSharpScript per typeIgnacio Roldán Etcheverry
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.
2022-08-22C#: Add source generator for properties and exports default valuesIgnacio Roldán Etcheverry
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.
2022-08-22C#/netcore: Add base desktop game export implementationIgnacio Roldán Etcheverry
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.
2022-08-22C#: Ensure native handles are freed after switch to .NET CoreIgnacio Roldán Etcheverry
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.
2022-08-22C#: Add initial implementation of source generator for script membersIgnacio Roldán Etcheverry
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.
2022-08-22C#: Code cleanup and greatly reduce use of C# pointersIgnacio Roldán Etcheverry
2022-08-22CI: Setup .NET Sdk to fix CI and build C# code as wellIgnacio Roldán Etcheverry
2022-08-22Fix detection of .NET Sdk from snap and allow higher versionsIgnacio Roldán Etcheverry
2022-08-22C#: Fallback to `dotnet --info` to determine .NET RIDIgnacio Roldán Etcheverry
Some Linux distros use their distro name as the RID for directory names. If the .NET Host directory cannot be found with the generic RID, try to get the rid from `dotnet --info`. The generic RID should still be the first choice. Some platforms like Windows 10 define the RID as `win10-x64` but still use the generic `win-x64` for directory names. Co-authored-by: Lewis James <lewiji+github@gmail.com>
2022-08-22C#: Begin move to .NET CoreIgnacio Roldán Etcheverry
We're targeting .NET 5 for now to make development easier while .NET 6 is not yet released. TEMPORARY REGRESSIONS --------------------- Assembly unloading is not implemented yet. As such, many Godot resources are leaked at exit. This will be re-implemented later together with assembly hot-reloading.
2022-08-22C#: Restructure code prior move to .NET CoreIgnacio Roldán Etcheverry
The main focus here was to remove the majority of code that relied on Mono's embedding APIs, specially the reflection APIs. The embedding APIs we still use are the bare minimum we need for things to work. A lot of code was moved to C#. We no longer deal with any managed objects (`MonoObject*`, and such) in native code, and all marshaling is done in C#. The reason for restructuring the code and move away from embedding APIs is that once we move to .NET Core, we will be limited by the much more minimal .NET hosting. PERFORMANCE REGRESSIONS ----------------------- Some parts of the code were written with little to no concern about performance. This includes code that calls into script methods and accesses script fields, properties and events. The reason for this is that all of that will be moved to source generators, so any work prior to that would be a waste of time. DISABLED FEATURES ----------------- Some code was removed as it no longer makes sense (or won't make sense in the future). Other parts were commented out with `#if 0`s and TODO warnings because it doesn't make much sense to work on them yet as those parts will change heavily when we switch to .NET Core but also when we start introducing source generators. As such, the following features were disabled temporarily: - Assembly-reloading (will be done with ALCs in .NET Core). - Properties/fields exports and script method listing (will be handled by source generators in the future). - Exception logging in the editor and stack info for errors. - Exporting games. - Building of C# projects. We no longer copy the Godot API assemblies to the project directory, so MSBuild won't be able to find them. The idea is to turn them into NuGet packages in the future, which could also be obtained from local NuGet sources during development.
2022-08-22C#: Re-write GD and some other icalls as P/InvokeIgnacio Roldán Etcheverry
2022-08-22C#: Re-write Array, Dictionary, NodePath, String icalls as P/InvokeIgnacio Roldán Etcheverry
2022-08-22C#: Remove DynamicGodotObject/Object.DynamicObjectIgnacio Roldán Etcheverry
We are moving in the direction of no dynamic code generation, so this is no longer desired. The feature can still be easily implemented by any project that still want it.