summaryrefslogtreecommitdiff
path: root/modules/mono
AgeCommit message (Collapse)Author
2022-08-22C#: Move marshaling logic and generated glue to C#Ignacio Roldán Etcheverry
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-18Make `property_*_revert` methods multilevel and expose them for scriptingYuri Sizov
2022-08-09vector4 distance_squared_to and update csharpantonWetzel
2022-08-08Rename the argument tag to param in XML documentationYuri Sizov
2022-08-08Avoid paths with invalid characters in `IsRider`Raul Santos
2022-08-07Various fixes to C# documentationRaul Santos
2022-08-06Merge pull request #63712 from object71/fix-export-issuesRémi Verschelde
2022-08-06Merge pull request #63871 from bruvzg/ts_build_optionsRémi Verschelde
Add Text Server related options to the build profiles editor.
2022-08-04Rename shader parameter uniform setter/getter methods for consistencyHugo Locurcio
`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-03Removed faulty function update after get_property_list.Hristo Stamenov
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-03Replace Vector3.ToDiagonalMatrix with Basis.FromScale in C#Aaron Franke
2022-08-03Add Text Server related options to the build profiles editor.bruvzg
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-02Fix consistency of translated/scaled/rotated in Transform2D and Transform3DFabian Keller
2022-08-01C#: Remove unused `Transform2D.ScaleBasis` methodRaul Santos
2022-08-01 Rename math 'phi' arguments to 'angle' in C#Raul Santos
2022-08-01Mono: Fix build after #63737Rémi Verschelde
2022-07-31create vector4, vector4i and projection for csharpantonWetzel
2022-07-31Merge pull request #63656 from raulsntos/fix-signal-bind-csharpRémi Verschelde
2022-07-31Merge pull request #63661 from raulsntos/fix-editor-paths-includeRémi Verschelde
Add `editor_paths.h` include missing in mono module
2022-07-30Fix TranslatedLocal method in C# affecting the original transformAaron Franke
2022-07-30Add editor_paths.h include missing in mono moduleRaul Santos
2022-07-29Fix Callable calls in mono moduleRaul Santos
The `Callable::call` and `Callable::call_deferred` methods have been renamed to `Callable::callp` and `Callable::call_deferredp`.
2022-07-29Swap arguments of ResourceSaver.save()kobewi
2022-07-29Move editor paths into the EditorPaths classAaron Franke
2022-07-28Merge pull request #63049 from Faless/mp/4.x_as_moduleRémi Verschelde
2022-07-28Merge pull request #57698 from ↵Rémi Verschelde
bluenote10/feature/rename_translated_to_translated_local
2022-07-26[Net] Modularize multiplayer, expose MultiplayerAPI to extensions.Fabio Alessandrelli
- 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-25Code quality: Fix header guards consistencyRémi Verschelde
Adds `header_guards.sh` bash script, used in CI to validate future changes. Can be run locally to fix invalid header guards.
2022-07-23Implement Vector4, Vector4i, Projectionreduz
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-22Rename directory for export templates from templates to export_templatesAaron Franke
2022-07-21Rename `epsilon` to `tolerance` in the `Plane::has_point` methodYuri Rubinsky
2022-07-21Rename OSX to macOS and iPhoneOS to iOS.bruvzg
2022-07-16rename translate(d) to translate(d)_local in Transform 2D/3DFabian Keller
2022-07-13Fix documentation for C# Vector2/3i classes.Lerg
The / operator was wrongly documented as a multiplication.
2022-07-07Merge pull request #62805 from raulsntos/csharp-rpcRémi Verschelde
2022-07-07Merge pull request #62789 from raulsntos/csharp-export-nodesRémi Verschelde
2022-07-07Merge pull request #62782 from raulsntos/csharp-bitfield-enumsRémi Verschelde
2022-07-07Merge pull request #62801 from raulsntos/ensure-nuget-path-existsRémi Verschelde
2022-07-07Allows parsing of invalid UTF-16 surrogates (can be encountered in Windows ↵bruvzg
filenames) and some non-standard UTF-8 variants, makes Unicode parse errors more verbose.
2022-07-07Merge pull request #62791 from raulsntos/csharp-bezier-interpolationRémi Verschelde
C#: Add `BezierInterpolate` method
2022-07-07C#: New `RPCAttribute`Raul Santos
Replace old RPC attributes with a new single `RPCAttribute` which works like the GDScript `@rpc` annotation.
2022-07-07Ensure NuGet.config directory existsRaul Santos
2022-07-06C#: Add `BezierInterpolate` methodRaul Santos
Adds a `BezierInterpolate` method for floats in `Mathf` and for vectors in `Vector2` and `Vector3`.
2022-07-06C#: Enable exporting nodes to the inspectorRaul Santos
2022-07-06Add C# support for bitfield enums (flags)Raul Santos
2022-07-06Merge pull request #62713 from YuriSizov/docs-scripting-annotationsRémi Verschelde
2022-07-05Implement a BitField hintreduz
Allows to specify the binder that an enum must be treated as a bitfield.
2022-07-04Add support for documenting built-in annotationsYuri Sizov
2022-07-01implement bone renamer in importerSilc Renew
2022-06-29Adding print_rich for printing with BBCodeVoylin