More work on the new variant types.

This commit is contained in:
Relintai 2023-06-02 13:36:48 +02:00
parent 5eeae5e6ba
commit b9243646fe
8 changed files with 138 additions and 22 deletions

View File

@ -15,32 +15,46 @@ from pandemonium.pool_arrays cimport (
) )
{% set render_target = "rid" %} {% set render_target = "rid" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "vector3" %} {% set render_target = "vector3" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "vector2" %} {% set render_target = "vector2" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "vector2i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector3i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector4" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector4i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "aabb" %} {% set render_target = "aabb" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "basis" %} {% set render_target = "basis" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "color" %} {% set render_target = "color" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "gdstring" %} {% set render_target = "gdstring" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "rect2" %} {% set render_target = "rect2" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "rect2i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "projection" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "transform2d" %} {% set render_target = "transform2d" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "plane" %} {% set render_target = "plane" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "quat" %} {% set render_target = "quaternion" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "transform" %} {% set render_target = "transform" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "node_path" %} {% set render_target = "node_path" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "string_name" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "dictionary" %} {% set render_target = "dictionary" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "array" %} {% set render_target = "array" %}
{% include 'render.tmpl.pxd' with context %} {% include 'render.tmpl.pyi' with context %}

View File

@ -9,6 +9,14 @@ from typing import Union
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "vector2" %} {% set render_target = "vector2" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "vector2i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector3i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector4" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector4i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "aabb" %} {% set render_target = "aabb" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "basis" %} {% set render_target = "basis" %}
@ -19,16 +27,22 @@ from typing import Union
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "rect2" %} {% set render_target = "rect2" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "rect2i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "projection" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "transform2d" %} {% set render_target = "transform2d" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "plane" %} {% set render_target = "plane" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "quat" %} {% set render_target = "quaternion" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "transform" %} {% set render_target = "transform" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "node_path" %} {% set render_target = "node_path" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "string_name" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "dictionary" %} {% set render_target = "dictionary" %}
{% include 'render.tmpl.pyi' with context %} {% include 'render.tmpl.pyi' with context %}
{% set render_target = "array" %} {% set render_target = "array" %}

View File

@ -17,7 +17,11 @@ from pandemonium.pool_arrays cimport (
PoolRealArray, PoolRealArray,
PoolByteArray, PoolByteArray,
PoolVector2Array, PoolVector2Array,
PoolVector2iArray,
PoolVector3Array, PoolVector3Array,
PoolVector3iArray,
PoolVector4Array,
PoolVector4iArray,
PoolColorArray, PoolColorArray,
PoolStringArray, PoolStringArray,
) )
@ -28,6 +32,14 @@ from pandemonium.pool_arrays cimport (
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector2" %} {% set render_target = "vector2" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector2i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector3i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector4" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "vector4i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "aabb" %} {% set render_target = "aabb" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "basis" %} {% set render_target = "basis" %}
@ -38,16 +50,22 @@ from pandemonium.pool_arrays cimport (
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "rect2" %} {% set render_target = "rect2" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "rect2i" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "projection" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "transform2d" %} {% set render_target = "transform2d" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "plane" %} {% set render_target = "plane" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "quat" %} {% set render_target = "quaternion" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "transform" %} {% set render_target = "transform" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "node_path" %} {% set render_target = "node_path" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "string_name" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "dictionary" %} {% set render_target = "dictionary" %}
{% include 'render.tmpl.pyx' with context %} {% include 'render.tmpl.pyx' with context %}
{% set render_target = "array" %} {% set render_target = "array" %}

View File

@ -196,20 +196,31 @@ SUPPORTED_TYPES = {
"pandemonium_color", "pandemonium_color",
"pandemonium_dictionary", "pandemonium_dictionary",
"pandemonium_node_path", "pandemonium_node_path",
"pandemonium_string_name",
"pandemonium_plane", "pandemonium_plane",
"pandemonium_quat", "pandemonium_quaternion",
"pandemonium_rect2", "pandemonium_rect2",
"pandemonium_rect2i",
"pandemonium_rid", "pandemonium_rid",
"pandemonium_transform", "pandemonium_transform",
"pandemonium_transform2d", "pandemonium_transform2d",
"pandemonium_projection",
"pandemonium_vector2", "pandemonium_vector2",
"pandemonium_vector2i",
"pandemonium_vector3", "pandemonium_vector3",
"pandemonium_vector3i",
"pandemonium_vector4",
"pandemonium_vector4i",
"pandemonium_pool_byte_array", "pandemonium_pool_byte_array",
"pandemonium_pool_int_array", "pandemonium_pool_int_array",
"pandemonium_pool_real_array", "pandemonium_pool_real_array",
"pandemonium_pool_string_array", "pandemonium_pool_string_array",
"pandemonium_pool_vector2_array", "pandemonium_pool_vector2_array",
"pandemonium_pool_vector2i_array",
"pandemonium_pool_vector3_array", "pandemonium_pool_vector3_array",
"pandemonium_pool_vector3i_array",
"pandemonium_pool_vector4_array",
"pandemonium_pool_vector4i_array",
"pandemonium_pool_color_array", "pandemonium_pool_color_array",
} }
@ -399,22 +410,41 @@ def cook_data(data):
return value return value
elif type == "pandemonium_string": elif type == "pandemonium_string":
return f'"{value}"' return f'"{value}"'
elif type == "pandemonium_node_path":
return f'"{value}"'
elif type == "pandemonium_string_name":
return f'"{value}"'
elif type == "pandemonium_object" and value in ("[Object:null]", "Null"): elif type == "pandemonium_object" and value in ("[Object:null]", "Null"):
return "None" return "None"
elif type == "pandemonium_dictionary" and value == "{}": elif type == "pandemonium_dictionary" and value == "{}":
return "Dictionary()" return "Dictionary()"
elif type == "pandemonium_vector2": elif type == "pandemonium_vector2":
return f"Vector2{value}" return f"Vector2{value}"
elif type == "pandemonium_vector2i":
return f"Vector2i{value}"
elif type == "pandemonium_rect2": elif type == "pandemonium_rect2":
return f"Rect2{value}" return f"Rect2{value}"
elif type == "pandemonium_rect2i":
return f"Rect2i{value}"
elif type == "pandemonium_vector3": elif type == "pandemonium_vector3":
return f"Vector3{value}" return f"Vector3{value}"
elif type == "pandemonium_transform" and value == "1, 0, 0, 0, 1, 0, 0, 0, 1 - 0, 0, 0": elif type == "pandemonium_vector3i":
return f"Vector3i{value}"
elif type == "pandemonium_vector4":
return f"Vector4{value}"
elif type == "pandemonium_vector4i":
return f"Vector4i{value}"
elif type == "pandemonium_transform" and value == "1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0":
# TODO
return ( return (
"Transform(Vector3(1, 0, 0), Vector3(0, 1, 0), Vector3(0, 0, 1), Vector3(0, 0, 0))" "Transform(Vector3(1, 0, 0), Vector3(0, 1, 0), Vector3(0, 0, 1), Vector3(0, 0, 0))"
) )
elif type == "pandemonium_transform2d" and value == "((1, 0), (0, 1), (0, 0))": elif type == "pandemonium_transform2d" and value == "((1, 0), (0, 1), (0, 0))":
# TODO
return "Transform2D(Vector2(1, 0), Vector2(0, 1), Vector2(0, 0))" return "Transform2D(Vector2(1, 0), Vector2(0, 1), Vector2(0, 0))"
elif type == "pandemonium_projection":
# TODO
return "Projection()"
elif value == "[RID]": elif value == "[RID]":
return "RID()" return "RID()"
elif type == "pandemonium_color": elif type == "pandemonium_color":
@ -425,8 +455,16 @@ def cook_data(data):
return f"Array()" return f"Array()"
elif type == "pandemonium_pool_vector2_array" and value == "[]": elif type == "pandemonium_pool_vector2_array" and value == "[]":
return f"PoolVector2Array()" return f"PoolVector2Array()"
elif type == "pandemonium_pool_vector2i_array" and value == "[]":
return f"PoolVector2iArray()"
elif type == "pandemonium_pool_vector3_array" and value == "[]": elif type == "pandemonium_pool_vector3_array" and value == "[]":
return f"PoolVector3Array()" return f"PoolVector3Array()"
elif type == "pandemonium_pool_vector3i_array" and value == "[]":
return f"PoolVector3iArray()"
elif type == "pandemonium_pool_vector4_array" and value == "[]":
return f"PoolVector4Array()"
elif type == "pandemonium_pool_vector4i_array" and value == "[]":
return f"PoolVector4iArray()"
elif type == "pandemonium_pool_int_array" and value == "[]": elif type == "pandemonium_pool_int_array" and value == "[]":
return f"PoolIntArray()" return f"PoolIntArray()"
elif type == "pandemonium_pool_real_array" and value == "[]": elif type == "pandemonium_pool_real_array" and value == "[]":

