summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_functions.cpp
AgeCommit message (Collapse)Author
2020-09-03[Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg
2020-07-25GDScript: Clarified/fixed inaccuracies in the built-in function docs.Meriipu
The input to smoothstep is not actually a weight, and the decscription of smoothstep was pretty hard to understand and easy to misinterpret. Clarified what it means to be approximately equal. nearest_po2 does not do what the descriptions says it does. For one, it returns the same power if the input is a power of 2. Second, it returns 0 if the input is negative or 0, while the smallest possible integral power of 2 actually is 1 (2^0 = 1). Due to the implementation and how it is used in a lot of places, it does not seem wise to change such a core function however, and I decided it is better to alter the description of the built-in. Added a few examples/clarifications/edge-cases.
2020-07-20Add new GDScript type checkerGeorge Marques
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: 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-09Merge pull request #38357 from ThakeeNathees/dict2inst-crash-fixRémi Verschelde
fix: dict2inst crash when constructor has arguments
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-30fix: dict2inst crash when constructor has argumentsThakee Nathees
2020-04-29[Core] Rename linear_interpolate to lerpAaron Franke
2020-04-02Replace NULL with nullptrlupoDharkael
2020-02-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- 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.
2020-02-22Add support for Vector2i, Rect2i and Vector3i to VariantJuan Linietsky
WARNING: Requires C++17 'guaranteed copy elision' to fix ambiguous operator problems in Variant. This was added for this commit (and future C++17 uses) in #36457.
2020-02-20Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky
objects and made them default.
2020-02-18PoolVector is gone, replaced by VectorJuan Linietsky
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
2020-02-15Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr.Juan Linietsky
2020-02-12Merge pull request #36142 from akien-mga/remove-deprecated-decimalsRémi Verschelde
Remove deprecated decimals builtin
2020-02-12ObjectID converted to a structure, fixes many bugs where used incorrectly as ↵Juan Linietsky
32 bits.
2020-02-12Remove deprecated decimals builtinRémi Verschelde
Replaced by 'step_decimals' in 3.2 via #21425.
2020-02-05Remove duplicate WARN_PRINT macro.Marcel Admiraal
2020-02-05Remove duplicate ERR_PRINT macro.Marcel Admiraal
2020-01-08GDScript: enable type checks on release modeGeorge Marques
Also make builtin GDScript functions report return type as Variant in release so type is converted when needed.
2020-01-01Update copyright statements to 2020Rémi Verschelde
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.
2019-12-15Updates docs for GDScript built-in functionsHaoyu Qiu
* Adds description for `ord()` * Adds relationship description between `char()` and `ord()` * Describes the argument of `char()` as Unicode code point instead of ASCII code * Fixes wrong interval notation in `randi()` description
2019-12-11Merge pull request #33018 from Xrayez/fix-inst2dict-gettersRémi Verschelde
Fix `inst2dict` calling to getters to retrieve value
2019-11-02Use GDScript resource path over script path for `inst2dict`Andrii Doroshenko (Xrayez)
The resource path holds the original path which can be used to convert a dictionary to instance consistently both within editor and exported projects as the original path is automatically remapped from `gd` to `gdc` or `gde` in exported projects.
2019-10-31Provide and print error messages for JSON parsingAndrii Doroshenko (Xrayez)
Core is not touched, only for binding and scripting.
2019-10-29Fixed leak in gdscript when creating empty WeakRefPouleyKetchoupp
Fixes #33150
2019-10-24Fix `inst2dict` calling to getters to retrieve valueAndrii Doroshenko (Xrayez)
Use `GDScriptInstance` to iterate through all members directly instead. This is similar to how `dict2inst` works and makes the serialization behaviour more consistent.
2019-09-16Allow weakref(null) in gdscriptWindy Darian
Tiny addition I personally found useful - this allows us to `var my_ref := weakref(null)` for nullable weak ref (with type hint!). When trying to test if `my_ref` is holding valid reference, we can just `if my_ref.get_ref():` instead of `if my_ref and my_ref.get_ref():` everywhere.
2019-08-28Add ord() function to return Unicode code point of a string of length oneMasoud Montazeri
2019-08-09Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "platform", ↵Robin Hübner
"modules/gdnative", "modules/gdscript" directories.
2019-07-20Added lerp_angles built-in functionChaosus
Co-authored-by: Xrayez <https://github.com/Xrayez> Co-authored-by: DleanJeans <https://github.com/DleanJeans>
2019-07-18Add integer posmod and rename default arg namesAaron Franke
"posmod" is the integer version of "fposmod". We do not need a "mod" because of the % operator. I changed the default arg names from "x" and "y" to "a" and "b" because they are not coordinates. I also changed pow's arg names to "base" and "exp". Also, I reorganized the code in the VS built-in funcs switch statement.
2019-06-11Fix error macro calls not ending with semicolonRémi Verschelde
It's not necessary, but the vast majority of calls of error macros do have an ending semicolon, so it's best to be consistent. Most WARN_DEPRECATED calls did *not* have a semicolon, but there's no reason for them to be treated differently.
2019-05-28Added move_toward functions for float, Vector2 and Vector3Giacom
2019-04-30Make "decimal" functions more consistentAaron Franke
In GDScript, rename "decimals" to "step_decimals". In C#, add "StepDecimals", but keep the old functionality in a method called "DecimalCount".
2019-04-25[Core] Expose approximate equality methods to GDScriptAaron Franke
2019-04-08Merge pull request #27231 from Chaosus/smoothstepRémi Verschelde
Added smoothstep built-in function
2019-04-07Added smoothstep built-in functionChaosus
2019-04-01Add object encoding param to serialization methodsFabio Alessandrelli
Network peers get_var/put_var File get_var/store_var GDScript/Mono/VisualScript bytes2var/var2bytes Add MultiplayerAPI.allow_object_decoding member which deprecates PacketPeer.allow_object_decoding. Break ABI compatibaility (API compatibility for GDNative).
2019-01-18GDScript: Fix return value of "lerp" builtinRémi Verschelde
Fixes #25082, fixes #24709.
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-13i18n: Sync translation template with current sourceRémi Verschelde
Also French translation update and misc fixes to source strings.
2018-12-07Merge pull request #22934 from SeleckyErik/issue-11457Rémi Verschelde
GDscript function str2var now returns null on invalid input
2018-11-28GDscript function str2var now returns input string on invalid inputErik
str2var used to raise a blocking error when invalid input was passed. Now it logs an error message and returns the input string. This solution was proposed in #13021. Closes #11457 and #13021.
2018-10-31Add new "push_*()" functions to GDScriptMichael Alexsander Silva Dias
2018-09-16Fixed argument names being swapped for atan2DualMatrix
The arguments of atan2() should be y,x instead of x,y This was just wrong since the internal atan2 already had y,x as parameters, so if you followed the autocomplete the result would just be wrong.
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
2018-09-05Fixed return type for get_stack() function callWiggleWizard
2018-08-24Make some debug prints verbose-only, remove othersRémi Verschelde