State machine animation node
This commit is contained in:
parent
c45a8a574a
commit
4f5a7ebaec
30 changed files with 3660 additions and 13 deletions
|
|
@ -214,6 +214,50 @@ struct PtrToArg<const T *> {
|
|||
} \
|
||||
}
|
||||
|
||||
#define MAKE_VECARG_ALT(m_type, m_type_alt) \
|
||||
template <> \
|
||||
struct PtrToArg<Vector<m_type_alt> > { \
|
||||
_FORCE_INLINE_ static Vector<m_type_alt> convert(const void *p_ptr) { \
|
||||
const PoolVector<m_type> *dvs = reinterpret_cast<const PoolVector<m_type> *>(p_ptr); \
|
||||
Vector<m_type_alt> ret; \
|
||||
int len = dvs->size(); \
|
||||
ret.resize(len); \
|
||||
{ \
|
||||
PoolVector<m_type>::Read r = dvs->read(); \
|
||||
for (int i = 0; i < len; i++) { \
|
||||
ret[i] = r[i]; \
|
||||
} \
|
||||
} \
|
||||
return ret; \
|
||||
} \
|
||||
_FORCE_INLINE_ static void encode(Vector<m_type_alt> p_vec, void *p_ptr) { \
|
||||
PoolVector<m_type> *dv = reinterpret_cast<PoolVector<m_type> *>(p_ptr); \
|
||||
int len = p_vec.size(); \
|
||||
dv->resize(len); \
|
||||
{ \
|
||||
PoolVector<m_type>::Write w = dv->write(); \
|
||||
for (int i = 0; i < len; i++) { \
|
||||
w[i] = p_vec[i]; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}; \
|
||||
template <> \
|
||||
struct PtrToArg<const Vector<m_type_alt> &> { \
|
||||
_FORCE_INLINE_ static Vector<m_type_alt> convert(const void *p_ptr) { \
|
||||
const PoolVector<m_type> *dvs = reinterpret_cast<const PoolVector<m_type> *>(p_ptr); \
|
||||
Vector<m_type_alt> ret; \
|
||||
int len = dvs->size(); \
|
||||
ret.resize(len); \
|
||||
{ \
|
||||
PoolVector<m_type>::Read r = dvs->read(); \
|
||||
for (int i = 0; i < len; i++) { \
|
||||
ret[i] = r[i]; \
|
||||
} \
|
||||
} \
|
||||
return ret; \
|
||||
} \
|
||||
}
|
||||
MAKE_VECARG(String);
|
||||
MAKE_VECARG(uint8_t);
|
||||
MAKE_VECARG(int);
|
||||
|
|
@ -221,6 +265,7 @@ MAKE_VECARG(float);
|
|||
MAKE_VECARG(Vector2);
|
||||
MAKE_VECARG(Vector3);
|
||||
MAKE_VECARG(Color);
|
||||
MAKE_VECARG_ALT(String, StringName);
|
||||
|
||||
//for stuff that gets converted to Array vectors
|
||||
#define MAKE_VECARR(m_type) \
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ MAKE_TEMPLATE_TYPE_INFO(Vector, Color, Variant::POOL_COLOR_ARRAY)
|
|||
MAKE_TEMPLATE_TYPE_INFO(Vector, Variant, Variant::ARRAY)
|
||||
MAKE_TEMPLATE_TYPE_INFO(Vector, RID, Variant::ARRAY)
|
||||
MAKE_TEMPLATE_TYPE_INFO(Vector, Plane, Variant::ARRAY)
|
||||
MAKE_TEMPLATE_TYPE_INFO(Vector, StringName, Variant::POOL_STRING_ARRAY)
|
||||
|
||||
MAKE_TEMPLATE_TYPE_INFO(PoolVector, Plane, Variant::ARRAY)
|
||||
MAKE_TEMPLATE_TYPE_INFO(PoolVector, Face3, Variant::POOL_VECTOR3_ARRAY)
|
||||
|
|
|
|||
|
|
@ -2012,6 +2012,19 @@ Variant::operator Vector<String>() const {
|
|||
}
|
||||
return to;
|
||||
}
|
||||
Variant::operator Vector<StringName>() const {
|
||||
|
||||
PoolVector<String> from = operator PoolVector<String>();
|
||||
Vector<StringName> to;
|
||||
int len = from.size();
|
||||
to.resize(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
to[i] = from[i];
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
||||
Variant::operator Vector<Vector3>() const {
|
||||
|
||||
PoolVector<Vector3> from = operator PoolVector<Vector3>();
|
||||
|
|
@ -2444,6 +2457,17 @@ Variant::Variant(const Vector<String> &p_array) {
|
|||
*this = v;
|
||||
}
|
||||
|
||||
Variant::Variant(const Vector<StringName> &p_array) {
|
||||
|
||||
type = NIL;
|
||||
PoolVector<String> v;
|
||||
int len = p_array.size();
|
||||
v.resize(len);
|
||||
for (int i = 0; i < len; i++)
|
||||
v.set(i, p_array[i]);
|
||||
*this = v;
|
||||
}
|
||||
|
||||
Variant::Variant(const Vector<Vector3> &p_array) {
|
||||
|
||||
type = NIL;
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ public:
|
|||
operator Vector<int>() const;
|
||||
operator Vector<real_t>() const;
|
||||
operator Vector<String>() const;
|
||||
operator Vector<StringName>() const;
|
||||
operator Vector<Vector3>() const;
|
||||
operator Vector<Color>() const;
|
||||
operator Vector<RID>() const;
|
||||
|
|
@ -280,6 +281,7 @@ public:
|
|||
Variant(const Vector<int> &p_int_array);
|
||||
Variant(const Vector<real_t> &p_real_array);
|
||||
Variant(const Vector<String> &p_string_array);
|
||||
Variant(const Vector<StringName> &p_string_array);
|
||||
Variant(const Vector<Vector3> &p_vector3_array);
|
||||
Variant(const Vector<Color> &p_color_array);
|
||||
Variant(const Vector<Plane> &p_array); // helper
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue