Commit graph

258 commits

Author SHA1 Message Date
Ignacio Etcheverry
f6f2be7577 Fix crash due to ~CSharpInstance() being called on freed instance
This would be the case when calling SetScript on an object with a C# script.
2018-12-01 02:28:24 +01:00
Ignacio Etcheverry
d275d848b3 C#: Replace calls to old of old Basis(Vec3,Vec3,Vec3) constructor 2018-11-20 22:23:09 +01:00
Rémi Verschelde
173b342ca7 Remove trailing whitespace
With `sed -i $(rg -l '[[:blank:]]*$' -g'!thirdparty') -e 's/[[:blank:]]*$//g'`
(+ manual revert of some thirdparty code under `platform/android`).
2018-11-20 11:15:02 +01:00
Ignacio Etcheverry
5712daf2d9
Merge pull request #23833 from neikeq/hh
C#: Fix Basis(Vec3,Vec3,Vec3) constructor
2018-11-20 06:13:29 +01:00
Ignacio Etcheverry
bf94eed60c C#: Fix Basis(Vec3,Vec3,Vec3) constructor
Now it sets axes in order to match GDScript implementation.
2018-11-20 02:08:22 +01:00
Michael Alexsander Silva Dias
92342690f7 Rename "Log*()" functions to "Push*()" in C# 2018-10-31 15:40:38 -03:00
Ben Rog-Wilhelm
f2476f8a7c Add new log functions for C#. 2018-10-25 20:32:50 -07:00
Ignacio Etcheverry
b63e518ce9 Mono: Fix crash on NodePath/RID disposal during Godot shutdown 2018-10-06 23:00:18 +02:00
Ignacio Etcheverry
b5aa5bca12 Fix C# API assembly build errors in generics 2018-10-05 19:39:11 +02:00
zochris
4a11864968
loosen generic guard on method for ResourceLoader
For more details see #22658
2018-10-05 15:32:33 +02:00
zochris
b84992e374
loosen generic guard on Node extension methods
For more details see #22658
2018-10-05 15:06:05 +02:00
Ignacio Etcheverry
50fd5ef3b5 Mono: Fix not creating generic Array or Dictionary where expected 2018-09-27 00:11:31 +02:00
Kelly Thomas
d4b2423428 [Mono] implement Transform.InterpolateWith() 2018-09-15 13:08:21 +08:00
Fabio Alessandrelli
d6b31daec6 Rename slave keyword to puppet
The slave keyword will still be available as deprecated in 3.1 but will
be dropped from future releases.
2018-09-15 00:06:03 +02:00
Ignacio Etcheverry
995a40e8ef Move modules/mono/glue/cs_files to modules/mono/glue/Managed/Files
Added dummy MSBuild project and solution to get tooling help when editing these files.
2018-09-12 22:03:36 +02:00
Ignacio Etcheverry
e558e1ec09 Fix/workaround for issue #21667
When a Reference managed instance is garbage collected and its finalizer is called, it could happen that the native instance is referenced once again before the finalizer can unreference and memdelete it. The workaround is to create a new managed instance when this happens (at least for now).
2018-09-12 03:24:08 +02:00
Ignacio Etcheverry
b1356a3590 Cleanup of c# api files and bindings generator
- We no longer generate RID and NodePath C# classes. Both will be maintained manually.
- We no longer generate C# declarations and runtime registration of internal calls for the following classes: RID, NodePath, String, GD, SignalAwaiter and Godot.Object (partial base).
- We no longer auto-generate the base members of Godot.Object. They will be maintained manually as a partial class.

This makes it easier to maintain these C# classes and their internal calls, as well as the bindings generator which no longer generates C# classes that don't derive from Godot Object, and it no longer generates the Godot.Object base members (which where unreadable in the bindings generator code).

- Added missing 'RID(Object from)' constructor to the RID C# class.
- Replaced MONO_GLUE_DISABLED constant macro with MONO_GLUE_ENABLED.
- Add sources in module/mono/glue even if glue is disabled, but surround glue files with ifdef MONO_GLUE_ENABLED.
2018-09-12 03:23:45 +02:00
Aaron Franke
627ed98ed1 [Mono] Various style changes and naming standardization 2018-09-10 15:22:10 -04:00
Aaron Franke
4743852466 [Mono] Tabs -> Spaces 2018-09-10 15:12:49 -04:00
Ignacio Etcheverry
78bb53f85d
Merge pull request #21205 from KellyThomas/c-sharp-feature-parity-quat
[Mono] Quat - add some missing constructors and methods
2018-08-27 16:18:09 +02:00
exts
035d498af2 Added Collections namespace to Array & Dictionary 2018-08-25 17:19:37 -05:00
Kelly Thomas
a941684590 mono: Quat - add some missing constructors and methods 2018-08-24 07:56:54 +08:00
Aaron Franke
514856d8c7 [Mono] Move several small related files 2018-08-23 12:50:04 -04:00
Kelly Thomas
46207ae7aa [Mono] AABB - Position, Size, End setters, Rect2 - End setter 2018-08-23 23:45:18 +08:00
Rémi Verschelde
1e729630d6
Merge pull request #21240 from aaronfranke/mono-project-vector
[Mono] Vector2/3 Project methods
2018-08-23 08:59:26 +02:00
Ignacio Etcheverry
980b81dd2a
Merge pull request #21174 from KellyThomas/c-sharp-feature-parity-rect2
[Mono] Rect2 - add Abs(), rename private fields
2018-08-22 22:34:45 +02:00
Aaron Franke
434973fb83 [Mono] Vector2/3 Project methods 2018-08-22 13:27:35 -04:00
Rémi Verschelde
a319d72071
Merge pull request #21253 from aaronfranke/plane-constants
Rename Plane constants, add to Mono
2018-08-21 21:16:41 +02:00
Rémi Verschelde
2969dffbe3 Deprecate incorrect Color::gray()
This average is not a proper approximation of a grayscale value,
get_v() is better suited for that.

If we want a real to_grayscale() conversion, it's somewhat more
involved: https://en.wikipedia.org/wiki/Grayscale

