diff options
author | Josh Grams <josh@qualdan.com> | 2016-02-17 22:34:49 -0500 |
---|---|---|
committer | Josh Grams <josh@qualdan.com> | 2016-03-01 07:37:36 -0500 |
commit | 391ce81c5ea037ffcbc525434673f4edd55a7d7e (patch) | |
tree | fbb1ea115bd472306be53c02186ff0941961e0dd /core/variant.cpp | |
parent | a12c63ef9e6332d0003228e1d8d79a57ef3995fb (diff) | |
download | redot-engine-391ce81c5ea037ffcbc525434673f4edd55a7d7e.tar.gz |
AnimationTreePlayer: blend value tracks (closes #2299)
Variant:
- zero() sets a Variant to the appropriate type of zero value
- blend() blends part of one Variant on top of another.
Diffstat (limited to 'core/variant.cpp')
-rw-r--r-- | core/variant.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/variant.cpp b/core/variant.cpp index 3bd8d80528..1fdbc9f753 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1116,6 +1116,21 @@ void Variant::reference(const Variant& p_variant) { } +void Variant::zero() { + switch(type) { + case NIL: break; + case BOOL: this->_data._bool = false; break; + case INT: this->_data._int = 0; break; + case REAL: this->_data._real = 0; break; + case VECTOR2: *reinterpret_cast<Vector2*>(this->_data._mem) = Vector2(); break; + case RECT2: *reinterpret_cast<Rect2*>(this->_data._mem) = Rect2(); break; + case VECTOR3: *reinterpret_cast<Vector3*>(this->_data._mem) = Vector3(); break; + case PLANE: *reinterpret_cast<Plane*>(this->_data._mem) = Plane(); break; + case QUAT: *reinterpret_cast<Quat*>(this->_data._mem) = Quat(); break; + case COLOR: *reinterpret_cast<Color*>(this->_data._mem) = Color(); break; + default: this->clear(); break; + } +} void Variant::clear() { switch(type) { |