Commit graph

1933 commits

Author SHA1 Message Date
RedworkDE
fce8a05b58 C#: Fix internal source generator on the 7.0.200 SDK 2023-02-16 11:25:47 +01:00
Raul Santos
d57cb460e2
C#: Open the solution directory when using VSCode
The solution directory used to be the same as the project
directory (`res://`). We now allow specifying a different
path for the solution and the other external editors already
use that (which seems more convenient for multi-project
scenarios).
2023-02-15 20:13:40 +01:00
Rémi Verschelde
49e8a2fb66
Merge pull request #73026 from SirUppyPancakes/sync-context-send
Implement GodotSynchronizationContext.Send
2023-02-12 22:34:18 +01:00
Caleb Kemper
103cb4bee6 Implement GodotSynchronizationContext.Send 2023-02-12 14:12:09 -07:00
Raul Santos
2a1523d751
Build C# csproj instead of the solution 2023-02-10 03:19:30 +01:00
Rémi Verschelde
b53c4dda62
Merge pull request #72849 from RedworkDE/net-export-settings
C#: Rename export settings `mono` -> `dotnet` and remove unused AOT settings
2023-02-08 09:32:41 +01:00
RedworkDE
bf47b62203 C#: Rename export settings mono -> dotnet and remove unused AOT settings 2023-02-07 18:20:23 +01:00
Paul Joannon
c70c82b0fb
Try and match MSBuild and Godot UI languages 2023-02-07 16:48:23 +01:00
Paul Joannon
9bf2a0bcda
Add new settings about MSBuild
- toggle creation of binary logs
- manage log verbosity
- toggle logging in console
2023-02-07 16:48:23 +01:00
Paul Joannon
7cf42dbdee
Add button to open the msbuild logs folder 2023-02-07 16:48:23 +01:00
Paul Joannon
e51a20b714
Rename existing editor settings mono -> dotnet 2023-02-07 16:48:18 +01:00
RedworkDE
fb0adaff9f C#: Fix AppContext.BaseDirectory 2023-02-04 14:35:11 +01:00
Rémi Verschelde
bbff9fd7a4
Merge pull request #71786 from raulsntos/dotnet/array
Sync C# Array with Core
2023-02-04 00:24:06 +01:00
Rémi Verschelde
1ff2204cfe
Merge pull request #72554 from RedworkDE/net-appcontext-basedirectory
C#: Set AppContext.BaseDirectory for editor builds
2023-02-03 15:35:29 +01:00
Rémi Verschelde
5a413894fc
Merge pull request #72635 from RedworkDE/net-nodepath-iequatable
C#: Implement `IEquatable<>` and equality operators in `NodePath`
2023-02-03 15:35:22 +01:00
RedworkDE
ac96af1cc9 C#: Declare IEquatable<> interface for StringName 2023-02-03 00:26:18 +01:00
RedworkDE
7403a3a11b C#: Implement IEquatable<> and equality operators in NodePath
- Implement `IEquatable<>` interface.
- Implement `==` and `!=` operators.
- Override `Equals` and `GetHashCode`.
2023-02-03 00:25:48 +01:00
RedworkDE
b9d1462d2a C#: Set AppContext.BaseDirectory for editor builds 2023-02-02 15:05:11 +01:00
Rémi Verschelde
c5c6f2db89
Merge pull request #72553 from RedworkDE/net-output-directory
C#: Preserve directories in output during export
2023-02-02 13:59:05 +01:00
Rémi Verschelde
0a9e6e478e
Merge pull request #71800 from akien-mga/ci-codespell-action
CI: Add official codespell action with PR annotations
2023-02-01 13:25:23 +01:00
Rémi Verschelde
c461d3880f
Merge pull request #72434 from Treer/master
Qualify Console's namespace to avoid mixup with plugin's objects
2023-02-01 13:24:47 +01:00
Rémi Verschelde
e52213e2fa
More codespell fixes, do more changes from previous ignore list 2023-02-01 12:11:36 +01:00
RedworkDE
70ebb6378c C#: Preserve directories in output during export 2023-02-01 00:37:12 +01:00
Treer
086ce855a8
Update modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
2023-02-01 07:56:20 +11:00
Raul Santos
7eb8325180
Fix C# examples in documentation
- Fix documentation after C# renames.
- Add missing `partial` in C# class declarations.
- Change `delta` parameter type to `double` in C#.
- Ensure parameters match base declaration.
- Use `$` string interpolation in C#.
- Fix invalid or outdated C# code.
- Changed some examples to follow our style guide more closely.
2023-01-31 19:04:07 +01:00
Treer
273df44e1d Qualify Console's namespace to avoid mixup with plugin's objects
Avoid error when a plugin contains a class called "Console":
Godot.SourceGenerators\Godot.SourceGenerators.GodotPluginsInitializerGenerator\GodotPlugins.Game.generated.cs(32,25): error CS0117: 'Console' does not contain a definition for 'Error'
2023-01-31 16:23:17 +11:00
Raul Santos
8166568976
C#: Implement IEquatable in Rid
- Implement `IEquatable` interface.
- Implement `==` and `!=` operators.
- Add `IsValid` method.
- Override `Equals` and `GetHashCode`.
- Fix `ToString` to follow Core.
- Sync documentation with Core.
2023-01-31 04:44:18 +01:00
Rémi Verschelde
312011fade
Fix various typos with codespell
And include #72377.

Co-authored-by: Wiktor Kocielski <withaust@gmail.com>
2023-01-30 14:22:47 +01:00
Rémi Verschelde
ab70b6ca8a
Merge pull request #72325 from raulsntos/dotnet/fix-72321
C#: Fix `Rotated` and `RotatedLocal`
2023-01-30 13:35:34 +01:00
Raul Santos
54f8fb010c
Sync C# Array with Core
- Add `AddRange` method.
- Add `Fill` method.
- Add `Max` and `Min` methods.
- Add `PickRandom` method.
- Add `Reverse` method.
- Add `RecursiveEqual` method.
- Add `Sort` method.
- Add `Slice` and `GetSliceRange` methods.
- Add `IndexOf` overload that takes an index parameter.
- Add `LastIndexOf` method.
- Add `BinarySearch` method.
- Add/update documentation.
2023-01-30 05:41:53 +01:00
Raul Santos
cc80dda408
C#: Fix Rotated and RotatedLocal
Implementation was interchanged.
2023-01-29 18:43:54 +01:00
Raul Santos
2ef9e2933a
C#: Add Skew to Transform2D and fix InterpolateWith
- Add `Skew` property to `Transform2D`.
- Fix `InterpolateWith` in `Transform2D` to support skewed transforms.
2023-01-29 16:24:41 +01:00
Rémi Verschelde
80f59aa3d9
Merge pull request #72205 from raulsntos/dotnet/proxy-class
Fix lookup of C# types by their engine name
2023-01-28 15:41:28 +01:00
Rémi Verschelde
092bbfc2ea
Merge pull request #71992 from raulsntos/dotnet/rect-alt
C#: Remove `GetArea` and `GetVolume` methods
2023-01-28 15:41:04 +01:00
Raul Santos
65d0d05fa7
Fix lookup of C# types by their engine name 2023-01-27 21:28:15 +01:00
Rémi Verschelde
3c9b7ec26b
Merge pull request #72182 from raulsntos/dotnet/remove-obsolete-stringextensions
C#: Remove obsolete StringExtensions methods
2023-01-27 19:26:39 +01:00
Rémi Verschelde
6462e54acc
Merge pull request #71986 from raulsntos/dotnet/readonly-collections
C#: Implement readonly-ness in Array and Dictionary
2023-01-27 19:26:35 +01:00
Raul Santos
b3af6141a2
C#: Remove GetArea and GetVolume methods
- Remove `GetArea` method in favor of the `Area` property in Rect2{i}.
- Replace `GetVolume` method with a `Volume` property in AABB.
2023-01-27 18:53:23 +01:00
Raul Santos
15066948d7
C#: Remove obsolete StringExtensions methods 2023-01-27 17:15:23 +01:00
Rémi Verschelde
2b55ac445b
Merge pull request #72111 from raulsntos/method-info-metadata
Add `GodotTypeInfo::Metadata` to `MethodInfo`
2023-01-27 15:41:38 +01:00
Raul Santos
1aa54141e6
C#: Implement readonly-ness in Array and Dictionary
- Expose `IsReadOnly` and add `MakeReadOnly` method.
2023-01-27 15:25:34 +01:00
Rémi Verschelde
bd1df0f2e3
Merge pull request #71943 from paulloz/debugger/better-errors-printing
Better error display in debugger panel
2023-01-27 10:32:38 +01:00
Paul Joannon
c93eec4139
Better error display in debugger panel
- Use the right stack frame info as title of the error.
- Use the actual C# exception type as error for exceptions raised from C#.
- Show the right language instead of always **C++ Error**.
2023-01-27 10:01:55 +01:00
Raul Santos
1aceacaa6b
C#: Rename Object to GodotObject 2023-01-27 02:04:18 +01:00
Raul Santos
a968e51414
C#: Renames to follow .NET naming conventions
Renamed C# types and members to use PascalCase and follow .NET naming conventions.
2023-01-27 02:04:17 +01:00
Raul Santos
4788cb35c1
C#: Add global namespace to grouping property info 2023-01-27 01:15:19 +01:00
Rémi Verschelde
2edef2a795
Merge pull request #71825 from RedworkDE/net6-roll-forward
C#: Allow use of .NET 7
2023-01-27 00:13:54 +01:00
Rémi Verschelde
0d1b5f8832
Merge pull request #71356 from raulsntos/dotnet/get
C#: Lookup signals and methods in Get method
2023-01-27 00:13:13 +01:00
Rémi Verschelde
4f572d1587
Merge pull request #71535 from raulsntos/dotnet/pointers-are-yabai
C#: Skip methods with pointer parameters
2023-01-26 23:44:28 +01:00
Rémi Verschelde
fdd3613de1
Merge pull request #71984 from raulsntos/dotnet/dictionary
Sync C# Dictionary with Core
2023-01-26 23:44:01 +01:00
Rémi Verschelde
239145d9cb
Merge pull request #71946 from raulsntos/dotnet/gd
C#: Sync GD with Core
2023-01-26 23:43:36 +01:00
Rémi Verschelde
bacf594a49
Merge pull request #71583 from raulsntos/dotnet/math
C#: Add float an double overloads to Mathf
2023-01-26 23:43:11 +01:00
Rémi Verschelde
c53066682b
Merge pull request #71787 from raulsntos/dotnet/restore-properties
C#: Restore `Scale` and `Rotation` properties
2023-01-26 23:42:46 +01:00
Rémi Verschelde
fdd02b8827
Merge pull request #71988 from raulsntos/🦭-attributes
Seal C# attributes
2023-01-26 23:42:21 +01:00
Rémi Verschelde
0f840cb214
Merge pull request #72053 from raulsntos/dotnet/sync-context-dispose
C#: Implement disposable pattern and seal `GodotSynchronizationContext` class and related
2023-01-26 23:41:52 +01:00
Rémi Verschelde
63b5adf8a8
Merge pull request #72057 from raulsntos/dotnet/fix-must-be-variant
C#: Annotate API with `[MustBeVariant]`
2023-01-26 23:00:30 +01:00
Rémi Verschelde
2aa532ad6c
Merge pull request #65529 from magian1127/4.0FixDocTag
C# Improve the "Tag" conversion of documents
2023-01-26 22:58:26 +01:00
Raul Santos
cac7a784d6
Add GodotTypeInfo::Metadata to MethodInfo 2023-01-26 15:51:34 +01:00
Raul Santos
256632a07e
C#: Skip documentation syntax in MustBeVariant analyzer 2023-01-25 17:29:08 +01:00
Raul Santos
0a0c730805
C#: Annotate API with MustBeVariant
- Add MustBeVariant attribute to generic parameters that are used in a Variant context
2023-01-25 17:28:59 +01:00
Raul Santos
fc72604bef
C#: Implement disposable pattern and seal GodotSynchronizationContext class and related
- `GodotSynchronizationContext`
  - Implements `IDisposable` to dispose of the disposable field `_queue`.
  - Makes the class sealed.
