summaryrefslogtreecommitdiffstats
path: root/modules/gdnative/nativescript/nativescript.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused GDNative codeRémi Verschelde2022-03-091-1777/+0
| | | | | | | | | This has been superseded by GDExtension so this code is no longer useful nor usable. There's still some GDNative-related stuff in platform export code which needs to be adapted for GDExtension (e.g. to include GDExtension libraries in exports).
* Convert _notification methods to switch - Chunk CJakob Bouchard2022-02-161-12/+9
|
* Refactor some object type checking code with `cast_to`Rémi Verschelde2022-02-081-1/+1
| | | | Less stringly typed logic, and less String allocations and comparisons.
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* Replace String comparisons with "", String() to is_empty()Nathan Franke2021-12-091-1/+1
| | | | | | Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
* Remove unimplemented methodsMarcel Admiraal2021-10-211-3/+0
|
* Use range iterators for `Map`Lightning_A2021-09-301-62/+62
|
* [Net] Move multiplayer to core subdir, split RPCManager.Fabio Alessandrelli2021-09-071-3/+3
| | | | | | | | | | | Move multiplayer classes to "core/multiplayer" subdir. Move the RPCConfig and enums (TransferMode, RPCMode) to a separate file (multiplayer.h), and bind them to the global namespace. Move the RPC handling code to its own class (RPCManager). Renames "get_rpc_sender_id" to "get_remote_sender_id".
* Implement inherits_script() for NativeScript and PluginScriptPedro J. Estébanez2021-08-021-3/+19
|
* Use const references where possible for List range iteratorsRémi Verschelde2021-07-251-1/+1
|
* Use C++ iterators for Lists in many situationsAaron Franke2021-07-231-3/+3
|
* Redo how instance bindings workreduz2021-07-081-0/+13
| | | | | | | | * The harcoded 8 slots are no more and impose limits in the new extension system. * New system is limitless, although it will impose small performance hit with a mutex. * Use a token to request the instance binding. **Warning**: Mono will most likely break as a result of this, will need to be modified to use the new system.
* Rename `instance()`->`instantiate()` when it's a verbLightning_A2021-06-191-3/+3
|
* Added support for scripts reporting multiple errors to ScriptTextEditorEric M2021-06-191-1/+1
| | | | Scripts can now report multiple errors to the scripting editors in the engine. UI elements were added to support multiple errors.
* Rename Reference to RefCountedPedro J. Estébanez2021-06-111-2/+2
|
* Core: Move DirAccess and FileAccess to `core/io`Rémi Verschelde2021-06-111-1/+1
| | | | | File handling APIs are typically considered part of I/O, and we did have most `FileAccess` implementations in `core/io` already.
* [Net] Refactor RPCs, remove RSETsFabio Alessandrelli2021-06-011-274/+4
| | | | | | | | | | 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.
* Highlight control flow keywords with a different colorHugo Locurcio2021-05-051-0/+4
| | | | This makes them easier to distinguish from other keywords.
* Fix crash on GDNative API json generator exit.bruvzg2021-04-221-0/+4
|
* Only cleanup meta data if GDNative library is reloadable and we're about to ↵Bastiaan Olij2021-04-061-28/+32
| | | | unload it
* Fixes #47607 (forgotten statement in GDNative cleanup)Jan Haller2021-04-041-0/+2
| | | | Co-authored-by: geekrelief <geekrelief@gmail.com>
* Merge pull request #46844 from geekrelief/gdnative_unregister_script_fixRémi Verschelde2021-03-291-0/+34
|\ | | | | fixes #46839, ensure library_classes is cleared and free funcs are ca…
| * fixes #46839, ensure library_classes is cleared and free funcs are calledgeekrelief2021-03-091-0/+34
| | | | | | | | | | Co-authored-by: toasteater <48371905+toasteater@users.noreply.github.com> Co-authored-by: Jan Haller <bromeon@gmail.com>
* | Fixes small typos and grammar correctionAnshul7sp12021-03-121-1/+1
|/
* Modernize atomicsPedro J. Estébanez2021-02-181-3/+3
| | | | | | | | | | - Based on C++11's `atomic` - Reworked `SafeRefCount` (based on the rewrite by @hpvb) - Replaced free atomic functions by the new `SafeNumeric<T>` - Replaced wrong cases of `volatile bool` by the new `SafeFlag` - Platform-specific implementations no longer needed Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
* Only unload the library when no NativeScript objects exist if the reloadable ↵Bastiaan Olij2021-02-141-1/+1
| | | | flag is true. If it is false it is likely the library does other things and can't be unloaded
* 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.
* Initialize class/struct variables with default values in modules/Rafał Mikrut2021-02-081-7/+0
|
* Add GDNative JSON generator for the builtin APIGeorge Marques2021-01-291-0/+9
| | | | | | | | | | | | | | Which can be used by language bindings to generate code statically. This is generated as a different file from the class API because it has different requirements (the builtin types have constructors and don't have signals), so bindings can better make use of each JSON file without extra parsing. This also cleans up a bit the old API generator, mainly initializing structs and renaming "instanciable" to the more correct "instantiable". The argument description in help text was updated to better reflect how it should be used. The <path> argument is mandatory.
* Merge pull request #44617 from geekrelief/gdnative_unloadRémi Verschelde2021-01-261-0/+6
|\ | | | | free library when no nativescripts reference it
| * Removes the gdnative library when no script (gdns) references it any longer. ↵geekrelief2020-12-231-0/+6
| | | | | | | | This enables hot reload for gdnative.
* | 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 🎆
* | Rename empty() to is_empty()Marcel Admiraal2020-12-281-2/+2
|/
* 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
* Remove multilevel callsGeorge Marques2020-07-241-26/+2
| | | | | | 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.
* Add a separate application focus/in notification out from Window focus ↵Juan Linietsky2020-06-301-2/+2
| | | | notification.
* GDNative: merge API structs, bump version of merged structs.bruvzg2020-06-111-1/+1
|
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-43/+86
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: Enforce separation line between function definitionsRémi Verschelde2020-05-141-0/+25
| | | | | | | | | | | | | | | | | | | | | | | I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-49/+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.
* Add ability to bind typed arrays to script APIJuan Linietsky2020-04-211-0/+7
| | | | | | | 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-16/+16
|
* Refactored input, goes all via windows now.Juan Linietsky2020-03-261-2/+2
| | | | Also renamed Input to InputFilter because all it does is filter events.
* Style: Set clang-format Standard to Cpp11Rémi Verschelde2020-03-171-14/+14
| | | | | | | | | | 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-50/+11
| | | | | | | | | | | | | | | | 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-15/+15
| | | | 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-56/+286
| | | | | | | | | | - 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.