summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge pull request #36756 from aaronfranke/mono-vec2i3iIgnacio Roldán Etcheverry2020-03-181-0/+3
|\ \ | | | | | | [Mono] Add Vector2i and Vector3i
| * | [Mono] Marshaling for Vector2i, Vector3i, and Rect2iAaron Franke2020-03-171-0/+3
| |/
* / Mono/C#: Optimize the way we store GC handles for scriptsIgnacio Etcheverry2020-03-171-55/+54
|/ | | | Don't store GC handles for C# script instances and instance bindings as 'Ref<MonoGCHandle>'; store the raw data instead. Initially this was not possible as we needed to store a Variant, but this had not been the case for a looong time yet the stored type was never updated.
* Fix C# bindings after recent breaking changesIgnacio Etcheverry2020-03-171-94/+328
| | | | | | | | | | | | | Implementation for new Variant types Callable, Signal, StringName. Added support for PackedInt64Array and PackedFloat64Array. Add generation of signal members as events, as well as support for user created signals as events. NOTE: As of now, raising such events will not emit the signal. As such, one must use `EmitSignal` instead of raising the event directly. Removed old ThreadLocal fallback class. It's safe to use thread_local now since it's supported on all minimum versions of compilers we support.
* Style: Set clang-format Standard to Cpp11Rémi Verschelde2020-03-171-13/+13
| | | | | | | | | | For us, it practically only changes the fact that `A<A<int>>` is now used instead of the C++03 compatible `A<A<int> >`. Note: clang-format 10+ changed the `Standard` arguments to fully specified `c++11`, `c++14`, etc. versions, but we can't use `c++17` now if we want to preserve compatibility with clang-format 8 and 9. `Cpp11` is still supported as deprecated alias for `Latest`.
* Refactor ScriptDebugger.Fabio Alessandrelli2020-03-081-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | EngineDebugger is the new interface to access the debugger. It tries to be as agnostic as possible on the data that various subsystems can expose. It allows 2 types of interactions: - Profilers: A subsystem can register a profiler, assigning it a unique name. That name can be used to activate the profiler or add data to it. The registered profiler can be composed of up to 3 functions: - Toggle: called when the profiler is activated/deactivated. - Add: called whenever data is added to the debugger (via `EngineDebugger::profiler_add_frame_data`) - Tick: called every frame (during idle), receives frame times. - Captures: (Only relevant in remote debugger for now) A subsystem can register a capture, assigning it a unique name. When receiving a message, the remote debugger will check if it starts with `[prefix]:` and call the associated capture with name `prefix`. Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new profiler system. Port SceneDebugger and RemoteDebugger to the new capture system. The LocalDebugger also uses the new profiler system for scripts profiling.
* Removed interactive loader, added proper thread loading.Juan Linietsky2020-02-281-1/+1
|
* Reimplement Mutex with C++'s <mutex>Pedro J. Estébanez2020-02-261-56/+15
| | | | | | | | | | | | | | | | Main: - It's now implemented thanks to `<mutex>`. No more platform-specific implementations. - `BinaryMutex` (non-recursive) is added, as an alternative for special cases. - Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes. - Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts. - A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this. - `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`. - Thread-safe utilities are therefore simpler now. Misc.: - `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same. - Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock). - `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
* Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky2020-02-251-3/+3
| | | | | | | | | | | | | | | | | | | | | - Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-12/+12
| | | | objects and made them default.
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-181-9/+9
| | | | | Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
* Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr.Juan Linietsky2020-02-151-3/+3
|
* Remove deprecated sync and slave networking keywordsRémi Verschelde2020-02-131-4/+0
| | | | | | Those keywords were deprecated for 3.1 in #22087. Also fix token name for `TK_REMOTE`, should be "remote" like the keyword.
* Fix Mono and GDNative builds after changes to ObjectIDRémi Verschelde2020-02-121-2/+2
| | | | | | | | | | Issues caused by cf8c679a23b21d6c6f29cba6a54eaa2eed88bf92. The Mono change is actually a bugfix (used the int instead of ObjectID by mistake). The GDNative change is a temporary revert until a more exhaustive approach is taken to make 'godot_int' 64-bit, is confirmed wanted by GDNative users.
* Optmized data sent during RPC and RSet calls.Andrea Catania2020-02-121-49/+166
| | | | | | | | | | - Now is sent the method ID rather the full function name. - The passed IDs (Node and Method) are compressed so to use less possible space. - The variant (INT and BOOL) is now encoded and compressed so to use much less data. - Optimized RPCMode retrieval for GDScript functions. - Added checksum to assert the methods are the same across peers. This work has been kindly sponsored by IMVU.
* Remove do{ } while(0) wrapper around error macros.Marcel Admiraal2020-02-081-2/+1
| | | | | | | | | | | | | | | | As pointed out by Faless, a do{ } while(0) wrapper around a continue or break just ends the do{ } while(0) loop. The do{ } while(0) loop exists to enable the macro to be used as a function which requires a semicolon. The alternative approach is to use an if(1) { } else ((void)0) wrapper. Since the macro already has an if(unlikely(m_cond)) { } this patch simply adds the else ((void)0) to this if statement instead. For consistency all the macros have been updated in the same way, and trailing else warnings corrected. However, the wrappers around ERR_PRINT and WARN_PRINT were removed, because they generated too many ambiguous trailing else warnings. They are also single line macros so a wrapper is not needed.
* Remove duplicate ERR_PRINT macro.Marcel Admiraal2020-02-051-11/+11
|
* Merge pull request #35527 from neikeq/issue-35259Rémi Verschelde2020-01-241-1/+4
|\ | | | | Mono/C#: Fix _update_exports possible crash with Reference types
| * Mono/C#: Fix _update_exports possible crash with Reference typesIgnacio Etcheverry2020-01-241-1/+4
| | | | | | | | | | | | | | | | | | 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.
* | Mono/C#: Lighten up unsafe reference checksIgnacio Etcheverry2020-01-231-5/+22
|/ | | | 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.
* Fix ClassDB API portability with some android and editor classesIgnacio Etcheverry2020-01-191-1/+1
| | | | | | | | | | | | | | | | | | - `EditorNavigationMeshGenerator` was being registered as part of the Core API, even after d3f48f88bb84d22b7805ce971ac86cf1953a29fd. 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: 4be87c6016a5893cbde897924e540df4c988cee5).
* Merge pull request #35208 from neikeq/mono-lazy-thread-attachIgnacio Roldán Etcheverry2020-01-161-37/+75
|\ | | | | Mono/C#: Script interface calls now attach the current thread
| * Mono/C#: Script interface calls now attach the current threadIgnacio Etcheverry2020-01-161-37/+75
| | | | | | | | | | | | | | | | | | 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.
* | Mono/C#: Fix false positive in unsafe reference checksIgnacio Etcheverry2020-01-151-2/+15
|/
* Mono/C#: Add error checks to detect possible Reference leaksIgnacio Etcheverry2020-01-131-3/+38
|
* Mono/C#: Fix _update_exports() leaking temporary Object/Node instancesIgnacio Etcheverry2020-01-131-0/+13
|
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | 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.
* Cleans up headers included in editor_node.hHaoyu Qiu2019-12-241-0/+1
|
* Mono/C#: Fix crash on exported games that don't use C#Ignacio Etcheverry2019-11-291-1/+2
|
* Mono/C#: Initial exporter support for AOT compilationIgnacio Etcheverry2019-11-151-2/+0
|
* Mono/C#: WebAssembly supportIgnacio Etcheverry2019-11-131-9/+9
|
* Added some obvious errors explanationsqarmin2019-09-251-3/+3
|
* Adds skip-breakpoints featureiwek72019-09-031-1/+1
|
* Make VarArg methods return types show up as Variant in API jsontoasteater2019-08-261-1/+1
| | | | | | | | | | | | VarArg methods have the return type Object in the API json for GDNative. This can cause undefined behavior in some language bindings due to lack of documentation on VarArg methods' behavior. This changes the MethodInfo of: - CSharpScript::_new - GDScript::_new - PluginScript::_new
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'modules/mono'Ignacio Etcheverry2019-08-091-70/+42
| | | | | | And 'CRASH_*_MSG' as well. Also make error messages puntuation and quotation more consistent.
* Add some code changes/fixes proposed by Coverity and Clang Tidyqarmin2019-08-071-2/+1
|
* Mono: Add option to keep running after unhandled exceptionsIgnacio Etcheverry2019-07-241-1/+0
| | | | | By default, an unhandled exception will cause the application to be terminated; but the project setting `mono/unhandled_exception_policy` was added to change this behaviour. The editor is hard-coded to never terminate because of unhandled exceptions, as that would make writing editor plugins a painful task, and we cannot kill the editor because of a mistake in a thirdparty plugin.
* Mono: Better handling of missing/outdated API assembliesIgnacio Etcheverry2019-07-141-12/+9
| | | | | | | | | | | Remove the old API assembly invalidation system. It's pretty simple since now the editor has a hard dependency on the API assemblies and SCons takes care of prebuilding them. If we fail to load a project's API assembly because it was either missing or outdated, we just copy the prebuilt assemblies to the project and try again. We also do this when creating the solution and before building, just in case the user removed them from the disk after they were loaded. This way the API assemblies will be always loaded successfully. If they are not, it's a bug. Also fixed: - EditorDef was behaving like GlobalDef in GodotTools. - NullReferenceException because we can't serialize System.WeakReference yet. Use Godot.WeakRef in the mean time.
* Fix EditorNavigationMeshGenerator registered in Core APIIgnacio Etcheverry2019-07-091-0/+13
| | | | Also added an option to output a json file with all the ClassDB registered classes and its members. This can be used to compare the API of two different builds by a simple diff.
* Mono: Fix build errors with tools=noIgnacio Etcheverry2019-07-081-2/+10
|
* C#: Fix some crashes during assemblies reloadingIgnacio Etcheverry2019-07-081-33/+41
|
* Re-write mono module editor code in C#Ignacio Etcheverry2019-07-051-100/+344
| | | | | | | | 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.
* Mono: Android build and shared libraries fixesIgnacio Etcheverry2019-07-031-6/+7
| | | | | Fix location of Mono's shared libraries. Fix build failing if the directory 'platform/android/java/libs/{target}/{abi}' doesn't exist.
* Remove unnecessary code and add some error explanationsqarmin2019-07-011-1/+1
|
* Some code changed with Clang-Tidyqarmin2019-06-261-4/+1
|
* C#: Implement ScriptInstance::to_stringIgnacio Etcheverry2019-05-241-0/+28
| | | | Create a blacklist of methods that must not be generated. Includes: "to_string", "_to_string" and "_init".
* C#: Marshalling support for IEnumerable<> and IDictionary<,>Ignacio Etcheverry2019-05-181-45/+91
| | | | Also fixed the hint string of exported members.
* C#: Support resource type hint in exported arraysIgnacio Etcheverry2019-04-291-1/+2
| | | | - Elements of types like PackedScene will display with the special editor for such type.
* Merge pull request #28423 from ↵Rémi Verschelde2019-04-291-8/+0
|\ | | | | | | | | neikeq/dont-forget-to-think-a-name-for-this-branch C#: Deprecate accessor methods and generate correct int and float types
| * C# bindings generator cleanupIgnacio Etcheverry2019-04-251-8/+0
| | | | | | | | | | | | - Normal log messages are no longer warnings. - BindingsGenerator is no longer a singleton. - Added a log function.