- `GodotTaskScheduler`
  - Implements `IDisposable` to dispose of the disposable property `Context`.
  - Makes the class sealed.
- `Dispatcher`
  - Dispose of previous `GodotTaskScheduler` instances before creating a new one.
2023-01-25 17:04:41 +01:00
Aaron Franke
2a65f6812b
Add PROPERTY_USAGE_NEVER_DUPLICATE flag and use for script
Co-authored-by: Yakov Borevich <j.borevich@gmail.com>
2023-01-24 16:37:50 -06:00
Aaron Franke
2bc0bcbd26
PropertyUsage: Rename "DO_NOT_SHARE_ON_DUPLICATE" to "ALWAYS_DUPLICATE" 2023-01-24 16:05:07 -06:00
Raul Santos
47ca2f2e09
C#: Sync GD with Core
- Add overloads to print methods that take a single `string`.
- Use `StringBuilder` to append print parameters.
- Remove `PrintStack` method.
- Add `ErrorString`.
- Remove `Str` method.
- Add exception to `Range` when step is 0.
- Add `VarToBytesWithObjects` and `BytesToVarWithObjects`.
- Remove optional boolean parameter from `VarToBytes` and `BytesToVar`.
- Move `InstanceFromId` to `Godot.Object`.
- Add `Godot.Object.IsInstanceIdValid`.
- Update documentation.
2023-01-24 19:18:38 +01:00
Raul Santos
e7b719b7ec
Seal C# attributes 2023-01-24 18:42:25 +01:00
Raul Santos
95ef4dc84f
Sync C# Dictionary with Core
- Implement `ICollection` methods explicitly.
- Add `Merge` method.
- Add `RecursiveEqual` method.
- Update documentation.
2023-01-24 17:19:52 +01:00
Raul Santos
8b07f95ba0
C#: Add float an double overloads to Mathf
- Add `float` and `double` overloads to all methods of `Mathf`.
This allows the methods to be usable with `float`, `double` or `real_t`.
- Use `System.MathF` in the `float` overloads which may result in
better performance.
- Constants remain as `real_t` for the time being.
- Add aggresive inlining for methods that wrap `System.Math` calls.
2023-01-24 15:01:26 +01:00
Magian
35bfce2afd C# Improve the "Tag" conversion of documents
[codeblocks] for Keep only the [CSharp] part.
[param] is changed to <c>.
[b] for bold text.
[i] for italic text.
4.0 now uses variant, so [variant] to <see cref="Godot.Variant"/>.
since Rider does not support [u], only comments have been modified.
2023-01-24 18:40:48 +08:00
Raul Santos
b29193945d
C#: Move LinearToDb and DbToLinear to Mathf 2023-01-23 20:20:54 +01:00
Rémi Verschelde
5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
RedworkDE
3f1241cb82 C#: Allow use of .NET 7
The editor will use .NET 7 if it is installed and fall back to .NET 6 otherwise.
Exported projects will use .NET 7 or .NET 6 depending on the value of TargetFramework in the csproj.
2023-01-21 23:11:37 +01:00
Juan Linietsky
dddd8d43f6 Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.

