Commit graph

833 commits

Author SHA1 Message Date
Rémi Verschelde
57de8397b2 Fix Mono check for unsafe object references
(cherry picked from commit 09534e2922)
2020-02-14 16:10:06 +01:00
Raul Santos
0fb35401d4 Avoid going out of bounds in IsSubsequenceOf
Closes #35598

(cherry picked from commit 4b79ef5ebe)
2020-02-14 16:03:18 +01:00
Aaron Franke
9a396a4e07 [Mono] Basis/Transforms Array operator comments and improvements
The behavior for Basis and Transform2D is unchanged, and Transform gets new behavior. All of the behavior is identical to GDScript's behavior. 

(cherry picked from commit 0a39c7b354)
2020-02-14 15:53:59 +01:00
Fabián L
04cfcb3ba0 Fixed GetNodeOrNull<T>
GetNodeOrNull<T> was using GetNode instead of GetNodeOrNull

(cherry picked from commit f595486076)
2020-02-06 13:02:07 +01:00
Rémi Verschelde
c96f08dc86
Merge pull request #35527 from neikeq/issue-35259
Mono/C#: Fix _update_exports possible crash with Reference types
2020-01-24 21:51:57 +01:00
Rémi Verschelde
75ab07546b
Merge pull request #35524 from neikeq/issue-35496
Fix C# preprocessor infinite loop and incorrect parsing of `#if!`
2020-01-24 21:51:38 +01:00
Ignacio Etcheverry
966a126186 Mono/C#: Fix _update_exports possible crash with Reference types
The code was attempting to dynamic cast the native instance to Reference after
the managed instance was disposed. As the managed instance acts as a Ref,
the native instance was freed during that disposal.
This made the dynamic cast fail and we attempted to memdelete a second time.

The fix is to make the dynamic cast before disposal.
2020-01-24 18:28:40 +01:00
Ignacio Etcheverry
0604b1839d Fix C# preprocessor infinite loop and incorrect parsing of #if! 2020-01-24 17:53:17 +01:00
Rémi Verschelde
55f580b24a
Merge pull request #35491 from neikeq/issue-35450
Mono/C#: Lighten up unsafe reference checks
2020-01-23 23:06:58 +01:00
Ignacio Etcheverry
55b2e58a98 Mono/C#: Lighten up unsafe reference checks
Because of the weird case with multi-threading and ResourceLoader, it can be the case that a resource is GCed while being referenced again in the main thread. In such cases, a new unsafe reference is created before the finalizer thread removes the previous one.
2020-01-23 21:23:32 +01:00
Rémi Verschelde
cadf946863
Merge pull request #35478 from neikeq/issue-32260
Mono/C#: Add setting to include I18N assemblies in the exported game
2020-01-23 18:24:15 +01:00
Ignacio Etcheverry
59ec19d5a8 Mono/C#: Add setting to include I18N assemblies in the exported game 2020-01-23 17:47:09 +01:00
Rémi Verschelde
b75fff5a56
Merge pull request #35473 from neikeq/default-to-net47
Mono/C#: Default to net47 for new projects
2020-01-23 17:23:33 +01:00
Ignacio Etcheverry
82b0899e54 Mono/C#: Add Basis.Slerp, update Quat.Xform and add some math checks 2020-01-23 16:13:28 +01:00
Ignacio Etcheverry
d9ff5f7fc2 Mono/C#: Default to net47 for new projects 2020-01-23 15:57:47 +01:00
Ignacio Etcheverry
d53c15b12c Make script class parser errors to not abort the build
As our script class parser is error prone, we should not impede the build from continuing because of a parsing error.
This should be reverted in the future once we switch to Roslyn.
2020-01-21 20:07:26 +01:00
Ignacio Etcheverry
378fc592b1 Add dummy preprocessor for the C# script class parser
No attempts are made at conditional compilation. The main if branch is always assumed to be true.
2020-01-21 19:57:38 +01:00
Ignacio Etcheverry
e4330e33e6 Mono/C#: Fix error when parsing nested generics
Also fixed the editor not including the parse error message in the error.
2020-01-20 19:08:08 +01:00
Ignacio Etcheverry
a6105c8ea0 Fix ClassDB API portability with some android and editor classes
- `EditorNavigationMeshGenerator` was being registered as part of the Core API,
even after d3f48f88bb. We must make sure to
set Editor as the current ClassDB API type before creating an instance.