Remove the deprecated Gray() from C# bindings as it conflicts
with new named color constants.
2018-08-21 17:48:31 +02:00
Aaron Franke
a986686ac4 Rename Plane constants, add to Mono
But I'm not tagging PR as [Core] or [Mono] due to it being a minor change anyway.
2018-08-21 01:35:07 -04:00
Kelly Thomas
792a8446ac mono: add Abs() to Rect2 and rename private fields 2018-08-19 19:18:12 +08:00
Ignacio Etcheverry
7287300433 Mono: Improve C# core files (glue/cs_files) buildsystem
- Search C# files recursively in 'glue/cs_files'.
- Determine a version for the C# core files automatically. The latest modified time will do for now.
2018-08-17 13:51:55 +02:00
Rémi Verschelde
4548ec4a49
Merge pull request #20945 from neikeq/dict-erase-retbool
Dictionary: remove erase_checked(key), make erase(key) return bool
2018-08-15 01:08:23 +02:00
Kelly Thomas
815d08f10c mono: add constants to transform and vector structs 2018-08-15 02:03:36 +08:00
Ignacio Etcheverry
21d285e30f Dictionary: remove erase_checked(key), make erase(key) return bool 2018-08-14 19:19:05 +02:00
Ignacio Etcheverry
d7b9fcd336
Merge pull request #20890 from KellyThomas/mono-is-instance-valid
mono: add IsInstanceValid(), move WeakRef()
2018-08-14 18:12:18 +02:00
Kelly Thomas
9341129d14 mono: add IsInstanceValid(), move WeakRef() 2018-08-14 15:48:54 +08:00
Ignacio Etcheverry
c4e75aa63a
Merge pull request #20706 from mysticfall/issue-20705
Add missing GetPtr() for Dictionary<> and Array<>
2018-08-13 22:37:09 +02:00
Xavier Cho
5d2c239772 Add missing GetPtr() for Dictionary<> and Array<>
Add missing GetPtr() method for generic versions of Dictionary
and Array to fix #20705.
2018-08-04 14:34:55 +09:00
exts
cdb4ae471b Added generic method for ResourceLoader: Load<T>() 2018-08-03 13:40:42 -05:00
Paul Joannon
877ea882ce
Add missing methods to Node class in the mono glue
* GetNodeOrNull<T>
* GetChild<T>
* GetChildOrNull<T>
* GetOwner<T>
* GetOwnerOrNull<T>
* GetParent<T>
* GetParentOrNull<T>
2018-07-27 08:50:35 +02:00
Aaron Franke
e3368d692d [Mono] Fix Color incorrect ordering of int export methods, added 64-bit
[Mono] Fix Color incorrect ordering of int export methods, added 64-bit long export methods.
2018-07-25 15:34:24 -05:00
Ignacio Etcheverry
fe28e323b3
Merge pull request #20298 from PJB3005/18-07-20-mono-partial-api-ext
Makes Mono binding classes partial & adds GetNode<T>.
2018-07-25 18:03:57 +02:00
Ignacio Etcheverry
779c9d638e
Merge pull request #15880 from neikeq/better-collections
Mono: Add Dictionary and Array classes
2018-07-23 23:59:04 +02:00
Aaron Franke
174cf31d00 [Mono] Improvements to GD.cs: PascalCasing and real_t
[Mono] Improvements to GD.cs: PascalCasing and real_t
2018-07-21 16:40:46 -05:00
Pieter-Jan Briers
a8c97eb094 Makes Mono bindings partial & adds GetNode<T>. 2018-07-20 13:55:13 +02:00
Ignacio Etcheverry
ee3c476c9a Add Array and Dictionary wrapper classes to C# 2018-07-20 01:44:30 +02:00
oisincar
7a4d593198 Fix bug with Basis.Transposed()
Fix bug where Basis.Transposed() incorrectly updated local basis, and
returned an unmodified copy. This also fixes Transform.Inverse().
2018-07-19 00:17:45 +01:00
Ignacio Etcheverry
d4f860c768
Merge pull request #19231 from aaronfranke/mono-fposmod-to-mod
[Mono] Rename Fposmod to PosMod, fix output
2018-07-05 01:05:44 +02:00
Aaron Franke
5b2b23c9a9 [Mono] Rename Fposmod to PosMod
[Mono] Rename Fposmod to PosMod
2018-06-27 00:58:24 -05:00
Nathan Warden
c2315e3291 Lerp now consistent with Godot API. InverseLerp fixed. 2018-06-24 17:52:17 -05:00
Fabio Alessandrelli
8e35d937a9 New sync keywords in GDScript, NativeScript, Mono 2018-05-29 20:26:41 +02:00
Max Hilbrunner
4c69a495c9
Revert "RPCMode refactor, more sync modes" 2018-05-29 11:47:52 +02:00
Fabio Alessandrelli
a5e8a3be5e New sync keywords in GDScript, NativeScript, Mono 2018-05-26 10:49:33 +02:00
Rémi Verschelde
17faf11119
Merge pull request #19063 from KellyThomas/c-sharp-feature-parity-vectors
mono: Add Slerp method to vector classes, expose Cross method for Vector2
2018-05-25 09:44:03 +02:00
Kelly Thomas
b335274bcd mono: add Slerp method to vector classes, expose Cross method for Vector2, and fix unnecessary casts in Basis 2018-05-22 08:27:49 +08:00
Kelly Thomas
c7e98eef67 Fix index out of range error in string.Extension() 2018-05-21 18:48:53 +08:00
Rémi Verschelde
228b09bafb
Merge pull request #18974 from KellyThomas/c-sharp-feature-parity-basis
Mono: Basis constructor for euler parameter
2018-05-18 21:09:57 +02:00
Ignacio Etcheverry
fc90f41f53
Merge pull request #18975 from KellyThomas/c-sharp-feature-parity-color
mono: New Color methods:  Darkened, Lightened and ToRgba32
2018-05-18 20:09:01 +02:00
Kelly Thomas
16e1b4bacf mono: Plane, expose Normal, and D 2018-05-17 23:04:20 +08:00
Kelly Thomas
88bd33f451 mono: New Color methods: Darkened, Lightened and ToRgba32 2018-05-17 21:41:19 +08:00
Kelly Thomas
c26d30986a Mono: Basis constructor for euler parameter 2018-05-17 21:31:14 +08:00
Ignacio Etcheverry
41f79a6f14
Merge pull request #18889 from madadam/async-await-fix
Set current SynchronizationContext before the game loop starts
2018-05-16 23:44:55 +02:00
Guilherme Felipe
35024d4e7b Add missing copyright headers 2018-05-16 14:50:44 -03:00
Adam Cigánek
f25240cfe6 Set current SynchronizationContext before the game loop starts
This fixes the problem that `SynchronizationContext.Current` would be null
during the call to `_EnterTree`, `_Ready` and the first call to `_Process` thus
the task continuations would be scheduled outside the main thread, which is unexpected and might lead to crashes.

