Commit graph

86 commits

Author SHA1 Message Date
Marcel Admiraal f0db13502a Remove duplicate WARN_PRINT macro. 2020-02-05 11:13:24 +01:00
Marcel Admiraal 5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +01: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
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 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 Etcheverry 8cbe4a3db4 Make C# internal calls return structs as ref parameters
The Mono IL interpreter's WebAssembly to native trampolines don't support passing structs by value, so we need to do it this way.

Also now we pass and return long, ulong, float and double as ref parameters as well. This is due to missing trampolines for float and long types. This is likely a temporary workaround that will be reverted in the future. The correct solution would be to patch 'mono/mini/m2n-gen.cs' when building the Mono runtime for WASM in order to generate the trampolines we need.
2019-11-15 03:22:25 +01:00
Ignacio Etcheverry 1509890dbc Mono: Don't compare API hashes on release builds
API hashes cannot be calculated on release builds, as bindings information is lacking. Therefore, we should not be comparing it with the generated glue hash as they will never match.
2019-09-28 01:07:57 +02:00
Rémi Verschelde dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin 17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Ignacio Etcheverry c4fa027614 Improve C# bindings generator errors for default param values 2019-09-24 15:09:54 +02:00
Ignacio Etcheverry 95c685143a C#: Make sure cs_glue_version is present when building export templates 2019-09-20 17:41:20 +02: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 5ed3d34cd9 Fix --generate-mono-glue bug when directory doesn't exist
DirAccess::get_full_path(path) only works if the path exists. Implement our own abspath function.
2019-07-08 18:07:15 +02:00
Ignacio Etcheverry 2c83255013 Fix C# bindings detection of abstract classes
ClassDB::can_instance was changed recently breaking our code, as the editor is not yet initialized. Check ClassInfo::creation_func directly.
2019-07-08 15:13:57 +02:00
Ignacio Etcheverry aa9908e4f6 Script API methods must return Ref<T> instead of Reference*
ptrcall assumes methods that return a Reference type do so with Ref<T>. Returning Reference* from a method exposed to the scripting API completely breaks ptrcalls to this method (it can be quite hard to debug!).
2019-07-05 09:38:28 +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 9f1a8ce6a2 Mono: Android build and shared libraries fixes
Fix location of Mono's shared libraries.
Fix build failing if the directory 'platform/android/java/libs/{target}/{abi}' doesn't exist.
2019-07-03 17:48:12 +02:00
Rémi Verschelde 89ce9a6f46 Mono: Fix -Wduplicated-branches warning 2019-06-15 18:01:34 +02:00
Ignacio Etcheverry 04ebf294f3 C#: Implement ScriptInstance::to_string
Create a blacklist of methods that must not be generated. Includes: "to_string", "_to_string" and "_init".
2019-05-24 00:40:20 +02:00
Ignacio Etcheverry 3380565e4b C#: Generate the correct integer and floating point types 2019-04-27 01:30:46 +02:00
Ignacio Etcheverry 340252727b C#: Mark generated property accessor methods as Obsolete
- Methods that act as accessors for properties in the same class (like `GetPosition` and `SetPosition` are for `Position`) are now marked as obsolete. They will be made private in the future.
2019-04-25 20:34:35 +02:00
Ignacio Etcheverry c20a3823a2 C# bindings generator cleanup
- Normal log messages are no longer warnings.
- BindingsGenerator is no longer a singleton.
- Added a log function.
2019-04-25 20:34:28 +02:00
Ignacio Etcheverry f64aa02933 Use StringBuilder in C# bindings generator
- Also fixed generation of empty summary comments when no comment should have been generated.
2019-04-19 02:11:39 +02:00
Rémi Verschelde c8994b56f9 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
Ignacio Etcheverry 7a4cf6339d Workaround for syntax highlighting issue in GitHub 2019-04-08 14:52:01 +02:00
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
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
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 Etcheverry 1ad16b3d4a C#: Bindings generator now translates BBCode docs to XML comments 2019-03-23 20:39:55 +01:00
marxin aff84ec55d Fix -Wsuggest-attribute=format warnings. 2019-02-27 06:56:50 +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 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 8f26c54c40 C# Bindings Generator: Fix vararg methods with custom return type 2019-01-18 01:03:44 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Ignacio Etcheverry 02d5ff4cd0 Improve the C# API projects generation
- Now there is only one solution that contains both GodotSharp and GodotSharpEditor project. Previously we had one solution for each project
- GodotSharpEditor reference GodotShatp with a 'ProjectReference'. Previously it was a 'Reference' to the assembly
- This also simplifies the command line option to generate this solution: 'godot --generate-cs-api <OutputDir>'
2018-11-08 01:05:22 +01:00
Ignacio Etcheverry 2adef1e52f Fix prefix erasing for the generated C# enum constants 2018-10-18 20:11:11 +02:00
Ignacio Etcheverry 23ae64b15e C#: Optimize struct marshalling
- We no longer box struct to return them from internal calls.
- Use reinterpret_cast if the managed struct layout is the same as the native struct.
2018-10-17 22:36:26 +02:00
Ignacio Etcheverry eeaa9124af C# API: Hide method bind fields from debugger 2018-10-16 17:22:27 +02:00
Ignacio Etcheverry c1dad2ae2d C# bindings generator fixes
- Fix unused bool local for MonoBoolean argument.
- Append U to API hashes. Fixes warning: 'integer constant is so large that it is unsigned'
2018-10-07 11:00:05 +02:00
Ignacio Etcheverry 2c8980f44c Fix GCC compiler warning in mono module
- thread_local.h: 'delegating constructors only available with -std=c++11 or -std=gnu++11'
- mono_reg_utils.cpp: 'extra tokens at end of #endif directive'
- mono_bottom_panel.cpp: '<fieldB> will be initialized after <fieldA> when initialized here'
- bindings_generator.cpp: 'name lookup of 'i' changed (...) matches this 'i' under ISO standard rules (...) matches this 'i' under old rules (...)'
2018-10-03 00:56:28 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Ignacio Etcheverry d21c64cc3b C#: Fix cs_files glue mismatch bug 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
Ignacio Etcheverry aa2bcf3dfc C# generated classes ignore warning CS1591 and cleanup 2018-08-27 20:39:51 +02:00
exts 035d498af2 Added Collections namespace to Array & Dictionary 2018-08-25 17:19:37 -05: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