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" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "vector3" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% 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" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "basis" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "color" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "gdstring" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% 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" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "plane" %}
{% include 'render.tmpl.pxd' with context %}
{% set render_target = "quat" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "quaternion" %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "transform" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% 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" %}
{% include 'render.tmpl.pxd' with context %}
{% include 'render.tmpl.pyi' with context %}
{% 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 %}
{% set render_target = "vector2" %}
{% 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" %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "basis" %}
@ -19,16 +27,22 @@ from typing import Union
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "rect2" %}
{% 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" %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "plane" %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "quat" %}
{% set render_target = "quaternion" %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "transform" %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "node_path" %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "string_name" %}
{% include 'render.tmpl.pyx' with context %}
{% set render_target = "dictionary" %}
{% include 'render.tmpl.pyi' with context %}
{% set render_target = "array" %}

View File

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

View File

@ -196,20 +196,31 @@ SUPPORTED_TYPES = {
"pandemonium_color",
"pandemonium_dictionary",
"pandemonium_node_path",
"pandemonium_string_name",
"pandemonium_plane",
"pandemonium_quat",
"pandemonium_quaternion",
"pandemonium_rect2",
"pandemonium_rect2i",
"pandemonium_rid",
"pandemonium_transform",
"pandemonium_transform2d",
"pandemonium_projection",
"pandemonium_vector2",
"pandemonium_vector2i",
"pandemonium_vector3",
"pandemonium_vector3i",
"pandemonium_vector4",
"pandemonium_vector4i",
"pandemonium_pool_byte_array",
"pandemonium_pool_int_array",
"pandemonium_pool_real_array",
"pandemonium_pool_string_array",
"pandemonium_pool_vector2_array",
"pandemonium_pool_vector2i_array",
"pandemonium_pool_vector3_array",
"pandemonium_pool_vector3i_array",
"pandemonium_pool_vector4_array",
"pandemonium_pool_vector4i_array",
"pandemonium_pool_color_array",
}
@ -399,22 +410,41 @@ def cook_data(data):
return value
elif type == "pandemonium_string":
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"):
return "None"
elif type == "pandemonium_dictionary" and value == "{}":
return "Dictionary()"
elif type == "pandemonium_vector2":
return f"Vector2{value}"
elif type == "pandemonium_vector2i":
return f"Vector2i{value}"
elif type == "pandemonium_rect2":
return f"Rect2{value}"
elif type == "pandemonium_rect2i":
return f"Rect2i{value}"
elif type == "pandemonium_vector3":
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 (
"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))":
# TODO
return "Transform2D(Vector2(1, 0), Vector2(0, 1), Vector2(0, 0))"
elif type == "pandemonium_projection":
# TODO
return "Projection()"
elif value == "[RID]":
return "RID()"
elif type == "pandemonium_color":
@ -425,8 +455,16 @@ def cook_data(data):
return f"Array()"
elif type == "pandemonium_pool_vector2_array" and value == "[]":
return f"PoolVector2Array()"
elif type == "pandemonium_pool_vector2i_array" and value == "[]":
return f"PoolVector2iArray()"
elif type == "pandemonium_pool_vector3_array" and value == "[]":
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 == "[]":
return f"PoolIntArray()"
elif type == "pandemonium_pool_real_array" and value == "[]":

View File

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

View File

@ -55,6 +55,14 @@ TYPES = [
is_base_type=False,
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(
gd_pool=f"pandemonium_pool_vector3_array",
py_pool=f"PoolVector3Array",
@ -63,6 +71,30 @@ TYPES = [
is_base_type=False,
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(
gd_pool=f"pandemonium_pool_color_array",
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
)
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(
gdapi_type="Rect2", c_type="pandemonium_rect2", cy_type="Rect2", is_builtin=True, is_stack_only=True