- The `VisualScriptEngineSingleton.constant` property has a property hint string
that's different between tools and non-tools builds. This commit makes the
hint string to no longer be set in `_bind_methods`, and to instead set it in
`_validate_property`. This way it's ignored when calculating the API hash.

- `JavaClassWrapper` is now registered in ClassDB on all platforms,
using a dummy implementation on platforms other than Android.
This fixes API portability between Android and other platforms.

- Updated `--class-db-json` command to ignore non-virtual methods that start
with an underscore (see: 4be87c6016).
2020-01-19 20:15:13 +01:00
Ignacio Roldán Etcheverry
1191d26ddc
Merge pull request #35208 from neikeq/mono-lazy-thread-attach
Mono/C#: Script interface calls now attach the current thread
2020-01-16 21:27:08 +01:00
Ignacio Etcheverry
d68b9c20d6 Mono/C#: Script interface calls now attach the current thread
Added guards to all C# script interface calls to attach the current thread
for the current scope if the thread is not already attached.
This is far from ideal, as attaching the thread is not cheap and all managed
thread local storage is lost when we detach the thread at the end of the calls.
However, it's the best we can do for now to avoid crashing
when an unattached thread tries to interact with C# code.
2020-01-16 17:47:36 +01:00
Ignacio Etcheverry
1a40f250bd Mono/C#: Fix false positive in unsafe reference checks 2020-01-15 23:46:42 +01:00
Rémi Verschelde
9b8d1383ce Mono: Fix parsing assembly names as UTF-8
Fixes #27185.
2020-01-15 11:51:03 +01:00
Ignacio Etcheverry
a6a5ef0fd6 Mono/C#: Add error checks to detect possible Reference leaks 2020-01-13 21:00:07 +01:00
Ignacio Etcheverry
ea737db43c Mono/C#: Fix _update_exports() leaking temporary Object/Node instances 2020-01-13 20:58:46 +01:00
dankan1890
51c601d2e3 [Mono]: the C# script icon is now visible in the editor. 2020-01-03 22:49:22 +01:00
Rémi Verschelde
399e53e8c3
Merge pull request #34784 from neikeq/fix-hintpath-godottools
Mono/C#: Fix wrong HintPath for package in GodotTools
2020-01-03 16:34:08 +01:00
Ignacio Etcheverry
9ce0ddcf0d Mono/C#: Fix wrong HintPath for package in GodotTools 2020-01-03 15:53:16 +01:00
Aaron Franke
68ba2588b8
[Mono] Color arithmetic operators 2020-01-03 06:00:14 -05:00
Aaron Franke
0b3f1cc70a
[Mono] Make Sign methods consistent with GDScript and System.Math 2020-01-02 16:41:41 -05:00
Ignacio Etcheverry
c1ff3ef9e8 Mono/C#: Fix comment generation for non-constant param default
- Generate the comment for the param, even if the method has no description.
- Generate the comment outside the <summary> element.
2020-01-02 18:10:02 +01:00
Ignacio Etcheverry
f3aa793ba3 Mono/C#: Fix bindings generator with void vararg methods
Commit 4d727f1ee6 made it possible for vararg
methods to return void. This broke the C# bindings generator which was
assuming in one place that vararg methods always return Variant.
2020-01-02 18:02:48 +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
Ignacio Etcheverry
ea75ea50d2 Mono/C#: Fix GD.PrintErr now showing in the Output panel 2020-01-02 13:13:22 +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 Roldán Etcheverry
7fddf5eb7c
Merge pull request #34699 from van800/godot-guid
Custom property for Godot generated project
2019-12-31 20:28:14 +01:00
Rémi Verschelde
edf2ed5e50
Merge pull request #34582 from timothyqiu/forward-decl
Cleans up headers included in editor_node.h
2019-12-30 16:28:47 +01:00
Ivan Shakhov
af2e6e12d1 add custom property to csproj, which identifies that project is generated by Godot 2019-12-30 16:16:47 +01:00
Dan Kramer
1b26f2c505 Fix msbuild target argument 2019-12-29 17:03:21 -05:00
Ignacio Etcheverry
86274b9fc9 Mono/C#: Re-structure API solution and GodotTools post-build target
Previously we had a placeholder solution called 'Managed' to benefit from
tooling while editing the a part of the C# API.
Later the bindings generator would create the final 'GodotSharp' solution
including these C# files as well as the auto-generated C# API.
Now we replaced the 'Managed' solution with the final 'GodotSharp' solution
which is no longer auto-generated, and the bindings generator only takes
care of the auto-generated C# API.
This has the following benefits:
- It's less confusing as there will no longer be two versions of the same file
(the original and a generated copy of it). Now there's only one.
- We no longer need placeholder for auto-generated API classes, like Node or
Resource. We used them for benefiting from tooling. Now we can just use the
auto-generated API itself.
- Simplifies the build system and bindings generator. Removed lot of code
that is not needed anymore.

