Commit Graph

7344 Commits

Author SHA1 Message Date
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
Rémi Verschelde af88438c71
Merge pull request #64354 from Mickeon/rename-navigation-distance 2022-08-25 18:35:23 +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
VolTer 88ad758b41 Added highlighting color for GDScript and GlobalScope functions 2022-08-25 17:00:16 +02:00
Rémi Verschelde 0cf0e96038
Merge pull request #64776 from YuriSizov/import-images-moar-flags 2022-08-25 16:51:26 +02: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
VolTer 73bbc61eb4 Tweaked StringName highlighting color 2022-08-25 08:32:14 +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
Rémi Verschelde 0569738a6e
Merge pull request #64849 from jtnicholl/fix_blender_check
Fix Blender file path check to require a directory
2022-08-25 07:31:43 +02:00
Aaron Franke 394d058420
Rename 2D NoiseTexture to NoiseTexture2D 2022-08-24 22:44:42 -05: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
Jonathan Nicholl 6ff41a3fcd Fix Blender file path check to require a directory 2022-08-24 16:08:01 -04: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
Rémi Verschelde c8c0f21880
Merge pull request #64780 from YuriSizov/editor-color-conversion-map 2022-08-24 16:49:51 +02:00
Rémi Verschelde 4698dc67b5
Merge pull request #64082 from KoBeWi/array3k 2022-08-24 16:05:59 +02:00
Rémi Verschelde a4a4402201
Merge pull request #64822 from akien-mga/sunset-visual-script 2022-08-24 15:41:57 +02:00
Yuri Sizov c78cbb523f Extract editor color map and simplify SVG color conversion 2022-08-24 15:59:14 +03: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
kobewi f7f4873ed0 Replace Array return types with TypedArray 3 2022-08-24 12:53:36 +02:00
Rémi Verschelde b1f392c25e Remove VisualScript module for 4.0
As announced in https://godotengine.org/article/godot-4-will-discontinue-visual-scripting,
Godot maintainers have agreed to discontinue the current implementation of
our VisualScript language.

The way it had been designed was not user-friendly enough and we did not
succeed in improving its usability to actually make it a good low-code
solution for users who need one.

So we prefer to remove it for Godot 4.0 and leave the door open for new,
innovative ideas around visual scripting, to be developed as plugins or
extensions now that Godot provides sufficient functionality for this
(notably via GDExtension and the godot-cpp C++ bindings).

The current module has been moved to a dedicated repository (with full Git
history extracted with `git filter-branch`):

https://github.com/godotengine/godot-visual-script