Properly fixes #66179. Supersedes #66215 and supersedes #62417

**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
2023-01-21 14:19:27 +01:00
Raul Santos
04996df61e
C#: Restore Scale and Rotation properties 2023-01-21 04:59:13 +01:00
Rémi Verschelde
5dd3a6dbe2
Merge pull request #71638 from raulsntos/dotnet/export-plugin
C#: Implement `ExportPlugin::_get_name` and move `GLOBAL_DEF` to CSharpLanguage
2023-01-18 22:29:37 +01:00
Raul Santos
3425d43fed
C#: Move GLOBAL_DEFs to CSharpLanguage ctor
Also documents the .NET project settings.
2023-01-18 21:53:58 +01:00
Raul Santos
62106fe5e3
C#: Implement ExportPlugin::_get_name 2023-01-18 18:17:38 +01:00
Raul Santos
4bdcfe1443
Sync C# vectors with Core
- Remove `Vector2.Lerp` overload that takes a weight parameter of type `Vector2`.
- Remove `Vector3.Lerp` overload that takes a weight parameter of type `Vector3`.
- Remove `Color.Lerp` overload that takes a weight parameter of type `Color`.
- Remove `Angle` method from `Vector2i`.
- Remove `AngleTo` method from `Vector2i`.
- Remove `AngleToPoint` method from `Vector2i`.
- Remove `Cross` method from `Vector2i`.
- Remove `DistanceSquaredTo` method from `Vector2i` and `Vector3i`.
- Remove `DistanceTo` method from `Vector2i` and `Vector3i`.
- Remove `Dot` method from `Vector2i` and `Vector3i`.
- Remove `PosMod` method from `Vector2i` and `Vector3i`.
- Remove `Orthogonal` method from `Vector2i`.
- Remove `&` operator from `Vector2i` and `Vector3i`.
2023-01-17 18:07:33 +01:00
Rémi Verschelde
3a53990e9c
Merge pull request #71516 from raulsntos/dotnet/property-accessors
C#: Make property accessors internal
2023-01-17 17:30:49 +01:00
Raul Santos
ab5e532f1a
C#: Skip methods with pointer parameters 2023-01-17 04:32:05 +01:00
Raul Santos
47e355f965
C#: Make property accessors internal 2023-01-16 15:15:26 +01:00
Raul Santos
0ccb5f3954
C#: Implement Mathf.SinCos
Implement `Mathf.SinCos` that wraps a call to `System.Math.SinCos`,
this allows us to use the `SinCos` method more conveniently with
`real_t`.