With this change, task continuations are scheduled always on the main thread and so async/await can be used without any explicit synchronization, which is what is expected.

Fixes #18849
2018-05-15 15:09:40 +02:00
Kelly thomas
a6bd2c6e72 round / ceil methods for c sharp vectors 2018-05-04 20:17:10 +08:00
Xavier Cho
6b611e6431 #18051: Fix indentation issues introduced during clean up 2018-04-17 07:53:27 +09:00
Xavier Cho
e59fad3924 #18051: Do not use var in a for-loop, or where type is not obvious 2018-04-17 07:39:37 +09:00
Xavier Cho
94edd92248 #18051: Use common name for Color type argument 2018-04-17 07:39:37 +09:00
Xavier Cho
f0bf5532fa #18051: Remove redundant verbatim prefixes 2018-04-17 07:39:37 +09:00
Xavier Cho
85787776a5 #18051: Use default parameter value 2018-04-17 07:39:37 +09:00
Xavier Cho
b765c051cb #18051: Use array initializer when applicable 2018-04-17 07:39:37 +09:00
Xavier Cho
9097c71255 #18051: Remove redundant parenthesis 2018-04-17 07:39:37 +09:00
Xavier Cho
93dd59d763 #18051: Remove unnecessary variable assignments 2018-04-17 07:39:37 +09:00
Xavier Cho
fdfc478c88 #18051: Use 'var' when applicable 2018-04-17 07:39:37 +09:00
Xavier Cho
0ef3e0577b #18051: Remove redundant casts and 'using', 'else', 'this' statements 2018-04-17 07:39:37 +09:00
Xavier Cho
9e2e6bb1e2 Remove duplicated declaration of RoundToInt() from Mathf 2018-04-17 07:39:37 +09:00
Chaosus
655a4e6540 [Mono] Improve Mathf 2018-04-13 20:15:49 +03:00
Alexander Alekseev
5677aed175 [mono] Fixes #17936 as GodotSharp (Core\Basic.cs) requires C#7 now, but we most probably should keep C#6 yet 2018-04-03 09:48:03 +03:00
Chaosus
d52722c6da Added wrap functions to C# 2018-03-26 14:33:09 +03:00
Carter Anderson
91f271fa9e Fix mono basis GetEuler bug and marshalling/unmarshalling 2018-03-24 13:45:11 -07:00
Ignacio Etcheverry
a8d8c06753
Merge pull request #17134 from aaronfranke/master
[Mono] Replace float with real_t, other misc C# improvements
2018-03-24 21:10:41 +01:00
Aaron Franke
ff97c97c93 Replace float with real_t, default Vectors, other misc C# improvements
Replace float with real_t in most files, defined at the top of each file via using. Objects such as Vector3 now accept doubles as inputs, and convert to real_t internally. I've added default Vectors such as Vector3.Zero. Other misc C# improvements such as Mathf.RoundToInt(). Color continues to use float only because high precision is not needed for 8-bit color math and to keep things simple. Everything seems to compile and work fine, but testing is requested, as this is the first time I've ever contributed to Godot.
2018-03-22 21:53:21 -05:00
Paul Joannon
d7020aef8d
[mono] rename functions to conform to PascalCase
in:
* StringExtensions.cs
* Transform.cs
2018-03-04 15:37:29 +01:00
Ignacio Etcheverry
f37090ccf4 Mono: Better versioning and gracefully unloading of Godot API assemblies 2018-02-25 20:56:27 +01:00
Ignacio Etcheverry
6e200b1fe0
Merge pull request #16326 from NathanWarden/fix_basis_mono
[Mono] Basis values now marshalled in the correct order.
2018-02-18 19:54:53 +01:00
Paul Joannon
efd52cd172
add a [Signal] attribute to CSharpScripts 2018-02-17 19:29:26 +01:00
Nathan Warden
0cc4de1f24 [Mono] Basis values now marshalled in the correct order. 2018-02-02 16:45:30 -05:00
Nathan Warden
2109bd3f97 Fix an infinite recursion in the Mathf.Decimals method when using floats. 2018-01-31 14:02:17 -05:00
Ignacio Etcheverry
58448561c7 Mono: Fix NodePath and RID bindings 2018-01-25 23:46:54 +01:00
Rémi Verschelde
9f479f096c Fix typos in code and docs with codespell
Using v1.11.0 from https://github.com/lucasdemarchi/codespell
2018-01-18 22:01:42 +01:00
Kelly Thomas
ed17b42654
remove c#7 features for compatibility with 2015 Build Tools
https://github.com/godotengine/godot/issues/15742
2018-01-18 19:43:23 +08:00
Ignacio Etcheverry
bff9627dc4 Mono: Some StackTrace to StackInfo[] fixes
- Sometimes `StackFrame.GetMethod()` returns null (e.g.: latest frame of a `MissingMethodException`). Still not sure what to do with that frame (maybe skip it), but at least it no longer fails.
- Skip `CSharpLanguage::debug_get_current_stack_info()` if an error is printed from `GDMonoUtils::update_corlib_cache()`.
- Fix crash when calling `GDMonoUtils::print_unhandled_exception(exc)` if there is no ScriptDebugger attached.
2018-01-12 19:31:15 +01:00
Pieter-Jan Briers
6e14cf991a Fixes Mono color creation from string.
Fixes #15468

