Commit graph

73 commits

Author SHA1 Message Date
Rémi Verschelde 0ae65472e7
clang-format: Enable BreakBeforeTernaryOperators
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 15:57:41 +02:00
Rémi Verschelde 3b11e33a09
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +02:00
Raul Santos bc47bacc9e Fix marshaling generic Godot.Object in C# 2021-10-18 03:07:47 +02:00
Raul Santos 035e14c69d Fix hint_string for C# enum arrays 2021-10-15 19:23:40 +02:00
Rémi Verschelde f113dc9863
Merge pull request #53627 from raulsntos/fix-list-marshal 2021-10-15 17:35:45 +02:00
Rémi Verschelde 6fb06ec47e
Merge pull request #53581 from raulsntos/mono-marshal-generics 2021-10-15 17:35:21 +02:00
Raul Santos ba4a88eaed Fix C# List<T> marshalling 2021-10-10 11:40:07 +02:00
Raul Santos 0be9664b42 Support marshaling generic Godot.Object
Allows using generic C# types in signals as long as they inherit
from `Godot.Object`.
2021-10-08 20:00:47 +02:00
Raul Santos 1f62d309d8 Support arrays of StringName, NodePath and RID in mono 2021-10-08 18:50:21 +02:00
Ignacio Roldán Etcheverry d2c3a86844 C#: Fix bindings generator for Callable argument default value
Previously there weren't any Callable arguments with a default value,
but d4dd859991 introduced one.
2021-08-20 11:18:04 +02:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Marcel Admiraal 8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00
Aaron Franke 08a85352fb
Rename Variant TRANSFORM to TRANSFORM3D
Also _transform to _transform3d
2021-06-03 07:30:01 -04:00
Aaron Franke de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
Rémi Verschelde 9f6a2aa321
Merge pull request #45029 from neikeq/issue-40023
C#: Fix System.Collections.Generic.List marshalling
2021-01-26 15:30:44 +01:00
Rémi Verschelde af878716f2
CI: Update to clang-format 11 and apply ternary operator changes 2021-01-12 19:32:53 +01:00
Ignacio Etcheverry da90364adf C#: Fix System.Collections.Generic.List marshalling 2021-01-08 21:51:25 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Ignacio Etcheverry a946f84e3d Don't box params on Native->C# calls with Variant params
Godot uses Variant parameters for calls to script methods.
Up until now we were boxing such parameters when marshalling
them for invokation, even if they were value types.

Now Godot allocates the marshalled parameters on the stack,
reducing the GC allocations resulted from boxing.
2020-12-06 01:36:20 +01:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde 9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
2020-11-09 16:29:04 +01:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Daniel Doran c3b16e825c Fix Mono PackedArray Marshalling 2020-07-05 14:54:31 -06:00
Rémi Verschelde 347a55d4c2
Merge pull request #40137 from neikeq/fix-clangtidy-warnings-mono
Mono/C#: Fix several clang-tidy warnings and cleanup
2020-07-05 22:32:27 +02:00
Ignacio Etcheverry 2511c43972 Mono/C#: Fix several clang-tidy warnings and cleanup 2020-07-05 19:19:36 +02:00
endlesstravel d2461bad63 fix crash when pass null in print array in GD.print
fix crash when pass null in print array in GD.print 2

fix crash when pass null in print array in GD.print 3

fix space
2020-07-03 16:55:09 +08:00
Michael Belousov 60fcefba69 return boxed long when marshalling a godot int to mono runtime in dynamic contexts 2020-06-17 17:16:17 -04:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Ignacio Etcheverry 20b9dbb1d5 C#: Revert marshalling of IDictionary/IEnumerable implementing types
Added marshalling for `System.Collections.Generic.List<T>` and
`System.Collections.Generic.Dictionary<TKey, TValue>`.
2020-04-23 02:26:43 +02:00
Ignacio Etcheverry 0fec3cb5ed Mono/C#: Allow exporting System.Array of type Godot.Object 2020-04-22 17:19:45 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Aaron Franke 9b322d46d3
[Mono] Marshaling for Vector2i, Vector3i, and Rect2i 2020-03-17 18:03:28 -04:00
Ignacio Etcheverry 6a85cdf640 Fix C# bindings after recent breaking changes
Implementation for new Variant types Callable, Signal, StringName.
Added support for PackedInt64Array and PackedFloat64Array.

