Commit graph

109 commits

Author SHA1 Message Date
Ignacio Etcheverry
6d7dc9d98b
Merge pull request #23583 from neikeq/ee
Improve the C# API projects generation
2018-11-08 01:52:27 +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
Ryan Schmitt
366c7e0f48 Fix false error when exporting enum in c# 2018-11-05 01:22:15 -08:00
Ignacio Etcheverry
d47cec43f2
Merge pull request #23162 from neikeq/cc
Proper support for namespaces and other enhancement/fixes
2018-10-25 18:18:40 +02:00
Ignacio Etcheverry
1aac95a737 Parse C# script namespace and class
- Added a very simple parser that can extract the namespace and class name of a C# script.
2018-10-25 18:00:24 +02:00
Ignacio Etcheverry
454b933106 Fix internal assembly load from
- Also make sure we load API assemblies from 'res://.mono/assemblies/'.
2018-10-22 20:35:44 +02:00
Mads Ynddal
16c0c037c8 Removed undeclared and unused variable, which caused a compile error 2018-10-21 21:55:30 +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
b63e518ce9 Mono: Fix crash on NodePath/RID disposal during Godot shutdown 2018-10-06 23:00:18 +02:00
Ignacio Etcheverry
9475e86078 Fix build error for windows mono export templates 2018-10-05 17:47:34 +02:00
Ignacio Etcheverry
d7ece43b74 Mono: Editor and export template dependencies and fixes
- Bundle editor dependencies:
    - 'GodotSharp': Root data directory for the editor
        - 'Tools': Editor dependencies. Only GodotSharp.dll for now.
        - 'Api': Prebuilt GodotSharp and GodotSharpEditor API assemblies.
        - 'Mono': Mono files to bundle with the editor.
            - 'bin': (Optional, not used for now) Mono bin directory.
            - 'etc': Mono configuration files.
            - 'lib': Mono dependency shared libraries.
            - 'lib/mono/4.5': Framework assemblies.
    - Added build option to copy the required files from the mono installation to 'GodotSharp/Mono'. Enable with 'copy_mono_root=yes'. Disabled by default.

- Export template dependencies:
    - 'data_AppName'/'data_Godot':
        - 'Mono': Mono files to bundle with the game.
            - 'etc': Mono configuration files.
            - 'lib': Mono dependency shared libraries.
    - The data directory is generated when compiling and must be bundled with the export templates. In the case of OSX, the data directory must be placed inside the 'osx.zip' export template.
    - In OSX, alternative location for directories (needed for app bundles) are:
        - 'data_AppName/Mono/etc' --> '../Resources/GodotSharp/Mono/etc'
        - 'data_AppName/Mono/lib' --> '../Frameworks/GodotSharp/Mono/lib'

- The editor can bundle prebuilt API assemblies.
    - Generate them with a tools build by running: `--generate-cs-core-api <GodotSharp_OutputDir> --generate-cs-editor-api <GodotSharpEditor_OutputDir> <GodotSharp_OutputDir>/bin/Release/GodotSharp.dll` (This command will be simplified in the future and both projects will be in the same solution)
    - Build the solutions and copy the output files to '#bin/GodotSharp/Api'.
- Fixed API assembly being added twice during the export process.
2018-10-03 19:16:29 +02:00
Ignacio Etcheverry
50fd5ef3b5 Mono: Fix not creating generic Array or Dictionary where expected 2018-09-27 00:11:31 +02:00
Ignacio Etcheverry
0f3de6ef3a Do not update cache if the C# API assembly is out of sync 2018-09-26 23:59:38 +02:00
Ignacio Etcheverry
50f6dbff87 Mono: Fix opening code editors in OSX and cleanup 2018-09-17 20:00:19 +02: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
Rémi Verschelde
1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz
08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04:00
Ignacio Etcheverry
6ae47ff19b C#: Fix explicit enum values when exporting member 2018-09-12 18:54:20 +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
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
61426464ea Add some mono root hint dirs for OSX
Fixes #13355
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
exts
035d498af2 Added Collections namespace to Array & Dictionary 2018-08-25 17:19:37 -05:00
Ignacio Etcheverry
d72a281468
Merge pull request #20717 from PJB3005/18-08-04-godot-exceptions
Fix Mono exception handling.
2018-08-24 16:27:43 +02:00
Rémi Verschelde
de59fe04e7 Add print_verbose to print to stdout only in verbose mode
Equivalent of the cumbersome:
if (OS::get_singleton()->is_stdout_verbose())
	print_line(msg);
