summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_functions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | Add new "push_*()" functions to GDScriptMichael Alexsander Silva Dias2018-10-311-4/+47
|/
* Fixed argument names being swapped for atan2DualMatrix2018-09-161-1/+1
| | | | 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.
* Make core/ includes absolute, remove subfolders from include pathRémi Verschelde2018-09-121-8/+8
| | | | | | 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.
* Fixed return type for get_stack() function callWiggleWizard2018-09-051-1/+1
|
* Make some debug prints verbose-only, remove othersRémi Verschelde2018-08-241-6/+0
|
* GDScript: Enable built-in function introspection in non-toolsGeorge Marques2018-07-251-1/+1
| | | | Only for debug builds. Fix problems in non-tools targets.
* Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam2018-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
* Add static type checks in the parserGeorge Marques2018-07-201-11/+12
| | | | | | | | | | | | - Resolve types for all identifiers. - Error when identifier is not found. - Match return type and error when not returning a value when it should. - Check unreachable code (code after sure return). - Match argument count and types for function calls. - Determine if return type of function call matches the assignment. - Do static type check with match statement when possible. - Use type hints to determine export type. - Check compatibility between type hint and explicit export type.