Also added a post-build target to the GodotTools project to copy the output to
the data dir. This makes it easy to iterate when doing changes to GodotTools,
as SCons doesn't have to be executed anymore just to copy these new files.
2019-12-28 20:48:55 +01:00
Ignacio Roldán Etcheverry
318c693516
Merge pull request #34595 from van800/mac_rider
Fix search for Rider path on Mac
2019-12-26 02:16:55 +01:00
Ignacio Roldán Etcheverry
f90e8c41a2
Merge pull request #34604 from neikeq/issue-27674
Mono/C#: Fix memory leak with new Reference instances created from C#
2019-12-25 20:47:07 +01:00
Ignacio Etcheverry
0ef635c0e3 Mono/C#: Fix memory leak with new Reference instances created from C# 2019-12-25 19:33:59 +01:00
Ivan.Shakhov
682dd04b2d fix Rider path on Mac 2019-12-25 00:14:31 +01:00
Haoyu Qiu
078c0d75f2 Cleans up headers included in editor_node.h 2019-12-24 21:46:05 +08:00
Dan Kramer
097d1c9383 add suggested fix 2019-12-21 13:26:29 -05:00
Rémi Verschelde
a10449bbbc
Merge pull request #34514 from neikeq/remove-dep-on-mono-posix
Mono/C#: Remove GodotTools dependency on the Mono.Posix assembly
2019-12-21 17:07:18 +01:00
Ignacio Etcheverry
5a3ccf4f14 Mono/C#: Remove GodotTools dependency on the Mono.Posix assembly
MSBuild on Windows uses the system .NET Framework BCL instead of Mono's. Because
of this, it may not be able to find the Mono.Posix assembly, so it's better
not to depend on it. We needed Mono.Posix to call Syscall.access, so we can
replace this with an internal call that does the same in C++.
2019-12-21 15:55:45 +01:00
Rémi Verschelde
2a4c528d06
Merge pull request #34465 from neikeq/no-hardcode-debugger-wait
Mono/C#: Remove hard-coded debugger wait at initialization
2019-12-19 21:27:59 +01:00
Ignacio Etcheverry
f3c6c63b94 Mono/C#: Remove hard-coded debugger wait at initialization
Up until now debug builds would always wait up to 500 ms during initialization
to give time for debuggers to attach to the game.
We no longer want this as it increases startup time unnecesarily.
The way forward is to setup the debugger agent as client instead of server.
This way it's the game that connect to the debugger, not the other way around.
If server mode is still desired, suspend=y can be used to indefinitely wait
for the debugger to attach. This all can be specified with the environment
variable 'GODOT_MONO_DEBUGGER_AGENT' when launching the game.
2019-12-19 17:07:20 +01:00