It can still be compiled as a C++ module (for now, but will likely require
work to be kept in sync with the engine repository), but our hope is that
contributors will port it to GDExtension (which is quite compatibile with
the existing C++ module code when using the godot-cpp C++ bindings).
2022-08-24 12:08:17 +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
Rémi Verschelde 711e372aad
Merge pull request #64787 from akien-mga/libwebp-1.2.4
libwebp: Sync with upstream 1.2.4
2022-08-24 09:51:49 +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
Rémi Verschelde 91e5f48ea7
Merge pull request #64009 from KoBeWi/arrayy_lmao
Replace Array return types with TypedArray (part 2)
2022-08-24 08:18:56 +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
kobewi 1abdffe7a0 Replace Array return types with TypedArray 2 2022-08-23 23:21:32 +02:00
Rémi Verschelde e5e34f21fc libwebp: Sync with upstream 1.2.4
Changes: https://chromium.googlesource.com/webm/libwebp/+/1.2.4/NEWS
2022-08-23 19:05:53 +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
Yuri Sizov 672e9d6868 Make `ImageLoader` take bit field flags 2022-08-23 14:39:01 +03: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 155fa4e156
Merge pull request #64758 from jtnicholl/blend_fbx_warnings 2022-08-23 10:29:28 +02:00
Rémi Verschelde 62c3e72b6f
Merge pull request #63959 from KoBeWi/typo_arrray
Replace Array return types with TypedArray (part 1)
2022-08-23 08:52:13 +02:00
bruvzg bcc3643989
Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +03: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
Rémi Verschelde 230225d360
Merge pull request #64744 from bruvzg/fix_mixed_font_color4
[4.x] Fix color modulation of the grayscale glyphs in font with mixed color / grayscale data.
2022-08-23 07:45:58 +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
Ignacio Roldán Etcheverry ebd966acee
Merge pull request #64725 from raulsntos/dotnet6-assembly-exists
Avoid trying to load non-existent assembly
2022-08-23 02:47:55 +02:00
Jonathan Nicholl d24b65b363 Update messages for missing FBX2glTF, add similar messages for Blender 2022-08-22 20:30:33 -04:00
kobewi 8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
Rémi Verschelde b8a64313f0
Merge pull request #59564 from KoBeWi/FINALLY,_ULTIMATE_UNDO_REDO 2022-08-22 22:37:33 +02:00
Rémi Verschelde 09b012a409
Merge pull request #64400 from aaronfranke/gltf-fix-camera 2022-08-22 22:23:08 +02:00
Rémi Verschelde 1f61d47766
Merge pull request #64339 from YuriSizov/core-multilevel-validate-property 2022-08-22 21:39:48 +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
bruvzg 1c5a50fac6
Fix color modulation of the grayscale glyphs in font with mixed color / grayscale data. 2022-08-22 21:01:22 +03: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
kobewi ece3df3938 Add per-scene UndoRedo 2022-08-22 18:05:10 +02:00
Yuri Sizov 1a24c9e14b Make `_validate_property` a multilevel method 2022-08-22 18:35:11 +03:00
Rémi Verschelde 5193332d10
Merge pull request #64343 from TokageItLab/priority-ph 2022-08-22 17:31:23 +02:00
Rémi Verschelde fdc36ad082
Merge pull request #64553 from RedMser/fix-property-validation-refactor 2022-08-22 16:54:47 +02:00
Rémi Verschelde ff7c10f709
Merge pull request #57297 from rafallus/orthogonal_index
Expose `Basis::set_orthogonal_index` as a GridMap method
2022-08-22 15:59:20 +02:00
Yuri Sizov 3cd3ec62e2
Merge pull request #37168 from theoway/ChangeNodeTypeDialog
Changed the title of change node type dialog
2022-08-22 15:42:28 +03: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
rafallus da7a5653f4 Expose Basis `set_orthogonal_index` method as a GridMap function 2022-08-20 21:42:20 -05:00
Umang Kalra 7ef5dfcfc3 Changed the title of change node type dialog 2022-08-20 22:53:07 +05:30
Max Hilbrunner 79717dcb46
Merge pull request #64170 from YuriSizov/docs-annotations-in-technicolor
Add documentation for all annotations
2022-08-20 00:57:01 +02:00
Yuri Sizov 7895a66cf2
Merge pull request #64334 from YuriSizov/core-bind-property-revert-methods
Make `property_*_revert` methods multilevel and expose them for scripting
2022-08-19 20:41:41 +03:00
Yuri Sizov a0995182fe Add documentation for all annotations 2022-08-19 15:06:39 +03:00
Max Hilbrunner 6f273d2156
Merge pull request #63326 from MewPurPur/binary-highlighting-fix
Fix highlighting of multiple operators
2022-08-19 01:27:02 +02:00
Clay John 17ca5b913c
Merge pull request #64156 from bruvzg/sys_msdf
Allow MSDF rendering for system fonts, fix crash on loading damaged / unsupported font files.
2022-08-18 14:58:57 -06:00
RedMser c25b8f2876 Remove unintentional PROPERTY_USAGE_INTERNAL
The flag only matters for property definition,
but was also used in _validate_property a lot.
2022-08-18 16:25:00 +02:00
Silc Renew b31115cdc1 Add collision weight to PhysicsBody for penetrations must be avoided
Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2022-08-18 08:10:31 +09:00
Yuri Sizov 980f5f32f4 Make `property_*_revert` methods multilevel and expose them for scripting 2022-08-18 00:03:53 +03:00
Haoyu Qiu 660c700f9c Fix action name completion for `Input` 2022-08-15 23:28:49 +08:00
Yuri Sizov d953d9590b Improve the `make_rst.py` parser for BBCode tags 2022-08-15 17:45:10 +03:00
Aaron Franke be81b33e2b
GLTF: Fix orthographic cameras, internally store data in GLTF's format 2022-08-14 19:18:53 -05:00
Aaron Franke 3bbb50359d
Document GLTFLight and GLTFSpecGloss 2022-08-14 14:57:58 -05:00
VolTer 2e6108d181 Improve binary operator highlighting 2022-08-14 15:49:07 +02:00
smix8 4f0730d4bc Add Navigation Debug for GridMap edge connections
Adds navigation visual debug for GridMap edge connections that use baked navigationmesh with bake_navigation=true.
2022-08-13 21:27:56 +02:00
Micky b62d06fbed Rename Navigation's `neighbor_dist` to `neightbor_distance`
NavigationAgent2D/3D.`neighbor_dist` -> `neighbor_distance` (also affects setters and getters)