Also improves the error messages if the string isn't hex, because saying that the color value is negative is just a side effect of the implementation and tells you nothing.
2018-01-10 13:56:30 +01:00
Ignacio Etcheverry
5be356b72f Mono: Implement stack info for errors and exceptions 2018-01-09 17:19:03 +01:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Ignacio Etcheverry
b271aa48e4 Mono: Script lifetime fixes
- alloc_language_binding: Use strong GC handle as well for references. Fixes #15138
- Set the native instance field of Godot.Object to IntPtr.Zero when it's freed.
- Create weak handles without tracking resurrection (that was causing trouble). This means we have to call notification predelete before queueing a native Object for deletion, and use the MonoObject* passed by the finalizer because the weak GC handle target will return NULL at this point.
2018-01-01 03:05:13 +01:00
Ignacio Etcheverry
0a0a44da8d Mono: Make the bindings generator output enums
- Switch to PascalCase for constants names
2017-12-24 04:20:41 +01:00
Unknown
fd1b94e307 Improve slang, especially in user-visible parts 2017-12-05 15:41:38 +01:00
Andreas Haas
e69dd3c712
Mono: Use PascalCase in core types. 2017-11-21 23:32:40 +01:00
pablotato
054a2ac579 Add cartesian to polar conversion functions 2017-11-20 23:34:40 +01:00
Ferenc Arn
d28763a4c1 Rename Rect3 to AABB.
Fixes #12973.
2017-11-17 11:01:41 -05:00
Leon Krause
9b7b46143d Move singleton management from ProjectSettings to Engine 2017-11-14 15:15:13 +01:00
Rémi Verschelde
5bc2cf257b Convert DOS line endings to Unix line endings
Should fix issues some of us have with `misc/dist/uwp_template/AppxManifest.xml`
always showing up as modified.
Might cause issues on Windows due to the removal of BOMs or change of line endings
in some of the Mono, UWP or gradlew.bat files, we will test and adapt if need be.
2017-11-05 11:37:59 +01:00
Ignacio Etcheverry
6e6b455d1f Export attribute fixes and improvements
- Allow non-public fields to be exported as well (to avoid confusion).
- Set PROPERTY_HINT_RESOURCE_TYPE for resource derived fields.
- Support enums and automatically fill PROPERTY_HINT_ENUM's hint_string for enum fields.
2017-10-17 14:42:13 +02:00
Ferenc Arn
8ddbd19777 Apply a few recent chages in Quat and Basis to their respective Mono counterparts. (#11899) 2017-10-09 14:49:53 +02:00
Ignacio Etcheverry
e36fb95c50 Added mono module 2017-10-03 00:01:26 +02:00