summaryrefslogtreecommitdiffstats
path: root/core/variant.h
Commit message (Collapse)AuthorAgeFilesLines
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-613/+0
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Refactored variant setters/gettersreduz2020-11-071-2/+60
| | | | | | -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
* Refactored Variant Operators.reduz2020-11-061-1/+8
| | | | | -Using classes to call and a table -For typed code (GDS or GDNative), can obtain functions to call prevalidated or ptr.
* Add name and base type to Variant::InternalMethod (on debug)George Marques2020-10-221-0/+11
| | | | | This is useful to showing error messages when a pointer to an InternalMethod is the only information available.
* Refactored binding system for core typesreduz2020-10-141-0/+28
| | | | | | | | | Moved to a system using variadic templates, shared with CallableBind. New code is cleaner, faster and allows for much better optimization of core type functions from GDScript and GDNative. Added Variant::InternalMethod function for direct call access.
* [Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg2020-09-031-2/+2
|
* Add VariantInternal classGeorge Marques2020-09-021-0/+1
| | | | | | This is used to get a direct pointer for the data inside a Variant. Added as another class instead of in Variant directly because this should only be used in special cases, so use must be explicit.
* Style: Remove unnecessary semicolons from `core`Rémi Verschelde2020-05-191-2/+2
| | | | | | | | | | 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.
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-1/+2
| | | | | 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-6/+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.
* Port member initialization from constructor to declaration (C++11)Rémi Verschelde2020-05-141-4/+3
| | | | | | | | | | 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.
* Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde2020-05-101-1/+2
| | | | | | | Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
* Remove some C++11 polyfill defines that are no longer neededHugo Locurcio2020-05-031-8/+1
|
* Replace NULL with nullptrlupoDharkael2020-04-021-8/+8
|
* Style: Harmonize header guards to style guide [Core]Rémi Verschelde2020-03-251-1/+2
|
* Update docs and bindings for new integer vector typesRémi Verschelde2020-02-251-9/+7
|
* Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky2020-02-251-12/+20
| | | | | | | | | | | | | | | | | | | | | - 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.
* Store arrays inside of Variant as shared.Juan Linietsky2020-02-231-4/+72
| | | | | | | | | | | | | Arrays inside of Variant are unique and use reference counting. When you assign a variant containing a packed array to another, or when you call non const functions to arrays, this will work even if the array is inside a dictionary, so they will from now pass as reference. The difference with regular variant arrays is that, once passed to a function in the C++ API, they are no longer shared. This is required for security and thread safety, as those arrays are mainly used to pass data back and forth even between threads.
* Add support for Vector2i, Rect2i and Vector3i to VariantJuan Linietsky2020-02-221-0/+10
| | | | | | | 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.
* Merge pull request #36400 from reduz/variant-string-nameRémi Verschelde2020-02-211-0/+1
|\ | | | | Added StringName as a variant type.
| * Added StringName as a variant type.Juan Linietsky2020-02-211-0/+1
| | | | | | | | Also changed all relevant properties defined manually to StringName.
* | Created the callable_mp macro, for signals to call method pointers directly.Juan Linietsky2020-02-211-1/+0
|/
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-19/+13
| | | | objects and made them default.
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-181-44/+28
| | | | | 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-7/+7
|
* ObjectID converted to a structure, fixes many bugs where used incorrectly as ↵Juan Linietsky2020-02-121-0/+4
| | | | 32 bits.
* 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.
* Remove redundant author doc commentsIAmActuallyCthulhu2019-08-121-4/+0
|
* Some code changed with Clang-Tidyqarmin2019-06-261-12/+12
|
* Don't crash on printing nested typesHein-Pieter van Braam-Stewart2019-04-201-0/+1
| | | | | | | | | | When adding an Array or Dictionary to itself operator String() got in an infinite loop. This commit adds a stack to operator String() (Through the use of a new 'stringify method'). This stack keeps track of all unique Arrays and Dictionaries it has seen. When a duplicate is found only a static string is printed '[...]' or '{...}'. This mirror Python's behavior in a similar case.
* Align the Variant data memberHein-Pieter van Braam2019-02-201-2/+8
| | | | | This should avoid potential alignment issues when _mem holds real values and speed up some floating point operations in some cases.
* Core: Ensure classes match their header filenameRémi Verschelde2019-02-121-1/+1
| | | | | | | | | | | | | | | Also drop some unused files. Renamed: - `core/dvector.h` -> `pool_vector.h` - `core/io/resource_import.h` -> `resource_importer.h` - `core/sort.h` -> `sort_array.h` - `core/string_db.h` -> `string_name.h` Dropped: - `core/allocators.h` - `core/os/shell.h` - `core/variant_construct_string.cpp`
* [Core] Rename Matrix3 file to BasisAaron Franke2019-02-091-1/+1
| | | The code already referred to "Basis", it's just the file name that was different for some reason.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Fix mismatched class/struct definition warnings [-Wmismatched-tags]Rémi Verschelde2018-10-011-1/+1
| | | | | | | | | | | | | | | | Fixes the following Clang 7 warnings: ``` core/object.cpp:44:1: warning: '_ObjectDebugLock' defined as a struct here but previously declared as a class [-Wmismatched-tags] core/variant_call.cpp:43:1: warning: '_VariantCall' defined as a struct here but previously declared as a class [-Wmismatched-tags] drivers/gles3/rasterizer_storage_gles3.h:765:2: warning: 'MultiMesh' defined as a struct here but previously declared as a class [-Wmismatched-tags] editor/editor_node.h:794:1: warning: 'EditorProgress' defined as a struct here but previously declared as a class [-Wmismatched-tags] modules/bullet/rigid_body_bullet.h:230:17: warning: class 'KinematicUtilities' was previously declared as a struct [-Wmismatched-tags] modules/bullet/space_bullet.h:60:1: warning: class 'btSoftBodyWorldInfo' was previously declared as a struct [-Wmismatched-tags] scene/resources/world_2d.cpp:40:1: warning: 'SpatialIndexer2D' defined as a struct here but previously declared as a class [-Wmismatched-tags] scene/resources/world.cpp:39:1: warning: 'SpatialIndexer' defined as a struct here but previously declared as a class [-Wmismatched-tags] servers/audio/reverb_sw.cpp:60:1: warning: 'ReverbParamsSW' defined as a struct here but previously declared as a class [-Wmismatched-tags] thirdparty/bullet/BulletSoftBody/btSoftBody.h:43:1: warning: 'btSoftBodyWorldInfo' defined as a struct here but previously declared as a class [-Wmismatched-tags] ```
* Make core/ includes absolute, remove subfolders from include pathRémi Verschelde2018-09-121-17/+17
| | | | | | 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.
* [Core] Completely kill math_2d.h, change includesAaron Franke2018-08-111-1/+1
|
* Allow some non-integer built-in constants in gdscriptBernhard Liebl2018-07-311-3/+3
|
* State machine animation nodeJuan Linietsky2018-06-251-0/+2
|
* Remove unused Variant._data.RefPtrEmmanuel Leblond2018-04-291-1/+0
|
* Duplicate Arrays and Dictionaries when instancing scene in editorBojidar Marinov2018-03-131-0/+1
| | | | | | Also, add deep (=false) parameter to Array.duplicate and Dictionary.duplicate Fixes #13971
* Fix typos with codespellluz.paz2018-02-211-1/+1
| | | | | | | | | | | | | | Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt` Whitelist consists of: ``` ang doubleclick lod nd que te unselect ```
* Add missing copyright headers and fix formattingRémi Verschelde2018-01-051-0/+1
| | | | | | Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
* Update copyright statements to 2018Rémi Verschelde2018-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Rename Rect3 to AABB.Ferenc Arn2017-11-171-5/+5
| | | | Fixes #12973.
* variant.h: Update comments with numeric enum valuesSebastian Krzyszkowiak2017-10-201-4/+4
| | | | | | Comments got desynchronized with the actual values of the enum. To avoid anyone making some stupid mistake here, let's fix it as soon as possible.
* Fixed constness of variant functions, as well as visual script sequence ↵Juan Linietsky2017-09-251-0/+1
| | | | ports. Closes #11258
* Allow booleanization of all typesHein-Pieter van Braam2017-09-191-1/+1
| | | | | | | | | | | | | We now allow booleanization of all types. This means that empty versions of all types now evaluate to false. So a Vector2(0,0), Dictionary(), etc. This allows you to write GDScript like: if not Dictionary(): print("Empty dict") Booleanization can now also no longer fail. There is no more valid flag, this changes Variant and GDNative API.
* Move Variant::evaluate() switch to computed gotoHein-Pieter van Braam2017-09-171-1/+3
| | | | | | | | | | | | | In an effort to make GDScript a little faster replace the double switch() with a computed goto on compilers that set __GNUC__. For compilers that don't support computed goto it will fall back to regular switch/case statements. In addition disable using boolean values in a mathematical context. Now boolean values can only be compared with other booleans. Booleans will also no longer be coerced to integers. This PR replaces #11308 and fixes #11291
* Fix enums bindingsMaxim Sheronov2017-09-131-1/+0
| | | | | Add missed bindings for enums Move some enums to class to have correct output of api.json