Using `Math.SinCos` is often cheaper than separate calls to `Math.Sin`
and `Math.Cos`, and they are often used together.
2023-01-16 13:29:32 +01:00
Rémi Verschelde
ba551727ef
Merge pull request #71458 from raulsntos/dotnet/quaternion
C#: Make `Length` and `LengthSquared` into methods in `Quaternion`.
2023-01-16 09:20:53 +01:00
Rémi Verschelde
88c81bfbe5
Merge pull request #71456 from raulsntos/dotnet/sync-plane
C#: Sync `Plane` with Core
2023-01-16 09:20:30 +01:00
Rémi Verschelde
94312ab943
Merge pull request #71445 from raulsntos/dotnet/transforms
C#: Add missing `Transform{2D,3D}` and `Basis` constructors
2023-01-16 09:20:07 +01:00
Raul Santos
7a19c87c7e
C#: Sync Plane with Core
- Add `Plane(Vector3)` constructor.
- Rename `IntersectRay` to `IntersectsRay`.
- Rename `IntersectSegment` to `IntersectsSegment`.
- Replace `Center` property with `GetCenter` method.
- Add and fix documentation about the _normal_ parameter
to Core and C# documentation.
2023-01-15 19:47:42 +01:00
Raul Santos
5136366112
C#: Add missing Transform{2D,3D} and Basis constructors
- Remove `Transform3D(Quaternion, Vector3)` constructor from C#.
- Add `Transform3D(Projection)` constructor to C#.
- Add documentation to the `Transform3D(Projection)` constructor in Core.
- Add `Transform3D` constructor with only real_t params to C# that mirrors `Transform2D`.
- Expose `Basis` constructor with only real_t params in C#.
- Add `Transform2D(real_t, Vector2, real_t, Vector2)` constructor to C#.
2023-01-15 15:45:43 +01:00
Raul Santos
0476fc5a07
C#: Replace Rotation and Scale properties with get methods
- Replace `Rotation` property with `GetRotation` method in `Transform2D`.
- Replace `Scale` property with `GetScale` method in `Transform2D`.
- Replace `Scale` property with `GetScale` method in `Basis`.

Core does not expose set methods.
2023-01-15 14:06:16 +01:00
Raul Santos
28a8caac26
C#: Make Length and LengthSquared into methods in Quaternion.
The `Length` and `LengthSquared` members are implemented as methods
in every other C# struct, `Quaternion` was the only one implementing
them as properties.
2023-01-15 14:03:44 +01:00
Rémi Verschelde
d6d87b6ca4
Merge pull request #71374 from raulsntos/dotnet/remove-spherical_interpolate_with
C#: Remove `SphericalInterpolateWith` from Transform3D
2023-01-15 13:08:15 +01:00
Rémi Verschelde
e51426cab9
Merge pull request #71423 from raulsntos/dotnet/intersects-without-include_borders
C#: Remove `includeBorders` parameter from `Rect2i.Intersects` and `AABB.Intersects`
2023-01-15 13:07:13 +01:00
Raul Santos
949a2778ca
C#: Sync Basis with Core
- Remove `GetOrthogonalIndex` method (moved to `GridMap`).
- Remove `GetRow` and `SetRow` methods.
2023-01-14 20:06:45 +01:00
Raul Santos
c990f7984e
C#: Remove includeBorders parameter from Rect2i.Intersects and AABB.Intersects 2023-01-14 04:39:40 +01:00
Raul Santos
4438315242
C#: Remove SphericalInterpolateWith from Transform3D 2023-01-14 02:10:59 +01:00
Raul Santos
a6ba914f15
C#: Lookup signals and methods in Get method
Allows to retrieve `Callable`s and `Signal`s using `Get` like it works in GDScript.
2023-01-13 22:19:25 +01:00
Yuri Sizov
4c5e09f96a
Merge pull request #71339 from raulsntos/dotnet/is_finite
Add `IsFinite` to C# Variants
2023-01-13 23:34:51 +03:00
Yuri Sizov
bdb3543c2a
Merge pull request #71343 from raulsntos/dotnet/is_zero_approx
Add `IsZeroApprox` to C# vectors
2023-01-13 23:31:24 +03:00
Raul Santos
14c16746f3
Add IsZeroApprox to C# vectors 2023-01-13 18:53:39 +01:00
Raul Santos
f852004cf5
Add IsFinite to C# Variants 2023-01-13 17:57:52 +01:00
Juan Linietsky
6f0e210093 Refactor ProjectSetting overrides
* Overrides no longer happen for set/get.
* They must be checked with a new function: `ProjectSettings::get_setting_with_override()`.
* GLOBAL_DEF/GLOBAL_GET updated to use this

This change solves many problems:
* General confusion about getting the actual or overriden setting.
* Feature tags available after settings are loaded were being ignored, they are now considered.
* Hacks required for the Project Settings editor to work.