NavigationServer2D/3D.`agent_set_neighbor_dist()` -> `agent_set_neighbor_distance()`

Also changes their parameters' names.

Doesn't affect "Agent.neighborDist_" in Agent.h
2022-08-13 12:40:55 +02:00
Rémi Verschelde 345dd9f0fb
Merge pull request #62934 from Xwdit/script_doc_arg_def_var 2022-08-10 16:31:45 +02:00
Rémi Verschelde a946768151
Merge pull request #63015 from Xwdit/fix_gds_editor_tooltip_arg_type 2022-08-10 16:31:32 +02:00
Rémi Verschelde 26b2ac82ff
Merge pull request #63020 from Xwdit/fix_gds_editor_tooltip_return_type 2022-08-10 16:31:20 +02:00
Rémi Verschelde 0af6aae5bb
Merge pull request #64169 from hakro/fix-gltf-animations-always-imported 2022-08-10 15:25:20 +02:00
Xwdit f265f175e3 Fix script documentation method argument default values
Co-Authored-By: Rémi Verschelde <rverschelde@gmail.com>
2022-08-10 15:07:21 +02:00
Xwdit e25c86bf5d Fixed incorrect type display of function argument in GDScript editor tooltips 2022-08-10 15:06:21 +02:00
Xwdit 7e262310a2 Fixed incorrect type display of void return in GDScript editor tooltips 2022-08-10 15:05:47 +02:00
Rémi Verschelde abe98a95c5
Merge pull request #64206 from Chaosus/gds_fix 2022-08-10 12:29:11 +02:00
Rémi Verschelde 6b84619136
Merge pull request #64188 from YeldhamDev/gridmap_item_fix 2022-08-10 11:50:20 +02:00
Hakim 805ffdfbf6 Prevent AnimationPlayer from being added on GLTF import if the option is unchecked. Fixes #63954 2022-08-10 11:17:29 +02:00
Yuri Rubinsky df85c9871f Prevent global functions from overriding completion of subscript 2022-08-10 11:51:53 +03:00
Michael Alexsander fe16aecbac Fix error when switching to another `GridMap` with an item with higher index selected 2022-08-09 19:05:02 -03:00
bruvzg bf1cc6326a
Allow MSDF rendering for system fonts, fix crash on loading damaged / unsupported font files. 2022-08-09 14:21:09 +03:00
antonWetzel 40a1d6d100 vector4 distance_squared_to and update csharp 2022-08-09 01:59:17 +02:00
Rémi Verschelde f8383a7c72
Merge pull request #64099 from A-Lamia/lsp_uri_path_fixes 2022-08-08 23:04:33 +02:00
Yuri Sizov c5d7115038 Rename the argument tag to param in XML documentation 2022-08-08 22:34:31 +03:00
Rémi Verschelde 862dedcefe
Merge pull request #64076 from raulsntos/doc-fixes
Add `@GDScript.type_exists` documentation, Fix typo in weakref documentation
2022-08-08 19:15:25 +02:00
Rémi Verschelde bc3ab0aaa8
Merge pull request #64004 from YuriSizov/doctool-fail-on-unnamed-args
Add checks and tests for empty/unnamed arguments
2022-08-08 19:15:07 +02:00
Rémi Verschelde 74d2c7d394
Merge pull request #63932 from smix8/navigation_heightmapshape_baking_4.x 2022-08-08 15:47:08 +02:00
Raul Santos e47ba81050
Add `@GDScript.type_exists` documentation 2022-08-08 15:40:32 +02:00
Yuri Sizov 1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00
Lamia 42a16ef76e fix: modifies workspace->root_uri so that p_uri is symmetrical to other operating systems. #63388 2022-08-08 22:40:13 +10:00
Rémi Verschelde 01ce034398
Merge pull request #64085 from raulsntos/fix-rider-check 2022-08-08 08:58:21 +02:00
Rémi Verschelde 7801ad0531
Merge pull request #64046 from AntonioDell/bugfix/63715-infer-preloaded-const-types 2022-08-08 08:55:37 +02: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
Antonio Dell'Annunziata f81a166ab8
fix(gdscript): Infer type from preload const
When resolving the type of the attribute from the variant, the result_type.kind was overritten for no reason.
It is assumed that this only needs to be done, if the variant value is not valid to have any kind here.

