summaryrefslogtreecommitdiff
path: root/core/variant_op.cpp
AgeCommit message (Collapse)Author
2020-03-08Refactor ScriptDebugger.Fabio Alessandrelli
EngineDebugger is the new interface to access the debugger. It tries to be as agnostic as possible on the data that various subsystems can expose. It allows 2 types of interactions: - Profilers: A subsystem can register a profiler, assigning it a unique name. That name can be used to activate the profiler or add data to it. The registered profiler can be composed of up to 3 functions: - Toggle: called when the profiler is activated/deactivated. - Add: called whenever data is added to the debugger (via `EngineDebugger::profiler_add_frame_data`) - Tick: called every frame (during idle), receives frame times. - Captures: (Only relevant in remote debugger for now) A subsystem can register a capture, assigning it a unique name. When receiving a message, the remote debugger will check if it starts with `[prefix]:` and call the associated capture with name `prefix`. Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new profiler system. Port SceneDebugger and RemoteDebugger to the new capture system. The LocalDebugger also uses the new profiler system for scripts profiling.
2020-02-25Update docs and bindings for new integer vector typesRé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-23Store arrays inside of Variant as shared.Juan Linietsky
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.
2020-02-22Add support for Vector2i, Rect2i and Vector3i to VariantJuan Linietsky
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.
2020-02-21Added StringName as a variant type.Juan Linietsky
Also changed all relevant properties defined manually to StringName.
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-15Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr.Juan Linietsky
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-12Don't allow to use too big or too small shift operatorsRafał Mikrut
2019-07-20Changed some code showed in LGTM and Coverageqarmin
2019-07-01Remove unnecessary code and add some error explanationsqarmin
2019-04-09Style: Apply new changes from clang-format 8.0Rémi Verschelde
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0, so contributors can keep using those versions for now (they will not undo those changes).
2019-03-03Merge pull request #25934 from mrcdk/pool_int_real_color_interpolateRémi Verschelde
Added PoolIntArray, PoolRealArray and PoolColorArray interpolate
2019-02-20Add -Wshadow=local to warnings and fix reported issues.marxin
Fixes #25316.
2019-02-16Added PoolIntArray, PoolRealArray and PoolColorArray interpolateMrCdK
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-11-28Fix many errors found by PVS-StudioAaron Franke
Fix errors 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, and 15.
2018-10-07Optimize interpolation algorithmsqonnop
Interpolation in the form of va + (vb - va) * c is faster and prevents floating point issues for int/string Followup to https://github.com/godotengine/godot/pull/22786
2018-10-07Merge pull request #22752 from aaronfranke/equals-redundantRémi Verschelde
Remove redundant "== true" and "== false" code
2018-10-06Remove redundant "== false" codeAaron Franke
Some of this code has been re-organized. f
2018-10-06Fixed int interpolation issue, closes #22763qonnop
When interpolating between two equal int values a and b, floating point calculation imprecisions can result in different values depending on the interpolation factor.
2018-09-18Color: Fix rounding error converting from float to 8-bitRémi Verschelde
Fixes #16736.
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
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.
2018-07-03Hacked around duplication bug. I think duplicate needs to be even smarter, ↵Juan Linietsky
maybe pass two bools? (containers and/or resources)
2018-07-02-Fixes to how hashing happened, now StringName and NodePath use default ↵Juan Linietsky
hasher, this was leading to some severe slowdown in scenarios -Fixes to some duplication scenarios for instanced scenes
2018-04-22Keep alpha when changing h, s or v on colorShyRed
When modifying the h, s or v properties of a color in GDScript the alpha value needs to stay unchanged.
2018-04-16Fix names of Variant operatorsGeorge Marques
2018-04-08Merge pull request #17382 from bojidar-bg/13971-path-array-unsavedJuan Linietsky
Duplicate Arrays and Dictionaries when instancing scene in editor
2018-03-13Duplicate Arrays and Dictionaries when instancing scene in editorBojidar Marinov
Also, add deep (=false) parameter to Array.duplicate and Dictionary.duplicate Fixes #13971
2018-03-13Fix a potential bug hinted by clangBojidar Marinov
2018-02-22Color:fix setting V switch S to old V valuePoommetee Ketson
2018-02-21Fix typos with codespellluz.paz
Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt` Whitelist consists of: ``` ang doubleclick lod nd que te unselect ```
2018-01-06Fix NEQ operation between 2 different ArraysMrCdK
it was returning false if it found the same content in both arrays which isn't correct, it should return true when it finds different values
2018-01-05Add missing copyright headers and fix formattingRémi Verschelde
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.
2018-01-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-11-17Rename Rect3 to AABB.Ferenc Arn
Fixes #12973.
2017-10-19Fix Color.r8/g8/b8/a8 being type float instead of type intMarcelo Fernandez
2017-09-25Make variant_op jumptable constHein-Pieter van Braam
Not doing this was a bit of an oversight
2017-09-24Merge pull request #11549 from hpvb/fix-11543Hein-Pieter van Braam
Fix Dictionary set_named
2017-09-24Fix Variant::get_named return when p_index is invalidMarcelo Fernandez
2017-09-24Fix Dictionary set_namedHein-Pieter van Braam
Reduz optimized field indexing in 3c85703 but the changes didn't apply to dictionary so this code remained untouched. However, the logic for validity checking was changed but not updated for the dictionary case.
2017-09-24Merge pull request #11473 from hpvb/fix-11466Rémi Verschelde
Implement operator != on Pool*Array types
2017-09-23Massive optimization to Variant::set_named/get_named. Should give a nice ↵Juan Linietsky
boost to GDScript.
2017-09-22Implement operator != on Pool*Array typesHein-Pieter van Braam
These types previously had equality checks but not inequality checks. Add these too. This fixes #11466
2017-09-20Allow equality checks between null and arbitrary typesHein-Pieter van Braam
Uninitialzed values in GDScript are of type NIL so not allowing null comparisons did end up breaking some code. This commit reenables NULL equality checks for all types. We're going to have to figure out how to make this fast for the compiler later.
2017-09-19Allow booleanization of all typesHein-Pieter van Braam
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.
2017-09-19Be type-strict checking on equality checksHein-Pieter van Braam
After a short discussion with @reduz and @karroffel we decided to make all non number/number comparisons return type errors on comparisons. Now bool == bool is allowed but Vector2 == Vector3 is a type error and no longer 'not equal'. The same has been done for the != operators. In addition I forgot to add some failures to some Object operators meaning that there was a potential for a crasher.
2017-09-19Fix accidental cast to Vector3 for Vector2 iterHein-Pieter van Braam