Add generation of signal members as events, as well as support for
user created signals as events.
NOTE: As of now, raising such events will not emit the signal. As such,
one must use `EmitSignal` instead of raising the event directly.

Removed old ThreadLocal fallback class. It's safe to use thread_local now since
it's supported on all minimum versions of compilers we support.
2020-03-17 16:30:04 +01:00
Juan Linietsky 33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
Juan Linietsky 3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Marcel Admiraal 5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +01:00
Ignacio Etcheverry 844a8d215b Mono/C#: Make 'GD.Print' and its variants fallback to 'ToString()'
Up until now, 'GD.Print' would convert parameters first to
Variant and only then to String. This meant parameters that cannot be
converted to Variant would be printed as "Null".
This commit makes 'GD.Print' fallback to 'System.Object.ToString()'
if the parameter could not be converted to Variant.
The same applies to all 'GD.Print' variants:
'GD.PrintS', 'GD.PrintT', 'GD.PrintErr' and 'GD.PrintRaw'.
2020-01-02 13:54:20 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Ignacio Etcheverry 98dc07f25f Mono/C#: Fix Variant -> MonoString* when type is Variant:NIL
`Variant::operator String()` returns "Null" if the type is `Variant:NIL`.
We must consider that and return a null `MonoString*` instead when marshalling.
This was also causing a "Null" error to be displayed when exporting a game
because null string members would be set to "Null" during hot-reload.
2019-12-19 16:51:32 +01:00
Ignacio Etcheverry 066ae9d83b Mono/C#: Several android fixes
- Added correct config file for android dllmaps.
- Fix __Internal DllImports with a dlopen fallback.
- Add missing P/Invoke functions and internal calls expected by the monodroid BCL and our custom version of the 'Android.Runtime.AndroidEnvironment' class (this last one can be found in the godot-mono-builds repo).
- Make sure to set 'btls' instead of 'legacy' as the default TLS provider on Android.
2019-12-04 19:03:42 +01:00
Ignacio Etcheverry de7c2ad21b Mono/C#: WebAssembly support 2019-11-13 21:41:11 +01:00
Ignacio Etcheverry c55ce204b3 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'modules/mono'
And 'CRASH_*_MSG' as well.

Also make error messages puntuation and quotation more consistent.
2019-08-09 12:13:21 +02:00
Ignacio Etcheverry 270af6fa08 Re-write mono module editor code in C#
Make the build system automatically build the C# Api assemblies to be shipped with the editor.
Make the editor, editor player and debug export templates use Api assemblies built with debug symbols.
Always run MSBuild to build the editor tools and Api assemblies when building Godot.
Several bugs fixed related to assembly hot reloading and restoring state.
Fix StringExtensions internal calls not being registered correctly, resulting in MissingMethodException.
2019-07-05 09:38:23 +02:00
Ignacio Etcheverry 14df9e5cb2 Android build and export for the mono module 2019-06-03 17:09:24 +02:00
Ignacio Etcheverry 9b76c56098 Fix C# build error in MarshalUtils debug code 2019-05-21 19:09:00 +02:00
Ignacio Etcheverry 5a4bf4f369 C#: Marshalling support for IEnumerable<> and IDictionary<,>
Also fixed the hint string of exported members.
2019-05-18 19:39:56 +02:00
Ignacio Etcheverry 470b80cc55 C#: Support resource type hint in exported arrays
- Elements of types like PackedScene will display with the special editor for such type.
2019-04-29 21:20:05 +02:00
Ignacio Etcheverry 480d4c6fba C#: Support type hints for exported Arrays
Added the code for Dictionary as well, but it's not yet supported by the Godot inspector.
2019-04-06 12:14:43 +02:00
Ignacio Etcheverry 187e6ae26d C#: Add marshalling support for IEnumerable and IDictionary
Added constructor that takes IEnumerable for Array and IEnumerable<T> for Array<T>.
Added constructor that takes IDictionary for Dictionary and IDictionary<TKey, TValue> for Dictionary<TKey, TValue>.
2019-04-06 12:14:37 +02:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00