Commit graph

612 commits

Author SHA1 Message Date
Rémi Verschelde a61ad365f5
Merge pull request #27677 from akien-mga/Wimplicit-fallthrough
Fix -Wimplicit-fallthrough warnings from GCC 8
2019-04-05 16:12:45 +02:00
Chaosus 55f3bd97a2 Added direction_to method to vectors 2019-04-05 17:09:57 +03:00
Rémi Verschelde 63d3a42f82
Merge pull request #27465 from neikeq/road-to-lang-agnostic-docs-is-going-to-be-tough
EditorHelp: Improve enum ref resolving and add constant ref support
2019-04-05 15:19:21 +02:00
Rémi Verschelde fc370b3feb Fix -Wimplicit-fallthrough warnings from GCC 8
Adds `FALLTHROUGH` macro to specify when a fallthrough is intentional.
Can be replaced by `[[fallthrough]]` if/when we switch to C++17.

The warning is now enabled by default for GCC on `extra` warnings level
(part of GCC's `-Wextra`). It's not enabled in Clang's `-Wextra` yet,
but we could enable it manually once we switch to C++11. There's no
equivalent feature in MSVC for now.

Fixes #26135.
2019-04-05 15:14:53 +02:00
ForLoveOfCats 444242a080 Mono: Make missing default constructor error more foolproof 2019-04-04 16:56:02 -04:00
ForLoveOfCats 46e79e6fad Mono: Makes GD.Convert take Variant.Type instead of int 2019-04-04 16:07:48 -04:00
Ignacio Etcheverry 0338e55a6e Fix memory leak introduced in bb6814a 2019-04-02 22:56:17 +02:00
Rémi Verschelde e3bd84fa57
Merge pull request #27485 from Faless/io/encode_decode_safety_pr
Safer encode/decode variant.
2019-04-01 17:00:40 +02:00
Fabio Alessandrelli 393e62b98a Add object encoding param to serialization methods
Network peers get_var/put_var
File get_var/store_var
GDScript/Mono/VisualScript bytes2var/var2bytes
Add MultiplayerAPI.allow_object_decoding member which deprecates PacketPeer.allow_object_decoding.

Break ABI compatibaility (API compatibility for GDNative).
2019-04-01 15:53:19 +02:00
Rémi Verschelde 39c868171e doc: Bump version to 3.2 2019-04-01 12:33:56 +02:00
Ignacio Etcheverry c8aa85189a EditorHelp, makerst: Improve enum ref resolving and constant ref support
Enum reference resolving will now search in the @GlobalScope if no class is specified and the enum cannot be resolved in the current class.
Added support for constant references in EditorHelp, e.g.: [constant KEY_ENTER] or [constant Control.FOCUS_CLICK]. It supports enum constants (the enum name must not be included).
2019-03-29 23:40:31 +01:00
Ignacio Etcheverry bb6814aef0 C#: Add DynamicGodotObject class
Expands to Object.call, Object.set and Object.get for accessing members. This means it can also access members from scripts written in other languages, like GDScript.
2019-03-29 00:53:48 +01:00
Ignacio Roldán Etcheverry e453934824
Merge pull request #27359 from neikeq/who-reads-docs-anyway
C#: Bindings generator now translates BBCode docs to XML comments
2019-03-23 20:49:59 +01:00
Ignacio Etcheverry 1ad16b3d4a C#: Bindings generator now translates BBCode docs to XML comments 2019-03-23 20:39:55 +01:00
Ignacio Roldán Etcheverry 96abb695f2
Merge pull request #27270 from shartte/fix-generics-parsing
Fix parsing of generic type declarations in C# source files
2019-03-20 18:34:28 +01:00
Sebastian Hartte 7440295ad1 Add support for new MSBuild directory naming introduced in VS 2019. 2019-03-20 17:57:20 +01:00
Sebastian Hartte 34366bc27f Fix parsing of generic type declarations in C# source files. 2019-03-20 17:23:11 +01:00
Rémi Verschelde 3b5a0f34d4
Merge pull request #27014 from neikeq/csharp-update-exports-only-in-editor
C#: Update exports only in the editor
2019-03-13 20:07:06 +01:00
Ignacio Etcheverry 5e354162f1 C#: Update exports only in the editor 2019-03-13 16:26:47 +01:00
Rémi Verschelde 4326fd5a7e Mono: Update welcome message with current state 2019-03-12 19:35:02 +01:00
Ignacio Etcheverry e9e7aab8eb Mono: Some assembly referencing changes and cleanup
Apparently we don't need to call mono_debug_close_image ourselves and we can call mono_image_close right away as it's not our duty to keep that reference.
2019-03-10 18:55:31 +01:00
Ignacio Etcheverry 4299332ecc Mono: Fix assemblies path String incorrectly constructed from utf8
Also fixed a wrong ifdef that was causing Mono to never be initialized if mscorlib was not found (which was the case with the utf8 assemblies path bug this commit fixes).
This condition was meant for exported projects only, not for the editor only.
2019-03-09 23:00:03 +01:00
Ignacio Roldán Etcheverry 65487ed4ed
Merge pull request #26746 from shartte/godot-trace-listener
Add a custom TraceListener on Startup for Mono
2019-03-08 07:05:41 +01:00
Ignacio Etcheverry a4825c2f8b Fix CSharpInstance::set not working with base classes 2019-03-08 00:12:19 +01:00
Rémi Verschelde 6ee3002237
Merge pull request #26773 from neikeq/issue-26628
Mono: Fix crash with exported field of custom Reference derived type
2019-03-07 22:54:03 +01:00
Ignacio Etcheverry c5f8b0960a Mono: Fix crash with exported field of custom Reference derived type 2019-03-07 22:38:31 +01:00
Ignacio Etcheverry 17a55861f1
Merge pull request #26770 from neikeq/issue-26675
Mono: Partially implement some Godot debug api functions
2019-03-07 22:00:59 +01:00
Ignacio Etcheverry 47407ba2df
Merge pull request #26761 from Chaosus/fix_mono_wrap
Fix division by zero at wrap functions in mono
2019-03-07 21:34:03 +01:00
Ignacio Etcheverry 8e2e0795bb Mono: Partially implement some Godot debug api functions
Debug breaks sent with debug_break and debug_break_parse should display correctly in the Godot debugger now.
2019-03-07 21:02:57 +01:00
Sebastian Hartte 37d448fca7 Added a Godot TraceListener, which is automatically installed on startup. Fixes that Debug/Trace Assertions are simply swallowed by Godot. 2019-03-07 21:00:19 +01:00
Chaosus 752055ccba Fix division by zero at wrap functions in mono 2019-03-07 22:57:12 +03:00
Ignacio Etcheverry 4c0b0a6bdd
Merge pull request #26765 from neikeq/issue-25959
Mono: Fix crash when re-using script binding after domain reloading
2019-03-07 20:50:37 +01:00
Ignacio Etcheverry e904f814c8 Mono: Fix crash when re-using script binding after domain reloading 2019-03-07 19:55:40 +01:00
Sebastian Hartte f8a6a6c8a2 Update scripts exports even when normal script instances are created to better support tool scripts with exported variables. 2019-03-07 18:52:43 +01:00
Rémi Verschelde 64923ff277
Merge pull request #26713 from neikeq/print-msbuild-command
Print MSBuild command if also printing output
2019-03-06 18:22:57 +01:00
Ignacio Etcheverry 0b68677112 Print MSBuild command if also printing output 2019-03-06 17:10:14 +01:00
Ignacio Etcheverry db7928849b
Merge pull request #26712 from neikeq/issue-26681
Mono: Make 'Build' button generate solution if it doesn't exist
2019-03-06 16:54:51 +01:00
Ignacio Etcheverry c97db904a0 Mono: Make 'Build' button generate solution if it doesn't exist 2019-03-06 16:36:53 +01:00
Ignacio Etcheverry 6492de800f
Merge pull request #26661 from neikeq/issue-17601
Mono: Fix array field being assigned MonoArray** instead of MonoArray*
2019-03-05 23:03:25 +01:00
Ignacio Etcheverry c6ac7333a6 Mono: Fix array field being assigned MonoArray** instead of MonoArray*
Fixes #17601
2019-03-05 21:46:55 +01:00
Rémi Verschelde 0a7de5472f
Merge pull request #26591 from neikeq/oi
Mono: Add option to print MSBuild output and improve out of sync error
2019-03-04 18:36:10 +01:00
Ignacio Etcheverry 8877b07f4c Mono: Add option to print MSBuild output and improve out of sync error 2019-03-04 16:05:08 +01:00
Carter Anderson 839ed2d092 Add mono log profiler support 2019-03-02 23:32:03 -08:00
Ignacio Etcheverry 42c57eef13 C#: Fix parsing of class full name when the base has generics
Also we no longer ignore base classes with generics, since we don't really care about that.
2019-03-01 00:23:23 +01:00
Ignacio Etcheverry 22b41ab2fe Mono: Fail on script instance creation if constructor was not found
Previously this would result in NULL dereferencing. Now we fail with an error.
2019-02-28 23:22:46 +01:00
Ignacio Etcheverry 5a4475fce3 Mono: Make sure the generated RootNamespace is a valid identifier 2019-02-28 22:26:15 +01:00
Ignacio Etcheverry b69569415f
Merge pull request #26411 from neikeq/issue-26195
C#: Add Array.Resize(int) method
2019-02-28 18:53:14 +01:00
Ignacio Etcheverry 32cd8ba9bd C#: Add Array.Resize(int) method 2019-02-28 18:33:42 +01:00
Rémi Verschelde 372152220b
Merge pull request #26159 from marxin/fix-Wsuggest-attribute=format
Fix -Wsuggest-attribute=format warnings.
2019-02-27 09:23:26 +01:00
Rémi Verschelde 426a6fdc17
Merge pull request #26134 from marxin/fix-Wsign-compare
Fix -Wsign-compare warnings.
2019-02-27 09:22:47 +01:00
marxin e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
marxin aff84ec55d Fix -Wsuggest-attribute=format warnings. 2019-02-27 06:56:50 +01:00
Ignacio Etcheverry 3e0846e65b Mono: Some editor usability improvements
- Move "Mono" popup menu from the top right corner to `Projects -> Tools` as a submenu.
- Add "Build solution" button to the top right corner. Makes it more visible and quicker to access.
- Fix build list in the bottom panel unselect an item when clicking on empty space. Previously it would hide the issues panel but the item would remain selected, making it impossible to display the issues panel again if there was only one item.
2019-02-27 02:45:21 +01:00
Ignacio Etcheverry 823fb59e10 Remove problematic VS Code hint path on Windows 2019-02-27 02:43:53 +01:00
Ignacio Etcheverry da3776a40a C#: Fix Vector2.AngleToPoint
Fixes #26209
2019-02-23 23:28:31 +01:00
Rémi Verschelde 07fbc34195
Merge pull request #26203 from neikeq/csharp-basis
C#: Basis fixes and cleanup
2019-02-23 20:53:03 +01:00
Ignacio Etcheverry 2c26e7f174 C#: Basis fixes and cleanup
Fix Basis operator[int]. Now it returns columns instead of rows.
Fix Transform2D.AfficeInverse() mutating rather than returning a new Transform2D.
2019-02-23 18:22:30 +01:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Ignacio Etcheverry 9421da57ad C#: Add 'Singleton' property to singleton wrapper class
This property returns an instance of the singleton.
The purpose of this is to allow using methods from the base class like 'Connect'.
Since all Godot singletons inherit Object, the type of the returned instance is Godot.Object.
2019-02-19 22:38:22 +01:00
Ignacio Etcheverry aa5b99821b
Merge pull request #26065 from neikeq/csharp-fix-gd-range
C#: Make GD.Range return IEnumerable instead of array
2019-02-19 19:27:37 +01:00
Ignacio Etcheverry 0826b79035 C#: Make GD.Range return IEnumerable instead of array
- Make NodePath and RID sealed classes.
- Renamed rand_range to RandRange.
2019-02-19 18:46:18 +01:00
Ignacio Etcheverry 1174d10e3c
Merge pull request #25890 from neikeq/issue-25818
Fix Godot.Reference marshalling from MonoObject* to Variant
2019-02-19 15:05:05 +01:00
Ignacio Etcheverry 29fd942dd6
Merge pull request #26039 from neikeq/throw_objectdisposedexception
C#: Throw ObjectDisposedException from disposed wrapper classes
2019-02-19 01:02:20 +01:00
Ignacio Etcheverry e1f01bf2ac
Merge pull request #26038 from neikeq/csharp_rand_funcs
C#: Add random functions to GD class
2019-02-19 00:52:01 +01:00
Ignacio Etcheverry efd5d4bcf9 C#: Throw ObjectDisposedException from disposed wrapper classes 2019-02-19 00:37:15 +01:00
Ignacio Etcheverry ce67808818 C#: Add random functions to GD class 2019-02-19 00:35:19 +01:00
RomanAkberov 041a7bbeba C#: fix Quat.Equals. 2019-02-19 01:01:05 +07:00
Ignacio Etcheverry a8dfe9ff7f Don't print 'Cannot find Mono in the registry' if bundled with Godot
Closes #24753
2019-02-15 19:52:32 +01:00
Ignacio Etcheverry d17ba9a140 Mono: Fix export template build errors
Fixes #25903
2019-02-15 19:52:22 +01:00
Ignacio Etcheverry b41a793592 Fix Godot.Reference marshalling from MonoObject* to Variant
Need to cast Ref<T> to Variant instead of constructing Variant from Object*, otherwise the Variant won't hold a reference.
2019-02-14 22:54:15 +01:00
Rémi Verschelde 55ca2a7c88
Merge pull request #25821 from akien-mga/sync-class-and-filenames
Ensure classes match their header filename
2019-02-13 08:49:39 +01:00
Aaron Franke f97eb6d881 [Mono] Fix Transform2D rotation and scale 2019-02-12 17:59:29 -05:00
Rémi Verschelde fe7e11e008 Modules: Ensure classes match their header filename
Renamed:
- `modules/mono/mono_gd/gd_mono_class_member.h` -> `i_mono_class_member.h`
- `modules/upnp/upnpdevice.h` -> `upnp_device.h`
- `modules/websocket/websocket_multiplayer.h` -> `websocket_multiplayer_peer.h`
2019-02-12 22:59:56 +01:00
Rémi Verschelde c4835c4345
Merge pull request #25721 from neikeq/ww
Use script instance binding for objects constructed from C#
2019-02-12 15:29:25 +01:00
Rémi Verschelde b7cc2bb1e2 Core: Ensure classes match their header filename
Also drop some unused files.

Renamed:
- `core/dvector.h` -> `pool_vector.h`
- `core/io/resource_import.h` -> `resource_importer.h`
- `core/sort.h` -> `sort_array.h`
- `core/string_db.h` -> `string_name.h`

Dropped:
- `core/allocators.h`
- `core/os/shell.h`
- `core/variant_construct_string.cpp`
2019-02-12 13:34:25 +01:00
Carter Anderson 22bf89e970 Use "origin" instead of "o" in Transform2D.Rotation 2019-02-11 23:46:55 -08:00
Ignacio Etcheverry be98a6ebbc
Merge pull request #25724 from aaronfranke/mono-transform
[Mono] Fix Transform2D origin
2019-02-11 22:27:49 +01:00
Ignacio Etcheverry 9115c6ab15
Merge pull request #25803 from neikeq/yy
Windows: Default to system MSBuild and add VSCode hint path
2019-02-11 22:25:11 +01:00
Ignacio Etcheverry da00c338a3 Add VSCode hint path for Windows 2019-02-11 22:03:51 +01:00
Ignacio Etcheverry 9a08b90472 Default to MSBuild from VS Build Tools instead of Mono's
Don't pass FrameworkPathOverride to MSBuild. It's causing issues with some nuget packages.
2019-02-11 22:03:37 +01:00
Ignacio Etcheverry eda4be193f
Merge pull request #25773 from neikeq/xx
Do not initialize Mono if 'res://.mono/' and mscorlib are missing
2019-02-10 19:08:28 +01:00
Ignacio Etcheverry 3afd9deded
Merge pull request #25774 from neikeq/fix-noreturn-attr-check
Fix check to determine if [[noreturn]] attribute is usable
2019-02-10 19:08:15 +01:00
Ignacio Etcheverry b67955afca Fix check to determine if [[noreturn]] attribute is usable 2019-02-10 18:45:18 +01:00
Ignacio Etcheverry 7f596270f3 Fix exporting assemblies from wrong output path
This is the whole reason 'fill_search_dirs' was added for, yet somehow I forgot to pass the config parameter.
2019-02-10 18:37:42 +01:00
Ignacio Etcheverry 24a2ae7f3c Do not initialize Mono if 'res://.mono/' and mscorlib are missing
This is needed to avoid aborting due to missing mscorlib for projects that do not use C#.
If 'res://.mono/' exists, then we assume the project uses C#, in which case a missing mscorlib should still abort.
2019-02-10 18:34:37 +01:00
Aaron Franke 25a90bcf1a [Mono] Fix Transform2D origin 2019-02-09 14:56:14 -05:00
Ignacio Etcheverry 9df44c2d2c Use script instance binding for objects constructed from C#
Only possible if the object class is a "native type". If the object class is a user class (that derives a "native type") then a script is needed.
Since CSharpLanguage does cleanup of script instance bindings when finished, cases like #25621 will no longer cause problems.

Fixed ~Object() trying to free script instance bindings after the language has already been removed, which would result in a NULL dereference.
2019-02-09 00:32:18 +01:00
Ignacio Etcheverry 5f8c30fbca Mono: Create player script metadata when building manually
Previously this was only done when building the script for running the game. This was a problem because the user could want to build the project manually with the "Build project" button, to then run the game from the command line or similar.
2019-02-08 22:49:27 +01:00
Ignacio Etcheverry 4aa4916b11 Mono: Workaround to fix 'flushing' errors when building at editor startup 2019-02-05 18:51:24 +01:00
Ignacio Etcheverry 919fa75803
Merge pull request #25574 from neikeq/ss
Mono: Lifetime fixes for CSharpInstance and instance binding data
2019-02-03 07:36:33 +01:00
Ignacio Etcheverry d8593747e0 Mono: Fix default debugger agent argument never being used 2019-02-03 06:51:07 +01:00
Ignacio Etcheverry 3233083f63 Mono: Lifetime fixes for CSharpInstance and instance binding data
Avoid CSharpInstance from accessing its state after self destructing (by deleting the Reference owner).
It's now safe to replace the script instance without leaking or crashing.

Also fixed godot_icall_Object_weakref return reference being freed before returning.
2019-02-03 06:47:25 +01:00
Ignacio Etcheverry 4e4e889c75
Merge pull request #25478 from neikeq/rr
Mono: Fix MonoPosixHelper not being found
2019-02-03 06:31:52 +01:00
Ignacio Etcheverry 065828d159 Mono: Fix MonoPosixHelper not being found 2019-02-03 05:38:47 +01:00
Ignacio Etcheverry d3c51a5dfb Mono: Cleanup 2019-02-03 05:38:40 +01:00
Rémi Verschelde 57c0082533 Mono: Test Windows binaries with lowercase extension
To help users writing good cross-platform code, Godot's
`FileAccessWindows:open()` will issue a warning on case mismatch, which
happens here with capitalized extensions given by `PATHEXT` compared to
actual file extensions which are lowercase 99% of the time.

Fixes #25368.
2019-01-27 11:54:32 +01:00
Ignacio Etcheverry bc8b61bb06 Mono: Fix hot reload build errors and cleanup 2019-01-22 18:33:36 +01:00
Ignacio Etcheverry 077e489773 Mono: Add assembly reloading to running games
Add environment variable to specify a custom --debugger-agent for mono.
2019-01-21 22:44:09 +01:00
Ignacio Etcheverry 0ac5be8368 Fix C# script metadata creation error due to missing directory 2019-01-21 00:57:03 +01:00
Ignacio Etcheverry ca8100f29f Workaround for bug with Mono's MSBuild and BaseIntermediateOutputPath
BaseIntermediateOutputPath seems to be empty by default. The workaround is to explicitly set it.

Also fixed passing char instead of char[] to String.Split. Why was this even working with Mono?
2019-01-21 00:38:28 +01:00