diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 7de8a2f5f..750e1c75e 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -650,35 +650,42 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT", Variant::INT); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_REAL", Variant::REAL); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING", Variant::STRING); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2); // 5 - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2I", Variant::VECTOR2I); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT2", Variant::RECT2); + + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT2", Variant::RECT2); // 5 BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT2I", Variant::RECT2I); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2I", Variant::VECTOR2I); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3", Variant::VECTOR3); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I", Variant::VECTOR3I); //10 - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I", Variant::VECTOR3I); // 10 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR4", Variant::VECTOR4); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR4I", Variant::VECTOR4I); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_QUATERNION", Variant::QUATERNION); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS); //15 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB); // 15 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM", Variant::TRANSFORM); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_PROJECTION", Variant::PROJECTION); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR); // 20 BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::_RID); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT); // 20 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::RID); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY); //25 BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RAW_ARRAY", Variant::POOL_BYTE_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT_ARRAY", Variant::POOL_INT_ARRAY); //25 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT_ARRAY", Variant::POOL_INT_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_REAL_ARRAY", Variant::POOL_REAL_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_ARRAY", Variant::POOL_STRING_ARRAY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_ARRAY", Variant::POOL_STRING_ARRAY); //30 BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2_ARRAY", Variant::POOL_VECTOR2_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2I_ARRAY", Variant::POOL_VECTOR2I_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3_ARRAY", Variant::POOL_VECTOR3_ARRAY); //30 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3_ARRAY", Variant::POOL_VECTOR3_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I_ARRAY", Variant::POOL_VECTOR3I_ARRAY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR4_ARRAY", Variant::POOL_VECTOR4_ARRAY); //35 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR4I_ARRAY", Variant::POOL_VECTOR4I_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR_ARRAY", Variant::POOL_COLOR_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX); // 38 //comparison BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("OP_EQUAL", Variant::OP_EQUAL); diff --git a/core/hashfuncs.h b/core/hashfuncs.h index 74861c0c6..bdadf1910 100644 --- a/core/hashfuncs.h +++ b/core/hashfuncs.h @@ -334,6 +334,7 @@ struct HashMapHasherDefault { static _FORCE_INLINE_ uint32_t hash(const int16_t p_int) { return hash_fmix32(p_int); } static _FORCE_INLINE_ uint32_t hash(const uint8_t p_int) { return hash_fmix32(p_int); } static _FORCE_INLINE_ uint32_t hash(const int8_t p_int) { return hash_fmix32(p_int); } + static _FORCE_INLINE_ uint32_t hash(const Vector2i &p_vec) { uint32_t h = hash_murmur3_one_32(p_vec.x); h = hash_murmur3_one_32(p_vec.y, h); diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index f365928d7..f7c130c5f 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -176,30 +176,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } break; // math types - case Variant::VECTOR2: { - ERR_FAIL_COND_V(len < 4 * 2, ERR_INVALID_DATA); - Vector2 val; - val.x = decode_float(&buf[0]); - val.y = decode_float(&buf[4]); - r_variant = val; - - if (r_len) { - (*r_len) += 4 * 2; - } - - } break; // 5 - case Variant::VECTOR2I: { - ERR_FAIL_COND_V(len < 4 * 2, ERR_INVALID_DATA); - Vector2i val; - val.x = decode_uint32(&buf[0]); - val.y = decode_uint32(&buf[4]); - r_variant = val; - - if (r_len) { - (*r_len) += 4 * 2; - } - - } break; case Variant::RECT2: { ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA); Rect2 val; @@ -227,6 +203,30 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int (*r_len) += 4 * 4; } + } break; + case Variant::VECTOR2: { + ERR_FAIL_COND_V(len < 4 * 2, ERR_INVALID_DATA); + Vector2 val; + val.x = decode_float(&buf[0]); + val.y = decode_float(&buf[4]); + r_variant = val; + + if (r_len) { + (*r_len) += 4 * 2; + } + + } break; // 5 + case Variant::VECTOR2I: { + ERR_FAIL_COND_V(len < 4 * 2, ERR_INVALID_DATA); + Vector2i val; + val.x = decode_uint32(&buf[0]); + val.y = decode_uint32(&buf[4]); + r_variant = val; + + if (r_len) { + (*r_len) += 4 * 2; + } + } break; case Variant::VECTOR3: { ERR_FAIL_COND_V(len < 4 * 3, ERR_INVALID_DATA); @@ -254,22 +254,35 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } } break; - case Variant::TRANSFORM2D: { - ERR_FAIL_COND_V(len < 4 * 6, ERR_INVALID_DATA); - Transform2D val; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - val.columns[i][j] = decode_float(&buf[(i * 2 + j) * 4]); - } - } - + case Variant::VECTOR4: { + ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA); + Vector4 val; + val.x = decode_float(&buf[0]); + val.y = decode_float(&buf[4]); + val.z = decode_float(&buf[8]); + val.w = decode_float(&buf[12]); r_variant = val; if (r_len) { - (*r_len) += 4 * 6; + (*r_len) += 4 * 3; } } break; + case Variant::VECTOR4I: { + ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA); + Vector4i val; + val.x = decode_uint32(&buf[0]); + val.y = decode_uint32(&buf[4]); + val.z = decode_uint32(&buf[8]); + val.w = decode_uint32(&buf[12]); + r_variant = val; + + if (r_len) { + (*r_len) += 4 * 3; + } + + } break; + case Variant::PLANE: { ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA); Plane val; @@ -348,6 +361,38 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int (*r_len) += 4 * 12; } + } break; + case Variant::TRANSFORM2D: { + ERR_FAIL_COND_V(len < 4 * 6, ERR_INVALID_DATA); + Transform2D val; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 2; j++) { + val.columns[i][j] = decode_float(&buf[(i * 2 + j) * 4]); + } + } + + r_variant = val; + + if (r_len) { + (*r_len) += 4 * 6; + } + + } break; + case Variant::PROJECTION: { + Projection val; + ERR_FAIL_COND_V((size_t)len < sizeof(float) * 62, ERR_INVALID_DATA); + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + val.matrix[i][j] = decode_float(&buf[(i * 4 + j) * sizeof(float)]); + } + } + + if (r_len) { + (*r_len) += sizeof(float) * 16; + } + + r_variant = val; + } break; // misc types @@ -415,7 +460,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } } break; - case Variant::_RID: { + case Variant::RID: { r_variant = RID(); } break; case Variant::OBJECT: { @@ -815,6 +860,78 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int r_variant = varray; + } break; + case Variant::POOL_VECTOR4_ARRAY: { + ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); + int32_t count = decode_uint32(buf); + buf += 4; + len -= 4; + + ERR_FAIL_MUL_OF(count, 4 * 4, ERR_INVALID_DATA); + ERR_FAIL_COND_V(count < 0 || count * 4 * 4 > len, ERR_INVALID_DATA); + + PoolVector varray; + + if (r_len) { + (*r_len) += 4; + } + + if (count) { + varray.resize(count); + PoolVector::Write w = varray.write(); + + for (int32_t i = 0; i < count; i++) { + w[i].x = decode_float(buf + i * 4 * 4 + 4 * 0); + w[i].y = decode_float(buf + i * 4 * 4 + 4 * 1); + w[i].z = decode_float(buf + i * 4 * 4 + 4 * 2); + w[i].w = decode_float(buf + i * 4 * 4 + 4 * 2); + } + + int adv = 4 * 4 * count; + + if (r_len) { + (*r_len) += adv; + } + } + + r_variant = varray; + + } break; + case Variant::POOL_VECTOR4I_ARRAY: { + ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); + int32_t count = decode_uint32(buf); + buf += 4; + len -= 4; + + ERR_FAIL_MUL_OF(count, 4 * 4, ERR_INVALID_DATA); + ERR_FAIL_COND_V(count < 0 || count * 4 * 4 > len, ERR_INVALID_DATA); + + PoolVector varray; + + if (r_len) { + (*r_len) += 4; + } + + if (count) { + varray.resize(count); + PoolVector::Write w = varray.write(); + + for (int32_t i = 0; i < count; i++) { + w[i].x = decode_uint32(buf + i * 4 * 4 + 4 * 0); + w[i].y = decode_uint32(buf + i * 4 * 4 + 4 * 1); + w[i].z = decode_uint32(buf + i * 4 * 4 + 4 * 2); + w[i].w = decode_uint32(buf + i * 4 * 4 + 4 * 2); + } + + int adv = 4 * 4 * count; + + if (r_len) { + (*r_len) += adv; + } + } + + r_variant = varray; + } break; case Variant::POOL_COLOR_ARRAY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); @@ -970,80 +1087,13 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4; } - } break; - case Variant::NODE_PATH: { - NodePath np = p_variant; - if (buf) { - encode_uint32(uint32_t(np.get_name_count()) | 0x80000000, buf); //for compatibility with the old format - encode_uint32(np.get_subname_count(), buf + 4); - uint32_t np_flags = 0; - if (np.is_absolute()) { - np_flags |= 1; - } - - encode_uint32(np_flags, buf + 8); - - buf += 12; - } - - r_len += 12; - - int total = np.get_name_count() + np.get_subname_count(); - - for (int i = 0; i < total; i++) { - String str; - - if (i < np.get_name_count()) { - str = np.get_name(i); - } else { - str = np.get_subname(i - np.get_name_count()); - } - - CharString utf8 = str.utf8(); - - int pad = 0; - - if (utf8.length() % 4) { - pad = 4 - utf8.length() % 4; - } - - if (buf) { - encode_uint32(utf8.length(), buf); - buf += 4; - memcpy(buf, utf8.get_data(), utf8.length()); - buf += pad + utf8.length(); - } - - r_len += 4 + utf8.length() + pad; - } - } break; case Variant::STRING: { _encode_string(p_variant, buf, r_len); } break; - // math types - case Variant::VECTOR2: { - if (buf) { - Vector2 v2 = p_variant; - encode_float(v2.x, &buf[0]); - encode_float(v2.y, &buf[4]); - } - - r_len += 2 * 4; - - } break; // 5 - case Variant::VECTOR2I: { - if (buf) { - Vector2i v2 = p_variant; - encode_uint32(v2.x, &buf[0]); - encode_uint32(v2.y, &buf[4]); - } - - r_len += 2 * 4; - - } break; + // math types case Variant::RECT2: { if (buf) { Rect2 r2 = p_variant; @@ -1065,6 +1115,26 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo } r_len += 4 * 4; + } break; + case Variant::VECTOR2: { + if (buf) { + Vector2 v2 = p_variant; + encode_float(v2.x, &buf[0]); + encode_float(v2.y, &buf[4]); + } + + r_len += 2 * 4; + + } break; // 5 + case Variant::VECTOR2I: { + if (buf) { + Vector2i v2 = p_variant; + encode_uint32(v2.x, &buf[0]); + encode_uint32(v2.y, &buf[4]); + } + + r_len += 2 * 4; + } break; case Variant::VECTOR3: { if (buf) { @@ -1088,19 +1158,31 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 3 * 4; } break; - case Variant::TRANSFORM2D: { + case Variant::VECTOR4: { if (buf) { - Transform2D val = p_variant; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - memcpy(&buf[(i * 2 + j) * 4], &val.columns[i][j], sizeof(float)); - } - } + Vector4 v4 = p_variant; + encode_float(v4.x, &buf[0]); + encode_float(v4.y, &buf[4]); + encode_float(v4.z, &buf[8]); + encode_float(v4.w, &buf[12]); } - r_len += 6 * 4; + r_len += 4 * 4; } break; + case Variant::VECTOR4I: { + if (buf) { + Vector4i v4 = p_variant; + encode_uint32(v4.x, &buf[0]); + encode_uint32(v4.y, &buf[4]); + encode_uint32(v4.z, &buf[8]); + encode_uint32(v4.w, &buf[12]); + } + + r_len += 4 * 4; + + } break; + case Variant::PLANE: { if (buf) { Plane p = p_variant; @@ -1168,6 +1250,32 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 12 * 4; + } break; + case Variant::TRANSFORM2D: { + if (buf) { + Transform2D val = p_variant; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 2; j++) { + memcpy(&buf[(i * 2 + j) * 4], &val.columns[i][j], sizeof(float)); + } + } + } + + r_len += 6 * 4; + + } break; + case Variant::PROJECTION: { + if (buf) { + Projection val = p_variant; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + memcpy(&buf[(i * 4 + j) * sizeof(real_t)], &val.matrix[i][j], sizeof(real_t)); + } + } + } + + r_len += 16 * sizeof(real_t); + } break; // misc types @@ -1183,7 +1291,54 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 * 4; } break; - case Variant::_RID: { + case Variant::NODE_PATH: { + NodePath np = p_variant; + if (buf) { + encode_uint32(uint32_t(np.get_name_count()) | 0x80000000, buf); //for compatibility with the old format + encode_uint32(np.get_subname_count(), buf + 4); + uint32_t np_flags = 0; + if (np.is_absolute()) { + np_flags |= 1; + } + + encode_uint32(np_flags, buf + 8); + + buf += 12; + } + + r_len += 12; + + int total = np.get_name_count() + np.get_subname_count(); + + for (int i = 0; i < total; i++) { + String str; + + if (i < np.get_name_count()) { + str = np.get_name(i); + } else { + str = np.get_subname(i - np.get_name_count()); + } + + CharString utf8 = str.utf8(); + + int pad = 0; + + if (utf8.length() % 4) { + pad = 4 - utf8.length() % 4; + } + + if (buf) { + encode_uint32(utf8.length(), buf); + buf += 4; + memcpy(buf, utf8.get_data(), utf8.length()); + buf += pad + utf8.length(); + } + + r_len += 4 + utf8.length() + pad; + } + + } break; + case Variant::RID: { } break; case Variant::OBJECT: { if (p_full_objects) { @@ -1317,6 +1472,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo } } break; + // arrays case Variant::POOL_BYTE_ARRAY: { PoolVector data = p_variant; @@ -1502,6 +1658,58 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 * 3 * len; + } break; + case Variant::POOL_VECTOR4_ARRAY: { + PoolVector data = p_variant; + int len = data.size(); + + if (buf) { + encode_uint32(len, buf); + buf += 4; + } + + r_len += 4; + + if (buf) { + for (int i = 0; i < len; i++) { + Vector4 v = data.get(i); + + encode_float(v.x, &buf[0]); + encode_float(v.y, &buf[4]); + encode_float(v.z, &buf[8]); + encode_float(v.w, &buf[12]); + buf += 4 * 4; + } + } + + r_len += 4 * 4 * len; + + } break; + case Variant::POOL_VECTOR4I_ARRAY: { + PoolVector data = p_variant; + int len = data.size(); + + if (buf) { + encode_uint32(len, buf); + buf += 4; + } + + r_len += 4; + + if (buf) { + for (int i = 0; i < len; i++) { + Vector4i v = data.get(i); + + encode_uint32(v.x, &buf[0]); + encode_uint32(v.y, &buf[4]); + encode_uint32(v.z, &buf[8]); + encode_uint32(v.z, &buf[12]); + buf += 4 * 4; + } + } + + r_len += 4 * 4 * len; + } break; case Variant::POOL_COLOR_ARRAY: { PoolVector data = p_variant; diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 680d70405..6d8fef13e 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -79,13 +79,12 @@ enum { VARIANT_VECTOR3I_ARRAY = 45, VARIANT_VECTOR2I_ARRAY = 46, VARIANT_STRING_NAME = 47, -#ifndef DISABLE_DEPRECATED - VARIANT_IMAGE = 21, // - no longer variant type - IMAGE_ENCODING_EMPTY = 0, - IMAGE_ENCODING_RAW = 1, - IMAGE_ENCODING_LOSSLESS = 2, - IMAGE_ENCODING_LOSSY = 3, -#endif + VARIANT_VECTOR4 = 48, + VARIANT_VECTOR4I = 49, + VARIANT_PROJECTION = 50, + VARIANT_VECTOR4_ARRAY = 51, + VARIANT_VECTOR4I_ARRAY = 52, + OBJECT_EMPTY = 0, OBJECT_EXTERNAL_RESOURCE = 1, OBJECT_INTERNAL_RESOURCE = 2, @@ -152,20 +151,6 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { case VARIANT_STRING: { r_v = get_unicode_string(); } break; - case VARIANT_VECTOR2: { - Vector2 v; - v.x = f->get_real(); - v.y = f->get_real(); - r_v = v; - - } break; - case VARIANT_VECTOR2I: { - Vector2i v; - v.x = f->get_32(); - v.y = f->get_32(); - r_v = v; - - } break; case VARIANT_RECT2: { Rect2 v; v.position.x = f->get_real(); @@ -183,6 +168,20 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { v.size.y = f->get_32(); r_v = v; + } break; + case VARIANT_VECTOR2: { + Vector2 v; + v.x = f->get_real(); + v.y = f->get_real(); + r_v = v; + + } break; + case VARIANT_VECTOR2I: { + Vector2i v; + v.x = f->get_32(); + v.y = f->get_32(); + r_v = v; + } break; case VARIANT_VECTOR3: { Vector3 v; @@ -198,6 +197,22 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { v.z = f->get_32(); r_v = v; } break; + case VARIANT_VECTOR4: { + Vector4 v; + v.x = f->get_real(); + v.y = f->get_real(); + v.z = f->get_real(); + v.w = f->get_real(); + r_v = v; + } break; + case VARIANT_VECTOR4I: { + Vector4i v; + v.x = f->get_32(); + v.y = f->get_32(); + v.z = f->get_32(); + v.w = f->get_32(); + r_v = v; + } break; case VARIANT_PLANE: { Plane v; v.normal.x = f->get_real(); @@ -225,17 +240,6 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { v.size.z = f->get_real(); r_v = v; - } break; - case VARIANT_MATRIX32: { - Transform2D v; - v.columns[0].x = f->get_real(); - v.columns[0].y = f->get_real(); - v.columns[1].x = f->get_real(); - v.columns[1].y = f->get_real(); - v.columns[2].x = f->get_real(); - v.columns[2].y = f->get_real(); - r_v = v; - } break; case VARIANT_MATRIX3: { Basis v; @@ -267,6 +271,37 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { v.origin.z = f->get_real(); r_v = v; } break; + case VARIANT_MATRIX32: { + Transform2D v; + v.columns[0].x = f->get_real(); + v.columns[0].y = f->get_real(); + v.columns[1].x = f->get_real(); + v.columns[1].y = f->get_real(); + v.columns[2].x = f->get_real(); + v.columns[2].y = f->get_real(); + r_v = v; + + } break; + case VARIANT_PROJECTION: { + Projection v; + v.matrix[0].x = f->get_real(); + v.matrix[0].y = f->get_real(); + v.matrix[0].z = f->get_real(); + v.matrix[0].w = f->get_real(); + v.matrix[1].x = f->get_real(); + v.matrix[1].y = f->get_real(); + v.matrix[1].z = f->get_real(); + v.matrix[1].w = f->get_real(); + v.matrix[2].x = f->get_real(); + v.matrix[2].y = f->get_real(); + v.matrix[2].z = f->get_real(); + v.matrix[2].w = f->get_real(); + v.matrix[3].x = f->get_real(); + v.matrix[3].y = f->get_real(); + v.matrix[3].z = f->get_real(); + v.matrix[3].w = f->get_real(); + r_v = v; + } break; case VARIANT_COLOR: { Color v; v.r = f->get_real(); @@ -276,7 +311,6 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { r_v = v; } break; - case VARIANT_NODE_PATH: { Vector names; Vector subnames; @@ -571,6 +605,54 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { r_v = array; } break; + case VARIANT_VECTOR4_ARRAY: { + uint32_t len = f->get_32(); + + PoolVector array; + array.resize(len); + PoolVector::Write w = array.write(); + if (sizeof(Vector4) == 16) { + f->get_buffer((uint8_t *)w.ptr(), len * sizeof(real_t) * 4); +#ifdef BIG_ENDIAN_ENABLED + { + uint32_t *ptr = (uint32_t *)w.ptr(); + for (int i = 0; i < len * 4; i++) { + ptr[i] = BSWAP32(ptr[i]); + } + } + +#endif + } else { + ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Vector4 size is NOT 16!"); + } + w.release(); + r_v = array; + + } break; + case VARIANT_VECTOR4I_ARRAY: { + uint32_t len = f->get_32(); + + PoolVector array; + array.resize(len); + PoolVector::Write w = array.write(); + if (sizeof(Vector4i) == 16) { + f->get_buffer((uint8_t *)w.ptr(), len * sizeof(uint32_t) * 4); +#ifdef BIG_ENDIAN_ENABLED + { + uint32_t *ptr = (uint32_t *)w.ptr(); + for (int i = 0; i < len * 4; i++) { + ptr[i] = BSWAP32(ptr[i]); + } + } +#endif + } else { + ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Vector4i size is NOT 16!"); + } + w.release(); + r_v = array; + + } break; + case VARIANT_COLOR_ARRAY: { uint32_t len = f->get_32(); @@ -595,66 +677,6 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { w.release(); r_v = array; } break; -#ifndef DISABLE_DEPRECATED - case VARIANT_IMAGE: { - uint32_t encoding = f->get_32(); - if (encoding == IMAGE_ENCODING_EMPTY) { - r_v = Ref(); - break; - } else if (encoding == IMAGE_ENCODING_RAW) { - uint32_t width = f->get_32(); - uint32_t height = f->get_32(); - uint32_t mipmaps = f->get_32(); - uint32_t format = f->get_32(); - const uint32_t format_version_shift = 24; - const uint32_t format_version_mask = format_version_shift - 1; - - uint32_t format_version = format >> format_version_shift; - - const uint32_t current_version = 0; - if (format_version > current_version) { - ERR_PRINT("Format version for encoded binary image is too new."); - return ERR_PARSE_ERROR; - } - - Image::Format fmt = Image::Format(format & format_version_mask); //if format changes, we can add a compatibility bit on top - - uint32_t datalen = f->get_32(); - - PoolVector imgdata; - imgdata.resize(datalen); - PoolVector::Write w = imgdata.write(); - f->get_buffer(w.ptr(), datalen); - _advance_padding(datalen); - w.release(); - - Ref image; - image.instance(); - image->create(width, height, mipmaps, fmt, imgdata); - r_v = image; - - } else { - //compressed - PoolVector data; - data.resize(f->get_32()); - PoolVector::Write w = data.write(); - f->get_buffer(w.ptr(), data.size()); - w.release(); - - Ref image; - - if (encoding == IMAGE_ENCODING_LOSSY && Image::webp_unpacker) { - image = Image::webp_unpacker(data); // IMAGE_ENCODING_LOSSY always meant WebP - } else if (encoding == IMAGE_ENCODING_LOSSLESS && Image::png_unpacker) { - image = Image::png_unpacker(data); // IMAGE_ENCODING_LOSSLESS always meant png - } - _advance_padding(data.size()); - - r_v = image; - } - - } break; -#endif default: { ERR_FAIL_V(ERR_FILE_CORRUPT); } break; @@ -1343,20 +1365,6 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia String val = p_property; save_unicode_string(f, val); - } break; - case Variant::VECTOR2: { - f->store_32(VARIANT_VECTOR2); - Vector2 val = p_property; - f->store_real(val.x); - f->store_real(val.y); - - } break; - case Variant::VECTOR2I: { - f->store_32(VARIANT_VECTOR2I); - Vector2i val = p_property; - f->store_32(val.x); - f->store_32(val.y); - } break; case Variant::RECT2: { f->store_32(VARIANT_RECT2); @@ -1375,6 +1383,20 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia f->store_32(val.size.x); f->store_32(val.size.y); + } break; + case Variant::VECTOR2: { + f->store_32(VARIANT_VECTOR2); + Vector2 val = p_property; + f->store_real(val.x); + f->store_real(val.y); + + } break; + case Variant::VECTOR2I: { + f->store_32(VARIANT_VECTOR2I); + Vector2i val = p_property; + f->store_32(val.x); + f->store_32(val.y); + } break; case Variant::VECTOR3: { f->store_32(VARIANT_VECTOR3); @@ -1392,18 +1414,24 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia f->store_32(val.z); } break; - case Variant::TRANSFORM2D: { - f->store_32(VARIANT_MATRIX32); - Transform2D val = p_property; - f->store_real(val.columns[0].x); - f->store_real(val.columns[0].y); - f->store_real(val.columns[1].x); - f->store_real(val.columns[1].y); - f->store_real(val.columns[2].x); - f->store_real(val.columns[2].y); + case Variant::VECTOR4: { + f->store_32(VARIANT_VECTOR4); + Vector4 val = p_property; + f->store_real(val.x); + f->store_real(val.y); + f->store_real(val.z); + f->store_real(val.w); } break; + case Variant::VECTOR4I: { + f->store_32(VARIANT_VECTOR4I); + Vector4i val = p_property; + f->store_32(val.x); + f->store_32(val.y); + f->store_32(val.z); + f->store_32(val.w); + } break; case Variant::PLANE: { f->store_32(VARIANT_PLANE); Plane val = p_property; @@ -1447,7 +1475,6 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia f->store_real(val.rows[2].z); } break; - case Variant::TRANSFORM: { f->store_32(VARIANT_TRANSFORM); Transform val = p_property; @@ -1464,6 +1491,38 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia f->store_real(val.origin.y); f->store_real(val.origin.z); + } break; + case Variant::TRANSFORM2D: { + f->store_32(VARIANT_MATRIX32); + Transform2D val = p_property; + f->store_real(val.columns[0].x); + f->store_real(val.columns[0].y); + f->store_real(val.columns[1].x); + f->store_real(val.columns[1].y); + f->store_real(val.columns[2].x); + f->store_real(val.columns[2].y); + + } break; + case Variant::PROJECTION: { + f->store_32(VARIANT_PROJECTION); + Projection val = p_property; + f->store_real(val.matrix[0].x); + f->store_real(val.matrix[0].y); + f->store_real(val.matrix[0].z); + f->store_real(val.matrix[0].w); + f->store_real(val.matrix[1].x); + f->store_real(val.matrix[1].y); + f->store_real(val.matrix[1].z); + f->store_real(val.matrix[1].w); + f->store_real(val.matrix[2].x); + f->store_real(val.matrix[2].y); + f->store_real(val.matrix[2].z); + f->store_real(val.matrix[2].w); + f->store_real(val.matrix[3].x); + f->store_real(val.matrix[3].y); + f->store_real(val.matrix[3].z); + f->store_real(val.matrix[3].w); + } break; case Variant::COLOR: { f->store_32(VARIANT_COLOR); @@ -1474,7 +1533,6 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia f->store_real(val.a); } break; - case Variant::NODE_PATH: { f->store_32(VARIANT_NODE_PATH); NodePath np = p_property; @@ -1500,7 +1558,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia } } break; - case Variant::_RID: { + case Variant::RID: { f->store_32(VARIANT_RID); WARN_PRINT("Can't save RIDs."); RID val = p_property; @@ -1655,6 +1713,35 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia f->store_32(r[i].z); } + } break; + + case Variant::POOL_VECTOR4_ARRAY: { + f->store_32(VARIANT_VECTOR4_ARRAY); + PoolVector arr = p_property; + int len = arr.size(); + f->store_32(len); + PoolVector::Read r = arr.read(); + for (int i = 0; i < len; i++) { + f->store_real(r[i].x); + f->store_real(r[i].y); + f->store_real(r[i].z); + f->store_real(r[i].w); + } + + } break; + case Variant::POOL_VECTOR4I_ARRAY: { + f->store_32(VARIANT_VECTOR4I_ARRAY); + PoolVector arr = p_property; + int len = arr.size(); + f->store_32(len); + PoolVector::Read r = arr.read(); + for (int i = 0; i < len; i++) { + f->store_32(r[i].x); + f->store_32(r[i].y); + f->store_32(r[i].z); + f->store_32(r[i].w); + } + } break; case Variant::POOL_COLOR_ARRAY: { f->store_32(VARIANT_COLOR_ARRAY); diff --git a/core/math/math_fieldwise.cpp b/core/math/math_fieldwise.cpp index cc9f1e6b3..ff3ee364b 100644 --- a/core/math/math_fieldwise.cpp +++ b/core/math/math_fieldwise.cpp @@ -48,16 +48,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const switch (p_source.get_type()) { - case Variant::VECTOR2: { - - SETUP_TYPE(Vector2) - - /**/ TRY_TRANSFER_FIELD("x", x) - else TRY_TRANSFER_FIELD("y", y) - - return target; - } - case Variant::RECT2: { SETUP_TYPE(Rect2) @@ -70,6 +60,38 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const return target; } + case Variant::RECT2I: { + + SETUP_TYPE(Rect2i) + + /**/ TRY_TRANSFER_FIELD("x", position.x) + else TRY_TRANSFER_FIELD("y", position.y) + else TRY_TRANSFER_FIELD("w", size.x) + else TRY_TRANSFER_FIELD("h", size.y) + + return target; + } + + case Variant::VECTOR2: { + + SETUP_TYPE(Vector2) + + /**/ TRY_TRANSFER_FIELD("x", x) + else TRY_TRANSFER_FIELD("y", y) + + return target; + } + + case Variant::VECTOR2I: { + + SETUP_TYPE(Vector2i) + + /**/ TRY_TRANSFER_FIELD("x", x) + else TRY_TRANSFER_FIELD("y", y) + + return target; + } + case Variant::VECTOR3: { SETUP_TYPE(Vector3) @@ -81,6 +103,39 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const return target; } + case Variant::VECTOR3I: { + + SETUP_TYPE(Vector3i) + + /**/ TRY_TRANSFER_FIELD("x", x) + else TRY_TRANSFER_FIELD("y", y) + else TRY_TRANSFER_FIELD("z", z) + + return target; + } + + case Variant::VECTOR4: { + SETUP_TYPE(Vector4) + + /**/ TRY_TRANSFER_FIELD("x", x) + else TRY_TRANSFER_FIELD("y", y) + else TRY_TRANSFER_FIELD("z", z) + else TRY_TRANSFER_FIELD("w", w) + + return target; + } + + case Variant::VECTOR4I: { + SETUP_TYPE(Vector4i) + + /**/ TRY_TRANSFER_FIELD("x", x) + else TRY_TRANSFER_FIELD("y", y) + else TRY_TRANSFER_FIELD("z", z) + else TRY_TRANSFER_FIELD("w", w) + + return target; + } + case Variant::PLANE: { SETUP_TYPE(Plane) @@ -119,20 +174,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const return target; } - case Variant::TRANSFORM2D: { - - SETUP_TYPE(Transform2D) - - /**/ TRY_TRANSFER_FIELD("xx", columns[0][0]) - else TRY_TRANSFER_FIELD("xy", columns[0][1]) - else TRY_TRANSFER_FIELD("yx", columns[1][0]) - else TRY_TRANSFER_FIELD("yy", columns[1][1]) - else TRY_TRANSFER_FIELD("ox", columns[2][0]) - else TRY_TRANSFER_FIELD("oy", columns[2][1]) - - return target; - } - case Variant::BASIS: { SETUP_TYPE(Basis) @@ -170,6 +211,20 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const return target; } + case Variant::TRANSFORM2D: { + + SETUP_TYPE(Transform2D) + + /**/ TRY_TRANSFER_FIELD("xx", columns[0][0]) + else TRY_TRANSFER_FIELD("xy", columns[0][1]) + else TRY_TRANSFER_FIELD("yx", columns[1][0]) + else TRY_TRANSFER_FIELD("yy", columns[1][1]) + else TRY_TRANSFER_FIELD("ox", columns[2][0]) + else TRY_TRANSFER_FIELD("oy", columns[2][1]) + + return target; + } + default: { ERR_FAIL_V(p_target); } diff --git a/core/math/projection.cpp b/core/math/projection.cpp index da6789feb..1e0cd082b 100644 --- a/core/math/projection.cpp +++ b/core/math/projection.cpp @@ -30,12 +30,14 @@ #include "projection.h" +#include "core/array.h" #include "core/math/aabb.h" #include "core/math/math_funcs.h" #include "core/math/plane.h" #include "core/math/rect2.h" #include "core/math/transform.h" #include "core/print_string.h" +#include "core/variant.h" float Projection::determinant() const { return matrix[0][3] * matrix[1][2] * matrix[2][1] * matrix[3][0] - matrix[0][2] * matrix[1][3] * matrix[2][1] * matrix[3][0] - @@ -68,31 +70,6 @@ void Projection::set_zero() { } } -Plane Projection::xform4(const Plane &p_vec4) const { - Plane ret; - - ret.normal.x = matrix[0][0] * p_vec4.normal.x + matrix[1][0] * p_vec4.normal.y + matrix[2][0] * p_vec4.normal.z + matrix[3][0] * p_vec4.d; - ret.normal.y = matrix[0][1] * p_vec4.normal.x + matrix[1][1] * p_vec4.normal.y + matrix[2][1] * p_vec4.normal.z + matrix[3][1] * p_vec4.d; - ret.normal.z = matrix[0][2] * p_vec4.normal.x + matrix[1][2] * p_vec4.normal.y + matrix[2][2] * p_vec4.normal.z + matrix[3][2] * p_vec4.d; - ret.d = matrix[0][3] * p_vec4.normal.x + matrix[1][3] * p_vec4.normal.y + matrix[2][3] * p_vec4.normal.z + matrix[3][3] * p_vec4.d; - return ret; -} - -Vector4 Projection::xform(const Vector4 &p_vec4) const { - return Vector4( - matrix[0][0] * p_vec4.x + matrix[1][0] * p_vec4.y + matrix[2][0] * p_vec4.z + matrix[3][0] * p_vec4.w, - matrix[0][1] * p_vec4.x + matrix[1][1] * p_vec4.y + matrix[2][1] * p_vec4.z + matrix[3][1] * p_vec4.w, - matrix[0][2] * p_vec4.x + matrix[1][2] * p_vec4.y + matrix[2][2] * p_vec4.z + matrix[3][2] * p_vec4.w, - matrix[0][3] * p_vec4.x + matrix[1][3] * p_vec4.y + matrix[2][3] * p_vec4.z + matrix[3][3] * p_vec4.w); -} -Vector4 Projection::xform_inv(const Vector4 &p_vec4) const { - return Vector4( - matrix[0][0] * p_vec4.x + matrix[0][1] * p_vec4.y + matrix[0][2] * p_vec4.z + matrix[0][3] * p_vec4.w, - matrix[1][0] * p_vec4.x + matrix[1][1] * p_vec4.y + matrix[1][2] * p_vec4.z + matrix[1][3] * p_vec4.w, - matrix[2][0] * p_vec4.x + matrix[2][1] * p_vec4.y + matrix[2][2] * p_vec4.z + matrix[2][3] * p_vec4.w, - matrix[3][0] * p_vec4.x + matrix[3][1] * p_vec4.y + matrix[3][2] * p_vec4.z + matrix[3][3] * p_vec4.w); -} - void Projection::adjust_perspective_znear(real_t p_new_znear) { real_t zfar = get_z_far(); real_t znear = p_new_znear; @@ -587,6 +564,88 @@ Vector Projection::get_projection_planes(const Transform &p_transform) co return planes; } +Array Projection::get_projection_planes_array(const Transform &p_transform) const { + /** Fast Plane Extraction from combined modelview/projection matrices. + * References: + * https://web.archive.org/web/20011221205252/https://www.markmorley.com/opengl/frustumculling.html + * https://web.archive.org/web/20061020020112/https://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf + */ + + Array planes; + + const real_t *matrix = (const real_t *)this->matrix; + + Plane new_plane; + + ///////--- Near Plane ---/////// + new_plane = Plane(matrix[3] + matrix[2], + matrix[7] + matrix[6], + matrix[11] + matrix[10], + matrix[15] + matrix[14]); + + new_plane.normal = -new_plane.normal; + new_plane.normalize(); + + planes.push_back(p_transform.xform(new_plane)); + + ///////--- Far Plane ---/////// + new_plane = Plane(matrix[3] - matrix[2], + matrix[7] - matrix[6], + matrix[11] - matrix[10], + matrix[15] - matrix[14]); + + new_plane.normal = -new_plane.normal; + new_plane.normalize(); + + planes.push_back(p_transform.xform(new_plane)); + + ///////--- Left Plane ---/////// + new_plane = Plane(matrix[3] + matrix[0], + matrix[7] + matrix[4], + matrix[11] + matrix[8], + matrix[15] + matrix[12]); + + new_plane.normal = -new_plane.normal; + new_plane.normalize(); + + planes.push_back(p_transform.xform(new_plane)); + + ///////--- Top Plane ---/////// + new_plane = Plane(matrix[3] - matrix[1], + matrix[7] - matrix[5], + matrix[11] - matrix[9], + matrix[15] - matrix[13]); + + new_plane.normal = -new_plane.normal; + new_plane.normalize(); + + planes.push_back(p_transform.xform(new_plane)); + + ///////--- Right Plane ---/////// + new_plane = Plane(matrix[3] - matrix[0], + matrix[7] - matrix[4], + matrix[11] - matrix[8], + matrix[15] - matrix[12]); + + new_plane.normal = -new_plane.normal; + new_plane.normalize(); + + planes.push_back(p_transform.xform(new_plane)); + + ///////--- Bottom Plane ---/////// + new_plane = Plane(matrix[3] + matrix[1], + matrix[7] + matrix[5], + matrix[11] + matrix[9], + matrix[15] + matrix[13]); + + new_plane.normal = -new_plane.normal; + new_plane.normalize(); + + planes.push_back(p_transform.xform(new_plane)); + + return planes; +} + Projection Projection::inverse() const { Projection cm = *this; cm.invert(); @@ -780,6 +839,32 @@ void Projection::set_light_atlas_rect(const Rect2 &p_rect) { m[15] = 1.0; } +Vector4 Projection::xform(const Vector4 &p_vec4) const { + return Vector4( + matrix[0][0] * p_vec4.x + matrix[1][0] * p_vec4.y + matrix[2][0] * p_vec4.z + matrix[3][0] * p_vec4.w, + matrix[0][1] * p_vec4.x + matrix[1][1] * p_vec4.y + matrix[2][1] * p_vec4.z + matrix[3][1] * p_vec4.w, + matrix[0][2] * p_vec4.x + matrix[1][2] * p_vec4.y + matrix[2][2] * p_vec4.z + matrix[3][2] * p_vec4.w, + matrix[0][3] * p_vec4.x + matrix[1][3] * p_vec4.y + matrix[2][3] * p_vec4.z + matrix[3][3] * p_vec4.w); +} + +Vector4 Projection::xform_inv(const Vector4 &p_vec4) const { + return Vector4( + matrix[0][0] * p_vec4.x + matrix[0][1] * p_vec4.y + matrix[0][2] * p_vec4.z + matrix[0][3] * p_vec4.w, + matrix[1][0] * p_vec4.x + matrix[1][1] * p_vec4.y + matrix[1][2] * p_vec4.z + matrix[1][3] * p_vec4.w, + matrix[2][0] * p_vec4.x + matrix[2][1] * p_vec4.y + matrix[2][2] * p_vec4.z + matrix[2][3] * p_vec4.w, + matrix[3][0] * p_vec4.x + matrix[3][1] * p_vec4.y + matrix[3][2] * p_vec4.z + matrix[3][3] * p_vec4.w); +} + +Plane Projection::xform(const Plane &p_vec4) const { + Plane ret; + + ret.normal.x = matrix[0][0] * p_vec4.normal.x + matrix[1][0] * p_vec4.normal.y + matrix[2][0] * p_vec4.normal.z + matrix[3][0] * p_vec4.d; + ret.normal.y = matrix[0][1] * p_vec4.normal.x + matrix[1][1] * p_vec4.normal.y + matrix[2][1] * p_vec4.normal.z + matrix[3][1] * p_vec4.d; + ret.normal.z = matrix[0][2] * p_vec4.normal.x + matrix[1][2] * p_vec4.normal.y + matrix[2][2] * p_vec4.normal.z + matrix[3][2] * p_vec4.d; + ret.d = matrix[0][3] * p_vec4.normal.x + matrix[1][3] * p_vec4.normal.y + matrix[2][3] * p_vec4.normal.z + matrix[3][3] * p_vec4.d; + return ret; +} + Projection::operator String() const { String str; for (int i = 0; i < 4; i++) { @@ -899,6 +984,11 @@ Projection::operator Transform() const { return tr; } + +void Projection::set_frustum2(real_t p_size, real_t p_aspect, Vector2 p_offset, real_t p_near, real_t p_far, bool p_flip_fov) { + set_frustum(p_size, p_aspect, p_offset, p_near, p_far, p_flip_fov); +} + Projection::Projection(const Vector4 &p_x, const Vector4 &p_y, const Vector4 &p_z, const Vector4 &p_w) { matrix[0] = p_x; matrix[1] = p_y; diff --git a/core/math/projection.h b/core/math/projection.h index 0f9f30075..4a5fa95eb 100644 --- a/core/math/projection.h +++ b/core/math/projection.h @@ -36,6 +36,7 @@ #include "core/math/vector4.h" #include "core/vector.h" +class Array; class AABB; class Plane; struct Rect2; @@ -90,8 +91,9 @@ struct Projection { static Projection create_frustum(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_near, real_t p_far); static Projection create_frustum_aspect(real_t p_size, real_t p_aspect, Vector2 p_offset, real_t p_near, real_t p_far, bool p_flip_fov = false); static Projection create_fit_aabb(const AABB &p_aabb); + Projection perspective_znear_adjusted(real_t p_new_znear) const; - Plane get_projection_plane(Planes p_plane) const; + Plane get_projection_plane(Projection::Planes p_plane) const; Projection flipped_y() const; Projection jitter_offseted(const Vector2 &p_offset) const; @@ -99,6 +101,10 @@ struct Projection { return Math::rad2deg(Math::atan(p_aspect * Math::tan(Math::deg2rad(p_fovx) * 0.5)) * 2.0); } + real_t calculate_fovy(real_t p_fovx, real_t p_aspect) { + return Math::rad2deg(Math::atan(p_aspect * Math::tan(Math::deg2rad(p_fovx) * 0.5)) * 2.0); + } + real_t get_z_far() const; real_t get_z_near() const; real_t get_aspect() const; @@ -106,6 +112,7 @@ struct Projection { bool is_orthogonal() const; Vector get_projection_planes(const Transform &p_transform) const; + Array get_projection_planes_array(const Transform &p_transform) const; bool get_endpoints(const Transform &p_transform, Vector3 *p_8points) const; Vector2 get_viewport_half_extents() const; @@ -116,12 +123,12 @@ struct Projection { Projection operator*(const Projection &p_matrix) const; - Plane xform4(const Plane &p_vec4) const; - _FORCE_INLINE_ Vector3 xform(const Vector3 &p_vec3) const; - Vector4 xform(const Vector4 &p_vec4) const; Vector4 xform_inv(const Vector4 &p_vec4) const; + _FORCE_INLINE_ Vector3 xform(const Vector3 &p_vector) const; + Plane xform(const Plane &p_plane) const; + operator String() const; void scale_translate_to_fit(const AABB &p_aabb); @@ -149,6 +156,24 @@ struct Projection { float get_lod_multiplier() const; + _FORCE_INLINE_ void set_perspective1(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov = false) { + set_perspective(p_fovy_degrees, p_aspect, p_z_near, p_z_far, p_flip_fov); + } + _FORCE_INLINE_ void set_perspective2(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov, int p_eye, real_t p_intraocular_dist, real_t p_convergence_dist) { + set_perspective(p_fovy_degrees, p_aspect, p_z_near, p_z_far, p_flip_fov, p_eye, p_intraocular_dist, p_convergence_dist); + } + _FORCE_INLINE_ void set_orthogonal1(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_znear, real_t p_zfar) { + set_orthogonal(p_left, p_right, p_bottom, p_top, p_znear, p_zfar); + } + _FORCE_INLINE_ void set_orthogonal2(real_t p_size, real_t p_aspect, real_t p_znear, real_t p_zfar, bool p_flip_fov = false) { + set_orthogonal(p_size, p_aspect, p_znear, p_zfar, p_flip_fov); + } + _FORCE_INLINE_ void set_frustum1(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_near, real_t p_far) { + set_frustum(p_left, p_right, p_bottom, p_top, p_near, p_far); + } + //Vector2 is incomplete here + void set_frustum2(real_t p_size, real_t p_aspect, Vector2 p_offset, real_t p_near, real_t p_far, bool p_flip_fov = false); + Projection(); Projection(const Vector4 &p_x, const Vector4 &p_y, const Vector4 &p_z, const Vector4 &p_w); Projection(const Transform &p_transform); diff --git a/core/math/vector4.h b/core/math/vector4.h index 1d6a524cf..c83d6a9bb 100644 --- a/core/math/vector4.h +++ b/core/math/vector4.h @@ -33,7 +33,6 @@ #include "core/math/math_defs.h" #include "core/math/math_funcs.h" -#include "core/math/vector3.h" #include "core/ustring.h" struct _NO_DISCARD_CLASS_ Vector4 { diff --git a/core/math/vector4i.cpp b/core/math/vector4i.cpp index c5f4c5995..c7aedd98b 100644 --- a/core/math/vector4i.cpp +++ b/core/math/vector4i.cpp @@ -83,9 +83,11 @@ Vector4i::operator Vector4() const { return Vector4(x, y, z, w); } +/* Vector4i::Vector4i(const Vector4 &p_vec4) { x = p_vec4.x; y = p_vec4.y; z = p_vec4.z; w = p_vec4.w; } +*/ diff --git a/core/math/vector4i.h b/core/math/vector4i.h index 95389f74c..b0b459f15 100644 --- a/core/math/vector4i.h +++ b/core/math/vector4i.h @@ -120,7 +120,7 @@ struct _NO_DISCARD_CLASS_ Vector4i { w = 0; } - Vector4i(const Vector4 &p_vec4); + //Vector4i(const Vector4 &p_vec4); _FORCE_INLINE_ Vector4i(const int32_t p_x, const int32_t p_y, const int32_t p_z, const int32_t p_w) { x = p_x; diff --git a/core/method_bind.h b/core/method_bind.h index e7376d074..6575bd4a8 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -164,10 +164,14 @@ struct VariantObjectClassChecker { // some helpers -VARIANT_ENUM_CAST(Vector3::Axis); -VARIANT_ENUM_CAST(Vector3i::Axis); + VARIANT_ENUM_CAST(Vector2::Axis); VARIANT_ENUM_CAST(Vector2i::Axis); +VARIANT_ENUM_CAST(Vector3::Axis); +VARIANT_ENUM_CAST(Vector3i::Axis); +VARIANT_ENUM_CAST(Vector4::Axis); +VARIANT_ENUM_CAST(Vector4i::Axis); +VARIANT_ENUM_CAST(Projection::Planes); VARIANT_ENUM_CAST(Error); VARIANT_ENUM_CAST(Margin); diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index bc343d46a..70ea4a134 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -114,18 +114,22 @@ MAKE_PTRARG(double); MAKE_PTRARG(String); MAKE_PTRARG(StringName); -MAKE_PTRARG(Vector2); -MAKE_PTRARG(Vector2i); + MAKE_PTRARG(Rect2); MAKE_PTRARG(Rect2i); +MAKE_PTRARG(Vector2); +MAKE_PTRARG(Vector2i); MAKE_PTRARG_BY_REFERENCE(Vector3); MAKE_PTRARG_BY_REFERENCE(Vector3i); -MAKE_PTRARG(Transform2D); +MAKE_PTRARG_BY_REFERENCE(Vector4); +MAKE_PTRARG_BY_REFERENCE(Vector4i); MAKE_PTRARG_BY_REFERENCE(Plane); MAKE_PTRARG(Quaternion); MAKE_PTRARG_BY_REFERENCE(AABB); MAKE_PTRARG_BY_REFERENCE(Basis); MAKE_PTRARG_BY_REFERENCE(Transform); +MAKE_PTRARG(Transform2D); +MAKE_PTRARG(Projection); MAKE_PTRARG_BY_REFERENCE(Color); MAKE_PTRARG(NodePath); MAKE_PTRARG(RID); @@ -266,6 +270,8 @@ MAKE_VECARG(Vector2); MAKE_VECARG(Vector2i); MAKE_VECARG(Vector3); MAKE_VECARG(Vector3i); +MAKE_VECARG(Vector4); +MAKE_VECARG(Vector4i); MAKE_VECARG(Color); MAKE_VECARG_ALT(String, StringName); diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index c1e8f525f..d6c6b40a5 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -250,7 +250,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector &tmpd } break; // misc types - case Variant::_RID: + case Variant::RID: case Variant::OBJECT: { return _pack(Variant(), tmpdata, string_cache); } break; diff --git a/core/type_info.h b/core/type_info.h index f87f6a524..04d33cb1a 100644 --- a/core/type_info.h +++ b/core/type_info.h @@ -137,21 +137,24 @@ MAKE_TYPE_INFO_WITH_META(float, Variant::REAL, PandemoniumTypeInfo::METADATA_REA MAKE_TYPE_INFO_WITH_META(double, Variant::REAL, PandemoniumTypeInfo::METADATA_REAL_IS_DOUBLE) MAKE_TYPE_INFO(String, Variant::STRING) -MAKE_TYPE_INFO(Vector2, Variant::VECTOR2) -MAKE_TYPE_INFO(Vector2i, Variant::VECTOR2I) MAKE_TYPE_INFO(Rect2, Variant::RECT2) MAKE_TYPE_INFO(Rect2i, Variant::RECT2I) +MAKE_TYPE_INFO(Vector2, Variant::VECTOR2) +MAKE_TYPE_INFO(Vector2i, Variant::VECTOR2I) MAKE_TYPE_INFO(Vector3, Variant::VECTOR3) MAKE_TYPE_INFO(Vector3i, Variant::VECTOR3I) -MAKE_TYPE_INFO(Transform2D, Variant::TRANSFORM2D) +MAKE_TYPE_INFO(Vector4, Variant::VECTOR4) +MAKE_TYPE_INFO(Vector4i, Variant::VECTOR4I) MAKE_TYPE_INFO(Plane, Variant::PLANE) MAKE_TYPE_INFO(Quaternion, Variant::QUATERNION) MAKE_TYPE_INFO(AABB, Variant::AABB) MAKE_TYPE_INFO(Basis, Variant::BASIS) MAKE_TYPE_INFO(Transform, Variant::TRANSFORM) +MAKE_TYPE_INFO(Transform2D, Variant::TRANSFORM2D) +MAKE_TYPE_INFO(Projection, Variant::PROJECTION) MAKE_TYPE_INFO(Color, Variant::COLOR) MAKE_TYPE_INFO(NodePath, Variant::NODE_PATH) -MAKE_TYPE_INFO(RID, Variant::_RID) +MAKE_TYPE_INFO(RID, Variant::RID) MAKE_TYPE_INFO(Dictionary, Variant::DICTIONARY) MAKE_TYPE_INFO(Array, Variant::ARRAY) MAKE_TYPE_INFO(PoolByteArray, Variant::POOL_BYTE_ARRAY) @@ -162,6 +165,8 @@ MAKE_TYPE_INFO(PoolVector2Array, Variant::POOL_VECTOR2_ARRAY) MAKE_TYPE_INFO(PoolVector2iArray, Variant::POOL_VECTOR2I_ARRAY) MAKE_TYPE_INFO(PoolVector3Array, Variant::POOL_VECTOR3_ARRAY) MAKE_TYPE_INFO(PoolVector3iArray, Variant::POOL_VECTOR3I_ARRAY) +MAKE_TYPE_INFO(PoolVector4Array, Variant::POOL_VECTOR4_ARRAY) +MAKE_TYPE_INFO(PoolVector4iArray, Variant::POOL_VECTOR4I_ARRAY) MAKE_TYPE_INFO(PoolColorArray, Variant::POOL_COLOR_ARRAY) MAKE_TYPE_INFO(StringName, Variant::STRING_NAME) @@ -233,6 +238,8 @@ MAKE_TEMPLATE_TYPE_INFO(Vector, Vector2, Variant::POOL_VECTOR2_ARRAY) MAKE_TEMPLATE_TYPE_INFO(Vector, Vector2i, Variant::POOL_VECTOR2I_ARRAY) MAKE_TEMPLATE_TYPE_INFO(Vector, Vector3, Variant::POOL_VECTOR3_ARRAY) MAKE_TEMPLATE_TYPE_INFO(Vector, Vector3i, Variant::POOL_VECTOR3I_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Vector4, Variant::POOL_VECTOR4_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Vector4i, Variant::POOL_VECTOR4I_ARRAY) MAKE_TEMPLATE_TYPE_INFO(Vector, Color, Variant::POOL_COLOR_ARRAY) MAKE_TEMPLATE_TYPE_INFO(Vector, Variant, Variant::ARRAY) diff --git a/core/variant.cpp b/core/variant.cpp index f78943f38..c3375270e 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -63,20 +63,17 @@ String Variant::get_type_name(Variant::Type p_type) { } break; // math types - case VECTOR2: { - return "Vector2"; - } break; - case VECTOR2I: { - return "Vector2i"; - } break; case RECT2: { return "Rect2"; } break; case RECT2I: { return "Rect2i"; } break; - case TRANSFORM2D: { - return "Transform2D"; + case VECTOR2: { + return "Vector2"; + } break; + case VECTOR2I: { + return "Vector2i"; } break; case VECTOR3: { return "Vector3"; @@ -84,37 +81,43 @@ String Variant::get_type_name(Variant::Type p_type) { case VECTOR3I: { return "Vector3i"; } break; + case VECTOR4: { + return "Vector4"; + } break; + case VECTOR4I: { + return "Vector4i"; + } break; + case PLANE: { return "Plane"; - - } break; - /* - case QUATERNION: { - - - } break;*/ - case AABB: { - return "AABB"; } break; case QUATERNION: { return "Quaternion"; - + } break; + case AABB: { + return "AABB"; } break; case BASIS: { return "Basis"; - } break; case TRANSFORM: { return "Transform"; - + } break; + case TRANSFORM2D: { + return "Transform2D"; + } break; + case PROJECTION: { + return "Projection"; } break; // misc types case COLOR: { return "Color"; - } break; - case _RID: { + case NODE_PATH: { + return "NodePath"; + } break; + case RID: { return "RID"; } break; case OBJECT: { @@ -123,54 +126,46 @@ String Variant::get_type_name(Variant::Type p_type) { case STRING_NAME: { return "StringName"; } break; - case NODE_PATH: { - return "NodePath"; - - } break; case DICTIONARY: { return "Dictionary"; - } break; case ARRAY: { return "Array"; - } break; // arrays case POOL_BYTE_ARRAY: { return "PoolByteArray"; - } break; case POOL_INT_ARRAY: { return "PoolIntArray"; - } break; case POOL_REAL_ARRAY: { return "PoolRealArray"; - } break; case POOL_STRING_ARRAY: { return "PoolStringArray"; } break; case POOL_VECTOR2_ARRAY: { return "PoolVector2Array"; - } break; case POOL_VECTOR2I_ARRAY: { return "PoolVector2iArray"; - } break; case POOL_VECTOR3_ARRAY: { return "PoolVector3Array"; - } break; case POOL_VECTOR3I_ARRAY: { return "PoolVector3iArray"; - + } break; + case POOL_VECTOR4_ARRAY: { + return "PoolVector4Array"; + } break; + case POOL_VECTOR4I_ARRAY: { + return "PoolVector4iArray"; } break; case POOL_COLOR_ARRAY: { return "PoolColorArray"; - } break; default: { } @@ -195,6 +190,9 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { const Type *invalid_types = nullptr; switch (p_type_to) { + case NIL: { + //can't + } break; case BOOL: { static const Type valid[] = { INT, @@ -214,7 +212,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; case REAL: { static const Type valid[] = { @@ -225,7 +222,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; case STRING: { static const Type invalid[] = { @@ -235,24 +231,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { invalid_types = invalid; } break; - case VECTOR2: { - static const Type valid[] = { - VECTOR2I, - NIL - }; - - valid_types = valid; - - } break; - case VECTOR2I: { - static const Type valid[] = { - VECTOR2, - NIL - }; - - valid_types = valid; - - } break; case RECT2: { static const Type valid[] = { RECT2I, @@ -260,7 +238,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; case RECT2I: { static const Type valid[] = { @@ -269,7 +246,22 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; + } break; + case VECTOR2: { + static const Type valid[] = { + VECTOR2I, + NIL + }; + valid_types = valid; + } break; + case VECTOR2I: { + static const Type valid[] = { + VECTOR2, + NIL + }; + + valid_types = valid; } break; case VECTOR3: { static const Type valid[] = { @@ -278,7 +270,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; case VECTOR3I: { static const Type valid[] = { @@ -287,16 +278,26 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; - case TRANSFORM2D: { + case VECTOR4: { static const Type valid[] = { - TRANSFORM, + VECTOR4I, NIL }; valid_types = valid; } break; + case VECTOR4I: { + static const Type valid[] = { + VECTOR4, + NIL + }; + + valid_types = valid; + } break; + case PLANE: { + //can't + } break; case QUATERNION: { static const Type valid[] = { BASIS, @@ -304,7 +305,9 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - + } break; + case AABB: { + //can't } break; case BASIS: { static const Type valid[] = { @@ -314,7 +317,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; case TRANSFORM: { static const Type valid[] = { @@ -325,9 +327,24 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; + case TRANSFORM2D: { + static const Type valid[] = { + TRANSFORM, + NIL + }; + valid_types = valid; + } break; + case PROJECTION: { + static const Type valid[] = { + TRANSFORM, + NIL + }; + + valid_types = valid; + } break; + // misc types case COLOR: { static const Type valid[] = { STRING, @@ -336,10 +353,16 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; + case NODE_PATH: { + static const Type valid[] = { + STRING, + NIL + }; - case _RID: { + valid_types = valid; + } break; + case RID: { static const Type valid[] = { OBJECT, NIL @@ -362,13 +385,8 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { valid_types = valid; } break; - case NODE_PATH: { - static const Type valid[] = { - STRING, - NIL - }; - - valid_types = valid; + case DICTIONARY: { + //can't } break; case ARRAY: { static const Type valid[] = { @@ -423,7 +441,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { NIL }; valid_types = valid; - } break; case POOL_VECTOR2I_ARRAY: { static const Type valid[] = { @@ -431,7 +448,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { NIL }; valid_types = valid; - } break; case POOL_VECTOR3_ARRAY: { static const Type valid[] = { @@ -439,7 +455,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { NIL }; valid_types = valid; - } break; case POOL_VECTOR3I_ARRAY: { static const Type valid[] = { @@ -447,7 +462,20 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { NIL }; valid_types = valid; - + } break; + case POOL_VECTOR4_ARRAY: { + static const Type valid[] = { + ARRAY, + NIL + }; + valid_types = valid; + } break; + case POOL_VECTOR4I_ARRAY: { + static const Type valid[] = { + ARRAY, + NIL + }; + valid_types = valid; } break; case POOL_COLOR_ARRAY: { static const Type valid[] = { @@ -456,7 +484,6 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; - } break; default: { } @@ -501,6 +528,9 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type const Type *valid_types = nullptr; switch (p_type_to) { + case NIL: { + //can't, also already handled + } break; case BOOL: { static const Type valid[] = { INT, @@ -542,24 +572,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type valid_types = valid; } break; - case VECTOR2: { - static const Type valid[] = { - VECTOR2I, - NIL - }; - - valid_types = valid; - - } break; - case VECTOR2I: { - static const Type valid[] = { - VECTOR2, - NIL - }; - - valid_types = valid; - - } break; case RECT2: { static const Type valid[] = { RECT2I, @@ -567,7 +579,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; - } break; case RECT2I: { static const Type valid[] = { @@ -576,7 +587,22 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; + } break; + case VECTOR2: { + static const Type valid[] = { + VECTOR2I, + NIL + }; + valid_types = valid; + } break; + case VECTOR2I: { + static const Type valid[] = { + VECTOR2, + NIL + }; + + valid_types = valid; } break; case VECTOR3: { static const Type valid[] = { @@ -585,7 +611,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; - } break; case VECTOR3I: { static const Type valid[] = { @@ -594,16 +619,26 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; - } break; - case TRANSFORM2D: { + case VECTOR4: { static const Type valid[] = { - TRANSFORM, + VECTOR4I, NIL }; valid_types = valid; } break; + case VECTOR4I: { + static const Type valid[] = { + VECTOR4, + NIL + }; + + valid_types = valid; + } break; + case PLANE: { + //Can't + } break; case QUATERNION: { static const Type valid[] = { BASIS, @@ -611,7 +646,9 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; - + } break; + case AABB: { + //Can't } break; case BASIS: { static const Type valid[] = { @@ -621,7 +658,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; - } break; case TRANSFORM: { static const Type valid[] = { @@ -632,9 +668,23 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; - } break; + case TRANSFORM2D: { + static const Type valid[] = { + TRANSFORM, + NIL + }; + valid_types = valid; + } break; + case PROJECTION: { + static const Type valid[] = { + TRANSFORM, + NIL + }; + + valid_types = valid; + } break; case COLOR: { static const Type valid[] = { STRING, @@ -643,10 +693,16 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; - } break; + case NODE_PATH: { + static const Type valid[] = { + STRING, + NIL + }; - case _RID: { + valid_types = valid; + } break; + case RID: { static const Type valid[] = { OBJECT, NIL @@ -669,13 +725,8 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type valid_types = valid; } break; - case NODE_PATH: { - static const Type valid[] = { - STRING, - NIL - }; - - valid_types = valid; + case DICTIONARY: { + //Can't } break; case ARRAY: { static const Type valid[] = { @@ -722,6 +773,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type ARRAY, NIL }; + valid_types = valid; } break; case POOL_VECTOR2_ARRAY: { @@ -729,32 +781,48 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type ARRAY, NIL }; - valid_types = valid; + valid_types = valid; } break; case POOL_VECTOR2I_ARRAY: { static const Type valid[] = { ARRAY, NIL }; - valid_types = valid; + valid_types = valid; } break; case POOL_VECTOR3_ARRAY: { static const Type valid[] = { ARRAY, NIL }; - valid_types = valid; + valid_types = valid; } break; case POOL_VECTOR3I_ARRAY: { static const Type valid[] = { ARRAY, NIL }; - valid_types = valid; + valid_types = valid; + } break; + case POOL_VECTOR4_ARRAY: { + static const Type valid[] = { + ARRAY, + NIL + }; + + valid_types = valid; + } break; + case POOL_VECTOR4I_ARRAY: { + static const Type valid[] = { + ARRAY, + NIL + }; + + valid_types = valid; } break; case POOL_COLOR_ARRAY: { static const Type valid[] = { @@ -763,7 +831,6 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; - } break; default: { } @@ -855,135 +922,118 @@ bool Variant::is_zero() const { } break; case INT: { return _data._int == 0; - } break; case REAL: { return _data._real == 0; - } break; case STRING: { return *reinterpret_cast(_data._mem) == String(); - } break; // math types - case VECTOR2: { - return *reinterpret_cast(_data._mem) == Vector2(); - - } break; - case VECTOR2I: { - return *reinterpret_cast(_data._mem) == Vector2i(); - - } break; case RECT2: { return *reinterpret_cast(_data._mem) == Rect2(); - } break; case RECT2I: { return *reinterpret_cast(_data._mem) == Rect2i(); - } break; - case TRANSFORM2D: { - return *_data._transform2d == Transform2D(); - + case VECTOR2: { + return *reinterpret_cast(_data._mem) == Vector2(); + } break; + case VECTOR2I: { + return *reinterpret_cast(_data._mem) == Vector2i(); } break; case VECTOR3: { return *reinterpret_cast(_data._mem) == Vector3(); - } break; case VECTOR3I: { return *reinterpret_cast(_data._mem) == Vector3i(); - } break; + case VECTOR4: { + return *reinterpret_cast(_data._mem) == Vector4(); + } break; + case VECTOR4I: { + return *reinterpret_cast(_data._mem) == Vector4i(); + } break; + case PLANE: { return *reinterpret_cast(_data._mem) == Plane(); - - } break; - /* - case QUATERNION: { - - - } break;*/ - case AABB: { - return *_data._aabb == ::AABB(); } break; case QUATERNION: { return *reinterpret_cast(_data._mem) == Quaternion(); - + } break; + case AABB: { + return *_data._aabb == ::AABB(); } break; case BASIS: { return *_data._basis == Basis(); - } break; case TRANSFORM: { return *_data._transform == Transform(); - + } break; + case TRANSFORM2D: { + return *_data._transform2d == Transform2D(); + } break; + case PROJECTION: { + return *_data._projection == Projection(); } break; // misc types case COLOR: { return *reinterpret_cast(_data._mem) == Color(); - } break; - case _RID: { - return *reinterpret_cast(_data._mem) == RID(); + case NODE_PATH: { + return reinterpret_cast(_data._mem)->is_empty(); + } break; + case RID: { + return *reinterpret_cast(_data._mem) == ::RID(); } break; case OBJECT: { return _UNSAFE_OBJ_PROXY_PTR(*this) == nullptr; } break; case STRING_NAME: { return *reinterpret_cast(_data._mem) != StringName(); - - } break; - case NODE_PATH: { - return reinterpret_cast(_data._mem)->is_empty(); - } break; case DICTIONARY: { return reinterpret_cast(_data._mem)->empty(); - } break; case ARRAY: { return reinterpret_cast(_data._mem)->empty(); - } break; // arrays case POOL_BYTE_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - } break; case POOL_INT_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - } break; case POOL_REAL_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - } break; case POOL_STRING_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - } break; case POOL_VECTOR2_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - } break; case POOL_VECTOR2I_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - } break; case POOL_VECTOR3_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - } break; case POOL_VECTOR3I_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - + } break; + case POOL_VECTOR4_ARRAY: { + return reinterpret_cast *>(_data._mem)->size() == 0; + } break; + case POOL_VECTOR4I_ARRAY: { + return reinterpret_cast *>(_data._mem)->size() == 0; } break; case POOL_COLOR_ARRAY: { return reinterpret_cast *>(_data._mem)->size() == 0; - } break; default: { } @@ -1004,43 +1054,39 @@ bool Variant::is_one() const { } break; case INT: { return _data._int == 1; - } break; case REAL: { return _data._real == 1; - - } break; - case VECTOR2: { - return *reinterpret_cast(_data._mem) == Vector2(1, 1); - - } break; - case VECTOR2I: { - return *reinterpret_cast(_data._mem) == Vector2i(1, 1); - } break; case RECT2: { return *reinterpret_cast(_data._mem) == Rect2(1, 1, 1, 1); - } break; case RECT2I: { return *reinterpret_cast(_data._mem) == Rect2i(1, 1, 1, 1); - + } break; + case VECTOR2: { + return *reinterpret_cast(_data._mem) == Vector2(1, 1); + } break; + case VECTOR2I: { + return *reinterpret_cast(_data._mem) == Vector2i(1, 1); } break; case VECTOR3: { return *reinterpret_cast(_data._mem) == Vector3(1, 1, 1); - } break; case VECTOR3I: { return *reinterpret_cast(_data._mem) == Vector3i(1, 1, 1); - + } break; + case VECTOR4: { + return *reinterpret_cast(_data._mem) == Vector4(1, 1, 1, 1); + } break; + case VECTOR4I: { + return *reinterpret_cast(_data._mem) == Vector4i(1, 1, 1, 1); } break; case PLANE: { return *reinterpret_cast(_data._mem) == Plane(1, 1, 1, 1); - } break; case COLOR: { return *reinterpret_cast(_data._mem) == Color(1, 1, 1, 1); - } break; default: { @@ -1100,20 +1146,17 @@ void Variant::reference(const Variant &p_variant) { } break; // math types - case VECTOR2: { - memnew_placement(_data._mem, Vector2(*reinterpret_cast(p_variant._data._mem))); - } break; - case VECTOR2I: { - memnew_placement(_data._mem, Vector2i(*reinterpret_cast(p_variant._data._mem))); - } break; case RECT2: { memnew_placement(_data._mem, Rect2(*reinterpret_cast(p_variant._data._mem))); } break; case RECT2I: { memnew_placement(_data._mem, Rect2i(*reinterpret_cast(p_variant._data._mem))); } break; - case TRANSFORM2D: { - _data._transform2d = memnew(Transform2D(*p_variant._data._transform2d)); + case VECTOR2: { + memnew_placement(_data._mem, Vector2(*reinterpret_cast(p_variant._data._mem))); + } break; + case VECTOR2I: { + memnew_placement(_data._mem, Vector2i(*reinterpret_cast(p_variant._data._mem))); } break; case VECTOR3: { memnew_placement(_data._mem, Vector3(*reinterpret_cast(p_variant._data._mem))); @@ -1121,32 +1164,44 @@ void Variant::reference(const Variant &p_variant) { case VECTOR3I: { memnew_placement(_data._mem, Vector3i(*reinterpret_cast(p_variant._data._mem))); } break; + case VECTOR4: { + memnew_placement(_data._mem, Vector4(*reinterpret_cast(p_variant._data._mem))); + } break; + case VECTOR4I: { + memnew_placement(_data._mem, Vector4i(*reinterpret_cast(p_variant._data._mem))); + } break; + case PLANE: { memnew_placement(_data._mem, Plane(*reinterpret_cast(p_variant._data._mem))); } break; - + case QUATERNION: { + memnew_placement(_data._mem, Quaternion(*reinterpret_cast(p_variant._data._mem))); + } break; case AABB: { _data._aabb = memnew(::AABB(*p_variant._data._aabb)); } break; - case QUATERNION: { - memnew_placement(_data._mem, Quaternion(*reinterpret_cast(p_variant._data._mem))); - - } break; case BASIS: { _data._basis = memnew(Basis(*p_variant._data._basis)); - } break; case TRANSFORM: { _data._transform = memnew(Transform(*p_variant._data._transform)); } break; + case TRANSFORM2D: { + _data._transform2d = memnew(Transform2D(*p_variant._data._transform2d)); + } break; + case PROJECTION: { + _data._projection = memnew(Projection(*p_variant._data._projection)); + } break; // misc types case COLOR: { memnew_placement(_data._mem, Color(*reinterpret_cast(p_variant._data._mem))); - } break; - case _RID: { - memnew_placement(_data._mem, RID(*reinterpret_cast(p_variant._data._mem))); + case NODE_PATH: { + memnew_placement(_data._mem, NodePath(*reinterpret_cast(p_variant._data._mem))); + } break; + case RID: { + memnew_placement(_data._mem, ::RID(*reinterpret_cast(p_variant._data._mem))); } break; case OBJECT: { memnew_placement(_data._mem, ObjData(p_variant._get_obj())); @@ -1156,57 +1211,47 @@ void Variant::reference(const Variant &p_variant) { } break; case STRING_NAME: { memnew_placement(_data._mem, StringName(*reinterpret_cast(p_variant._data._mem))); - - } break; - case NODE_PATH: { - memnew_placement(_data._mem, NodePath(*reinterpret_cast(p_variant._data._mem))); - } break; case DICTIONARY: { memnew_placement(_data._mem, Dictionary(*reinterpret_cast(p_variant._data._mem))); - } break; case ARRAY: { memnew_placement(_data._mem, Array(*reinterpret_cast(p_variant._data._mem))); - } break; // arrays case POOL_BYTE_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - } break; case POOL_INT_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - } break; case POOL_REAL_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - } break; case POOL_STRING_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - } break; case POOL_VECTOR2_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - } break; case POOL_VECTOR2I_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - } break; case POOL_VECTOR3_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - } break; case POOL_VECTOR3I_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - + } break; + case POOL_VECTOR4_ARRAY: { + memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); + } break; + case POOL_VECTOR4I_ARRAY: { + memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); } break; case POOL_COLOR_ARRAY: { memnew_placement(_data._mem, PoolVector(*reinterpret_cast *>(p_variant._data._mem))); - } break; default: { } @@ -1226,30 +1271,39 @@ void Variant::zero() { case REAL: this->_data._real = 0; break; - case VECTOR2: - *reinterpret_cast(this->_data._mem) = Vector2(); - break; - case VECTOR2I: - *reinterpret_cast(this->_data._mem) = Vector2i(); - break; case RECT2: *reinterpret_cast(this->_data._mem) = Rect2(); break; case RECT2I: *reinterpret_cast(this->_data._mem) = Rect2i(); break; + case VECTOR2: + *reinterpret_cast(this->_data._mem) = Vector2(); + break; + case VECTOR2I: + *reinterpret_cast(this->_data._mem) = Vector2i(); + break; case VECTOR3: *reinterpret_cast(this->_data._mem) = Vector3(); break; case VECTOR3I: *reinterpret_cast(this->_data._mem) = Vector3i(); break; + case VECTOR4: + *reinterpret_cast(this->_data._mem) = Vector4(); + break; + case VECTOR4I: + *reinterpret_cast(this->_data._mem) = Vector4i(); + break; case PLANE: *reinterpret_cast(this->_data._mem) = Plane(); break; case QUATERNION: *reinterpret_cast(this->_data._mem) = Quaternion(); break; + case AABB: + *reinterpret_cast<::AABB *>(this->_data._mem) = ::AABB(); + break; case COLOR: *reinterpret_cast(this->_data._mem) = Color(); break; @@ -1261,24 +1315,28 @@ void Variant::zero() { void Variant::clear() { switch (type) { + /* + // no point, they don't allocate memory + BOOL, + INT, + REAL, + */ case STRING: { reinterpret_cast(_data._mem)->~String(); } break; /* - // no point, they don't allocate memory - VECTOR3, - VECTOR3i, - PLANE, - QUATERNION, - COLOR, - VECTOR2, - VECTOR2I, RECT2, RECT2I - */ - case TRANSFORM2D: { - memdelete(_data._transform2d); - } break; + VECTOR2, + VECTOR2I, + VECTOR3, + VECTOR3i, + VECTOR4, + VECTOR4i, + + PLANE, + QUATERNION, + */ case AABB: { memdelete(_data._aabb); } break; @@ -1288,11 +1346,22 @@ void Variant::clear() { case TRANSFORM: { memdelete(_data._transform); } break; + case TRANSFORM2D: { + memdelete(_data._transform2d); + } break; + case PROJECTION: { + memdelete(_data._projection); + } break; + //COLOR // misc types case NODE_PATH: { reinterpret_cast(_data._mem)->~NodePath(); } break; + case RID: { + // not much need probably + reinterpret_cast<::RID *>(_data._mem)->~RID(); + } break; case OBJECT: { if (likely(_get_obj().rc)) { if (unlikely(_get_obj().rc->decrement())) { @@ -1305,16 +1374,13 @@ void Variant::clear() { case STRING_NAME: { reinterpret_cast(_data._mem)->~StringName(); } break; - case _RID: { - // not much need probably - reinterpret_cast(_data._mem)->~RID(); - } break; case DICTIONARY: { reinterpret_cast(_data._mem)->~Dictionary(); } break; case ARRAY: { reinterpret_cast(_data._mem)->~Array(); } break; + // arrays case POOL_BYTE_ARRAY: { reinterpret_cast *>(_data._mem)->~PoolVector(); @@ -1340,6 +1406,12 @@ void Variant::clear() { case POOL_VECTOR3I_ARRAY: { reinterpret_cast *>(_data._mem)->~PoolVector(); } break; + case POOL_VECTOR4_ARRAY: { + reinterpret_cast *>(_data._mem)->~PoolVector(); + } break; + case POOL_VECTOR4I_ARRAY: { + reinterpret_cast *>(_data._mem)->~PoolVector(); + } break; case POOL_COLOR_ARRAY: { reinterpret_cast *>(_data._mem)->~PoolVector(); } break; @@ -1641,29 +1713,29 @@ String Variant::stringify(List &stack) const { return rtos(_data._real); case STRING: return *reinterpret_cast(_data._mem); - case VECTOR2: - return "(" + operator Vector2() + ")"; - case VECTOR2I: - return "(" + operator Vector2i() + ")"; case RECT2: - return "(" + operator Rect2() + ")"; + return operator Rect2(); case RECT2I: - return "(" + operator Rect2i() + ")"; - case TRANSFORM2D: { - Transform2D mat32 = operator Transform2D(); - return "(" + Variant(mat32.columns[0]).operator String() + ", " + Variant(mat32.columns[1]).operator String() + ", " + Variant(mat32.columns[2]).operator String() + ")"; - } break; + return operator Rect2i(); + case VECTOR2: + return operator Vector2(); + case VECTOR2I: + return operator Vector2i(); case VECTOR3: - return "(" + operator Vector3() + ")"; + return operator Vector3(); case VECTOR3I: - return "(" + operator Vector3i() + ")"; + return operator Vector3i(); + case VECTOR4: + return operator Vector4(); + case VECTOR4I: + return operator Vector4i(); + case PLANE: return operator Plane(); - //case QUATERNION: + case QUATERNION: + return operator Quaternion(); case AABB: return operator ::AABB(); - case QUATERNION: - return "(" + operator Quaternion() + ")"; case BASIS: { Basis mat3 = operator Basis(); @@ -1690,10 +1762,31 @@ String Variant::stringify(List &stack) const { } break; case TRANSFORM: return operator Transform(); - case NODE_PATH: - return operator NodePath(); + case TRANSFORM2D: { + Transform2D mat32 = operator Transform2D(); + return "(" + Variant(mat32.columns[0]).operator String() + ", " + Variant(mat32.columns[1]).operator String() + ", " + Variant(mat32.columns[2]).operator String() + ")"; + } break; + case PROJECTION: + return operator Projection(); + case COLOR: return String::num(operator Color().r) + "," + String::num(operator Color().g) + "," + String::num(operator Color().b) + "," + String::num(operator Color().a); + case NODE_PATH: + return operator NodePath(); + //RID + case OBJECT: { + Object *obj = _OBJ_PTR(*this); + if (likely(obj)) { + return obj->to_string(); + } else { + if (_get_obj().rc) { + return "[Deleted Object]"; + } + return "[Object:null]"; + } + } break; + case STRING_NAME: + return operator StringName(); case DICTIONARY: { const Dictionary &d = *reinterpret_cast(_data._mem); if (stack.find(d.id())) { @@ -1730,6 +1823,30 @@ String Variant::stringify(List &stack) const { stack.erase(d.id()); return str; } break; + case ARRAY: { + Array arr = operator Array(); + if (stack.find(arr.id())) { + return "[...]"; + } + stack.push_back(arr.id()); + String str = stringify_vector(arr, stack); + stack.erase(arr.id()); + return str; + + } break; + + case POOL_BYTE_ARRAY: { + return stringify_vector(operator PoolVector(), stack); + } break; + case POOL_INT_ARRAY: { + return stringify_vector(operator PoolVector(), stack); + } break; + case POOL_REAL_ARRAY: { + return stringify_vector(operator PoolVector(), stack); + } break; + case POOL_STRING_ARRAY: { + return stringify_vector(operator PoolVector(), stack); + } break; case POOL_VECTOR2_ARRAY: { return stringify_vector(operator PoolVector(), stack); } break; @@ -1742,45 +1859,16 @@ String Variant::stringify(List &stack) const { case POOL_VECTOR3I_ARRAY: { return stringify_vector(operator PoolVector(), stack); } break; + case POOL_VECTOR4_ARRAY: { + return stringify_vector(operator PoolVector(), stack); + } break; + case POOL_VECTOR4I_ARRAY: { + return stringify_vector(operator PoolVector(), stack); + } break; case POOL_COLOR_ARRAY: { return stringify_vector(operator PoolVector(), stack); } break; - case POOL_STRING_ARRAY: { - return stringify_vector(operator PoolVector(), stack); - } break; - case POOL_BYTE_ARRAY: { - return stringify_vector(operator PoolVector(), stack); - } break; - case POOL_INT_ARRAY: { - return stringify_vector(operator PoolVector(), stack); - } break; - case POOL_REAL_ARRAY: { - return stringify_vector(operator PoolVector(), stack); - } break; - case ARRAY: { - Array arr = operator Array(); - if (stack.find(arr.id())) { - return "[...]"; - } - stack.push_back(arr.id()); - String str = stringify_vector(arr, stack); - stack.erase(arr.id()); - return str; - } break; - case OBJECT: { - Object *obj = _OBJ_PTR(*this); - if (likely(obj)) { - return obj->to_string(); - } else { - if (_get_obj().rc) { - return "[Deleted Object]"; - } - return "[Object:null]"; - } - } break; - case STRING_NAME: - return operator StringName(); default: { return "[" + get_type_name(type) + "]"; } @@ -1789,33 +1877,6 @@ String Variant::stringify(List &stack) const { return ""; } -Variant::operator Vector2() const { - if (type == VECTOR2) { - return *reinterpret_cast(_data._mem); - } else if (type == VECTOR2I) { - return Vector2(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); - } else if (type == VECTOR3) { - return Vector2(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); - } else if (type == VECTOR3I) { - return Vector2(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); - } else { - return Vector2(); - } -} -Variant::operator Vector2i() const { - if (type == VECTOR2I) { - return *reinterpret_cast(_data._mem); - } else if (type == VECTOR2) { - return Vector2i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); - } else if (type == VECTOR3) { - return Vector2i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); - } else if (type == VECTOR3I) { - return Vector2i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); - } else { - return Vector2i(); - } -} - Variant::operator Rect2() const { if (type == RECT2) { return *reinterpret_cast(_data._mem); @@ -1835,6 +1896,41 @@ Variant::operator Rect2i() const { } } +Variant::operator Vector2() const { + if (type == VECTOR2) { + return *reinterpret_cast(_data._mem); + } else if (type == VECTOR2I) { + return Vector2(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else if (type == VECTOR3) { + return Vector2(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else if (type == VECTOR3I) { + return Vector2(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else if (type == VECTOR4) { + return Vector2(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else if (type == VECTOR4I) { + return Vector2(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else { + return Vector2(); + } +} +Variant::operator Vector2i() const { + if (type == VECTOR2I) { + return *reinterpret_cast(_data._mem); + } else if (type == VECTOR2) { + return Vector2i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else if (type == VECTOR3) { + return Vector2i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else if (type == VECTOR3I) { + return Vector2i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else if (type == VECTOR4) { + return Vector2i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else if (type == VECTOR4I) { + return Vector2i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y); + } else { + return Vector2i(); + } +} + Variant::operator Vector3() const { if (type == VECTOR3) { return *reinterpret_cast(_data._mem); @@ -1844,6 +1940,10 @@ Variant::operator Vector3() const { return Vector3(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, 0.0); } else if (type == VECTOR2I) { return Vector3(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, 0.0); + } else if (type == VECTOR4) { + return Vector3(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, reinterpret_cast(_data._mem)->z); + } else if (type == VECTOR4I) { + return Vector3(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, reinterpret_cast(_data._mem)->z); } else { return Vector3(); } @@ -1857,10 +1957,52 @@ Variant::operator Vector3i() const { return Vector3i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, 0.0); } else if (type == VECTOR2I) { return Vector3i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, 0.0); + } else if (type == VECTOR4) { + return Vector3i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, reinterpret_cast(_data._mem)->z); + } else if (type == VECTOR4I) { + return Vector3i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, reinterpret_cast(_data._mem)->z); } else { return Vector3i(); } } + +Variant::operator Vector4() const { + if (type == VECTOR4) { + return *reinterpret_cast(_data._mem); + } else if (type == VECTOR4I) { + return *reinterpret_cast(_data._mem); + } else if (type == VECTOR2) { + return Vector4(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, 0.0, 0.0); + } else if (type == VECTOR2I) { + return Vector4(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, 0.0, 0.0); + } else if (type == VECTOR3) { + return Vector4(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, reinterpret_cast(_data._mem)->z, 0.0); + } else if (type == VECTOR3I) { + return Vector4(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, reinterpret_cast(_data._mem)->z, 0.0); + } else { + return Vector4(); + } +} + +Variant::operator Vector4i() const { + if (type == VECTOR4I) { + return *reinterpret_cast(_data._mem); + } else if (type == VECTOR4) { + const Vector4 &v4 = *reinterpret_cast(_data._mem); + return Vector4i(v4.x, v4.y, v4.z, v4.w); + } else if (type == VECTOR2) { + return Vector4i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, 0.0, 0.0); + } else if (type == VECTOR2I) { + return Vector4i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, 0.0, 0.0); + } else if (type == VECTOR3) { + return Vector4i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, reinterpret_cast(_data._mem)->z, 0.0); + } else if (type == VECTOR3I) { + return Vector4i(reinterpret_cast(_data._mem)->x, reinterpret_cast(_data._mem)->y, reinterpret_cast(_data._mem)->z, 0.0); + } else { + return Vector4i(); + } +} + Variant::operator Plane() const { if (type == PLANE) { return *reinterpret_cast(_data._mem); @@ -1902,6 +2044,24 @@ Variant::operator Quaternion() const { } } +Variant::operator Transform2D() const { + if (type == TRANSFORM2D) { + return *_data._transform2d; + } else if (type == TRANSFORM) { + const Transform &t = *_data._transform; + Transform2D m; + m.columns[0][0] = t.basis.rows[0][0]; + m.columns[0][1] = t.basis.rows[1][0]; + m.columns[1][0] = t.basis.rows[0][1]; + m.columns[1][1] = t.basis.rows[1][1]; + m.columns[2][0] = t.origin[0]; + m.columns[2][1] = t.origin[1]; + return m; + } else { + return Transform2D(); + } +} + Variant::operator Transform() const { if (type == TRANSFORM) { return *_data._transform; @@ -1919,26 +2079,34 @@ Variant::operator Transform() const { m.origin[0] = t.columns[2][0]; m.origin[1] = t.columns[2][1]; return m; + } else if (type == PROJECTION) { + return *_data._projection; } else { return Transform(); } } -Variant::operator Transform2D() const { - if (type == TRANSFORM2D) { - return *_data._transform2d; - } else if (type == TRANSFORM) { - const Transform &t = *_data._transform; - Transform2D m; - m.columns[0][0] = t.basis.rows[0][0]; - m.columns[0][1] = t.basis.rows[1][0]; - m.columns[1][0] = t.basis.rows[0][1]; - m.columns[1][1] = t.basis.rows[1][1]; - m.columns[2][0] = t.origin[0]; - m.columns[2][1] = t.origin[1]; +Variant::operator Projection() const { + if (type == TRANSFORM) { + return *_data._transform; + } else if (type == BASIS) { + return Transform(*_data._basis, Vector3()); + } else if (type == QUATERNION) { + return Transform(Basis(*reinterpret_cast(_data._mem)), Vector3()); + } else if (type == TRANSFORM2D) { + const Transform2D &t = *_data._transform2d; + Transform m; + m.basis.rows[0][0] = t.columns[0][0]; + m.basis.rows[1][0] = t.columns[0][1]; + m.basis.rows[0][1] = t.columns[1][0]; + m.basis.rows[1][1] = t.columns[1][1]; + m.origin[0] = t.columns[2][0]; + m.origin[1] = t.columns[2][1]; return m; + } else if (type == PROJECTION) { + return *_data._projection; } else { - return Transform2D(); + return Projection(); } } @@ -1972,9 +2140,9 @@ Variant::operator RefPtr() const { } } -Variant::operator RID() const { - if (type == _RID) { - return *reinterpret_cast(_data._mem); +Variant::operator ::RID() const { + if (type == RID) { + return *reinterpret_cast(_data._mem); } else if (type == OBJECT) { if (!_get_obj().ref.is_null()) { return _get_obj().ref.get_rid(); @@ -1984,18 +2152,18 @@ Variant::operator RID() const { if (_get_obj().rc) { ERR_PRINT("Attempted get RID on a deleted object."); } - return RID(); + return ::RID(); } Variant::CallError ce; Variant ret = obj->call(CoreStringNames::get_singleton()->get_rid, nullptr, 0, ce); - if (ce.error == Variant::CallError::CALL_OK && ret.get_type() == Variant::_RID) { + if (ce.error == Variant::CallError::CALL_OK && ret.get_type() == Variant::RID) { return ret; } else { - return RID(); + return ::RID(); } } } else { - return RID(); + return ::RID(); } } @@ -2071,6 +2239,12 @@ inline DA _convert_array_from_variant(const Variant &p_variant) { case Variant::POOL_VECTOR3I_ARRAY: { return _convert_array>(p_variant.operator PoolVector()); } + case Variant::POOL_VECTOR4_ARRAY: { + return _convert_array>(p_variant.operator PoolVector()); + } + case Variant::POOL_VECTOR4I_ARRAY: { + return _convert_array>(p_variant.operator PoolVector()); + } case Variant::POOL_COLOR_ARRAY: { return _convert_array>(p_variant.operator PoolVector()); } @@ -2117,20 +2291,6 @@ Variant::operator PoolVector() const { return _convert_array_from_variant>(*this); } } -Variant::operator PoolVector() const { - if (type == POOL_VECTOR3_ARRAY) { - return *reinterpret_cast *>(_data._mem); - } else { - return _convert_array_from_variant>(*this); - } -} -Variant::operator PoolVector() const { - if (type == POOL_VECTOR3I_ARRAY) { - return *reinterpret_cast *>(_data._mem); - } else { - return _convert_array_from_variant>(*this); - } -} Variant::operator PoolVector() const { if (type == POOL_VECTOR2_ARRAY) { return *reinterpret_cast *>(_data._mem); @@ -2145,6 +2305,34 @@ Variant::operator PoolVector() const { return _convert_array_from_variant>(*this); } } +Variant::operator PoolVector() const { + if (type == POOL_VECTOR3_ARRAY) { + return *reinterpret_cast *>(_data._mem); + } else { + return _convert_array_from_variant>(*this); + } +} +Variant::operator PoolVector() const { + if (type == POOL_VECTOR3I_ARRAY) { + return *reinterpret_cast *>(_data._mem); + } else { + return _convert_array_from_variant>(*this); + } +} +Variant::operator PoolVector() const { + if (type == POOL_VECTOR4_ARRAY) { + return *reinterpret_cast *>(_data._mem); + } else { + return _convert_array_from_variant>(*this); + } +} +Variant::operator PoolVector() const { + if (type == POOL_VECTOR4I_ARRAY) { + return *reinterpret_cast *>(_data._mem); + } else { + return _convert_array_from_variant>(*this); + } +} Variant::operator PoolVector() const { if (type == POOL_COLOR_ARRAY) { return *reinterpret_cast *>(_data._mem); @@ -2155,9 +2343,9 @@ Variant::operator PoolVector() const { /* helpers */ -Variant::operator Vector() const { +Variant::operator Vector<::RID>() const { Array va = operator Array(); - Vector rids; + Vector<::RID> rids; rids.resize(va.size()); for (int i = 0; i < rids.size(); i++) { rids.write[i] = va[i]; @@ -2343,6 +2531,38 @@ Variant::operator Vector() const { } return to; } + +Variant::operator Vector() const { + PoolVector from = operator PoolVector(); + Vector to; + int len = from.size(); + if (len == 0) { + return Vector(); + } + to.resize(len); + PoolVector::Read r = from.read(); + Vector4 *w = to.ptrw(); + for (int i = 0; i < len; i++) { + w[i] = r[i]; + } + return to; +} +Variant::operator Vector() const { + PoolVector from = operator PoolVector(); + Vector to; + int len = from.size(); + if (len == 0) { + return Vector(); + } + to.resize(len); + PoolVector::Read r = from.read(); + Vector4i *w = to.ptrw(); + for (int i = 0; i < len; i++) { + w[i] = r[i]; + } + return to; +} + Variant::operator Vector() const { PoolVector from = operator PoolVector(); Vector to; @@ -2467,14 +2687,16 @@ Variant::Variant(const CharType *p_wstring) { type = STRING; memnew_placement(_data._mem, String(p_wstring)); } -Variant::Variant(const Vector3 &p_vector3) { - type = VECTOR3; - memnew_placement(_data._mem, Vector3(p_vector3)); + +Variant::Variant(const Rect2 &p_rect2) { + type = RECT2; + memnew_placement(_data._mem, Rect2(p_rect2)); } -Variant::Variant(const Vector3i &p_vector3) { - type = VECTOR3I; - memnew_placement(_data._mem, Vector3i(p_vector3)); +Variant::Variant(const Rect2i &p_rect2) { + type = RECT2I; + memnew_placement(_data._mem, Rect2i(p_rect2)); } + Variant::Variant(const Vector2 &p_vector2) { type = VECTOR2; memnew_placement(_data._mem, Vector2(p_vector2)); @@ -2483,13 +2705,23 @@ Variant::Variant(const Vector2i &p_vector2) { type = VECTOR2I; memnew_placement(_data._mem, Vector2i(p_vector2)); } -Variant::Variant(const Rect2 &p_rect2) { - type = RECT2; - memnew_placement(_data._mem, Rect2(p_rect2)); + +Variant::Variant(const Vector3 &p_vector3) { + type = VECTOR3; + memnew_placement(_data._mem, Vector3(p_vector3)); } -Variant::Variant(const Rect2i &p_rect2) { - type = RECT2I; - memnew_placement(_data._mem, Rect2i(p_rect2)); +Variant::Variant(const Vector3i &p_vector3) { + type = VECTOR3I; + memnew_placement(_data._mem, Vector3i(p_vector3)); +} + +Variant::Variant(const Vector4 &p_vector4) { + type = VECTOR4; + memnew_placement(_data._mem, Vector4(p_vector4)); +} +Variant::Variant(const Vector4i &p_vector4) { + type = VECTOR4I; + memnew_placement(_data._mem, Vector4i(p_vector4)); } Variant::Variant(const Plane &p_plane) { @@ -2519,6 +2751,12 @@ Variant::Variant(const Transform2D &p_transform) { type = TRANSFORM2D; _data._transform2d = memnew(Transform2D(p_transform)); } + +Variant::Variant(const Projection &p_projection) { + type = PROJECTION; + _data._projection = memnew(Projection(p_projection)); +} + Variant::Variant(const Color &p_color) { type = COLOR; memnew_placement(_data._mem, Color(p_color)); @@ -2536,9 +2774,9 @@ Variant::Variant(const RefPtr &p_resource) { _get_obj().ref = p_resource; } -Variant::Variant(const RID &p_rid) { - type = _RID; - memnew_placement(_data._mem, RID(p_rid)); +Variant::Variant(const ::RID &p_rid) { + type = RID; + memnew_placement(_data._mem, ::RID(p_rid)); } Variant::Variant(const Object *p_object) { @@ -2589,7 +2827,7 @@ Variant::Variant(const Vector &p_array) { } } -Variant::Variant(const Vector &p_array) { +Variant::Variant(const Vector<::RID> &p_array) { type = ARRAY; Array *rid_array = memnew_placement(_data._mem, Array); @@ -2634,6 +2872,15 @@ Variant::Variant(const PoolVector &p_vector3_array) { memnew_placement(_data._mem, PoolVector(p_vector3_array)); } +Variant::Variant(const PoolVector &p_vector4_array) { + type = POOL_VECTOR4_ARRAY; + memnew_placement(_data._mem, PoolVector(p_vector4_array)); +} +Variant::Variant(const PoolVector &p_vector4_array) { + type = POOL_VECTOR4I_ARRAY; + memnew_placement(_data._mem, PoolVector(p_vector4_array)); +} + Variant::Variant(const PoolVector &p_color_array) { type = POOL_COLOR_ARRAY; memnew_placement(_data._mem, PoolVector(p_color_array)); @@ -2790,6 +3037,37 @@ Variant::Variant(const Vector &p_array) { *this = v; } +Variant::Variant(const Vector &p_array) { + type = NIL; + PoolVector v; + int len = p_array.size(); + if (len > 0) { + v.resize(len); + PoolVector::Write w = v.write(); + const Vector4 *r = p_array.ptr(); + + for (int i = 0; i < len; i++) { + w[i] = r[i]; + } + } + *this = v; +} +Variant::Variant(const Vector &p_array) { + type = NIL; + PoolVector v; + int len = p_array.size(); + if (len > 0) { + v.resize(len); + PoolVector::Write w = v.write(); + const Vector4i *r = p_array.ptr(); + + for (int i = 0; i < len; i++) { + w[i] = r[i]; + } + } + *this = v; +} + Variant::Variant(const Vector &p_array) { type = NIL; PoolVector v; @@ -2830,21 +3108,18 @@ void Variant::operator=(const Variant &p_variant) { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; - // math types - case VECTOR2: { - *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); - } break; - case VECTOR2I: { - *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); - } break; + // math types case RECT2: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; case RECT2I: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; - case TRANSFORM2D: { - *_data._transform2d = *(p_variant._data._transform2d); + case VECTOR2: { + *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); + } break; + case VECTOR2I: { + *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; case VECTOR3: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); @@ -2852,29 +3127,44 @@ void Variant::operator=(const Variant &p_variant) { case VECTOR3I: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; + case VECTOR4: { + *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); + } break; + case VECTOR4I: { + *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); + } break; + case PLANE: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; - - case AABB: { - *_data._aabb = *(p_variant._data._aabb); - } break; case QUATERNION: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; + case AABB: { + *_data._aabb = *(p_variant._data._aabb); + } break; case BASIS: { *_data._basis = *(p_variant._data._basis); } break; case TRANSFORM: { *_data._transform = *(p_variant._data._transform); } break; + case TRANSFORM2D: { + *_data._transform2d = *(p_variant._data._transform2d); + } break; + case PROJECTION: { + *_data._projection = *(p_variant._data._projection); + } break; // misc types case COLOR: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; - case _RID: { - *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); + case NODE_PATH: { + *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); + } break; + case RID: { + *reinterpret_cast<::RID *>(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; case OBJECT: { if (likely(_get_obj().rc)) { @@ -2890,9 +3180,6 @@ void Variant::operator=(const Variant &p_variant) { case STRING_NAME: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; - case NODE_PATH: { - *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); - } break; case DICTIONARY: { *reinterpret_cast(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; @@ -2925,6 +3212,12 @@ void Variant::operator=(const Variant &p_variant) { case POOL_VECTOR3I_ARRAY: { *reinterpret_cast *>(_data._mem) = *reinterpret_cast *>(p_variant._data._mem); } break; + case POOL_VECTOR4_ARRAY: { + *reinterpret_cast *>(_data._mem) = *reinterpret_cast *>(p_variant._data._mem); + } break; + case POOL_VECTOR4I_ARRAY: { + *reinterpret_cast *>(_data._mem) = *reinterpret_cast *>(p_variant._data._mem); + } break; case POOL_COLOR_ARRAY: { *reinterpret_cast *>(_data._mem) = *reinterpret_cast *>(p_variant._data._mem); } break; @@ -2954,6 +3247,7 @@ uint32_t Variant::hash() const { case NIL: { return 0; } break; + case BOOL: { return _data._bool ? 1 : 0; } break; @@ -2967,15 +3261,7 @@ uint32_t Variant::hash() const { return reinterpret_cast(_data._mem)->hash(); } break; - // math types - case VECTOR2: { - uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->x); - return hash_djb2_one_float(reinterpret_cast(_data._mem)->y, hash); - } break; - case VECTOR2I: { - uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->x); - return hash_djb2_one_float(reinterpret_cast(_data._mem)->y, hash); - } break; + // math types case RECT2: { uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->position.x); hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->position.y, hash); @@ -2988,15 +3274,13 @@ uint32_t Variant::hash() const { hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->size.x, hash); return hash_djb2_one_float(reinterpret_cast(_data._mem)->size.y, hash); } break; - case TRANSFORM2D: { - uint32_t hash = 5831; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - hash = hash_djb2_one_float(_data._transform2d->columns[i][j], hash); - } - } - - return hash; + case VECTOR2: { + uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->x); + return hash_djb2_one_float(reinterpret_cast(_data._mem)->y, hash); + } break; + case VECTOR2I: { + uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->x); + return hash_djb2_one_float(reinterpret_cast(_data._mem)->y, hash); } break; case VECTOR3: { uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->x); @@ -3008,27 +3292,19 @@ uint32_t Variant::hash() const { hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->y, hash); return hash_djb2_one_float(reinterpret_cast(_data._mem)->z, hash); } break; + case VECTOR4: { + return HashMapHasherDefault::hash(*reinterpret_cast(_data._mem)); + } break; + case VECTOR4I: { + return HashMapHasherDefault::hash(*reinterpret_cast(_data._mem)); + } break; + case PLANE: { uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->normal.x); hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->normal.y, hash); hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->normal.z, hash); return hash_djb2_one_float(reinterpret_cast(_data._mem)->d, hash); - } break; - /* - case QUATERNION: { - - - } break;*/ - case AABB: { - uint32_t hash = 5831; - for (int i = 0; i < 3; i++) { - hash = hash_djb2_one_float(_data._aabb->position[i], hash); - hash = hash_djb2_one_float(_data._aabb->size[i], hash); - } - - return hash; - } break; case QUATERNION: { uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->x); @@ -3037,6 +3313,15 @@ uint32_t Variant::hash() const { return hash_djb2_one_float(reinterpret_cast(_data._mem)->w, hash); } break; + case AABB: { + uint32_t hash = 5831; + for (int i = 0; i < 3; i++) { + hash = hash_djb2_one_float(_data._aabb->position[i], hash); + hash = hash_djb2_one_float(_data._aabb->size[i], hash); + } + + return hash; + } break; case BASIS: { uint32_t hash = 5831; for (int i = 0; i < 3; i++) { @@ -3046,7 +3331,6 @@ uint32_t Variant::hash() const { } return hash; - } break; case TRANSFORM: { uint32_t hash = 5831; @@ -3058,37 +3342,66 @@ uint32_t Variant::hash() const { } return hash; + } break; + case TRANSFORM2D: { + uint32_t hash = 5831; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 2; j++) { + hash = hash_djb2_one_float(_data._transform2d->columns[i][j], hash); + } + } + return hash; } break; - case STRING_NAME: { - return reinterpret_cast(_data._mem)->hash(); + case PROJECTION: { + uint32_t h = HASH_MURMUR3_SEED; + const Projection &t = *_data._projection; + h = hash_murmur3_one_real(t.matrix[0].x, h); + h = hash_murmur3_one_real(t.matrix[0].y, h); + h = hash_murmur3_one_real(t.matrix[0].z, h); + h = hash_murmur3_one_real(t.matrix[0].w, h); + h = hash_murmur3_one_real(t.matrix[1].x, h); + h = hash_murmur3_one_real(t.matrix[1].y, h); + h = hash_murmur3_one_real(t.matrix[1].z, h); + h = hash_murmur3_one_real(t.matrix[1].w, h); + h = hash_murmur3_one_real(t.matrix[2].x, h); + h = hash_murmur3_one_real(t.matrix[2].y, h); + h = hash_murmur3_one_real(t.matrix[2].z, h); + h = hash_murmur3_one_real(t.matrix[2].w, h); + h = hash_murmur3_one_real(t.matrix[3].x, h); + h = hash_murmur3_one_real(t.matrix[3].y, h); + h = hash_murmur3_one_real(t.matrix[3].z, h); + h = hash_murmur3_one_real(t.matrix[3].w, h); + return hash_fmix32(h); } break; + // misc types case COLOR: { uint32_t hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->r); hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->g, hash); hash = hash_djb2_one_float(reinterpret_cast(_data._mem)->b, hash); return hash_djb2_one_float(reinterpret_cast(_data._mem)->a, hash); - - } break; - case _RID: { - return hash_djb2_one_64(reinterpret_cast(_data._mem)->get_id()); - } break; - case OBJECT: { - return hash_djb2_one_64(make_uint64_t(_UNSAFE_OBJ_PROXY_PTR(*this))); } break; case NODE_PATH: { return reinterpret_cast(_data._mem)->hash(); } break; + case RID: { + return hash_djb2_one_64(reinterpret_cast(_data._mem)->get_id()); + } break; + case OBJECT: { + return hash_djb2_one_64(make_uint64_t(_UNSAFE_OBJ_PROXY_PTR(*this))); + } break; + case STRING_NAME: { + return reinterpret_cast(_data._mem)->hash(); + } break; case DICTIONARY: { return reinterpret_cast(_data._mem)->hash(); - } break; case ARRAY: { const Array &arr = *reinterpret_cast(_data._mem); return arr.hash(); - } break; + case POOL_BYTE_ARRAY: { const PoolVector &arr = *reinterpret_cast *>(_data._mem); int len = arr.size(); @@ -3204,6 +3517,42 @@ uint32_t Variant::hash() const { return hash; } break; + case POOL_VECTOR4_ARRAY: { + uint32_t hash = 5831; + const PoolVector &arr = *reinterpret_cast *>(_data._mem); + int len = arr.size(); + + if (likely(len)) { + PoolVector::Read r = arr.read(); + + for (int i = 0; i < len; i++) { + hash = hash_djb2_one_float(r[i].x, hash); + hash = hash_djb2_one_float(r[i].y, hash); + hash = hash_djb2_one_float(r[i].z, hash); + hash = hash_djb2_one_float(r[i].w, hash); + } + } + + return hash; + } break; + case POOL_VECTOR4I_ARRAY: { + uint32_t hash = 5831; + const PoolVector &arr = *reinterpret_cast *>(_data._mem); + int len = arr.size(); + + if (likely(len)) { + PoolVector::Read r = arr.read(); + + for (int i = 0; i < len; i++) { + hash = hash_djb2_one_float(r[i].x, hash); + hash = hash_djb2_one_float(r[i].y, hash); + hash = hash_djb2_one_float(r[i].z, hash); + hash = hash_djb2_one_float(r[i].w, hash); + } + } + + return hash; + } break; case POOL_COLOR_ARRAY: { uint32_t hash = 5831; const PoolVector &arr = *reinterpret_cast *>(_data._mem); @@ -3250,6 +3599,18 @@ uint32_t Variant::hash() const { (((p_lhs).y == (p_rhs).y)) && \ (((p_lhs).z == (p_rhs).z)) +#define hash_compare_vector4(p_lhs, p_rhs) \ + (hash_compare_scalar((p_lhs).x, (p_rhs).x)) && \ + (hash_compare_scalar((p_lhs).y, (p_rhs).y)) && \ + (hash_compare_scalar((p_lhs).z, (p_rhs).z)) && \ + (hash_compare_scalar((p_lhs).w, (p_rhs).w)) + +#define hash_compare_vector4i(p_lhs, p_rhs) \ + (((p_lhs).x == (p_rhs).x)) && \ + (((p_lhs).y == (p_rhs).y)) && \ + (((p_lhs).z == (p_rhs).z)) && \ + (((p_lhs).w == (p_rhs).w)) + #define hash_compare_quat(p_lhs, p_rhs) \ (hash_compare_scalar((p_lhs).x, (p_rhs).x)) && \ (hash_compare_scalar((p_lhs).y, (p_rhs).y)) && \ @@ -3285,32 +3646,17 @@ bool Variant::hash_compare(const Variant &p_variant) const { } switch (type) { + //BOOL case INT: { return _data._int == p_variant._data._int; } break; - case REAL: { return hash_compare_scalar(_data._real, p_variant._data._real); } break; - case STRING: { return *reinterpret_cast(_data._mem) == *reinterpret_cast(p_variant._data._mem); } break; - case VECTOR2: { - const Vector2 *l = reinterpret_cast(_data._mem); - const Vector2 *r = reinterpret_cast(p_variant._data._mem); - - return hash_compare_vector2(*l, *r); - } break; - - case VECTOR2I: { - const Vector2i *l = reinterpret_cast(_data._mem); - const Vector2i *r = reinterpret_cast(p_variant._data._mem); - - return hash_compare_vector2i(*l, *r); - } break; - case RECT2: { const Rect2 *l = reinterpret_cast(_data._mem); const Rect2 *r = reinterpret_cast(p_variant._data._mem); @@ -3318,7 +3664,6 @@ bool Variant::hash_compare(const Variant &p_variant) const { return (hash_compare_vector2(l->position, r->position)) && (hash_compare_vector2(l->size, r->size)); } break; - case RECT2I: { const Rect2i *l = reinterpret_cast(_data._mem); const Rect2i *r = reinterpret_cast(p_variant._data._mem); @@ -3326,33 +3671,42 @@ bool Variant::hash_compare(const Variant &p_variant) const { return (hash_compare_vector2i(l->position, r->position)) && (hash_compare_vector2i(l->size, r->size)); } break; + case VECTOR2: { + const Vector2 *l = reinterpret_cast(_data._mem); + const Vector2 *r = reinterpret_cast(p_variant._data._mem); - case TRANSFORM2D: { - Transform2D *l = _data._transform2d; - Transform2D *r = p_variant._data._transform2d; - - for (int i = 0; i < 3; i++) { - if (!(hash_compare_vector2(l->columns[i], r->columns[i]))) { - return false; - } - } - - return true; + return hash_compare_vector2(*l, *r); } break; + case VECTOR2I: { + const Vector2i *l = reinterpret_cast(_data._mem); + const Vector2i *r = reinterpret_cast(p_variant._data._mem); + return hash_compare_vector2i(*l, *r); + } break; case VECTOR3: { const Vector3 *l = reinterpret_cast(_data._mem); const Vector3 *r = reinterpret_cast(p_variant._data._mem); return hash_compare_vector3(*l, *r); } break; - case VECTOR3I: { const Vector3i *l = reinterpret_cast(_data._mem); const Vector3i *r = reinterpret_cast(p_variant._data._mem); return hash_compare_vector3i(*l, *r); } break; + case VECTOR4: { + const Vector4 *l = reinterpret_cast(_data._mem); + const Vector4 *r = reinterpret_cast(p_variant._data._mem); + + return hash_compare_vector4(*l, *r); + } break; + case VECTOR4I: { + const Vector4i *l = reinterpret_cast(_data._mem); + const Vector4i *r = reinterpret_cast(p_variant._data._mem); + + return hash_compare_vector4i(*l, *r); + } break; case PLANE: { const Plane *l = reinterpret_cast(_data._mem); @@ -3361,7 +3715,12 @@ bool Variant::hash_compare(const Variant &p_variant) const { return (hash_compare_vector3(l->normal, r->normal)) && (hash_compare_scalar(l->d, r->d)); } break; + case QUATERNION: { + const Quaternion *l = reinterpret_cast(_data._mem); + const Quaternion *r = reinterpret_cast(p_variant._data._mem); + return hash_compare_quat(*l, *r); + } break; case AABB: { const ::AABB *l = _data._aabb; const ::AABB *r = p_variant._data._aabb; @@ -3370,14 +3729,6 @@ bool Variant::hash_compare(const Variant &p_variant) const { (hash_compare_vector3(l->size, r->size))); } break; - - case QUATERNION: { - const Quaternion *l = reinterpret_cast(_data._mem); - const Quaternion *r = reinterpret_cast(p_variant._data._mem); - - return hash_compare_quat(*l, *r); - } break; - case BASIS: { const Basis *l = _data._basis; const Basis *r = p_variant._data._basis; @@ -3390,7 +3741,6 @@ bool Variant::hash_compare(const Variant &p_variant) const { return true; } break; - case TRANSFORM: { const Transform *l = _data._transform; const Transform *r = p_variant._data._transform; @@ -3403,6 +3753,30 @@ bool Variant::hash_compare(const Variant &p_variant) const { return hash_compare_vector3(l->origin, r->origin); } break; + case TRANSFORM2D: { + Transform2D *l = _data._transform2d; + Transform2D *r = p_variant._data._transform2d; + + for (int i = 0; i < 3; i++) { + if (!(hash_compare_vector2(l->columns[i], r->columns[i]))) { + return false; + } + } + + return true; + } break; + case PROJECTION: { + const Projection *l = _data._projection; + const Projection *r = p_variant._data._projection; + + for (int i = 0; i < 4; i++) { + if (!(hash_compare_vector4(l->matrix[i], r->matrix[i]))) { + return false; + } + } + + return true; + } break; case COLOR: { const Color *l = reinterpret_cast(_data._mem); @@ -3410,7 +3784,6 @@ bool Variant::hash_compare(const Variant &p_variant) const { return hash_compare_color(*l, *r); } break; - case ARRAY: { const Array &l = *(reinterpret_cast(_data._mem)); const Array &r = *(reinterpret_cast(p_variant._data._mem)); @@ -3431,23 +3804,24 @@ bool Variant::hash_compare(const Variant &p_variant) const { case POOL_REAL_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, real_t, hash_compare_scalar); } break; - case POOL_VECTOR2_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, Vector2, hash_compare_vector2); } break; - case POOL_VECTOR2I_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, Vector2i, hash_compare_vector2i); } break; - case POOL_VECTOR3_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, Vector3, hash_compare_vector3); } break; - case POOL_VECTOR3I_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, Vector3i, hash_compare_vector3i); } break; - + case POOL_VECTOR4_ARRAY: { + hash_compare_pool_array(_data._mem, p_variant._data._mem, Vector4, hash_compare_vector4); + } break; + case POOL_VECTOR4I_ARRAY: { + hash_compare_pool_array(_data._mem, p_variant._data._mem, Vector4i, hash_compare_vector4i); + } break; case POOL_COLOR_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, Color, hash_compare_color); } break; diff --git a/core/variant.h b/core/variant.h index 131503bda..173bfc5cb 100644 --- a/core/variant.h +++ b/core/variant.h @@ -38,11 +38,14 @@ #include "core/math/basis.h" #include "core/math/face3.h" #include "core/math/plane.h" +#include "core/math/projection.h" #include "core/math/quaternion.h" #include "core/math/transform.h" #include "core/math/transform_2d.h" #include "core/math/vector3.h" #include "core/math/vector3i.h" +#include "core/math/vector4.h" +#include "core/math/vector4i.h" #include "core/node_path.h" #include "core/object_id.h" #include "core/pool_vector.h" @@ -66,6 +69,8 @@ typedef PoolVector PoolVector2Array; typedef PoolVector PoolVector2iArray; typedef PoolVector PoolVector3Array; typedef PoolVector PoolVector3iArray; +typedef PoolVector PoolVector4Array; +typedef PoolVector PoolVector4iArray; typedef PoolVector PoolColorArray; // Temporary workaround until c++11 alignas() @@ -96,41 +101,46 @@ public: STRING, // math types - - VECTOR2, // 5 - VECTOR2I, - RECT2, + RECT2, // 5 RECT2I, + VECTOR2, + VECTOR2I, VECTOR3, - VECTOR3I, //10 - TRANSFORM2D, + VECTOR3I, // 10 + VECTOR4, + VECTOR4I, + PLANE, QUATERNION, - AABB, - BASIS, //15 + AABB, // 15 + BASIS, TRANSFORM, + TRANSFORM2D, + PROJECTION, // misc types - COLOR, - NODE_PATH, - _RID, - OBJECT, //20 + COLOR, // 20 + NODE_PATH, + RID, + OBJECT, STRING_NAME, - DICTIONARY, + DICTIONARY, // 25 ARRAY, // arrays - POOL_BYTE_ARRAY, - POOL_INT_ARRAY, //25 - POOL_REAL_ARRAY, - POOL_STRING_ARRAY, + POOL_BYTE_ARRAY, + POOL_INT_ARRAY, + POOL_REAL_ARRAY, + POOL_STRING_ARRAY, //30 POOL_VECTOR2_ARRAY, POOL_VECTOR2I_ARRAY, - POOL_VECTOR3_ARRAY, //30 - POOL_VECTOR3I_ARRAY, + POOL_VECTOR3_ARRAY, + POOL_VECTOR3I_ARRAY, + POOL_VECTOR4_ARRAY, //35 + POOL_VECTOR4I_ARRAY, POOL_COLOR_ARRAY, - VARIANT_MAX // 33 + VARIANT_MAX // 38 }; @@ -166,6 +176,7 @@ private: ::AABB *_aabb; Basis *_basis; Transform *_transform; + Projection *_projection; void *_ptr; //generic pointer uint8_t _mem[sizeof(ObjData) > (sizeof(real_t) * 4) ? sizeof(ObjData) : (sizeof(real_t) * 4)]; } _data GCC_ALIGNED_8; @@ -210,23 +221,26 @@ public: operator double() const; operator String() const; operator StringName() const; - operator Vector2() const; - operator Vector2i() const; operator Rect2() const; operator Rect2i() const; + operator Vector2() const; + operator Vector2i() const; operator Vector3() const; operator Vector3i() const; + operator Vector4() const; + operator Vector4i() const; operator Plane() const; operator ::AABB() const; operator Quaternion() const; operator Basis() const; operator Transform() const; operator Transform2D() const; + operator Projection() const; operator Color() const; operator NodePath() const; operator RefPtr() const; - operator RID() const; + operator ::RID() const; operator Object *() const; operator Node *() const; @@ -243,6 +257,8 @@ public: operator PoolVector() const; operator PoolVector() const; operator PoolVector() const; + operator PoolVector() const; + operator PoolVector() const; operator PoolVector() const; operator PoolVector() const; operator PoolVector() const; @@ -255,11 +271,13 @@ public: operator Vector() const; operator Vector() const; operator Vector() const; + operator Vector() const; + operator Vector() const; operator Vector() const; - operator Vector() const; + operator Vector<::RID>() const; operator Vector() const; operator Vector() const; - + operator Vector() const; // some core type enums to convert to @@ -295,6 +313,9 @@ public: Variant(const Rect2i &p_rect2); Variant(const Vector3 &p_vector3); Variant(const Vector3i &p_vector3); + Variant(const Vector4 &p_vector4); + Variant(const Vector4i &p_vector4); + Variant(const Projection &p_projection); Variant(const Plane &p_plane); Variant(const ::AABB &p_aabb); Variant(const Quaternion &p_quat); @@ -304,12 +325,12 @@ public: Variant(const Color &p_color); Variant(const NodePath &p_node_path); Variant(const RefPtr &p_resource); - Variant(const RID &p_rid); + Variant(const ::RID &p_rid); Variant(const Object *p_object); Variant(const Dictionary &p_dictionary); Variant(const Array &p_array); - Variant(const PoolVector &p_array); // helper + Variant(const PoolVector &p_array); Variant(const PoolVector &p_raw_array); Variant(const PoolVector &p_int_array); Variant(const PoolVector &p_real_array); @@ -318,8 +339,10 @@ public: Variant(const PoolVector &p_vector3_array); Variant(const PoolVector &p_color_array); Variant(const PoolVector &p_face_array); - Variant(const PoolVector &p_vector2_array); // helper - Variant(const PoolVector &p_vector2_array); // helper + Variant(const PoolVector &p_vector2_array); + Variant(const PoolVector &p_vector2_array); + Variant(const PoolVector &p_vector4_array); + Variant(const PoolVector &p_vector4_array); Variant(const Vector &p_array); Variant(const Vector &p_array); @@ -330,10 +353,12 @@ public: Variant(const Vector &p_array); Variant(const Vector &p_array); Variant(const Vector &p_array); - Variant(const Vector &p_array); // helper - Variant(const Vector &p_array); // helper - Variant(const Vector &p_array); // helper - Variant(const Vector &p_array); // helper + Variant(const Vector &p_array); + Variant(const Vector<::RID> &p_array); + Variant(const Vector &p_array); + Variant(const Vector &p_array); + Variant(const Vector &p_array); + Variant(const Vector &p_array); Variant(const IP_Address &p_address); @@ -458,7 +483,9 @@ public: void operator=(const Variant &p_variant); // only this is enough for all the other types Variant(const Variant &p_variant); - _FORCE_INLINE_ Variant() { type = NIL; } + _FORCE_INLINE_ Variant() { + type = NIL; + } _FORCE_INLINE_ ~Variant() { if (type != Variant::NIL) { clear(); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 59dc8bf64..d490a0138 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -149,7 +149,7 @@ struct _VariantCall { #endif } - static void addfunc(bool p_const, Variant::Type p_type, Variant::Type p_return, bool p_has_return, const StringName &p_name, VariantFunc p_func, const Vector &p_defaultarg, const Arg &p_argtype1 = Arg(), const Arg &p_argtype2 = Arg(), const Arg &p_argtype3 = Arg(), const Arg &p_argtype4 = Arg(), const Arg &p_argtype5 = Arg()) { + static void addfunc(bool p_const, Variant::Type p_type, Variant::Type p_return, bool p_has_return, const StringName &p_name, VariantFunc p_func, const Vector &p_defaultarg, const Arg &p_argtype1 = Arg(), const Arg &p_argtype2 = Arg(), const Arg &p_argtype3 = Arg(), const Arg &p_argtype4 = Arg(), const Arg &p_argtype5 = Arg(), const Arg &p_argtype6 = Arg(), const Arg &p_argtype7 = Arg(), const Arg &p_argtype8 = Arg()) { FuncData funcdata; funcdata.func = p_func; funcdata.default_args = p_defaultarg; @@ -205,6 +205,33 @@ struct _VariantCall { goto end; } + if (p_argtype6.name) { + funcdata.arg_types.push_back(p_argtype6.type); +#ifdef DEBUG_ENABLED + funcdata.arg_names.push_back(p_argtype6.name); +#endif + } else { + goto end; + } + + if (p_argtype7.name) { + funcdata.arg_types.push_back(p_argtype7.type); +#ifdef DEBUG_ENABLED + funcdata.arg_names.push_back(p_argtype7.name); +#endif + } else { + goto end; + } + + if (p_argtype8.name) { + funcdata.arg_types.push_back(p_argtype8.type); +#ifdef DEBUG_ENABLED + funcdata.arg_names.push_back(p_argtype8.name); +#endif + } else { + goto end; + } + end: funcdata.arg_count = funcdata.arg_types.size(); @@ -664,6 +691,46 @@ struct _VariantCall { VCALL_LOCALMEM2R(Vector3i, clamp); VCALL_LOCALMEM2R(Vector3i, linear_interpolate); + VCALL_LOCALMEM1(Vector4, set_all); + VCALL_LOCALMEM2(Vector4, set_axis); + VCALL_LOCALMEM1R(Vector4, get_axis); + VCALL_LOCALMEM0R(Vector4, min_axis); + VCALL_LOCALMEM0R(Vector4, max_axis); + VCALL_LOCALMEM0R(Vector4, length_squared); + VCALL_LOCALMEM1R(Vector4, is_equal_approx); + VCALL_LOCALMEM0R(Vector4, length); + VCALL_LOCALMEM0(Vector4, normalize); + VCALL_LOCALMEM0R(Vector4, normalized); + VCALL_LOCALMEM0R(Vector4, is_normalized); + VCALL_LOCALMEM1R(Vector4, distance_to); + VCALL_LOCALMEM1R(Vector4, distance_squared_to); + VCALL_LOCALMEM1R(Vector4, direction_to); + VCALL_LOCALMEM0R(Vector4, abs); + VCALL_LOCALMEM0R(Vector4, sign); + VCALL_LOCALMEM0R(Vector4, floor); + VCALL_LOCALMEM0R(Vector4, ceil); + VCALL_LOCALMEM0R(Vector4, round); + VCALL_LOCALMEM2R(Vector4, lerp); + VCALL_LOCALMEM4R(Vector4, cubic_interpolate); + VCALL_LOCALMEM1R(Vector4, posmod); + VCALL_LOCALMEM1R(Vector4, posmodv); + VCALL_LOCALMEM1(Vector4, snap); + VCALL_LOCALMEM1R(Vector4, snapped); + VCALL_LOCALMEM2R(Vector4, clamp); + VCALL_LOCALMEM0R(Vector4, inverse); + VCALL_LOCALMEM1R(Vector4, dot); + + VCALL_LOCALMEM2(Vector4i, set_axis); + VCALL_LOCALMEM1R(Vector4i, get_axis); + VCALL_LOCALMEM0R(Vector4i, min_axis); + VCALL_LOCALMEM0R(Vector4i, max_axis); + VCALL_LOCALMEM0R(Vector4i, length_squared); + VCALL_LOCALMEM0R(Vector4i, length); + VCALL_LOCALMEM0(Vector4i, zero); + VCALL_LOCALMEM0R(Vector4i, abs); + VCALL_LOCALMEM0R(Vector4i, sign); + VCALL_LOCALMEM2R(Vector4i, clamp); + VCALL_LOCALMEM1(Plane, set_normal); VCALL_LOCALMEM0R(Plane, get_normal); VCALL_LOCALMEM0(Plane, normalize); @@ -1104,6 +1171,46 @@ struct _VariantCall { VCALL_LOCALMEM0(PoolVector3iArray, clear); VCALL_LOCALMEM0(PoolVector3iArray, sort); + VCALL_LOCALMEM0R(PoolVector4Array, size); + VCALL_LOCALMEM0R(PoolVector4Array, empty); + VCALL_LOCALMEM2(PoolVector4Array, set); + VCALL_LOCALMEM1R(PoolVector4Array, get); + VCALL_LOCALMEM1(PoolVector4Array, push_back); + VCALL_LOCALMEM1(PoolVector4Array, fill); + VCALL_LOCALMEM1(PoolVector4Array, resize); + VCALL_LOCALMEM2R(PoolVector4Array, insert); + VCALL_LOCALMEM1(PoolVector4Array, remove); + VCALL_LOCALMEM1(PoolVector4Array, append); + VCALL_LOCALMEM1(PoolVector4Array, append_array); + VCALL_LOCALMEM0(PoolVector4Array, invert); + VCALL_LOCALMEM1R(PoolVector4Array, contains); + VCALL_LOCALMEM2R(PoolVector4Array, find); + VCALL_LOCALMEM2R(PoolVector4Array, rfind); + VCALL_LOCALMEM1R(PoolVector4Array, count); + VCALL_LOCALMEM1R(PoolVector4Array, has); + VCALL_LOCALMEM0(PoolVector4Array, clear); + VCALL_LOCALMEM0(PoolVector4Array, sort); + + VCALL_LOCALMEM0R(PoolVector4iArray, size); + VCALL_LOCALMEM0R(PoolVector4iArray, empty); + VCALL_LOCALMEM2(PoolVector4iArray, set); + VCALL_LOCALMEM1R(PoolVector4iArray, get); + VCALL_LOCALMEM1(PoolVector4iArray, push_back); + VCALL_LOCALMEM1(PoolVector4iArray, fill); + VCALL_LOCALMEM1(PoolVector4iArray, resize); + VCALL_LOCALMEM2R(PoolVector4iArray, insert); + VCALL_LOCALMEM1(PoolVector4iArray, remove); + VCALL_LOCALMEM1(PoolVector4iArray, append); + VCALL_LOCALMEM1(PoolVector4iArray, append_array); + VCALL_LOCALMEM0(PoolVector4iArray, invert); + VCALL_LOCALMEM1R(PoolVector4iArray, contains); + VCALL_LOCALMEM2R(PoolVector4iArray, find); + VCALL_LOCALMEM2R(PoolVector4iArray, rfind); + VCALL_LOCALMEM1R(PoolVector4iArray, count); + VCALL_LOCALMEM1R(PoolVector4iArray, has); + VCALL_LOCALMEM0(PoolVector4iArray, clear); + VCALL_LOCALMEM0(PoolVector4iArray, sort); + VCALL_LOCALMEM0R(PoolColorArray, size); VCALL_LOCALMEM0R(PoolColorArray, empty); VCALL_LOCALMEM2(PoolColorArray, set); @@ -1172,6 +1279,14 @@ struct _VariantCall { static void _call_##m_type##_##m_method(Variant &r_ret, Variant &p_self, const Variant **p_args) { \ r_ret = reinterpret_cast(p_self._data._ptr)->m_method(*p_args[0], *p_args[1], *p_args[2], *p_args[3], *p_args[4]); \ } +#define VCALL_PTR6(m_type, m_method) \ + static void _call_##m_type##_##m_method(Variant &r_ret, Variant &p_self, const Variant **p_args) { \ + reinterpret_cast(p_self._data._ptr)->m_method(*p_args[0], *p_args[1], *p_args[2], *p_args[3], *p_args[4], *p_args[5]); \ + } +#define VCALL_PTR8(m_type, m_method) \ + static void _call_##m_type##_##m_method(Variant &r_ret, Variant &p_self, const Variant **p_args) { \ + reinterpret_cast(p_self._data._ptr)->m_method(*p_args[0], *p_args[1], *p_args[2], *p_args[3], *p_args[4], *p_args[5], *p_args[6], *p_args[7]); \ + } VCALL_PTR0R(AABB, get_volume); VCALL_PTR0R(AABB, has_no_volume); @@ -1259,18 +1374,18 @@ struct _VariantCall { static void _call_Transform2D_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) { switch (p_args[0]->type) { - case Variant::VECTOR2: - r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Vector2()); - return; - case Variant::VECTOR2I: - r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Vector2i()); - return; case Variant::RECT2: r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Rect2()); return; case Variant::RECT2I: r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Rect2i()); return; + case Variant::VECTOR2: + r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Vector2()); + return; + case Variant::VECTOR2I: + r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Vector2i()); + return; case Variant::POOL_VECTOR2_ARRAY: r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator PoolVector2Array()); return; @@ -1284,18 +1399,18 @@ struct _VariantCall { static void _call_Transform2D_xform_inv(Variant &r_ret, Variant &p_self, const Variant **p_args) { switch (p_args[0]->type) { - case Variant::VECTOR2: - r_ret = reinterpret_cast(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector2()); - return; - case Variant::VECTOR2I: - r_ret = reinterpret_cast(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector2i()); - return; case Variant::RECT2: r_ret = reinterpret_cast(p_self._data._ptr)->xform_inv(p_args[0]->operator Rect2()); return; case Variant::RECT2I: r_ret = reinterpret_cast(p_self._data._ptr)->xform_inv(p_args[0]->operator Rect2i()); return; + case Variant::VECTOR2: + r_ret = reinterpret_cast(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector2()); + return; + case Variant::VECTOR2I: + r_ret = reinterpret_cast(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector2i()); + return; case Variant::POOL_VECTOR2_ARRAY: r_ret = reinterpret_cast(p_self._data._ptr)->xform_inv(p_args[0]->operator PoolVector2Array()); return; @@ -1518,6 +1633,69 @@ struct _VariantCall { } } + VCALL_PTR0R(Projection, determinant); + VCALL_PTR0(Projection, set_identity); + VCALL_PTR0(Projection, set_zero); + VCALL_PTR0(Projection, set_light_bias); + VCALL_PTR1(Projection, set_depth_correction); + VCALL_PTR1(Projection, set_light_atlas_rect); + VCALL_PTR5(Projection, set_perspective1); + VCALL_PTR8(Projection, set_perspective2); + VCALL_PTR8(Projection, set_for_hmd); + VCALL_PTR6(Projection, set_orthogonal1); + VCALL_PTR5(Projection, set_orthogonal2); + VCALL_PTR6(Projection, set_frustum1); + VCALL_PTR6(Projection, set_frustum2); + VCALL_PTR1(Projection, adjust_perspective_znear); + VCALL_PTR1R(Projection, perspective_znear_adjusted); + //TODO figure out why this doesn't work + //VCALL_PTR1R(Projection, get_projection_plane); + VCALL_PTR0R(Projection, flipped_y); + VCALL_PTR1R(Projection, jitter_offseted); + VCALL_PTR2R(Projection, calculate_fovy); + VCALL_PTR0R(Projection, get_z_far); + VCALL_PTR0R(Projection, get_z_near); + VCALL_PTR0R(Projection, get_aspect); + VCALL_PTR0R(Projection, get_fov); + VCALL_PTR0R(Projection, is_orthogonal); + VCALL_PTR1R(Projection, get_projection_planes_array); + VCALL_PTR0R(Projection, get_viewport_half_extents); + VCALL_PTR0R(Projection, get_far_plane_half_extents); + VCALL_PTR0(Projection, invert); + VCALL_PTR0R(Projection, inverse); + VCALL_PTR1(Projection, scale_translate_to_fit); + VCALL_PTR1(Projection, add_jitter_offset); + VCALL_PTR1(Projection, make_scale); + VCALL_PTR1R(Projection, get_pixels_per_meter); + VCALL_PTR0(Projection, flip_y); + VCALL_PTR0R(Projection, get_lod_multiplier); + + static void _call_Projection_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) { + switch (p_args[0]->type) { + case Variant::VECTOR4: + r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Vector4()); + return; + case Variant::VECTOR3: + r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Vector3()); + return; + case Variant::PLANE: + r_ret = reinterpret_cast(p_self._data._ptr)->xform(p_args[0]->operator Plane()); + return; + default: + r_ret = Variant(); + } + } + + static void _call_Projection_xform_inv(Variant &r_ret, Variant &p_self, const Variant **p_args) { + switch (p_args[0]->type) { + case Variant::VECTOR4: + r_ret = reinterpret_cast(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector4()); + return; + default: + r_ret = Variant(); + } + } + struct ConstructData { int arg_count; Vector arg_types; @@ -1531,14 +1709,6 @@ struct _VariantCall { static ConstructFunc *construct_funcs; - static void Vector2_init1(Variant &r_ret, const Variant **p_args) { - r_ret = Vector2(*p_args[0], *p_args[1]); - } - - static void Vector2i_init1(Variant &r_ret, const Variant **p_args) { - r_ret = Vector2i(*p_args[0], *p_args[1]); - } - static void Rect2_init1(Variant &r_ret, const Variant **p_args) { r_ret = Rect2(*p_args[0], *p_args[1]); } @@ -1555,17 +1725,12 @@ struct _VariantCall { r_ret = Rect2i(*p_args[0], *p_args[1], *p_args[2], *p_args[3]); } - static void Transform2D_init2(Variant &r_ret, const Variant **p_args) { - Transform2D m(*p_args[0], *p_args[1]); - r_ret = m; + static void Vector2_init1(Variant &r_ret, const Variant **p_args) { + r_ret = Vector2(*p_args[0], *p_args[1]); } - static void Transform2D_init3(Variant &r_ret, const Variant **p_args) { - Transform2D m; - m[0] = *p_args[0]; - m[1] = *p_args[1]; - m[2] = *p_args[2]; - r_ret = m; + static void Vector2i_init1(Variant &r_ret, const Variant **p_args) { + r_ret = Vector2i(*p_args[0], *p_args[1]); } static void Vector3_init1(Variant &r_ret, const Variant **p_args) { @@ -1576,6 +1741,14 @@ struct _VariantCall { r_ret = Vector3i(*p_args[0], *p_args[1], *p_args[2]); } + static void Vector4_init1(Variant &r_ret, const Variant **p_args) { + r_ret = Vector4(*p_args[0], *p_args[1], *p_args[2], *p_args[3]); + } + + static void Vector4i_init1(Variant &r_ret, const Variant **p_args) { + r_ret = Vector4i(*p_args[0], *p_args[1], *p_args[2], *p_args[3]); + } + static void Plane_init1(Variant &r_ret, const Variant **p_args) { r_ret = Plane(*p_args[0], *p_args[1], *p_args[2], *p_args[3]); } @@ -1603,22 +1776,6 @@ struct _VariantCall { r_ret = Quaternion(((Vector3)(*p_args[0]))); } - static void Color_init1(Variant &r_ret, const Variant **p_args) { - r_ret = Color(*p_args[0], *p_args[1], *p_args[2], *p_args[3]); - } - - static void Color_init2(Variant &r_ret, const Variant **p_args) { - r_ret = Color(*p_args[0], *p_args[1], *p_args[2]); - } - - static void Color_init3(Variant &r_ret, const Variant **p_args) { - r_ret = Color::html(*p_args[0]); - } - - static void Color_init4(Variant &r_ret, const Variant **p_args) { - r_ret = Color::hex(*p_args[0]); - } - static void AABB_init1(Variant &r_ret, const Variant **p_args) { r_ret = ::AABB(*p_args[0], *p_args[1]); } @@ -1648,6 +1805,35 @@ struct _VariantCall { r_ret = Transform(p_args[0]->operator Basis(), p_args[1]->operator Vector3()); } + static void Transform2D_init2(Variant &r_ret, const Variant **p_args) { + Transform2D m(*p_args[0], *p_args[1]); + r_ret = m; + } + + static void Transform2D_init3(Variant &r_ret, const Variant **p_args) { + Transform2D m; + m[0] = *p_args[0]; + m[1] = *p_args[1]; + m[2] = *p_args[2]; + r_ret = m; + } + + static void Color_init1(Variant &r_ret, const Variant **p_args) { + r_ret = Color(*p_args[0], *p_args[1], *p_args[2], *p_args[3]); + } + + static void Color_init2(Variant &r_ret, const Variant **p_args) { + r_ret = Color(*p_args[0], *p_args[1], *p_args[2]); + } + + static void Color_init3(Variant &r_ret, const Variant **p_args) { + r_ret = Color::html(*p_args[0]); + } + + static void Color_init4(Variant &r_ret, const Variant **p_args) { + r_ret = Color::hex(*p_args[0]); + } + static void add_constructor(VariantConstructFunc p_func, const Variant::Type p_type, const String &p_name1 = "", const Variant::Type p_type1 = Variant::NIL, const String &p_name2 = "", const Variant::Type p_type2 = Variant::NIL, @@ -1790,54 +1976,61 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i case STRING: return String(); - // math types - case VECTOR2: - return Vector2(); // 5 - case VECTOR2I: - return Vector2i(); - case RECT2: + // math types + case RECT2: // 5 return Rect2(); case RECT2I: return Rect2i(); + case VECTOR2: + return Vector2(); + case VECTOR2I: + return Vector2i(); case VECTOR3: return Vector3(); - case VECTOR3I: + case VECTOR3I: // 10 return Vector3i(); - case TRANSFORM2D: - return Transform2D(); + case VECTOR4: + return Vector4(); + case VECTOR4I: + return Vector4i(); + case PLANE: return Plane(); case QUATERNION: return Quaternion(); - case AABB: - return ::AABB(); // 10 + case AABB: // 15 + return ::AABB(); case BASIS: return Basis(); case TRANSFORM: return Transform(); + case TRANSFORM2D: + return Transform2D(); + case PROJECTION: + return Projection(); // misc types - case COLOR: + case COLOR: // 20 return Color(); case NODE_PATH: - return NodePath(); // 15 - case _RID: - return RID(); + return NodePath(); + case RID: + return ::RID(); case OBJECT: return (Object *)nullptr; case STRING_NAME: return StringName(); - case DICTIONARY: + case DICTIONARY: // 25 return Dictionary(); case ARRAY: - return Array(); // 20 + return Array(); case POOL_BYTE_ARRAY: return PoolByteArray(); case POOL_INT_ARRAY: return PoolIntArray(); case POOL_REAL_ARRAY: return PoolRealArray(); - case POOL_STRING_ARRAY: + case POOL_STRING_ARRAY: //30 return PoolStringArray(); case POOL_VECTOR2_ARRAY: return PoolVector2Array(); @@ -1847,6 +2040,10 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i return PoolVector3Array(); case POOL_VECTOR3I_ARRAY: return PoolVector3iArray(); + case POOL_VECTOR4_ARRAY: //35 + return PoolVector4Array(); + case POOL_VECTOR4I_ARRAY: + return PoolVector4iArray(); case POOL_COLOR_ARRAY: return PoolColorArray(); default: @@ -1874,6 +2071,11 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i case STRING: { return String(*p_args[0]); } + case RECT2: + return (Rect2(*p_args[0])); + case RECT2I: + //TODO Don't cast like this + return (Rect2i(Rect2(*p_args[0]))); case VECTOR2: { return Vector2(*p_args[0]); } @@ -1881,17 +2083,14 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i //TODO Don't cast like this return Vector2i(Vector2(*p_args[0])); } - case RECT2: - return (Rect2(*p_args[0])); - case RECT2I: - //TODO Don't cast like this - return (Rect2i(Rect2(*p_args[0]))); case VECTOR3: return (Vector3(*p_args[0])); case VECTOR3I: return (Vector3i(*p_args[0])); - case TRANSFORM2D: - return (Transform2D(p_args[0]->operator Transform2D())); + case VECTOR4: + return (Vector4(*p_args[0])); + case VECTOR4I: + return (Vector4i(*p_args[0])); case PLANE: return (Plane(*p_args[0])); case QUATERNION: @@ -1902,14 +2101,18 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i return (Basis(p_args[0]->operator Basis())); case TRANSFORM: return (Transform(p_args[0]->operator Transform())); + case TRANSFORM2D: + return (Transform2D(p_args[0]->operator Transform2D())); + case PROJECTION: + return (Projection(p_args[0]->operator Projection())); // misc types case COLOR: return p_args[0]->type == Variant::STRING ? Color::html(*p_args[0]) : Color::hex(*p_args[0]); case NODE_PATH: return (NodePath(p_args[0]->operator NodePath())); // 15 - case _RID: - return (RID(*p_args[0])); + case RID: + return (::RID(*p_args[0])); case OBJECT: return ((Object *)(p_args[0]->operator Object *())); case STRING_NAME: @@ -1936,6 +2139,10 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i return (PoolVector3Array(*p_args[0])); case POOL_VECTOR3I_ARRAY: return (PoolVector3iArray(*p_args[0])); + case POOL_VECTOR4_ARRAY: + return (PoolVector4Array(*p_args[0])); + case POOL_VECTOR4I_ARRAY: + return (PoolVector4iArray(*p_args[0])); case POOL_COLOR_ARRAY: return (PoolColorArray(*p_args[0])); default: @@ -2230,6 +2437,13 @@ void register_variant_methods() { #define ADDFUNC4NC(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_arg3, m_argname3, m_arg4, m_argname4, m_defarg) \ _VariantCall::addfunc(false, Variant::m_vtype, Variant::m_ret, false, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)), _VariantCall::Arg(Variant::m_arg4, _scs_create(m_argname4))); +#define ADDFUNC5(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_arg3, m_argname3, m_arg4, m_argname4, m_arg5, m_argname5, m_defarg) \ + _VariantCall::addfunc(true, Variant::m_vtype, Variant::m_ret, false, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)), _VariantCall::Arg(Variant::m_arg4, _scs_create(m_argname4)), _VariantCall::Arg(Variant::m_arg5, _scs_create(m_argname5))); +#define ADDFUNC6(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_arg3, m_argname3, m_arg4, m_argname4, m_arg5, m_argname5, m_arg6, m_argname6, m_defarg) \ + _VariantCall::addfunc(true, Variant::m_vtype, Variant::m_ret, false, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)), _VariantCall::Arg(Variant::m_arg4, _scs_create(m_argname4)), _VariantCall::Arg(Variant::m_arg5, _scs_create(m_argname5)), _VariantCall::Arg(Variant::m_arg6, _scs_create(m_argname6))); +#define ADDFUNC8(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_arg3, m_argname3, m_arg4, m_argname4, m_arg5, m_argname5, m_arg6, m_argname6, m_arg7, m_argname7, m_arg8, m_argname8, m_defarg) \ + _VariantCall::addfunc(true, Variant::m_vtype, Variant::m_ret, false, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)), _VariantCall::Arg(Variant::m_arg4, _scs_create(m_argname4)), _VariantCall::Arg(Variant::m_arg5, _scs_create(m_argname5)), _VariantCall::Arg(Variant::m_arg6, _scs_create(m_argname6)), _VariantCall::Arg(Variant::m_arg7, _scs_create(m_argname7)), _VariantCall::Arg(Variant::m_arg8, _scs_create(m_argname8))); + /* STRING */ ADDFUNC1(STRING, NIL, String, remove, INT, "index", varray()); @@ -2565,6 +2779,46 @@ void register_variant_methods() { ADDFUNC2R(VECTOR3I, VECTOR3I, Vector3i, clamp, VECTOR3I, "min", VECTOR3I, "max", varray()); ADDFUNC2R(VECTOR3I, VECTOR3I, Vector3i, linear_interpolate, VECTOR3I, "to", REAL, "weight", varray()); + ADDFUNC1(VECTOR4, NIL, Vector4, set_all, REAL, "value", varray()); + ADDFUNC2(VECTOR4, NIL, Vector4, set_axis, INT, "axis", REAL, "value", varray()); + ADDFUNC1R(VECTOR4, INT, Vector4, get_axis, INT, "axis", varray()); + ADDFUNC0R(VECTOR4, INT, Vector4, min_axis, varray()); + ADDFUNC0R(VECTOR4, INT, Vector4, max_axis, varray()); + ADDFUNC0R(VECTOR4, REAL, Vector4, length_squared, varray()); + ADDFUNC1R(VECTOR4, BOOL, Vector4, is_equal_approx, VECTOR4, "v", varray()); + ADDFUNC0R(VECTOR4, REAL, Vector4, length, varray()); + ADDFUNC0(VECTOR4, NIL, Vector4, normalize, varray()); + ADDFUNC0R(VECTOR4, VECTOR4, Vector4, normalized, varray()); + ADDFUNC0R(VECTOR4, BOOL, Vector4, is_normalized, varray()); + ADDFUNC1R(VECTOR4, REAL, Vector4, distance_to, VECTOR4, "b", varray()); + ADDFUNC1R(VECTOR4, REAL, Vector4, distance_squared_to, VECTOR4, "b", varray()); + ADDFUNC1R(VECTOR4, VECTOR4, Vector4, direction_to, VECTOR4, "b", varray()); + ADDFUNC0R(VECTOR4, VECTOR4, Vector4, abs, varray()); + ADDFUNC0R(VECTOR4, VECTOR4, Vector4, sign, varray()); + ADDFUNC0R(VECTOR4, VECTOR4, Vector4, floor, varray()); + ADDFUNC0R(VECTOR4, VECTOR4, Vector4, ceil, varray()); + ADDFUNC0R(VECTOR4, VECTOR4, Vector4, round, varray()); + ADDFUNC2R(VECTOR4, VECTOR4, Vector4, lerp, VECTOR4, "to", REAL, "weight", varray()); + ADDFUNC4R(VECTOR4, VECTOR4, Vector4, cubic_interpolate, VECTOR4, "b", VECTOR4, "pre_a", VECTOR4, "post_b", REAL, "weight", varray()); + ADDFUNC1R(VECTOR4, VECTOR4, Vector4, posmod, REAL, "mod", varray()); + ADDFUNC1R(VECTOR4, VECTOR4, Vector4, posmodv, VECTOR4, "modv", varray()); + ADDFUNC1(VECTOR4, NIL, Vector4, snap, VECTOR4, "val", varray()); + ADDFUNC1R(VECTOR4, VECTOR4, Vector4, snapped, VECTOR4, "by", varray()); + ADDFUNC2R(VECTOR4, VECTOR4, Vector4, clamp, VECTOR4, "min", VECTOR4, "max", varray()); + ADDFUNC0R(VECTOR4, VECTOR4, Vector4, inverse, varray()); + ADDFUNC1R(VECTOR4, REAL, Vector4, dot, VECTOR4, "b", varray()); + + ADDFUNC2(VECTOR4I, NIL, Vector4i, set_axis, INT, "axis", INT, "value", varray()); + ADDFUNC1R(VECTOR4I, INT, Vector4i, get_axis, INT, "axis", varray()); + ADDFUNC0R(VECTOR4I, INT, Vector4i, min_axis, varray()); + ADDFUNC0R(VECTOR4I, INT, Vector4i, max_axis, varray()); + ADDFUNC0R(VECTOR4I, REAL, Vector4i, length_squared, varray()); + ADDFUNC0R(VECTOR4I, REAL, Vector4i, length, varray()); + ADDFUNC0(VECTOR4I, NIL, Vector4i, zero, varray()); + ADDFUNC0R(VECTOR4I, VECTOR4I, Vector4i, abs, varray()); + ADDFUNC0R(VECTOR4I, VECTOR4I, Vector4i, sign, varray()); + ADDFUNC2R(VECTOR4I, VECTOR4I, Vector4i, clamp, VECTOR4I, "min", VECTOR4I, "max", varray()); + ADDFUNC1(PLANE, NIL, Plane, set_normal, VECTOR3, "normal", varray()); ADDFUNC0R(PLANE, VECTOR3, Plane, get_normal, varray()); ADDFUNC0(PLANE, NIL, Plane, normalize, varray()); @@ -2646,7 +2900,7 @@ void register_variant_methods() { ADDFUNC1(COLOR, NIL, Color, set_s, INT, "s", varray()); ADDFUNC1(COLOR, NIL, Color, set_v, INT, "v", varray()); - ADDFUNC0R(_RID, INT, RID, get_id, varray()); + ADDFUNC0R(RID, INT, RID, get_id, varray()); ADDFUNC0R(NODE_PATH, BOOL, NodePath, is_absolute, varray()); ADDFUNC0R(NODE_PATH, INT, NodePath, get_name_count, varray()); @@ -2867,6 +3121,44 @@ void register_variant_methods() { ADDFUNC0(POOL_VECTOR3I_ARRAY, NIL, PoolVector3iArray, clear, varray()); ADDFUNC0(POOL_VECTOR3I_ARRAY, NIL, PoolVector3iArray, sort, varray()); + ADDFUNC0R(POOL_VECTOR4_ARRAY, INT, PoolVector4Array, size, varray()); + ADDFUNC0R(POOL_VECTOR4_ARRAY, BOOL, PoolVector4Array, empty, varray()); + ADDFUNC2(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, set, INT, "idx", VECTOR4, "vector4", varray()); + ADDFUNC1(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, push_back, VECTOR4, "vector4", varray()); + ADDFUNC1(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, fill, VECTOR4, "vector4", varray()); + ADDFUNC1(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, append, VECTOR4, "vector4", varray()); + ADDFUNC1(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, append_array, POOL_VECTOR4_ARRAY, "array", varray()); + ADDFUNC1(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, remove, INT, "idx", varray()); + ADDFUNC2R(POOL_VECTOR4_ARRAY, INT, PoolVector4Array, insert, INT, "idx", VECTOR4, "vector4", varray()); + ADDFUNC1(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, resize, INT, "idx", varray()); + ADDFUNC0(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, invert, varray()); + ADDFUNC1R(POOL_VECTOR4_ARRAY, BOOL, PoolVector4Array, contains, VECTOR4, "value", varray()) + ADDFUNC2R(POOL_VECTOR4_ARRAY, INT, PoolVector4Array, find, VECTOR4, "value", INT, "from", varray(0)) + ADDFUNC2R(POOL_VECTOR4_ARRAY, INT, PoolVector4Array, rfind, VECTOR4, "value", INT, "from", varray(-1)); + ADDFUNC1R(POOL_VECTOR4_ARRAY, INT, PoolVector4Array, count, VECTOR4, "value", varray()); + ADDFUNC1R(POOL_VECTOR4_ARRAY, BOOL, PoolVector4Array, has, VECTOR4, "value", varray()); + ADDFUNC0(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, clear, varray()); + ADDFUNC0(POOL_VECTOR4_ARRAY, NIL, PoolVector4Array, sort, varray()); + + ADDFUNC0R(POOL_VECTOR4I_ARRAY, INT, PoolVector4iArray, size, varray()); + ADDFUNC0R(POOL_VECTOR4I_ARRAY, BOOL, PoolVector4iArray, empty, varray()); + ADDFUNC2(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, set, INT, "idx", VECTOR4I, "vector4i", varray()); + ADDFUNC1(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, push_back, VECTOR4I, "vector4i", varray()); + ADDFUNC1(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, fill, VECTOR4I, "vector4i", varray()); + ADDFUNC1(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, append, VECTOR4I, "vector4i", varray()); + ADDFUNC1(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, append_array, POOL_VECTOR4I_ARRAY, "array", varray()); + ADDFUNC1(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, remove, INT, "idx", varray()); + ADDFUNC2R(POOL_VECTOR4I_ARRAY, INT, PoolVector4iArray, insert, INT, "idx", VECTOR4I, "vector4i", varray()); + ADDFUNC1(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, resize, INT, "idx", varray()); + ADDFUNC0(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, invert, varray()); + ADDFUNC1R(POOL_VECTOR4I_ARRAY, BOOL, PoolVector4iArray, contains, VECTOR4I, "value", varray()) + ADDFUNC2R(POOL_VECTOR4I_ARRAY, INT, PoolVector4iArray, find, VECTOR4I, "value", INT, "from", varray(0)) + ADDFUNC2R(POOL_VECTOR4I_ARRAY, INT, PoolVector4iArray, rfind, VECTOR4I, "value", INT, "from", varray(-1)); + ADDFUNC1R(POOL_VECTOR4I_ARRAY, INT, PoolVector4iArray, count, VECTOR4I, "value", varray()); + ADDFUNC1R(POOL_VECTOR4I_ARRAY, BOOL, PoolVector4iArray, has, VECTOR4I, "value", varray()); + ADDFUNC0(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, clear, varray()); + ADDFUNC0(POOL_VECTOR4I_ARRAY, NIL, PoolVector4iArray, sort, varray()); + ADDFUNC0R(POOL_COLOR_ARRAY, INT, PoolColorArray, size, varray()); ADDFUNC0R(POOL_COLOR_ARRAY, BOOL, PoolColorArray, empty, varray()); ADDFUNC2(POOL_COLOR_ARRAY, NIL, PoolColorArray, set, INT, "idx", COLOR, "color", varray()); @@ -3089,6 +3381,57 @@ void register_variant_methods() { ADDFUNC1R(TRANSFORM, NIL, Transform, xform, NIL, "v", varray()); ADDFUNC1R(TRANSFORM, NIL, Transform, xform_inv, NIL, "v", varray()); + ADDFUNC0R(PROJECTION, REAL, Projection, determinant, varray()); + + ADDFUNC0(PROJECTION, NIL, Projection, set_identity, varray()); + ADDFUNC0(PROJECTION, NIL, Projection, set_zero, varray()); + ADDFUNC0(PROJECTION, NIL, Projection, set_light_bias, varray()); + ADDFUNC1(PROJECTION, NIL, Projection, set_depth_correction, BOOL, "flip_y", varray(true)); + + ADDFUNC1(PROJECTION, NIL, Projection, set_light_atlas_rect, RECT2, "rect", varray()); + ADDFUNC5(PROJECTION, NIL, Projection, set_perspective1, REAL, "fovy_degrees", REAL, "aspect", REAL, "z_near", REAL, "z_far", BOOL, "flip_fov", varray(false)); + ADDFUNC8(PROJECTION, NIL, Projection, set_perspective2, REAL, "fovy_degrees", REAL, "aspect", REAL, "z_near", REAL, "z_far", BOOL, "flip_fov", INT, "eye", REAL, "intraocular_dist", REAL, "convergence_dist", varray()); + ADDFUNC8(PROJECTION, NIL, Projection, set_for_hmd, INT, "eye", REAL, "aspect", REAL, "intraocular_dist", REAL, "display_width", REAL, "display_to_lens", REAL, "oversample", REAL, "z_near", REAL, "z_far", varray()); + ADDFUNC6(PROJECTION, NIL, Projection, set_orthogonal1, REAL, "left", REAL, "right", REAL, "bottom", REAL, "top", REAL, "znear", REAL, "zfar", varray()); + ADDFUNC5(PROJECTION, NIL, Projection, set_orthogonal2, REAL, "size", REAL, "aspect", REAL, "znear", REAL, "zfar", BOOL, "flip_fov", varray(false)); + ADDFUNC6(PROJECTION, NIL, Projection, set_frustum1, REAL, "left", REAL, "right", REAL, "bottom", REAL, "top", REAL, "near", REAL, "far", varray()); + ADDFUNC6(PROJECTION, NIL, Projection, set_frustum2, REAL, "size", REAL, "aspect", VECTOR2, "offset", REAL, "near", REAL, "far", BOOL, "flip_fov", varray(false)); + ADDFUNC1(PROJECTION, NIL, Projection, adjust_perspective_znear, REAL, "new_znear", varray()); + + ADDFUNC1R(PROJECTION, PROJECTION, Projection, perspective_znear_adjusted, REAL, "new_znear", varray()); + //TODO + //ADDFUNC1R(PROJECTION, PLANE, Projection, get_projection_plane, INT, "plane", varray()); + ADDFUNC0R(PROJECTION, PROJECTION, Projection, flipped_y, varray()); + ADDFUNC1R(PROJECTION, PROJECTION, Projection, jitter_offseted, VECTOR2, "offset", varray()); + + ADDFUNC2R(PROJECTION, REAL, Projection, calculate_fovy, REAL, "fovx", REAL, "aspect", varray()); + + ADDFUNC0R(PROJECTION, REAL, Projection, get_z_far, varray()); + ADDFUNC0R(PROJECTION, REAL, Projection, get_z_near, varray()); + ADDFUNC0R(PROJECTION, REAL, Projection, get_aspect, varray()); + ADDFUNC0R(PROJECTION, REAL, Projection, get_fov, varray()); + ADDFUNC0R(PROJECTION, BOOL, Projection, is_orthogonal, varray()); + + ADDFUNC1R(PROJECTION, ARRAY, Projection, get_projection_planes_array, TRANSFORM, "transform", varray()); + + ADDFUNC0R(PROJECTION, VECTOR2, Projection, get_viewport_half_extents, varray()); + ADDFUNC0R(PROJECTION, VECTOR2, Projection, get_far_plane_half_extents, varray()); + + ADDFUNC0(PROJECTION, NIL, Projection, invert, varray()); + ADDFUNC0R(PROJECTION, PROJECTION, Projection, inverse, varray()); + + ADDFUNC1(PROJECTION, NIL, Projection, scale_translate_to_fit, AABB, "aabb", varray()); + ADDFUNC1(PROJECTION, NIL, Projection, add_jitter_offset, VECTOR2, "offset", varray()); + ADDFUNC1(PROJECTION, NIL, Projection, make_scale, VECTOR3, "scale", varray()); + ADDFUNC1R(PROJECTION, INT, Projection, get_pixels_per_meter, INT, "for_pixel_width", varray()); + + ADDFUNC0(PROJECTION, NIL, Projection, flip_y, varray()); + + ADDFUNC0R(PROJECTION, REAL, Projection, get_lod_multiplier, varray()); + + ADDFUNC1R(PROJECTION, NIL, Projection, xform, NIL, "v4_v3_plane", varray()); + ADDFUNC1R(PROJECTION, NIL, Projection, xform_inv, VECTOR4, "v", varray()); + /* REGISTER CONSTRUCTORS */ _VariantCall::add_constructor(_VariantCall::Vector2_init1, Variant::VECTOR2, "x", Variant::REAL, "y", Variant::REAL); @@ -3105,6 +3448,10 @@ void register_variant_methods() { _VariantCall::add_constructor(_VariantCall::Vector3i_init1, Variant::VECTOR3I, "x", Variant::INT, "y", Variant::INT, "z", Variant::INT); + _VariantCall::add_constructor(_VariantCall::Vector4_init1, Variant::VECTOR4, "x", Variant::REAL, "y", Variant::REAL, "z", Variant::REAL, "w", Variant::REAL); + + _VariantCall::add_constructor(_VariantCall::Vector4i_init1, Variant::VECTOR4I, "x", Variant::INT, "y", Variant::INT, "z", Variant::INT, "w", Variant::INT); + _VariantCall::add_constructor(_VariantCall::Plane_init1, Variant::PLANE, "a", Variant::REAL, "b", Variant::REAL, "c", Variant::REAL, "d", Variant::REAL); _VariantCall::add_constructor(_VariantCall::Plane_init2, Variant::PLANE, "v1", Variant::VECTOR3, "v2", Variant::VECTOR3, "v3", Variant::VECTOR3); _VariantCall::add_constructor(_VariantCall::Plane_init3, Variant::PLANE, "normal", Variant::VECTOR3, "d", Variant::REAL); @@ -3131,6 +3478,27 @@ void register_variant_methods() { _VariantCall::add_variant_constant(Variant::COLOR, color->key(), color->value()); } + _VariantCall::add_constant(Variant::VECTOR2, "AXIS_X", Vector2::AXIS_X); + _VariantCall::add_constant(Variant::VECTOR2, "AXIS_Y", Vector2::AXIS_Y); + + _VariantCall::add_variant_constant(Variant::VECTOR2, "ZERO", Vector2(0, 0)); + _VariantCall::add_variant_constant(Variant::VECTOR2, "ONE", Vector2(1, 1)); + _VariantCall::add_variant_constant(Variant::VECTOR2, "INF", Vector2(Math_INF, Math_INF)); + _VariantCall::add_variant_constant(Variant::VECTOR2, "LEFT", Vector2(-1, 0)); + _VariantCall::add_variant_constant(Variant::VECTOR2, "RIGHT", Vector2(1, 0)); + _VariantCall::add_variant_constant(Variant::VECTOR2, "UP", Vector2(0, -1)); + _VariantCall::add_variant_constant(Variant::VECTOR2, "DOWN", Vector2(0, 1)); + + _VariantCall::add_constant(Variant::VECTOR2I, "AXIS_X", Vector2i::AXIS_X); + _VariantCall::add_constant(Variant::VECTOR2I, "AXIS_Y", Vector2i::AXIS_Y); + + _VariantCall::add_variant_constant(Variant::VECTOR2I, "ZERO", Vector2i(0, 0)); + _VariantCall::add_variant_constant(Variant::VECTOR2I, "ONE", Vector2i(1, 1)); + _VariantCall::add_variant_constant(Variant::VECTOR2I, "LEFT", Vector2i(-1, 0)); + _VariantCall::add_variant_constant(Variant::VECTOR2I, "RIGHT", Vector2i(1, 0)); + _VariantCall::add_variant_constant(Variant::VECTOR2I, "UP", Vector2i(0, -1)); + _VariantCall::add_variant_constant(Variant::VECTOR2I, "DOWN", Vector2i(0, 1)); + _VariantCall::add_constant(Variant::VECTOR3, "AXIS_X", Vector3::AXIS_X); _VariantCall::add_constant(Variant::VECTOR3, "AXIS_Y", Vector3::AXIS_Y); _VariantCall::add_constant(Variant::VECTOR3, "AXIS_Z", Vector3::AXIS_Z); @@ -3158,26 +3526,15 @@ void register_variant_methods() { _VariantCall::add_variant_constant(Variant::VECTOR3I, "FORWARD", Vector3i(0, 0, -1)); _VariantCall::add_variant_constant(Variant::VECTOR3I, "BACK", Vector3i(0, 0, 1)); - _VariantCall::add_constant(Variant::VECTOR2, "AXIS_X", Vector2::AXIS_X); - _VariantCall::add_constant(Variant::VECTOR2, "AXIS_Y", Vector2::AXIS_Y); + _VariantCall::add_constant(Variant::VECTOR4, "AXIS_X", Vector4::AXIS_X); + _VariantCall::add_constant(Variant::VECTOR4, "AXIS_Y", Vector4::AXIS_Y); + _VariantCall::add_constant(Variant::VECTOR4, "AXIS_Z", Vector4::AXIS_Z); + _VariantCall::add_constant(Variant::VECTOR4, "AXIS_W", Vector4::AXIS_W); - _VariantCall::add_variant_constant(Variant::VECTOR2, "ZERO", Vector2(0, 0)); - _VariantCall::add_variant_constant(Variant::VECTOR2, "ONE", Vector2(1, 1)); - _VariantCall::add_variant_constant(Variant::VECTOR2, "INF", Vector2(Math_INF, Math_INF)); - _VariantCall::add_variant_constant(Variant::VECTOR2, "LEFT", Vector2(-1, 0)); - _VariantCall::add_variant_constant(Variant::VECTOR2, "RIGHT", Vector2(1, 0)); - _VariantCall::add_variant_constant(Variant::VECTOR2, "UP", Vector2(0, -1)); - _VariantCall::add_variant_constant(Variant::VECTOR2, "DOWN", Vector2(0, 1)); - - _VariantCall::add_constant(Variant::VECTOR2I, "AXIS_X", Vector2i::AXIS_X); - _VariantCall::add_constant(Variant::VECTOR2I, "AXIS_Y", Vector2i::AXIS_Y); - - _VariantCall::add_variant_constant(Variant::VECTOR2I, "ZERO", Vector2i(0, 0)); - _VariantCall::add_variant_constant(Variant::VECTOR2I, "ONE", Vector2i(1, 1)); - _VariantCall::add_variant_constant(Variant::VECTOR2I, "LEFT", Vector2i(-1, 0)); - _VariantCall::add_variant_constant(Variant::VECTOR2I, "RIGHT", Vector2i(1, 0)); - _VariantCall::add_variant_constant(Variant::VECTOR2I, "UP", Vector2i(0, -1)); - _VariantCall::add_variant_constant(Variant::VECTOR2I, "DOWN", Vector2i(0, 1)); + _VariantCall::add_constant(Variant::VECTOR4I, "AXIS_X", Vector4i::AXIS_X); + _VariantCall::add_constant(Variant::VECTOR4I, "AXIS_Y", Vector4i::AXIS_Y); + _VariantCall::add_constant(Variant::VECTOR4I, "AXIS_Z", Vector4i::AXIS_Z); + _VariantCall::add_constant(Variant::VECTOR4I, "AXIS_W", Vector4i::AXIS_W); _VariantCall::add_variant_constant(Variant::TRANSFORM2D, "IDENTITY", Transform2D()); _VariantCall::add_variant_constant(Variant::TRANSFORM2D, "FLIP_X", Transform2D(-1, 0, 0, 1, 0, 0)); @@ -3192,6 +3549,18 @@ void register_variant_methods() { _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Y", flip_y_transform); _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Z", flip_z_transform); + _VariantCall::add_constant(Variant::PROJECTION, "PLANE_NEAR", Projection::PLANE_NEAR); + _VariantCall::add_constant(Variant::PROJECTION, "PLANE_FAR", Projection::PLANE_FAR); + _VariantCall::add_constant(Variant::PROJECTION, "PLANE_LEFT", Projection::PLANE_LEFT); + _VariantCall::add_constant(Variant::PROJECTION, "PLANE_TOP", Projection::PLANE_TOP); + _VariantCall::add_constant(Variant::PROJECTION, "PLANE_RIGHT", Projection::PLANE_RIGHT); + _VariantCall::add_constant(Variant::PROJECTION, "PLANE_BOTTOM", Projection::PLANE_BOTTOM); + + Projection p; + _VariantCall::add_variant_constant(Variant::PROJECTION, "IDENTITY", p); + p.set_zero(); + _VariantCall::add_variant_constant(Variant::PROJECTION, "ZERO", p); + Basis identity_basis = Basis(); Basis flip_x_basis = Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1); Basis flip_y_basis = Basis(1, 0, 0, 0, -1, 0, 0, 0, 1); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 0cd5b4d26..b8bc15d36 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -44,21 +44,24 @@ CASE_TYPE(PREFIX, OP, BOOL) \ CASE_TYPE(PREFIX, OP, REAL) \ CASE_TYPE(PREFIX, OP, STRING) \ - CASE_TYPE(PREFIX, OP, VECTOR2) \ - CASE_TYPE(PREFIX, OP, VECTOR2I) \ CASE_TYPE(PREFIX, OP, RECT2) \ CASE_TYPE(PREFIX, OP, RECT2I) \ + CASE_TYPE(PREFIX, OP, VECTOR2) \ + CASE_TYPE(PREFIX, OP, VECTOR2I) \ CASE_TYPE(PREFIX, OP, VECTOR3) \ CASE_TYPE(PREFIX, OP, VECTOR3I) \ - CASE_TYPE(PREFIX, OP, TRANSFORM2D) \ + CASE_TYPE(PREFIX, OP, VECTOR4) \ + CASE_TYPE(PREFIX, OP, VECTOR4I) \ CASE_TYPE(PREFIX, OP, PLANE) \ - CASE_TYPE(PREFIX, OP, QUATERNION) \ + CASE_TYPE(PREFIX, OP, QUATERNION) \ CASE_TYPE(PREFIX, OP, AABB) \ CASE_TYPE(PREFIX, OP, BASIS) \ CASE_TYPE(PREFIX, OP, TRANSFORM) \ + CASE_TYPE(PREFIX, OP, TRANSFORM2D) \ + CASE_TYPE(PREFIX, OP, PROJECTION) \ CASE_TYPE(PREFIX, OP, COLOR) \ CASE_TYPE(PREFIX, OP, NODE_PATH) \ - CASE_TYPE(PREFIX, OP, _RID) \ + CASE_TYPE(PREFIX, OP, RID) \ CASE_TYPE(PREFIX, OP, OBJECT) \ CASE_TYPE(PREFIX, OP, STRING_NAME) \ CASE_TYPE(PREFIX, OP, DICTIONARY) \ @@ -71,6 +74,8 @@ CASE_TYPE(PREFIX, OP, POOL_VECTOR2I_ARRAY) \ CASE_TYPE(PREFIX, OP, POOL_VECTOR3_ARRAY) \ CASE_TYPE(PREFIX, OP, POOL_VECTOR3I_ARRAY) \ + CASE_TYPE(PREFIX, OP, POOL_VECTOR4_ARRAY) \ + CASE_TYPE(PREFIX, OP, POOL_VECTOR4I_ARRAY) \ CASE_TYPE(PREFIX, OP, POOL_COLOR_ARRAY) #ifdef __GNUC__ @@ -84,21 +89,24 @@ TYPE(PREFIX, OP, INT), \ TYPE(PREFIX, OP, REAL), \ TYPE(PREFIX, OP, STRING), \ - TYPE(PREFIX, OP, VECTOR2), \ - TYPE(PREFIX, OP, VECTOR2I), \ TYPE(PREFIX, OP, RECT2), \ TYPE(PREFIX, OP, RECT2I), \ + TYPE(PREFIX, OP, VECTOR2), \ + TYPE(PREFIX, OP, VECTOR2I), \ TYPE(PREFIX, OP, VECTOR3), \ TYPE(PREFIX, OP, VECTOR3I), \ - TYPE(PREFIX, OP, TRANSFORM2D), \ + TYPE(PREFIX, OP, VECTOR4), \ + TYPE(PREFIX, OP, VECTOR4I), \ TYPE(PREFIX, OP, PLANE), \ - TYPE(PREFIX, OP, QUATERNION), \ + TYPE(PREFIX, OP, QUATERNION), \ TYPE(PREFIX, OP, AABB), \ TYPE(PREFIX, OP, BASIS), \ TYPE(PREFIX, OP, TRANSFORM), \ + TYPE(PREFIX, OP, TRANSFORM2D), \ + TYPE(PREFIX, OP, PROJECTION), \ TYPE(PREFIX, OP, COLOR), \ TYPE(PREFIX, OP, NODE_PATH), \ - TYPE(PREFIX, OP, _RID), \ + TYPE(PREFIX, OP, RID), \ TYPE(PREFIX, OP, OBJECT), \ TYPE(PREFIX, OP, STRING_NAME), \ TYPE(PREFIX, OP, DICTIONARY), \ @@ -111,12 +119,14 @@ TYPE(PREFIX, OP, POOL_VECTOR2I_ARRAY), \ TYPE(PREFIX, OP, POOL_VECTOR3_ARRAY), \ TYPE(PREFIX, OP, POOL_VECTOR3I_ARRAY), \ + TYPE(PREFIX, OP, POOL_VECTOR4_ARRAY), \ + TYPE(PREFIX, OP, POOL_VECTOR4I_ARRAY), \ TYPE(PREFIX, OP, POOL_COLOR_ARRAY), \ } /* clang-format on */ -#define CASES(PREFIX) static const void *switch_table_##PREFIX[25][33] = { \ +#define CASES(PREFIX) static const void *switch_table_##PREFIX[25][38] = { \ TYPES(PREFIX, OP_EQUAL), \ TYPES(PREFIX, OP_NOT_EQUAL), \ TYPES(PREFIX, OP_LESS), \ @@ -257,6 +267,10 @@ bool Variant::booleanize() const { _RETURN(p_a._data.m_type m_op *reinterpret_cast(p_b._data._mem)); \ if (p_b.type == VECTOR3I) \ _RETURN(p_a._data.m_type m_op *reinterpret_cast(p_b._data._mem)); \ + if (p_b.type == VECTOR4) \ + _RETURN(p_a._data.m_type m_op *reinterpret_cast(p_b._data._mem)); \ + if (p_b.type == VECTOR4I) \ + _RETURN(p_a._data.m_type m_op *reinterpret_cast(p_b._data._mem)); \ \ _RETURN_FAIL \ }; @@ -528,22 +542,25 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_NUM_NULL(math, OP_EQUAL, INT, ==, _int); DEFAULT_OP_NUM_NULL(math, OP_EQUAL, REAL, ==, _real); DEFAULT_OP_STR_NULL(math, OP_EQUAL, STRING, ==, String); - DEFAULT_OP_STR_NULL_SN(math, OP_EQUAL, STRING_NAME, ==, StringName); - DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR2, ==, Vector2); - DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR2I, ==, Vector2i); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, RECT2, ==, Rect2); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, RECT2I, ==, Rect2i); - DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM2D, ==, _transform2d); + DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR2, ==, Vector2); + DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR2I, ==, Vector2i); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR3, ==, Vector3); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR3I, ==, Vector3i); + DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR4, ==, Vector4); + DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR4I, ==, Vector4i); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, PLANE, ==, Plane); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, QUATERNION, ==, Quaternion); DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, AABB, ==, _aabb); DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, BASIS, ==, _basis); DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM, ==, _transform); + DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM2D, ==, _transform2d); + DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, PROJECTION, ==, _projection); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, COLOR, ==, Color); DEFAULT_OP_STR_NULL_NP(math, OP_EQUAL, NODE_PATH, ==, NodePath); - DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, _RID, ==, RID); + DEFAULT_OP_STR_NULL_SN(math, OP_EQUAL, STRING_NAME, ==, StringName); + DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, RID, ==, ::RID); DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_BYTE_ARRAY, uint8_t); DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_INT_ARRAY, int); @@ -553,6 +570,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR2I_ARRAY, Vector2i); DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR3_ARRAY, Vector3); DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR3I_ARRAY, Vector3i); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR4_ARRAY, Vector4); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR4I_ARRAY, Vector4i); DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_COLOR_ARRAY, Color); } @@ -625,22 +644,25 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_NUM_NULL(math, OP_NOT_EQUAL, INT, !=, _int); DEFAULT_OP_NUM_NULL(math, OP_NOT_EQUAL, REAL, !=, _real); DEFAULT_OP_STR_NULL(math, OP_NOT_EQUAL, STRING, !=, String); - DEFAULT_OP_STR_NULL_SN(math, OP_NOT_EQUAL, STRING_NAME, !=, StringName); - DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR2, !=, Vector2); - DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR2I, !=, Vector2i); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, RECT2, !=, Rect2); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, RECT2I, !=, Rect2i); - DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM2D, !=, _transform2d); + DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR2, !=, Vector2); + DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR2I, !=, Vector2i); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR3, !=, Vector3); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR3I, !=, Vector3i); + DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR4, !=, Vector4); + DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR4I, !=, Vector4i); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, PLANE, !=, Plane); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, QUATERNION, !=, Quaternion); DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, AABB, !=, _aabb); DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, BASIS, !=, _basis); DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM, !=, _transform); + DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM2D, !=, _transform2d); + DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, PROJECTION, !=, _projection); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, COLOR, !=, Color); DEFAULT_OP_STR_NULL_NP(math, OP_NOT_EQUAL, NODE_PATH, !=, NodePath); - DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, _RID, !=, RID); + DEFAULT_OP_STR_NULL_SN(math, OP_NOT_EQUAL, STRING_NAME, !=, StringName); + DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, RID, !=, ::RID); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_BYTE_ARRAY, uint8_t); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_INT_ARRAY, int); @@ -650,6 +672,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR2I_ARRAY, Vector2i); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR3_ARRAY, Vector3); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR3I_ARRAY, Vector3i); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR4_ARRAY, Vector4); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR4I_ARRAY, Vector4i); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_COLOR_ARRAY, Color); } @@ -699,7 +723,10 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR2I, <, Vector2i); DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR3, <, Vector3); DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR3I, <, Vector3i); - DEFAULT_OP_LOCALMEM(math, OP_LESS, _RID, <, RID); + DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR4, <, Vector4); + DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR4I, <, Vector4i); + DEFAULT_OP_LOCALMEM(math, OP_LESS, RID, <, ::RID); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_BYTE_ARRAY, uint8_t); DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_INT_ARRAY, int); DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_REAL_ARRAY, real_t); @@ -708,17 +735,20 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR2I_ARRAY, Vector2i); DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR3_ARRAY, Vector3); DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR3I_ARRAY, Vector3i); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR4_ARRAY, Vector4); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR4I_ARRAY, Vector4i); DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_COLOR_ARRAY, Color); CASE_TYPE(math, OP_LESS, NIL) CASE_TYPE(math, OP_LESS, RECT2) CASE_TYPE(math, OP_LESS, RECT2I) - CASE_TYPE(math, OP_LESS, TRANSFORM2D) CASE_TYPE(math, OP_LESS, PLANE) CASE_TYPE(math, OP_LESS, QUATERNION) CASE_TYPE(math, OP_LESS, AABB) CASE_TYPE(math, OP_LESS, BASIS) CASE_TYPE(math, OP_LESS, TRANSFORM) + CASE_TYPE(math, OP_LESS, TRANSFORM2D) + CASE_TYPE(math, OP_LESS, PROJECTION) CASE_TYPE(math, OP_LESS, STRING_NAME) CASE_TYPE(math, OP_LESS, COLOR) CASE_TYPE(math, OP_LESS, NODE_PATH) @@ -740,18 +770,21 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR2I, <=, Vector2i); DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR3, <=, Vector3); DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR3I, <=, Vector3i); - DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, _RID, <=, RID); + DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR4, <=, Vector4); + DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR4I, <=, Vector4i); + DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, RID, <=, ::RID); CASE_TYPE(math, OP_LESS_EQUAL, NIL) CASE_TYPE(math, OP_LESS_EQUAL, BOOL) CASE_TYPE(math, OP_LESS_EQUAL, RECT2) CASE_TYPE(math, OP_LESS_EQUAL, RECT2I) - CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM2D) CASE_TYPE(math, OP_LESS_EQUAL, PLANE) CASE_TYPE(math, OP_LESS_EQUAL, QUATERNION) CASE_TYPE(math, OP_LESS_EQUAL, AABB) CASE_TYPE(math, OP_LESS_EQUAL, BASIS) CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM) + CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM2D) + CASE_TYPE(math, OP_LESS_EQUAL, PROJECTION) CASE_TYPE(math, OP_LESS_EQUAL, COLOR) CASE_TYPE(math, OP_LESS_EQUAL, NODE_PATH) CASE_TYPE(math, OP_LESS_EQUAL, STRING_NAME) @@ -765,6 +798,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR2I_ARRAY); CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR3_ARRAY); CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR3I_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR4_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR4I_ARRAY); CASE_TYPE(math, OP_LESS_EQUAL, POOL_COLOR_ARRAY); _RETURN_FAIL; } @@ -815,7 +850,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR2I, <, Vector2i); DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR3, <, Vector3); DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR3I, <, Vector3i); - DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, _RID, <, RID); + DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR4, <, Vector4); + DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR4I, <, Vector4i); + DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, RID, <, ::RID); DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_BYTE_ARRAY, uint8_t); DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_INT_ARRAY, int); DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_REAL_ARRAY, real_t); @@ -824,18 +861,21 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR2I_ARRAY, Vector2i); DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR3_ARRAY, Vector3); DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR3I_ARRAY, Vector3i); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR4_ARRAY, Vector4); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR4I_ARRAY, Vector4i); DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_COLOR_ARRAY, Color); CASE_TYPE(math, OP_GREATER, NIL) CASE_TYPE(math, OP_GREATER, RECT2) CASE_TYPE(math, OP_GREATER, RECT2I) - CASE_TYPE(math, OP_GREATER, TRANSFORM2D) CASE_TYPE(math, OP_GREATER, PLANE) CASE_TYPE(math, OP_GREATER, QUATERNION) CASE_TYPE(math, OP_GREATER, AABB) CASE_TYPE(math, OP_GREATER, BASIS) CASE_TYPE(math, OP_GREATER, STRING_NAME) CASE_TYPE(math, OP_GREATER, TRANSFORM) + CASE_TYPE(math, OP_GREATER, TRANSFORM2D) + CASE_TYPE(math, OP_GREATER, PROJECTION) CASE_TYPE(math, OP_GREATER, COLOR) CASE_TYPE(math, OP_GREATER, NODE_PATH) CASE_TYPE(math, OP_GREATER, DICTIONARY) @@ -856,18 +896,21 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR2I, <=, Vector2i); DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR3, <=, Vector3); DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR3I, <=, Vector3i); - DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, _RID, <=, RID); + DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR4, <=, Vector4); + DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR4I, <=, Vector4i); + DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, RID, <=, ::RID); CASE_TYPE(math, OP_GREATER_EQUAL, NIL) CASE_TYPE(math, OP_GREATER_EQUAL, BOOL) CASE_TYPE(math, OP_GREATER_EQUAL, RECT2) CASE_TYPE(math, OP_GREATER_EQUAL, RECT2I) - CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM2D) CASE_TYPE(math, OP_GREATER_EQUAL, PLANE) CASE_TYPE(math, OP_GREATER_EQUAL, QUATERNION) CASE_TYPE(math, OP_GREATER_EQUAL, AABB) CASE_TYPE(math, OP_GREATER_EQUAL, BASIS) CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM) + CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM2D) + CASE_TYPE(math, OP_GREATER_EQUAL, PROJECTION) CASE_TYPE(math, OP_GREATER_EQUAL, COLOR) CASE_TYPE(math, OP_GREATER_EQUAL, NODE_PATH) CASE_TYPE(math, OP_GREATER_EQUAL, DICTIONARY) @@ -881,6 +924,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR2I_ARRAY); CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR3_ARRAY); CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR3I_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR4_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR4I_ARRAY); CASE_TYPE(math, OP_GREATER_EQUAL, POOL_COLOR_ARRAY); _RETURN_FAIL; } @@ -912,6 +957,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR2I, +, Vector2i); DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR3, +, Vector3); DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR3I, +, Vector3i); + DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR4, +, Vector4); + DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR4I, +, Vector4i); DEFAULT_OP_LOCALMEM(math, OP_ADD, QUATERNION, +, Quaternion); DEFAULT_OP_LOCALMEM(math, OP_ADD, COLOR, +, Color); @@ -923,19 +970,22 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR2I_ARRAY, Vector2i); DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR3_ARRAY, Vector3); DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR3I_ARRAY, Vector3i); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR4_ARRAY, Vector4); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR4I_ARRAY, Vector4i); DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_COLOR_ARRAY, Color); CASE_TYPE(math, OP_ADD, NIL) CASE_TYPE(math, OP_ADD, BOOL) CASE_TYPE(math, OP_ADD, RECT2) CASE_TYPE(math, OP_ADD, RECT2I) - CASE_TYPE(math, OP_ADD, TRANSFORM2D) CASE_TYPE(math, OP_ADD, PLANE) CASE_TYPE(math, OP_ADD, AABB) CASE_TYPE(math, OP_ADD, BASIS) CASE_TYPE(math, OP_ADD, TRANSFORM) + CASE_TYPE(math, OP_ADD, TRANSFORM2D) + CASE_TYPE(math, OP_ADD, PROJECTION) CASE_TYPE(math, OP_ADD, NODE_PATH) - CASE_TYPE(math, OP_ADD, _RID) + CASE_TYPE(math, OP_ADD, RID) CASE_TYPE(math, OP_ADD, OBJECT) CASE_TYPE(math, OP_ADD, DICTIONARY) CASE_TYPE(math, OP_ADD, STRING_NAME) @@ -949,6 +999,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR2I, -, Vector2i); DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR3, -, Vector3); DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR3I, -, Vector3i); + DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR4, -, Vector4); + DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR4I, -, Vector4i); DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, QUATERNION, -, Quaternion); DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, COLOR, -, Color); @@ -957,13 +1009,14 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_SUBTRACT, STRING) CASE_TYPE(math, OP_SUBTRACT, RECT2) CASE_TYPE(math, OP_SUBTRACT, RECT2I) - CASE_TYPE(math, OP_SUBTRACT, TRANSFORM2D) CASE_TYPE(math, OP_SUBTRACT, PLANE) CASE_TYPE(math, OP_SUBTRACT, AABB) CASE_TYPE(math, OP_SUBTRACT, BASIS) CASE_TYPE(math, OP_SUBTRACT, TRANSFORM) + CASE_TYPE(math, OP_SUBTRACT, TRANSFORM2D) + CASE_TYPE(math, OP_SUBTRACT, PROJECTION) CASE_TYPE(math, OP_SUBTRACT, NODE_PATH) - CASE_TYPE(math, OP_SUBTRACT, _RID) + CASE_TYPE(math, OP_SUBTRACT, RID) CASE_TYPE(math, OP_SUBTRACT, OBJECT) CASE_TYPE(math, OP_SUBTRACT, STRING_NAME) CASE_TYPE(math, OP_SUBTRACT, DICTIONARY) @@ -976,27 +1029,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR2I_ARRAY); CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR3_ARRAY); CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR3I_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR4_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR4I_ARRAY); CASE_TYPE(math, OP_SUBTRACT, POOL_COLOR_ARRAY); _RETURN_FAIL; } SWITCH_OP(math, OP_MULTIPLY, p_a.type) { - CASE_TYPE(math, OP_MULTIPLY, TRANSFORM2D) { - switch (p_b.type) { - case TRANSFORM2D: { - _RETURN(*p_a._data._transform2d * *p_b._data._transform2d); - } - case VECTOR2: { - _RETURN(p_a._data._transform2d->xform(*(const Vector2 *)p_b._data._mem)); - } - case VECTOR2I: { - _RETURN(p_a._data._transform2d->xform(*(const Vector2i *)p_b._data._mem)); - } - default: - _RETURN_FAIL; - } - } - CASE_TYPE(math, OP_MULTIPLY, QUATERNION) { switch (p_b.type) { case VECTOR3: { @@ -1048,12 +1087,46 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, } } + CASE_TYPE(math, OP_MULTIPLY, TRANSFORM2D) { + switch (p_b.type) { + case TRANSFORM2D: { + _RETURN(*p_a._data._transform2d * *p_b._data._transform2d); + } + case VECTOR2: { + _RETURN(p_a._data._transform2d->xform(*(const Vector2 *)p_b._data._mem)); + } + case VECTOR2I: { + _RETURN(p_a._data._transform2d->xform(*(const Vector2i *)p_b._data._mem)); + } + default: + _RETURN_FAIL; + } + } + + CASE_TYPE(math, OP_MULTIPLY, PROJECTION) { + switch (p_b.type) { + case VECTOR4: { + _RETURN(p_a._data._projection->xform(*(const Vector4 *)p_b._data._mem)); + } + case VECTOR3: { + _RETURN(p_a._data._projection->xform(*(const Vector3 *)p_b._data._mem)); + } + case PLANE: { + _RETURN(p_a._data._projection->xform(*(const Plane *)p_b._data._mem)); + } + default: + _RETURN_FAIL; + } + } + DEFAULT_OP_NUM_VEC(math, OP_MULTIPLY, INT, *, _int); DEFAULT_OP_NUM_VEC(math, OP_MULTIPLY, REAL, *, _real); DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR2, *, Vector2); DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR2I, *, Vector2i); DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR3, *, Vector3); DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR3I, *, Vector3i); + DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR4, *, Vector4); + DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR4I, *, Vector4i); DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, COLOR, *, Color); CASE_TYPE(math, OP_MULTIPLY, NIL) @@ -1064,7 +1137,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MULTIPLY, PLANE) CASE_TYPE(math, OP_MULTIPLY, AABB) CASE_TYPE(math, OP_MULTIPLY, NODE_PATH) - CASE_TYPE(math, OP_MULTIPLY, _RID) + CASE_TYPE(math, OP_MULTIPLY, RID) CASE_TYPE(math, OP_MULTIPLY, OBJECT) CASE_TYPE(math, OP_MULTIPLY, STRING_NAME) CASE_TYPE(math, OP_MULTIPLY, DICTIONARY) @@ -1077,6 +1150,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR2I_ARRAY); CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR3_ARRAY); CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR3I_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR4_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR4I_ARRAY); CASE_TYPE(math, OP_MULTIPLY, POOL_COLOR_ARRAY); _RETURN_FAIL; } @@ -1100,6 +1175,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR2I, /, Vector2i); DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR3, /, Vector3); DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR3I, /, Vector3i); + DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR4, /, Vector4); + DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR4I, /, Vector4i); DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, COLOR, /, Color); CASE_TYPE(math, OP_DIVIDE, NIL) @@ -1107,13 +1184,14 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_DIVIDE, STRING) CASE_TYPE(math, OP_DIVIDE, RECT2) CASE_TYPE(math, OP_DIVIDE, RECT2I) - CASE_TYPE(math, OP_DIVIDE, TRANSFORM2D) CASE_TYPE(math, OP_DIVIDE, PLANE) CASE_TYPE(math, OP_DIVIDE, AABB) CASE_TYPE(math, OP_DIVIDE, BASIS) CASE_TYPE(math, OP_DIVIDE, TRANSFORM) + CASE_TYPE(math, OP_DIVIDE, TRANSFORM2D) + CASE_TYPE(math, OP_DIVIDE, PROJECTION) CASE_TYPE(math, OP_DIVIDE, NODE_PATH) - CASE_TYPE(math, OP_DIVIDE, _RID) + CASE_TYPE(math, OP_DIVIDE, RID) CASE_TYPE(math, OP_DIVIDE, OBJECT) CASE_TYPE(math, OP_DIVIDE, STRING_NAME) CASE_TYPE(math, OP_DIVIDE, DICTIONARY) @@ -1126,6 +1204,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR2I_ARRAY); CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR3_ARRAY); CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR3I_ARRAY); + CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR4_ARRAY); + CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR4I_ARRAY); CASE_TYPE(math, OP_DIVIDE, POOL_COLOR_ARRAY); _RETURN_FAIL; } @@ -1133,25 +1213,28 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, SWITCH_OP(math, OP_POSITIVE, p_a.type) { DEFAULT_OP_NUM_POS(math, OP_POSITIVE, INT, _int); DEFAULT_OP_NUM_POS(math, OP_POSITIVE, REAL, _real); - DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR3, Vector3); - DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR3I, Vector3i); - DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, PLANE, Plane); - DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, QUATERNION, Quaternion); DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR2, Vector2); DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR2I, Vector2i); + DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR3, Vector3); + DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR3I, Vector3i); + DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR4, Vector4); + DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR4I, Vector4i); + DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, PLANE, Plane); + DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, QUATERNION, Quaternion); CASE_TYPE(math, OP_POSITIVE, NIL) CASE_TYPE(math, OP_POSITIVE, BOOL) CASE_TYPE(math, OP_POSITIVE, STRING) CASE_TYPE(math, OP_POSITIVE, RECT2) CASE_TYPE(math, OP_POSITIVE, RECT2I) - CASE_TYPE(math, OP_POSITIVE, TRANSFORM2D) CASE_TYPE(math, OP_POSITIVE, AABB) CASE_TYPE(math, OP_POSITIVE, BASIS) CASE_TYPE(math, OP_POSITIVE, TRANSFORM) + CASE_TYPE(math, OP_POSITIVE, TRANSFORM2D) + CASE_TYPE(math, OP_POSITIVE, PROJECTION) CASE_TYPE(math, OP_POSITIVE, COLOR) CASE_TYPE(math, OP_POSITIVE, NODE_PATH) - CASE_TYPE(math, OP_POSITIVE, _RID) + CASE_TYPE(math, OP_POSITIVE, RID) CASE_TYPE(math, OP_POSITIVE, OBJECT) CASE_TYPE(math, OP_POSITIVE, STRING_NAME) CASE_TYPE(math, OP_POSITIVE, DICTIONARY) @@ -1164,6 +1247,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR2I_ARRAY) CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR3_ARRAY) CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR3I_ARRAY) + CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR4_ARRAY) + CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR4I_ARRAY) CASE_TYPE(math, OP_POSITIVE, POOL_COLOR_ARRAY) _RETURN_FAIL; } @@ -1176,6 +1261,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR2I, Vector2i); DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR3, Vector3); DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR3I, Vector3i); + DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR4, Vector4); + DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR4I, Vector4i); DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, PLANE, Plane); DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, QUATERNION, Quaternion); DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, COLOR, Color); @@ -1185,12 +1272,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_NEGATE, STRING) CASE_TYPE(math, OP_NEGATE, RECT2) CASE_TYPE(math, OP_NEGATE, RECT2I) - CASE_TYPE(math, OP_NEGATE, TRANSFORM2D) CASE_TYPE(math, OP_NEGATE, AABB) CASE_TYPE(math, OP_NEGATE, BASIS) CASE_TYPE(math, OP_NEGATE, TRANSFORM) + CASE_TYPE(math, OP_NEGATE, TRANSFORM2D) + CASE_TYPE(math, OP_NEGATE, PROJECTION) CASE_TYPE(math, OP_NEGATE, NODE_PATH) - CASE_TYPE(math, OP_NEGATE, _RID) + CASE_TYPE(math, OP_NEGATE, RID) CASE_TYPE(math, OP_NEGATE, OBJECT) CASE_TYPE(math, OP_NEGATE, STRING_NAME) CASE_TYPE(math, OP_NEGATE, DICTIONARY) @@ -1203,6 +1291,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_NEGATE, POOL_VECTOR2I_ARRAY) CASE_TYPE(math, OP_NEGATE, POOL_VECTOR3_ARRAY) CASE_TYPE(math, OP_NEGATE, POOL_VECTOR3I_ARRAY) + CASE_TYPE(math, OP_NEGATE, POOL_VECTOR4_ARRAY) + CASE_TYPE(math, OP_NEGATE, POOL_VECTOR4I_ARRAY) CASE_TYPE(math, OP_NEGATE, POOL_COLOR_ARRAY) _RETURN_FAIL; } @@ -1242,21 +1332,24 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MODULE, NIL) CASE_TYPE(math, OP_MODULE, BOOL) CASE_TYPE(math, OP_MODULE, REAL) - CASE_TYPE(math, OP_MODULE, VECTOR2) - CASE_TYPE(math, OP_MODULE, VECTOR2I) CASE_TYPE(math, OP_MODULE, RECT2) CASE_TYPE(math, OP_MODULE, RECT2I) + CASE_TYPE(math, OP_MODULE, VECTOR2) + CASE_TYPE(math, OP_MODULE, VECTOR2I) CASE_TYPE(math, OP_MODULE, VECTOR3) CASE_TYPE(math, OP_MODULE, VECTOR3I) - CASE_TYPE(math, OP_MODULE, TRANSFORM2D) + CASE_TYPE(math, OP_MODULE, VECTOR4) + CASE_TYPE(math, OP_MODULE, VECTOR4I) CASE_TYPE(math, OP_MODULE, PLANE) CASE_TYPE(math, OP_MODULE, QUATERNION) CASE_TYPE(math, OP_MODULE, AABB) CASE_TYPE(math, OP_MODULE, BASIS) CASE_TYPE(math, OP_MODULE, TRANSFORM) + CASE_TYPE(math, OP_MODULE, TRANSFORM2D) + CASE_TYPE(math, OP_MODULE, PROJECTION) CASE_TYPE(math, OP_MODULE, COLOR) CASE_TYPE(math, OP_MODULE, NODE_PATH) - CASE_TYPE(math, OP_MODULE, _RID) + CASE_TYPE(math, OP_MODULE, RID) CASE_TYPE(math, OP_MODULE, OBJECT) CASE_TYPE(math, OP_MODULE, STRING_NAME) CASE_TYPE(math, OP_MODULE, DICTIONARY) @@ -1269,6 +1362,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MODULE, POOL_VECTOR2I_ARRAY) CASE_TYPE(math, OP_MODULE, POOL_VECTOR3_ARRAY) CASE_TYPE(math, OP_MODULE, POOL_VECTOR3I_ARRAY) + CASE_TYPE(math, OP_MODULE, POOL_VECTOR4_ARRAY) + CASE_TYPE(math, OP_MODULE, POOL_VECTOR4I_ARRAY) CASE_TYPE(math, OP_MODULE, POOL_COLOR_ARRAY) _RETURN_FAIL; } @@ -1391,50 +1486,6 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, void Variant::set_named(const StringName &p_index, const Variant &p_value, bool *r_valid) { bool valid = false; switch (type) { - case VECTOR2: { - if (p_value.type == Variant::INT) { - Vector2 *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->x) { - v->x = p_value._data._int; - valid = true; - } else if (p_index == CoreStringNames::singleton->y) { - v->y = p_value._data._int; - valid = true; - } - } else if (p_value.type == Variant::REAL) { - Vector2 *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->x) { - v->x = p_value._data._real; - valid = true; - } else if (p_index == CoreStringNames::singleton->y) { - v->y = p_value._data._real; - valid = true; - } - } - - } break; - case VECTOR2I: { - if (p_value.type == Variant::INT) { - Vector2i *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->x) { - v->x = p_value._data._int; - valid = true; - } else if (p_index == CoreStringNames::singleton->y) { - v->y = p_value._data._int; - valid = true; - } - } else if (p_value.type == Variant::REAL) { - Vector2i *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->x) { - v->x = static_cast(p_value._data._real); - valid = true; - } else if (p_index == CoreStringNames::singleton->y) { - v->y = static_cast(p_value._data._real); - valid = true; - } - } - - } break; case RECT2: { if (p_value.type == Variant::VECTOR2) { Rect2 *v = reinterpret_cast(_data._mem); @@ -1493,29 +1544,45 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool } } } break; - case TRANSFORM2D: { - if (p_value.type == Variant::VECTOR2) { - Transform2D *v = _data._transform2d; + case VECTOR2: { + if (p_value.type == Variant::INT) { + Vector2 *v = reinterpret_cast(_data._mem); if (p_index == CoreStringNames::singleton->x) { - v->columns[0] = *reinterpret_cast(p_value._data._mem); + v->x = p_value._data._int; valid = true; } else if (p_index == CoreStringNames::singleton->y) { - v->columns[1] = *reinterpret_cast(p_value._data._mem); - valid = true; - } else if (p_index == CoreStringNames::singleton->origin) { - v->columns[2] = *reinterpret_cast(p_value._data._mem); + v->y = p_value._data._int; valid = true; } - } else if (p_value.type == Variant::VECTOR2I) { - Transform2D *v = _data._transform2d; + } else if (p_value.type == Variant::REAL) { + Vector2 *v = reinterpret_cast(_data._mem); if (p_index == CoreStringNames::singleton->x) { - v->columns[0] = *reinterpret_cast(p_value._data._mem); + v->x = p_value._data._real; valid = true; } else if (p_index == CoreStringNames::singleton->y) { - v->columns[1] = *reinterpret_cast(p_value._data._mem); + v->y = p_value._data._real; valid = true; - } else if (p_index == CoreStringNames::singleton->origin) { - v->columns[2] = *reinterpret_cast(p_value._data._mem); + } + } + + } break; + case VECTOR2I: { + if (p_value.type == Variant::INT) { + Vector2i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + v->x = p_value._data._int; + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->y = p_value._data._int; + valid = true; + } + } else if (p_value.type == Variant::REAL) { + Vector2i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + v->x = static_cast(p_value._data._real); + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->y = static_cast(p_value._data._real); valid = true; } } @@ -1576,6 +1643,74 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool } } + } break; + case VECTOR4: { + if (p_value.type == Variant::INT) { + Vector4 *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + v->x = p_value._data._int; + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->y = p_value._data._int; + valid = true; + } else if (p_index == CoreStringNames::singleton->z) { + v->z = p_value._data._int; + valid = true; + } else if (p_index == CoreStringNames::singleton->w) { + v->w = p_value._data._int; + valid = true; + } + } else if (p_value.type == Variant::REAL) { + Vector4 *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + v->x = p_value._data._real; + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->y = p_value._data._real; + valid = true; + } else if (p_index == CoreStringNames::singleton->z) { + v->z = p_value._data._real; + valid = true; + } else if (p_index == CoreStringNames::singleton->w) { + v->w = p_value._data._real; + valid = true; + } + } + + } break; + case VECTOR4I: { + if (p_value.type == Variant::INT) { + Vector4i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + v->x = p_value._data._int; + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->y = p_value._data._int; + valid = true; + } else if (p_index == CoreStringNames::singleton->z) { + v->z = p_value._data._int; + valid = true; + } else if (p_index == CoreStringNames::singleton->w) { + v->w = p_value._data._int; + valid = true; + } + } else if (p_value.type == Variant::REAL) { + Vector4i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + v->x = p_value._data._real; + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->y = p_value._data._real; + valid = true; + } else if (p_index == CoreStringNames::singleton->z) { + v->z = p_value._data._real; + valid = true; + } else if (p_index == CoreStringNames::singleton->w) { + v->w = p_value._data._real; + valid = true; + } + } + } break; case PLANE: { if (p_value.type == Variant::INT) { @@ -1722,6 +1857,53 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool valid = true; } + } break; + case TRANSFORM2D: { + if (p_value.type == Variant::VECTOR2) { + Transform2D *v = _data._transform2d; + if (p_index == CoreStringNames::singleton->x) { + v->columns[0] = *reinterpret_cast(p_value._data._mem); + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->columns[1] = *reinterpret_cast(p_value._data._mem); + valid = true; + } else if (p_index == CoreStringNames::singleton->origin) { + v->columns[2] = *reinterpret_cast(p_value._data._mem); + valid = true; + } + } else if (p_value.type == Variant::VECTOR2I) { + Transform2D *v = _data._transform2d; + if (p_index == CoreStringNames::singleton->x) { + v->columns[0] = *reinterpret_cast(p_value._data._mem); + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->columns[1] = *reinterpret_cast(p_value._data._mem); + valid = true; + } else if (p_index == CoreStringNames::singleton->origin) { + v->columns[2] = *reinterpret_cast(p_value._data._mem); + valid = true; + } + } + + } break; + case PROJECTION: { + if (p_value.type == Variant::VECTOR4) { + Projection *v = _data._projection; + if (p_index == CoreStringNames::singleton->x) { + v->matrix[0] = *reinterpret_cast(p_value._data._mem); + valid = true; + } else if (p_index == CoreStringNames::singleton->y) { + v->matrix[1] = *reinterpret_cast(p_value._data._mem); + valid = true; + } else if (p_index == CoreStringNames::singleton->z) { + v->matrix[2] = *reinterpret_cast(p_value._data._mem); + valid = true; + } else if (p_index == CoreStringNames::singleton->w) { + v->matrix[3] = *reinterpret_cast(p_value._data._mem); + valid = true; + } + } + } break; case COLOR: { if (p_value.type == Variant::INT) { @@ -1826,24 +2008,6 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { *r_valid = true; } switch (type) { - case VECTOR2: { - const Vector2 *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->x) { - return v->x; - } else if (p_index == CoreStringNames::singleton->y) { - return v->y; - } - - } break; - case VECTOR2I: { - const Vector2i *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->x) { - return v->x; - } else if (p_index == CoreStringNames::singleton->y) { - return v->y; - } - - } break; case RECT2: { const Rect2 *v = reinterpret_cast(_data._mem); //scalar name @@ -1866,14 +2030,21 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { return v->size + v->position; } } break; - case TRANSFORM2D: { - const Transform2D *v = _data._transform2d; + case VECTOR2: { + const Vector2 *v = reinterpret_cast(_data._mem); if (p_index == CoreStringNames::singleton->x) { - return v->columns[0]; + return v->x; } else if (p_index == CoreStringNames::singleton->y) { - return v->columns[1]; - } else if (p_index == CoreStringNames::singleton->origin) { - return v->columns[2]; + return v->y; + } + + } break; + case VECTOR2I: { + const Vector2i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + return v->x; + } else if (p_index == CoreStringNames::singleton->y) { + return v->y; } } break; @@ -1898,6 +2069,32 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { return v->z; } + } break; + case VECTOR4: { + const Vector4 *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + return v->x; + } else if (p_index == CoreStringNames::singleton->y) { + return v->y; + } else if (p_index == CoreStringNames::singleton->z) { + return v->z; + } else if (p_index == CoreStringNames::singleton->w) { + return v->w; + } + + } break; + case VECTOR4I: { + const Vector4i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + return v->x; + } else if (p_index == CoreStringNames::singleton->y) { + return v->y; + } else if (p_index == CoreStringNames::singleton->z) { + return v->z; + } else if (p_index == CoreStringNames::singleton->w) { + return v->w; + } + } break; case PLANE: { const Plane *v = reinterpret_cast(_data._mem); @@ -1957,6 +2154,30 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { return _data._transform->origin; } + } break; + case TRANSFORM2D: { + const Transform2D *v = _data._transform2d; + if (p_index == CoreStringNames::singleton->x) { + return v->columns[0]; + } else if (p_index == CoreStringNames::singleton->y) { + return v->columns[1]; + } else if (p_index == CoreStringNames::singleton->origin) { + return v->columns[2]; + } + + } break; + case PROJECTION: { + const Projection *v = _data._projection; + if (p_index == CoreStringNames::singleton->x) { + return v->matrix[0]; + } else if (p_index == CoreStringNames::singleton->y) { + return v->matrix[1]; + } else if (p_index == CoreStringNames::singleton->z) { + return v->matrix[2]; + } else if (p_index == CoreStringNames::singleton->w) { + return v->matrix[3]; + } + } break; case COLOR: { const Color *v = reinterpret_cast(_data._mem); @@ -2103,102 +2324,6 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) return; } break; - case VECTOR2: { - if (p_value.type != Variant::INT && p_value.type != Variant::REAL) { - return; - } - - if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { - // scalar index - int idx = p_index; - - if (idx < 0) { - idx += 2; - } - if (idx >= 0 && idx < 2) { - Vector2 *v = reinterpret_cast(_data._mem); - valid = true; - (*v)[idx] = p_value; - return; - } - } else if (p_index.get_type() == Variant::STRING) { - //scalar name - - const String *str = reinterpret_cast(p_index._data._mem); - Vector2 *v = reinterpret_cast(_data._mem); - if (*str == "x") { - valid = true; - v->x = p_value; - return; - } else if (*str == "y") { - valid = true; - v->y = p_value; - return; - } - } else if (p_index.get_type() == Variant::STRING_NAME) { - //scalar name - - Vector2 *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->x) { - valid = true; - v->x = p_value; - return; - } else if (p_index == CoreStringNames::singleton->y) { - valid = true; - v->y = p_value; - return; - } - } - - } break; // 5 - case VECTOR2I: { - if (p_value.type != Variant::INT && p_value.type != Variant::REAL) { - return; - } - - if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { - // scalar index - int idx = p_index; - - if (idx < 0) { - idx += 2; - } - if (idx >= 0 && idx < 2) { - Vector2i *v = reinterpret_cast(_data._mem); - valid = true; - (*v)[idx] = p_value; - return; - } - } else if (p_index.get_type() == Variant::STRING) { - //scalar name - - const String *str = reinterpret_cast(p_index._data._mem); - Vector2i *v = reinterpret_cast(_data._mem); - if (*str == "x") { - valid = true; - v->x = p_value; - return; - } else if (*str == "y") { - valid = true; - v->y = p_value; - return; - } - } else if (p_index.get_type() == Variant::STRING_NAME) { - //scalar name - - Vector2i *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->x) { - valid = true; - v->x = p_value; - return; - } else if (p_index == CoreStringNames::singleton->y) { - valid = true; - v->y = p_value; - return; - } - } - - } break; //6 case RECT2: { if (p_value.type == Variant::VECTOR2 || p_value.type == Variant::VECTOR2I) { if (p_index.get_type() == Variant::STRING) { @@ -2284,61 +2409,102 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) return; } } break; - case TRANSFORM2D: { - if (p_value.type != Variant::VECTOR2 || p_value.get_type() != Variant::VECTOR2I) { + case VECTOR2: { + if (p_value.type != Variant::INT && p_value.type != Variant::REAL) { return; } if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { - int index = p_index; + // scalar index + int idx = p_index; - if (index < 0) { - index += 3; + if (idx < 0) { + idx += 2; } - if (index >= 0 && index < 3) { - Transform2D *v = _data._transform2d; - + if (idx >= 0 && idx < 2) { + Vector2 *v = reinterpret_cast(_data._mem); valid = true; - v->columns[index] = p_value; + (*v)[idx] = p_value; return; } } else if (p_index.get_type() == Variant::STRING) { //scalar name + const String *str = reinterpret_cast(p_index._data._mem); - Transform2D *v = _data._transform2d; + Vector2 *v = reinterpret_cast(_data._mem); if (*str == "x") { valid = true; - v->columns[0] = p_value; + v->x = p_value; return; } else if (*str == "y") { valid = true; - v->columns[1] = p_value; - return; - } else if (*str == "origin") { - valid = true; - v->columns[2] = p_value; + v->y = p_value; return; } } else if (p_index.get_type() == Variant::STRING_NAME) { //scalar name - Transform2D *v = _data._transform2d; + Vector2 *v = reinterpret_cast(_data._mem); if (p_index == CoreStringNames::singleton->x) { valid = true; - v->columns[0] = p_value; + v->x = p_value; return; } else if (p_index == CoreStringNames::singleton->y) { valid = true; - v->columns[1] = p_value; + v->y = p_value; return; - } else if (p_index == CoreStringNames::singleton->origin) { + } + } + } break; // 5 + case VECTOR2I: { + if (p_value.type != Variant::INT && p_value.type != Variant::REAL) { + return; + } + + if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { + // scalar index + int idx = p_index; + + if (idx < 0) { + idx += 2; + } + if (idx >= 0 && idx < 2) { + Vector2i *v = reinterpret_cast(_data._mem); valid = true; - v->columns[2] = p_value; + (*v)[idx] = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING) { + //scalar name + + const String *str = reinterpret_cast(p_index._data._mem); + Vector2i *v = reinterpret_cast(_data._mem); + if (*str == "x") { + valid = true; + v->x = p_value; + return; + } else if (*str == "y") { + valid = true; + v->y = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + //scalar name + + Vector2i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + valid = true; + v->x = p_value; + return; + } else if (p_index == CoreStringNames::singleton->y) { + valid = true; + v->y = p_value; return; } } - } break; + } break; //6 + case VECTOR3: { if (p_value.type != Variant::INT && p_value.type != Variant::REAL) { return; @@ -2446,6 +2612,129 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) } } + } break; + case VECTOR4: { + if (p_value.type != Variant::INT && p_value.type != Variant::REAL) { + return; + } + + if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { + //scalar index + int idx = p_index; + if (idx < 0) { + idx += 4; + } + if (idx >= 0 && idx < 4) { + Vector4 *v = reinterpret_cast(_data._mem); + valid = true; + (*v)[idx] = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING) { + //scalar name + const String *str = reinterpret_cast(p_index._data._mem); + Vector4 *v = reinterpret_cast(_data._mem); + if (*str == "x") { + valid = true; + v->x = p_value; + return; + } else if (*str == "y") { + valid = true; + v->y = p_value; + return; + } else if (*str == "z") { + valid = true; + v->z = p_value; + return; + } else if (*str == "w") { + valid = true; + v->w = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + //scalar name + + Vector4 *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + valid = true; + v->x = p_value; + return; + } else if (p_index == CoreStringNames::singleton->y) { + valid = true; + v->y = p_value; + return; + } else if (p_index == CoreStringNames::singleton->z) { + valid = true; + v->z = p_value; + return; + } else if (p_index == CoreStringNames::singleton->w) { + valid = true; + v->w = p_value; + return; + } + } + } break; + case VECTOR4I: { + if (p_value.type != Variant::INT && p_value.type != Variant::REAL) { + return; + } + + if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { + //scalar index + int idx = p_index; + if (idx < 0) { + idx += 4; + } + if (idx >= 0 && idx < 4) { + Vector4i *v = reinterpret_cast(_data._mem); + valid = true; + (*v)[idx] = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING) { + //scalar name + const String *str = reinterpret_cast(p_index._data._mem); + Vector4 *v = reinterpret_cast(_data._mem); + if (*str == "x") { + valid = true; + v->x = p_value; + return; + } else if (*str == "y") { + valid = true; + v->y = p_value; + return; + } else if (*str == "z") { + valid = true; + v->z = p_value; + return; + } else if (*str == "w") { + valid = true; + v->w = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + //scalar name + + Vector4i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + valid = true; + v->x = p_value; + return; + } else if (p_index == CoreStringNames::singleton->y) { + valid = true; + v->y = p_value; + return; + } else if (p_index == CoreStringNames::singleton->z) { + valid = true; + v->z = p_value; + return; + } else if (p_index == CoreStringNames::singleton->w) { + valid = true; + v->w = p_value; + return; + } + } + } break; case PLANE: { if (p_index.get_type() == Variant::STRING) { @@ -2738,6 +3027,130 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) } } + } break; + case TRANSFORM2D: { + if (p_value.type != Variant::VECTOR2 || p_value.get_type() != Variant::VECTOR2I) { + return; + } + + if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { + int index = p_index; + + if (index < 0) { + index += 3; + } + if (index >= 0 && index < 3) { + Transform2D *v = _data._transform2d; + + valid = true; + v->columns[index] = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING) { + //scalar name + const String *str = reinterpret_cast(p_index._data._mem); + Transform2D *v = _data._transform2d; + if (*str == "x") { + valid = true; + v->columns[0] = p_value; + return; + } else if (*str == "y") { + valid = true; + v->columns[1] = p_value; + return; + } else if (*str == "origin") { + valid = true; + v->columns[2] = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + //scalar name + + Transform2D *v = _data._transform2d; + if (p_index == CoreStringNames::singleton->x) { + valid = true; + v->columns[0] = p_value; + return; + } else if (p_index == CoreStringNames::singleton->y) { + valid = true; + v->columns[1] = p_value; + return; + } else if (p_index == CoreStringNames::singleton->origin) { + valid = true; + v->columns[2] = p_value; + return; + } + } + + } break; + case PROJECTION: { + if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { + if (p_value.type != Variant::VECTOR4) { + return; + } + + int index = p_index; + + if (index < 0) { + index += 4; + } + if (index >= 0 && index < 4) { + Projection *v = _data._projection; + valid = true; + v->matrix[index] = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING) { + Projection *v = _data._projection; + const String *str = reinterpret_cast(p_index._data._mem); + + if (p_value.type != Variant::VECTOR4) { + return; + } + + if (*str == "x") { + valid = true; + v->matrix[0] = p_value; + return; + } else if (*str == "y") { + valid = true; + v->matrix[1] = p_value; + return; + } else if (*str == "z") { + valid = true; + v->matrix[2] = p_value; + return; + } else if (*str == "w") { + valid = true; + v->matrix[3] = p_value; + return; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + Projection *v = _data._projection; + + if (p_value.type != Variant::VECTOR4) { + return; + } + + if (p_index == CoreStringNames::singleton->x) { + valid = true; + v->matrix[0] = p_value; + return; + } else if (p_index == CoreStringNames::singleton->y) { + valid = true; + v->matrix[1] = p_value; + return; + } else if (p_index == CoreStringNames::singleton->z) { + valid = true; + v->matrix[2] = p_value; + return; + } else if (p_index == CoreStringNames::singleton->w) { + valid = true; + v->matrix[3] = p_value; + return; + } + } + } break; case COLOR: { if (p_value.type != Variant::INT && p_value.type != Variant::REAL) { @@ -2854,7 +3267,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) } break; case NODE_PATH: { } break; // 15 - case _RID: { + case RID: { } break; case OBJECT: { Object *obj = _OBJ_PTR(*this); @@ -2933,6 +3346,70 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } break; + case RECT2: { + if (p_index.get_type() == Variant::STRING) { + //scalar name + + const String *str = reinterpret_cast(p_index._data._mem); + const Rect2 *v = reinterpret_cast(_data._mem); + if (*str == "position") { + valid = true; + return v->position; + } else if (*str == "size") { + valid = true; + return v->size; + } else if (*str == "end") { + valid = true; + return v->size + v->position; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + //scalar name + + const Rect2 *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->position) { + valid = true; + return v->position; + } else if (p_index == CoreStringNames::singleton->size) { + valid = true; + return v->size; + } else if (p_index == CoreStringNames::singleton->end) { + valid = true; + return v->size + v->position; + } + } + } break; + case RECT2I: { + if (p_index.get_type() == Variant::STRING) { + //scalar name + + const String *str = reinterpret_cast(p_index._data._mem); + const Rect2i *v = reinterpret_cast(_data._mem); + if (*str == "position") { + valid = true; + return v->position; + } else if (*str == "size") { + valid = true; + return v->size; + } else if (*str == "end") { + valid = true; + return v->size + v->position; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + //scalar name + + const Rect2i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->position) { + valid = true; + return v->position; + } else if (p_index == CoreStringNames::singleton->size) { + valid = true; + return v->size; + } else if (p_index == CoreStringNames::singleton->end) { + valid = true; + return v->size + v->position; + } + } + } break; case VECTOR2: { if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { // scalar index @@ -3009,70 +3486,6 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } break; // 6 - case RECT2: { - if (p_index.get_type() == Variant::STRING) { - //scalar name - - const String *str = reinterpret_cast(p_index._data._mem); - const Rect2 *v = reinterpret_cast(_data._mem); - if (*str == "position") { - valid = true; - return v->position; - } else if (*str == "size") { - valid = true; - return v->size; - } else if (*str == "end") { - valid = true; - return v->size + v->position; - } - } else if (p_index.get_type() == Variant::STRING_NAME) { - //scalar name - - const Rect2 *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->position) { - valid = true; - return v->position; - } else if (p_index == CoreStringNames::singleton->size) { - valid = true; - return v->size; - } else if (p_index == CoreStringNames::singleton->end) { - valid = true; - return v->size + v->position; - } - } - } break; - case RECT2I: { - if (p_index.get_type() == Variant::STRING) { - //scalar name - - const String *str = reinterpret_cast(p_index._data._mem); - const Rect2i *v = reinterpret_cast(_data._mem); - if (*str == "position") { - valid = true; - return v->position; - } else if (*str == "size") { - valid = true; - return v->size; - } else if (*str == "end") { - valid = true; - return v->size + v->position; - } - } else if (p_index.get_type() == Variant::STRING_NAME) { - //scalar name - - const Rect2i *v = reinterpret_cast(_data._mem); - if (p_index == CoreStringNames::singleton->position) { - valid = true; - return v->position; - } else if (p_index == CoreStringNames::singleton->size) { - valid = true; - return v->size; - } else if (p_index == CoreStringNames::singleton->end) { - valid = true; - return v->size + v->position; - } - } - } break; case VECTOR3: { if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { //scalar index @@ -3159,46 +3572,99 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } break; - case TRANSFORM2D: { + case VECTOR4: { if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { - int index = p_index; - - if (index < 0) { - index += 3; + //scalar index + int idx = p_index; + if (idx < 0) { + idx += 4; } - if (index >= 0 && index < 3) { - const Transform2D *v = _data._transform2d; - + if (idx >= 0 && idx < 4) { + const Vector4 *v = reinterpret_cast(_data._mem); valid = true; - return v->columns[index]; + return (*v)[idx]; } } else if (p_index.get_type() == Variant::STRING) { //scalar name const String *str = reinterpret_cast(p_index._data._mem); - const Transform2D *v = _data._transform2d; + const Vector4 *v = reinterpret_cast(_data._mem); if (*str == "x") { valid = true; - return v->columns[0]; + return v->x; } else if (*str == "y") { valid = true; - return v->columns[1]; - } else if (*str == "origin") { + return v->y; + } else if (*str == "z") { valid = true; - return v->columns[2]; + return v->z; + } else if (*str == "w") { + valid = true; + return v->w; } } else if (p_index.get_type() == Variant::STRING_NAME) { //scalar name - const Transform2D *v = _data._transform2d; + const Vector4 *v = reinterpret_cast(_data._mem); if (p_index == CoreStringNames::singleton->x) { valid = true; - return v->columns[0]; + return v->x; } else if (p_index == CoreStringNames::singleton->y) { valid = true; - return v->columns[1]; - } else if (p_index == CoreStringNames::singleton->origin) { + return v->y; + } else if (p_index == CoreStringNames::singleton->z) { valid = true; - return v->columns[2]; + return v->z; + } else if (p_index == CoreStringNames::singleton->w) { + valid = true; + return v->w; + } + } + + } break; + case VECTOR4I: { + if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { + //scalar index + int idx = p_index; + if (idx < 0) { + idx += 4; + } + if (idx >= 0 && idx < 4) { + const Vector4i *v = reinterpret_cast(_data._mem); + valid = true; + return (*v)[idx]; + } + } else if (p_index.get_type() == Variant::STRING) { + //scalar name + const String *str = reinterpret_cast(p_index._data._mem); + const Vector4i *v = reinterpret_cast(_data._mem); + if (*str == "x") { + valid = true; + return v->x; + } else if (*str == "y") { + valid = true; + return v->y; + } else if (*str == "z") { + valid = true; + return v->z; + } else if (*str == "w") { + valid = true; + return v->w; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + //scalar name + const Vector4i *v = reinterpret_cast(_data._mem); + if (p_index == CoreStringNames::singleton->x) { + valid = true; + return v->x; + } else if (p_index == CoreStringNames::singleton->y) { + valid = true; + return v->y; + } else if (p_index == CoreStringNames::singleton->z) { + valid = true; + return v->z; + } else if (p_index == CoreStringNames::singleton->w) { + valid = true; + return v->w; } } @@ -3392,6 +3858,97 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } + } break; + case TRANSFORM2D: { + if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { + int index = p_index; + + if (index < 0) { + index += 3; + } + if (index >= 0 && index < 3) { + const Transform2D *v = _data._transform2d; + + valid = true; + return v->columns[index]; + } + } else if (p_index.get_type() == Variant::STRING) { + //scalar name + const String *str = reinterpret_cast(p_index._data._mem); + const Transform2D *v = _data._transform2d; + if (*str == "x") { + valid = true; + return v->columns[0]; + } else if (*str == "y") { + valid = true; + return v->columns[1]; + } else if (*str == "origin") { + valid = true; + return v->columns[2]; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + //scalar name + + const Transform2D *v = _data._transform2d; + if (p_index == CoreStringNames::singleton->x) { + valid = true; + return v->columns[0]; + } else if (p_index == CoreStringNames::singleton->y) { + valid = true; + return v->columns[1]; + } else if (p_index == CoreStringNames::singleton->origin) { + valid = true; + return v->columns[2]; + } + } + + } break; + case PROJECTION: { + if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { + int index = p_index; + if (index < 0) { + index += 4; + } + if (index >= 0 && index < 4) { + const Projection *v = _data._projection; + valid = true; + return v->matrix[index]; + } + } else if (p_index.get_type() == Variant::STRING) { + const Projection *v = _data._projection; + const String *str = reinterpret_cast(p_index._data._mem); + + if (*str == "x") { + valid = true; + return v->matrix[0]; + } else if (*str == "y") { + valid = true; + return v->matrix[1]; + } else if (*str == "z") { + valid = true; + return v->matrix[2]; + } else if (*str == "w") { + valid = true; + return v->matrix[3]; + } + } else if (p_index.get_type() == Variant::STRING_NAME) { + const Projection *v = _data._projection; + + if (p_index == CoreStringNames::singleton->x) { + valid = true; + return v->matrix[0]; + } else if (p_index == CoreStringNames::singleton->y) { + valid = true; + return v->matrix[1]; + } else if (p_index == CoreStringNames::singleton->z) { + valid = true; + return v->matrix[2]; + } else if (p_index == CoreStringNames::singleton->w) { + valid = true; + return v->matrix[3]; + } + } + } break; case COLOR: { if (p_index.get_type() == Variant::STRING) { @@ -3482,7 +4039,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } break; case NODE_PATH: { } break; // 15 - case _RID: { + case RID: { } break; case OBJECT: { Object *obj = _OBJ_PTR(*this); @@ -3522,6 +4079,8 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { DEFAULT_OP_DVECTOR_GET(POOL_VECTOR2I_ARRAY, Vector2i) DEFAULT_OP_DVECTOR_GET(POOL_VECTOR3_ARRAY, Vector3) DEFAULT_OP_DVECTOR_GET(POOL_VECTOR3I_ARRAY, Vector3i) + DEFAULT_OP_DVECTOR_GET(POOL_VECTOR4_ARRAY, Vector4) + DEFAULT_OP_DVECTOR_GET(POOL_VECTOR4I_ARRAY, Vector4i) DEFAULT_OP_DVECTOR_GET(POOL_COLOR_ARRAY, Color) default: return Variant(); @@ -3734,6 +4293,44 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { return false; } + } break; + case POOL_VECTOR4_ARRAY: { + if (p_index.get_type() == Variant::VECTOR4) { + Vector4 index = p_index; + const PoolVector *arr = reinterpret_cast *>(_data._mem); + + int l = arr->size(); + if (l) { + PoolVector::Read r = arr->read(); + for (int i = 0; i < l; i++) { + if (r[i] == index) { + return true; + } + } + } + + return false; + } + + } break; + case POOL_VECTOR4I_ARRAY: { + if (p_index.get_type() == Variant::VECTOR4I) { + Vector4i index = p_index; + const PoolVector *arr = reinterpret_cast *>(_data._mem); + + int l = arr->size(); + if (l) { + PoolVector::Read r = arr->read(); + for (int i = 0; i < l; i++) { + if (r[i] == index) { + return true; + } + } + } + + return false; + } + } break; case POOL_COLOR_ARRAY: { if (p_index.get_type() == Variant::COLOR) { @@ -3765,16 +4362,6 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { void Variant::get_property_list(List *p_list) const { switch (type) { - case VECTOR2: { - p_list->push_back(PropertyInfo(Variant::REAL, "x")); - p_list->push_back(PropertyInfo(Variant::REAL, "y")); - - } break; - case VECTOR2I: { - p_list->push_back(PropertyInfo(Variant::INT, "x")); - p_list->push_back(PropertyInfo(Variant::INT, "y")); - - } break; case RECT2: { p_list->push_back(PropertyInfo(Variant::VECTOR2, "position")); p_list->push_back(PropertyInfo(Variant::VECTOR2, "size")); @@ -3786,6 +4373,16 @@ void Variant::get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::VECTOR2I, "size")); p_list->push_back(PropertyInfo(Variant::VECTOR2I, "end")); + } break; + case VECTOR2: { + p_list->push_back(PropertyInfo(Variant::REAL, "x")); + p_list->push_back(PropertyInfo(Variant::REAL, "y")); + + } break; + case VECTOR2I: { + p_list->push_back(PropertyInfo(Variant::INT, "x")); + p_list->push_back(PropertyInfo(Variant::INT, "y")); + } break; case VECTOR3: { p_list->push_back(PropertyInfo(Variant::REAL, "x")); @@ -3799,10 +4396,18 @@ void Variant::get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::INT, "z")); } break; - case TRANSFORM2D: { - p_list->push_back(PropertyInfo(Variant::VECTOR2, "x")); - p_list->push_back(PropertyInfo(Variant::VECTOR2, "y")); - p_list->push_back(PropertyInfo(Variant::VECTOR2, "origin")); + case VECTOR4: { + p_list->push_back(PropertyInfo(Variant::REAL, "x")); + p_list->push_back(PropertyInfo(Variant::REAL, "y")); + p_list->push_back(PropertyInfo(Variant::REAL, "z")); + p_list->push_back(PropertyInfo(Variant::REAL, "w")); + + } break; + case VECTOR4I: { + p_list->push_back(PropertyInfo(Variant::INT, "x")); + p_list->push_back(PropertyInfo(Variant::INT, "y")); + p_list->push_back(PropertyInfo(Variant::INT, "z")); + p_list->push_back(PropertyInfo(Variant::INT, "w")); } break; case PLANE: { @@ -3835,6 +4440,19 @@ void Variant::get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::BASIS, "basis")); p_list->push_back(PropertyInfo(Variant::VECTOR3, "origin")); + } break; + case TRANSFORM2D: { + p_list->push_back(PropertyInfo(Variant::VECTOR2, "x")); + p_list->push_back(PropertyInfo(Variant::VECTOR2, "y")); + p_list->push_back(PropertyInfo(Variant::VECTOR2, "origin")); + + } break; + case PROJECTION: { + p_list->push_back(PropertyInfo(Variant::VECTOR4, "x")); + p_list->push_back(PropertyInfo(Variant::VECTOR4, "y")); + p_list->push_back(PropertyInfo(Variant::VECTOR4, "z")); + p_list->push_back(PropertyInfo(Variant::VECTOR4, "w")); + } break; case COLOR: { p_list->push_back(PropertyInfo(Variant::REAL, "r")); @@ -3852,7 +4470,7 @@ void Variant::get_property_list(List *p_list) const { } break; case NODE_PATH: { } break; - case _RID: { + case RID: { } break; case OBJECT: { Object *obj = _OBJ_PTR(*this); @@ -3886,6 +4504,8 @@ void Variant::get_property_list(List *p_list) const { case POOL_VECTOR2I_ARRAY: case POOL_VECTOR3_ARRAY: case POOL_VECTOR3I_ARRAY: + case POOL_VECTOR4_ARRAY: + case POOL_VECTOR4I_ARRAY: case POOL_COLOR_ARRAY: { //nothing } break; @@ -4075,6 +4695,22 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { r_iter = 0; return true; } break; + case POOL_VECTOR4_ARRAY: { + const PoolVector *arr = reinterpret_cast *>(_data._mem); + if (arr->size() == 0) { + return false; + } + r_iter = 0; + return true; + } break; + case POOL_VECTOR4I_ARRAY: { + const PoolVector *arr = reinterpret_cast *>(_data._mem); + if (arr->size() == 0) { + return false; + } + r_iter = 0; + return true; + } break; case POOL_COLOR_ARRAY: { const PoolVector *arr = reinterpret_cast *>(_data._mem); if (arr->size() == 0) { @@ -4317,6 +4953,26 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { r_iter = idx; return true; } break; + case POOL_VECTOR4_ARRAY: { + const PoolVector *arr = reinterpret_cast *>(_data._mem); + int idx = r_iter; + idx++; + if (idx >= arr->size()) { + return false; + } + r_iter = idx; + return true; + } break; + case POOL_VECTOR4I_ARRAY: { + const PoolVector *arr = reinterpret_cast *>(_data._mem); + int idx = r_iter; + idx++; + if (idx >= arr->size()) { + return false; + } + r_iter = idx; + return true; + } break; case POOL_COLOR_ARRAY: { const PoolVector *arr = reinterpret_cast *>(_data._mem); int idx = r_iter; @@ -4486,6 +5142,28 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { r_valid = false; return Variant(); } +#endif + return arr->get(idx); + } break; + case POOL_VECTOR4_ARRAY: { + const PoolVector *arr = reinterpret_cast *>(_data._mem); + int idx = r_iter; +#ifdef DEBUG_ENABLED + if (idx < 0 || idx >= arr->size()) { + r_valid = false; + return Variant(); + } +#endif + return arr->get(idx); + } break; + case POOL_VECTOR4I_ARRAY: { + const PoolVector *arr = reinterpret_cast *>(_data._mem); + int idx = r_iter; +#ifdef DEBUG_ENABLED + if (idx < 0 || idx >= arr->size()) { + r_valid = false; + return Variant(); + } #endif return arr->get(idx); } break; @@ -4552,18 +5230,6 @@ void Variant::sub(const Variant &a, const Variant &b, Variant &r_dst) { r_dst = ra - rb; } return; - case VECTOR2: { - r_dst = *reinterpret_cast(a._data._mem) - *reinterpret_cast(b._data._mem); - } - return; - case VECTOR2I: { - int32_t vax = reinterpret_cast(a._data._mem)->x; - int32_t vbx = reinterpret_cast(b._data._mem)->x; - int32_t vay = reinterpret_cast(a._data._mem)->y; - int32_t vby = reinterpret_cast(b._data._mem)->y; - r_dst = Vector2i(int32_t(vax - vbx), int32_t(vay - vby)); - } - return; case RECT2: { const Rect2 *ra = reinterpret_cast(a._data._mem); const Rect2 *rb = reinterpret_cast(b._data._mem); @@ -4586,6 +5252,18 @@ void Variant::sub(const Variant &a, const Variant &b, Variant &r_dst) { r_dst = Rect2i(int32_t(vax - vbx), int32_t(vay - vby), int32_t(vcx - vdx), int32_t(vcy - vdy)); } return; + case VECTOR2: { + r_dst = *reinterpret_cast(a._data._mem) - *reinterpret_cast(b._data._mem); + } + return; + case VECTOR2I: { + int32_t vax = reinterpret_cast(a._data._mem)->x; + int32_t vbx = reinterpret_cast(b._data._mem)->x; + int32_t vay = reinterpret_cast(a._data._mem)->y; + int32_t vby = reinterpret_cast(b._data._mem)->y; + r_dst = Vector2i(int32_t(vax - vbx), int32_t(vay - vby)); + } + return; case VECTOR3: { r_dst = *reinterpret_cast(a._data._mem) - *reinterpret_cast(b._data._mem); } @@ -4600,6 +5278,22 @@ void Variant::sub(const Variant &a, const Variant &b, Variant &r_dst) { r_dst = Vector3i(int32_t(vax - vbx), int32_t(vay - vby), int32_t(vaz - vbz)); } return; + case VECTOR4: { + r_dst = *reinterpret_cast(a._data._mem) - *reinterpret_cast(b._data._mem); + } + return; + case VECTOR4I: { + int32_t vax = reinterpret_cast(a._data._mem)->x; + int32_t vbx = reinterpret_cast(b._data._mem)->x; + int32_t vay = reinterpret_cast(a._data._mem)->y; + int32_t vaw = reinterpret_cast(a._data._mem)->w; + int32_t vby = reinterpret_cast(b._data._mem)->y; + int32_t vaz = reinterpret_cast(a._data._mem)->z; + int32_t vbz = reinterpret_cast(b._data._mem)->z; + int32_t vbw = reinterpret_cast(b._data._mem)->w; + r_dst = Vector4i(int32_t(vax - vbx), int32_t(vay - vby), int32_t(vaz - vbz), int32_t(vaw - vbw)); + } + return; case AABB: { const ::AABB *ra = reinterpret_cast(a._data._mem); const ::AABB *rb = reinterpret_cast(b._data._mem); @@ -4663,14 +5357,6 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) r_dst = ra + rb * c; } return; - case VECTOR2: { - r_dst = *reinterpret_cast(a._data._mem) + *reinterpret_cast(b._data._mem) * c; - } - return; - case VECTOR2I: { - r_dst = *reinterpret_cast(a._data._mem) + *reinterpret_cast(b._data._mem) * c; - } - return; case RECT2: { const Rect2 *ra = reinterpret_cast(a._data._mem); const Rect2 *rb = reinterpret_cast(b._data._mem); @@ -4683,6 +5369,14 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) r_dst = Rect2(ra->position + rb->position * c, ra->size + rb->size * c); } return; + case VECTOR2: { + r_dst = *reinterpret_cast(a._data._mem) + *reinterpret_cast(b._data._mem) * c; + } + return; + case VECTOR2I: { + r_dst = *reinterpret_cast(a._data._mem) + *reinterpret_cast(b._data._mem) * c; + } + return; case VECTOR3: { r_dst = *reinterpret_cast(a._data._mem) + *reinterpret_cast(b._data._mem) * c; } @@ -4691,6 +5385,14 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) r_dst = *reinterpret_cast(a._data._mem) + *reinterpret_cast(b._data._mem) * c; } return; + case VECTOR4: { + r_dst = *reinterpret_cast(a._data._mem) + *reinterpret_cast(b._data._mem) * c; + } + return; + case VECTOR4I: { + r_dst = *reinterpret_cast(a._data._mem) + *reinterpret_cast(b._data._mem) * c; + } + return; case AABB: { const ::AABB *ra = reinterpret_cast(a._data._mem); const ::AABB *rb = reinterpret_cast(b._data._mem); @@ -4800,14 +5502,6 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = dst; } return; - case VECTOR2: { - r_dst = reinterpret_cast(a._data._mem)->linear_interpolate(*reinterpret_cast(b._data._mem), c); - } - return; - case VECTOR2I: { - r_dst = reinterpret_cast(a._data._mem)->linear_interpolate(*reinterpret_cast(b._data._mem), c); - } - return; case RECT2: { r_dst = Rect2(reinterpret_cast(a._data._mem)->position.linear_interpolate(reinterpret_cast(b._data._mem)->position, c), reinterpret_cast(a._data._mem)->size.linear_interpolate(reinterpret_cast(b._data._mem)->size, c)); } @@ -4816,6 +5510,14 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = Rect2(reinterpret_cast(a._data._mem)->position.linear_interpolate(reinterpret_cast(b._data._mem)->position, c), reinterpret_cast(a._data._mem)->size.linear_interpolate(reinterpret_cast(b._data._mem)->size, c)); } return; + case VECTOR2: { + r_dst = reinterpret_cast(a._data._mem)->linear_interpolate(*reinterpret_cast(b._data._mem), c); + } + return; + case VECTOR2I: { + r_dst = reinterpret_cast(a._data._mem)->linear_interpolate(*reinterpret_cast(b._data._mem), c); + } + return; case VECTOR3: { r_dst = reinterpret_cast(a._data._mem)->linear_interpolate(*reinterpret_cast(b._data._mem), c); } @@ -4824,8 +5526,13 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = reinterpret_cast(a._data._mem)->linear_interpolate(*reinterpret_cast(b._data._mem), c); } return; - case TRANSFORM2D: { - r_dst = a._data._transform2d->interpolate_with(*b._data._transform2d, c); + case VECTOR4: { + r_dst = reinterpret_cast(a._data._mem)->lerp(*reinterpret_cast(b._data._mem), c); + } + return; + case VECTOR4I: { + //r_dst = reinterpret_cast(a._data._mem)->lerp(*reinterpret_cast(b._data._mem), c); + r_dst = a; } return; case PLANE: { @@ -4848,6 +5555,10 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = a._data._transform->interpolate_with(*b._data._transform, c); } return; + case TRANSFORM2D: { + r_dst = a._data._transform2d->interpolate_with(*b._data._transform2d, c); + } + return; case COLOR: { r_dst = reinterpret_cast(a._data._mem)->linear_interpolate(*reinterpret_cast(b._data._mem), c); } @@ -4856,7 +5567,7 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = a; } return; - case _RID: { + case RID: { r_dst = a; } return; @@ -5019,6 +5730,53 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & } } return; + case POOL_VECTOR4_ARRAY: { + const PoolVector *arr_a = reinterpret_cast *>(a._data._mem); + const PoolVector *arr_b = reinterpret_cast *>(b._data._mem); + int sz = arr_a->size(); + if (sz == 0 || arr_b->size() != sz) { + r_dst = a; + } else { + PoolVector v; + v.resize(sz); + { + PoolVector::Write vw = v.write(); + PoolVector::Read ar = arr_a->read(); + PoolVector::Read br = arr_b->read(); + + for (int i = 0; i < sz; i++) { + vw[i] = ar[i].lerp(br[i], c); + } + } + r_dst = v; + } + } + return; + case POOL_VECTOR4I_ARRAY: { + /* + const PoolVector *arr_a = reinterpret_cast *>(a._data._mem); + const PoolVector *arr_b = reinterpret_cast *>(b._data._mem); + int sz = arr_a->size(); + if (sz == 0 || arr_b->size() != sz) { + r_dst = a; + } else { + PoolVector v; + v.resize(sz); + { + PoolVector::Write vw = v.write(); + PoolVector::Read ar = arr_a->read(); + PoolVector::Read br = arr_b->read(); + + for (int i = 0; i < sz; i++) { + vw[i] = ar[i].lerp(br[i], c); + } + } + r_dst = v; + } + */ + r_dst = a; + } + return; case POOL_COLOR_ARRAY: { const PoolVector *arr_a = reinterpret_cast *>(a._data._mem); const PoolVector *arr_b = reinterpret_cast *>(b._data._mem); diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index fd4485fa0..90695af88 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -538,32 +538,6 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, value = -Math_INF; } else if (id == "nan") { value = Math_NAN; - } else if (id == "Vector2") { - Vector args; - Error err = _parse_construct(p_stream, args, line, r_err_str); - if (err) { - return err; - } - - if (args.size() != 2) { - r_err_str = "Expected 2 arguments for constructor"; - return ERR_PARSE_ERROR; - } - - value = Vector2(args[0], args[1]); - } else if (id == "Vector2i") { - Vector args; - Error err = _parse_construct(p_stream, args, line, r_err_str); - if (err) { - return err; - } - - if (args.size() != 2) { - r_err_str = "Expected 2 arguments for constructor"; - return ERR_PARSE_ERROR; - } - - value = Vector2i(args[0], args[1]); } else if (id == "Rect2") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); @@ -590,6 +564,32 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, } value = Rect2i(args[0], args[1], args[2], args[3]); + } else if (id == "Vector2") { + Vector args; + Error err = _parse_construct(p_stream, args, line, r_err_str); + if (err) { + return err; + } + + if (args.size() != 2) { + r_err_str = "Expected 2 arguments for constructor"; + return ERR_PARSE_ERROR; + } + + value = Vector2(args[0], args[1]); + } else if (id == "Vector2i") { + Vector args; + Error err = _parse_construct(p_stream, args, line, r_err_str); + if (err) { + return err; + } + + if (args.size() != 2) { + r_err_str = "Expected 2 arguments for constructor"; + return ERR_PARSE_ERROR; + } + + value = Vector2i(args[0], args[1]); } else if (id == "Vector3") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); @@ -616,23 +616,32 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, } value = Vector3i(args[0], args[1], args[2]); - } else if (id == "Transform2D" || id == "Matrix32") { //compatibility + } else if (id == "Vector4") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); if (err) { return err; } - if (args.size() != 6) { - r_err_str = "Expected 6 arguments for constructor"; + if (args.size() != 4) { + r_err_str = "Expected 4 arguments for constructor"; return ERR_PARSE_ERROR; } - Transform2D m; - m[0] = Vector2(args[0], args[1]); - m[1] = Vector2(args[2], args[3]); - m[2] = Vector2(args[4], args[5]); - value = m; + value = Vector4(args[0], args[1], args[2], args[3]); + } else if (id == "Vector4i") { + Vector args; + Error err = _parse_construct(p_stream, args, line, r_err_str); + if (err) { + return err; + } + + if (args.size() != 4) { + r_err_str = "Expected 4 arguments for constructor"; + return ERR_PARSE_ERROR; + } + + value = Vector4i(args[0], args[1], args[2], args[3]); } else if (id == "Plane") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); @@ -672,7 +681,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, } value = AABB(Vector3(args[0], args[1], args[2]), Vector3(args[3], args[4], args[5])); - } else if (id == "Basis" || id == "Matrix3") { //compatibility + } else if (id == "Basis") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); if (err) { @@ -698,6 +707,36 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, } value = Transform(Basis(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]), Vector3(args[9], args[10], args[11])); + } else if (id == "Transform2D") { + Vector args; + Error err = _parse_construct(p_stream, args, line, r_err_str); + if (err) { + return err; + } + + if (args.size() != 6) { + r_err_str = "Expected 6 arguments for constructor"; + return ERR_PARSE_ERROR; + } + + Transform2D m; + m[0] = Vector2(args[0], args[1]); + m[1] = Vector2(args[2], args[3]); + m[2] = Vector2(args[4], args[5]); + value = m; + } else if (id == "Projection") { + Vector args; + Error err = _parse_construct(p_stream, args, line, r_err_str); + if (err) { + return err; + } + + if (args.size() != 16) { + r_err_str = "Expected 16 arguments for constructor"; + return ERR_PARSE_ERROR; + } + + value = Projection(Vector4(args[0], args[1], args[2], args[3]), Vector4(args[4], args[5], args[6], args[7]), Vector4(args[8], args[9], args[10], args[11]), Vector4(args[12], args[13], args[14], args[15])); } else if (id == "Color") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); @@ -900,189 +939,6 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return ERR_PARSE_ERROR; } } -#ifndef DISABLE_DEPRECATED - } else if (id == "InputEvent") { - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_PARENTHESIS_OPEN) { - r_err_str = "Expected '('"; - return ERR_PARSE_ERROR; - } - - get_token(p_stream, token, line, r_err_str); - - if (token.type != TK_IDENTIFIER) { - r_err_str = "Expected identifier"; - return ERR_PARSE_ERROR; - } - - String id2 = token.value; - - Ref ie; - - if (id2 == "NONE") { - get_token(p_stream, token, line, r_err_str); - - if (token.type != TK_PARENTHESIS_CLOSE) { - r_err_str = "Expected ')'"; - return ERR_PARSE_ERROR; - } - - } else if (id2 == "KEY") { - Ref key; - key.instance(); - ie = key; - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_COMMA) { - r_err_str = "Expected ','"; - return ERR_PARSE_ERROR; - } - - get_token(p_stream, token, line, r_err_str); - if (token.type == TK_IDENTIFIER) { - String name = token.value; - key->set_scancode(find_keycode(name)); - } else if (token.type == TK_NUMBER) { - key->set_scancode(token.value); - } else { - r_err_str = "Expected string or integer for keycode"; - return ERR_PARSE_ERROR; - } - - get_token(p_stream, token, line, r_err_str); - - if (token.type == TK_COMMA) { - get_token(p_stream, token, line, r_err_str); - - if (token.type != TK_IDENTIFIER) { - r_err_str = "Expected identifier with modifier flas"; - return ERR_PARSE_ERROR; - } - - String mods = token.value; - - if (mods.findn("C") != -1) { - key->set_control(true); - } - if (mods.findn("A") != -1) { - key->set_alt(true); - } - if (mods.findn("S") != -1) { - key->set_shift(true); - } - if (mods.findn("M") != -1) { - key->set_metakey(true); - } - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_PARENTHESIS_CLOSE) { - r_err_str = "Expected ')'"; - return ERR_PARSE_ERROR; - } - - } else if (token.type != TK_PARENTHESIS_CLOSE) { - r_err_str = "Expected ')' or modifier flags."; - return ERR_PARSE_ERROR; - } - - } else if (id2 == "MBUTTON") { - Ref mb; - mb.instance(); - ie = mb; - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_COMMA) { - r_err_str = "Expected ','"; - return ERR_PARSE_ERROR; - } - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_NUMBER) { - r_err_str = "Expected button index"; - return ERR_PARSE_ERROR; - } - - mb->set_button_index(token.value); - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_PARENTHESIS_CLOSE) { - r_err_str = "Expected ')'"; - return ERR_PARSE_ERROR; - } - - } else if (id2 == "JBUTTON") { - Ref jb; - jb.instance(); - ie = jb; - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_COMMA) { - r_err_str = "Expected ','"; - return ERR_PARSE_ERROR; - } - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_NUMBER) { - r_err_str = "Expected button index"; - return ERR_PARSE_ERROR; - } - - jb->set_button_index(token.value); - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_PARENTHESIS_CLOSE) { - r_err_str = "Expected ')'"; - return ERR_PARSE_ERROR; - } - - } else if (id2 == "JAXIS") { - Ref jm; - jm.instance(); - ie = jm; - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_COMMA) { - r_err_str = "Expected ','"; - return ERR_PARSE_ERROR; - } - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_NUMBER) { - r_err_str = "Expected axis index"; - return ERR_PARSE_ERROR; - } - - jm->set_axis(token.value); - - get_token(p_stream, token, line, r_err_str); - - if (token.type != TK_COMMA) { - r_err_str = "Expected ',' after axis index"; - return ERR_PARSE_ERROR; - } - - get_token(p_stream, token, line, r_err_str); - if (token.type != TK_NUMBER) { - r_err_str = "Expected axis sign"; - return ERR_PARSE_ERROR; - } - - jm->set_axis_value(token.value); - - get_token(p_stream, token, line, r_err_str); - - if (token.type != TK_PARENTHESIS_CLOSE) { - r_err_str = "Expected ')' for jaxis"; - return ERR_PARSE_ERROR; - } - - } else { - r_err_str = "Invalid input event type."; - return ERR_PARSE_ERROR; - } - - value = ie; -#endif } else if (id == "PoolByteArray" || id == "ByteArray") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); @@ -1263,6 +1119,44 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, value = arr; + } else if (id == "PoolVector4Array" || id == "Vector4Array") { + Vector args; + Error err = _parse_construct(p_stream, args, line, r_err_str); + if (err) { + return err; + } + + PoolVector arr; + { + int len = args.size() / 3; + arr.resize(len); + PoolVector::Write w = arr.write(); + for (int i = 0; i < len; i++) { + w[i] = Vector4(args[i * 4 + 0], args[i * 4 + 1], args[i * 4 + 2], args[i * 4 + 3]); + } + } + + value = arr; + + } else if (id == "PoolVector4iArray" || id == "Vector4iArray") { + Vector args; + Error err = _parse_construct(p_stream, args, line, r_err_str); + if (err) { + return err; + } + + PoolVector arr; + { + int len = args.size() / 3; + arr.resize(len); + PoolVector::Write w = arr.write(); + for (int i = 0; i < len; i++) { + w[i] = Vector4i(args[i * 4 + 0], args[i * 4 + 1], args[i * 4 + 2], args[i * 4 + 3]); + } + } + + value = arr; + } else if (id == "PoolColorArray" || id == "ColorArray") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); @@ -1666,14 +1560,6 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str str = "\"" + str.c_escape_multiline() + "\""; p_store_string_func(p_store_string_ud, str); } break; - case Variant::VECTOR2: { - Vector2 v = p_variant; - p_store_string_func(p_store_string_ud, "Vector2( " + rtos_fix(v.x) + ", " + rtos_fix(v.y) + " )"); - } break; - case Variant::VECTOR2I: { - Vector2i v = p_variant; - p_store_string_func(p_store_string_ud, "Vector2i( " + rtos_fix(v.x) + ", " + rtos_fix(v.y) + " )"); - } break; case Variant::RECT2: { Rect2 aabb = p_variant; p_store_string_func(p_store_string_ud, "Rect2( " + rtos_fix(aabb.position.x) + ", " + rtos_fix(aabb.position.y) + ", " + rtos_fix(aabb.size.x) + ", " + rtos_fix(aabb.size.y) + " )"); @@ -1684,6 +1570,14 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, "Rect2i( " + rtos_fix(aabb.position.x) + ", " + rtos_fix(aabb.position.y) + ", " + rtos_fix(aabb.size.x) + ", " + rtos_fix(aabb.size.y) + " )"); } break; + case Variant::VECTOR2: { + Vector2 v = p_variant; + p_store_string_func(p_store_string_ud, "Vector2( " + rtos_fix(v.x) + ", " + rtos_fix(v.y) + " )"); + } break; + case Variant::VECTOR2I: { + Vector2i v = p_variant; + p_store_string_func(p_store_string_ud, "Vector2i( " + rtos_fix(v.x) + ", " + rtos_fix(v.y) + " )"); + } break; case Variant::VECTOR3: { Vector3 v = p_variant; p_store_string_func(p_store_string_ud, "Vector3( " + rtos_fix(v.x) + ", " + rtos_fix(v.y) + ", " + rtos_fix(v.z) + " )"); @@ -1692,34 +1586,27 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str Vector3i v = p_variant; p_store_string_func(p_store_string_ud, "Vector3i( " + rtos_fix(v.x) + ", " + rtos_fix(v.y) + ", " + rtos_fix(v.z) + " )"); } break; + case Variant::VECTOR4: { + Vector4 v = p_variant; + p_store_string_func(p_store_string_ud, "Vector4( " + rtos_fix(v.x) + ", " + rtos_fix(v.y) + ", " + rtos_fix(v.z) + ", " + rtos_fix(v.w) + " )"); + } break; + case Variant::VECTOR4I: { + Vector4i v = p_variant; + p_store_string_func(p_store_string_ud, "Vector4i( " + rtos_fix(v.x) + ", " + rtos_fix(v.y) + ", " + rtos_fix(v.z) + ", " + rtos_fix(v.w) + " )"); + } break; case Variant::PLANE: { Plane p = p_variant; p_store_string_func(p_store_string_ud, "Plane( " + rtos_fix(p.normal.x) + ", " + rtos_fix(p.normal.y) + ", " + rtos_fix(p.normal.z) + ", " + rtos_fix(p.d) + " )"); - } break; - case Variant::AABB: { - AABB aabb = p_variant; - p_store_string_func(p_store_string_ud, "AABB( " + rtos_fix(aabb.position.x) + ", " + rtos_fix(aabb.position.y) + ", " + rtos_fix(aabb.position.z) + ", " + rtos_fix(aabb.size.x) + ", " + rtos_fix(aabb.size.y) + ", " + rtos_fix(aabb.size.z) + " )"); - } break; case Variant::QUATERNION: { Quaternion quat = p_variant; p_store_string_func(p_store_string_ud, "Quaternion( " + rtos_fix(quat.x) + ", " + rtos_fix(quat.y) + ", " + rtos_fix(quat.z) + ", " + rtos_fix(quat.w) + " )"); } break; - case Variant::TRANSFORM2D: { - String s = "Transform2D( "; - Transform2D m3 = p_variant; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - if (i != 0 || j != 0) { - s += ", "; - } - s += rtos_fix(m3.columns[i][j]); - } - } - - p_store_string_func(p_store_string_ud, s + " )"); + case Variant::AABB: { + AABB aabb = p_variant; + p_store_string_func(p_store_string_ud, "AABB( " + rtos_fix(aabb.position.x) + ", " + rtos_fix(aabb.position.y) + ", " + rtos_fix(aabb.position.z) + ", " + rtos_fix(aabb.size.x) + ", " + rtos_fix(aabb.size.y) + ", " + rtos_fix(aabb.size.z) + " )"); } break; case Variant::BASIS: { @@ -1754,6 +1641,35 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, s + " )"); } break; + case Variant::TRANSFORM2D: { + String s = "Transform2D( "; + Transform2D m3 = p_variant; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 2; j++) { + if (i != 0 || j != 0) { + s += ", "; + } + s += rtos_fix(m3.columns[i][j]); + } + } + + p_store_string_func(p_store_string_ud, s + " )"); + + } break; + case Variant::PROJECTION: { + String s = "Projection("; + Projection t = p_variant; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + if (i != 0 || j != 0) { + s += ", "; + } + s += rtos_fix(t.matrix[i][j]); + } + } + + p_store_string_func(p_store_string_ud, s + ")"); + } break; // misc types case Variant::COLOR: { @@ -1768,7 +1684,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, str); } break; - + //RID case Variant::OBJECT: { Object *obj = p_variant; @@ -1826,7 +1742,6 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, ")\n"); } break; - case Variant::STRING_NAME: { String str = p_variant; @@ -1834,7 +1749,6 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, str); } break; - case Variant::DICTIONARY: { Dictionary dict = p_variant; @@ -2015,6 +1929,41 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, " )"); + } break; + + case Variant::POOL_VECTOR4_ARRAY: { + p_store_string_func(p_store_string_ud, "PoolVector4Array( "); + PoolVector data = p_variant; + int len = data.size(); + PoolVector::Read r = data.read(); + const Vector4 *ptr = r.ptr(); + + for (int i = 0; i < len; i++) { + if (i > 0) { + p_store_string_func(p_store_string_ud, ", "); + } + p_store_string_func(p_store_string_ud, rtos_fix(ptr[i].x) + ", " + rtos_fix(ptr[i].y) + ", " + rtos_fix(ptr[i].z) + ", " + rtos_fix(ptr[i].w)); + } + + p_store_string_func(p_store_string_ud, " )"); + + } break; + case Variant::POOL_VECTOR4I_ARRAY: { + p_store_string_func(p_store_string_ud, "PoolVector4iArray( "); + PoolVector data = p_variant; + int len = data.size(); + PoolVector::Read r = data.read(); + const Vector4i *ptr = r.ptr(); + + for (int i = 0; i < len; i++) { + if (i > 0) { + p_store_string_func(p_store_string_ud, ", "); + } + p_store_string_func(p_store_string_ud, rtos_fix(ptr[i].x) + ", " + rtos_fix(ptr[i].y) + ", " + rtos_fix(ptr[i].z) + ", " + rtos_fix(ptr[i].w)); + } + + p_store_string_func(p_store_string_ud, " )"); + } break; case Variant::POOL_COLOR_ARRAY: { p_store_string_func(p_store_string_ud, "PoolColorArray( "); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index aae70381d..58c35a67b 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -39,6 +39,7 @@ #include "core/math/math_defs.h" #include "core/math/math_funcs.h" #include "core/math/plane.h" +#include "core/math/projection.h" #include "core/math/quaternion.h" #include "core/math/rect2.h" #include "core/math/transform.h" @@ -2035,6 +2036,183 @@ EditorPropertyVector3i::EditorPropertyVector3i() { setting = false; } +///////////////////// VECTOR4 ///////////////////////// + +void EditorPropertyVector4::_value_changed(double val, const String &p_name) { + if (setting) { + return; + } + + Vector4 v4; + v4.x = spin[0]->get_value(); + v4.y = spin[1]->get_value(); + v4.z = spin[2]->get_value(); + v4.w = spin[3]->get_value(); + emit_changed(get_edited_property(), v4, p_name); +} + +void EditorPropertyVector4::update_property() { + update_using_vector(get_edited_object()->get(get_edited_property())); +} + +void EditorPropertyVector4::update_using_vector(Vector4 p_vector) { + setting = true; + spin[0]->set_value(p_vector.x); + spin[1]->set_value(p_vector.y); + spin[2]->set_value(p_vector.z); + spin[3]->set_value(p_vector.w); + setting = false; +} + +Vector4 EditorPropertyVector4::get_vector() { + Vector4 v4; + v4.x = spin[0]->get_value(); + v4.y = spin[1]->get_value(); + v4.z = spin[2]->get_value(); + v4.w = spin[3]->get_value(); + return v4; +} + +void EditorPropertyVector4::_notification(int p_what) { + if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { + Color base = get_color("accent_color", "Editor"); + for (int i = 0; i < 4; i++) { + Color c = base; + c.set_hsv(float(i) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v()); + spin[i]->set_custom_label_color(true, c); + } + } +} +void EditorPropertyVector4::_bind_methods() { + ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyVector4::_value_changed); +} + +void EditorPropertyVector4::setup(double p_min, double p_max, double p_step, bool p_no_slider) { + for (int i = 0; i < 4; i++) { + spin[i]->set_min(p_min); + spin[i]->set_max(p_max); + spin[i]->set_step(p_step); + spin[i]->set_hide_slider(p_no_slider); + spin[i]->set_allow_greater(true); + spin[i]->set_allow_lesser(true); + } +} + +EditorPropertyVector4::EditorPropertyVector4() { + bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing"); + + BoxContainer *bc; + + if (horizontal) { + bc = memnew(HBoxContainer); + add_child(bc); + set_bottom_editor(bc); + } else { + bc = memnew(VBoxContainer); + add_child(bc); + } + + static const char *desc[4] = { "x", "y", "z", "w" }; + for (int i = 0; i < 4; i++) { + spin[i] = memnew(EditorSpinSlider); + spin[i]->set_flat(true); + spin[i]->set_label(desc[i]); + bc->add_child(spin[i]); + add_focusable(spin[i]); + spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + if (horizontal) { + spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); + } + } + + if (!horizontal) { + set_label_reference(spin[0]); //show text and buttons around this + } + setting = false; +} + +///////////////////// VECTOR3I ///////////////////////// + +void EditorPropertyVector4i::_value_changed(double val, const String &p_name) { + if (setting) { + return; + } + + Vector4i v4; + v4.x = spin[0]->get_value(); + v4.y = spin[1]->get_value(); + v4.z = spin[2]->get_value(); + v4.w = spin[3]->get_value(); + emit_changed(get_edited_property(), v4, p_name); +} + +void EditorPropertyVector4i::update_property() { + Vector4i val = get_edited_object()->get(get_edited_property()); + setting = true; + spin[0]->set_value(val.x); + spin[1]->set_value(val.y); + spin[2]->set_value(val.z); + spin[3]->set_value(val.w); + setting = false; +} +void EditorPropertyVector4i::_notification(int p_what) { + if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { + Color base = get_color("accent_color", "Editor"); + for (int i = 0; i < 4; i++) { + Color c = base; + c.set_hsv(float(i) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v()); + spin[i]->set_custom_label_color(true, c); + } + } +} +void EditorPropertyVector4i::_bind_methods() { + ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyVector4i::_value_changed); +} + +void EditorPropertyVector4i::setup(int p_min, int p_max, bool p_no_slider) { + for (int i = 0; i < 4; i++) { + spin[i]->set_min(p_min); + spin[i]->set_max(p_max); + spin[i]->set_step(1); + spin[i]->set_hide_slider(p_no_slider); + spin[i]->set_allow_greater(true); + spin[i]->set_allow_lesser(true); + } +} + +EditorPropertyVector4i::EditorPropertyVector4i() { + bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing"); + + BoxContainer *bc; + + if (horizontal) { + bc = memnew(HBoxContainer); + add_child(bc); + set_bottom_editor(bc); + } else { + bc = memnew(VBoxContainer); + add_child(bc); + } + + static const char *desc[4] = { "x", "y", "z", "w" }; + for (int i = 0; i < 4; i++) { + spin[i] = memnew(EditorSpinSlider); + spin[i]->set_flat(true); + spin[i]->set_label(desc[i]); + bc->add_child(spin[i]); + add_focusable(spin[i]); + spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + if (horizontal) { + spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); + } + } + + if (!horizontal) { + set_label_reference(spin[0]); //show text and buttons around this + } + setting = false; +} + ///////////////////// PLANE ///////////////////////// void EditorPropertyPlane::_value_changed(double val, const String &p_name) { @@ -2518,6 +2696,105 @@ EditorPropertyTransform::EditorPropertyTransform() { setting = false; } +///////////////////// PROJECTION ///////////////////////// + +void EditorPropertyProjection::_value_changed(double val, const String &p_name) { + if (setting) { + return; + } + + Projection p; + p.matrix[0][0] = spin[0]->get_value(); + p.matrix[0][1] = spin[1]->get_value(); + p.matrix[0][2] = spin[2]->get_value(); + p.matrix[0][3] = spin[3]->get_value(); + p.matrix[1][0] = spin[4]->get_value(); + p.matrix[1][1] = spin[5]->get_value(); + p.matrix[1][2] = spin[6]->get_value(); + p.matrix[1][3] = spin[7]->get_value(); + p.matrix[2][0] = spin[8]->get_value(); + p.matrix[2][1] = spin[9]->get_value(); + p.matrix[2][2] = spin[10]->get_value(); + p.matrix[2][3] = spin[11]->get_value(); + p.matrix[3][0] = spin[12]->get_value(); + p.matrix[3][1] = spin[13]->get_value(); + p.matrix[3][2] = spin[14]->get_value(); + p.matrix[3][3] = spin[15]->get_value(); + + emit_changed(get_edited_property(), p, p_name); +} + +void EditorPropertyProjection::update_property() { + update_using_projection(get_edited_object()->get(get_edited_property())); +} + +void EditorPropertyProjection::update_using_projection(Projection p_projection) { + setting = true; + + spin[0]->set_value(p_projection.matrix[0][0]); + spin[1]->set_value(p_projection.matrix[0][1]); + spin[2]->set_value(p_projection.matrix[0][2]); + spin[3]->set_value(p_projection.matrix[0][3]); + spin[4]->set_value(p_projection.matrix[1][0]); + spin[5]->set_value(p_projection.matrix[1][1]); + spin[6]->set_value(p_projection.matrix[1][2]); + spin[7]->set_value(p_projection.matrix[1][3]); + spin[8]->set_value(p_projection.matrix[2][0]); + spin[9]->set_value(p_projection.matrix[2][1]); + spin[10]->set_value(p_projection.matrix[2][2]); + spin[11]->set_value(p_projection.matrix[2][3]); + spin[12]->set_value(p_projection.matrix[3][0]); + spin[13]->set_value(p_projection.matrix[3][1]); + spin[14]->set_value(p_projection.matrix[3][2]); + spin[15]->set_value(p_projection.matrix[3][3]); + + setting = false; +} + +void EditorPropertyProjection::_notification(int p_what) { + if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { + Color base = get_color("accent_color", "Editor"); + for (int i = 0; i < 16; i++) { + Color c = base; + c.set_hsv(float(i % 3) / 3.0 + 0.05, c.get_s() * 0.75, c.get_v()); + spin[i]->set_custom_label_color(true, c); + } + } +} +void EditorPropertyProjection::_bind_methods() { + ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyProjection::_value_changed); +} + +void EditorPropertyProjection::setup(double p_min, double p_max, double p_step, bool p_no_slider) { + for (int i = 0; i < 16; i++) { + spin[i]->set_min(p_min); + spin[i]->set_max(p_max); + spin[i]->set_step(p_step); + spin[i]->set_hide_slider(p_no_slider); + spin[i]->set_allow_greater(true); + spin[i]->set_allow_lesser(true); + } +} + +EditorPropertyProjection::EditorPropertyProjection() { + GridContainer *g = memnew(GridContainer); + g->set_columns(4); + add_child(g); + + static const char *desc[16] = { "x", "y", "z", "w", "x", "y", "z", "w", "x", "y", "z", "w", "x", "y", "z", "w" }; + for (int i = 0; i < 16; i++) { + spin[i] = memnew(EditorSpinSlider); + spin[i]->set_label(desc[i]); + spin[i]->set_flat(true); + g->add_child(spin[i]); + spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); + add_focusable(spin[i]); + spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + } + set_bottom_editor(g); + setting = false; +} + ////////////// COLOR PICKER ////////////////////// void EditorPropertyColor::_color_changed(const Color &p_color) { @@ -3331,6 +3608,37 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ // math types + case Variant::RECT2: { + EditorPropertyRect2 *editor = memnew(EditorPropertyRect2); + double min = -65535, max = 65535, step = default_float_step; + bool hide_slider = true; + + if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) { + min = p_hint_text.get_slice(",", 0).to_double(); + max = p_hint_text.get_slice(",", 1).to_double(); + if (p_hint_text.get_slice_count(",") >= 3) { + step = p_hint_text.get_slice(",", 2).to_double(); + } + hide_slider = false; + } + + editor->setup(min, max, step, hide_slider); + add_property_editor(p_path, editor); + } break; + case Variant::RECT2I: { + EditorPropertyRect2i *editor = memnew(EditorPropertyRect2i); + double min = -65535, max = 65535; + bool hide_slider = true; + + if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) { + min = p_hint_text.get_slice(",", 0).to_double(); + max = p_hint_text.get_slice(",", 1).to_double(); + hide_slider = false; + } + + editor->setup(min, max, hide_slider); + add_property_editor(p_path, editor); + } break; case Variant::VECTOR2: { EditorPropertyVector2 *editor = memnew(EditorPropertyVector2); double min = -65535, max = 65535, step = default_float_step; @@ -3364,37 +3672,6 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ add_property_editor(p_path, editor); } break; - case Variant::RECT2: { - EditorPropertyRect2 *editor = memnew(EditorPropertyRect2); - double min = -65535, max = 65535, step = default_float_step; - bool hide_slider = true; - - if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) { - min = p_hint_text.get_slice(",", 0).to_double(); - max = p_hint_text.get_slice(",", 1).to_double(); - if (p_hint_text.get_slice_count(",") >= 3) { - step = p_hint_text.get_slice(",", 2).to_double(); - } - hide_slider = false; - } - - editor->setup(min, max, step, hide_slider); - add_property_editor(p_path, editor); - } break; - case Variant::RECT2I: { - EditorPropertyRect2i *editor = memnew(EditorPropertyRect2i); - double min = -65535, max = 65535; - bool hide_slider = true; - - if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) { - min = p_hint_text.get_slice(",", 0).to_double(); - max = p_hint_text.get_slice(",", 1).to_double(); - hide_slider = false; - } - - editor->setup(min, max, hide_slider); - add_property_editor(p_path, editor); - } break; case Variant::VECTOR3: { EditorPropertyVector3 *editor = memnew(EditorPropertyVector3); double min = -65535, max = 65535, step = default_float_step; @@ -3428,8 +3705,8 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ add_property_editor(p_path, editor); } break; - case Variant::TRANSFORM2D: { - EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D); + case Variant::VECTOR4: { + EditorPropertyVector4 *editor = memnew(EditorPropertyVector4); double min = -65535, max = 65535, step = default_float_step; bool hide_slider = true; @@ -3445,6 +3722,21 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(min, max, step, hide_slider); add_property_editor(p_path, editor); + } break; + case Variant::VECTOR4I: { + EditorPropertyVector4i *editor = memnew(EditorPropertyVector4i); + double min = -65535, max = 65535; + bool hide_slider = true; + + if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) { + min = p_hint_text.get_slice(",", 0).to_double(); + max = p_hint_text.get_slice(",", 1).to_double(); + hide_slider = false; + } + + editor->setup(min, max, hide_slider); + add_property_editor(p_path, editor); + } break; case Variant::PLANE: { EditorPropertyPlane *editor = memnew(EditorPropertyPlane); @@ -3531,6 +3823,42 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(min, max, step, hide_slider); add_property_editor(p_path, editor); + } break; + case Variant::TRANSFORM2D: { + EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D); + double min = -65535, max = 65535, step = default_float_step; + bool hide_slider = true; + + if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) { + min = p_hint_text.get_slice(",", 0).to_double(); + max = p_hint_text.get_slice(",", 1).to_double(); + if (p_hint_text.get_slice_count(",") >= 3) { + step = p_hint_text.get_slice(",", 2).to_double(); + } + hide_slider = false; + } + + editor->setup(min, max, step, hide_slider); + add_property_editor(p_path, editor); + + } break; + case Variant::PROJECTION: { + EditorPropertyProjection *editor = memnew(EditorPropertyProjection); + double min = -65535, max = 65535, step = default_float_step; + bool hide_slider = true; + + if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) { + min = p_hint_text.get_slice(",", 0).to_double(); + max = p_hint_text.get_slice(",", 1).to_double(); + if (p_hint_text.get_slice_count(",") >= 3) { + step = p_hint_text.get_slice(",", 2).to_double(); + } + hide_slider = false; + } + + editor->setup(min, max, step, hide_slider); + add_property_editor(p_path, editor); + } break; // misc types @@ -3552,7 +3880,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ add_property_editor(p_path, editor); } break; // 15 - case Variant::_RID: { + case Variant::RID: { EditorPropertyRID *editor = memnew(EditorPropertyRID); add_property_editor(p_path, editor); } break; @@ -3640,6 +3968,16 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(Variant::POOL_VECTOR3I_ARRAY); add_property_editor(p_path, editor); } break; // 25 + case Variant::POOL_VECTOR4_ARRAY: { + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_VECTOR4_ARRAY); + add_property_editor(p_path, editor); + } break; // 25 + case Variant::POOL_VECTOR4I_ARRAY: { + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_VECTOR4I_ARRAY); + add_property_editor(p_path, editor); + } break; // 25 case Variant::POOL_COLOR_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); editor->setup(Variant::POOL_COLOR_ARRAY); diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 46dda1542..d8f11ac6e 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -34,6 +34,8 @@ #include "core/color.h" #include "core/math/vector2.h" +#include "core/math/vector3.h" +#include "core/math/vector4.h" #include "core/node_path.h" #include "core/object.h" #include "core/reference.h" @@ -516,6 +518,40 @@ public: EditorPropertyVector3i(); }; +class EditorPropertyVector4 : public EditorProperty { + GDCLASS(EditorPropertyVector4, EditorProperty); + EditorSpinSlider *spin[4]; + bool setting; + void _value_changed(double p_val, const String &p_name); + +protected: + void _notification(int p_what); + static void _bind_methods(); + +public: + virtual void update_property(); + virtual void update_using_vector(Vector4 p_vector); + virtual Vector4 get_vector(); + void setup(double p_min, double p_max, double p_step, bool p_no_slider); + EditorPropertyVector4(); +}; + +class EditorPropertyVector4i : public EditorProperty { + GDCLASS(EditorPropertyVector4i, EditorProperty); + EditorSpinSlider *spin[4]; + bool setting; + void _value_changed(double p_val, const String &p_name); + +protected: + void _notification(int p_what); + static void _bind_methods(); + +public: + virtual void update_property(); + void setup(int p_min, int p_max, bool p_no_slider); + EditorPropertyVector4i(); +}; + class EditorPropertyPlane : public EditorProperty { GDCLASS(EditorPropertyPlane, EditorProperty); EditorSpinSlider *spin[4]; @@ -613,6 +649,23 @@ public: EditorPropertyTransform(); }; +class EditorPropertyProjection : public EditorProperty { + GDCLASS(EditorPropertyProjection, EditorProperty); + EditorSpinSlider *spin[16]; + bool setting; + void _value_changed(double p_val, const String &p_name); + +protected: + void _notification(int p_what); + static void _bind_methods(); + +public: + virtual void update_property(); + virtual void update_using_projection(Projection p_projection); + void setup(double p_min, double p_max, double p_step, bool p_no_slider); + EditorPropertyProjection(); +}; + class EditorPropertyColor : public EditorProperty { GDCLASS(EditorPropertyColor, EditorProperty); ColorPickerButton *picker; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 4609b89b6..9d06051d6 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -30,26 +30,25 @@ #include "editor_properties_array_dict.h" -#include "core/io/marshalls.h" -#include "core/os/input.h" -#include "editor/editor_node.h" -#include "editor/editor_scale.h" -#include "editor_properties.h" -#include "scene/main/viewport.h" #include "core/class_db.h" #include "core/color.h" #include "core/error_macros.h" +#include "core/io/marshalls.h" #include "core/io/resource_loader.h" #include "core/math/math_defs.h" #include "core/math/rect2.h" +#include "core/os/input.h" #include "core/os/input_event.h" #include "core/os/memory.h" #include "core/resource.h" #include "core/typedefs.h" #include "core/vector.h" #include "editor/editor_file_system.h" +#include "editor/editor_node.h" +#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_spin_slider.h" +#include "editor_properties.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/control.h" @@ -57,6 +56,7 @@ #include "scene/gui/panel_container.h" #include "scene/gui/popup_menu.h" #include "scene/main/node.h" +#include "scene/main/viewport.h" #include "scene/resources/style_box.h" bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_value) { @@ -267,6 +267,14 @@ void EditorPropertyArray::update_property() { case Variant::POOL_VECTOR3I_ARRAY: { arrtype = "PoolVector3iArray"; + } break; + case Variant::POOL_VECTOR4_ARRAY: { + arrtype = "PoolVector4Array"; + + } break; + case Variant::POOL_VECTOR4I_ARRAY: { + arrtype = "PoolVector4iArray"; + } break; case Variant::POOL_COLOR_ARRAY: { arrtype = "PoolColorArray"; @@ -959,19 +967,7 @@ void EditorPropertyDictionary::update_property() { } break; - // Math types. - case Variant::VECTOR2: { - EditorPropertyVector2 *editor = memnew(EditorPropertyVector2); - editor->setup(-100000, 100000, 0.001, true); - prop = editor; - - } break; - case Variant::VECTOR2I: { - EditorPropertyVector2i *editor = memnew(EditorPropertyVector2i); - editor->setup(-100000, 100000, true); - prop = editor; - - } break; + // Math types. case Variant::RECT2: { EditorPropertyRect2 *editor = memnew(EditorPropertyRect2); editor->setup(-100000, 100000, 0.001, true); @@ -984,6 +980,19 @@ void EditorPropertyDictionary::update_property() { prop = editor; } break; + case Variant::VECTOR2: { + EditorPropertyVector2 *editor = memnew(EditorPropertyVector2); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; + + } break; + case Variant::VECTOR2I: { + EditorPropertyVector2i *editor = memnew(EditorPropertyVector2i); + editor->setup(-100000, 100000, true); + prop = editor; + + } break; + case Variant::VECTOR3: { EditorPropertyVector3 *editor = memnew(EditorPropertyVector3); editor->setup(-100000, 100000, 0.001, true); @@ -996,11 +1005,17 @@ void EditorPropertyDictionary::update_property() { prop = editor; } break; - case Variant::TRANSFORM2D: { - EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D); + case Variant::VECTOR4: { + EditorPropertyVector4 *editor = memnew(EditorPropertyVector4); editor->setup(-100000, 100000, 0.001, true); prop = editor; + } break; + case Variant::VECTOR4I: { + EditorPropertyVector4i *editor = memnew(EditorPropertyVector4i); + editor->setup(-100000, 100000, true); + prop = editor; + } break; case Variant::PLANE: { EditorPropertyPlane *editor = memnew(EditorPropertyPlane); @@ -1031,6 +1046,18 @@ void EditorPropertyDictionary::update_property() { editor->setup(-100000, 100000, 0.001, true); prop = editor; + } break; + case Variant::TRANSFORM2D: { + EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; + + } break; + case Variant::PROJECTION: { + EditorPropertyProjection *editor = memnew(EditorPropertyProjection); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; + } break; // Miscellaneous types. @@ -1042,7 +1069,7 @@ void EditorPropertyDictionary::update_property() { prop = memnew(EditorPropertyNodePath); } break; - case Variant::_RID: { + case Variant::RID: { prop = memnew(EditorPropertyRID); } break; @@ -1117,6 +1144,16 @@ void EditorPropertyDictionary::update_property() { editor->setup(Variant::POOL_VECTOR3I_ARRAY); prop = editor; } break; + case Variant::POOL_VECTOR4_ARRAY: { + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_VECTOR4_ARRAY); + prop = editor; + } break; + case Variant::POOL_VECTOR4I_ARRAY: { + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_VECTOR4I_ARRAY); + prop = editor; + } break; case Variant::POOL_COLOR_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); editor->setup(Variant::POOL_COLOR_ARRAY); diff --git a/editor/icons/editor_icons_builders.py b/editor/icons/editor_icons_builders.py index c14369d49..918660045 100644 --- a/editor/icons/editor_icons_builders.py +++ b/editor/icons/editor_icons_builders.py @@ -55,6 +55,7 @@ def make_editor_icons_action(target, source, env): #hack icon_name = icon_name.replace("Vector2I", "Vector2i") icon_name = icon_name.replace("Vector3I", "Vector3i") + icon_name = icon_name.replace("Vector4I", "Vector4i") icon_name = icon_name.replace("Rect2I", "Rect2i") icon_name = icon_name.replace("_", "") diff --git a/editor/icons/icon_pool_vector4_array.svg b/editor/icons/icon_pool_vector4_array.svg new file mode 100644 index 000000000..503b0e7b6 --- /dev/null +++ b/editor/icons/icon_pool_vector4_array.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_pool_vector4i_array.svg b/editor/icons/icon_pool_vector4i_array.svg new file mode 100644 index 000000000..503b0e7b6 --- /dev/null +++ b/editor/icons/icon_pool_vector4i_array.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_projection.svg b/editor/icons/icon_projection.svg new file mode 100644 index 000000000..f6e99cb56 --- /dev/null +++ b/editor/icons/icon_projection.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_quat.svg b/editor/icons/icon_quaternion.svg similarity index 100% rename from editor/icons/icon_quat.svg rename to editor/icons/icon_quaternion.svg diff --git a/editor/icons/icon_vector4.svg b/editor/icons/icon_vector4.svg new file mode 100644 index 000000000..2797df444 --- /dev/null +++ b/editor/icons/icon_vector4.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_vector4i.svg b/editor/icons/icon_vector4i.svg new file mode 100644 index 000000000..2797df444 --- /dev/null +++ b/editor/icons/icon_vector4i.svg @@ -0,0 +1 @@ + diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 7f6bbb26a..e7a2c62b2 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -388,7 +388,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: checks20[i]->hide(); } - type = (p_variant.get_type() != Variant::NIL && p_variant.get_type() != Variant::_RID && p_type != Variant::OBJECT) ? p_variant.get_type() : p_type; + type = (p_variant.get_type() != Variant::NIL && p_variant.get_type() != Variant::RID && p_type != Variant::OBJECT) ? p_variant.get_type() : p_type; switch (type) { case Variant::BOOL: { diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index 1acebed79..2d006a08f 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -30,8 +30,6 @@ #include "property_selector.h" -#include "core/os/keyboard.h" -#include "editor/editor_node.h" #include "core/class_db.h" #include "core/color.h" #include "core/error_macros.h" @@ -39,12 +37,14 @@ #include "core/map.h" #include "core/method_bind.h" #include "core/os/input_event.h" +#include "core/os/keyboard.h" #include "core/os/memory.h" #include "core/script_language.h" #include "core/string_name.h" #include "core/typedefs.h" #include "editor/doc/doc_data.h" #include "editor/editor_help.h" +#include "editor/editor_node.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/control.h" @@ -143,19 +143,26 @@ void PropertySelector::_update_search() { Control::get_icon("int", "EditorIcons"), Control::get_icon("float", "EditorIcons"), Control::get_icon("String", "EditorIcons"), - Control::get_icon("Vector2", "EditorIcons"), Control::get_icon("Rect2", "EditorIcons"), + Control::get_icon("Rect2i", "EditorIcons"), + Control::get_icon("Vector2", "EditorIcons"), + Control::get_icon("Vector2i", "EditorIcons"), Control::get_icon("Vector3", "EditorIcons"), - Control::get_icon("Transform2D", "EditorIcons"), + Control::get_icon("Vector3i", "EditorIcons"), + Control::get_icon("Vector4", "EditorIcons"), + Control::get_icon("Vector4i", "EditorIcons"), Control::get_icon("Plane", "EditorIcons"), Control::get_icon("Quaternion", "EditorIcons"), Control::get_icon("AABB", "EditorIcons"), Control::get_icon("Basis", "EditorIcons"), Control::get_icon("Transform", "EditorIcons"), + Control::get_icon("Transform2D", "EditorIcons"), + Control::get_icon("Projection", "EditorIcons"), Control::get_icon("Color", "EditorIcons"), Control::get_icon("Path", "EditorIcons"), Control::get_icon("RID", "EditorIcons"), Control::get_icon("Object", "EditorIcons"), + Control::get_icon("StringName", "EditorIcons"), Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), Control::get_icon("PoolByteArray", "EditorIcons"), @@ -163,7 +170,11 @@ void PropertySelector::_update_search() { Control::get_icon("PoolRealArray", "EditorIcons"), Control::get_icon("PoolStringArray", "EditorIcons"), Control::get_icon("PoolVector2Array", "EditorIcons"), + Control::get_icon("PoolVector2iArray", "EditorIcons"), Control::get_icon("PoolVector3Array", "EditorIcons"), + Control::get_icon("PoolVector3iArray", "EditorIcons"), + Control::get_icon("PoolVector4Array", "EditorIcons"), + Control::get_icon("PoolVector4iArray", "EditorIcons"), Control::get_icon("PoolColorArray", "EditorIcons") }; diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index d02a9178b..0133f2437 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1836,7 +1836,7 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n for (int i = 0; i < VARIANT_ARG_MAX; i++) { //no pointers, sorry - if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::_RID)) { + if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::RID)) { return; } } diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp index 0b9484f70..68ed83804 100644 --- a/main/tests/test_math.cpp +++ b/main/tests/test_math.cpp @@ -358,7 +358,7 @@ public: void test_vec(Plane p_vec) { Projection cm; cm.set_perspective(45, 1, 0, 100); - Plane v0 = cm.xform4(p_vec); + Plane v0 = cm.xform(p_vec); print_line("out: " + v0); v0.normal.z = (v0.d / 100.0 * 2.0 - 1.0) * v0.d; diff --git a/modules/cscript/cscript_editor.cpp b/modules/cscript/cscript_editor.cpp index 51a2413d9..9d444daa0 100644 --- a/modules/cscript/cscript_editor.cpp +++ b/modules/cscript/cscript_editor.cpp @@ -2173,10 +2173,11 @@ static void _find_identifiers(const CScriptCompletionContext &p_context, bool p_ } static const char *_type_names[Variant::VARIANT_MAX] = { - "null", "bool", "int", "float", "String", "Vector2", "Vector2i", "Rect2", "Rect2i", "Vector3", "Vector3i", "Transform2D", "Plane", - "Quaternion", "AABB", "Basis", "Transform", "Color", "NodePath", "RID", "Object", "Dictionary", "Array", - "PoolByteArray", "PoolIntArray", "PoolRealArray", "PoolStringArray", - "PoolVector2Array", "PoolVector2iArray", "PoolVector3Array", "PoolVector3iArray", "PoolColorArray" + "null", "bool", "int", "float", "String", "Rect2", "Rect2i", "Vector2", "Vector2i", "Vector3", "Vector3i", "Vector4", "Vector4i", + "Plane", "Quaternion", "AABB", "Basis", "Transform", "Transform2D", "Projection", "Color", "NodePath", + "RID", "Object", "StringName", "Dictionary", "Array", "PoolByteArray", "PoolIntArray", "PoolRealArray", "PoolStringArray", + "PoolVector2Array", "PoolVector2iArray", "PoolVector3Array", "PoolVector3iArray", + "PoolVector4Array", "PoolVector4iArray", "PoolColorArray" }; for (int i = 0; i < Variant::VARIANT_MAX; i++) { diff --git a/modules/cscript/cscript_functions.cpp b/modules/cscript/cscript_functions.cpp index 7c33ae612..4f48d420e 100644 --- a/modules/cscript/cscript_functions.cpp +++ b/modules/cscript/cscript_functions.cpp @@ -1371,6 +1371,14 @@ void CScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_c PoolVector d = *p_args[0]; r_ret = d.size(); } break; + case Variant::POOL_VECTOR4_ARRAY: { + PoolVector d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::POOL_VECTOR4I_ARRAY: { + PoolVector d = *p_args[0]; + r_ret = d.size(); + } break; case Variant::POOL_COLOR_ARRAY: { PoolVector d = *p_args[0]; r_ret = d.size(); diff --git a/modules/cscript/cscript_parser.cpp b/modules/cscript/cscript_parser.cpp index 24462067d..0ad4db17f 100644 --- a/modules/cscript/cscript_parser.cpp +++ b/modules/cscript/cscript_parser.cpp @@ -6543,6 +6543,8 @@ CScriptParser::DataType CScriptParser::_reduce_node_type(Node *p_node) { case Variant::POOL_VECTOR2I_ARRAY: case Variant::POOL_VECTOR3_ARRAY: case Variant::POOL_VECTOR3I_ARRAY: + case Variant::POOL_VECTOR4_ARRAY: + case Variant::POOL_VECTOR4I_ARRAY: case Variant::ARRAY: case Variant::STRING: { error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::REAL; @@ -6561,9 +6563,12 @@ CScriptParser::DataType CScriptParser::_reduce_node_type(Node *p_node) { case Variant::VECTOR2I: case Variant::VECTOR3: case Variant::VECTOR3I: + case Variant::VECTOR4: + case Variant::VECTOR4I: case Variant::TRANSFORM2D: case Variant::BASIS: - case Variant::TRANSFORM: { + case Variant::TRANSFORM: + case Variant::PROJECTION: { error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::REAL && index_type.builtin_type != Variant::STRING; } break; @@ -6595,7 +6600,11 @@ CScriptParser::DataType CScriptParser::_reduce_node_type(Node *p_node) { case Variant::POOL_REAL_ARRAY: case Variant::POOL_STRING_ARRAY: case Variant::POOL_VECTOR2_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::POOL_VECTOR2I_ARRAY: + case Variant::POOL_VECTOR3_ARRAY: + case Variant::POOL_VECTOR3I_ARRAY: + case Variant::POOL_VECTOR4_ARRAY: + case Variant::POOL_VECTOR4I_ARRAY: { break; } default: { @@ -6636,12 +6645,15 @@ CScriptParser::DataType CScriptParser::_reduce_node_type(Node *p_node) { case Variant::INT: case Variant::REAL: case Variant::NODE_PATH: - case Variant::_RID: { + case Variant::RID: { _set_error("Can't index on a value of type \"" + base_type.to_string() + "\".", op->line); return DataType(); } break; // Return int case Variant::POOL_BYTE_ARRAY: + case Variant::VECTOR2I: + case Variant::VECTOR3I: + case Variant::VECTOR4I: case Variant::POOL_INT_ARRAY: { result.builtin_type = Variant::INT; } break; @@ -6649,6 +6661,7 @@ CScriptParser::DataType CScriptParser::_reduce_node_type(Node *p_node) { case Variant::POOL_REAL_ARRAY: case Variant::VECTOR2: case Variant::VECTOR3: + case Variant::VECTOR4: case Variant::QUATERNION: { result.builtin_type = Variant::REAL; } break; @@ -6666,12 +6679,22 @@ CScriptParser::DataType CScriptParser::_reduce_node_type(Node *p_node) { case Variant::TRANSFORM2D: case Variant::RECT2: { result.builtin_type = Variant::VECTOR2; + } break; + case Variant::POOL_VECTOR2I_ARRAY: + case Variant::RECT2I: { + result.builtin_type = Variant::VECTOR2I; } break; // Return Vector3 case Variant::POOL_VECTOR3_ARRAY: case Variant::AABB: case Variant::BASIS: { result.builtin_type = Variant::VECTOR3; + } break; + case Variant::POOL_VECTOR3I_ARRAY: { + result.builtin_type = Variant::VECTOR3I; + } break; + case Variant::PROJECTION: { + result.builtin_type = Variant::VECTOR4; } break; // Depends on the index case Variant::TRANSFORM: diff --git a/modules/cscript/cscript_tokenizer.cpp b/modules/cscript/cscript_tokenizer.cpp index f4fc574c1..b7977cd1f 100644 --- a/modules/cscript/cscript_tokenizer.cpp +++ b/modules/cscript/cscript_tokenizer.cpp @@ -141,23 +141,26 @@ static const _bit _type_list[] = { { Variant::INT, "int" }, { Variant::REAL, "float" }, { Variant::STRING, "String" }, - { Variant::VECTOR2, "Vector2" }, - { Variant::VECTOR2I, "Vector2i" }, { Variant::RECT2, "Rect2" }, { Variant::RECT2I, "Rect2i" }, - { Variant::TRANSFORM2D, "Transform2D" }, + { Variant::VECTOR2, "Vector2" }, + { Variant::VECTOR2I, "Vector2i" }, { Variant::VECTOR3, "Vector3" }, { Variant::VECTOR3I, "Vector3i" }, - { Variant::AABB, "AABB" }, + { Variant::VECTOR4, "Vector4" }, + { Variant::VECTOR4I, "Vector4i" }, { Variant::PLANE, "Plane" }, { Variant::QUATERNION, "Quaternion" }, + { Variant::AABB, "AABB" }, { Variant::BASIS, "Basis" }, { Variant::TRANSFORM, "Transform" }, + { Variant::TRANSFORM2D, "Transform2D" }, + { Variant::PROJECTION, "Projection" }, { Variant::COLOR, "Color" }, - { Variant::_RID, "RID" }, + { Variant::NODE_PATH, "NodePath" }, + { Variant::RID, "RID" }, { Variant::OBJECT, "Object" }, { Variant::STRING_NAME, "StringName" }, - { Variant::NODE_PATH, "NodePath" }, { Variant::DICTIONARY, "Dictionary" }, { Variant::ARRAY, "Array" }, { Variant::POOL_BYTE_ARRAY, "PoolByteArray" }, @@ -168,6 +171,8 @@ static const _bit _type_list[] = { { Variant::POOL_VECTOR2I_ARRAY, "PoolVector2iArray" }, { Variant::POOL_VECTOR3_ARRAY, "PoolVector3Array" }, { Variant::POOL_VECTOR3I_ARRAY, "PoolVector3iArray" }, + { Variant::POOL_VECTOR4_ARRAY, "PoolVector4Array" }, + { Variant::POOL_VECTOR4I_ARRAY, "PoolVector4iArray" }, { Variant::POOL_COLOR_ARRAY, "PoolColorArray" }, { Variant::VARIANT_MAX, nullptr }, }; diff --git a/modules/entity_spell_system/data/items/item_template.cpp b/modules/entity_spell_system/data/items/item_template.cpp index 0bdb43eb1..046cd7627 100644 --- a/modules/entity_spell_system/data/items/item_template.cpp +++ b/modules/entity_spell_system/data/items/item_template.cpp @@ -550,7 +550,7 @@ void ItemTemplate::_bind_methods() { ClassDB::bind_method(D_METHOD("get_teaches_spells"), &ItemTemplate::get_teaches_spells); ClassDB::bind_method(D_METHOD("set_teaches_spells", "spells"), &ItemTemplate::set_teaches_spells); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "teaches_spells", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_teaches_spells", "get_teaches_spells"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "teaches_spells", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_teaches_spells", "get_teaches_spells"); //// Grants Spells //// ClassDB::bind_method(D_METHOD("get_num_grants_spells"), &ItemTemplate::get_num_grants_spells); @@ -561,7 +561,7 @@ void ItemTemplate::_bind_methods() { ClassDB::bind_method(D_METHOD("get_grants_spells"), &ItemTemplate::get_grants_spells); ClassDB::bind_method(D_METHOD("set_grants_spells", "spells"), &ItemTemplate::set_grants_spells); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "grants_spells", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_grants_spells", "get_grants_spells"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "grants_spells", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_grants_spells", "get_grants_spells"); //// Auras //// ClassDB::bind_method(D_METHOD("get_num_auras"), &ItemTemplate::get_num_auras); @@ -572,7 +572,7 @@ void ItemTemplate::_bind_methods() { ClassDB::bind_method(D_METHOD("get_auras"), &ItemTemplate::get_auras); ClassDB::bind_method(D_METHOD("set_auras", "auras"), &ItemTemplate::set_auras); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras"); //// Required Skills //// ClassDB::bind_method(D_METHOD("get_num_required_skills"), &ItemTemplate::get_num_required_skills); @@ -582,7 +582,7 @@ void ItemTemplate::_bind_methods() { ClassDB::bind_method(D_METHOD("get_required_skills"), &ItemTemplate::get_required_skills); ClassDB::bind_method(D_METHOD("set_required_skills", "auras"), &ItemTemplate::set_required_skills); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "required_skills", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_required_skills", "get_required_skills"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "required_skills", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_required_skills", "get_required_skills"); //Use spell ClassDB::bind_method(D_METHOD("get_use_spell"), &ItemTemplate::get_use_spell); diff --git a/modules/entity_spell_system/data/items/model_visual.cpp b/modules/entity_spell_system/data/items/model_visual.cpp index 671ce8dd0..471a4659e 100644 --- a/modules/entity_spell_system/data/items/model_visual.cpp +++ b/modules/entity_spell_system/data/items/model_visual.cpp @@ -96,5 +96,5 @@ void ModelVisual::_bind_methods() { ClassDB::bind_method(D_METHOD("get_visual_entries"), &ModelVisual::get_visual_entries); ClassDB::bind_method(D_METHOD("set_visual_entries", "visual_entrys"), &ModelVisual::set_visual_entries); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "get_visual_entries", PROPERTY_HINT_NONE, "20/19:ModelVisualEntry", PROPERTY_USAGE_DEFAULT, "ModelVisualEntry"), "set_visual_entries", "get_visual_entries"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "get_visual_entries", PROPERTY_HINT_NONE, "23/19:ModelVisualEntry", PROPERTY_USAGE_DEFAULT, "ModelVisualEntry"), "set_visual_entries", "get_visual_entries"); } diff --git a/modules/entity_spell_system/data/species/entity_species_data.cpp b/modules/entity_spell_system/data/species/entity_species_data.cpp index 61d3d9f44..4c070d074 100644 --- a/modules/entity_spell_system/data/species/entity_species_data.cpp +++ b/modules/entity_spell_system/data/species/entity_species_data.cpp @@ -202,7 +202,7 @@ void EntitySpeciesData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_model_datas"), &EntitySpeciesData::get_model_datas); ClassDB::bind_method(D_METHOD("set_model_datas", "model_datas"), &EntitySpeciesData::set_model_datas); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "model_datas", PROPERTY_HINT_NONE, "20/19:SpeciesModelData", PROPERTY_USAGE_DEFAULT, "SpeciesModelData"), "set_model_datas", "get_model_datas"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "model_datas", PROPERTY_HINT_NONE, "23/19:SpeciesModelData", PROPERTY_USAGE_DEFAULT, "SpeciesModelData"), "set_model_datas", "get_model_datas"); //Spells ClassDB::bind_method(D_METHOD("get_spell", "index"), &EntitySpeciesData::get_spell); @@ -214,7 +214,7 @@ void EntitySpeciesData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_spells"), &EntitySpeciesData::get_spells); ClassDB::bind_method(D_METHOD("set_spells", "spells"), &EntitySpeciesData::set_spells); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells"); //Auras ClassDB::bind_method(D_METHOD("get_aura", "index"), &EntitySpeciesData::get_aura); @@ -226,5 +226,5 @@ void EntitySpeciesData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_auras"), &EntitySpeciesData::get_auras); ClassDB::bind_method(D_METHOD("set_auras", "auras"), &EntitySpeciesData::set_auras); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras"); } diff --git a/modules/entity_spell_system/data/species/species_model_data.cpp b/modules/entity_spell_system/data/species/species_model_data.cpp index 10f85431f..654e4fe4a 100644 --- a/modules/entity_spell_system/data/species/species_model_data.cpp +++ b/modules/entity_spell_system/data/species/species_model_data.cpp @@ -331,7 +331,7 @@ void SpeciesModelData::_get_property_list(List *p_list) const { int count = _customizable_slots_string.get_slice_count(","); for (int i = 0; i < count; ++i) { - p_list->push_back(PropertyInfo(Variant::ARRAY, "customizable_slots/" + itos(i) + "_" + _customizable_slots_string.get_slicec(',', i), PROPERTY_HINT_NONE, "20/19:ModelVisualEntry", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL, "ModelVisualEntry")); + p_list->push_back(PropertyInfo(Variant::ARRAY, "customizable_slots/" + itos(i) + "_" + _customizable_slots_string.get_slicec(',', i), PROPERTY_HINT_NONE, "23/19:ModelVisualEntry", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL, "ModelVisualEntry")); } count = _customizable_color_slots_string.get_slice_count(","); @@ -339,7 +339,7 @@ void SpeciesModelData::_get_property_list(List *p_list) const { for (int i = 0; i < count; ++i) { p_list->push_back(PropertyInfo(Variant::INT, "customizable_color_slots/" + itos(i) + "_" + _customizable_color_slots_string.get_slicec(',', i) + "/texture_layer", PROPERTY_HINT_ENUM, ESS::get_singleton()->texture_layers_get(), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED)); p_list->push_back(PropertyInfo(Variant::INT, "customizable_color_slots/" + itos(i) + "_" + _customizable_color_slots_string.get_slicec(',', i) + "/bone_slot_mask", PROPERTY_HINT_FLAGS, ESS::get_singleton()->skeletons_bones_index_get(_bone_structure), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL)); - p_list->push_back(PropertyInfo(Variant::ARRAY, "customizable_color_slots/" + itos(i) + "_" + _customizable_color_slots_string.get_slicec(',', i) + "/colors", PROPERTY_HINT_NONE, "20/19:Color", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL, "Color")); + p_list->push_back(PropertyInfo(Variant::ARRAY, "customizable_color_slots/" + itos(i) + "_" + _customizable_color_slots_string.get_slicec(',', i) + "/colors", PROPERTY_HINT_NONE, "23/19:Color", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL, "Color")); } } void SpeciesModelData::_validate_property(PropertyInfo &property) const { diff --git a/modules/entity_spell_system/data/spells/spell.cpp b/modules/entity_spell_system/data/spells/spell.cpp index cf5c241e4..19e7a22eb 100644 --- a/modules/entity_spell_system/data/spells/spell.cpp +++ b/modules/entity_spell_system/data/spells/spell.cpp @@ -2728,7 +2728,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("spells_cast_on_caster_get"), &Spell::spells_cast_on_caster_get); ClassDB::bind_method(D_METHOD("spells_cast_on_caster_set", "caster_aura_applys"), &Spell::spells_cast_on_caster_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells_cast_on_caster", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "spells_cast_on_caster_set", "spells_cast_on_caster_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells_cast_on_caster", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "spells_cast_on_caster_set", "spells_cast_on_caster_get"); //ADD_GROUP("Target Aura Apply", "target_aura_applys"); ClassDB::bind_method(D_METHOD("spells_cast_on_target_num_get"), &Spell::spells_cast_on_target_num_get); @@ -2739,7 +2739,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("spells_cast_on_target_get"), &Spell::spells_cast_on_target_get); ClassDB::bind_method(D_METHOD("spells_cast_on_target_set", "target_aura_applys"), &Spell::spells_cast_on_target_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells_cast_on_target", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "spells_cast_on_target_set", "spells_cast_on_target_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells_cast_on_target", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "spells_cast_on_target_set", "spells_cast_on_target_get"); //ADD_GROUP("Apply Auras On Learn", "on_learn_auras"); ClassDB::bind_method(D_METHOD("on_learn_cast_spells_num_get"), &Spell::on_learn_cast_spells_num_get); @@ -2750,7 +2750,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("spells_cast_on_learn_get"), &Spell::spells_cast_on_learn_get); ClassDB::bind_method(D_METHOD("spells_cast_on_learn_set", "spells"), &Spell::spells_cast_on_learn_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells_cast_on_learn", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "spells_cast_on_learn_set", "spells_cast_on_learn_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells_cast_on_learn", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "spells_cast_on_learn_set", "spells_cast_on_learn_get"); ADD_GROUP("Texts", "text"); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::STRING, "desc"), "_get_description", PropertyInfo(Variant::INT, "class_level"), PropertyInfo(Variant::INT, "character_level"))); diff --git a/modules/entity_spell_system/database/ess_resource_db_static.cpp b/modules/entity_spell_system/database/ess_resource_db_static.cpp index b6edd4c9b..db7651914 100644 --- a/modules/entity_spell_system/database/ess_resource_db_static.cpp +++ b/modules/entity_spell_system/database/ess_resource_db_static.cpp @@ -312,11 +312,11 @@ void ESSResourceDBStatic::_bind_methods() { ClassDB::bind_method(D_METHOD("set_remap_ids", "value"), &ESSResourceDBStatic::set_remap_ids); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "remap_ids"), "set_remap_ids", "get_remap_ids"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_resources", PROPERTY_HINT_NONE, "20/19:EntityResource", PROPERTY_USAGE_DEFAULT, "EntityResource"), "set_entity_resources", "get_entity_resources"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_skills", PROPERTY_HINT_NONE, "20/19:EntitySkillData", PROPERTY_USAGE_DEFAULT, "EntitySkillData"), "set_entity_skills", "get_entity_skills"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_datas", PROPERTY_HINT_NONE, "20/19:EntityData", PROPERTY_USAGE_DEFAULT, "EntityData"), "set_entity_datas", "get_entity_datas"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "craft_recipes", PROPERTY_HINT_NONE, "20/19:CraftRecipe", PROPERTY_USAGE_DEFAULT, "CraftRecipe"), "set_craft_recipes", "get_craft_recipes"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "item_templates", PROPERTY_HINT_NONE, "20/19:ItemTemplate", PROPERTY_USAGE_DEFAULT, "ItemTemplate"), "set_item_templates", "get_item_templates"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_species_datas", PROPERTY_HINT_NONE, "20/19:EntitySpeciesData", PROPERTY_USAGE_DEFAULT, "EntitySpeciesData"), "set_entity_species_datas", "get_entity_species_datas"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_resources", PROPERTY_HINT_NONE, "23/19:EntityResource", PROPERTY_USAGE_DEFAULT, "EntityResource"), "set_entity_resources", "get_entity_resources"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_skills", PROPERTY_HINT_NONE, "23/19:EntitySkillData", PROPERTY_USAGE_DEFAULT, "EntitySkillData"), "set_entity_skills", "get_entity_skills"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_datas", PROPERTY_HINT_NONE, "23/19:EntityData", PROPERTY_USAGE_DEFAULT, "EntityData"), "set_entity_datas", "get_entity_datas"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "craft_recipes", PROPERTY_HINT_NONE, "23/19:CraftRecipe", PROPERTY_USAGE_DEFAULT, "CraftRecipe"), "set_craft_recipes", "get_craft_recipes"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "item_templates", PROPERTY_HINT_NONE, "23/19:ItemTemplate", PROPERTY_USAGE_DEFAULT, "ItemTemplate"), "set_item_templates", "get_item_templates"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_species_datas", PROPERTY_HINT_NONE, "23/19:EntitySpeciesData", PROPERTY_USAGE_DEFAULT, "EntitySpeciesData"), "set_entity_species_datas", "get_entity_species_datas"); } diff --git a/modules/entity_spell_system/entities/data/entity_class_data.cpp b/modules/entity_spell_system/entities/data/entity_class_data.cpp index 6e7abb6da..b560084e6 100644 --- a/modules/entity_spell_system/entities/data/entity_class_data.cpp +++ b/modules/entity_spell_system/entities/data/entity_class_data.cpp @@ -415,7 +415,7 @@ void EntityClassData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_entity_resources"), &EntityClassData::get_entity_resources); ClassDB::bind_method(D_METHOD("set_entity_resources", "entity_resources"), &EntityClassData::set_entity_resources); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_resources", PROPERTY_HINT_NONE, "20/19:EntityResource", PROPERTY_USAGE_DEFAULT, "EntityResource"), "set_entity_resources", "get_entity_resources"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_resources", PROPERTY_HINT_NONE, "23/19:EntityResource", PROPERTY_USAGE_DEFAULT, "EntityResource"), "set_entity_resources", "get_entity_resources"); ClassDB::bind_method(D_METHOD("_setup_resources", "entity"), &EntityClassData::_setup_resources); @@ -428,7 +428,7 @@ void EntityClassData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_specs"), &EntityClassData::get_specs); ClassDB::bind_method(D_METHOD("set_specs", "specs"), &EntityClassData::set_specs); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "specs", PROPERTY_HINT_NONE, "20/19:CharacterSpec", PROPERTY_USAGE_DEFAULT, "CharacterSpec"), "set_specs", "get_specs"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "specs", PROPERTY_HINT_NONE, "23/19:CharacterSpec", PROPERTY_USAGE_DEFAULT, "CharacterSpec"), "set_specs", "get_specs"); //// Spell //// ClassDB::bind_method(D_METHOD("get_num_spells"), &EntityClassData::get_num_spells); @@ -439,7 +439,7 @@ void EntityClassData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_spells"), &EntityClassData::get_spells); ClassDB::bind_method(D_METHOD("set_spells", "spells"), &EntityClassData::set_spells); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells"); //// Start Spells //// ClassDB::bind_method(D_METHOD("get_num_start_spells"), &EntityClassData::get_num_start_spells); @@ -450,7 +450,7 @@ void EntityClassData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_start_spells"), &EntityClassData::get_start_spells); ClassDB::bind_method(D_METHOD("set_start_spells", "spells"), &EntityClassData::set_start_spells); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "start_spells", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_start_spells", "get_start_spells"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "start_spells", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_start_spells", "get_start_spells"); //// AURAS //// ClassDB::bind_method(D_METHOD("get_num_auras"), &EntityClassData::get_num_auras); @@ -461,7 +461,7 @@ void EntityClassData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_auras"), &EntityClassData::get_auras); ClassDB::bind_method(D_METHOD("set_auras", "auras"), &EntityClassData::set_auras); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras"); //Vendor ClassDB::bind_method(D_METHOD("get_vendor_item_data"), &EntityClassData::get_vendor_item_data); @@ -485,7 +485,7 @@ void EntityClassData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_craft_recipes"), &EntityClassData::get_craft_recipes); ClassDB::bind_method(D_METHOD("set_craft_recipes", "recipe"), &EntityClassData::set_craft_recipes); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "craft_recipes", PROPERTY_HINT_NONE, "20/19:CraftRecipe", PROPERTY_USAGE_DEFAULT, "CraftRecipe"), "set_craft_recipes", "get_craft_recipes"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "craft_recipes", PROPERTY_HINT_NONE, "23/19:CraftRecipe", PROPERTY_USAGE_DEFAULT, "CraftRecipe"), "set_craft_recipes", "get_craft_recipes"); //// AI ACTIONS //// ClassDB::bind_method(D_METHOD("get_num_ais"), &EntityClassData::get_num_ais); @@ -496,7 +496,7 @@ void EntityClassData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_ais"), &EntityClassData::get_ais); ClassDB::bind_method(D_METHOD("set_ais", "auras"), &EntityClassData::set_ais); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "ais", PROPERTY_HINT_NONE, "20/19:EntityAI", PROPERTY_USAGE_DEFAULT, "EntityAI"), "set_ais", "get_ais"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "ais", PROPERTY_HINT_NONE, "23/19:EntityAI", PROPERTY_USAGE_DEFAULT, "EntityAI"), "set_ais", "get_ais"); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "EntityAI"), "_get_ai_instance")); diff --git a/modules/entity_spell_system/entities/data/item_container_data.cpp b/modules/entity_spell_system/entities/data/item_container_data.cpp index 583c19b02..74e6198b0 100644 --- a/modules/entity_spell_system/entities/data/item_container_data.cpp +++ b/modules/entity_spell_system/entities/data/item_container_data.cpp @@ -70,5 +70,5 @@ void ItemContainerData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_container_datas"), &ItemContainerData::get_container_datas); ClassDB::bind_method(D_METHOD("set_container_datas", "container_datas"), &ItemContainerData::set_container_datas); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "container_datas", PROPERTY_HINT_NONE, "20/19:ItemContainerDataEntry", PROPERTY_USAGE_DEFAULT, "ItemContainerDataEntry"), "set_container_datas", "get_container_datas"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "container_datas", PROPERTY_HINT_NONE, "23/19:ItemContainerDataEntry", PROPERTY_USAGE_DEFAULT, "ItemContainerDataEntry"), "set_container_datas", "get_container_datas"); } diff --git a/modules/entity_spell_system/entities/data/vendor_item_data.cpp b/modules/entity_spell_system/entities/data/vendor_item_data.cpp index e05c7d940..edd0dccda 100644 --- a/modules/entity_spell_system/entities/data/vendor_item_data.cpp +++ b/modules/entity_spell_system/entities/data/vendor_item_data.cpp @@ -64,5 +64,5 @@ void VendorItemData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_vendor_datas"), &VendorItemData::get_vendor_datas); ClassDB::bind_method(D_METHOD("set_vendor_datas", "vendor_datas"), &VendorItemData::set_vendor_datas); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "vendor_datas", PROPERTY_HINT_NONE, "20/19:VendorItemDataEntry", PROPERTY_USAGE_DEFAULT, "VendorItemDataEntry"), "set_vendor_datas", "get_vendor_datas"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "vendor_datas", PROPERTY_HINT_NONE, "23/19:VendorItemDataEntry", PROPERTY_USAGE_DEFAULT, "VendorItemDataEntry"), "set_vendor_datas", "get_vendor_datas"); } diff --git a/modules/entity_spell_system/entities/entity.cpp b/modules/entity_spell_system/entities/entity.cpp index 7d4b423c6..c5ca6e273 100644 --- a/modules/entity_spell_system/entities/entity.cpp +++ b/modules/entity_spell_system/entities/entity.cpp @@ -7156,7 +7156,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("sauras_get"), &Entity::sauras_get); ClassDB::bind_method(D_METHOD("sauras_set", "data"), &Entity::sauras_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sauras", PROPERTY_HINT_NONE, "20/19:AuraData", PROPERTY_USAGE_ENTITY_HIDDEN, "AuraData"), "sauras_set", "sauras_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sauras", PROPERTY_HINT_NONE, "23/19:AuraData", PROPERTY_USAGE_ENTITY_HIDDEN, "AuraData"), "sauras_set", "sauras_get"); //Hooks BIND_VMETHOD(MethodInfo("_moved")); @@ -7406,7 +7406,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("sresources_get"), &Entity::sresources_get); ClassDB::bind_method(D_METHOD("sresources_set", "caster_aura_applys"), &Entity::sresources_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sresources", PROPERTY_HINT_NONE, "20/19:EntityResource", PROPERTY_USAGE_ENTITY_HIDDEN, "EntityResource"), "sresources_set", "sresources_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sresources", PROPERTY_HINT_NONE, "23/19:EntityResource", PROPERTY_USAGE_ENTITY_HIDDEN, "EntityResource"), "sresources_set", "sresources_get"); //GCD ADD_SIGNAL(MethodInfo("sgcd_started", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::REAL, "value"))); @@ -7441,7 +7441,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("sdatas_get"), &Entity::sdatas_get); ClassDB::bind_method(D_METHOD("sdatas_set", "data"), &Entity::sdatas_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sdatas", PROPERTY_HINT_NONE, "20/19:EntityDataContainer", PROPERTY_USAGE_ENTITY_HIDDEN, "EntityDataContainer"), "sdatas_set", "sdatas_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sdatas", PROPERTY_HINT_NONE, "23/19:EntityDataContainer", PROPERTY_USAGE_ENTITY_HIDDEN, "EntityDataContainer"), "sdatas_set", "sdatas_get"); //States ADD_SIGNAL(MethodInfo("sstate_changed", PropertyInfo(Variant::INT, "value"))); @@ -7577,7 +7577,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("sspells_get"), &Entity::sspells_get); ClassDB::bind_method(D_METHOD("sspells_set", "data"), &Entity::sspells_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sspells", PROPERTY_HINT_NONE, "20/19:Spell", PROPERTY_USAGE_ENTITY_HIDDEN, "Spell"), "sspells_set", "sspells_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sspells", PROPERTY_HINT_NONE, "23/19:Spell", PROPERTY_USAGE_ENTITY_HIDDEN, "Spell"), "sspells_set", "sspells_get"); //Crafting BIND_VMETHOD(MethodInfo("_crafts", PropertyInfo(Variant::INT, "id"))); @@ -7612,7 +7612,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("scraft_recipes_get"), &Entity::scraft_recipes_get); ClassDB::bind_method(D_METHOD("scraft_recipes_set", "caster_aura_applys"), &Entity::scraft_recipes_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "scraft_recipes", PROPERTY_HINT_NONE, "20/19:CraftRecipe", PROPERTY_USAGE_ENTITY_HIDDEN, "CraftRecipe"), "scraft_recipes_set", "scraft_recipes_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "scraft_recipes", PROPERTY_HINT_NONE, "23/19:CraftRecipe", PROPERTY_USAGE_ENTITY_HIDDEN, "CraftRecipe"), "scraft_recipes_set", "scraft_recipes_get"); //Skills ClassDB::bind_method(D_METHOD("skill_hass_id", "id"), &Entity::skill_hass_id); @@ -7636,7 +7636,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("sskills_get"), &Entity::sskills_get); ClassDB::bind_method(D_METHOD("sskills_set", "data"), &Entity::sskills_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sskills", PROPERTY_HINT_NONE, "20/19:EntitySkill", PROPERTY_USAGE_ENTITY_HIDDEN, "EntitySkill"), "sskills_set", "sskills_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "sskills", PROPERTY_HINT_NONE, "23/19:EntitySkill", PROPERTY_USAGE_ENTITY_HIDDEN, "EntitySkill"), "sskills_set", "sskills_get"); //skeleton ClassDB::bind_method(D_METHOD("get_body"), &Entity::get_body); diff --git a/modules/entity_spell_system/material_cache/ess_material_cache.cpp b/modules/entity_spell_system/material_cache/ess_material_cache.cpp index 2fff5b3e4..d42bb00dd 100644 --- a/modules/entity_spell_system/material_cache/ess_material_cache.cpp +++ b/modules/entity_spell_system/material_cache/ess_material_cache.cpp @@ -337,7 +337,7 @@ void ESSMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &ESSMaterialCache::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &ESSMaterialCache::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); ClassDB::bind_method(D_METHOD("texture_add", "texture"), &ESSMaterialCache::texture_add); ClassDB::bind_method(D_METHOD("texture_remove", "texture"), &ESSMaterialCache::texture_remove); diff --git a/modules/entity_spell_system/singletons/ess.cpp b/modules/entity_spell_system/singletons/ess.cpp index b5ef4a743..de09fc932 100644 --- a/modules/entity_spell_system/singletons/ess.cpp +++ b/modules/entity_spell_system/singletons/ess.cpp @@ -855,7 +855,7 @@ void ESS::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &ESS::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &ESS::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); ClassDB::bind_method(D_METHOD("material_cache_get", "key"), &ESS::material_cache_get); ClassDB::bind_method(D_METHOD("material_cache_unref", "key"), &ESS::material_cache_unref); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 386991c8e..f578d6551 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2183,10 +2183,11 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p } static const char *_type_names[Variant::VARIANT_MAX] = { - "null", "bool", "int", "float", "String", "Vector2", "Vector2i", "Rect2", "Rect2i", "Vector3", "Vector3i", "Transform2D", "Plane", - "Quaternion", "AABB", "Basis", "Transform", "Color", "NodePath", "RID", "Object", "Dictionary", "Array", - "PoolByteArray", "PoolIntArray", "PoolRealArray", "PoolStringArray", - "PoolVector2Array", "PoolVector2iArray", "PoolVector3Array", "PoolVector3iArray", "PoolColorArray" + "null", "bool", "int", "float", "String", "Rect2", "Rect2i", "Vector2", "Vector2i", "Vector3", "Vector3i", "Vector4", "Vector4i", + "Plane", "Quaternion", "AABB", "Basis", "Transform", "Transform2D", "Projection", "Color", "NodePath", + "RID", "Object", "StringName", "Dictionary", "Array", "PoolByteArray", "PoolIntArray", "PoolRealArray", "PoolStringArray", + "PoolVector2Array", "PoolVector2iArray", "PoolVector3Array", "PoolVector3iArray", + "PoolVector4Array", "PoolVector4iArray", "PoolColorArray" }; for (int i = 0; i < Variant::VARIANT_MAX; i++) { diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index a114bac8b..f8a3fb2ab 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -1371,6 +1371,14 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ PoolVector d = *p_args[0]; r_ret = d.size(); } break; + case Variant::POOL_VECTOR4_ARRAY: { + PoolVector d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::POOL_VECTOR4I_ARRAY: { + PoolVector d = *p_args[0]; + r_ret = d.size(); + } break; case Variant::POOL_COLOR_ARRAY: { PoolVector d = *p_args[0]; r_ret = d.size(); diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 7ff47098b..c83fb91a2 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -6749,6 +6749,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::POOL_VECTOR2I_ARRAY: case Variant::POOL_VECTOR3_ARRAY: case Variant::POOL_VECTOR3I_ARRAY: + case Variant::POOL_VECTOR4_ARRAY: + case Variant::POOL_VECTOR4I_ARRAY: case Variant::ARRAY: case Variant::STRING: { error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::REAL; @@ -6767,9 +6769,12 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::VECTOR2I: case Variant::VECTOR3: case Variant::VECTOR3I: + case Variant::VECTOR4: + case Variant::VECTOR4I: case Variant::TRANSFORM2D: case Variant::BASIS: - case Variant::TRANSFORM: { + case Variant::TRANSFORM: + case Variant::PROJECTION: { error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::REAL && index_type.builtin_type != Variant::STRING; } break; @@ -6801,7 +6806,11 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::POOL_REAL_ARRAY: case Variant::POOL_STRING_ARRAY: case Variant::POOL_VECTOR2_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::POOL_VECTOR2I_ARRAY: + case Variant::POOL_VECTOR3_ARRAY: + case Variant::POOL_VECTOR3I_ARRAY: + case Variant::POOL_VECTOR4_ARRAY: + case Variant::POOL_VECTOR4I_ARRAY: { break; } default: { @@ -6842,12 +6851,15 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::INT: case Variant::REAL: case Variant::NODE_PATH: - case Variant::_RID: { + case Variant::RID: { _set_error("Can't index on a value of type \"" + base_type.to_string() + "\".", op->line); return DataType(); } break; // Return int case Variant::POOL_BYTE_ARRAY: + case Variant::VECTOR2I: + case Variant::VECTOR3I: + case Variant::VECTOR4I: case Variant::POOL_INT_ARRAY: { result.builtin_type = Variant::INT; } break; @@ -6855,6 +6867,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::POOL_REAL_ARRAY: case Variant::VECTOR2: case Variant::VECTOR3: + case Variant::VECTOR4: case Variant::QUATERNION: { result.builtin_type = Variant::REAL; } break; @@ -6872,12 +6885,22 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::TRANSFORM2D: case Variant::RECT2: { result.builtin_type = Variant::VECTOR2; + } break; + case Variant::POOL_VECTOR2I_ARRAY: + case Variant::RECT2I: { + result.builtin_type = Variant::VECTOR2I; } break; // Return Vector3 case Variant::POOL_VECTOR3_ARRAY: case Variant::AABB: case Variant::BASIS: { result.builtin_type = Variant::VECTOR3; + } break; + case Variant::POOL_VECTOR3I_ARRAY: { + result.builtin_type = Variant::VECTOR3I; + } break; + case Variant::PROJECTION: { + result.builtin_type = Variant::VECTOR4; } break; // Depends on the index case Variant::TRANSFORM: diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index 248bcd7de..2f160ff77 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -150,23 +150,26 @@ static const _bit _type_list[] = { { Variant::INT, "int" }, { Variant::REAL, "float" }, { Variant::STRING, "String" }, - { Variant::VECTOR2, "Vector2" }, - { Variant::VECTOR2I, "Vector2i" }, { Variant::RECT2, "Rect2" }, { Variant::RECT2I, "Rect2i" }, - { Variant::TRANSFORM2D, "Transform2D" }, + { Variant::VECTOR2, "Vector2" }, + { Variant::VECTOR2I, "Vector2i" }, { Variant::VECTOR3, "Vector3" }, { Variant::VECTOR3I, "Vector3i" }, - { Variant::AABB, "AABB" }, + { Variant::VECTOR4, "Vector4" }, + { Variant::VECTOR4I, "Vector4i" }, { Variant::PLANE, "Plane" }, { Variant::QUATERNION, "Quaternion" }, + { Variant::AABB, "AABB" }, { Variant::BASIS, "Basis" }, { Variant::TRANSFORM, "Transform" }, + { Variant::TRANSFORM2D, "Transform2D" }, + { Variant::PROJECTION, "Projection" }, { Variant::COLOR, "Color" }, - { Variant::_RID, "RID" }, + { Variant::NODE_PATH, "NodePath" }, + { Variant::RID, "RID" }, { Variant::OBJECT, "Object" }, { Variant::STRING_NAME, "StringName" }, - { Variant::NODE_PATH, "NodePath" }, { Variant::DICTIONARY, "Dictionary" }, { Variant::ARRAY, "Array" }, { Variant::POOL_BYTE_ARRAY, "PoolByteArray" }, @@ -177,6 +180,8 @@ static const _bit _type_list[] = { { Variant::POOL_VECTOR2I_ARRAY, "PoolVector2iArray" }, { Variant::POOL_VECTOR3_ARRAY, "PoolVector3Array" }, { Variant::POOL_VECTOR3I_ARRAY, "PoolVector3iArray" }, + { Variant::POOL_VECTOR4_ARRAY, "PoolVector4Array" }, + { Variant::POOL_VECTOR4I_ARRAY, "PoolVector4iArray" }, { Variant::POOL_COLOR_ARRAY, "PoolColorArray" }, { Variant::VARIANT_MAX, nullptr }, }; diff --git a/modules/material_maker/nodes/mm_material.cpp b/modules/material_maker/nodes/mm_material.cpp index 87e586f33..08e7da539 100644 --- a/modules/material_maker/nodes/mm_material.cpp +++ b/modules/material_maker/nodes/mm_material.cpp @@ -221,7 +221,7 @@ void MMMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("get_nodes"), &MMMaterial::get_nodes); ClassDB::bind_method(D_METHOD("set_nodes", "value"), &MMMaterial::set_nodes); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "nodes", PROPERTY_HINT_NONE, "20/19:MMNode", PROPERTY_USAGE_DEFAULT, "MMNode"), "set_nodes", "get_nodes"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "nodes", PROPERTY_HINT_NONE, "23/19:MMNode", PROPERTY_USAGE_DEFAULT, "MMNode"), "set_nodes", "get_nodes"); ClassDB::bind_method(D_METHOD("get_initialized"), &MMMaterial::get_initialized); ClassDB::bind_method(D_METHOD("set_initialized", "value"), &MMMaterial::set_initialized); diff --git a/modules/material_maker/nodes/mm_node.cpp b/modules/material_maker/nodes/mm_node.cpp index 8fbae9987..663f4730c 100644 --- a/modules/material_maker/nodes/mm_node.cpp +++ b/modules/material_maker/nodes/mm_node.cpp @@ -236,11 +236,11 @@ void MMNode::_bind_methods() { ClassDB::bind_method(D_METHOD("get_input_properties"), &MMNode::get_input_properties); ClassDB::bind_method(D_METHOD("set_input_properties", "value"), &MMNode::set_input_properties); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "input_properties", PROPERTY_HINT_NONE, "20/19:MMNodeUniversalProperty", PROPERTY_USAGE_DEFAULT, "MMNodeUniversalProperty"), "set_input_properties", "get_input_properties"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "input_properties", PROPERTY_HINT_NONE, "23/19:MMNodeUniversalProperty", PROPERTY_USAGE_DEFAULT, "MMNodeUniversalProperty"), "set_input_properties", "get_input_properties"); ClassDB::bind_method(D_METHOD("get_output_properties"), &MMNode::get_output_properties); ClassDB::bind_method(D_METHOD("set_output_properties", "value"), &MMNode::set_output_properties); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "output_properties", PROPERTY_HINT_NONE, "20/19:MMNodeUniversalProperty", PROPERTY_USAGE_DEFAULT, "MMNodeUniversalProperty"), "set_output_properties", "get_output_properties"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "output_properties", PROPERTY_HINT_NONE, "23/19:MMNodeUniversalProperty", PROPERTY_USAGE_DEFAULT, "MMNodeUniversalProperty"), "set_output_properties", "get_output_properties"); ClassDB::bind_method(D_METHOD("get_properties_initialized"), &MMNode::get_properties_initialized); ClassDB::bind_method(D_METHOD("set_properties_initialized", "value"), &MMNode::set_properties_initialized); diff --git a/modules/props/material_cache/prop_material_cache.cpp b/modules/props/material_cache/prop_material_cache.cpp index 3e729a2f7..1c98ba3a4 100644 --- a/modules/props/material_cache/prop_material_cache.cpp +++ b/modules/props/material_cache/prop_material_cache.cpp @@ -329,7 +329,7 @@ void PropMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &PropMaterialCache::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &PropMaterialCache::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); ClassDB::bind_method(D_METHOD("texture_add", "texture"), &PropMaterialCache::texture_add); ClassDB::bind_method(D_METHOD("texture_remove", "texture"), &PropMaterialCache::texture_remove); diff --git a/modules/props/prop_instance_merger.cpp b/modules/props/prop_instance_merger.cpp index 821c1b5e0..2e4bb2c6b 100644 --- a/modules/props/prop_instance_merger.cpp +++ b/modules/props/prop_instance_merger.cpp @@ -957,7 +957,7 @@ void PropInstanceMerger::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &PropInstanceMerger::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &PropInstanceMerger::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); //Meshes ClassDB::bind_method(D_METHOD("mesh_get", "index"), &PropInstanceMerger::mesh_get); diff --git a/modules/props/props/prop_data.cpp b/modules/props/props/prop_data.cpp index 2fc8e52bc..9cad0bf52 100644 --- a/modules/props/props/prop_data.cpp +++ b/modules/props/props/prop_data.cpp @@ -161,7 +161,7 @@ void PropData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_props"), &PropData::get_props); ClassDB::bind_method(D_METHOD("set_props", "props"), &PropData::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "20/19:PropDataEntry", PROPERTY_USAGE_DEFAULT, "PropDataEntry"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropDataEntry", PROPERTY_USAGE_DEFAULT, "PropDataEntry"), "set_props", "get_props"); #if TEXTURE_PACKER_PRESENT ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &PropData::add_textures_into); diff --git a/modules/props/singleton/prop_cache.cpp b/modules/props/singleton/prop_cache.cpp index 5cd4cda8a..e6cd75e69 100644 --- a/modules/props/singleton/prop_cache.cpp +++ b/modules/props/singleton/prop_cache.cpp @@ -408,7 +408,7 @@ void PropCache::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &PropCache::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &PropCache::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); ClassDB::bind_method(D_METHOD("material_cache_get", "prop"), &PropCache::material_cache_get); ClassDB::bind_method(D_METHOD("material_cache_unref", "prop"), &PropCache::material_cache_unref); diff --git a/modules/props/tiled_wall/tiled_wall_data.cpp b/modules/props/tiled_wall/tiled_wall_data.cpp index bd1b3189c..e69cb0b1b 100644 --- a/modules/props/tiled_wall/tiled_wall_data.cpp +++ b/modules/props/tiled_wall/tiled_wall_data.cpp @@ -565,7 +565,7 @@ void TiledWallData::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &TiledWallData::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &TiledWallData::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); #if TEXTURE_PACKER_PRESENT ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &TiledWallData::add_textures_into); diff --git a/modules/props_2d/props/prop_2d_data.cpp b/modules/props_2d/props/prop_2d_data.cpp index 4e5891d35..d9a5090fe 100644 --- a/modules/props_2d/props/prop_2d_data.cpp +++ b/modules/props_2d/props/prop_2d_data.cpp @@ -139,7 +139,7 @@ void Prop2DData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_props"), &Prop2DData::get_props); ClassDB::bind_method(D_METHOD("set_props", "props"), &Prop2DData::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "20/19:Prop2DDataEntry", PROPERTY_USAGE_DEFAULT, "Prop2DDataEntry"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:Prop2DDataEntry", PROPERTY_USAGE_DEFAULT, "Prop2DDataEntry"), "set_props", "get_props"); #if TEXTURE_PACKER_PRESENT ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &Prop2DData::add_textures_into); diff --git a/modules/props_2d/tiled_wall/tiled_wall_2d_data.cpp b/modules/props_2d/tiled_wall/tiled_wall_2d_data.cpp index 3f7c54380..ef4490282 100644 --- a/modules/props_2d/tiled_wall/tiled_wall_2d_data.cpp +++ b/modules/props_2d/tiled_wall/tiled_wall_2d_data.cpp @@ -255,7 +255,7 @@ void TiledWall2DData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_textures"), &TiledWall2DData::get_textures); ClassDB::bind_method(D_METHOD("set_textures", "textures"), &TiledWall2DData::set_textures); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "20/19:Texture", PROPERTY_USAGE_DEFAULT, "Texture"), "set_textures", "get_textures"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "23/19:Texture", PROPERTY_USAGE_DEFAULT, "Texture"), "set_textures", "get_textures"); //flavour_textures ClassDB::bind_method(D_METHOD("get_flavour_texture", "index"), &TiledWall2DData::get_flavour_texture); @@ -267,7 +267,7 @@ void TiledWall2DData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_flavour_textures"), &TiledWall2DData::get_flavour_textures); ClassDB::bind_method(D_METHOD("set_flavour_textures", "textures"), &TiledWall2DData::set_flavour_textures); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "flavour_textures", PROPERTY_HINT_NONE, "20/19:Texture", PROPERTY_USAGE_DEFAULT, "Texture"), "set_flavour_textures", "get_flavour_textures"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "flavour_textures", PROPERTY_HINT_NONE, "23/19:Texture", PROPERTY_USAGE_DEFAULT, "Texture"), "set_flavour_textures", "get_flavour_textures"); ClassDB::bind_method(D_METHOD("get_flavour_chance"), &TiledWall2DData::get_flavour_chance); ClassDB::bind_method(D_METHOD("set_flavour_chance", "texture"), &TiledWall2DData::set_flavour_chance); diff --git a/modules/terraman/library/terrain_library.cpp b/modules/terraman/library/terrain_library.cpp index 725a8399e..291a2661f 100644 --- a/modules/terraman/library/terrain_library.cpp +++ b/modules/terraman/library/terrain_library.cpp @@ -390,7 +390,7 @@ void TerrainLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &TerrainLibrary::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &TerrainLibrary::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); BIND_VMETHOD(MethodInfo("_liquid_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "TerrainMaterialCache"), "_liquid_material_cache_get", PropertyInfo(Variant::INT, "key"))); @@ -414,7 +414,7 @@ void TerrainLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("liquid_materials_get"), &TerrainLibrary::liquid_materials_get); ClassDB::bind_method(D_METHOD("liquid_materials_set"), &TerrainLibrary::liquid_materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "liquid_materials_set", "liquid_materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "liquid_materials_set", "liquid_materials_get"); BIND_VMETHOD(MethodInfo("_prop_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "TerrainMaterialCache"), "_prop_material_cache_get", PropertyInfo(Variant::INT, "key"))); @@ -438,7 +438,7 @@ void TerrainLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("prop_materials_get"), &TerrainLibrary::prop_materials_get); ClassDB::bind_method(D_METHOD("prop_materials_set"), &TerrainLibrary::prop_materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "prop_materials_set", "prop_materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "prop_materials_set", "prop_materials_get"); ClassDB::bind_method(D_METHOD("terra_surface_get", "index"), &TerrainLibrary::terra_surface_get); ClassDB::bind_method(D_METHOD("terra_surface_add", "value"), &TerrainLibrary::terra_surface_add); diff --git a/modules/terraman/library/terrain_library_merger.cpp b/modules/terraman/library/terrain_library_merger.cpp index 7da309ebe..20e08348a 100644 --- a/modules/terraman/library/terrain_library_merger.cpp +++ b/modules/terraman/library/terrain_library_merger.cpp @@ -460,12 +460,12 @@ void TerrainLibraryMerger::_bind_methods() { ClassDB::bind_method(D_METHOD("get_terra_surfaces"), &TerrainLibraryMerger::get_terra_surfaces); ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &TerrainLibraryMerger::set_terra_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "20/19:TerrainSurfaceMerger", PROPERTY_USAGE_DEFAULT, "TerrainSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "23/19:TerrainSurfaceMerger", PROPERTY_USAGE_DEFAULT, "TerrainSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); #ifdef PROPS_PRESENT ClassDB::bind_method(D_METHOD("get_props"), &TerrainLibraryMerger::get_props); ClassDB::bind_method(D_METHOD("set_props"), &TerrainLibraryMerger::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "20/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &TerrainLibraryMerger::get_prop_uv_rect); diff --git a/modules/terraman/library/terrain_library_merger_pcm.cpp b/modules/terraman/library/terrain_library_merger_pcm.cpp index cbb76246a..9a9457094 100644 --- a/modules/terraman/library/terrain_library_merger_pcm.cpp +++ b/modules/terraman/library/terrain_library_merger_pcm.cpp @@ -1000,12 +1000,12 @@ void TerrainLibraryMergerPCM::_bind_methods() { ClassDB::bind_method(D_METHOD("get_terra_surfaces"), &TerrainLibraryMergerPCM::get_terra_surfaces); ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &TerrainLibraryMergerPCM::set_terra_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "20/19:TerrainSurfaceMerger", PROPERTY_USAGE_DEFAULT, "TerrainSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "23/19:TerrainSurfaceMerger", PROPERTY_USAGE_DEFAULT, "TerrainSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); #ifdef PROPS_PRESENT ClassDB::bind_method(D_METHOD("get_props"), &TerrainLibraryMergerPCM::get_props); ClassDB::bind_method(D_METHOD("set_props"), &TerrainLibraryMergerPCM::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "20/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &TerrainLibraryMergerPCM::get_prop_uv_rect); diff --git a/modules/terraman/library/terrain_library_simple.cpp b/modules/terraman/library/terrain_library_simple.cpp index da05b0994..d2e56e922 100644 --- a/modules/terraman/library/terrain_library_simple.cpp +++ b/modules/terraman/library/terrain_library_simple.cpp @@ -147,5 +147,5 @@ void TerrainLibrarySimple::_bind_methods() { ClassDB::bind_method(D_METHOD("get_terra_surfaces"), &TerrainLibrarySimple::get_terra_surfaces); ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &TerrainLibrarySimple::set_terra_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "20/19:TerrainSurfaceSimple", PROPERTY_USAGE_DEFAULT, "TerrainSurfaceSimple"), "set_terra_surfaces", "get_terra_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "23/19:TerrainSurfaceSimple", PROPERTY_USAGE_DEFAULT, "TerrainSurfaceSimple"), "set_terra_surfaces", "get_terra_surfaces"); } diff --git a/modules/terraman/library/terrain_material_cache.cpp b/modules/terraman/library/terrain_material_cache.cpp index 7a4e943a5..b0ba796e2 100644 --- a/modules/terraman/library/terrain_material_cache.cpp +++ b/modules/terraman/library/terrain_material_cache.cpp @@ -294,7 +294,7 @@ void TerrainMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &TerrainMaterialCache::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &TerrainMaterialCache::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); ClassDB::bind_method(D_METHOD("surface_get", "index"), &TerrainMaterialCache::surface_get); ClassDB::bind_method(D_METHOD("surface_id_get", "index"), &TerrainMaterialCache::surface_id_get); diff --git a/modules/terraman/world/default/terrain_chunk_default.cpp b/modules/terraman/world/default/terrain_chunk_default.cpp index 5791782c7..c76c335a4 100644 --- a/modules/terraman/world/default/terrain_chunk_default.cpp +++ b/modules/terraman/world/default/terrain_chunk_default.cpp @@ -125,7 +125,7 @@ RID TerrainChunkDefault::mesh_rid_get(const int mesh_index, const int mesh_type_ Variant v = m[mesh_type_index]; - if (v.get_type() != Variant::_RID) + if (v.get_type() != Variant::RID) return RID(); return v; @@ -144,7 +144,7 @@ void TerrainChunkDefault::mesh_rid_set(const int mesh_index, const int mesh_type Variant v = m[mesh_type_index]; - ERR_FAIL_COND(v.get_type() != Variant::_RID); + ERR_FAIL_COND(v.get_type() != Variant::RID); m[mesh_type_index] = value; _rids[mesh_index] = m; diff --git a/modules/terraman/world/terrain_chunk.cpp b/modules/terraman/world/terrain_chunk.cpp index 8b4b8db9a..43eb798ed 100644 --- a/modules/terraman/world/terrain_chunk.cpp +++ b/modules/terraman/world/terrain_chunk.cpp @@ -1476,7 +1476,7 @@ void TerrainChunk::_bind_methods() { ClassDB::bind_method(D_METHOD("voxel_structures_get"), &TerrainChunk::voxel_structures_get); ClassDB::bind_method(D_METHOD("voxel_structures_set"), &TerrainChunk::voxel_structures_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "20/19:TerrainStructure", PROPERTY_USAGE_DEFAULT, "TerrainStructure"), "voxel_structures_set", "voxel_structures_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "23/19:TerrainStructure", PROPERTY_USAGE_DEFAULT, "TerrainStructure"), "voxel_structures_set", "voxel_structures_get"); //Meshes diff --git a/modules/terraman/world/terrain_world.cpp b/modules/terraman/world/terrain_world.cpp index 93db3613b..1307183fe 100644 --- a/modules/terraman/world/terrain_world.cpp +++ b/modules/terraman/world/terrain_world.cpp @@ -1149,7 +1149,7 @@ void TerrainWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("voxel_structures_get"), &TerrainWorld::voxel_structures_get); ClassDB::bind_method(D_METHOD("voxel_structures_set"), &TerrainWorld::voxel_structures_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "20/19:TerrainStructure", PROPERTY_USAGE_DEFAULT, "TerrainStructure"), "voxel_structures_set", "voxel_structures_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "23/19:TerrainStructure", PROPERTY_USAGE_DEFAULT, "TerrainStructure"), "voxel_structures_set", "voxel_structures_get"); BIND_VMETHOD(MethodInfo("_chunk_added", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); @@ -1166,7 +1166,7 @@ void TerrainWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("chunks_get"), &TerrainWorld::chunks_get); ClassDB::bind_method(D_METHOD("chunks_set"), &TerrainWorld::chunks_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "chunks", PROPERTY_HINT_NONE, "20/19:TerrainChunk", PROPERTY_USAGE_DEFAULT, "TerrainChunk"), "chunks_set", "chunks_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "chunks", PROPERTY_HINT_NONE, "23/19:TerrainChunk", PROPERTY_USAGE_DEFAULT, "TerrainChunk"), "chunks_set", "chunks_get"); ClassDB::bind_method(D_METHOD("generation_queue_add_to", "chunk"), &TerrainWorld::generation_queue_add_to); ClassDB::bind_method(D_METHOD("generation_queue_get_index", "index"), &TerrainWorld::generation_queue_get_index); diff --git a/modules/terraman_2d/library/terrain_2d_library_merger.cpp b/modules/terraman_2d/library/terrain_2d_library_merger.cpp index 20dd05b4e..fd5a0097c 100644 --- a/modules/terraman_2d/library/terrain_2d_library_merger.cpp +++ b/modules/terraman_2d/library/terrain_2d_library_merger.cpp @@ -414,12 +414,12 @@ void Terrain2DLibraryMerger::_bind_methods() { ClassDB::bind_method(D_METHOD("get_terra_surfaces"), &Terrain2DLibraryMerger::get_terra_surfaces); ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &Terrain2DLibraryMerger::set_terra_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "20/19:Terrain2DSurfaceMerger", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "23/19:Terrain2DSurfaceMerger", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); #ifdef PROPS_2D_PRESENT ClassDB::bind_method(D_METHOD("get_props"), &Terrain2DLibraryMerger::get_props); ClassDB::bind_method(D_METHOD("set_props"), &Terrain2DLibraryMerger::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "20/19:Prop2DData", PROPERTY_USAGE_DEFAULT, "Prop2DData"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:Prop2DData", PROPERTY_USAGE_DEFAULT, "Prop2DData"), "set_props", "get_props"); ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &Terrain2DLibraryMerger::get_prop_uv_rect); diff --git a/modules/terraman_2d/library/terrain_2d_library_merger_pcm.cpp b/modules/terraman_2d/library/terrain_2d_library_merger_pcm.cpp index 5ebd3b614..8f5a2dea9 100644 --- a/modules/terraman_2d/library/terrain_2d_library_merger_pcm.cpp +++ b/modules/terraman_2d/library/terrain_2d_library_merger_pcm.cpp @@ -790,12 +790,12 @@ void Terrain2DLibraryMergerPCM::_bind_methods() { ClassDB::bind_method(D_METHOD("get_terra_surfaces"), &Terrain2DLibraryMergerPCM::get_terra_surfaces); ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &Terrain2DLibraryMergerPCM::set_terra_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "20/19:Terrain2DSurfaceMerger", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "23/19:Terrain2DSurfaceMerger", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); #ifdef PROPS_2D_PRESENT ClassDB::bind_method(D_METHOD("get_props"), &Terrain2DLibraryMergerPCM::get_props); ClassDB::bind_method(D_METHOD("set_props"), &Terrain2DLibraryMergerPCM::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "20/19:Prop2DData", PROPERTY_USAGE_DEFAULT, "Prop2DData"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:Prop2DData", PROPERTY_USAGE_DEFAULT, "Prop2DData"), "set_props", "get_props"); ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &Terrain2DLibraryMergerPCM::get_prop_uv_rect); diff --git a/modules/terraman_2d/library/terrain_2d_library_simple.cpp b/modules/terraman_2d/library/terrain_2d_library_simple.cpp index a3bc4a7d7..75109390d 100644 --- a/modules/terraman_2d/library/terrain_2d_library_simple.cpp +++ b/modules/terraman_2d/library/terrain_2d_library_simple.cpp @@ -147,5 +147,5 @@ void Terrain2DLibrarySimple::_bind_methods() { ClassDB::bind_method(D_METHOD("get_terra_surfaces"), &Terrain2DLibrarySimple::get_terra_surfaces); ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &Terrain2DLibrarySimple::set_terra_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "20/19:Terrain2DSurfaceSimple", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceSimple"), "set_terra_surfaces", "get_terra_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "23/19:Terrain2DSurfaceSimple", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceSimple"), "set_terra_surfaces", "get_terra_surfaces"); } diff --git a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp index 1a62a0f9e..e2ed62884 100644 --- a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp +++ b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp @@ -85,7 +85,7 @@ RID Terrain2DChunkDefault::mesh_rid_get(const int mesh_index, const int mesh_typ Variant v = m[mesh_type_index]; - if (v.get_type() != Variant::_RID) + if (v.get_type() != Variant::RID) return RID(); return v; @@ -104,7 +104,7 @@ void Terrain2DChunkDefault::mesh_rid_set(const int mesh_index, const int mesh_ty Variant v = m[mesh_type_index]; - ERR_FAIL_COND(v.get_type() != Variant::_RID); + ERR_FAIL_COND(v.get_type() != Variant::RID); m[mesh_type_index] = value; _rids[mesh_index] = m; diff --git a/modules/terraman_2d/world/terrain_2d_chunk.cpp b/modules/terraman_2d/world/terrain_2d_chunk.cpp index 54f81d107..01b7c4380 100644 --- a/modules/terraman_2d/world/terrain_2d_chunk.cpp +++ b/modules/terraman_2d/world/terrain_2d_chunk.cpp @@ -1598,7 +1598,7 @@ void Terrain2DChunk::_bind_methods() { ClassDB::bind_method(D_METHOD("voxel_structures_get"), &Terrain2DChunk::voxel_structures_get); ClassDB::bind_method(D_METHOD("voxel_structures_set"), &Terrain2DChunk::voxel_structures_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "20/19:Terrain2DStructure", PROPERTY_USAGE_DEFAULT, "Terrain2DStructure"), "voxel_structures_set", "voxel_structures_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "23/19:Terrain2DStructure", PROPERTY_USAGE_DEFAULT, "Terrain2DStructure"), "voxel_structures_set", "voxel_structures_get"); //Meshes diff --git a/modules/terraman_2d/world/terrain_2d_world.cpp b/modules/terraman_2d/world/terrain_2d_world.cpp index 7fdd7e56f..b174e81ec 100644 --- a/modules/terraman_2d/world/terrain_2d_world.cpp +++ b/modules/terraman_2d/world/terrain_2d_world.cpp @@ -1236,7 +1236,7 @@ void Terrain2DWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("voxel_structures_get"), &Terrain2DWorld::voxel_structures_get); ClassDB::bind_method(D_METHOD("voxel_structures_set"), &Terrain2DWorld::voxel_structures_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "20/19:Terrain2DStructure", PROPERTY_USAGE_DEFAULT, "Terrain2DStructure"), "voxel_structures_set", "voxel_structures_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "23/19:Terrain2DStructure", PROPERTY_USAGE_DEFAULT, "Terrain2DStructure"), "voxel_structures_set", "voxel_structures_get"); BIND_VMETHOD(MethodInfo("_chunk_added", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); @@ -1253,7 +1253,7 @@ void Terrain2DWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("chunks_get"), &Terrain2DWorld::chunks_get); ClassDB::bind_method(D_METHOD("chunks_set"), &Terrain2DWorld::chunks_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "chunks", PROPERTY_HINT_NONE, "20/19:Terrain2DChunk", PROPERTY_USAGE_DEFAULT, "Terrain2DChunk"), "chunks_set", "chunks_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "chunks", PROPERTY_HINT_NONE, "23/19:Terrain2DChunk", PROPERTY_USAGE_DEFAULT, "Terrain2DChunk"), "chunks_set", "chunks_get"); ClassDB::bind_method(D_METHOD("generation_queue_add_to", "chunk"), &Terrain2DWorld::generation_queue_add_to); ClassDB::bind_method(D_METHOD("generation_queue_get_index", "index"), &Terrain2DWorld::generation_queue_get_index); diff --git a/modules/texture_packer/texture_merger.cpp b/modules/texture_packer/texture_merger.cpp index 59cf28711..d1ecade58 100644 --- a/modules/texture_packer/texture_merger.cpp +++ b/modules/texture_packer/texture_merger.cpp @@ -314,7 +314,7 @@ void TextureMerger::_bind_methods() { ClassDB::bind_method(D_METHOD("get_textures"), &TextureMerger::get_textures); ClassDB::bind_method(D_METHOD("set_textures", "textures"), &TextureMerger::set_textures); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "20/19:Texture", PROPERTY_USAGE_DEFAULT, "Texture"), "set_textures", "get_textures"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "23/19:Texture", PROPERTY_USAGE_DEFAULT, "Texture"), "set_textures", "get_textures"); ClassDB::bind_method(D_METHOD("get_packer"), &TextureMerger::get_packer); ClassDB::bind_method(D_METHOD("set_packer", "packer"), &TextureMerger::set_packer); diff --git a/modules/users/managers/user_manager_static.cpp b/modules/users/managers/user_manager_static.cpp index 2601f74c1..64febd186 100644 --- a/modules/users/managers/user_manager_static.cpp +++ b/modules/users/managers/user_manager_static.cpp @@ -128,7 +128,7 @@ UserManagerStatic::~UserManagerStatic() { void UserManagerStatic::_bind_methods() { ClassDB::bind_method(D_METHOD("get_users"), &UserManagerStatic::get_users); ClassDB::bind_method(D_METHOD("set_users", "users"), &UserManagerStatic::set_users); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "users", PROPERTY_HINT_NONE, "20/19:User", PROPERTY_USAGE_DEFAULT, "User"), "set_users", "get_users"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "users", PROPERTY_HINT_NONE, "23/19:User", PROPERTY_USAGE_DEFAULT, "User"), "set_users", "get_users"); ClassDB::bind_method(D_METHOD("get_create_user_name"), &UserManagerStatic::get_create_user_name_bind); ClassDB::bind_method(D_METHOD("set_create_user_name", "val"), &UserManagerStatic::set_create_user_name_bind); diff --git a/modules/users/users/user.cpp b/modules/users/users/user.cpp index c93da8f8c..d33be7aff 100644 --- a/modules/users/users/user.cpp +++ b/modules/users/users/user.cpp @@ -327,7 +327,7 @@ void User::_bind_methods() { ClassDB::bind_method(D_METHOD("get_modules"), &User::get_modules); ClassDB::bind_method(D_METHOD("set_modules", "modules"), &User::set_modules); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "modules", PROPERTY_HINT_NONE, "20/19:UserModule", PROPERTY_USAGE_DEFAULT, "UserModule"), "set_modules", "get_modules"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "modules", PROPERTY_HINT_NONE, "23/19:UserModule", PROPERTY_USAGE_DEFAULT, "UserModule"), "set_modules", "get_modules"); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "ret"), "_check_password", PropertyInfo(Variant::STRING, "password"))); BIND_VMETHOD(MethodInfo("_create_password", PropertyInfo(Variant::STRING, "password"))); diff --git a/modules/voxelman/library/voxel_library.cpp b/modules/voxelman/library/voxel_library.cpp index 6ce8c0e8f..9b85c068f 100644 --- a/modules/voxelman/library/voxel_library.cpp +++ b/modules/voxelman/library/voxel_library.cpp @@ -391,7 +391,7 @@ void VoxelLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &VoxelLibrary::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &VoxelLibrary::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); BIND_VMETHOD(MethodInfo("_liquid_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "TerrainMaterialCache"), "_liquid_material_cache_get", PropertyInfo(Variant::INT, "key"))); @@ -415,7 +415,7 @@ void VoxelLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("liquid_materials_get"), &VoxelLibrary::liquid_materials_get); ClassDB::bind_method(D_METHOD("liquid_materials_set"), &VoxelLibrary::liquid_materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "liquid_materials_set", "liquid_materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "liquid_materials_set", "liquid_materials_get"); BIND_VMETHOD(MethodInfo("_prop_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "TerrainMaterialCache"), "_prop_material_cache_get", PropertyInfo(Variant::INT, "key"))); @@ -439,7 +439,7 @@ void VoxelLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("prop_materials_get"), &VoxelLibrary::prop_materials_get); ClassDB::bind_method(D_METHOD("prop_materials_set"), &VoxelLibrary::prop_materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "prop_materials_set", "prop_materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "prop_materials_set", "prop_materials_get"); ClassDB::bind_method(D_METHOD("voxel_surface_get", "index"), &VoxelLibrary::voxel_surface_get); ClassDB::bind_method(D_METHOD("voxel_surface_add", "value"), &VoxelLibrary::voxel_surface_add); diff --git a/modules/voxelman/library/voxel_library_merger.cpp b/modules/voxelman/library/voxel_library_merger.cpp index 6f1f8726a..8269db488 100644 --- a/modules/voxelman/library/voxel_library_merger.cpp +++ b/modules/voxelman/library/voxel_library_merger.cpp @@ -458,12 +458,12 @@ void VoxelLibraryMerger::_bind_methods() { ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &VoxelLibraryMerger::get_voxel_surfaces); ClassDB::bind_method(D_METHOD("set_voxel_surfaces"), &VoxelLibraryMerger::set_voxel_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "20/19:VoxelSurfaceMerger", PROPERTY_USAGE_DEFAULT, "VoxelSurfaceMerger"), "set_voxel_surfaces", "get_voxel_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "23/19:VoxelSurfaceMerger", PROPERTY_USAGE_DEFAULT, "VoxelSurfaceMerger"), "set_voxel_surfaces", "get_voxel_surfaces"); #ifdef PROPS_PRESENT ClassDB::bind_method(D_METHOD("get_props"), &VoxelLibraryMerger::get_props); ClassDB::bind_method(D_METHOD("set_props"), &VoxelLibraryMerger::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "20/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &VoxelLibraryMerger::get_prop_uv_rect); diff --git a/modules/voxelman/library/voxel_library_merger_pcm.cpp b/modules/voxelman/library/voxel_library_merger_pcm.cpp index 02733bc91..3a6b1bc58 100644 --- a/modules/voxelman/library/voxel_library_merger_pcm.cpp +++ b/modules/voxelman/library/voxel_library_merger_pcm.cpp @@ -801,12 +801,12 @@ void VoxelLibraryMergerPCM::_bind_methods() { ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &VoxelLibraryMergerPCM::get_voxel_surfaces); ClassDB::bind_method(D_METHOD("set_voxel_surfaces"), &VoxelLibraryMergerPCM::set_voxel_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "20/19:VoxelSurfaceMerger", PROPERTY_USAGE_DEFAULT, "VoxelSurfaceMerger"), "set_voxel_surfaces", "get_voxel_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "23/19:VoxelSurfaceMerger", PROPERTY_USAGE_DEFAULT, "VoxelSurfaceMerger"), "set_voxel_surfaces", "get_voxel_surfaces"); #ifdef PROPS_PRESENT ClassDB::bind_method(D_METHOD("get_props"), &VoxelLibraryMergerPCM::get_props); ClassDB::bind_method(D_METHOD("set_props"), &VoxelLibraryMergerPCM::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "20/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &VoxelLibraryMergerPCM::get_prop_uv_rect); diff --git a/modules/voxelman/library/voxel_library_simple.cpp b/modules/voxelman/library/voxel_library_simple.cpp index 8f24563e4..22ecbbe87 100644 --- a/modules/voxelman/library/voxel_library_simple.cpp +++ b/modules/voxelman/library/voxel_library_simple.cpp @@ -147,5 +147,5 @@ void VoxelLibrarySimple::_bind_methods() { ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &VoxelLibrarySimple::get_voxel_surfaces); ClassDB::bind_method(D_METHOD("set_voxel_surfaces"), &VoxelLibrarySimple::set_voxel_surfaces); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "20/19:VoxelSurfaceSimple", PROPERTY_USAGE_DEFAULT, "VoxelSurfaceSimple"), "set_voxel_surfaces", "get_voxel_surfaces"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "23/19:VoxelSurfaceSimple", PROPERTY_USAGE_DEFAULT, "VoxelSurfaceSimple"), "set_voxel_surfaces", "get_voxel_surfaces"); } diff --git a/modules/voxelman/library/voxel_material_cache.cpp b/modules/voxelman/library/voxel_material_cache.cpp index 407e22328..547d9d277 100644 --- a/modules/voxelman/library/voxel_material_cache.cpp +++ b/modules/voxelman/library/voxel_material_cache.cpp @@ -294,7 +294,7 @@ void VoxelMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_get"), &VoxelMaterialCache::materials_get); ClassDB::bind_method(D_METHOD("materials_set"), &VoxelMaterialCache::materials_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "20/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); ClassDB::bind_method(D_METHOD("surface_get", "index"), &VoxelMaterialCache::surface_get); ClassDB::bind_method(D_METHOD("surface_id_get", "index"), &VoxelMaterialCache::surface_id_get); diff --git a/modules/voxelman/world/default/voxel_chunk_default.cpp b/modules/voxelman/world/default/voxel_chunk_default.cpp index d83073940..ded9ebf57 100644 --- a/modules/voxelman/world/default/voxel_chunk_default.cpp +++ b/modules/voxelman/world/default/voxel_chunk_default.cpp @@ -123,7 +123,7 @@ RID VoxelChunkDefault::mesh_rid_get(const int mesh_index, const int mesh_type_in Variant v = m[mesh_type_index]; - if (v.get_type() != Variant::_RID) + if (v.get_type() != Variant::RID) return RID(); return v; @@ -142,7 +142,7 @@ void VoxelChunkDefault::mesh_rid_set(const int mesh_index, const int mesh_type_i Variant v = m[mesh_type_index]; - ERR_FAIL_COND(v.get_type() != Variant::_RID); + ERR_FAIL_COND(v.get_type() != Variant::RID); m[mesh_type_index] = value; _rids[mesh_index] = m; diff --git a/modules/voxelman/world/voxel_chunk.cpp b/modules/voxelman/world/voxel_chunk.cpp index a6c748848..7f181e995 100644 --- a/modules/voxelman/world/voxel_chunk.cpp +++ b/modules/voxelman/world/voxel_chunk.cpp @@ -1458,7 +1458,7 @@ void VoxelChunk::_bind_methods() { ClassDB::bind_method(D_METHOD("voxel_structures_get"), &VoxelChunk::voxel_structures_get); ClassDB::bind_method(D_METHOD("voxel_structures_set"), &VoxelChunk::voxel_structures_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "20/19:VoxelStructure", PROPERTY_USAGE_DEFAULT, "VoxelStructure"), "voxel_structures_set", "voxel_structures_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "23/19:VoxelStructure", PROPERTY_USAGE_DEFAULT, "VoxelStructure"), "voxel_structures_set", "voxel_structures_get"); //Meshes diff --git a/modules/voxelman/world/voxel_world.cpp b/modules/voxelman/world/voxel_world.cpp index dd48e4ca0..d63e3f5d4 100644 --- a/modules/voxelman/world/voxel_world.cpp +++ b/modules/voxelman/world/voxel_world.cpp @@ -1109,7 +1109,7 @@ void VoxelWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("voxel_structures_get"), &VoxelWorld::voxel_structures_get); ClassDB::bind_method(D_METHOD("voxel_structures_set"), &VoxelWorld::voxel_structures_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "20/19:VoxelStructure", PROPERTY_USAGE_DEFAULT, "VoxelStructure"), "voxel_structures_set", "voxel_structures_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "23/19:VoxelStructure", PROPERTY_USAGE_DEFAULT, "VoxelStructure"), "voxel_structures_set", "voxel_structures_get"); BIND_VMETHOD(MethodInfo("_chunk_added", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"))); @@ -1126,7 +1126,7 @@ void VoxelWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("chunks_get"), &VoxelWorld::chunks_get); ClassDB::bind_method(D_METHOD("chunks_set"), &VoxelWorld::chunks_set); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "chunks", PROPERTY_HINT_NONE, "20/19:VoxelChunk", PROPERTY_USAGE_DEFAULT, "VoxelChunk"), "chunks_set", "chunks_get"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "chunks", PROPERTY_HINT_NONE, "23/19:VoxelChunk", PROPERTY_USAGE_DEFAULT, "VoxelChunk"), "chunks_set", "chunks_get"); ClassDB::bind_method(D_METHOD("generation_queue_add_to", "chunk"), &VoxelWorld::generation_queue_add_to); ClassDB::bind_method(D_METHOD("generation_queue_get_index", "index"), &VoxelWorld::generation_queue_get_index); diff --git a/modules/web/html/bbcode_parser.cpp b/modules/web/html/bbcode_parser.cpp index 37298d2a1..4c5321390 100644 --- a/modules/web/html/bbcode_parser.cpp +++ b/modules/web/html/bbcode_parser.cpp @@ -527,7 +527,7 @@ void BBCodeParserTag::_bind_methods() { ClassDB::bind_method(D_METHOD("get_child_tags"), &BBCodeParserTag::get_child_tags); ClassDB::bind_method(D_METHOD("set_child_tags", "val"), &BBCodeParserTag::set_child_tags); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "child_tags", PROPERTY_HINT_NONE, "20/19:BBCodeParserTag", PROPERTY_USAGE_DEFAULT, "BBCodeParserTag"), "set_child_tags", "get_child_tags"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "child_tags", PROPERTY_HINT_NONE, "23/19:BBCodeParserTag", PROPERTY_USAGE_DEFAULT, "BBCodeParserTag"), "set_child_tags", "get_child_tags"); ClassDB::bind_method(D_METHOD("add_child_attribute", "tag"), &BBCodeParserTag::add_child_attribute); ClassDB::bind_method(D_METHOD("remote_child_attribute", "index"), &BBCodeParserTag::remote_child_attribute); @@ -537,7 +537,7 @@ void BBCodeParserTag::_bind_methods() { ClassDB::bind_method(D_METHOD("get_attributes"), &BBCodeParserTag::get_attributes); ClassDB::bind_method(D_METHOD("set_attributes", "val"), &BBCodeParserTag::set_attributes); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "attributes", PROPERTY_HINT_NONE, "20/19:BBCodeParserAttribute", PROPERTY_USAGE_DEFAULT, "BBCodeParserAttribute"), "set_attributes", "get_attributes"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "attributes", PROPERTY_HINT_NONE, "23/19:BBCodeParserAttribute", PROPERTY_USAGE_DEFAULT, "BBCodeParserAttribute"), "set_attributes", "get_attributes"); ClassDB::bind_method(D_METHOD("get_first", "t"), &BBCodeParserTag::get_first); ClassDB::bind_method(D_METHOD("get_firstc", "t", "attrib", "val"), &BBCodeParserTag::get_firstc); diff --git a/modules/web/html/form_validator.cpp b/modules/web/html/form_validator.cpp index 129cd249f..806c9511a 100644 --- a/modules/web/html/form_validator.cpp +++ b/modules/web/html/form_validator.cpp @@ -796,7 +796,7 @@ void FormField::_bind_methods() { ClassDB::bind_method(D_METHOD("get_entries"), &FormField::get_entries); ClassDB::bind_method(D_METHOD("set_entries", "array"), &FormField::set_entries); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entries", PROPERTY_HINT_NONE, "20/19:FormFieldEntry", PROPERTY_USAGE_DEFAULT, "FormFieldEntry"), "set_entries", "get_entries"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entries", PROPERTY_HINT_NONE, "23/19:FormFieldEntry", PROPERTY_USAGE_DEFAULT, "FormFieldEntry"), "set_entries", "get_entries"); ClassDB::bind_method(D_METHOD("need_to_exist"), &FormField::need_to_exist); ClassDB::bind_method(D_METHOD("need_to_be_int"), &FormField::need_to_be_int); @@ -905,7 +905,7 @@ void FormValidator::_bind_methods() { ClassDB::bind_method(D_METHOD("get_fields"), &FormValidator::get_fields); ClassDB::bind_method(D_METHOD("set_fields", "array"), &FormValidator::set_fields); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "fields", PROPERTY_HINT_NONE, "20/19:FormField", PROPERTY_USAGE_DEFAULT, "FormField"), "set_fields", "get_fields"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "fields", PROPERTY_HINT_NONE, "23/19:FormField", PROPERTY_USAGE_DEFAULT, "FormField"), "set_fields", "get_fields"); BIND_VMETHOD(MethodInfo("_validate", PropertyInfo(Variant::OBJECT, "request", PROPERTY_HINT_RESOURCE_TYPE, "WebServerRequest"))); ClassDB::bind_method(D_METHOD("validate", "request"), &FormValidator::validate); diff --git a/modules/web/html/html_parser.cpp b/modules/web/html/html_parser.cpp index 9a25edd11..0a2c021c0 100644 --- a/modules/web/html/html_parser.cpp +++ b/modules/web/html/html_parser.cpp @@ -571,7 +571,7 @@ void HTMLParserTag::_bind_methods() { ClassDB::bind_method(D_METHOD("get_child_tags"), &HTMLParserTag::get_child_tags); ClassDB::bind_method(D_METHOD("set_child_tags", "val"), &HTMLParserTag::set_child_tags); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "child_tags", PROPERTY_HINT_NONE, "20/19:HTMLParserTag", PROPERTY_USAGE_DEFAULT, "HTMLParserTag"), "set_child_tags", "get_child_tags"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "child_tags", PROPERTY_HINT_NONE, "23/19:HTMLParserTag", PROPERTY_USAGE_DEFAULT, "HTMLParserTag"), "set_child_tags", "get_child_tags"); ClassDB::bind_method(D_METHOD("add_child_attribute", "tag"), &HTMLParserTag::add_child_attribute); ClassDB::bind_method(D_METHOD("remote_child_attribute", "index"), &HTMLParserTag::remote_child_attribute); @@ -581,7 +581,7 @@ void HTMLParserTag::_bind_methods() { ClassDB::bind_method(D_METHOD("get_attributes"), &HTMLParserTag::get_attributes); ClassDB::bind_method(D_METHOD("set_attributes", "val"), &HTMLParserTag::set_attributes); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "attributes", PROPERTY_HINT_NONE, "20/19:HTMLParserAttribute", PROPERTY_USAGE_DEFAULT, "HTMLParserAttribute"), "set_attributes", "get_attributes"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "attributes", PROPERTY_HINT_NONE, "23/19:HTMLParserAttribute", PROPERTY_USAGE_DEFAULT, "HTMLParserAttribute"), "set_attributes", "get_attributes"); ClassDB::bind_method(D_METHOD("get_first", "t"), &HTMLParserTag::get_first); ClassDB::bind_method(D_METHOD("get_firstc", "t", "attrib", "val"), &HTMLParserTag::get_firstc); diff --git a/modules/web/http/web_root.cpp b/modules/web/http/web_root.cpp index 79fd1803d..7dc4e204b 100644 --- a/modules/web/http/web_root.cpp +++ b/modules/web/http/web_root.cpp @@ -205,7 +205,7 @@ void WebRoot::_bind_methods() { ClassDB::bind_method(D_METHOD("get_middlewares"), &WebRoot::get_middlewares); ClassDB::bind_method(D_METHOD("set_middlewares", "data"), &WebRoot::set_middlewares); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "middlewares", PROPERTY_HINT_NONE, "20/19:WebServerMiddleware", PROPERTY_USAGE_DEFAULT, "WebServerMiddleware"), "set_middlewares", "get_middlewares"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "middlewares", PROPERTY_HINT_NONE, "23/19:WebServerMiddleware", PROPERTY_USAGE_DEFAULT, "WebServerMiddleware"), "set_middlewares", "get_middlewares"); ClassDB::bind_method(D_METHOD("process_middlewares", "request"), &WebRoot::process_middlewares); ClassDB::bind_method(D_METHOD("try_send_wwwroot_file", "request"), &WebRoot::try_send_wwwroot_file); diff --git a/platform/windows/pandemonium.natvis b/platform/windows/pandemonium.natvis index d9b6a7673..de265d999 100644 --- a/platform/windows/pandemonium.natvis +++ b/platform/windows/pandemonium.natvis @@ -59,7 +59,7 @@ {*(Quaternion *)_data._mem} {*(Color *)_data._mem} {*(NodePath *)_data._mem} - {*(RID *)_data._mem} + {*(RID *)_data._mem} {*(Object *)_data._mem} {*(Dictionary *)_data._mem} {*(Array *)_data._mem} @@ -89,7 +89,7 @@ *(Quaternion *)_data._mem *(Color *)_data._mem *(NodePath *)_data._mem - *(RID *)_data._mem + *(RID *)_data._mem *(Object *)_data._mem *(Dictionary *)_data._mem *(Array *)_data._mem diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index fc104558b..52a3036f7 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -536,13 +536,13 @@ void Area2D::_bind_methods() { ClassDB::bind_method(D_METHOD("_body_inout"), &Area2D::_body_inout); ClassDB::bind_method(D_METHOD("_area_inout"), &Area2D::_area_inout); - ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::_RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); - ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::_RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); - ADD_SIGNAL(MethodInfo("area_shape_entered", PropertyInfo(Variant::_RID, "area_rid"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area2D"), PropertyInfo(Variant::INT, "area_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); - ADD_SIGNAL(MethodInfo("area_shape_exited", PropertyInfo(Variant::_RID, "area_rid"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area2D"), PropertyInfo(Variant::INT, "area_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("area_shape_entered", PropertyInfo(Variant::RID, "area_rid"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area2D"), PropertyInfo(Variant::INT, "area_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("area_shape_exited", PropertyInfo(Variant::RID, "area_rid"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area2D"), PropertyInfo(Variant::INT, "area_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); ADD_SIGNAL(MethodInfo("area_entered", PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area2D"))); ADD_SIGNAL(MethodInfo("area_exited", PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area2D"))); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 05931562c..9e43a54b9 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -933,8 +933,8 @@ void RigidBody2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "applied_force"), "set_applied_force", "get_applied_force"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "applied_torque"), "set_applied_torque", "get_applied_torque"); - ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::_RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); - ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::_RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("sleeping_state_changed")); @@ -1588,7 +1588,7 @@ void KinematicCollision2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "local_shape"), "", "get_local_shape"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id"), "", "get_collider_id"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "collider_rid"), "", "get_collider_rid"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider_shape"), "", "get_collider_shape"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape_index"), "", "get_collider_shape_index"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collider_velocity"), "", "get_collider_velocity"); diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index e5dcae7db..944675ad9 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -575,13 +575,13 @@ void Area::_bind_methods() { ClassDB::bind_method(D_METHOD("set_reverb_uniformity", "amount"), &Area::set_reverb_uniformity); ClassDB::bind_method(D_METHOD("get_reverb_uniformity"), &Area::get_reverb_uniformity); - ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::_RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); - ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::_RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); - ADD_SIGNAL(MethodInfo("area_shape_entered", PropertyInfo(Variant::_RID, "area_rid"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area"), PropertyInfo(Variant::INT, "area_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); - ADD_SIGNAL(MethodInfo("area_shape_exited", PropertyInfo(Variant::_RID, "area_rid"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area"), PropertyInfo(Variant::INT, "area_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("area_shape_entered", PropertyInfo(Variant::RID, "area_rid"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area"), PropertyInfo(Variant::INT, "area_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("area_shape_exited", PropertyInfo(Variant::RID, "area_rid"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area"), PropertyInfo(Variant::INT, "area_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); ADD_SIGNAL(MethodInfo("area_entered", PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area"))); ADD_SIGNAL(MethodInfo("area_exited", PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area"))); diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 4833889b3..bc28903ff 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -375,7 +375,7 @@ Point2 Camera::unproject_position(const Vector3 &p_pos) const { Plane p(get_camera_transform().xform_inv(p_pos), 1.0); - p = cm.xform4(p); + p = cm.xform(p); p.normal /= p.d; Point2 res; diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index 689cc1543..9d9faceeb 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -115,7 +115,7 @@ void Navigation::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge_connection_margin"), "set_edge_connection_margin", "get_edge_connection_margin"); ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_3D_NAVIGATION), "set_navigation_layers", "get_navigation_layers"); - ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::_RID, "map"))); + ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); } void Navigation::_notification(int p_what) { diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index c5f64c037..95cb594fa 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -909,8 +909,8 @@ void RigidBody::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "angular_velocity"), "set_angular_velocity", "get_angular_velocity"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"), "set_angular_damp", "get_angular_damp"); - ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::_RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); - ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::_RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); + ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::RID, "body_rid"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape_index"), PropertyInfo(Variant::INT, "local_shape_index"))); ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("sleeping_state_changed")); @@ -1606,7 +1606,7 @@ void KinematicCollision::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "local_shape"), "", "get_local_shape"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id"), "", "get_collider_id"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "collider_rid"), "", "get_collider_rid"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider_shape"), "", "get_collider_shape"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape_index"), "", "get_collider_shape_index"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "collider_velocity"), "", "get_collider_velocity"); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index ecef62ed7..f1eeef99b 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2920,7 +2920,7 @@ void RichTextLabel::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deselect_on_focus_loss_enabled"), "set_deselect_on_focus_loss_enabled", "is_deselect_on_focus_loss_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "custom_effects", PROPERTY_HINT_RESOURCE_TYPE, "20/19:RichTextEffect", (PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE), "RichTextEffect"), "set_effects", "get_effects"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "custom_effects", PROPERTY_HINT_RESOURCE_TYPE, "23/19:RichTextEffect", (PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE), "RichTextEffect"), "set_effects", "get_effects"); ADD_SIGNAL(MethodInfo("meta_clicked", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT))); ADD_SIGNAL(MethodInfo("meta_hover_started", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT))); diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index a006ede6e..20c1f7049 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -78,7 +78,7 @@ void Shader::get_param_list(List *p_params) const { params_cache[pi.name] = E->get().name; if (p_params) { //small little hack - if (pi.type == Variant::_RID) { + if (pi.type == Variant::RID) { pi.type = Variant::OBJECT; } p_params->push_back(pi); diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index f41182e4c..aa9f371ae 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -325,9 +325,9 @@ void World::_bind_methods() { ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "navigation_map", PROPERTY_HINT_NONE, "", 0), "", "get_navigation_map"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "navigation_map", PROPERTY_HINT_NONE, "", 0), "", "get_navigation_map"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state"); } diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index ac9382340..ff36937c5 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -344,9 +344,9 @@ void World2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World2D::get_direct_space_state); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "canvas", PROPERTY_HINT_NONE, "", 0), "", "get_canvas"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "navigation_map", PROPERTY_HINT_NONE, "", 0), "", "get_navigation_map"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "canvas", PROPERTY_HINT_NONE, "", 0), "", "get_canvas"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "navigation_map", PROPERTY_HINT_NONE, "", 0), "", "get_navigation_map"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "Physics2DDirectSpaceState", 0), "", "get_direct_space_state"); } diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_2d_server.cpp index 2060ab878..c5a33ae29 100644 --- a/servers/navigation_2d_server.cpp +++ b/servers/navigation_2d_server.cpp @@ -224,7 +224,7 @@ void Navigation2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("free_rid", "rid"), &Navigation2DServer::free); ClassDB::bind_method(D_METHOD("_emit_map_changed"), &Navigation2DServer::_emit_map_changed); - ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::_RID, "map"))); + ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); } Navigation2DServer::Navigation2DServer() { diff --git a/servers/navigation_server.cpp b/servers/navigation_server.cpp index 4b2392aa4..c4fc79b7a 100644 --- a/servers/navigation_server.cpp +++ b/servers/navigation_server.cpp @@ -98,7 +98,7 @@ void NavigationServer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_active", "active"), &NavigationServer::set_active); ClassDB::bind_method(D_METHOD("process", "delta_time"), &NavigationServer::process); - ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::_RID, "map"))); + ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); } const NavigationServer *NavigationServer::get_singleton() { diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index d9647ea4b..121bfe2a9 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -236,11 +236,11 @@ void Physics2DShapeQueryParameters::_bind_methods() { ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &Physics2DShapeQueryParameters::is_collide_with_areas_enabled); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::RID) + ":"), "set_exclude", "get_exclude"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion"), "set_motion", "get_motion"); //ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", ""); // FIXME: Lacks a getter - ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_bodies"), "set_collide_with_bodies", "is_collide_with_bodies_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled"); @@ -478,7 +478,7 @@ void Physics2DTestMotionResult::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collision_normal"), "", "get_collision_normal"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collider_velocity"), "", "get_collider_velocity"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id", PROPERTY_HINT_OBJECT_ID), "", "get_collider_id"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "collider_rid"), "", "get_collider_rid"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape"), "", "get_collider_shape"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision_depth"), "", "get_collision_depth"); diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index ebbba0128..37f09d6f6 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -231,10 +231,10 @@ void PhysicsShapeQueryParameters::_bind_methods() { ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &PhysicsShapeQueryParameters::is_collide_with_areas_enabled); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::RID) + ":"), "set_exclude", "get_exclude"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin"); //ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", ""); // FIXME: Lacks a getter - ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_bodies"), "set_collide_with_bodies", "is_collide_with_bodies_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled"); @@ -455,7 +455,7 @@ void PhysicsTestMotionResult::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "collision_normal"), "", "get_collision_normal"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "collider_velocity"), "", "get_collider_velocity"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id", PROPERTY_HINT_OBJECT_ID), "", "get_collider_id"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "collider_rid"), "", "get_collider_rid"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape"), "", "get_collider_shape"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision_depth"), "", "get_collision_depth"); diff --git a/servers/visual/portals/portal_occlusion_culler.cpp b/servers/visual/portals/portal_occlusion_culler.cpp index c9e6561ef..274d524f8 100644 --- a/servers/visual/portals/portal_occlusion_culler.cpp +++ b/servers/visual/portals/portal_occlusion_culler.cpp @@ -690,7 +690,7 @@ bool PortalOcclusionCuller::calculate_poly_goodness_of_fit(const VSOccluder_Poly Plane source(p_opoly.poly.verts[n], 1.0f); Plane &dest = xpoints[n]; - dest = _matrix_camera.xform4(source); + dest = _matrix_camera.xform(source); } // find screen space area