Fixes #64100. Fixes #64014. Fixes #61908.
2023-01-13 15:13:56 +01:00
Guillermo
6137929f52 Improve description of GetNodeOrDefault in C# API
Indenting with spaces and added a line break

Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-01-11 15:02:08 +01:00
Rémi Verschelde
64f2b970d8
Merge pull request #71114 from reduz/cleanup-property-hints
Removed unused property hints and `Object::get_translatable_strings()`
2023-01-09 16:57:31 +01:00
Juan Linietsky
0e0a6bb39b
Removed unused property hints and Object::get_translatable_strings()
* Remove unused `EditorPropertyMember` and related hints, previouly used by
  VisualScript. Such logic should be implemented in the VS module itself.
* As the above broke compatibility with the VS module, clean up the other
  hacks that were still in core in support of VisualScript.
* `PROPERTY_USAGE_INTERNATIONALIZED` was only used in Object's
  `get_translatable_strings()`, which is a legacy function not used anywhere.
  So both are removed.
* Reordered some usage flags after the above removal to minimize the diff.
* General clean up.

Fixes #30203.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-09 16:56:01 +01:00
Raul Santos
59e8fc1edf
C#: Add [Flags] attribute to core bitfield enums 2023-01-09 16:13:28 +01:00
Juan Linietsky
47592927b3 Use BitField<> hint for ArrayFormat
This was missing in the conversion of bitflags to BitField<>.
2023-01-08 18:47:48 +01:00
Rémi Verschelde
e5f6e03490
Merge pull request #70547 from TokageItLab/pingpong-wrap
Fix pingpong-loop with `loop_wrap` is not working & clean-up cubic interpolation key retrieve process
2023-01-06 00:10:18 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Ignacio Roldán Etcheverry
0daa86d70e
Merge pull request #70511 from raulsntos/dotnet/fix-update-script-class-info
C#: Skip getting class info for unbound generics
2022-12-30 01:29:53 +01:00
Raul Santos
a43e8285a7
C#: Avoid generic types in the script path attribute generator
- Avoid generic types in `ScriptPathAttributeGenerator`, this
means they won't be added to the `[AssemblyHasScripts]` attribute
and a `[ScriptPath]` attribute won't be added to the class.
Since generic classes can't be used as scripts they shouldn't use
those attributes, this also makes CSharpScript consider those types
invalid since they won't be added to the script/type map.
- Avoid generic types in `ScriptManagerBridge.LookupScriptsInAssembly`.
- Set `outMethodsDest` in `ScriptManagerBridge.UpdateScriptClassInfo`.
2022-12-28 23:20:02 +01:00
Silc Renew
8745c206c4 Fix pingpong with loop wrap is not working 2022-12-25 18:16:38 +09:00
Ignacio Roldán Etcheverry
f382a2b59b
Merge pull request #70509 from irwiss/reverse-Vector2.AngleToPoint
C#: reverse Vector2.AngleToPoint
2022-12-24 17:22:50 +01:00
Alexey Kim
e9ace71c88 C#: reverse Vector2.AngleToPoint 2022-12-24 04:18:53 +02:00
Ignacio Roldán Etcheverry
dfac8bb407 C#: Fix leak in Span to Variant conversions 2022-12-23 21:37:28 +01:00
Ignacio Roldán Etcheverry
5784bf1be0
Merge pull request #70486 from raulsntos/dotnet/convert-to
C#: Rename `ConvertToX` methods
2022-12-23 21:15:24 +01:00
Raul Santos
24e4ac9167
C#: Rename ConvertToX methods
- Renamed `ConvertToX` to `ConvertToNativeX`.
- Renamed `ConvertToXObject` to `ConvertToX`.
- Renamed `ConvertToXManaged` to `ConvertToX`.
- Fix `Signal` name in bindings generator and csharp script.
2022-12-23 19:40:32 +01:00
Raul Santos
03c26d6618
C#: Disallow init-only properties
ReadOnly properties are currently not allowed because the generated code
needs to set them, this also apply to `init` properties because they
need to be set after initialization.
2022-12-23 19:04:14 +01:00
Raul Santos
2be8cd6863
C#: Add note about the class name in instantiate error
Adds a note about the requirement that a C# class name must match the
script filename in which the they are defined to the instantiate error.
2022-12-17 20:02:01 +01:00
Ignacio Roldán Etcheverry
df0cf08878
Merge pull request #69867 from raulsntos/dotnet/color
C#: Synchronize Color with Core
2022-12-16 13:17:03 +01:00
Raul Santos
d843a7ab97
C#: Synchronize Color with Core
- Add `Luminance` readonly property.
- Add `LinearToSrgb` and `SrgbToLinear` static methods.
- Add `FromOkHsl` static method.
- Add `FromRgbe9995` static method.
- Add `FromString` static method.
- Expose `FromHtml` static method.
- Expose `HtmlIsValid` static method.
- Add and update some Color documentation.
2022-12-16 03:04:05 +01:00
Rémi Verschelde
d4bbfc7075
Merge pull request #70125 from TokageItLab/cs-sync-usage-flags
Fix out of sync PropertyUsageFlags for cs
2022-12-15 23:55:44 +01:00
Silc Renew
a52479f770 Fix out of sync PropertyUsageFlags for cs 2022-12-16 06:27:04 +09:00
Alberto Vilches
2d60b9c6e4 Added Projection to ConvertTo<T> and CreateFrom<T> 2022-12-15 13:38:09 +01:00
Rémi Verschelde
346efd29e0
Fix typos with codespell 2022-12-15 12:24:08 +01:00
Rémi Verschelde
b8e1d6585c
Merge pull request #69971 from neikeq/csharp-vararg-ret-premature-free
C#: Fix premature free of returned Variant in vararg methods
2022-12-14 23:27:40 +01:00
Ignacio Roldán Etcheverry
833b252ce7 C#: Fix premature free of returned Variant in vararg methods
Notably, this fixes obscure issues after calling `script.New()` when
the returned instance is a `RefCounted`.
2022-12-12 17:54:28 +01:00
Raul Santos
1a4c8856ec
C#: Rename SignalInfo to Signal and make awaitable 2022-12-12 17:30:14 +01:00
Raul Santos
1ab4f26cc4
C#: Fix bindings generator for methods that return signals 2022-12-12 17:04:03 +01:00
Rémi Verschelde
f1edd03d4c
Merge pull request #69718 from groud/finally_rename_gdnative_to_gdextension
Rename all gdnative occurences to gdextension
2022-12-12 11:43:59 +01:00
Gilles Roudière
be1c9d677d Rename all gdnative occurences to gdextension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension ->Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:04:57 +01:00
Rémi Verschelde
0580790140
Merge pull request #69933 from neikeq/issue-69822
C#: Fix exported properties of GodotObject[] type
2022-12-11 22:56:05 +01:00
Ignacio Roldán Etcheverry
51f2d7b59f
Merge pull request #69869 from raulsntos/dotnet/attributes
C#: Expose attribute properties and add documentation
2022-12-11 22:40:35 +01:00
Ignacio Roldán Etcheverry
5c6c766732 C#: Fix exported properties of GodotObject[] type
This was a regression from 17b2838f39.
`MarshalUtils` was changed in the source generators to use
`ConvertTo<T>` and `CreateFrom<T>`, which don't support `GodotObject[]`
because it would need reflection.
As such, we need to keep the custom cases for `GodotObject[]` in
`MarshalUtils`.
2022-12-11 22:29:31 +01:00
Raul Santos
a86f076321
C#: Expose attribute properties and add documentation
- Exposes the properties of C# attribute so they can be accessed from
reflection, renaming them to PascalCase to follow .NET conventions.
- Added some documentation to the newly exposed members.
- Made attribute properties readonly to avoid giving the impression that
they could be modified.
2022-12-10 20:11:17 +01:00
Hugo Locurcio
063637ec77
Rename float=64 SCons option to precision=double
This avoids confusion with the old `bits=64` option and building
for 64-bit CPUs in general.
2022-12-10 16:43:45 +01:00
Raul Santos
fbd41a6eda
C#: Always convert float Variants to System.Double
Godot floats are always 64-bit.
The real_t feature only affects vectors, not scalars.
2022-12-02 17:04:11 +01:00
Rémi Verschelde
f3c68d6c83
Merge pull request #69391 from NeilKleistGao/sln
Fix C# Solution Directory Project Settings
2022-12-02 16:48:30 +01:00
NeilKleistGao
2bab84c8c7 Fix C# solution directory settings
Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
2022-12-02 22:01:15 +08:00
Ignacio Roldán Etcheverry
17b2838f39 C#: Cleanup Variant marshaling code in source/bindings generators
This change aims to reduce the number of places that need to be changed
when adding or editing a Godot type to the bindings.

