Added gdscript support for the new types .

This commit is contained in:
Relintai 2022-03-21 15:09:56 +01:00
parent 527cfb88aa
commit b67082e9dd
4 changed files with 22 additions and 3 deletions

View File

@ -2180,9 +2180,10 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
}
static const char *_type_names[Variant::VARIANT_MAX] = {
"null", "bool", "int", "float", "String", "Vector2", "Rect2", "Vector3", "Transform2D", "Plane", "Quat", "AABB", "Basis", "Transform",
"Color", "NodePath", "RID", "Object", "Dictionary", "Array", "PoolByteArray", "PoolIntArray", "PoolRealArray", "PoolStringArray",
"PoolVector2Array", "PoolVector3Array", "PoolColorArray"
"null", "bool", "int", "float", "String", "Vector2", "Vector2i", "Rect2", "Rect2i", "Vector3", "Vector3i", "Transform2D", "Plane",
"Quat", "AABB", "Basis", "Transform", "Color", "NodePath", "RID", "Object", "Dictionary", "Array",
"PoolByteArray", "PoolIntArray", "PoolRealArray", "PoolStringArray",
"PoolVector2Array", "PoolVector2iArray", "PoolVector3Array", "PoolVector3iArray", "PoolColorArray"
};
for (int i = 0; i < Variant::VARIANT_MAX; i++) {

View File

@ -1359,10 +1359,18 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
PoolVector<Vector2> d = *p_args[0];
r_ret = d.size();
} break;
case Variant::POOL_VECTOR2I_ARRAY: {
PoolVector<Vector2i> d = *p_args[0];
r_ret = d.size();
} break;
case Variant::POOL_VECTOR3_ARRAY: {
PoolVector<Vector3> d = *p_args[0];
r_ret = d.size();
} break;
case Variant::POOL_VECTOR3I_ARRAY: {
PoolVector<Vector3i> d = *p_args[0];
r_ret = d.size();
} break;
case Variant::POOL_COLOR_ARRAY: {
PoolVector<Color> d = *p_args[0];
r_ret = d.size();

View File

@ -6725,13 +6725,16 @@ 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_VECTOR2I_ARRAY:
case Variant::POOL_VECTOR3_ARRAY:
case Variant::POOL_VECTOR3I_ARRAY:
case Variant::ARRAY:
case Variant::STRING: {
error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::REAL;
} break;
// Expect String only
case Variant::RECT2:
case Variant::RECT2I:
case Variant::PLANE:
case Variant::QUAT:
case Variant::AABB:
@ -6740,7 +6743,9 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
} break;
// Expect String or number
case Variant::VECTOR2:
case Variant::VECTOR2I:
case Variant::VECTOR3:
case Variant::VECTOR3I:
case Variant::TRANSFORM2D:
case Variant::BASIS:
case Variant::TRANSFORM: {

View File

@ -151,9 +151,12 @@ static const _bit _type_list[] = {
{ Variant::REAL, "float" },
{ Variant::STRING, "String" },
{ Variant::VECTOR2, "Vector2" },
{ Variant::VECTOR2I, "Vector2i" },
{ Variant::RECT2, "Rect2" },
{ Variant::RECT2I, "Rect2i" },
{ Variant::TRANSFORM2D, "Transform2D" },
{ Variant::VECTOR3, "Vector3" },
{ Variant::VECTOR3I, "Vector3i" },
{ Variant::AABB, "AABB" },
{ Variant::PLANE, "Plane" },
{ Variant::QUAT, "Quat" },
@ -170,7 +173,9 @@ static const _bit _type_list[] = {
{ Variant::POOL_REAL_ARRAY, "PoolRealArray" },
{ Variant::POOL_STRING_ARRAY, "PoolStringArray" },
{ Variant::POOL_VECTOR2_ARRAY, "PoolVector2Array" },
{ Variant::POOL_VECTOR2I_ARRAY, "PoolVector2iArray" },
{ Variant::POOL_VECTOR3_ARRAY, "PoolVector3Array" },
{ Variant::POOL_VECTOR3I_ARRAY, "PoolVector3iArray" },
{ Variant::POOL_COLOR_ARRAY, "PoolColorArray" },
{ Variant::VARIANT_MAX, nullptr },
};