Commit graph

1805 commits

Author SHA1 Message Date
Ignacio Roldán Etcheverry
d39d462907
Merge pull request #65823 from raulsntos/dotnet/signal-docs
C#: Move signal documentation to the event
2022-09-15 18:37:12 +02:00
Raul Santos
a5ffd25292
C#: Move signal documentation to the event
Move signal documentation from the delegate to the event and also
deprecate the event if the signal is deprecated.
2022-09-15 13:24:41 +02:00
Raul Santos
02bd0724f5
Fix NuGet fallback folder packages
- 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-15 09:28:59 +02:00
bruvzg
f4f556d198
[macOS, .NET] Fix dotnet binary detection. 2022-09-14 18:31:52 +03:00
Rémi Verschelde
047801693c
Merge pull request #65533 from neikeq/issue-65522 2022-09-09 09:11:38 +02:00
Rémi Verschelde
c909120b59
Merge pull request #64373 from YeldhamDev/edscale_likes_them_floaty 2022-09-09 09:07:53 +02:00
Raul Santos
f63cfc12c5
Fix MacOS compiler flags in .NET module 2022-09-08 23:29:01 +02:00
Ignacio Roldán Etcheverry
8199a209c2 C#: Fix module builds for Windows 32-bit with mingw-w64
The lambda was giving issues, so I re-wrote it as a static function.
2022-09-08 20:57:28 +02:00
Michael Alexsander
c4c9e41073 Make Vector2i values paired with EDSCALE be just Vector2 2022-09-08 14:46:32 -03:00
Rémi Verschelde
6b92dbfce2 Merge pull request #65438 from neikeq/replace-libnethost-dependency
Replace libnethost dependency to find hostfxr
2022-09-07 17:55:07 +02:00
Ignacio Roldán Etcheverry
f784fb2000 C#: Replace libnethost dependency to find hostfxr
We want to replace libnethost as it gives us issues with some compilers.
Our implementation tries to mimic libnethost's hostfxr_resolver search
logic. We try to use the same function names for easier comparing in
case we need to update this in the future.
2022-09-07 16:36:36 +02:00
Rémi Verschelde
5c5079b398 Merge pull request #65197 from Mickeon/rename-connect-one-shot
Rename CONNECT_ONESHOT to CONNECT_ONE_SHOT
2022-09-07 08:51:10 +02:00
Rémi Verschelde
432c4c40a9
Merge pull request #65433 from neikeq/fix-mustbevariant-omittedtypearg 2022-09-06 21:41:53 +02:00
Micky
dd26ecdd31 Rename CONNECT_ONESHOT TO CONNECT_ONE_SHOT
For consistency. Every other exposed `one_shot` is spaced out like this.
2022-09-06 19:00:33 +02:00
Ignacio Roldán Etcheverry
3666e9fcd0 C#: Make MustBeVariantAnalyzer ignore OmittedTypeArgument
Fixes assertion error in the analyzer.
2022-09-06 18:51:45 +02:00
Ignacio Roldán Etcheverry
5628ab9215
Merge pull request #65410 from magian1127/4.0UnifiedMemberName
C# Modify the MemberName generated for the user script
2022-09-06 18:49:48 +02:00
Rémi Verschelde
5062aafc2d Merge pull request #64417 from aaronfranke/has-space
Replace AABB/Rect2/Rect2i has_no_* methods with has_* methods
2022-09-06 17:00:44 +02:00
Magian
4448859ead C# Modify the MemberName generated for the user script 2022-09-06 20:43:40 +08:00
Micky
b6daad8d4b Rename range_lerp to remap 2022-09-06 07:19:20 +02:00
Rémi Verschelde
6c818da55e
Merge pull request #65321 from rburing/physics_server_2d_extension
Create GDExtension classes for PhysicsServer2D
2022-09-05 12:44:58 +02:00
Rémi Verschelde
785ce4208d Merge pull request #65266 from raulsntos/dotnet/reload-non-tool-scripts
Create script instance of reloaded scripts even if they're not tools
2022-09-05 08:27:16 +02:00
Aaron Franke
7c2f0a82f0
Replace AABB/Rect2(i) HasNo* methods in C# 2022-09-04 23:03:36 -05:00
Aaron Franke
39521f9c8e
Fix some bugs with Vector4 in C# 2022-09-04 19:55:30 -05:00
Raul Santos
a91a3d01f8
C#: Create script instance of reloaded scripts even if they're not tools
Scripts that are instantiated at some point will always be recreated
if they ever become placeholders to prevent non-tool scripts
instantiated manually by users to become placeholders, if they
do become placeholders due to errors that prevent instantiation
(such as a missing parameterless constructor) these scripts
will also be recreated replacing the temporary placeholder.

