summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * Avoid warning about harmless unfulfilled yieldsPedro J. Estébanez2020-09-061-2/+6
| |
* | Avoid infinite loop in GDScript at shutdownPedro J. Estébanez2020-09-261-2/+12
| |
* | Ensure cyclic dependencies between scripts are broken at exitPedro J. Estébanez2020-09-101-2/+20
|/
* GDScript: Use pointer instead of references in cacheGeorge Marques2020-08-231-3/+1
| | | | | They are not supposed to be kept alive and this is cleaner and less error-prone than unreferencing the elements.
* GDScript: Add script to cache on reloadGeorge Marques2020-08-181-0/+15
| | | | | | This ensures that scripts created without a resource loader are properly included in the cache (such as builtin scripts) and are not tried to be loaded from the disk.
* Remove multilevel callsGeorge Marques2020-07-241-33/+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.
* Wrap up GDScript 2.0 base implementationGeorge Marques2020-07-221-20/+15
|
* Reintroduce code completionGeorge Marques2020-07-201-1/+1
|
* Add warning checks in GDScript analyzerGeorge Marques2020-07-201-12/+11
| | | | Reenable checking those when validating code.
* Add GDScript cache singletonGeorge Marques2020-07-201-0/+3
|
* New GDScript tokenizer and parserGeorge Marques2020-07-201-310/+147
| | | | | | | | | | Sometimes to fix something you have to break it first. This get GDScript mostly working with the new tokenizer and parser but a lot of things isn't working yet. It compiles and it's usable, and that should be enough for now. Don't worry: other huge commits will come after this.
* Revert "Include gdscript warning name in the warning message."Ryan Roden-Corrent2020-07-141-32/+30
| | | | This reverts commit de3ad3b30ecb8de1aa112df7d61630102f077b5b.
* Include gdscript warning name in the warning message.Ryan Roden-Corrent2020-07-061-30/+32
| | | | | | | | | | | | | | | | | | | | Occasionally you want to ignore a warning with a `warning-ignore` comment, and you have to go into the settings to look up what the actual name of the warning is. This patch appends the warning name to the end of the warning so you know what string to use to ignore it, similar to other linters like pylint. For example ``` "The signal 'blah' is declared but never emitted."; ``` is now ``` "The signal 'blah' is declared but never emitted. (UNUSED_SIGNAL)"; ```
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-55/+108
| | | | | 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/+9
| | | | | | | | | | | | | | | | | | | | | | | 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-146/+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.
* Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde2020-05-101-1/+2
| | | | Part of #33027.
* Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde2020-05-101-4/+8
| | | | | | | Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
* fixed: saving gdscript with cyclic inheritance crash the editorThakee Nathees2020-05-101-3/+26
| | | | Fix: #9609
* Fix object leaks caused by unfulfilled yieldsPedro J. Estébanez2020-05-051-2/+18
| | | | | | | | | | Now the stack saved in a `GDScriptFunctionState` is cleared as soon as the `yield()` operation is known not to be resumed because either the script, the instance or both are deleted. This clears problems like leaked objects by eliminating cases of circular references between `GDScriptFunctionState`s preventing them and the objects they refer to in their saved stacks from being released. As an example, this makes using `SceneTreeTimer` safer. Furthermore, with this change it's now possible to print early warnings about `yield()`s to released script/instances, as now we know they won't be successfully resumed as the condition for that happens. However, this PR doesn't add such messages, to keep the observed behavior the same for the time being. Also, now a backup of the function name in `GDScriptFunctionState` is used, since the script may not be valid by the time the function name is needed for the resume-after-yield error messages.
* Merge pull request #32534 from Xrayez/fix-dict2inst-initRémi Verschelde2020-05-031-7/+4
|\ | | | | Make `dict2inst` to work with arbitrary `_init` parameters
| * Make `dict2inst` to work with arbitrary `_init` parametersAndrii Doroshenko (Xrayez)2020-04-301-7/+4
| | | | | | | | | | | | | | | | This is achieved by skipping initializer call while creating an instance of a GDScript. This is implemented by passing -1 as an argument count to `_new` and interpreting any value below 0 to mean that the initializer should not be called during instantiation, because internal members of an instance are going to be overridden afterwards.
* | Merge pull request #38105 from AndreaCatania/AndreaCatania-patch-2Fabio Alessandrelli2020-05-011-4/+4
|\ \ | |/ |/| Removed noisy ERR check from Multiplayer API.
| * Removed noisy ERR check from Multiplayer API.Andrea Catania2020-04-221-4/+4
| |
* | Add ability to bind typed arrays to script APIJuan Linietsky2020-04-211-0/+18
| | | | | | | | | | | | | | 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-30/+30
|
* Style: Set clang-format Standard to Cpp11Rémi Verschelde2020-03-171-23/+23
| | | | | | | | | | 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`.
* Merge pull request #36599 from AndreaCatania/gen_rpc_data_exportRémi Verschelde2020-03-131-46/+52
|\ | | | | Generates the rpc and rset info for exported GDScript.
| * Generates the rpc and rset info for exported GDScript.Andrea Catania2020-02-281-46/+52
| | | | | | | | | | | | Improved the send rpc log message when fail. This work has been kindly sponsored by IMVU.
* | Merge pull request #36723 from AndreaCatania/fix-rsetRémi Verschelde2020-03-131-2/+2
|\ \ | | | | | | Fixed rset method for gdscript and visual script
| * | Fixed rset method for gdscript and visual scriptAndrea Catania2020-03-021-2/+2
| | |
* | | Refactor ScriptDebugger.Fabio Alessandrelli2020-03-081-6/+6
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-122/+45
|/ | | | | | | | | | | | | | | | 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-28/+28
| | | | objects and made them default.
* GDScript: Remove self static reference and create one on callsGeorge Marques2020-02-191-1/+0
| | | | | | This is needed because of the new changes to Variant. The reference counter is increased by adding it to a Variant, which means no GDScript will be freed (or will be double freed if manually freed somewhere).
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-181-5/+5
| | | | | 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-4/+5
|
* Remove deprecated sync and slave networking keywordsRémi Verschelde2020-02-131-2/+0
| | | | | | Those keywords were deprecated for 3.1 in #22087. Also fix token name for `TK_REMOTE`, should be "remote" like the keyword.
* Optmized data sent during RPC and RSet calls.Andrea Catania2020-02-121-24/+131
| | | | | | | | | | - 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.
* Merge pull request #35218 from bojidar-bg/26691-parse-error-errorsRémi Verschelde2020-01-161-1/+1
|\ | | | | Fix errors raised when showing parse errors in the editor
| * Fix errors raised when showing parse errors in the editorBojidar Marinov2020-01-161-1/+1
| | | | | | | | Fixes #26691
* | Keep a weak reference to orphan subclasses to reuse on class reloadChibiDenDen2020-01-151-3/+48
|/
* Add GDScript warning for standalone expressionGeorge Marques2020-01-091-0/+4
| | | | | This makes the error message clearer as it might be used to call functions with side effects.
* 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.
* GDScript: Convert values when setting member variablesGeorge Marques2019-12-131-5/+16
| | | | This allows doing: self.x = 1 even if self.x is declared as float.
* Disable GDScript warning for unused class variable by defaultGeorge Marques2019-12-111-1/+2
|
* Document how to bypass the unused argument/variable warning in messageHugo Locurcio2019-11-271-5/+3
| | | | | | | Note that prefixing with an underscore only works with unused arguments and local variables, not class variables and signals. This closes #26056.
* Add setting to exclude addons from script warningsmashumafi2019-11-071-0/+1
|