View File

@ -144,7 +144,7 @@ TARGET_TO_TYPE_SPEC = {
"rect2": TYPE_RECT2, "rect2": TYPE_RECT2,
"transform2d": TYPE_TRANSFORM2D, "transform2d": TYPE_TRANSFORM2D,
"plane": TYPE_PLANE, "plane": TYPE_PLANE,
"quat": TYPE_QUATERNION, "quaternion": TYPE_QUATERNION,
"transform": TYPE_TRANSFORM, "transform": TYPE_TRANSFORM,
"node_path": TYPE_NODEPATH, "node_path": TYPE_NODEPATH,
"dictionary": TYPE_DICTIONARY, "dictionary": TYPE_DICTIONARY,

View File

@ -55,6 +55,14 @@ TYPES = [
is_base_type=False, is_base_type=False,
is_stack_only=True, is_stack_only=True,
), ),
TypeItem(
gd_pool=f"pandemonium_pool_vector2i_array",
py_pool=f"PoolVector2iArray",
gd_value=f"pandemonium_vector2i",
py_value=f"Vector2i",
is_base_type=False,
is_stack_only=True,
),
TypeItem( TypeItem(
gd_pool=f"pandemonium_pool_vector3_array", gd_pool=f"pandemonium_pool_vector3_array",
py_pool=f"PoolVector3Array", py_pool=f"PoolVector3Array",
@ -63,6 +71,30 @@ TYPES = [
is_base_type=False, is_base_type=False,
is_stack_only=True, is_stack_only=True,
), ),
TypeItem(
gd_pool=f"pandemonium_pool_vector3i_array",
py_pool=f"PoolVector3iArray",
gd_value=f"pandemonium_vector3i",
py_value=f"Vector3i",
is_base_type=False,
is_stack_only=True,
),
TypeItem(
gd_pool=f"pandemonium_pool_vector4_array",
py_pool=f"PoolVector4Array",
gd_value=f"pandemonium_vector4",
py_value=f"Vector4",
is_base_type=False,
is_stack_only=True,
),
TypeItem(
gd_pool=f"pandemonium_pool_vector4i_array",
py_pool=f"PoolVector4iArray",
gd_value=f"pandemonium_vector4i",
py_value=f"Vector4i",
is_base_type=False,
is_stack_only=True,
),
TypeItem( TypeItem(
gd_pool=f"pandemonium_pool_color_array", gd_pool=f"pandemonium_pool_color_array",
py_pool=f"PoolColorArray", py_pool=f"PoolColorArray",

View File

@ -205,7 +205,7 @@ TYPE_PLANE = TypeSpec(
gdapi_type="Plane", c_type="pandemonium_plane", cy_type="Plane", is_builtin=True, is_stack_only=True gdapi_type="Plane", c_type="pandemonium_plane", cy_type="Plane", is_builtin=True, is_stack_only=True
) )
TYPE_QUATERNION = TypeSpec( TYPE_QUATERNION = TypeSpec(
gdapi_type="Quaternion", c_type="pandemonium_quat", cy_type="Quaternion", is_builtin=True, is_stack_only=True gdapi_type="Quaternion", c_type="pandemonium_quaternion", cy_type="Quaternion", is_builtin=True, is_stack_only=True
) )
TYPE_RECT2 = TypeSpec( TYPE_RECT2 = TypeSpec(
gdapi_type="Rect2", c_type="pandemonium_rect2", cy_type="Rect2", is_builtin=True, is_stack_only=True gdapi_type="Rect2", c_type="pandemonium_rect2", cy_type="Rect2", is_builtin=True, is_stack_only=True