If a script is marked as a tool but becomes a non-tool script
in a rebuild, the script will become a placeholder and will
no longer be considered applicable to be replaced by an instance
since the user explicitly removed the Tool attribute.
2022-09-04 20:39:37 +02:00
Ricardo Buring
d22ff48b3d Create GDExtension classes for PhysicsServer2D
This allows a 2D physics server created entirely from GDExtension.
Based on the structure of PhysicsServer3DExtension by reduz.
2022-09-04 12:04:08 +02:00
Ignacio Roldán Etcheverry
8a928bf465
Merge pull request #65296 from raulsntos/dotnet/signal-once
C#: Connect only once for each signal of a script
2022-09-03 23:12:36 +02:00
Raul Santos
281ccc7e1b
C#: Connect only once for each signal of a script
Since the list of signals in `CSharpScript::event_signals` retrieved
from calling `ScriptManagerBridge.UpdateScriptClassInfo` already
includes the signals from base scripts there is no need to iterate the
hierarchy again on `CSharpInstance::connect_event_signals`.
2022-09-03 20:39:01 +02:00
Almighty Laxz
c71b78bbb8 Add float arg to build_assemblies.py 2022-09-04 04:02:39 +09:30
Almighty Laxz
2c1593f7e4 Fixed build failing when REAL_T double and dotnet enabled 2022-09-03 00:24:14 +09:30
Ignacio Roldán Etcheverry
00058bb0ea
Merge pull request #65168 from raulsntos/dotnet/float64
C#: Assume 64-bit types when type has no meta
2022-09-01 18:05:33 +02:00
Raul Santos
9a10701c69
C#: Assume 64-bit types when type has no meta
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`
2022-09-01 10:29:52 +02:00
Ignacio Roldán Etcheverry
0e63185651 C#: Fix Vector4 in godot_variant and missing marshaling
Vector4 and Vector4i were implemented incorrectly in godot_variant.
They were also missing their respective Variant conversion callbacks
(used for generic collections).

Took the chance to remove unnecessary native calls for creating
Variant from Vector4, as now it can be done from C# (which is faster).
2022-08-31 23:43:28 +02:00
Hugo Locurcio
291d3aaabe
Improve null and object printing to avoid confusion with arrays
- Use different syntax for object printing to avoid confusion with arrays.
- Print null as `<null>` to avoid confusion with a string `"null"`.
- Display `<empty>` in editor resource pickers to avoid confusion
  with array-based properties.
2022-08-31 15:31:49 +02:00
Ignacio Roldán Etcheverry
706d988baa
Merge pull request #65061 from paulloz/dotnet/fix-godot_variants-with-empty-type-field
C#: Populate `Type` field on `godot_variant` created in managed
2022-08-30 18:01:00 +02:00
Danil Alexeev
d4555ef5fb
Add String.to_{camel,pascal,snake}_case methods 2022-08-30 12:36:24 +03:00
Aaron Franke
10a56981dc
Rename String plus_file to path_join 2022-08-29 19:38:13 -05:00
Paul Joannon
b783be59a2
C#: godot_variant should always have a valid type 2022-08-30 00:32:53 +02:00
Ignacio Roldán Etcheverry
051f24b067
Merge pull request #65049 from paulloz/dotnet/win10-export
C#: Fix .NET export template compilation on Windows
2022-08-29 18:34:02 +02:00
Ignacio Roldán Etcheverry
a5218989a2
Merge pull request #65046 from neikeq/dotnet-fix-exported-game-uninitialized-callbacks
C#: Fix exported game crash because of uninitialized callbacks
2022-08-29 18:14:04 +02:00
Ignacio Roldán Etcheverry
70c0774e70
Merge pull request #64987 from raulsntos/dotnet/linux-export
Fix .NET exporting in Linux
2022-08-29 18:13:20 +02:00
Paul Joannon
ab5807d722
Fix .NET export template compilation on Windows 10 2022-08-29 17:49:37 +02:00
Ignacio Roldán Etcheverry
8d9ff955b7 C#: Fix exported game crash because of uninitialized callbacks
This was a regression from 2c180f62d9,
where I forgot to update the source generator.
2022-08-29 17:37:56 +02:00
Rémi Verschelde
e60086f98b
Merge pull request #64119 from YuriSizov/theme-init-database 2022-08-29 14:02:21 +02:00
Fabio Alessandrelli
d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +02:00
Rémi Verschelde
4333f785f6
Merge pull request #64956 from raulsntos/dotnet/format-ci
Add `dotnet format` to CI to check C# style
2022-08-29 07:03:20 +02:00
Ignacio Roldán Etcheverry
58f8f3a40e
Merge pull request #64900 from raulsntos/dotnet/fix-exceptions
Fix various C# exceptions
2022-08-29 01:22:39 +02:00
Ignacio Roldán Etcheverry
f70e106010
Merge pull request #64994 from raulsntos/dotnet/property-indexers
C#: Ignore property indexers and report if exported
2022-08-29 00:52:25 +02:00
Raul Santos
761e2b1a65
C#: Ignore property indexers and report if exported
Ignore property indexers since they are unsupported and report a
diagnostic if an user tries to export it.
2022-08-28 18:16:57 +02:00
Rémi Verschelde
f7f8af232c
Merge pull request #64885 from Mickeon/rename-tooltip-hint
Rename `hint_tooltip` to `tooltip_text` & setter getter
2022-08-28 17:43:01 +02:00
Raul Santos
b0274d0ee7
Fix .NET exporting in Linux
- Fix platform detection after Linux OS name was renamed from `LinuxBSD`
to `Linux`
- Fix arch detection after renaming `64` to `x86_64`
- Fix typo in `find_hostfxr`
2022-08-28 15:44:05 +02:00
Ignacio Roldán Etcheverry
202f0f2f1b
Merge pull request #64959 from raulsntos/dotnet/fix-malloc-size
C#: Fix byteCount in `NativeMemory.Alloc`
2022-08-28 01:44:56 +02:00
Rémi Verschelde
19e2f30a55
Merge pull request #64860 from raulsntos/dotnet/sync-math
Sync C# cubic interpolation with core
2022-08-27 19:01:37 +02:00
Rémi Verschelde
b5294b5759
Merge pull request #64922 from akien-mga/dotnet-fix-app-host-version-detection
.NET: Change NETCore.App version detection to use highest match
2022-08-27 18:58:40 +02:00
Raul Santos
ebe008d41b
C#: Fix byteCount in NativeMemory.Alloc
`NativeMemory.Alloc` takes the byte count as parameter, this is
calculated by multiplying the element size in bytes by the length
of the array.
2022-08-27 17:35:53 +02:00
Raul Santos
f64b845514
C#: Add CubicInterpolateAngle 2022-08-27 12:28:54 +02:00
Raul Santos
623f4a52ca
C#: Add CubicInterpolateInTime 2022-08-27 12:27:11 +02:00
Raul Santos
4c5cefe4fe
C#: Rename and fix Quaternion.SphericalCubicInterpolate 2022-08-27 12:26:38 +02:00
Raul Santos
f72b7a1595
C#: Fix Quaternion.CubicSlerp 2022-08-27 12:26:38 +02:00
Raul Santos
8ad0ef75b8
C#: Add Exp and Log to Quaternion 2022-08-27 12:26:38 +02:00
Raul Santos
b526a0d824
C#: Add GetAngle and GetAxis to Quaternion 2022-08-27 12:26:38 +02:00
Raul Santos
961a086d20
C#: Fix Transform3D interpolation and add spherical interpolation 2022-08-27 12:26:38 +02:00
Raul Santos
b35fcf3620
C#: Add missing match check in Quaternion.Slerpni 2022-08-27 12:26:37 +02:00
Rémi Verschelde
488c501633
Merge pull request #64942 from paulloz/cs-fix-color-names
C#: Fix dictionary keys in Colors
2022-08-27 08:10:07 +02:00
Raul Santos
d35c58507c
Fix C# style with dotnet format 2022-08-27 03:22:31 +02:00
Micky
ef5b9a06a9 Rename hint_tooltip to tooltip_text & setget
`hint_tooltip` -> `tooltip_text`
`set_tooltip` -> `set_tooltip_text`
`_get_tooltip` -> `get_tooltip_text`

Updates documentation, too.
2022-08-27 01:35:01 +02:00
Paul Joannon
4c05b95857
C#: Fix dictionary keys in Colors 2022-08-26 23:27:45 +02:00
Rémi Verschelde
f9f2446972
Merge pull request #64367 from Mickeon/rename-var-to-str
Rename `str2var` to `str_to_var` and similar
2022-08-26 23:04:06 +02:00
Yuri Sizov
6320a0fc18 Add ThemeDB, expose previously static Theme methods 2022-08-26 19:23:05 +03:00
Raul Santos
79f9f59a87
Fix various C# exceptions
- Replace `IndexOutOfRangeException` with `ArgumentOutOfRangeException`
- Replace `Exception` with a more specific exception
- Add the parameter name to argument exception
- Update documentation for methods that throw exceptions
- Use `StringBuilder` to build exception messages
- Ensure exception messages end with a period
2022-08-26 16:56:00 +02:00
Micky
59e11934d8 Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
Rémi Verschelde
3d43ffdb5b .NET: Change NETCore.App version detection to use highest match
`libnethost.a` detection failed on my Linux system (Mageia 9, using Fedora 36
dotnet repos), because it used the first match which isn't the one matching
the rest of the SDK:
```
$ dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.28 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.28 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
```

No idea why I still have 6.0.5 installed but it should pick the highest I guess.
2022-08-26 13:19:01 +02:00
fabriceci
f8cc88fab3 Restore RigidBody2/3D, SoftBody names in physics 2022-08-26 12:26:25 +02:00
Ignacio Roldán Etcheverry
e8ce36628f
Merge pull request #64901 from raulsntos/dotnet/equals
C#: Use pattern matching to simplify `Equals`
2022-08-26 08:33:52 +02:00
Raul Santos
9c9b8fcd34
Remove [Signal] attribute from events
- Remove event as a valid target of `SignalAttribute`
- Stop adding the `[Signal]` attribute to events in bindings_generator
- Make bindings_generator use the `EventHandler` suffix to be consistent with the C# source generator
- Remove obsolete comment about the signal's delegate name
2022-08-26 00:53:45 +02:00
Ignacio Roldán Etcheverry
a8476c04f4
Merge pull request #64852 from paulloz/dotnet6-export-category-attribute
C#: Preserve order of exported fields/categories
2022-08-25 23:26:03 +02:00
Rémi Verschelde
6d196c1ce3
Merge pull request #64898 from neikeq/dotnet-fix-find-arch 2022-08-25 22:18:38 +02:00
Paul Joannon
cf99d92a39
C#: Preserve order of exported fields/categories 2022-08-25 20:39:57 +02:00
Ignacio Roldán Etcheverry
09af583e10 C#: Fix buildsystem when dotnet --info does not specify arch
For some installations the architecture information is not printed.
2022-08-25 20:05:42 +02:00
Ignacio Roldán Etcheverry
f03ac21ea8
Merge pull request #52815 from magian1127/temp3
C# Generate SnakeName const
2022-08-25 20:02:16 +02:00
Raul Santos
f8ceceed15
Various C# documentation improvements
Fixes wrong/invalid documentation and add documentation to some OS members.
2022-08-25 17:09:32 +02:00
Magian
c371d1bac9 C# Generate StringName(SnakeName) for all class members 2022-08-25 23:07:20 +08:00
Rémi Verschelde
c7eb423eeb
Merge pull request #55778 from aaronfranke/use-arch-btw
[skip ci]
2022-08-25 13:03:48 +02:00
Ignacio Roldán Etcheverry
8769088f48
Merge pull request #64869 from bruvzg/dotnet_arch
[macOS] Check .NET binary architecture, and search for the cross compile SDK in the subfolders.
2022-08-25 11:25:08 +02:00
Aaron Franke
27b0f18275 Unify bits, arch, and android_arch into env["arch"]
Fully removes the `bits` option and adapts the code that relied on it.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-08-25 11:19:20 +02:00
bruvzg
0a427cf159
[macOS] Check .NET binary architecture, and search for the cross compile SDK in the subfolders. 2022-08-25 09:32:07 +03:00
Rémi Verschelde
6ffbec9e49
Merge pull request #64731 from raulsntos/dotnet6-variant-generics-analyzer
C#: Add `MustBeVariant` attribute and analyzer
2022-08-25 07:34:05 +02:00
Rémi Verschelde
e1266d2f35
Merge pull request #64781 from raulsntos/csharp_children
Add `includeInternal` to C# NodeExtensions and avoid printing errors in `GetChildOrNull`
2022-08-25 07:32:50 +02:00
Raul Santos
6468f9b37c
Add MustBeVariant attribute and analyzer
- MustBeVariant attribute can be used to enforce that generic types must
be a marshable from/to Variant.
- Also renames all diagnostic ids to be valid unicode identifiers.
2022-08-25 01:47:40 +02:00
Aaron Franke
09551c3d2b
Remove mentions of the Server platform from the Mono module 2022-08-24 14:56:40 -05:00
Ignacio Roldán Etcheverry
686286ed9d
Merge pull request #64742 from zaevi/csharp_add_grouping_attributes
C#: Add grouping attributes for properties.
2022-08-24 20:09:47 +02:00
Ignacio Roldán Etcheverry
e172b1aa91
Merge pull request #64743 from raulsntos/dotnet6-signal-analyzer
Improve C# signal analyzer errors
2022-08-24 19:28:47 +02:00
Raul Santos
a0da258401
Use pattern matching to simplify Equals
- Simplify and unify `Equals` implementation of C# struct types
- Also add pattern matching to replace a cast in `DebuggingUtils`
2022-08-24 14:15:33 +02:00
Raul Santos
22a3c585c2
Update C# named colors to use HEX codes 2022-08-24 10:46:06 +02:00
Raul Santos
665621aa1b
Avoid printing an error in GetChildOrNull
`GetChildOrNull` won't print an error when the given index is out of range,
similar to how the LINQ `ElementAtOrDefault` method works.
2022-08-24 10:10:47 +02:00
Ignacio Roldán Etcheverry
b438859d04
Merge pull request #64727 from raulsntos/csharp-remove-ctors
Remove copy constructors in C# structs
2022-08-24 08:28:58 +02:00
Ignacio Roldán Etcheverry
4d9ddc8ab3
Merge pull request #64773 from raulsntos/dotnet6-🦭
C#: Seal classes that can't be inherited from
2022-08-24 08:01:27 +02:00
Raul Santos
7924d643e5
Add includeInternal to C# NodeExtensions and fix get_child documentation
Node methods in C# extended to use generics
now have the optional parameter `includeInternal`
like their non-generic equivalents.

Also, fixed a typo in the `Node.get_child` documentation.
2022-08-23 18:19:44 +02:00
Raul Santos
d6574f025b
Seal classes that can't be inherited from 2022-08-23 11:08:59 +02:00
Rémi Verschelde
d5606503b4
Merge pull request #64762 from neikeq/csharp-dangling-callable-code 2022-08-23 11:08:28 +02:00
Rémi Verschelde
7e4817a096
Merge pull request #64729 from raulsntos/csharp-xform-operator
C#: Replace `Xform` and `XformInv` with `*` operator
2022-08-23 07:47:09 +02:00
Ignacio Roldán Etcheverry
bc12436f73 C#: Remove old Callable code left dangling after switch to .NET 6 2022-08-23 04:14:58 +02:00
Raul Santos
0b8b733d77
C#: Replace Xform and XformInv with * operator
- 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++).
2022-08-22 21:11:24 +02:00
Raul Santos
3b201c2b04
Improve C# signal analyzer errors
Report the specific parameters that are not supported.
2022-08-22 19:44:05 +02:00
Zae
431a28fe19 C#: Add grouping attributes for properties. 2022-08-23 01:23:45 +08:00
Raul Santos
c56b157c61
Avoid trying to load non-existent assembly
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.
2022-08-22 11:48:12 +02:00
Raul Santos
29894e9c1a
Remove copy constructors in C# structs 2022-08-22 11:30:17 +02:00
Ignacio Roldán Etcheverry
9c34a02191 C#: Add module README
This should clarify development workflow with the NuGet packages.
2022-08-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
2c180f62d9 C#: Replace P/Invoke with delegate pointers
- 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-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
186d7f6239 C#: Remove IL post-processor build dependency
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-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
1bf4397e5b C#: Use custom project setting for C# project files name
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-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
0c30c678f0 C#: Re-introduce generic Godot Array and Dictionary
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-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
3123be2384 C#: Array, Dictionary and marshaling refactoring
- 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-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
344f5028d4 C#: Add dedicated Variant struct, replacing System.Object 2022-08-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
a9892f2571 C#: Add source generator for method list 2022-08-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
97713ff77a C#: Add source generator for signals as events
Changed the signal declaration signal to:

```
// The following generates a MySignal event
[Signal] public delegate void MySignalEventHandler(int param);
```
2022-08-22 03:36:52 +02:00
Ignacio Roldán Etcheverry
f033764ffe C#: Refactor Array & Dictionary interface implementations 2022-08-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
e235cef09f C#: Re-implement assembly reloading with ALCs 2022-08-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
d78e0a8426 C#: Make GodotSharp API a NuGet package
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
4b90d16250 C#: Initial NativeAOT support
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
18f805b3aa C#: Upgrade to .NET 6 (5.0 -> 6.0) 2022-08-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
e22dd3bc6a C#: Static marshaling for bindings and source generators
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
778007a358 C#: Re-introduce exception logging and error stack traces in editor
These two had been disabled while moving to .NET 5, as the previous
implementation relied on Mono embedding APIs.
2022-08-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
67db89988d C#: Ensure we only create one CSharpScript per type
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
92503ae8db C#: Add source generator for properties and exports default values
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
88e367a406 C#/netcore: Add base desktop game export implementation
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
f88d8902cf C#: Ensure native handles are freed after switch to .NET Core
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
4d710bf659 C#: Add initial implementation of source generator for script members
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
e5e7a795b1 C#: Code cleanup and greatly reduce use of C# pointers 2022-08-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
f16c8e3759 Fix detection of .NET Sdk from snap and allow higher versions 2022-08-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
315636e77c C#: Fallback to dotnet --info to determine .NET RID
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-22 03:36:51 +02:00
Ignacio Roldán Etcheverry
f9a67ee9da C#: Begin move to .NET Core
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-22 03:35:59 +02:00
Ignacio Roldán Etcheverry
513ee857a9 C#: Restructure code prior move to .NET Core
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-22 03:35:59 +02:00
Ignacio Roldán Etcheverry
5e37d073bb C#: Re-write GD and some other icalls as P/Invoke 2022-08-22 03:35:59 +02:00
Ignacio Roldán Etcheverry
9a51430441 C#: Re-write Array, Dictionary, NodePath, String icalls as P/Invoke 2022-08-22 03:35:59 +02:00
Ignacio Roldán Etcheverry
c4ccabd3fb C#: Remove DynamicGodotObject/Object.DynamicObject
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.
2022-08-22 03:35:59 +02:00
Ignacio Roldán Etcheverry
124fbf95f8 C#: Move marshaling logic and generated glue to C#
We will be progressively moving most code to C#.
The plan is to only use Mono's embedding APIs to set things at launch.
This will make it much easier to later support CoreCLR too which
doesn't have rich embedding APIs.

Additionally the code in C# is more maintainable and makes it easier
to implement new features, e.g.: runtime codegen which we could use to
avoid using reflection for marshaling everytime a field, property or
method is accessed.

SOME NOTES ON INTEROP

We make the same assumptions as GDNative about the size of the Godot
structures we use. We take it a bit further by also assuming the layout
of fields in some cases, which is riskier but let's us squeeze out some
performance by avoiding unnecessary managed to native calls.

Code that deals with native structs is less safe than before as there's
no RAII and copy constructors in C#. It's like using the GDNative C API
directly. One has to take special care to free values they own.
Perhaps we could use roslyn analyzers to check this, but I don't know
any that uses attributes to determine what's owned or borrowed.

As to why we maily use pointers for native structs instead of ref/out:
- AFAIK (and confirmed with a benchmark) ref/out are pinned
  during P/Invoke calls and that has a cost.
- Native struct fields can't be ref/out in the first place.
- A `using` local can't be passed as ref/out, only `in`. Calling a
  method or property on an `in` value makes a silent copy, so we want
  to avoid `in`.

REGARDING THE BUILD SYSTEM

There's no longer a `mono_glue=yes/no` SCons options. We no longer
need to build with `mono_glue=no`, generate the glue and then build
again with `mono_glue=yes`. We build only once and generate the glue
(which is in C# now).
However, SCons no longer builds the C# projects for us. Instead one
must run `build_assemblies.py`, e.g.:
```sh
%godot_src_root%/modules/mono/build_scripts/build_assemblies.py \
        --godot-output-dir=%godot_src_root%/bin \
        --godot-target=release_debug`
```
We could turn this into a custom build target, but I don't know how
to do that with SCons (it's possible with Meson).

OTHER NOTES

Most of the moved code doesn't follow the C# naming convention and
still has the word Mono in the names despite no longer dealing with
Mono's embedding APIs. This is just temporary while transitioning,
to make it easier to understand what was moved where.
2022-08-22 03:35:59 +02:00
Yuri Sizov
980f5f32f4 Make property_*_revert methods multilevel and expose them for scripting 2022-08-18 00:03:53 +03:00
antonWetzel
40a1d6d100 vector4 distance_squared_to and update csharp 2022-08-09 01:59:17 +02:00
Yuri Sizov
c5d7115038 Rename the argument tag to param in XML documentation 2022-08-08 22:34:31 +03:00
Raul Santos
34c3966510
Avoid paths with invalid characters in IsRider 2022-08-08 02:00:17 +02:00
Raul Santos
83ffe70f1f
Various fixes to C# documentation 2022-08-07 19:18:04 +02:00
Rémi Verschelde
77d3ac700d
Merge pull request #63712 from object71/fix-export-issues 2022-08-06 14:27:17 +02:00
Rémi Verschelde
bd833f8e06
Merge pull request #63871 from bruvzg/ts_build_options
Add Text Server related options to the build profiles editor.
2022-08-06 00:23:41 +02:00
Hugo Locurcio
db22b7ded0
Rename shader parameter uniform setter/getter methods for consistency
`shader_uniform` is now consistenly used across both per-shader
and per-instance shader uniform methods. This makes methods easier
to find in the class reference when looking for them.
2022-08-04 23:17:06 +02:00
Hristo Stamenov
0e1f7e9f89 Removed faulty function update after get_property_list.
The function tried to rearrange properties but that lead to problems with duplication or deleted properties. Implemented the logic that that function did inside the get_property_list both for tool scripts and non-tool scripts.
2022-08-03 21:45:16 +03:00
Aaron Franke
19a4d75b44
Replace Vector3.ToDiagonalMatrix with Basis.FromScale in C# 2022-08-03 10:24:22 -05:00
bruvzg
066ca97690
Add Text Server related options to the build profiles editor.
Adds SCons options to disable Brotli and Graphite.
Adds option categories to the build profiles editor.
Adds options default state to the build profiles editor.
Adds Text Server related options to the build profiles editor.
Fix misplaced OpenGL/Vulkan SCons options.
2022-08-03 15:06:43 +03:00
Fabian Keller
f242f9c738 Fix consistency of translated/scaled/rotated in Transform2D and Transform3D 2022-08-02 23:38:14 +02:00
Raul Santos
a4ad1dfa51
C#: Remove unused Transform2D.ScaleBasis method 2022-08-01 20:56:29 +02:00
Raul Santos
d0e586fc7e
Rename math 'phi' arguments to 'angle' in C# 2022-08-01 02:42:20 +02:00
Rémi Verschelde
14828c331c Mono: Fix build after #63737 2022-08-01 00:40:18 +02:00
antonWetzel
87ebfff46d create vector4, vector4i and projection for csharp 2022-07-31 19:42:34 +02:00
Rémi Verschelde
556cc22dd0
Merge pull request #63656 from raulsntos/fix-signal-bind-csharp 2022-07-31 13:29:31 +02:00
Rémi Verschelde
bd58300718
Merge pull request #63661 from raulsntos/fix-editor-paths-include
Add `editor_paths.h` include missing in mono module
2022-07-31 09:57:37 +02:00
Aaron Franke
ab4b5af286
Fix TranslatedLocal method in C# affecting the original transform 2022-07-30 11:54:35 -05:00
Raul Santos
cef3ca4024
Add editor_paths.h include missing in mono module 2022-07-30 02:00:56 +02:00
Raul Santos
ca47471dfa
Fix Callable calls in mono module
The `Callable::call` and `Callable::call_deferred` methods have been
renamed to `Callable::callp` and `Callable::call_deferredp`.
2022-07-29 21:56:02 +02:00
kobewi
c3606cb5f3 Swap arguments of ResourceSaver.save() 2022-07-29 19:53:09 +02:00
Aaron Franke
ac870ab1c8
Move editor paths into the EditorPaths class 2022-07-29 11:07:30 -05:00
Rémi Verschelde
14d021287b
Merge pull request #63049 from Faless/mp/4.x_as_module 2022-07-28 20:46:31 +02:00
Rémi Verschelde
199ea349f5
Merge pull request #57698 from bluenote10/feature/rename_translated_to_translated_local 2022-07-28 10:03:07 +02:00
Fabio Alessandrelli
ca7d572908 [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.
- RPC configurations are now dictionaries.
- Script.get_rpc_methods renamed to Script.get_rpc_config.
- Node.rpc[_id] and Callable.rpc now return an Error.
- Refactor MultiplayerAPI to allow extension.
- New MultiplayerAPI.rpc method with Array argument (for scripts).
- Move the default MultiplayerAPI implementation to a module.
2022-07-26 09:31:12 +02:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz
455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
Aaron Franke
b00bb577e7
Rename directory for export templates from templates to export_templates 2022-07-22 12:35:43 -05:00
Yuri Rubinsky
ccc56cc6d4 Rename epsilon to tolerance in the Plane::has_point method 2022-07-21 20:15:15 +03:00
bruvzg
8823eae328
Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +03:00
Fabian Keller
2bf9e6090c rename translate(d) to translate(d)_local in Transform 2D/3D 2022-07-16 11:47:54 +02:00
Lerg
52adbb763e Fix documentation for C# Vector2/3i classes.
The / operator was wrongly documented as a multiplication.
2022-07-13 22:49:22 +02:00
Rémi Verschelde
31974aaae2
Merge pull request #62805 from raulsntos/csharp-rpc 2022-07-07 17:21:51 +02:00
Rémi Verschelde
3768236ad2
Merge pull request #62789 from raulsntos/csharp-export-nodes 2022-07-07 17:21:10 +02:00
Rémi Verschelde
421e93b590
Merge pull request #62782 from raulsntos/csharp-bitfield-enums 2022-07-07 14:59:21 +02:00
Rémi Verschelde
72b3e81bdf
Merge pull request #62801 from raulsntos/ensure-nuget-path-exists 2022-07-07 12:23:35 +02:00
bruvzg
0c5431644d
Allows parsing of invalid UTF-16 surrogates (can be encountered in Windows filenames) and some non-standard UTF-8 variants, makes Unicode parse errors more verbose. 2022-07-07 11:07:18 +03:00
Rémi Verschelde
28a3dee276
Merge pull request #62791 from raulsntos/csharp-bezier-interpolation
C#: Add `BezierInterpolate` method
2022-07-07 09:40:36 +02:00
Raul Santos
8131358b71
C#: New RPCAttribute
Replace old RPC attributes with a new single `RPCAttribute` which works
like the GDScript `@rpc` annotation.
2022-07-07 04:10:38 +02:00
Raul Santos
1637d0c699
Ensure NuGet.config directory exists 2022-07-07 01:53:32 +02:00
Raul Santos
71f99c6d40
C#: Add BezierInterpolate method
Adds a `BezierInterpolate` method for floats in `Mathf` and for vectors
in `Vector2` and `Vector3`.
2022-07-06 21:59:42 +02:00
Raul Santos
68477e9b1b
C#: Enable exporting nodes to the inspector 2022-07-06 21:49:53 +02:00
Raul Santos
f9c43c5489
Add C# support for bitfield enums (flags) 2022-07-06 17:49:37 +02:00
Rémi Verschelde
635d447a69
Merge pull request #62713 from YuriSizov/docs-scripting-annotations 2022-07-06 15:31:19 +02:00
reduz
5ac42cf576 Implement a BitField hint
Allows to specify the binder that an enum must be treated as a bitfield.
2022-07-05 22:13:37 +02:00
Yuri Sizov
a9098e6147 Add support for documenting built-in annotations 2022-07-04 20:21:39 +03:00
Silc Renew
dc43cfc830 implement bone renamer in importer 2022-07-01 03:55:28 +09:00
Voylin
c6291bcd8a Adding print_rich for printing with BBCode 2022-06-29 00:41:29 +09:00
Rémi Verschelde
fec3a48e53
Merge pull request #59918 from piiertho/enhancement/rename-controll-minimum_size-to-custom_minimum_size 2022-06-24 14:54:53 +02:00
Pierre-Thomas Meisels
5ad1a1b5e7 enhancement: rename exposed property Control::minimum_size to Control::custom_minimum_size 2022-06-23 18:06:10 +02:00
Rémi Verschelde
870c02143b Mono: Update Newtonsoft.Json to 13.0.1
See https://github.com/advisories/GHSA-5crp-9r3c-p9vr
2022-06-23 16:24:16 +02:00
reduz
141c375581 Clean up Hash Functions
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02:00
Rémi Verschelde
dd93ae63fa
Merge pull request #61991 from bruvzg/property_shortcut
Make enum/constant binds 64-bit.
2022-06-17 21:05:51 +02:00
Rémi Verschelde
c8e17b5a30
Merge pull request #62069 from iamjsk10/master
Typo: Changed "forech" into "foreach" in string_utils.cpp
2022-06-17 18:36:08 +02:00
bruvzg
860e24683f
Make enum/constant binds 64-bit. 2022-06-17 16:36:26 +03:00
iamjsk10
d3a839f4b1 Mono: Fix typo to foreach C# keyword 2022-06-17 13:03:32 +02:00
Raul Santos
525b5e0e16
Fix EditorScenePostImport templates for C# 2022-06-16 19:29:59 +02:00
Paul Joannon
ee95a1cb28
Fix Lerp documentation and implement RangeLerp 2022-06-16 13:56:32 +02:00
Rémi Verschelde
d82c227e2b
Merge pull request #61486 from jtnicholl/import_script_templates
Add script templates for EditorScenePostImport
2022-06-15 21:07:42 +02:00
Jonathan Nicholl
912d8e23ca Add script templates for EditorScenePostImport 2022-06-15 12:41:37 -04:00
Joshua Quinones
003ad31ed5
Added documentation comments to the .NET library
Comments have been added for the following:
modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/DisableGodotGeneratorsAttribute.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs
modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs
2022-06-11 21:37:40 -05:00
Rémi Verschelde
c0bf18e923
Merge pull request #57824 from raulsntos/csharp-typed-arrays 2022-06-03 17:32:41 +02:00
Raul Santos
329818f20b
Support explicit values in flag properties, add C# flags support
- Add support for explicit values in properties using `PROPERTY_HINT_FLAGS`
that works the same way it does for enums.
- Fix enums and flags in VisualScriptEditor (it wasn't considering the
explicit value).
- Use `PROPERTY_HINT_FLAGS` for C# enums with the FlagsAttribute instead
of `PROPERTY_HINT_ENUM`.
2022-06-03 05:19:01 +02:00
Raul Santos
8dec74f22f
Generate typed array parameters in C# bindings
Adds support for generating C# bindings that use the generic `Array<T>`
type instead of the non-generic `Array` type when the registered ClassDB
method specifies the array element type.
2022-06-03 05:17:53 +02:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Rémi Verschelde
947a1fa090
Merge pull request #60956 from macjuul/hide-mono-cmd-prompt
Prevent blank command prompts from spawning when building a mono project
2022-05-12 21:23:00 +02:00
Julian Mills
d606a8eded Fix blank command prompts spawning
prevent certain mono actions from displaying empty command prompts.
2022-05-12 13:49:37 +02:00
reduz
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
bruvzg
ffe61e0895
[macOS / iOS] Fix text-to-speech build with older macOS / iOS SDK.
Add __has_include check for AVFAudio include.
Add some explicit casts to avoid conflicts.
Change all `include`s to `import`s for consistency.
2022-05-10 21:11:34 +03:00
Vitika9
aef3b5681d Changed signals of ItemList 2022-05-06 13:09:04 +05:30
Rémi Verschelde
e7a58a7eb6 Core: Rename math 'phi' arguments to 'angle' 2022-05-05 14:17:39 +02:00
Rémi Verschelde
84f64ddde9
Merge pull request #60723 from reduz/refactor-module-initialization 2022-05-04 19:08:43 +02:00
reduz
de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
Rémi Verschelde
931838b330
Merge pull request #60627 from aaronfranke/rename-elements
Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
2022-05-03 14:40:01 +02:00
Hugo Locurcio
180e5d3028
Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
Aaron Franke
1bf94dff3a
Rename Basis "elements" to "rows" 2022-04-29 08:02:56 -05:00
Aaron Franke
b831fb0a54
Rename Transform2D "elements" to "columns" 2022-04-29 08:02:39 -05:00
bruvzg
4bf99f4af2 Narrow FileAccess scope to prevent deadlocks. 2022-04-12 10:54:39 +03:00
bruvzg
9381acb6a4
Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
Rémi Verschelde
f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
Rémi Verschelde
a647fb3e62 Fix typos with codespell
Using codespell 2.2-dev from current git.

Fix a couple incorrect uses of gendered pronouns.
2022-03-31 14:07:29 +02:00
Rémi Verschelde
7119d355eb String: Remove TTR and DTR defines in non-tools build
This ensures we don't use TTR in runtime code, as it's specifically meant
to source translations for the editor.
2022-03-28 20:26:35 +02:00
Rémi Verschelde
c9b75431f3 Refactor GDScript/C# script templates logic to be editor-only
Not a full refactor as it still goes through ScriptLanguage so it's hacky,
but at least it can now compile without this.
2022-03-28 16:21:00 +02:00
Rémi Verschelde
143d13717b
Merge pull request #59553 from reduz/script-extension-support 2022-03-28 13:35:21 +02:00
Michael Alexsander
42df9ed059 Make script templates follow the GDScript style guide 2022-03-28 01:32:12 -03:00
reduz
360dea5348 Add GDExtension support to Script
* Ability to create script languages from GDExtension
* Some additions to gdnative_extension.h to make this happen
* Moved the GDExtension binder to core

This now allows creating scripting languages from GDExtension, with the same ease as if it was a module. It replaces the old PluginScript from Godot 3.x.
Warning: GodotCPP will need to be updated to support this (it may be a bit of work as ScriptInstance needs to be created over there again).
2022-03-27 16:13:00 +02:00
Raul Santos
83e0e13f4a
Support static methods in C# bindings generator 2022-03-22 19:36:57 +01:00
Raul Santos
4bbfd20aa9
Ignore PhysicsServer3DExtension class in C#
PhysicsServer3DExtension inherits from PhysicsServer3D which is a
singleton class, since singleton classes are generated as static in C#
it would generate invalid C# so for now we'll be
ignoring PhysicsServer3DExtension.
2022-03-18 17:28:48 +01:00
bruvzg
98d0af7d5c
Implement GDExtension export plugin. 2022-03-16 11:16:19 +02:00
Aaron Franke
89c4990274
Fix Slerp C# docs and add test cases for vectors in the same direction 2022-03-12 13:20:55 -06:00
Rémi Verschelde
768f9422bc Convert uses of DirAccess * to DirAccessRef to prevent memleaks
`DirAccess *` needs to be deleted manually, and this is often forgotten
especially when doing early returns with `ERR_FAIL_COND`.
`DirAccessRef` is deleted automatically when it goes out of scope.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-03-11 09:13:11 +01:00
reduz
21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
Haoyu Qiu
851ed8886c Fix Autoload capitalization inconsistency 2022-03-09 15:03:03 +08:00
Marcel Admiraal
507f72db8e Rename Control's Rect properties to exclude rect_ part 2022-03-08 16:30:35 +00:00
Rémi Verschelde
53cf5eff9a
Merge pull request #58847 from KoBeWi/editor_settings_mess 2022-03-07 08:38:15 +01:00
kobewi
2057ea2883 Remove duplicate editor settings definitions 2022-03-06 22:05:49 +01:00
Berke Kocaoğlu
20d72e462b
Implement Deconstruct methods for C# vectors
See https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/deconstruct#user-defined-types
2022-03-06 11:16:30 +03:00
Raul Santos
eaddb79ec6
Refactor bbcode_to_xml into multiple specific methods
The specific `_append_xml_*` methods implement the logic that generates
the proper XML documentation for the given BBCode tag and target and
appends it to the output.
2022-03-03 23:35:10 +01:00
Raul Santos
84615b4b53
Find inherited members in C# documentation generator 2022-03-03 19:53:06 +01:00
Raul Santos
42989befd6
Add theme_item support to C# documentation generator 2022-03-03 18:54:49 +01:00
Raul Santos
e601c9eb8f
Fix checking for @GlobalScope in C# documentation generator 2022-03-03 18:54:41 +01:00
Raul Santos
424817039a
Check for missing methods/members in C# documentation generator
- Outputs errors for missing members or methods when generating the C#
documentation.
- Hardcodes a special case for the `_init` method, in C# we'll reference
the constructor.
- Ignores properties with slashes (since they are not declared in C# and
can't be referenced in the documentation).
2022-03-03 18:53:15 +01:00
Raul Santos
47a7d85cc4
Fix references to global constants in C# documentation generator
Tries to find the referenced constants in the GlobalScope
if not found in the target class or if no class is specified.
2022-03-03 18:53:15 +01:00
Chris Bradfield
849d34ba8e Rename motion_velocity to velocity 2022-02-22 23:31:33 -08:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Rémi Verschelde
11572c6e30
Editor: Cleanup some includes dependencies
Removes some unnecessary includes from `editor_node.h`, and instead add
those where they're used.

Removes unnecessary `editor_node.h` includes in various editor classes.

Renames `dynamicfont` to `dynamic_font` in a couple files.

Misc cleanup while jumping through that rabbit hole.
2022-02-15 14:54:15 +01:00
Hugo Locurcio
b68dd2e189
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-02-15 00:03:31 +01:00
Rémi Verschelde
7224389468
Merge pull request #57954 from TokageItLab/refactor-cubic-interpolate
Implement `cubic_interpolate()` as MathFunc for refactoring
2022-02-13 10:34:13 +01:00
Hendrik Brucker
77fb65debf Use EditorFileDialog instead of FileDialog in the project manager 2022-02-12 12:06:51 +01:00
Silc 'Tokage' Renew
865da09871 Implement cubic_interpolate() as MathFunc for refactoring 2022-02-12 18:11:17 +09:00
Hendrik Brucker
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Raul Santos
f380a8e0ec Support signals in C# documentation 2022-02-10 16:02:31 +01:00