Since the addition of `Variant.From<T>/As<T>` and
`VariantUtils.CreateFrom<T>/ConvertTo<T>`, we can now replace a lot of
the previous code in the bindings generator and the source generators
that specify these conversions for each type manually.

The only exceptions are the generic Godot collections (`Array<T>` and
`Dictionary<TKey, TValue>`) which still use the old version, as that
one cannot be matched by our new conversion methods (limitation in the
language with generics, forcing us to use delegate pointers).

The cleanup applies to:

- Bindings generator:
  - `TypeInterface.cs_variant_to_managed`
  - `TypeInterface.cs_managed_to_variant`
- Source generators:
  - `MarshalUtils.AppendNativeVariantToManagedExpr`
  - `MarshalUtils.AppendManagedToNativeVariantExpr`
  - `MarshalUtils.AppendVariantToManagedExpr`
  - `MarshalUtils.AppendManagedToVariantExpr`
2022-12-02 14:47:12 +01:00
Ignacio Roldán Etcheverry
f86c6b6ac4 C#: Replace most conversions between Variant and System.Object
This commit replaces most usages of `ConvertManagedObjectToVariant` and
`ConvertVariantToManagedObjectOfType`, by using the `Godot.Variant`
struct instead of `System.Object`.

The most notable change is to the `GetGodotPropertyDefaultValues` method
that's generated for scripts. The dictionary it returns now stores
`Godot.Variant` values.

