1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

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.

(cherry picked from commit 391ce81c5e)
This commit is contained in:
Josh Grams
2016-02-17 22:34:49 -05:00
committed by Rémi Verschelde
parent 459b914d9c
commit cafcdb015d
4 changed files with 77 additions and 4 deletions

View File

@@ -1115,6 +1115,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() {