Solves #63715
2022-08-07 16:09:24 +02:00
Rémi Verschelde e3876899d3
Merge pull request #63919 from Faless/scons/4.x_easy_deps 2022-08-07 16:09:02 +02:00
Fabio Alessandrelli 43f51d78d1 [MP] Cleanup and fixes for replication plugin.
- Remove dead code.
- Fix "Add from path" adding the wrong string when targeting root node.
2022-08-07 15:08:35 +02:00
Fabio Alessandrelli 202320e1ed [Websocket] Remove dummy JS server implemenation.
It does nothing but printing errors (only websocket client is available
in browsers), so we might as well return null when you instantiate it.
2022-08-07 13:44:16 +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 c81ef51503
Merge pull request #63976 from aaronfranke/godots-own-comment-lines 2022-08-06 13:20:57 +02:00
Rémi Verschelde ae335196b5
Merge pull request #63762 from bruvzg/ft_warn
[TextServer] Add a build warning when building with external FreeType without Brotli support.
2022-08-06 00:31:15 +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
Aaron Franke ce0080768c
Make "Godot source files" comment consistent in modules 2022-08-05 17:09:11 -05:00
bruvzg 4b155b939b
[Text Server] Prevent composite glyphs which incorporate kashida from being used for justification. Update TextServer tests to clean up on fail. 2022-08-05 19:35:38 +03:00
smix8 5137cd9d87 Add NavigationMesh baking for HeightMapShape
Adds HeightMapShape for StaticColliders and GridMap to the NavigationMeshGenerator for baking NavigationMesh.
2022-08-05 08:56:38 +02:00
Rémi Verschelde 25915cdd0e
Merge pull request #59844 from Calinou/rename-shader-param-methods 2022-08-05 02:52:06 +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
bruvzg 80c9a44492
Fix overrun flag check and HarfBuzz safe to break flag check. 2022-08-04 22:58:28 +03:00
Fabio Alessandrelli 951a1016d3 [Scons] Implement module dependency sorting.
Modules can now call:

env.module_add_dependencies(name: str, deps: list, optional: bool)

To add required or optional dependencies during the "can_build" step.

Required dependencies will be checked and the module will be not be
enabled when they are missing, printing a warning to notify the user.
2022-08-04 20:00:19 +02:00
Fabio Alessandrelli 55845bac26 Fix some array size function definition mismatch. 2022-08-04 13:06:17 +02:00
Rémi Verschelde fdceece7f8
Merge pull request #63899 from bruvzg/hb_510
HarfBuzz: Update to version 5.1.0, use new FLAG_SAFE_TO_INSERT_TATWEEL flag to improve justification.
2022-08-04 09:12:05 +02:00
bruvzg 2980c0d60c
HarfBuzz: Update to version 5.1.0, use new FLAG_SAFE_TO_INSERT_TATWEEL flag to improve justification. 2022-08-04 09:10:16 +03: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
Rémi Verschelde c67febb008
Merge pull request #63830 from KoBeWi/regEX
Add static method for creating RegEx
2022-08-02 18:16:04 +02:00
kobewi 61a2cb65b1 Add static method for creating RegEx 2022-08-02 15:56:46 +02:00
Rémi Verschelde 33258d850c
Merge pull request #61315 from lawnjelly/variant_bucket_pools
Variant memory pools
2022-08-02 15:54:18 +02:00
bruvzg 4373a0bb86
[TextServer] Add ICU Unicode security and spoofing detection. 2022-08-02 15:37:49 +03:00
Max Hilbrunner 2685cc7bb6 UPNP: Don't delete mappings when adding mappings
Don't delete previous mappings when adding a new mapping.
This was a old workaround that seems to cause issues.
2022-08-02 09:11:05 +02:00
Rémi Verschelde b7346e5025
Merge pull request #53956 from bruvzg/icu_uax_31 2022-08-02 08:54:19 +02:00
Rémi Verschelde 536b5b69ab
Merge pull request #63789 from YuriSizov/editor-remove-old-property-widgets
Remove `CustomPropertyEditor` completely
2022-08-02 07:50:20 +02:00
bruvzg 5aa48b6ae5
[TextServer] Implement ICU/UAX 31 based `is_valid_identifier` function. 2022-08-02 08:30:20 +03:00
Ignacio Roldán Etcheverry 8243c7ab5d
Merge pull request #63790 from raulsntos/csharp-unused
C#: Remove unused `Transform2D.ScaleBasis` method
2022-08-01 22:38:17 +02:00
Yuri Sizov 86798d36db Remove `CustomPropertyEditor` completely 2022-08-01 22:57:05 +03:00
Raul Santos a4ad1dfa51
C#: Remove unused `Transform2D.ScaleBasis` method 2022-08-01 20:56:29 +02:00
Yuri Sizov 1c9ba5ef3e Remove excessive `editor/property_editor.h` includes 2022-08-01 17:19:11 +03:00
bruvzg 366e2d893e
[TextServer] Add a build warning when building with external FreeType without Brotli support. 2022-08-01 13:22:29 +03: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
Rémi Verschelde f04004b24c
Merge pull request #55450 from Calinou/script-editor-improve-light-theme-syntax-colors 2022-08-01 00:08:25 +02:00
Rémi Verschelde 8ad80f0547
Merge pull request #63737 from YuriSizov/editorresourceconversionpluginactomy 2022-07-31 23:52:38 +02:00
Rémi Verschelde 880d93c71c
Merge pull request #63537 from antonWetzel/csharp-vector4
`Vector4`, `Vector4i` and `Projection` for Csharp
2022-07-31 23:45:52 +02:00
Hugo Locurcio 0a24d40836
Improve script editor's light theme syntax colors for better readability
New colors were hand-picked to have a better contrast rate,
while still following the general coloring of the previous light theme.