Remaining usages are:

- The `DelegateUtils` class, for the serialization of closure display
  classes during assembly reloading by the editor. These display classes
  are compiler generated classes to store values captured by a closure.
  Since it's generated by the compiler, the only way we have to access
  the fields is through reflection. This leads to using `System.Object`.
- Converting parameters when invoking constructors from the engine.
  This will be replaced with source generators in the future.
- Legacy support for old `GetGodotPropertyDefaultValues` return values.
  We need to keep supporting the old version of this generated method
  for some time. Otherwise, if loading a project built with the previous
  version, it could lead to the loss of exported property values.
  Ideally, we should remove this legacy support before a stable release.
2022-12-02 14:47:12 +01:00
Ignacio Roldán Etcheverry
3afeb28560 C#: Remove ConvertVariantToManagedObject
Its two usages were:

- The Array `ICollection.CopyTo` implementation.
  It's possible that this class shouldn't be implementing the
  non-generic `ICollection`, but this commit doesn't change that.
  The new implementation stores the elements as boxed `Variant` values.
- The `Variant.Obj` property.
  I'm not sure if this property's existence is justified, but for now
  I rewrote it as a simpler version of `ConvertVariantToManagedObject`.
2022-12-02 03:34:40 +01:00
Ignacio Roldán Etcheverry
bcc061edae
Merge pull request #67023 from raulsntos/dotnet/fix-signal-callback-generation
C#: Fix signature of generated signal callbacks
2022-12-02 03:19:49 +01:00
Ignacio Roldán Etcheverry
6745e199fb
Merge pull request #69278 from rhofour/remove-namespaces
Remove unnecessary namespaces in generated PropertyDefVal files.
2022-11-30 18:31:52 +01:00
R. Alex Hofer
215022c507 Remove unnecessary namespaces in generated PropertyDefVal files. 2022-11-29 22:12:34 -05:00
Ignacio Roldán Etcheverry
5826e96014
Merge pull request #65905 from raulsntos/dotnet/marshaling-collections
C#: Fix marshaling generic Godot collections
2022-11-30 01:00:59 +01:00
trollodel
c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59:43 +01:00
Rémi Verschelde
8253c28200
Merge pull request #67031 from raulsntos/dotnet/string-extensions
C#: Cleanup and sync StringExtensions with core
2022-11-28 08:21:23 +01:00
Ignacio Roldán Etcheverry
4a82d71d73
Merge pull request #65907 from magian1127/4.0FixPropertiesGenerator
C#: Fix Generated ScriptProperty Error.
2022-11-28 01:48:52 +01:00
Raul Santos
dc2ceef0ec
C#: Remove/deprecate unnecessary string extensions
- Removed `UnicodeAt`
- Removed `EndsWith`
- Removed `LPad` and `RPad`
- Deprecated `BeginsWith` in favor of `string.StartsWith`
- Deprecated `LStrip` and `RStrip` in favor of `string.TrimStart` and `string.TrimEnd`
2022-11-27 23:25:48 +01:00
Magian
c41196f0f3 C#: Fix Generated ScriptProperty Error.
1. Add "this." to prevent errors caused by duplicate variable names.
2. Try to find the default value of property getters.
2022-11-27 17:40:40 +08:00
Ignacio Roldán Etcheverry
690199b7dd
Merge pull request #69194 from raulsntos/dotnet/begone-variant-disposer
C#: Remove VariantSpanDisposer and use constants in stackalloc
2022-11-27 03:30:59 +01:00
Raul Santos
3ff181096a
C#: Remove VariantSpanDisposer and use constants in stackalloc
- Remove `VariantSpanDisposer`, no need to dispose of the Variant Spans
since we are now borrowing the Variants instead of copying them.
- Remove `VariantSpanExtensions.Cleared` that was only used so the
Span was initialized for `VariantSpanDisposer` to know what to dispose.
- Fix stackalloc Spans to use constant VarArgsSpanThreshold
and avoid bound checks.
2022-11-27 03:04:34 +01:00