summaryrefslogtreecommitdiff
path: root/core/math/expression.cpp
AgeCommit message (Collapse)Author
2023-01-05One Copyright Update to rule them allRémi Verschelde
As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
2022-11-14Fix periods in editor strings and messagesHugo Locurcio
- Ensure all strings with ellipsis end with 3 periods instead of 2. - Fix extraneous period in "Error calling from signal '...' to callable" messages.
2022-10-07Fix MSVC warnings, rename shadowed variables, fix uninitialized values, ↵bruvzg
change warnings=all to use /W4.
2022-07-04Expression built-in functions can also be considered as identifiers in ↵cdemirer
subscripts
2022-06-27Add a const call mode to Object, Variant and Script.K. S. Ernest (iFire) Lee
For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script). This mode ensures only const functions can be called, making it safe to use from the editor. Co-Authored-By: reduz <reduzio@gmail.com>
2022-06-08i18n: Misc fixes translation stringsRémi Verschelde
Adds some translator comments to solve some questions raised on Weblate.
2022-05-11Implement exponential operator (**) to GDScript/ExpressionsYuri Roubinsky
2022-03-09Remove VARIANT_ARG* macrosreduz
* Very old macros from the time Godot was created. * Limited arguments to 5 (then later changed to 8) in many places. * They were replaced by C++11 Variadic Templates. * Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard. * Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-02-05Merge pull request #57620 from Haydoggo/expression-exp-fixRémi Verschelde
Fix Expression's parsing of positive exponent literals
2022-02-05Make parser treat all exponent literals as floatHayden
2022-02-04Cleanup and move char functions to the `char_utils.h` header.bruvzg
2022-02-04Added hex and bin literal support to Expression parserHayden Leete
fixed formatting
2022-01-30Add support for the escaped UTF-16 and UTF-32 Unicode characters in the ↵bruvzg
scripts and expressions.
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-02Merge pull request #47294 from sebastian-heinz/patch-1Rémi Verschelde
2021-12-02allow variant construction in expressionssebastian-heinz
2021-11-23Rename `remove()` to `remove_at()` when removing by indexLightning_A
2021-07-21Use the standard C `INFINITY` and `NAN` constants directlyHugo Locurcio
The `Math_INF` and `Math_NAN` defines were just aliases for those constants, so we might as well use them directly. Some portions of the code were already using `INFINITY` directly.
2021-06-11Rename Reference to RefCountedPedro J. Estébanez
2021-03-12Fixes small typos and grammar correctionAnshul7sp1
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-09Static analyzer fixes:bruvzg
Removes unused code in OS. Fixes return types. Fixes few typos.
2020-11-11Refactor variant built-in methods yet again.reduz
* Using C-style function pointers now, InternalMethod is gone. * This ensures much better performance in typed code. * Renamed builtin_funcs to utility_funcs, to avoid naming confusion
2020-11-10Create Variant built-in functions.reduz
-Moved Expression to use this, removed its own. -Eventually GDScript/VisualScript/GDNative need to be moved to this. -Given the JSON functions were hacked-in, removed them and created a new JSONParser class -Made sure these functions appear properly in documentation, since they will be removed from GDScript
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-11-07Refactored variant setters/gettersreduz
-Discern between named, indexed and keyed -Get direct access to functions for typed GDScript and GDNative bindings -Small changes to some classes in order to work with the new setget binder
2020-11-06Exposed randi_range to global funcs + renamed rand_range to randf_rangeYuri Roubinsky
2020-09-03[Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg
2020-07-27Make all String float conversion methods be 64-bitAaron Franke
2020-07-01Merge pull request #38713 from aaronfranke/string-64bitRémi Verschelde
Make all String integer conversion methods be 64-bit
2020-06-03Remove 32-bit String to_int methodAaron Franke
2020-06-02Fix for Expression class: inner string can be single quotedntfs.hard
2020-05-19Style: Remove unnecessary semicolons from `core`Rémi Verschelde
Semicolons are not necessary after function definitions or control flow blocks, and having some code use them makes things inconsistent (and occasionally can mess up `clang-format`'s formatting). Removing them is tedious work though, I had to do this manually (regex + manual review) as I couldn't find a tool for that. All other code folders would need to get the same treatment.
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-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-04-01Fix out of bound array access caused by unassigned variableRafał Mikrut
2020-03-11Fix various typosluz.paz
Found via `codespell`
2020-02-25Merge pull request #36515 from reduz/packed-array-64-bitsRémi Verschelde
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
2020-02-25Expression: Fix parsing integers as 32-bitRémi Verschelde
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-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-13Remove more deprecated methods and codeRémi Verschelde
2020-02-12Remove deprecated decimals builtinRémi Verschelde
Replaced by 'step_decimals' in 3.2 via #21425.
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-29Add ord() function to Expression classDanil Alexeev
The ord() function was recently added in GDScript and VisualScript, but was missed in the Expression class.