summaryrefslogtreecommitdiffstats
path: root/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample
Commit message (Collapse)AuthorAgeFilesLines
* Dotnet: Fix attributes for `sln`/`csproj` filesThaddeus Crews2024-05-031-1/+1
|
* Fix interpolated strings in ScriptPropertyDefValPaul Joannon2024-03-011-0/+26
|
* Cleanup C# projects, code quality & stylePaul Joannon2024-02-2713-168/+168
| | | | | | | | | | | | | | | | | | | | | New rules: - Do not silence CA1805 any more - Limit where we silence CA1707, CA1711, CA1720 - Enforce severity=warning for IDE0040 - Enforce Allman style braces - Enforce naming conventions (IDE1006 is still severity=suggestion) Fixes: - Fix REFL045, CS1572, CS1573 - Suppress CS0618 when generating `InvokeGodotClassMethod` - Fix indent when generating GD_constants.cs - Temporarily silence CS1734 in generated code - Fix a lot of naming rule violations Misc.: - Remove ReSharper comments for RedundantNameQualifier - Remove suppression attributes for RedundantNameQualifier - Remove severity=warnings for CA1716, CA1304 (already included in the level of analysis we run)
* C#: Various fixes to generic scriptsRaul Santos2024-02-193-11/+19
| | | | | | - Report a diagnostic when there are multiple classes that match the script file name in the same script since that will result in a duplicate path key in the bimap and it's not allowed. - Fix InspectorPlugin to handle empty paths in case the project was built with a previous version of Godot that used empty paths for generic scripts. - Add tests for the new diagnostic GD0003.
* C#: Fix to allow usage of [MustBeVariant] in generic typed attributesAlberto Vilches2024-01-211-2/+492
|
* C# Add test suite for Diagnostic Analyzers: GlobalClass and MustBeVariantAlberto Vilches2024-01-153-0/+179
|
* C#: Fix generated nested class orderRaul Santos2023-10-181-0/+22
|
* Allow readonly and writeonly C# properties to be accessed from GDScriptWilliam Scalf2023-08-133-0/+33
|
* C#: Fix building projects for MSBuild before 17.3RedworkDE2023-03-061-1/+1
|
* C#: Encode GodotProjectDir as Base64 to prevent issues with special charactersRaul Santos2023-03-041-0/+1
|
* C#: Rename `Object` to `GodotObject`Raul Santos2023-01-278-15/+15
|
* C#: Renames to follow .NET naming conventionsRaul Santos2023-01-272-14/+14
| | | | Renamed C# types and members to use PascalCase and follow .NET naming conventions.
* Fix typos with codespellRémi Verschelde2022-12-151-1/+1
|
* C#: Rename SignalInfo to Signal and make awaitableRaul Santos2022-12-122-2/+2
|
* C#: Fix Generated ScriptProperty Error.Magian2022-11-271-0/+89
| | | | | 1. Add "this." to prevent errors caused by duplicate variable names. 2. Try to find the default value of property getters.
* Fully qualify C# default values in exported fields.R. Alex Hofer2022-11-222-0/+24
| | | | | This avoids issues when the default values rely on using namespaces.
* C#: Assume 64-bit types when type has no metaRaul Santos2022-09-011-1/+1
| | | | | | | When the C# bindings generator finds a type without meta assume the type refers to the 64-bit version of the type: - `float` is converted to `double` - `int` is converted to `long`
* Fix C# style with `dotnet format`Raul Santos2022-08-272-8/+16
|
* C#: Re-introduce generic Godot Array and DictionaryIgnacio Roldán Etcheverry2022-08-222-0/+12
| | | | | | | | | | | | | | | 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-222-64/+6
| | | | | | | | | | | | | | | - 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-223-5/+3
|
* C#: Add source generator for method listIgnacio Roldán Etcheverry2022-08-221-0/+31
|
* C#: Add source generator for signals as eventsIgnacio Roldán Etcheverry2022-08-221-0/+7
| | | | | | | | | Changed the signal declaration signal to: ``` // The following generates a MySignal event [Signal] public delegate void MySignalEventHandler(int param); ```
* C#: Upgrade to .NET 6 (5.0 -> 6.0)Ignacio Roldán Etcheverry2022-08-221-1/+1
|
* C#: Add source generator for properties and exports default valuesIgnacio Roldán Etcheverry2022-08-225-1/+274
| | | | | | | | | | | | | | 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-221-1/+16
| | | | | | | | | 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#: Add initial implementation of source generator for script membersIgnacio Roldán Etcheverry2022-08-221-0/+21
| | | | | | | | | | | | | | | | | | | | 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#: Begin move to .NET CoreIgnacio Roldán Etcheverry2022-08-221-1/+1
| | | | | | | | | | | | 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.
* Fix Godot.SourceGenerators for generic classesRaul Santos2021-12-051-0/+16
| | | | | Fix invalid C# generated by source generators for generic classes and add generic classes to the Sample project for testing.
* Add C# source generator for a new ScriptPath attributeIgnacio Etcheverry2021-03-063-0/+57
This source generator adds a newly introduced attribute, `ScriptPath` to all classes that: - Are top-level classes (not inner/nested). - Have the `partial` modifier. - Inherit `Godot.Object`. - The class name matches the file name. A build error is thrown if the generator finds a class that meets these conditions but is not declared `partial`, unless the class is annotated with the `DisableGodotGenerators` attribute. We also generate an `AssemblyHasScripts` assembly attribute which Godot uses to get all the script classes in the assembly, eliminating the need for Godot to search them. We can also avoid searching in assemblies that don't have this attribute. This will be good for performance in the future once we support multiple assemblies with Godot script classes. This is an example of what the generated code looks like: ``` using Godot; namespace Foo { [ScriptPathAttribute("res://Player.cs")] // Multiple partial declarations are allowed [ScriptPathAttribute("res://Foo/Player.cs")] partial class Player {} } [assembly:AssemblyHasScripts(new System.Type[] { typeof(Foo.Player) })] ``` The new attributes replace script metadata which we were generating by determining the namespace of script classes with a very simple parser. This fixes several issues with the old approach related to parser errors and conditional compilation. It also makes the task part of the MSBuild project build, rather than a separate step executed by the Godot editor.