summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename `instance()`->`instantiate()` when it's a verbLightning_A2021-06-191-1/+1
|
* Added support for scripts reporting multiple errors to ScriptTextEditorEric M2021-06-191-3/+2
| | | | Scripts can now report multiple errors to the scripting editors in the engine. UI elements were added to support multiple errors.
* Fix slow load/save of scenes with many instances of the same scriptPedro J. Estébanez2021-06-131-1/+1
|
* Rename Reference to RefCountedPedro J. Estébanez2021-06-111-2/+2
|
* Merge pull request #49221 from Faless/mp/4.x_rpc_refactorRémi Verschelde2021-06-071-24/+3
|\ | | | | [Net] Refactor RPCs, remove RSETs
| * [Net] Refactor RPCs, remove RSETsFabio Alessandrelli2021-06-011-24/+3
| | | | | | | | | | | | | | | | | | | | In this PR: - Removed rset - rpc_config can now optionally configure transfer mode (reliable/unreliable/ordered) and channel (channels are not actually implemented yet.) - Refactor how the RPC id is computed to minimize the logic in Node and scripts that now only needs a single `get_rpc_methods` function.
* | Add missing override keyword to CSharpLanguage::is_control_flow_keyword()Marcel Admiraal2021-06-041-1/+1
|/
* Highlight control flow keywords with a different colorHugo Locurcio2021-05-051-0/+1
| | | | This makes them easier to distinguish from other keywords.
* C#: Fix disconnecting event signals twiceIgnacio Etcheverry2021-03-151-0/+2
| | | | | `disconnect_event_signals` can be called twice (when managed instance is disposed and from the ScriptInstance destructor).
* Add C# source generator for a new ScriptPath attributeIgnacio Etcheverry2021-03-061-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This source generator adds a newly introduced attribute, `ScriptPath` to all classes that: - Are top-level classes (not inner/nested). - Have the `partial` modifier. - Inherit `Godot.Object`. - The class name matches the file name. A build error is thrown if the generator finds a class that meets these conditions but is not declared `partial`, unless the class is annotated with the `DisableGodotGenerators` attribute. We also generate an `AssemblyHasScripts` assembly attribute which Godot uses to get all the script classes in the assembly, eliminating the need for Godot to search them. We can also avoid searching in assemblies that don't have this attribute. This will be good for performance in the future once we support multiple assemblies with Godot script classes. This is an example of what the generated code looks like: ``` using Godot; namespace Foo { [ScriptPathAttribute("res://Player.cs")] // Multiple partial declarations are allowed [ScriptPathAttribute("res://Foo/Player.cs")] partial class Player {} } [assembly:AssemblyHasScripts(new System.Type[] { typeof(Foo.Player) })] ``` The new attributes replace script metadata which we were generating by determining the namespace of script classes with a very simple parser. This fixes several issues with the old approach related to parser errors and conditional compilation. It also makes the task part of the MSBuild project build, rather than a separate step executed by the Godot editor.
* Improve resource load cachereduz2021-02-111-1/+1
| | | | | | -Added a new method in Resource: reset_state , used for reloading the same resource from disk -Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type) -Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
* Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* Refactor DocData into core and editor (DocTools) partsThakee Nathees2020-12-021-0/+1
|
* Documentation generation for GDScriptThakee Nathees2020-11-291-0/+8
| | | | | | | | | | | | | | | | | | - ClassDoc added to GDScript and property reflection data were extracted from parse tree - GDScript comments are collected from tokenizer for documentation and applied to the ClassDoc by the GDScript compiler - private docs were excluded (name with underscore prefix and doesn't have any doc comments) - default values (of non exported vars), arguments are extraced from the parser - Integrated with GDScript 2.0 and new enums were added. - merge conflicts fixed
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-2/+2
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* C#: Fix custom event signals crash on hot-reloadIgnacio Etcheverry2020-10-261-1/+1
| | | | | Cleanup and re-initialization of event signals before and after hot-reload should be working correctly now.
* Fix code duplication in CSharpScriptopl-2020-10-131-0/+1
| | | | | | | | Removes code duplication between `CSharpScript::reload()` and `CSharpScript::initialize_for_managed_type()`. Removes a redundant `CSharpScript::update_exports()` call in `CSharpLanguage::reload_assemblies()` as `CSharpScript::reload()` already calls it when appropriate. Fixes missing update of RPC information in `CSharpScript::initialize_for_managed_type()`.
* Remove multilevel callsGeorge Marques2020-07-241-4/+0
| | | | | | In general they are more confusing to users because they expect inheritance to fully override parent methods. This behavior can be enabled by script writers using a simple super() call.
* Mono/C#: Fix several clang-tidy warnings and cleanupIgnacio Etcheverry2020-07-051-124/+129
|
* Mono/C#: Fix values not updated in remote inspectorIgnacio Etcheverry2020-05-221-0/+6
|
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-4/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Port member initialization from constructor to declaration (C++11)Rémi Verschelde2020-05-141-8/+4
| | | | | | | | | | Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
* Inherited C# scene not inheriting parent's fieldspepegadeveloper1232020-05-111-1/+2
| | | | | | | | | | | | When a child scene inherits a parent scene with a C# root node, the parent scene's export variables appear to assume values set in the parent scene, in the child scene's Inspector. However, when the child scene is played, the parent scene's export variables assume default values. When a node is created, it inherits its parent C# script's fields from the map CSharpScriptInstance::script->member_info. However this map was not initialized outside the editor, and this commit ensured it is. This fixes issues #36480 and #37581.
* Add ability to bind typed arrays to script APIJuan Linietsky2020-04-211-0/+2
| | | | | | | Note: Only replaced 2 instances to test, Node.get_children and TileMap.get_used_cells Note: Will do a mass replace on later PRs of whathever I can find, but probably need a tool to grep through doc. Warning: Mono will break, needs to be fixed (and so do TypeScript and NativeScript, need to ask respective maintainers)
* Exposed RenderingDevice to script APIJuan Linietsky2020-04-201-1/+1
| | | | | | | | | | | | | Also added an easier way to load native GLSL shaders. Extras: Had to fix no-cache for subresources in resource loader, it was not properly working, making shaders not properly reload. Note: The precommit hooks are broken because they don't seem to support enums from one class being used in another. Feel free to fix this after merging this PR.
* Replace NULL with nullptrlupoDharkael2020-04-021-4/+4
|
* Mono/C#: Optimize the way we store GC handles for scriptsIgnacio Etcheverry2020-03-171-5/+11
| | | | 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-36/+63
| | | | | | | | | | | | | 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-4/+4
| | | | | | | | | | 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`.
* 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-5/+5
| | | | | | | | | | | | | | | | 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`.
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-4/+4
| | | | objects and made them default.
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-181-1/+1
| | | | | Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
* Optmized data sent during RPC and RSet calls.Andrea Catania2020-02-121-2/+26
| | | | | | | | | | - 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.
* Mono/C#: Lighten up unsafe reference checksIgnacio Etcheverry2020-01-231-2/+3
| | | | 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.
* Mono/C#: Add error checks to detect possible Reference leaksIgnacio Etcheverry2020-01-131-0/+8
|
* 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.
* Mono: Fix build errors with tools=noIgnacio Etcheverry2019-07-081-1/+3
|
* C#: Fix some crashes during assemblies reloadingIgnacio Etcheverry2019-07-081-0/+1
|
* Re-write mono module editor code in C#Ignacio Etcheverry2019-07-051-1/+21
| | | | | | | | 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.
* Some code changed with Clang-Tidyqarmin2019-06-261-1/+1
|
* Made use of semicolons more consitent, fixed formattingJohnJLight2019-06-191-1/+1
|
* Unexpose subclasses of ResourceFormatLoader and -SaverRémi Verschelde2019-06-181-2/+0
| | | | | | | | | | | | | | ResourceFormatLoader and ResourceFormatSaver are meant to be overridden to add support for different formats in ResourceLoader and ResourceSaver. Those should be exposed as they can be overridden in plugins. On the other hand, all predefined subclasses of those two base classes are only meant to register support for new file and resource types, but should not and cannot be used directly from script, so they should not be exposed. Also unexposed ResourceImporterOGGVorbis (and thus its base class ResourceImporter) which are editor-only.
* Android build and export for the mono moduleIgnacio Etcheverry2019-06-031-1/+0
|
* Merge pull request #28099 from lupoDharkael/fix-completionRémi Verschelde2019-06-031-1/+1
|\ | | | | Fix code completion not working with class_name
| * Fix code completion not working with class_namelupoDharkael2019-04-161-1/+1
| |
* | C#: Implement ScriptInstance::to_stringIgnacio Etcheverry2019-05-241-0/+2
| | | | | | | | 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-1/+2
| | | | | | | | Also fixed the hint string of exported members.
* | Mono: Lazily load scripts metadata fileIgnacio Etcheverry2019-04-261-3/+12
|/ | | | - Only load the scripts metadata file when it's really needed. This way we avoid false errors, when there is no C# project, about missing scripts metadata file.
* Fixes #17233 allowing C# to override _GetPropertyListNuno Cardoso2019-04-121-0/+1
|