summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_functions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GDScript: Refactor builtin functionsGeorge Marques2020-11-261-1942/+0
| | | | | | | | | | | 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.
* Minor clamp and float fixesAaron Franke2020-11-101-8/+8
|
* Refactored variant constructor logicreduz2020-11-091-1/+1
|
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-37/+3
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Exposed randi_range to global funcs + renamed rand_range to randf_rangeYuri Roubinsky2020-11-061-6/+18
|
* [Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg2020-09-031-1/+1
|
* GDScript: Clarified/fixed inaccuracies in the built-in function docs.Meriipu2020-07-251-1/+1
| | | | | | | | | | | | | | | | | 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.
* Add new GDScript type checkerGeorge Marques2020-07-201-0/+4
|
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-5/+9
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-114/+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.
* Merge pull request #38357 from ThakeeNathees/dict2inst-crash-fixRémi Verschelde2020-05-091-0/+5
|\ | | | | fix: dict2inst crash when constructor has arguments
| * fix: dict2inst crash when constructor has argumentsThakee Nathees2020-04-301-0/+5
| |
* | Make `dict2inst` to work with arbitrary `_init` parametersAndrii Doroshenko (Xrayez)2020-04-301-2/+1
|/ | | | | | | | 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.
* [Core] Rename linear_interpolate to lerpAaron Franke2020-04-291-3/+3
|
* Replace NULL with nullptrlupoDharkael2020-04-021-3/+3
|
* Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky2020-02-251-97/+107
| | | | | | | | | | | | | | | | | | | | | - 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.
* Add support for Vector2i, Rect2i and Vector3i to VariantJuan Linietsky2020-02-221-1/+1
| | | | | | | 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.
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-67/+67
| | | | objects and made them default.
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-181-25/+25
| | | | | 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-2/+2
|
* Merge pull request #36142 from akien-mga/remove-deprecated-decimalsRémi Verschelde2020-02-121-13/+0
|\ | | | | Remove deprecated decimals builtin
| * Remove deprecated decimals builtinRémi Verschelde2020-02-121-13/+0
| | | | | | | | Replaced by 'step_decimals' in 3.2 via #21425.
* | ObjectID converted to a structure, fixes many bugs where used incorrectly as ↵Juan Linietsky2020-02-121-1/+1
|/ | | | 32 bits.
* Remove duplicate WARN_PRINT macro.Marcel Admiraal2020-02-051-1/+1
|
* Remove duplicate ERR_PRINT macro.Marcel Admiraal2020-02-051-2/+2
|
* GDScript: enable type checks on release modeGeorge Marques2020-01-081-3/+4
| | | | | Also make builtin GDScript functions report return type as Variant in release so type is converted when needed.
* 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.
* Updates docs for GDScript built-in functionsHaoyu Qiu2019-12-151-1/+1
| | | | | | | * 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
* Merge pull request #33018 from Xrayez/fix-inst2dict-gettersRémi Verschelde2019-12-111-17/+3
|\ | | | | Fix `inst2dict` calling to getters to retrieve value
| * Fix `inst2dict` calling to getters to retrieve valueAndrii Doroshenko (Xrayez)2019-10-241-17/+3
| | | | | | | | | | | | Use `GDScriptInstance` to iterate through all members directly instead. This is similar to how `dict2inst` works and makes the serialization behaviour more consistent.
* | Use GDScript resource path over script path for `inst2dict`Andrii Doroshenko (Xrayez)2019-11-021-1/+1
| | | | | | | | | | | | | | 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.
* | Provide and print error messages for JSON parsingAndrii Doroshenko (Xrayez)2019-10-311-0/+1
| | | | | | | | Core is not touched, only for binding and scripting.
* | Fixed leak in gdscript when creating empty WeakRefPouleyKetchoupp2019-10-291-1/+2
|/ | | | Fixes #33150
* Allow weakref(null) in gdscriptWindy Darian2019-09-161-25/+19
| | | | 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.
* Add ord() function to return Unicode code point of a string of length oneMasoud Montazeri2019-08-281-0/+36
|
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "platform", ↵Robin Hübner2019-08-091-2/+1
| | | | "modules/gdnative", "modules/gdscript" directories.
* Added lerp_angles built-in functionChaosus2019-07-201-0/+13
| | | | | Co-authored-by: Xrayez <https://github.com/Xrayez> Co-authored-by: DleanJeans <https://github.com/DleanJeans>
* Add integer posmod and rename default arg namesAaron Franke2019-07-181-3/+16
| | | | | "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.
* Fix error macro calls not ending with semicolonRémi Verschelde2019-06-111-1/+1
| | | | | | | 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.
* Added move_toward functions for float, Vector2 and Vector3Giacom2019-05-281-0/+14
|
* Make "decimal" functions more consistentAaron Franke2019-04-301-1/+15
| | | | In GDScript, rename "decimals" to "step_decimals". In C#, add "StepDecimals", but keep the old functionality in a method called "DecimalCount".
* [Core] Expose approximate equality methods to GDScriptAaron Franke2019-04-251-0/+23
|
* Merge pull request #27231 from Chaosus/smoothstepRémi Verschelde2019-04-081-0/+14
|\ | | | | Added smoothstep built-in function
| * Added smoothstep built-in functionChaosus2019-04-071-0/+14
| |
* | Add object encoding param to serialization methodsFabio Alessandrelli2019-04-011-8/+49
|/ | | | | | | | | 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).
* GDScript: Fix return value of "lerp" builtinRémi Verschelde2019-01-181-1/+2
| | | | Fixes #25082, fixes #24709.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* i18n: Sync translation template with current sourceRémi Verschelde2018-12-131-1/+1
| | | | Also French translation update and misc fixes to source strings.
* Merge pull request #22934 from SeleckyErik/issue-11457Rémi Verschelde2018-12-071-10/+2
|\ | | | | GDscript function str2var now returns null on invalid input
| * GDscript function str2var now returns input string on invalid inputErik2018-11-281-10/+2
| | | | | | | | | | | | | | 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.