2018-08-24 09:23:20 +02:00
Pieter-Jan Briers
af39684885 Fix Mono exception handling.
First of all, this fixes the handling of exceptions so the engine actually notices them,
it was broken in 4172fa03b5.

Next, unhandled exceptions now do NOT cause an abort(). They're logged now,
so before #16987. The pending exception thing still works though.
2018-08-23 20:21:36 +02:00
Ignacio Etcheverry
143c471eff Mono: Fix weird crash when loading corlib 2018-08-22 00:49:38 +02:00
Ignacio Etcheverry
5df91099c7
Merge pull request #18502 from space-wizards/18-04-29-assembly-load-hook
assembly_load_hook fallback for registering GDMonoAssemblies.
2018-08-22 00:27:35 +02:00
Juan Linietsky
ea3d997f9d
Revert "added get_creation_time function for gdscript" 2018-08-10 13:29:49 -03:00
Juan Linietsky
275e0d5ee4
Merge pull request #18914 from notwarp/master
added get_creation_time function for gdscript
2018-08-10 13:28:47 -03:00
Ignacio Etcheverry
4172fa03b5 Mono: Fix property set_value and cleanup 2018-07-31 19:49:16 +02:00
Hein-Pieter van Braam
0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Ignacio Etcheverry
5aefe5d936 Mono: Fix null dereferences 2018-07-25 21:30:11 +02:00
Ignacio Etcheverry
ee3c476c9a Add Array and Dictionary wrapper classes to C# 2018-07-20 01:44:30 +02:00
Rémi Verschelde
7c9f7452f4 Style: Format code with clang-format 6.0.1 2018-07-18 16:27:03 +02:00
Ignacio Etcheverry
4739cb8c00 Mono: Pending exceptions and cleanup 2018-07-04 03:08:29 +02:00
Ignacio Etcheverry
7933a6cc9f Mono: Null checks when marshaling from MonoArray* and managed Dictionary 2018-06-05 22:14:32 +02: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
Max Hilbrunner
d0b62ce155
Merge pull request #19021 from Faless/rpc_sync_fix
RPCMode refactor, more sync modes
2018-05-29 09:44:03 +02:00
Ignacio Etcheverry
97fb999976 Mono: Fix MonoImage filename being set to an invalid path 2018-05-27 17:15:41 +02:00
Fabio Alessandrelli
a5e8a3be5e New sync keywords in GDScript, NativeScript, Mono 2018-05-26 10:49:33 +02:00
Carter Anderson
56262ceafe Reduce allocations when converting mono arrays to pool arrays 2018-05-20 18:18:06 -07:00
Daniele Giuliani
d315b0fb8a added get_creation_time function for gdscript 2018-05-16 00:50:57 +02:00
Pieter-Jan Briers
ce4451b45f assembly_load_hook fallback for registering GDMonoAssemblies.
Fixes #18029.

There are ways to load assemblies that the search hook has no way of intercepting,
and handling itself. Such as loading from a byte[] in C# code.

We now handle these cases with a fallback assembly_load_hook,
to avoid crashes when this is indeed done.
2018-04-29 16:32:30 +02:00
Carter Anderson
91f271fa9e Fix mono basis GetEuler bug and marshalling/unmarshalling 2018-03-24 13:45:11 -07:00
Ignacio Etcheverry
883afd1b4d
Merge pull request #17619 from neikeq/mono-runtime-main-args
Mono: Runtime main args and assembly search fixes
2018-03-18 23:16:44 +01:00
Ignacio Etcheverry
fa1d656af4 Mono: Runtime main args and assembly search fixes
- Setup runtime main args during initialization. This must be done manually by embedders who do not call mono_runtime_run_main. Fixes NullReferenceException in System.Environment.
- Continue to search the assembly in the rest of the search locations if loading it from one of them failed.
2018-03-18 23:07:04 +01:00
Paul Joannon
22606a7bec
[mono] add the 'Facades' subfolder to the searched directories in _preload_hook 2018-03-02 13:38:29 +01:00