summaryrefslogtreecommitdiffstats
path: root/core/variant/variant.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Core: Integrate initalizer lists for VariantThaddeus Crews2024-04-191-114/+110
|
* Core: Use fixed-width integer types in VariantThaddeus Crews2024-04-041-87/+32
|
* Enforce template syntax `typename` over `class`Thaddeus Crews2024-03-071-3/+3
|
* Add const lvalue ref to core/* container parametersMuller-Castro2024-02-141-1/+1
|
* Use Packed*Array over Vector<T> in VariantMicky2024-02-061-91/+91
| | | | | | Also shuffles some method definitions and declarations to be more consistent with the way the Variant types are ordered across the codebase. And removes an unnecessary JSON assign (`JSON::stringify` can now be accessed statically)
* Remove unnecessary `this->` expressionsA Thousand Ships2024-01-291-15/+15
|
* Merge pull request #73896 from vnen/object-null-boolean-consistencyYuri Sizov2023-12-161-1/+1
|\ | | | | | | Make freed object different than null in comparison operators
| * Make freed object different than null in comparison operatorsGeorge Marques2023-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | This is so everything is consistent, as a freed object is not equivalent to `null` in general. The booleanization of a freed object still returns `false` to work as an easy check for validity of objects. Similarly, the negation of a freed object returns `true`. Also makes freed objects different from each other (if they are not the same reference).
* | Keep Variant type after zero()kobewi2023-11-081-0/+6
| |
* | Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicableA Thousand Ships2023-10-081-1/+1
| |
* | Support both semantic (by default) and numeric Variant hash comparisonArman Elgudzhyan2023-08-311-3/+6
|/ | | | Hash comparison for Variant continues to perform semantic/logical comparison with NaN's considered equal by default (to prevent #16114, #7354, #6947, #8081), but now optionally allows for numeric comparison that does not consider NaN's equal to support proper value comparison (for #72222)
* Core: Fix recursion level check for array stringificationDanil Alexeev2023-07-121-11/+7
|
* Fix expected argument count in Callable call error textkleonc2023-04-191-2/+2
|
* Fix Variant hashing for floatsNinni Pipping2023-03-081-2/+2
| | | | Incorrectly hashed floats as single precision
* Core: Identity compare objects by id, not by pointersDmitrii Maganov2023-02-241-1/+1
|
* GDScript: Improve usability of setter chainsGeorge Marques2023-02-021-9/+0
| | | | | | | | | - Consider PackedArrays non-shared since they are copied on C++/script boundaries. - Add error messages in the analyzer when assigning to read-only properties. - Add specific error message at runtime when assignment fails because the property is read-only.
* Add `@GlobalScope` `is_same(a, b)` and `Variant::identity_compare()`Adam Scott2023-01-251-0/+40
|
* Fix Callable call error reporting.Juan Linietsky2023-01-101-1/+16
| | | | | | * Fix potential crash when using bind in `Variant::get_callable_error_text()` * Properly compute bound arguments so they can be properly shown. * Add a function to obtain the actual bound arguments.
* Fix for PackedArray comparisonNinni Pipping2023-01-081-37/+38
|
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | 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".
* Merge pull request #68747 from rune-scape/rune-stringname-unificationRémi Verschelde2022-12-091-0/+13
|\ | | | | | | GDScript: Unify StringName and String
| * Unify String and StringNamerune-scape2022-12-051-0/+13
| |
* | Fix Variant StringName `is_zero` being invertedAaron Franke2022-12-061-1/+1
|/
* Fix periods in editor strings and messagesHugo Locurcio2022-11-141-5/+5
| | | | | | - Ensure all strings with ellipsis end with 3 periods instead of 2. - Fix extraneous period in "Error calling from signal '...' to callable" messages.
* Merge pull request #67224 from Mickeon/jasonRémi Verschelde2022-10-111-2/+1
|\ | | | | | | Use `JSON::stringify` where possible
| * Use `JSON::stringify` where possibleMicky2022-10-111-2/+1
| |
* | Strip unnecessary break on switches returning early in VariantMicky2022-10-101-212/+133
|/ | | | | | Tweaks comments around the touched-up parts. Also tweaks spacing Also adds some spacing in all cases of Variant::`reference()`. This is a special for consistency, because it ends up making the cases more readable.
* Fix more MSVC C4702 (unreachable code) warningsRémi Verschelde2022-10-071-2/+0
|
* Fix MSVC warnings, rename shadowed variables, fix uninitialized values, ↵bruvzg2022-10-071-4/+0
| | | | change warnings=all to use /W4.
* Merge pull request #66898 from aaronfranke/proj-mat-columnsRémi Verschelde2022-10-051-17/+17
|\ | | | | | | Rename Projection `matrix` to `columns`
| * Rename Projection `matrix` to `columns`Aaron Franke2022-10-041-17/+17
| |
* | Improve dictionary printing to avoid confusion with arraysHugo Locurcio2022-10-041-6/+8
|/ | | | | | - Add leading and trailing spaces within dictionaries, as the `{}` characters are hard to distinguish from `[]` on some fonts. This is especially helpful with empty arrays and dictionaries.
* Use variadic template in `vformat()`Micky2022-09-141-30/+0
| | | | Allows `vformat()` to take more than 5 arguments. as well as being a general optimisation that avoids redundant empty Variant checks.
* Improve null and object printing to avoid confusion with arraysHugo Locurcio2022-08-311-4/+4
| | | | | | | - Use different syntax for object printing to avoid confusion with arrays. - Print null as `<null>` to avoid confusion with a string `"null"`. - Display `<empty>` in editor resource pickers to avoid confusion with array-based properties.
* Variant large bucket memory pool - for Projectionlawnjelly2022-08-021-9/+16
| | | | Add a larger bucket size pool for the new Projection Matrix.
* Merge pull request #61315 from lawnjelly/variant_bucket_poolsRémi Verschelde2022-08-021-15/+39
|\ | | | | Variant memory pools
| * Variant memory poolslawnjelly2022-07-041-15/+39
| | | | | | | | Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
* | Implement Vector4, Vector4i, Projectionreduz2022-07-231-1/+269
|/ | | | | | | | | | | | | Implement built-in classes Vector4, Vector4i and Projection. * Two versions of Vector4 (float and integer). * A Projection class, which is a 4x4 matrix specialized in projection types. These types have been requested for a long time, but given they were very corner case they were not added before. Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity. **Q**: Why Projection and not Matrix4? **A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
* Merge pull request #62468 from V-Sekai/core-const-expressionsRémi Verschelde2022-06-281-0/+2
|\ | | | | Add a const call mode to Object, Variant and Script.
| * Add a const call mode to Object, Variant and Script.K. S. Ernest (iFire) Lee2022-06-271-0/+2
| | | | | | | | | | | | | | 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>
* | GDScript: Fix setter being called in chains for shared typesGeorge Marques2022-06-271-4/+15
|/ | | | | | | | | | | When a type is shared (i.e. passed by reference) it doesn't need to be called in a setter chain (e.g. `a.b.c = 0`) since it will be updated in place. This commit adds an instruction that jumps when the value is shared so it can be used to skip those cases and avoid redundant calls of setters. It also solves issues when assigning to sub-properties of read-only properties.
* Clean up Hash Functionsreduz2022-06-201-40/+104
| | | | | | | Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934 * Clean up usage of murmur3 * Fixed usages of binary murmur3 on floats (this is invalid) * Changed DJB2 to use xor (which seems to be better)
* Hash function improvementsHendrik Brucker2022-06-151-76/+20
|
* Add StringName explicitly to Variant::hash_compareGeorge Marques2022-06-031-0/+4
| | | | This makes equality comparisons to StringName more performant
* quote strings inside arrays and dictionariesNathan Franke2022-05-031-5/+26
|
* Merge pull request #60627 from aaronfranke/rename-elementsRémi Verschelde2022-05-031-18/+18
|\ | | | | Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
| * Rename Basis "elements" to "rows"Aaron Franke2022-04-291-12/+12
| |
| * Rename Transform2D "elements" to "columns"Aaron Franke2022-04-291-14/+14
| |
* | Simplify Callable error text methodskobewi2022-04-301-48/+11
|/
* Fix more issues found by cppcheck.bruvzg2022-04-201-2/+2
|