summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript.cpp
AgeCommit message (Collapse)Author
2021-02-11Improve resource load cachereduz
-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.
2021-02-08Initialize class/struct variables with default values in modules/Rafał Mikrut
2021-01-01Update copyright statements to 2021Rémi Verschelde
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 🎆
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-12-15Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde
GDScript: Refactor builtin functions
2020-12-02Merge pull request #41095 from ThakeeNathees/GDScript-DocumentationRémi Verschelde
GDScript(2.0) Documentation generation system
2020-12-02Refactor DocData into core and editor (DocTools) partsThakee Nathees
2020-11-29Documentation generation for GDScriptThakee Nathees
- 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
2020-11-28Implement proper error print, Fixes a crash when no error messages are ↵AndreaCatania
generated by the analyser.
2020-11-26GDScript: Refactor builtin functionsGeorge Marques
They are now called "utility functions" to avoid confusion with methods of builtin types, and be consistent with the naming in Variant. Core utility functions are now available in GDScript. The ones missing in core are added specifically to GDScript as helpers for convenience. Some functions were remove when there are better ways to do, reducing redundancy and cleaning up the global scope.
2020-11-09Refactored variant constructor logicreduz
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-10-01Merge pull request #41829 from RandomShaper/fix_40353Rémi Verschelde
Avoid warning about harmless unfulfilled yields
2020-09-26Avoid infinite loop in GDScript at shutdownPedro J. Estébanez
2020-09-10Ensure cyclic dependencies between scripts are broken at exitPedro J. Estébanez
2020-09-06Avoid warning about harmless unfulfilled yieldsPedro J. Estébanez
2020-08-23GDScript: Use pointer instead of references in cacheGeorge Marques
They are not supposed to be kept alive and this is cleaner and less error-prone than unreferencing the elements.
2020-08-18GDScript: Add script to cache on reloadGeorge Marques
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.
2020-07-24Remove multilevel callsGeorge Marques
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.
2020-07-22Wrap up GDScript 2.0 base implementationGeorge Marques
2020-07-20Reintroduce code completionGeorge Marques
2020-07-20Add warning checks in GDScript analyzerGeorge Marques
Reenable checking those when validating code.
2020-07-20Add GDScript cache singletonGeorge Marques
2020-07-20New GDScript tokenizer and parserGeorge Marques
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.
2020-07-14Revert "Include gdscript warning name in the warning message."Ryan Roden-Corrent
This reverts commit de3ad3b30ecb8de1aa112df7d61630102f077b5b.
2020-07-06Include gdscript warning name in the warning message.Ryan Roden-Corrent
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)"; ```
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
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.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
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.
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-05-10Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde
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.
2020-05-10fixed: saving gdscript with cyclic inheritance crash the editorThakee Nathees
Fix: #9609
2020-05-05Fix object leaks caused by unfulfilled yieldsPedro J. Estébanez
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.
2020-05-03Merge pull request #32534 from Xrayez/fix-dict2inst-initRémi Verschelde
Make `dict2inst` to work with arbitrary `_init` parameters
2020-05-01Merge pull request #38105 from AndreaCatania/AndreaCatania-patch-2Fabio Alessandrelli
Removed noisy ERR check from Multiplayer API.
2020-04-30Make `dict2inst` to work with arbitrary `_init` parametersAndrii Doroshenko (Xrayez)
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.
2020-04-22Removed noisy ERR check from Multiplayer API.Andrea Catania
2020-04-21Add ability to bind typed arrays to script APIJuan Linietsky
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)
2020-04-20Exposed RenderingDevice to script APIJuan Linietsky
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.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-17Style: Set clang-format Standard to Cpp11Rémi Verschelde
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`.
2020-03-13Merge pull request #36599 from AndreaCatania/gen_rpc_data_exportRémi Verschelde
Generates the rpc and rset info for exported GDScript.
2020-03-13Merge pull request #36723 from AndreaCatania/fix-rsetRémi Verschelde
Fixed rset method for gdscript and visual script
2020-03-08Refactor ScriptDebugger.Fabio Alessandrelli
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.
2020-03-02Fixed rset method for gdscript and visual scriptAndrea Catania
2020-02-28Removed interactive loader, added proper thread loading.Juan Linietsky
2020-02-28Generates the rpc and rset info for exported GDScript.Andrea Catania
Improved the send rpc log message when fail. This work has been kindly sponsored by IMVU.
2020-02-26Reimplement Mutex with C++'s <mutex>Pedro J. Estébanez
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`.
2020-02-20Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky
objects and made them default.
2020-02-19GDScript: Remove self static reference and create one on callsGeorge Marques
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).