This improves the light theme's accessibility, especially in outdoor
environments with direct sunlight.
2022-07-31 23:40:48 +02:00
Rémi Verschelde c0946d3c38
Merge pull request #63743 from bruvzg/hb_inc_order_and_ver_check 2022-07-31 23:38:00 +02:00
Fabio Alessandrelli faff5e10a5
Merge pull request #63599 from nathanfranke/mp-docs
Document multiplayer replication classes, small changes to MultiplayerSpawner
2022-07-31 23:14:33 +02:00
bruvzg b54c5c2683
[TextServer] Ensure that built-in library headers are always included before system header, add HarfBuzz version checks for optional features. 2022-07-31 22:52:59 +03:00
Yuri Sizov 9f55bd971e Extract EditorResourceConversionPlugin into its own source files and clean up editor includes 2022-07-31 21:14:15 +03:00
antonWetzel 87ebfff46d create vector4, vector4i and projection for csharp 2022-07-31 19:42:34 +02:00
Rémi Verschelde 602e967ba8
Merge pull request #55943 from jvanmourik/master
glTF animation parsing: Changed the 'loop' and 'cycle' animation name keywords to be case-insensitive
2022-07-31 17:28:43 +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
Nathan Franke b7c5aeca8a
document multiplayer replication classes, small changes to multiplayer spawner 2022-07-30 21:38:19 -05: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
Rémi Verschelde 335fc2a946
Merge pull request #48183 from madmiraal/fix-regex-offset
Generate error if RegEx offset is negative
2022-07-29 22:38:35 +02:00
Rémi Verschelde 15a02c49be
Merge pull request #61647 from KoBeWi/SaverResource 2022-07-29 22:30:51 +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
Marcel Admiraal db1270d521 Generate error if RegEx offset is negative 2022-07-29 19:43:23 +01:00
kobewi c3606cb5f3 Swap arguments of ResourceSaver.save() 2022-07-29 19:53:09 +02:00
LinuxUserGD 6e6569aa78 fix 'Comparison result is always the same' warnings 2022-07-29 19:45:22 +02:00
Rémi Verschelde ba3734e69a
Merge pull request #63603 from aaronfranke/editor-paths
Move editor paths into the EditorPaths class
2022-07-29 19:31:59 +02:00
Rémi Verschelde 7199314eb3
Merge pull request #63595 from reduz/remove-signal-connect-binds
Remove Signal connect binds
2022-07-29 18:10:39 +02:00
Aaron Franke ac870ab1c8
Move editor paths into the EditorPaths class 2022-07-29 11:07:30 -05:00
Juan Linietsky d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00