Mass replace godot to pandemonium pt1.

This commit is contained in:
Relintai 2023-06-02 11:05:45 +02:00
parent f2c01c272e
commit e9f699aabd
64 changed files with 1360 additions and 1369 deletions

View File

@ -65,7 +65,7 @@ jobs:
pip install -U pip pip install -U pip
pip install -r requirements.txt pip install -r requirements.txt
# Configuration for scons # Configuration for scons
echo 'godot_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py echo 'pandemonium_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py
echo 'platform = "${{ env.PLATFORM }}"' >> custom.py echo 'platform = "${{ env.PLATFORM }}"' >> custom.py
echo 'CC = "${{ env.CC }}"' >> custom.py echo 'CC = "${{ env.CC }}"' >> custom.py
- name: 'Build project' - name: 'Build project'
@ -126,7 +126,7 @@ jobs:
python -m pip install --user -U pip python -m pip install --user -U pip
python -m pip install --user -r requirements.txt python -m pip install --user -r requirements.txt
# Configuration for scons # Configuration for scons
echo 'godot_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py echo 'pandemonium_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py
echo 'platform = "${{ matrix.PLATFORM }}"' >> custom.py echo 'platform = "${{ matrix.PLATFORM }}"' >> custom.py
echo 'MSVC_USE_SCRIPT = True' >> custom.py echo 'MSVC_USE_SCRIPT = True' >> custom.py
echo 'TARGET_ARCH = "${{ matrix.VS_ARCH }}"' >> custom.py echo 'TARGET_ARCH = "${{ matrix.VS_ARCH }}"' >> custom.py
@ -198,7 +198,7 @@ jobs:
pip install -U pip pip install -U pip
pip install -r requirements.txt pip install -r requirements.txt
# Configuration for scons # Configuration for scons
echo 'godot_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py echo 'pandemonium_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py
echo 'platform = "${{ env.PLATFORM }}"' >> custom.py echo 'platform = "${{ env.PLATFORM }}"' >> custom.py
echo 'CC = "${{ env.CC }}"' >> custom.py echo 'CC = "${{ env.CC }}"' >> custom.py
- name: 'Build project' - name: 'Build project'

View File

@ -86,16 +86,7 @@ Godot-Python requires Python >= 3.7 and a C compiler.
Godot GDNative header Godot GDNative header
--------------------- ---------------------
TODO (need to be copied from the gdnative module)
The Godot GDNative headers are provided as git submodule:
.. code-block:: bash
$ git submodule init
$ git submodule update
Alternatively, you can get them `from github <https://github.com/GodotNativeTools/godot_headers>`_.
Linux Linux
----- -----
@ -263,7 +254,7 @@ use that the static library and binary for building and tests.
.. code-block:: bash .. code-block:: bash
godot-python(venv)$ scons platform=x11-64 godot_binary=../godot/bin/godot.x11.opt.64 godot-python(venv)$ scons platform=x11-64 pandemonium_binary=../godot/bin/godot.x11.opt.64
Additional build options Additional build options

View File

@ -17,10 +17,10 @@ def extract_version():
return gl["__version__"] return gl["__version__"]
def godot_binary_converter(val, env): def pandemonium_binary_converter(val, env):
file = File(val) file = File(val)
if file.exists(): if file.exists():
# Note here `env["godot_binary_download_version"]` is not defined, this is ok given # Note here `env["pandemonium_binary_download_version"]` is not defined, this is ok given
# this variable shouldn't be needed if Godot doesn't have to be downloaded # this variable shouldn't be needed if Godot doesn't have to be downloaded
return file return file
# Provided value is version information with format <major>.<minor>.<patch>[-<extra>] # Provided value is version information with format <major>.<minor>.<patch>[-<extra>]
@ -31,8 +31,8 @@ def godot_binary_converter(val, env):
raise UserError( raise UserError(
f"`{val}` is neither an existing file nor a valid <major>.<minor>.<patch>[-<extra>] Godot version format" f"`{val}` is neither an existing file nor a valid <major>.<minor>.<patch>[-<extra>] Godot version format"
) )
env["godot_binary_download_version"] = (major, minor, patch, extra or "stable") env["pandemonium_binary_download_version"] = (major, minor, patch, extra or "stable")
# `godot_binary` is set to None to indicate it should be downloaded # `pandemonium_binary` is set to None to indicate it should be downloaded
return None return None
@ -47,14 +47,14 @@ vars.Add(
) )
vars.Add("pytest_args", "Pytest arguments passed to tests functions", "") vars.Add("pytest_args", "Pytest arguments passed to tests functions", "")
vars.Add( vars.Add(
"godot_args", "Additional arguments passed to godot binary when running tests&examples", "" "pandemonium_args", "Additional arguments passed to godot binary when running tests&examples", ""
) )
vars.Add("release_suffix", "Suffix to add to the release archive", extract_version()) vars.Add("release_suffix", "Suffix to add to the release archive", extract_version())
vars.Add( vars.Add(
"godot_binary", "pandemonium_binary",
"Path to Godot binary or version of Godot to use", "Path to Godot binary or version of Godot to use",
default="3.2.2", default="3.2.2",
converter=godot_binary_converter, converter=pandemonium_binary_converter,
) )
vars.Add("pandemonium_headers", "Path to Godot GDnative headers", "") vars.Add("pandemonium_headers", "Path to Godot GDnative headers", "")
vars.Add("debugger", "Run test with a debugger", "") vars.Add("debugger", "Run test with a debugger", "")

View File

@ -3,7 +3,7 @@ Import("env")
for test in ["pong", "pong_multiplayer"]: for test in ["pong", "pong_multiplayer"]:
dist_symlink = env.Symlink(f"{test}/addons", "$DIST_ROOT/addons") dist_symlink = env.Symlink(f"{test}/addons", "$DIST_ROOT/addons")
target = env.Command( target = env.Command(
test, ["$godot_binary", dist_symlink], "${SOURCE.abspath} ${godot_args} --path ${TARGET}" test, ["$pandemonium_binary", dist_symlink], "${SOURCE.abspath} ${pandemonium_args} --path ${TARGET}"
) )
env.AlwaysBuild(target) env.AlwaysBuild(target)

View File

@ -2,7 +2,7 @@
singleton=true singleton=true
load_once=true load_once=true
symbol_prefix="godot_" symbol_prefix="pandemonium_"
[entry] [entry]

View File

@ -2,7 +2,7 @@
singleton=true singleton=true
load_once=true load_once=true
symbol_prefix="godot_" symbol_prefix="pandemonium_"
[entry] [entry]

View File

@ -13,114 +13,114 @@ __ERR_MSG_BINDING_NOT_AVAILABLE = "No Godot binding available"
class Error(IntFlag): class Error(IntFlag):
OK = godot_error.GODOT_OK OK = pandemonium_error.GODOT_OK
FAILED = godot_error.GODOT_FAILED FAILED = pandemonium_error.GODOT_FAILED
ERR_UNAVAILABLE = godot_error.GODOT_ERR_UNAVAILABLE ERR_UNAVAILABLE = pandemonium_error.GODOT_ERR_UNAVAILABLE
ERR_UNCONFIGURED = godot_error.GODOT_ERR_UNCONFIGURED ERR_UNCONFIGURED = pandemonium_error.GODOT_ERR_UNCONFIGURED
ERR_UNAUTHORIZED = godot_error.GODOT_ERR_UNAUTHORIZED ERR_UNAUTHORIZED = pandemonium_error.GODOT_ERR_UNAUTHORIZED
ERR_PARAMETER_RANGE_ERROR = godot_error.GODOT_ERR_PARAMETER_RANGE_ERROR ERR_PARAMETER_RANGE_ERROR = pandemonium_error.GODOT_ERR_PARAMETER_RANGE_ERROR
ERR_OUT_OF_MEMORY = godot_error.GODOT_ERR_OUT_OF_MEMORY ERR_OUT_OF_MEMORY = pandemonium_error.GODOT_ERR_OUT_OF_MEMORY
ERR_FILE_NOT_FOUND = godot_error.GODOT_ERR_FILE_NOT_FOUND ERR_FILE_NOT_FOUND = pandemonium_error.GODOT_ERR_FILE_NOT_FOUND
ERR_FILE_BAD_DRIVE = godot_error.GODOT_ERR_FILE_BAD_DRIVE ERR_FILE_BAD_DRIVE = pandemonium_error.GODOT_ERR_FILE_BAD_DRIVE
ERR_FILE_BAD_PATH = godot_error.GODOT_ERR_FILE_BAD_PATH ERR_FILE_BAD_PATH = pandemonium_error.GODOT_ERR_FILE_BAD_PATH
ERR_FILE_NO_PERMISSION = godot_error.GODOT_ERR_FILE_NO_PERMISSION ERR_FILE_NO_PERMISSION = pandemonium_error.GODOT_ERR_FILE_NO_PERMISSION
ERR_FILE_ALREADY_IN_USE = godot_error.GODOT_ERR_FILE_ALREADY_IN_USE ERR_FILE_ALREADY_IN_USE = pandemonium_error.GODOT_ERR_FILE_ALREADY_IN_USE
ERR_FILE_CANT_OPEN = godot_error.GODOT_ERR_FILE_CANT_OPEN ERR_FILE_CANT_OPEN = pandemonium_error.GODOT_ERR_FILE_CANT_OPEN
ERR_FILE_CANT_WRITE = godot_error.GODOT_ERR_FILE_CANT_WRITE ERR_FILE_CANT_WRITE = pandemonium_error.GODOT_ERR_FILE_CANT_WRITE
ERR_FILE_CANT_READ = godot_error.GODOT_ERR_FILE_CANT_READ ERR_FILE_CANT_READ = pandemonium_error.GODOT_ERR_FILE_CANT_READ
ERR_FILE_UNRECOGNIZED = godot_error.GODOT_ERR_FILE_UNRECOGNIZED ERR_FILE_UNRECOGNIZED = pandemonium_error.GODOT_ERR_FILE_UNRECOGNIZED
ERR_FILE_CORRUPT = godot_error.GODOT_ERR_FILE_CORRUPT ERR_FILE_CORRUPT = pandemonium_error.GODOT_ERR_FILE_CORRUPT
ERR_FILE_MISSING_DEPENDENCIES = godot_error.GODOT_ERR_FILE_MISSING_DEPENDENCIES ERR_FILE_MISSING_DEPENDENCIES = pandemonium_error.GODOT_ERR_FILE_MISSING_DEPENDENCIES
ERR_FILE_EOF = godot_error.GODOT_ERR_FILE_EOF ERR_FILE_EOF = pandemonium_error.GODOT_ERR_FILE_EOF
ERR_CANT_OPEN = godot_error.GODOT_ERR_CANT_OPEN ERR_CANT_OPEN = pandemonium_error.GODOT_ERR_CANT_OPEN
ERR_CANT_CREATE = godot_error.GODOT_ERR_CANT_CREATE ERR_CANT_CREATE = pandemonium_error.GODOT_ERR_CANT_CREATE
ERR_QUERY_FAILED = godot_error.GODOT_ERR_QUERY_FAILED ERR_QUERY_FAILED = pandemonium_error.GODOT_ERR_QUERY_FAILED
ERR_ALREADY_IN_USE = godot_error.GODOT_ERR_ALREADY_IN_USE ERR_ALREADY_IN_USE = pandemonium_error.GODOT_ERR_ALREADY_IN_USE
ERR_LOCKED = godot_error.GODOT_ERR_LOCKED ERR_LOCKED = pandemonium_error.GODOT_ERR_LOCKED
ERR_TIMEOUT = godot_error.GODOT_ERR_TIMEOUT ERR_TIMEOUT = pandemonium_error.GODOT_ERR_TIMEOUT
ERR_CANT_CONNECT = godot_error.GODOT_ERR_CANT_CONNECT ERR_CANT_CONNECT = pandemonium_error.GODOT_ERR_CANT_CONNECT
ERR_CANT_RESOLVE = godot_error.GODOT_ERR_CANT_RESOLVE ERR_CANT_RESOLVE = pandemonium_error.GODOT_ERR_CANT_RESOLVE
ERR_CONNECTION_ERROR = godot_error.GODOT_ERR_CONNECTION_ERROR ERR_CONNECTION_ERROR = pandemonium_error.GODOT_ERR_CONNECTION_ERROR
ERR_CANT_ACQUIRE_RESOURCE = godot_error.GODOT_ERR_CANT_ACQUIRE_RESOURCE ERR_CANT_ACQUIRE_RESOURCE = pandemonium_error.GODOT_ERR_CANT_ACQUIRE_RESOURCE
ERR_CANT_FORK = godot_error.GODOT_ERR_CANT_FORK ERR_CANT_FORK = pandemonium_error.GODOT_ERR_CANT_FORK
ERR_INVALID_DATA = godot_error.GODOT_ERR_INVALID_DATA ERR_INVALID_DATA = pandemonium_error.GODOT_ERR_INVALID_DATA
ERR_INVALID_PARAMETER = godot_error.GODOT_ERR_INVALID_PARAMETER ERR_INVALID_PARAMETER = pandemonium_error.GODOT_ERR_INVALID_PARAMETER
ERR_ALREADY_EXISTS = godot_error.GODOT_ERR_ALREADY_EXISTS ERR_ALREADY_EXISTS = pandemonium_error.GODOT_ERR_ALREADY_EXISTS
ERR_DOES_NOT_EXIST = godot_error.GODOT_ERR_DOES_NOT_EXIST ERR_DOES_NOT_EXIST = pandemonium_error.GODOT_ERR_DOES_NOT_EXIST
ERR_DATABASE_CANT_READ = godot_error.GODOT_ERR_DATABASE_CANT_READ ERR_DATABASE_CANT_READ = pandemonium_error.GODOT_ERR_DATABASE_CANT_READ
ERR_DATABASE_CANT_WRITE = godot_error.GODOT_ERR_DATABASE_CANT_WRITE ERR_DATABASE_CANT_WRITE = pandemonium_error.GODOT_ERR_DATABASE_CANT_WRITE
ERR_COMPILATION_FAILED = godot_error.GODOT_ERR_COMPILATION_FAILED ERR_COMPILATION_FAILED = pandemonium_error.GODOT_ERR_COMPILATION_FAILED
ERR_METHOD_NOT_FOUND = godot_error.GODOT_ERR_METHOD_NOT_FOUND ERR_METHOD_NOT_FOUND = pandemonium_error.GODOT_ERR_METHOD_NOT_FOUND
ERR_LINK_FAILED = godot_error.GODOT_ERR_LINK_FAILED ERR_LINK_FAILED = pandemonium_error.GODOT_ERR_LINK_FAILED
ERR_SCRIPT_FAILED = godot_error.GODOT_ERR_SCRIPT_FAILED ERR_SCRIPT_FAILED = pandemonium_error.GODOT_ERR_SCRIPT_FAILED
ERR_CYCLIC_LINK = godot_error.GODOT_ERR_CYCLIC_LINK ERR_CYCLIC_LINK = pandemonium_error.GODOT_ERR_CYCLIC_LINK
ERR_INVALID_DECLARATION = godot_error.GODOT_ERR_INVALID_DECLARATION ERR_INVALID_DECLARATION = pandemonium_error.GODOT_ERR_INVALID_DECLARATION
ERR_DUPLICATE_SYMBOL = godot_error.GODOT_ERR_DUPLICATE_SYMBOL ERR_DUPLICATE_SYMBOL = pandemonium_error.GODOT_ERR_DUPLICATE_SYMBOL
ERR_PARSE_ERROR = godot_error.GODOT_ERR_PARSE_ERROR ERR_PARSE_ERROR = pandemonium_error.GODOT_ERR_PARSE_ERROR
ERR_BUSY = godot_error.GODOT_ERR_BUSY ERR_BUSY = pandemonium_error.GODOT_ERR_BUSY
ERR_SKIP = godot_error.GODOT_ERR_SKIP ERR_SKIP = pandemonium_error.GODOT_ERR_SKIP
ERR_HELP = godot_error.GODOT_ERR_HELP ERR_HELP = pandemonium_error.GODOT_ERR_HELP
ERR_BUG = godot_error.GODOT_ERR_BUG ERR_BUG = pandemonium_error.GODOT_ERR_BUG
ERR_PRINTER_ON_FIRE = godot_error.GODOT_ERR_PRINTER_ON_FIRE ERR_PRINTER_ON_FIRE = pandemonium_error.GODOT_ERR_PRINTER_ON_FIRE
class VariantType(IntFlag): class VariantType(IntFlag):
NIL = godot_variant_type.GODOT_VARIANT_TYPE_NIL NIL = pandemonium_variant_type.GODOT_VARIANT_TYPE_NIL
BOOL = godot_variant_type.GODOT_VARIANT_TYPE_BOOL BOOL = pandemonium_variant_type.GODOT_VARIANT_TYPE_BOOL
INT = godot_variant_type.GODOT_VARIANT_TYPE_INT INT = pandemonium_variant_type.GODOT_VARIANT_TYPE_INT
REAL = godot_variant_type.GODOT_VARIANT_TYPE_REAL REAL = pandemonium_variant_type.GODOT_VARIANT_TYPE_REAL
STRING = godot_variant_type.GODOT_VARIANT_TYPE_STRING STRING = pandemonium_variant_type.GODOT_VARIANT_TYPE_STRING
VECTOR2 = godot_variant_type.GODOT_VARIANT_TYPE_VECTOR2 VECTOR2 = pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR2
RECT2 = godot_variant_type.GODOT_VARIANT_TYPE_RECT2 RECT2 = pandemonium_variant_type.GODOT_VARIANT_TYPE_RECT2
VECTOR3 = godot_variant_type.GODOT_VARIANT_TYPE_VECTOR3 VECTOR3 = pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR3
TRANSFORM2D = godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D TRANSFORM2D = pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D
PLANE = godot_variant_type.GODOT_VARIANT_TYPE_PLANE PLANE = pandemonium_variant_type.GODOT_VARIANT_TYPE_PLANE
QUAT = godot_variant_type.GODOT_VARIANT_TYPE_QUAT QUAT = pandemonium_variant_type.GODOT_VARIANT_TYPE_QUAT
AABB = godot_variant_type.GODOT_VARIANT_TYPE_AABB AABB = pandemonium_variant_type.GODOT_VARIANT_TYPE_AABB
BASIS = godot_variant_type.GODOT_VARIANT_TYPE_BASIS BASIS = pandemonium_variant_type.GODOT_VARIANT_TYPE_BASIS
TRANSFORM = godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM TRANSFORM = pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM
COLOR = godot_variant_type.GODOT_VARIANT_TYPE_COLOR COLOR = pandemonium_variant_type.GODOT_VARIANT_TYPE_COLOR
NODE_PATH = godot_variant_type.GODOT_VARIANT_TYPE_NODE_PATH NODE_PATH = pandemonium_variant_type.GODOT_VARIANT_TYPE_NODE_PATH
RID = godot_variant_type.GODOT_VARIANT_TYPE_RID RID = pandemonium_variant_type.GODOT_VARIANT_TYPE_RID
OBJECT = godot_variant_type.GODOT_VARIANT_TYPE_OBJECT OBJECT = pandemonium_variant_type.GODOT_VARIANT_TYPE_OBJECT
DICTIONARY = godot_variant_type.GODOT_VARIANT_TYPE_DICTIONARY DICTIONARY = pandemonium_variant_type.GODOT_VARIANT_TYPE_DICTIONARY
ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_ARRAY ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_ARRAY
POOL_BYTE_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY POOL_BYTE_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY
POOL_INT_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY POOL_INT_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY
POOL_REAL_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY POOL_REAL_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY
POOL_STRING_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY POOL_STRING_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY
POOL_VECTOR2_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY POOL_VECTOR2_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY
POOL_VECTOR3_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY POOL_VECTOR3_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY
POOL_COLOR_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY POOL_COLOR_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY
class VariantOperator(IntFlag): class VariantOperator(IntFlag):
EQUAL = godot_variant_operator.GODOT_VARIANT_OP_EQUAL EQUAL = pandemonium_variant_operator.GODOT_VARIANT_OP_EQUAL
NOT_EQUAL = godot_variant_operator.GODOT_VARIANT_OP_NOT_EQUAL NOT_EQUAL = pandemonium_variant_operator.GODOT_VARIANT_OP_NOT_EQUAL
LESS = godot_variant_operator.GODOT_VARIANT_OP_LESS LESS = pandemonium_variant_operator.GODOT_VARIANT_OP_LESS
LESS_EQUAL = godot_variant_operator.GODOT_VARIANT_OP_LESS_EQUAL LESS_EQUAL = pandemonium_variant_operator.GODOT_VARIANT_OP_LESS_EQUAL
GREATER = godot_variant_operator.GODOT_VARIANT_OP_GREATER GREATER = pandemonium_variant_operator.GODOT_VARIANT_OP_GREATER
GREATER_EQUAL = godot_variant_operator.GODOT_VARIANT_OP_GREATER_EQUAL GREATER_EQUAL = pandemonium_variant_operator.GODOT_VARIANT_OP_GREATER_EQUAL
ADD = godot_variant_operator.GODOT_VARIANT_OP_ADD ADD = pandemonium_variant_operator.GODOT_VARIANT_OP_ADD
SUBTRACT = godot_variant_operator.GODOT_VARIANT_OP_SUBTRACT SUBTRACT = pandemonium_variant_operator.GODOT_VARIANT_OP_SUBTRACT
MULTIPLY = godot_variant_operator.GODOT_VARIANT_OP_MULTIPLY MULTIPLY = pandemonium_variant_operator.GODOT_VARIANT_OP_MULTIPLY
DIVIDE = godot_variant_operator.GODOT_VARIANT_OP_DIVIDE DIVIDE = pandemonium_variant_operator.GODOT_VARIANT_OP_DIVIDE
NEGATE = godot_variant_operator.GODOT_VARIANT_OP_NEGATE NEGATE = pandemonium_variant_operator.GODOT_VARIANT_OP_NEGATE
POSITIVE = godot_variant_operator.GODOT_VARIANT_OP_POSITIVE POSITIVE = pandemonium_variant_operator.GODOT_VARIANT_OP_POSITIVE
MODULE = godot_variant_operator.GODOT_VARIANT_OP_MODULE MODULE = pandemonium_variant_operator.GODOT_VARIANT_OP_MODULE
STRING_CONCAT = godot_variant_operator.GODOT_VARIANT_OP_STRING_CONCAT STRING_CONCAT = pandemonium_variant_operator.GODOT_VARIANT_OP_STRING_CONCAT
SHIFT_LEFT = godot_variant_operator.GODOT_VARIANT_OP_SHIFT_LEFT SHIFT_LEFT = pandemonium_variant_operator.GODOT_VARIANT_OP_SHIFT_LEFT
SHIFT_RIGHT = godot_variant_operator.GODOT_VARIANT_OP_SHIFT_RIGHT SHIFT_RIGHT = pandemonium_variant_operator.GODOT_VARIANT_OP_SHIFT_RIGHT
BIT_AND = godot_variant_operator.GODOT_VARIANT_OP_BIT_AND BIT_AND = pandemonium_variant_operator.GODOT_VARIANT_OP_BIT_AND
BIT_OR = godot_variant_operator.GODOT_VARIANT_OP_BIT_OR BIT_OR = pandemonium_variant_operator.GODOT_VARIANT_OP_BIT_OR
BIT_XOR = godot_variant_operator.GODOT_VARIANT_OP_BIT_XOR BIT_XOR = pandemonium_variant_operator.GODOT_VARIANT_OP_BIT_XOR
BIT_NEGATE = godot_variant_operator.GODOT_VARIANT_OP_BIT_NEGATE BIT_NEGATE = pandemonium_variant_operator.GODOT_VARIANT_OP_BIT_NEGATE
AND = godot_variant_operator.GODOT_VARIANT_OP_AND AND = pandemonium_variant_operator.GODOT_VARIANT_OP_AND
OR = godot_variant_operator.GODOT_VARIANT_OP_OR OR = pandemonium_variant_operator.GODOT_VARIANT_OP_OR
XOR = godot_variant_operator.GODOT_VARIANT_OP_XOR XOR = pandemonium_variant_operator.GODOT_VARIANT_OP_XOR
NOT = godot_variant_operator.GODOT_VARIANT_OP_NOT NOT = pandemonium_variant_operator.GODOT_VARIANT_OP_NOT
IN = godot_variant_operator.GODOT_VARIANT_OP_IN IN = pandemonium_variant_operator.GODOT_VARIANT_OP_IN
MAX = godot_variant_operator.GODOT_VARIANT_OP_MAX MAX = pandemonium_variant_operator.GODOT_VARIANT_OP_MAX
### Classes ### ### Classes ###
@ -145,12 +145,12 @@ class VariantOperator(IntFlag):
# (where at this point Godot should have finished it initialization). # (where at this point Godot should have finished it initialization).
{% set early_needed_bindings = ["_OS", "_ProjectSettings"] %} {% set early_needed_bindings = ["_OS", "_ProjectSettings"] %}
cdef godot_object *_ptr cdef pandemonium_object *_ptr
{% for cls in classes %} {% for cls in classes %}
{% if cls.name in early_needed_bindings %} {% if cls.name in early_needed_bindings %}
{{ render_class_gdapi_ptrs_init(cls) }} {{ render_class_gdapi_ptrs_init(cls) }}
{% if cls.singleton %} {% if cls.singleton %}
_ptr = gdapi10.godot_global_get_singleton("{{ cls.singleton }}") _ptr = gdapi10.pandemonium_global_get_singleton("{{ cls.singleton }}")
if _ptr != NULL: if _ptr != NULL:
{{ cls.singleton }} = {{ cls.name }}.from_ptr(_ptr) {{ cls.singleton }} = {{ cls.name }}.from_ptr(_ptr)
else: else:
@ -181,7 +181,7 @@ cdef void _initialize_bindings():
{{ render_class_gdapi_ptrs_init(cls) | indent }} {{ render_class_gdapi_ptrs_init(cls) | indent }}
{%- if cls.singleton %} {%- if cls.singleton %}
global {{ cls.singleton }} global {{ cls.singleton }}
(<{{ cls["name"] }}>{{ cls.singleton }})._gd_ptr = gdapi10.godot_global_get_singleton("{{ cls.singleton }}") (<{{ cls["name"] }}>{{ cls.singleton }})._gd_ptr = gdapi10.pandemonium_global_get_singleton("{{ cls.singleton }}")
if (<{{ cls["name"] }}>{{ cls.singleton }})._gd_ptr == NULL: if (<{{ cls["name"] }}>{{ cls.singleton }})._gd_ptr == NULL:
print('Cannot retreive singleton {{ cls.singleton }}') print('Cannot retreive singleton {{ cls.singleton }}')
{%- endif %} {%- endif %}

View File

@ -4,16 +4,16 @@
cdef class {{ cls.name }}({{ cls.base_class }}): cdef class {{ cls.name }}({{ cls.base_class }}):
{% if not cls.base_class %} {% if not cls.base_class %}
cdef godot_object *_gd_ptr cdef pandemonium_object *_gd_ptr
@staticmethod @staticmethod
cdef inline Object cast_from_variant(const godot_variant *p_gdvar) cdef inline Object cast_from_variant(const pandemonium_variant *p_gdvar)
@staticmethod @staticmethod
cdef inline Object cast_from_ptr(godot_object *ptr) cdef inline Object cast_from_ptr(pandemonium_object *ptr)
{% endif %} {% endif %}
@staticmethod @staticmethod
cdef {{ cls.name }} from_ptr(godot_object *_ptr) cdef {{ cls.name }} from_ptr(pandemonium_object *_ptr)
{% endmacro %} {% endmacro %}

View File

@ -5,12 +5,12 @@
{% if not cls.singleton %} {% if not cls.singleton %}
global __{{ cls.name }}_constructor global __{{ cls.name }}_constructor
__{{ cls.name }}_constructor = gdapi10.godot_get_class_constructor("{{ cls.name }}") __{{ cls.name }}_constructor = gdapi10.pandemonium_get_class_constructor("{{ cls.name }}")
{% endif %} {% endif %}
{% for method in cls.methods %} {% for method in cls.methods %}
global {{ get_method_bind_register_name(cls, method) }} global {{ get_method_bind_register_name(cls, method) }}
{{ get_method_bind_register_name(cls, method) }} = gdapi10.godot_method_bind_get_method("{{ cls.bind_register_name }}", "{{ method.name }}") {{ get_method_bind_register_name(cls, method) }} = gdapi10.pandemonium_method_bind_get_method("{{ cls.bind_register_name }}", "{{ method.name }}")
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
@ -24,11 +24,11 @@ from cpython.object cimport PyObject_GenericGetAttr, PyObject_GenericSetAttr
{% endif %} {% endif %}
{% if not cls.singleton %} {% if not cls.singleton %}
cdef godot_class_constructor __{{ cls.name }}_constructor = NULL cdef pandemonium_class_constructor __{{ cls.name }}_constructor = NULL
{% endif %} {% endif %}
{% for method in cls.methods %} {% for method in cls.methods %}
cdef godot_method_bind *{{ get_method_bind_register_name(cls, method) }} = NULL cdef pandemonium_method_bind *{{ get_method_bind_register_name(cls, method) }} = NULL
{% endfor %} {% endfor %}
cdef class {{ cls.name }}({{ cls.base_class }}): cdef class {{ cls.name }}({{ cls.base_class }}):
@ -36,7 +36,7 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
# free is virtual but this is not marked in api.json :'( # free is virtual but this is not marked in api.json :'(
def free(self): def free(self):
with nogil: with nogil:
gdapi10.godot_object_destroy(self._gd_ptr) gdapi10.pandemonium_object_destroy(self._gd_ptr)
def __init__(self): def __init__(self):
raise RuntimeError( raise RuntimeError(
@ -47,12 +47,12 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
return f"<{type(self).__name__} wrapper on 0x{<size_t>self._gd_ptr:x}>" return f"<{type(self).__name__} wrapper on 0x{<size_t>self._gd_ptr:x}>"
@staticmethod @staticmethod
cdef inline Object cast_from_variant(const godot_variant *p_gdvar): cdef inline Object cast_from_variant(const pandemonium_variant *p_gdvar):
cdef godot_object *ptr = gdapi10.godot_variant_as_object(p_gdvar) cdef pandemonium_object *ptr = gdapi10.pandemonium_variant_as_object(p_gdvar)
# Retreive class # Retreive class
cdef GDString classname = GDString.__new__(GDString) cdef GDString classname = GDString.__new__(GDString)
with nogil: with nogil:
gdapi10.godot_method_bind_ptrcall( gdapi10.pandemonium_method_bind_ptrcall(
__methbind__Object__get_class, __methbind__Object__get_class,
ptr, ptr,
NULL, NULL,
@ -61,11 +61,11 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
return globals()[str(classname)]._from_ptr(<size_t>ptr) return globals()[str(classname)]._from_ptr(<size_t>ptr)
@staticmethod @staticmethod
cdef inline Object cast_from_ptr(godot_object *ptr): cdef inline Object cast_from_ptr(pandemonium_object *ptr):
# Retreive class # Retreive class
cdef GDString classname = GDString.__new__(GDString) cdef GDString classname = GDString.__new__(GDString)
with nogil: with nogil:
gdapi10.godot_method_bind_ptrcall( gdapi10.pandemonium_method_bind_ptrcall(
__methbind__Object__get_class, __methbind__Object__get_class,
ptr, ptr,
NULL, NULL,
@ -139,14 +139,14 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
def __init__(self): def __init__(self):
if __{{ cls.name }}_constructor == NULL: if __{{ cls.name }}_constructor == NULL:
raise NotImplementedError(__ERR_MSG_BINDING_NOT_AVAILABLE) raise NotImplementedError(__ERR_MSG_BINDING_NOT_AVAILABLE)
cdef godot_bool __ret cdef pandemonium_bool __ret
with nogil: with nogil:
self._gd_ptr = __{{ cls["name"] }}_constructor() self._gd_ptr = __{{ cls["name"] }}_constructor()
if self._gd_ptr is NULL: if self._gd_ptr is NULL:
raise MemoryError raise MemoryError
gdapi10.godot_method_bind_ptrcall( gdapi10.pandemonium_method_bind_ptrcall(
__methbind__Reference__init_ref, __methbind__Reference__init_ref,
self._gd_ptr, self._gd_ptr,
NULL, NULL,
@ -172,24 +172,24 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
raise RuntimeError(f"Refcounted Godot object must be created with `{ cls.__name__ }()`") raise RuntimeError(f"Refcounted Godot object must be created with `{ cls.__name__ }()`")
def __dealloc__(self): def __dealloc__(self):
cdef godot_bool __ret cdef pandemonium_bool __ret
if self._gd_ptr == NULL: if self._gd_ptr == NULL:
return return
with nogil: with nogil:
gdapi10.godot_method_bind_ptrcall( gdapi10.pandemonium_method_bind_ptrcall(
__methbind__Reference__unreference, __methbind__Reference__unreference,
self._gd_ptr, self._gd_ptr,
NULL, NULL,
&__ret &__ret
) )
if __ret: if __ret:
gdapi10.godot_object_destroy(self._gd_ptr) gdapi10.pandemonium_object_destroy(self._gd_ptr)
{% endif %} {% endif %}
{% endif %} {% endif %}
@staticmethod @staticmethod
cdef {{ cls.name }} from_ptr(godot_object *_ptr): cdef {{ cls.name }} from_ptr(pandemonium_object *_ptr):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef {{ cls.name }} wrapper = {{ cls.name }}.__new__({{ cls.name }}) cdef {{ cls.name }} wrapper = {{ cls.name }}.__new__({{ cls.name }})
wrapper._gd_ptr = _ptr wrapper._gd_ptr = _ptr
@ -202,7 +202,7 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
{% if not cls.singleton and cls.instantiable %} {% if not cls.singleton and cls.instantiable %}
@classmethod @classmethod
def _new(cls): def _new(cls):
cdef godot_object* ptr = __{{ cls.name }}_constructor() cdef pandemonium_object* ptr = __{{ cls.name }}_constructor()
if ptr is NULL: if ptr is NULL:
raise MemoryError raise MemoryError
return <size_t>ptr return <size_t>ptr
@ -212,9 +212,9 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
def _from_ptr(ptr): def _from_ptr(ptr):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef {{ cls.name }} wrapper = {{ cls.name }}.__new__({{ cls.name }}) cdef {{ cls.name }} wrapper = {{ cls.name }}.__new__({{ cls.name }})
# /!\ doing `<godot_object*>ptr` would return the address of # /!\ doing `<pandemonium_object*>ptr` would return the address of
# the PyObject instead of casting it value ! # the PyObject instead of casting it value !
wrapper._gd_ptr = <godot_object *><size_t>ptr wrapper._gd_ptr = <pandemonium_object *><size_t>ptr
{% if cls.is_reference %} {% if cls.is_reference %}
# Note we steal the reference from the caller given we # Note we steal the reference from the caller given we
# don't call `Reference.reference` here # don't call `Reference.reference` here

View File

@ -15,7 +15,7 @@ __methbind__{{ cls.name }}__{{ method.name }}
{% macro render_method_signature(method) %} {% macro render_method_signature(method) %}
{{ method.name }}(self, {{ method.name }}(self,
{%- for arg in method.arguments %} {%- for arg in method.arguments %}
{%- if arg.type.c_type in ("godot_string", "godot_node_path") %} {%- if arg.type.c_type in ("pandemonium_string", "pandemonium_node_path") %}
object {{ arg.name }} object {{ arg.name }}
{%- else %} {%- else %}
{{ arg.type.cy_type }} {{ arg.name }} {{ arg.type.cy_type }} {{ arg.name }}
@ -42,12 +42,12 @@ if {{ retval }} == NULL:
return None return None
else: else:
return Object.cast_from_ptr({{ retval }}) return Object.cast_from_ptr({{ retval }})
{% elif method.return_type.c_type == "godot_variant" %} {% elif method.return_type.c_type == "pandemonium_variant" %}
try: try:
return godot_variant_to_pyobj(&{{ retval }}) return pandemonium_variant_to_pyobj(&{{ retval }})
finally: finally:
with nogil: with nogil:
gdapi10.godot_variant_destroy(&{{ retval }}) gdapi10.pandemonium_variant_destroy(&{{ retval }})
{% elif method.return_type.is_enum %} {% elif method.return_type.is_enum %}
return {{ method.return_type.py_type }}({{ retval }}) return {{ method.return_type.py_type }}({{ retval }})
{% else %} {% else %}
@ -63,10 +63,10 @@ cdef const void *{{ argsval }}[{{ method.arguments | length }}]
{% for arg in method.arguments %} {% for arg in method.arguments %}
{% set i = loop.index - 1 %} {% set i = loop.index - 1 %}
# {{ arg.type.c_type }} {{ arg.name }} # {{ arg.type.c_type }} {{ arg.name }}
{% if arg.type.c_type == "godot_string" %} {% if arg.type.c_type == "pandemonium_string" %}
cdef GDString __gdstr_{{ arg.name }} = ensure_is_gdstring({{ arg.name }}) cdef GDString __gdstr_{{ arg.name }} = ensure_is_gdstring({{ arg.name }})
{{ argsval }}[{{ i }}] = <void*>(&__gdstr_{{ arg.name }}._gd_data) {{ argsval }}[{{ i }}] = <void*>(&__gdstr_{{ arg.name }}._gd_data)
{% elif arg.type.c_type == "godot_node_path" %} {% elif arg.type.c_type == "pandemonium_node_path" %}
cdef NodePath __nodepath_{{ arg.name }} = ensure_is_nodepath({{ arg.name }}) cdef NodePath __nodepath_{{ arg.name }} = ensure_is_nodepath({{ arg.name }})
{{ argsval }}[{{ i }}] = <void*>(&__nodepath_{{ arg.name }}._gd_data) {{ argsval }}[{{ i }}] = <void*>(&__nodepath_{{ arg.name }}._gd_data)
{% elif arg.type.is_object %} {% elif arg.type.is_object %}
@ -75,13 +75,13 @@ cdef NodePath __nodepath_{{ arg.name }} = ensure_is_nodepath({{ arg.name }})
{%- else %} {%- else %}
{{ argsval }}[{{ i }}] = <void*>{{ arg.name }}._gd_ptr {{ argsval }}[{{ i }}] = <void*>{{ arg.name }}._gd_ptr
{%- endif %} {%- endif %}
{% elif arg.type.c_type == "godot_variant" %} {% elif arg.type.c_type == "pandemonium_variant" %}
cdef godot_variant __var_{{ arg.name }} cdef pandemonium_variant __var_{{ arg.name }}
pyobj_to_godot_variant({{ arg.name }}, &__var_{{ arg.name }}) pyobj_to_pandemonium_variant({{ arg.name }}, &__var_{{ arg.name }})
{{ argsval }}[{{ i }}] = <void*>(&__var_{{ arg.name }}) {{ argsval }}[{{ i }}] = <void*>(&__var_{{ arg.name }})
{% elif arg.type.is_builtin %} {% elif arg.type.is_builtin %}
{{ argsval }}[{{ i }}] = <void*>(&{{ arg.name }}._gd_data) {{ argsval }}[{{ i }}] = <void*>(&{{ arg.name }}._gd_data)
{% elif arg.type.c_type == "godot_real" %} {% elif arg.type.c_type == "pandemonium_real" %}
# ptrcall does not work with single precision floats, so we must convert to a double # ptrcall does not work with single precision floats, so we must convert to a double
cdef double {{ arg.name }}_d = <double>{{ arg.name }}; cdef double {{ arg.name }}_d = <double>{{ arg.name }};
{{ argsval }}[{{ i }}] = &{{ arg.name }}_d {{ argsval }}[{{ i }}] = &{{ arg.name }}_d
@ -95,9 +95,9 @@ cdef double {{ arg.name }}_d = <double>{{ arg.name }};
{% macro _render_method_destroy_args(method) %} {% macro _render_method_destroy_args(method) %}
{% for arg in method.arguments %} {% for arg in method.arguments %}
{% set i = loop.index - 1 %} {% set i = loop.index - 1 %}
{% if arg.type.c_type == "godot_variant" %} {% if arg.type.c_type == "pandemonium_variant" %}
with nogil: with nogil:
gdapi10.godot_variant_destroy(&__var_{{ arg.name }}) gdapi10.pandemonium_variant_destroy(&__var_{{ arg.name }})
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{%- endmacro %} {%- endmacro %}
@ -111,16 +111,16 @@ with nogil:
# in case of Reference, Godot will try to decrease the # in case of Reference, Godot will try to decrease the
# refcount if the pointer is valid ! # refcount if the pointer is valid !
# (see https://github.com/godotengine/godot/issues/35609) # (see https://github.com/godotengine/godot/issues/35609)
cdef godot_object *{{ retval }} = NULL cdef pandemonium_object *{{ retval }} = NULL
{% set retval_as_arg = "&{}".format(retval) %} {% set retval_as_arg = "&{}".format(retval) %}
{% elif method.return_type.c_type == "godot_variant" %} {% elif method.return_type.c_type == "pandemonium_variant" %}
cdef godot_variant {{ retval }} cdef pandemonium_variant {{ retval }}
{% set retval_as_arg = "&{}".format(retval) %} {% set retval_as_arg = "&{}".format(retval) %}
{% elif method.return_type.is_builtin %} {% elif method.return_type.is_builtin %}
{% set cy_type = method.return_type.cy_type %} {% set cy_type = method.return_type.cy_type %}
cdef {{ cy_type }} {{ retval }} = {{ cy_type }}.__new__({{ cy_type }}) cdef {{ cy_type }} {{ retval }} = {{ cy_type }}.__new__({{ cy_type }})
{% set retval_as_arg = "&{}._gd_data".format(retval) %} {% set retval_as_arg = "&{}._gd_data".format(retval) %}
{% elif method.return_type.c_type == "godot_real" %} {% elif method.return_type.c_type == "pandemonium_real" %}
# ptrcall does not work with single precision floats, so we must convert to a double # ptrcall does not work with single precision floats, so we must convert to a double
cdef double {{ retval }} cdef double {{ retval }}
{% set retval_as_arg = "&{}".format(retval) %} {% set retval_as_arg = "&{}".format(retval) %}
@ -131,7 +131,7 @@ cdef {{ method.return_type.c_type }} {{ retval }}
if {{ get_method_bind_register_name(cls, method) }} == NULL: if {{ get_method_bind_register_name(cls, method) }} == NULL:
raise NotImplementedError(__ERR_MSG_BINDING_NOT_AVAILABLE) raise NotImplementedError(__ERR_MSG_BINDING_NOT_AVAILABLE)
with nogil: with nogil:
gdapi10.godot_method_bind_ptrcall( gdapi10.pandemonium_method_bind_ptrcall(
{{ get_method_bind_register_name(cls, method) }}, {{ get_method_bind_register_name(cls, method) }},
self._gd_ptr, self._gd_ptr,
{% if (method.arguments | length ) != 0 %} {% if (method.arguments | length ) != 0 %}

View File

@ -6,13 +6,13 @@
@cython.final @cython.final
cdef class AABB: cdef class AABB:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_aabb _gd_data cdef pandemonium_aabb _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, Vector3 pos not None=Vector3(), Vector3 size not None=Vector3()): def __init__(self, Vector3 pos not None=Vector3(), Vector3 size not None=Vector3()):
{{ force_mark_rendered("godot_aabb_new" )}} {{ force_mark_rendered("pandemonium_aabb_new" )}}
gdapi10.godot_aabb_new(&self._gd_data, &pos._gd_data, &size._gd_data) gdapi10.pandemonium_aabb_new(&self._gd_data, &pos._gd_data, &size._gd_data)
def __repr__(self): def __repr__(self):
return f"<AABB({self.as_string()})>" return f"<AABB({self.as_string()})>"
@ -20,33 +20,33 @@ cdef class AABB:
@property @property
def position(AABB self) -> Vector3: def position(AABB self) -> Vector3:
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_aabb_get_position" )}} {{ force_mark_rendered("pandemonium_aabb_get_position" )}}
ret._gd_data = gdapi10.godot_aabb_get_position(&self._gd_data) ret._gd_data = gdapi10.pandemonium_aabb_get_position(&self._gd_data)
return ret return ret
@position.setter @position.setter
def position(AABB self, Vector3 val not None) -> None: def position(AABB self, Vector3 val not None) -> None:
{{ force_mark_rendered("godot_aabb_set_position" )}} {{ force_mark_rendered("pandemonium_aabb_set_position" )}}
gdapi10.godot_aabb_set_position(&self._gd_data, &val._gd_data) gdapi10.pandemonium_aabb_set_position(&self._gd_data, &val._gd_data)
@property @property
def size(AABB self) -> Vector3: def size(AABB self) -> Vector3:
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_aabb_get_size" )}} {{ force_mark_rendered("pandemonium_aabb_get_size" )}}
ret._gd_data = gdapi10.godot_aabb_get_size(&self._gd_data) ret._gd_data = gdapi10.pandemonium_aabb_get_size(&self._gd_data)
return ret return ret
@size.setter @size.setter
def size(AABB self, Vector3 val not None) -> None: def size(AABB self, Vector3 val not None) -> None:
{{ force_mark_rendered("godot_aabb_set_size" )}} {{ force_mark_rendered("pandemonium_aabb_set_size" )}}
gdapi10.godot_aabb_set_size(&self._gd_data, &val._gd_data) gdapi10.pandemonium_aabb_set_size(&self._gd_data, &val._gd_data)
@property @property
def end(AABB self) -> Vector3: def end(AABB self) -> Vector3:
cdef godot_vector3 position = gdapi10.godot_aabb_get_position(&self._gd_data) cdef pandemonium_vector3 position = gdapi10.pandemonium_aabb_get_position(&self._gd_data)
cdef godot_vector3 size = gdapi10.godot_aabb_get_size(&self._gd_data) cdef pandemonium_vector3 size = gdapi10.pandemonium_aabb_get_size(&self._gd_data)
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
ret._gd_data = gdapi10.godot_vector3_operator_add(&position, &size) ret._gd_data = gdapi10.pandemonium_vector3_operator_add(&position, &size)
return ret return ret
{{ render_operator_eq() | indent }} {{ render_operator_eq() | indent }}

View File

@ -4,28 +4,28 @@
{% endblock -%} {% endblock -%}
{# TODO: conversion from pool arrays is not supported #} {# TODO: conversion from pool arrays is not supported #}
{{ force_mark_rendered("godot_array_new_pool_byte_array") }} {{ force_mark_rendered("pandemonium_array_new_pool_byte_array") }}
{{ force_mark_rendered("godot_array_new_pool_color_array") }} {{ force_mark_rendered("pandemonium_array_new_pool_color_array") }}
{{ force_mark_rendered("godot_array_new_pool_int_array") }} {{ force_mark_rendered("pandemonium_array_new_pool_int_array") }}
{{ force_mark_rendered("godot_array_new_pool_real_array") }} {{ force_mark_rendered("pandemonium_array_new_pool_real_array") }}
{{ force_mark_rendered("godot_array_new_pool_string_array") }} {{ force_mark_rendered("pandemonium_array_new_pool_string_array") }}
{{ force_mark_rendered("godot_array_new_pool_vector2_array") }} {{ force_mark_rendered("pandemonium_array_new_pool_vector2_array") }}
{{ force_mark_rendered("godot_array_new_pool_vector3_array") }} {{ force_mark_rendered("pandemonium_array_new_pool_vector3_array") }}
{# We can't do const in Python #} {# We can't do const in Python #}
{{ force_mark_rendered("godot_array_operator_index_const") }} {{ force_mark_rendered("pandemonium_array_operator_index_const") }}
@cython.final @cython.final
cdef class Array: cdef class Array:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_array _gd_data cdef pandemonium_array _gd_data
@staticmethod @staticmethod
cdef inline Array new() cdef inline Array new()
@staticmethod @staticmethod
cdef inline Array from_ptr(const godot_array *_ptr) cdef inline Array from_ptr(const pandemonium_array *_ptr)
cdef inline Array operator_getslice(self, godot_int start, godot_int stop, godot_int step) cdef inline Array operator_getslice(self, pandemonium_int start, pandemonium_int stop, pandemonium_int step)
cdef inline bint operator_equal(self, Array other) cdef inline bint operator_equal(self, Array other)
cdef inline Array operator_add(self, Array items) cdef inline Array operator_add(self, Array items)
cdef inline operator_iadd(self, Array items) cdef inline operator_iadd(self, Array items)
@ -33,15 +33,15 @@ cdef class Array:
{% block python_defs %} {% block python_defs %}
def __init__(self, iterable=None): def __init__(self, iterable=None):
{{ force_mark_rendered("godot_array_new") }} {{ force_mark_rendered("pandemonium_array_new") }}
{{ force_mark_rendered("godot_array_duplicate") }} {{ force_mark_rendered("pandemonium_array_duplicate") }}
if not iterable: if not iterable:
gdapi10.godot_array_new(&self._gd_data) gdapi10.pandemonium_array_new(&self._gd_data)
elif isinstance(iterable, Array): elif isinstance(iterable, Array):
self._gd_data = gdapi11.godot_array_duplicate(&(<Array>iterable)._gd_data, False) self._gd_data = gdapi11.pandemonium_array_duplicate(&(<Array>iterable)._gd_data, False)
# TODO: handle Pool*Array # TODO: handle Pool*Array
else: else:
gdapi10.godot_array_new(&self._gd_data) gdapi10.pandemonium_array_new(&self._gd_data)
for x in iterable: for x in iterable:
self.append(x) self.append(x)
@ -49,44 +49,44 @@ cdef class Array:
cdef inline Array new(): cdef inline Array new():
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef Array ret = Array.__new__(Array) cdef Array ret = Array.__new__(Array)
gdapi10.godot_array_new(&ret._gd_data) gdapi10.pandemonium_array_new(&ret._gd_data)
return ret return ret
@staticmethod @staticmethod
cdef inline Array from_ptr(const godot_array *_ptr): cdef inline Array from_ptr(const pandemonium_array *_ptr):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef Array ret = Array.__new__(Array) cdef Array ret = Array.__new__(Array)
# `godot_array` is a cheap structure pointing on a refcounted vector # `pandemonium_array` is a cheap structure pointing on a refcounted vector
# of variants. Unlike it name could let think, `godot_array_new_copy` # of variants. Unlike it name could let think, `pandemonium_array_new_copy`
# only increment the refcount of the underlying structure. # only increment the refcount of the underlying structure.
{{ force_mark_rendered("godot_array_new_copy") }} {{ force_mark_rendered("pandemonium_array_new_copy") }}
gdapi10.godot_array_new_copy(&ret._gd_data, _ptr) gdapi10.pandemonium_array_new_copy(&ret._gd_data, _ptr)
return ret return ret
def __dealloc__(self): def __dealloc__(self):
# /!\ if `__init__` is skipped, `_gd_data` must be initialized by # /!\ if `__init__` is skipped, `_gd_data` must be initialized by
# hand otherwise we will get a segfault here # hand otherwise we will get a segfault here
{{ force_mark_rendered("godot_array_destroy") }} {{ force_mark_rendered("pandemonium_array_destroy") }}
gdapi10.godot_array_destroy(&self._gd_data) gdapi10.pandemonium_array_destroy(&self._gd_data)
def __repr__(self): def __repr__(self):
return f"<{type(self).__name__}([{', '.join([repr(x) for x in self])}])>" return f"<{type(self).__name__}([{', '.join([repr(x) for x in self])}])>"
# Operators # Operators
cdef inline Array operator_getslice(self, godot_int start, godot_int stop, godot_int step): cdef inline Array operator_getslice(self, pandemonium_int start, pandemonium_int stop, pandemonium_int step):
{{ force_mark_rendered("godot_array_slice") }} {{ force_mark_rendered("pandemonium_array_slice") }}
cdef Array ret = Array.__new__(Array) cdef Array ret = Array.__new__(Array)
ret._gd_data = gdapi12.godot_array_slice(&self._gd_data, start, stop, step, False) ret._gd_data = gdapi12.pandemonium_array_slice(&self._gd_data, start, stop, step, False)
return ret return ret
# TODO: support slice # TODO: support slice
def __getitem__(self, index): def __getitem__(self, index):
{{ force_mark_rendered("godot_array_operator_index") }} {{ force_mark_rendered("pandemonium_array_operator_index") }}
cdef godot_int size = self.size() cdef pandemonium_int size = self.size()
cdef godot_int start cdef pandemonium_int start
cdef godot_int stop cdef pandemonium_int stop
cdef godot_int step cdef pandemonium_int step
if isinstance(index, slice): if isinstance(index, slice):
step = index.step if index.step is not None else 1 step = index.step if index.step is not None else 1
@ -105,28 +105,28 @@ cdef class Array:
if index < 0 or index >= size: if index < 0 or index >= size:
raise IndexError("list index out of range") raise IndexError("list index out of range")
cdef godot_variant *p_ret = gdapi10.godot_array_operator_index(&self._gd_data, index) cdef pandemonium_variant *p_ret = gdapi10.pandemonium_array_operator_index(&self._gd_data, index)
return godot_variant_to_pyobj(p_ret) return pandemonium_variant_to_pyobj(p_ret)
# TODO: support slice # TODO: support slice
def __setitem__(self, godot_int index, object value): def __setitem__(self, pandemonium_int index, object value):
cdef godot_int size = self.size() cdef pandemonium_int size = self.size()
index = size + index if index < 0 else index index = size + index if index < 0 else index
if abs(index) >= size: if abs(index) >= size:
raise IndexError("list index out of range") raise IndexError("list index out of range")
cdef godot_variant *p_ret = gdapi10.godot_array_operator_index(&self._gd_data, index) cdef pandemonium_variant *p_ret = gdapi10.pandemonium_array_operator_index(&self._gd_data, index)
gdapi10.godot_variant_destroy(p_ret) gdapi10.pandemonium_variant_destroy(p_ret)
pyobj_to_godot_variant(value, p_ret) pyobj_to_pandemonium_variant(value, p_ret)
# TODO: support slice # TODO: support slice
def __delitem__(self, godot_int index): def __delitem__(self, pandemonium_int index):
cdef godot_int size = self.size() cdef pandemonium_int size = self.size()
index = size + index if index < 0 else index index = size + index if index < 0 else index
if abs(index) >= size: if abs(index) >= size:
raise IndexError("list index out of range") raise IndexError("list index out of range")
gdapi10.godot_array_remove(&self._gd_data, index) gdapi10.pandemonium_array_remove(&self._gd_data, index)
def __iter__(self): def __iter__(self):
# TODO: mid iteration mutation should throw exception ? # TODO: mid iteration mutation should throw exception ?
@ -141,15 +141,15 @@ cdef class Array:
return self.duplicate(True) return self.duplicate(True)
cdef inline bint operator_equal(self, Array other): cdef inline bint operator_equal(self, Array other):
# TODO `godot_array_operator_equal` is missing in gdapi, submit a PR ? # TODO `pandemonium_array_operator_equal` is missing in gdapi, submit a PR ?
cdef godot_int size = self.size() cdef pandemonium_int size = self.size()
if size != other.size(): if size != other.size():
return False return False
cdef int i cdef int i
for i in range(size): for i in range(size):
if not gdapi10.godot_variant_operator_equal( if not gdapi10.pandemonium_variant_operator_equal(
gdapi10.godot_array_operator_index(&self._gd_data, i), gdapi10.pandemonium_array_operator_index(&self._gd_data, i),
gdapi10.godot_array_operator_index(&other._gd_data, i) gdapi10.pandemonium_array_operator_index(&other._gd_data, i)
): ):
return False return False
return True return True
@ -167,9 +167,9 @@ cdef class Array:
return True return True
cdef inline operator_iadd(self, Array items): cdef inline operator_iadd(self, Array items):
cdef godot_int self_size = self.size() cdef pandemonium_int self_size = self.size()
cdef godot_int items_size = items.size() cdef pandemonium_int items_size = items.size()
gdapi10.godot_array_resize(&self._gd_data, self_size + items_size) gdapi10.pandemonium_array_resize(&self._gd_data, self_size + items_size)
cdef int i cdef int i
for i in range(items_size): for i in range(items_size):
Array.set(self, self_size + i, items.get(i)) Array.set(self, self_size + i, items.get(i))
@ -184,10 +184,10 @@ cdef class Array:
return self return self
cdef inline Array operator_add(self, Array items): cdef inline Array operator_add(self, Array items):
cdef godot_int self_size = self.size() cdef pandemonium_int self_size = self.size()
cdef godot_int items_size = items.size() cdef pandemonium_int items_size = items.size()
cdef Array ret = Array.new() cdef Array ret = Array.new()
gdapi10.godot_array_resize(&ret._gd_data, self_size + items_size) gdapi10.pandemonium_array_resize(&ret._gd_data, self_size + items_size)
cdef int i cdef int i
for i in range(self_size): for i in range(self_size):
Array.set(ret, i, self.get(i)) Array.set(ret, i, self.get(i))
@ -234,11 +234,11 @@ cdef class Array:
{{ render_method("rfind") | indent }} {{ render_method("rfind") | indent }}
{{ render_method("sort") | indent }} {{ render_method("sort") | indent }}
{#- TODO: opaque object as param is not supported #} {#- TODO: opaque object as param is not supported #}
{{- force_mark_rendered("godot_array_sort_custom") }} {{- force_mark_rendered("pandemonium_array_sort_custom") }}
{#- {{ render_method("sort_custom") | indent }} #} {#- {{ render_method("sort_custom") | indent }} #}
{{ render_method("bsearch") | indent }} {{ render_method("bsearch") | indent }}
{#- TODO: opaque object as param is not supported #} {#- TODO: opaque object as param is not supported #}
{{- force_mark_rendered("godot_array_bsearch_custom") }} {{- force_mark_rendered("pandemonium_array_bsearch_custom") }}
{#- {{ render_method("bsearch_custom") | indent }} #} {#- {{ render_method("bsearch_custom") | indent }} #}
{{ render_method("max") | indent }} {{ render_method("max") | indent }}
{{ render_method("min") | indent }} {{ render_method("min") | indent }}

View File

@ -4,14 +4,14 @@
cdef inline Basis Basis_multiply_vector(Basis self, Basis b): cdef inline Basis Basis_multiply_vector(Basis self, Basis b):
cdef Basis ret = Basis.__new__(Basis) cdef Basis ret = Basis.__new__(Basis)
{{ force_mark_rendered("godot_basis_operator_multiply_vector") }} {{ force_mark_rendered("pandemonium_basis_operator_multiply_vector") }}
ret._gd_data = gdapi10.godot_basis_operator_multiply_vector(&self._gd_data, &b._gd_data) ret._gd_data = gdapi10.pandemonium_basis_operator_multiply_vector(&self._gd_data, &b._gd_data)
return ret return ret
cdef inline Basis Basis_multiply_scalar(Basis self, godot_real b): cdef inline Basis Basis_multiply_scalar(Basis self, pandemonium_real b):
cdef Basis ret = Basis.__new__(Basis) cdef Basis ret = Basis.__new__(Basis)
{{ force_mark_rendered("godot_basis_operator_multiply_scalar") }} {{ force_mark_rendered("pandemonium_basis_operator_multiply_scalar") }}
ret._gd_data = gdapi10.godot_basis_operator_multiply_scalar(&self._gd_data, b) ret._gd_data = gdapi10.pandemonium_basis_operator_multiply_scalar(&self._gd_data, b)
return ret return ret
{%- endblock %} {%- endblock %}
@ -19,27 +19,27 @@ cdef inline Basis Basis_multiply_scalar(Basis self, godot_real b):
@cython.final @cython.final
cdef class Basis: cdef class Basis:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_basis _gd_data cdef pandemonium_basis _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, Vector3 x not None=Vector3.RIGHT, Vector3 y not None=Vector3.UP, Vector3 z not None=Vector3.BACK): def __init__(self, Vector3 x not None=Vector3.RIGHT, Vector3 y not None=Vector3.UP, Vector3 z not None=Vector3.BACK):
{{ force_mark_rendered("godot_basis_new") }} {# We always use the `with_rows` version #} {{ force_mark_rendered("pandemonium_basis_new") }} {# We always use the `with_rows` version #}
{{ force_mark_rendered("godot_basis_new_with_rows") }} {{ force_mark_rendered("pandemonium_basis_new_with_rows") }}
gdapi10.godot_basis_new_with_rows(&self._gd_data, &(<Vector3>x)._gd_data, &(<Vector3>y)._gd_data, &(<Vector3>z)._gd_data) gdapi10.pandemonium_basis_new_with_rows(&self._gd_data, &(<Vector3>x)._gd_data, &(<Vector3>y)._gd_data, &(<Vector3>z)._gd_data)
@staticmethod @staticmethod
def from_euler(from_): def from_euler(from_):
cdef Basis ret = Basis.__new__(Basis) cdef Basis ret = Basis.__new__(Basis)
try: try:
{{ force_mark_rendered("godot_basis_new_with_euler") }} {{ force_mark_rendered("pandemonium_basis_new_with_euler") }}
gdapi10.godot_basis_new_with_euler(&ret._gd_data, &(<Vector3?>from_)._gd_data) gdapi10.pandemonium_basis_new_with_euler(&ret._gd_data, &(<Vector3?>from_)._gd_data)
return ret return ret
except TypeError: except TypeError:
pass pass
try: try:
{{ force_mark_rendered("godot_basis_new_with_euler_quat") }} {{ force_mark_rendered("pandemonium_basis_new_with_euler_quat") }}
gdapi10.godot_basis_new_with_euler_quat(&ret._gd_data, &(<Quat?>from_)._gd_data) gdapi10.pandemonium_basis_new_with_euler_quat(&ret._gd_data, &(<Quat?>from_)._gd_data)
return ret return ret
except TypeError: except TypeError:
raise TypeError('`from_` must be Quat or Vector3') raise TypeError('`from_` must be Quat or Vector3')
@ -47,8 +47,8 @@ cdef class Basis:
@staticmethod @staticmethod
def from_axis_angle(Vector3 axis not None, phi): def from_axis_angle(Vector3 axis not None, phi):
cdef Basis ret = Basis.__new__(Basis) cdef Basis ret = Basis.__new__(Basis)
{{ force_mark_rendered("godot_basis_new_with_axis_and_angle") }} {{ force_mark_rendered("pandemonium_basis_new_with_axis_and_angle") }}
gdapi10.godot_basis_new_with_axis_and_angle(&ret._gd_data, &axis._gd_data, phi) gdapi10.pandemonium_basis_new_with_axis_and_angle(&ret._gd_data, &axis._gd_data, phi)
return ret return ret
def __repr__(self): def __repr__(self):
@ -57,38 +57,38 @@ cdef class Basis:
@property @property
def x(Basis self) -> Vector3: def x(Basis self) -> Vector3:
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_basis_get_axis") }} {{ force_mark_rendered("pandemonium_basis_get_axis") }}
ret._gd_data = gdapi10.godot_basis_get_axis(&self._gd_data, 0) ret._gd_data = gdapi10.pandemonium_basis_get_axis(&self._gd_data, 0)
return ret return ret
@x.setter @x.setter
def x(Basis self, Vector3 val not None) -> None: def x(Basis self, Vector3 val not None) -> None:
{{ force_mark_rendered("godot_basis_set_axis") }} {{ force_mark_rendered("pandemonium_basis_set_axis") }}
gdapi10.godot_basis_set_axis(&self._gd_data, 0, &val._gd_data) gdapi10.pandemonium_basis_set_axis(&self._gd_data, 0, &val._gd_data)
@property @property
def y(Basis self) -> Vector3: def y(Basis self) -> Vector3:
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_basis_get_axis") }} {{ force_mark_rendered("pandemonium_basis_get_axis") }}
ret._gd_data = gdapi10.godot_basis_get_axis(&self._gd_data, 1) ret._gd_data = gdapi10.pandemonium_basis_get_axis(&self._gd_data, 1)
return ret return ret
@y.setter @y.setter
def y(Basis self, Vector3 val not None) -> None: def y(Basis self, Vector3 val not None) -> None:
{{ force_mark_rendered("godot_basis_set_axis") }} {{ force_mark_rendered("pandemonium_basis_set_axis") }}
gdapi10.godot_basis_set_axis(&self._gd_data, 1, &val._gd_data) gdapi10.pandemonium_basis_set_axis(&self._gd_data, 1, &val._gd_data)
@property @property
def z(Basis self) -> Vector3: def z(Basis self) -> Vector3:
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_basis_get_axis") }} {{ force_mark_rendered("pandemonium_basis_get_axis") }}
ret._gd_data = gdapi10.godot_basis_get_axis(&self._gd_data, 2) ret._gd_data = gdapi10.pandemonium_basis_get_axis(&self._gd_data, 2)
return ret return ret
@z.setter @z.setter
def z(Basis self, Vector3 val not None) -> None: def z(Basis self, Vector3 val not None) -> None:
{{ force_mark_rendered("godot_basis_set_axis") }} {{ force_mark_rendered("pandemonium_basis_set_axis") }}
gdapi10.godot_basis_set_axis(&self._gd_data, 2, &val._gd_data) gdapi10.pandemonium_basis_set_axis(&self._gd_data, 2, &val._gd_data)
{{ render_operator_eq() | indent }} {{ render_operator_eq() | indent }}
{{ render_operator_ne() | indent }} {{ render_operator_ne() | indent }}

View File

@ -8,17 +8,17 @@ from libc.stdint cimport uint8_t
@cython.final @cython.final
cdef class Color: cdef class Color:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_color _gd_data cdef pandemonium_color _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, godot_real r=0, godot_real g=0, godot_real b=0, a=None): def __init__(self, pandemonium_real r=0, pandemonium_real g=0, pandemonium_real b=0, a=None):
if a is None: if a is None:
{{ force_mark_rendered("godot_color_new_rgb")}} {{ force_mark_rendered("pandemonium_color_new_rgb")}}
gdapi10.godot_color_new_rgb(&self._gd_data, r, g, b) gdapi10.pandemonium_color_new_rgb(&self._gd_data, r, g, b)
else: else:
{{ force_mark_rendered("godot_color_new_rgba")}} {{ force_mark_rendered("pandemonium_color_new_rgba")}}
gdapi10.godot_color_new_rgba(&self._gd_data, r, g, b, a) gdapi10.pandemonium_color_new_rgba(&self._gd_data, r, g, b, a)
def __repr__(self): def __repr__(self):
return f"<Color(r={self.r}, g={self.g}, b={self.b}, a={self.a})>" return f"<Color(r={self.r}, g={self.g}, b={self.b}, a={self.a})>"
@ -27,7 +27,7 @@ cdef class Color:
def from_resource(Resource resource not None): def from_resource(Resource resource not None):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef RID ret = RID.__new__(RID) cdef RID ret = RID.__new__(RID)
gdapi10.godot_rid_new_with_resource(&ret._gd_data, resource._gd_ptr) gdapi10.pandemonium_rid_new_with_resource(&ret._gd_data, resource._gd_ptr)
return ret return ret
@property @property

View File

@ -4,18 +4,18 @@
{% endblock -%} {% endblock -%}
{# We can't do const in Python #} {# We can't do const in Python #}
{{ force_mark_rendered("godot_dictionary_operator_index_const") }} {{ force_mark_rendered("pandemonium_dictionary_operator_index_const") }}
@cython.final @cython.final
cdef class Dictionary: cdef class Dictionary:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_dictionary _gd_data cdef pandemonium_dictionary _gd_data
@staticmethod @staticmethod
cdef inline Dictionary new() cdef inline Dictionary new()
@staticmethod @staticmethod
cdef inline Dictionary from_ptr(const godot_dictionary *_ptr) cdef inline Dictionary from_ptr(const pandemonium_dictionary *_ptr)
cdef inline operator_update(self, Dictionary items) cdef inline operator_update(self, Dictionary items)
cdef inline bint operator_equal(self, Dictionary other) cdef inline bint operator_equal(self, Dictionary other)
@ -23,18 +23,18 @@ cdef class Dictionary:
{% block python_defs %} {% block python_defs %}
def __init__(self, iterable=None): def __init__(self, iterable=None):
{{ force_mark_rendered("godot_dictionary_new") }} {{ force_mark_rendered("pandemonium_dictionary_new") }}
if not iterable: if not iterable:
gdapi10.godot_dictionary_new(&self._gd_data) gdapi10.pandemonium_dictionary_new(&self._gd_data)
elif isinstance(iterable, Dictionary): elif isinstance(iterable, Dictionary):
self._gd_data = gdapi12.godot_dictionary_duplicate(&(<Dictionary>iterable)._gd_data, False) self._gd_data = gdapi12.pandemonium_dictionary_duplicate(&(<Dictionary>iterable)._gd_data, False)
# TODO: handle Pool*Array # TODO: handle Pool*Array
elif isinstance(iterable, dict): elif isinstance(iterable, dict):
gdapi10.godot_dictionary_new(&self._gd_data) gdapi10.pandemonium_dictionary_new(&self._gd_data)
for k, v in iterable.items(): for k, v in iterable.items():
self[k] = v self[k] = v
else: else:
gdapi10.godot_dictionary_new(&self._gd_data) gdapi10.pandemonium_dictionary_new(&self._gd_data)
try: try:
for k, v in iterable: for k, v in iterable:
self[k] = v self[k] = v
@ -42,27 +42,27 @@ cdef class Dictionary:
raise ValueError("dictionary update sequence element has length 1; 2 is required") raise ValueError("dictionary update sequence element has length 1; 2 is required")
def __dealloc__(self): def __dealloc__(self):
{{ force_mark_rendered("godot_dictionary_destroy") }} {{ force_mark_rendered("pandemonium_dictionary_destroy") }}
# /!\ if `__init__` is skipped, `_gd_data` must be initialized by # /!\ if `__init__` is skipped, `_gd_data` must be initialized by
# hand otherwise we will get a segfault here # hand otherwise we will get a segfault here
gdapi10.godot_dictionary_destroy(&self._gd_data) gdapi10.pandemonium_dictionary_destroy(&self._gd_data)
@staticmethod @staticmethod
cdef inline Dictionary new(): cdef inline Dictionary new():
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef Dictionary ret = Dictionary.__new__(Dictionary) cdef Dictionary ret = Dictionary.__new__(Dictionary)
gdapi10.godot_dictionary_new(&ret._gd_data) gdapi10.pandemonium_dictionary_new(&ret._gd_data)
return ret return ret
@staticmethod @staticmethod
cdef inline Dictionary from_ptr(const godot_dictionary *_ptr): cdef inline Dictionary from_ptr(const pandemonium_dictionary *_ptr):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef Dictionary ret = Dictionary.__new__(Dictionary) cdef Dictionary ret = Dictionary.__new__(Dictionary)
# `godot_dictionary` is a cheap structure pointing on a refcounted hashmap # `pandemonium_dictionary` is a cheap structure pointing on a refcounted hashmap
# of variants. Unlike it name could let think, `godot_dictionary_new_copy` # of variants. Unlike it name could let think, `pandemonium_dictionary_new_copy`
# only increment the refcount of the underlying structure. # only increment the refcount of the underlying structure.
{{ force_mark_rendered("godot_dictionary_new_copy") }} {{ force_mark_rendered("pandemonium_dictionary_new_copy") }}
gdapi10.godot_dictionary_new_copy(&ret._gd_data, _ptr) gdapi10.pandemonium_dictionary_new_copy(&ret._gd_data, _ptr)
return ret return ret
def __repr__(self): def __repr__(self):
@ -76,38 +76,38 @@ cdef class Dictionary:
return f"<Dictionary({repr_dict})>" return f"<Dictionary({repr_dict})>"
def __getitem__(self, object key): def __getitem__(self, object key):
{{ force_mark_rendered("godot_dictionary_operator_index") }} {{ force_mark_rendered("pandemonium_dictionary_operator_index") }}
cdef godot_variant var_key cdef pandemonium_variant var_key
if not pyobj_to_godot_variant(key, &var_key): if not pyobj_to_pandemonium_variant(key, &var_key):
raise TypeError(f"Cannot convert `{key!r}` to Godot Variant") raise TypeError(f"Cannot convert `{key!r}` to Godot Variant")
cdef godot_variant *p_var_ret = gdapi10.godot_dictionary_operator_index(&self._gd_data, &var_key) cdef pandemonium_variant *p_var_ret = gdapi10.pandemonium_dictionary_operator_index(&self._gd_data, &var_key)
gdapi10.godot_variant_destroy(&var_key) gdapi10.pandemonium_variant_destroy(&var_key)
if p_var_ret == NULL: if p_var_ret == NULL:
raise KeyError(key) raise KeyError(key)
else: else:
return godot_variant_to_pyobj(p_var_ret) return pandemonium_variant_to_pyobj(p_var_ret)
{{ render_method("set", py_name="__setitem__") | indent }} {{ render_method("set", py_name="__setitem__") | indent }}
def __delitem__(self, object key): def __delitem__(self, object key):
{{ force_mark_rendered("godot_dictionary_erase_with_return") }} {{ force_mark_rendered("pandemonium_dictionary_erase_with_return") }}
cdef godot_variant var_key cdef pandemonium_variant var_key
if not pyobj_to_godot_variant(key, &var_key): if not pyobj_to_pandemonium_variant(key, &var_key):
raise TypeError(f"Cannot convert `{key!r}` to Godot Variant") raise TypeError(f"Cannot convert `{key!r}` to Godot Variant")
cdef godot_bool ret = gdapi11.godot_dictionary_erase_with_return(&self._gd_data, &var_key) cdef pandemonium_bool ret = gdapi11.pandemonium_dictionary_erase_with_return(&self._gd_data, &var_key)
gdapi10.godot_variant_destroy(&var_key) gdapi10.pandemonium_variant_destroy(&var_key)
if not ret: if not ret:
raise KeyError(key) raise KeyError(key)
def __iter__(self): def __iter__(self):
{{ force_mark_rendered("godot_dictionary_next") }} {{ force_mark_rendered("pandemonium_dictionary_next") }}
cdef godot_variant *p_key = NULL cdef pandemonium_variant *p_key = NULL
# TODO: mid iteration mutation should throw exception ? # TODO: mid iteration mutation should throw exception ?
while True: while True:
p_key = gdapi10.godot_dictionary_next(&self._gd_data, p_key) p_key = gdapi10.pandemonium_dictionary_next(&self._gd_data, p_key)
if p_key == NULL: if p_key == NULL:
return return
yield godot_variant_to_pyobj(p_key) yield pandemonium_variant_to_pyobj(p_key)
def __copy__(self): def __copy__(self):
return self.duplicate(False) return self.duplicate(False)
@ -116,32 +116,32 @@ cdef class Dictionary:
return self.duplicate(True) return self.duplicate(True)
def get(self, object key, object default=None): def get(self, object key, object default=None):
{{ force_mark_rendered("godot_dictionary_get") }} {{ force_mark_rendered("pandemonium_dictionary_get") }}
{{ force_mark_rendered("godot_dictionary_get_with_default") }} {{ force_mark_rendered("pandemonium_dictionary_get_with_default") }}
cdef godot_variant var_key cdef pandemonium_variant var_key
pyobj_to_godot_variant(key, &var_key) pyobj_to_pandemonium_variant(key, &var_key)
cdef godot_variant var_ret cdef pandemonium_variant var_ret
cdef godot_variant var_default cdef pandemonium_variant var_default
if default is not None: if default is not None:
pyobj_to_godot_variant(default, &var_default) pyobj_to_pandemonium_variant(default, &var_default)
var_ret = gdapi11.godot_dictionary_get_with_default(&self._gd_data, &var_key, &var_default) var_ret = gdapi11.pandemonium_dictionary_get_with_default(&self._gd_data, &var_key, &var_default)
gdapi10.godot_variant_destroy(&var_default) gdapi10.pandemonium_variant_destroy(&var_default)
else: else:
var_ret = gdapi10.godot_dictionary_get(&self._gd_data, &var_key) var_ret = gdapi10.pandemonium_dictionary_get(&self._gd_data, &var_key)
gdapi10.godot_variant_destroy(&var_key) gdapi10.pandemonium_variant_destroy(&var_key)
cdef object ret = godot_variant_to_pyobj(&var_ret) cdef object ret = pandemonium_variant_to_pyobj(&var_ret)
gdapi10.godot_variant_destroy(&var_ret) gdapi10.pandemonium_variant_destroy(&var_ret)
return ret return ret
cdef inline operator_update(self, Dictionary items): cdef inline operator_update(self, Dictionary items):
cdef godot_variant *p_value cdef pandemonium_variant *p_value
cdef godot_variant *p_key = NULL cdef pandemonium_variant *p_key = NULL
while True: while True:
p_key = gdapi10.godot_dictionary_next(&items._gd_data, p_key) p_key = gdapi10.pandemonium_dictionary_next(&items._gd_data, p_key)
if p_key == NULL: if p_key == NULL:
break break
p_value = gdapi10.godot_dictionary_operator_index(&items._gd_data, p_key) p_value = gdapi10.pandemonium_dictionary_operator_index(&items._gd_data, p_key)
gdapi10.godot_dictionary_set(&self._gd_data, p_key, p_value) gdapi10.pandemonium_dictionary_set(&self._gd_data, p_key, p_value)
return self return self
def update(self, other): def update(self, other):
@ -156,20 +156,20 @@ cdef class Dictionary:
raise TypeError("other must be godot.Dictionary or dict") raise TypeError("other must be godot.Dictionary or dict")
def items(self): def items(self):
cdef godot_variant *p_key = NULL cdef pandemonium_variant *p_key = NULL
cdef godot_variant *p_value cdef pandemonium_variant *p_value
# TODO: mid iteration mutation should throw exception ? # TODO: mid iteration mutation should throw exception ?
while True: while True:
p_key = gdapi10.godot_dictionary_next(&self._gd_data, p_key) p_key = gdapi10.pandemonium_dictionary_next(&self._gd_data, p_key)
if p_key == NULL: if p_key == NULL:
return return
p_value = gdapi10.godot_dictionary_operator_index(&self._gd_data, p_key) p_value = gdapi10.pandemonium_dictionary_operator_index(&self._gd_data, p_key)
yield godot_variant_to_pyobj(p_key), godot_variant_to_pyobj(p_value) yield pandemonium_variant_to_pyobj(p_key), pandemonium_variant_to_pyobj(p_value)
cdef inline bint operator_equal(self, Dictionary other): cdef inline bint operator_equal(self, Dictionary other):
if other is None: if other is None:
return False return False
cdef godot_int size = self.size() cdef pandemonium_int size = self.size()
if size != other.size(): if size != other.size():
return False return False
# TODO: gdnative should provide a function to do that # TODO: gdnative should provide a function to do that
@ -177,7 +177,7 @@ cdef class Dictionary:
def __eq__(self, other): def __eq__(self, other):
{# see https://github.com/godotengine/godot/issues/27615 #} {# see https://github.com/godotengine/godot/issues/27615 #}
{{ force_mark_rendered("godot_dictionary_operator_equal") }} {{ force_mark_rendered("pandemonium_dictionary_operator_equal") }}
try: try:
return Dictionary.operator_equal(self, <Dictionary?>other) return Dictionary.operator_equal(self, <Dictionary?>other)
except TypeError: except TypeError:

View File

@ -4,99 +4,99 @@
from libc.stdint cimport int8_t from libc.stdint cimport int8_t
{% endblock -%} {% endblock -%}
{# godot_char_string is not really a bultin type...#} {# pandemonium_char_string is not really a bultin type...#}
{{ force_mark_rendered("godot_char_string_destroy") }} {{ force_mark_rendered("pandemonium_char_string_destroy") }}
{{ force_mark_rendered("godot_char_string_get_data") }} {{ force_mark_rendered("pandemonium_char_string_get_data") }}
{{ force_mark_rendered("godot_char_string_length") }} {{ force_mark_rendered("pandemonium_char_string_length") }}
{# Those methods are present in gdnative_api.json but not in the Godot documentation... #} {# Those methods are present in gdnative_api.json but not in the Godot documentation... #}
{{ force_mark_rendered("godot_string_ascii") }} {{ force_mark_rendered("pandemonium_string_ascii") }}
{{ force_mark_rendered("godot_string_ascii_extended") }} {{ force_mark_rendered("pandemonium_string_ascii_extended") }}
{{ force_mark_rendered("godot_string_begins_with_char_array") }} {{ force_mark_rendered("pandemonium_string_begins_with_char_array") }}
{{ force_mark_rendered("godot_string_c_escape_multiline") }} {{ force_mark_rendered("pandemonium_string_c_escape_multiline") }}
{{ force_mark_rendered("godot_string_camelcase_to_underscore") }} {{ force_mark_rendered("pandemonium_string_camelcase_to_underscore") }}
{{ force_mark_rendered("godot_string_camelcase_to_underscore_lowercased") }} {{ force_mark_rendered("pandemonium_string_camelcase_to_underscore_lowercased") }}
{{ force_mark_rendered("godot_string_char_lowercase") }} {{ force_mark_rendered("pandemonium_string_char_lowercase") }}
{{ force_mark_rendered("godot_string_char_to_double") }} {{ force_mark_rendered("pandemonium_string_char_to_double") }}
{{ force_mark_rendered("godot_string_char_to_int") }} {{ force_mark_rendered("pandemonium_string_char_to_int") }}
{{ force_mark_rendered("godot_string_char_to_int64_with_len") }} {{ force_mark_rendered("pandemonium_string_char_to_int64_with_len") }}
{{ force_mark_rendered("godot_string_char_to_int_with_len") }} {{ force_mark_rendered("pandemonium_string_char_to_int_with_len") }}
{{ force_mark_rendered("godot_string_char_uppercase") }} {{ force_mark_rendered("pandemonium_string_char_uppercase") }}
{{ force_mark_rendered("godot_string_chars_to_utf8") }} {{ force_mark_rendered("pandemonium_string_chars_to_utf8") }}
{{ force_mark_rendered("godot_string_chars_to_utf8_with_len") }} {{ force_mark_rendered("pandemonium_string_chars_to_utf8_with_len") }}
{{ force_mark_rendered("godot_string_chr") }} {{ force_mark_rendered("pandemonium_string_chr") }}
{{ force_mark_rendered("godot_string_find_from") }} {{ force_mark_rendered("pandemonium_string_find_from") }}
{{ force_mark_rendered("godot_string_findmk") }} {{ force_mark_rendered("pandemonium_string_findmk") }}
{{ force_mark_rendered("godot_string_findmk_from") }} {{ force_mark_rendered("pandemonium_string_findmk_from") }}
{{ force_mark_rendered("godot_string_findmk_from_in_place") }} {{ force_mark_rendered("pandemonium_string_findmk_from_in_place") }}
{{ force_mark_rendered("godot_string_findn_from") }} {{ force_mark_rendered("pandemonium_string_findn_from") }}
{{ force_mark_rendered("godot_string_format_with_custom_placeholder") }} {{ force_mark_rendered("pandemonium_string_format_with_custom_placeholder") }}
{{ force_mark_rendered("godot_string_get_slice") }} {{ force_mark_rendered("pandemonium_string_get_slice") }}
{{ force_mark_rendered("godot_string_get_slice_count") }} {{ force_mark_rendered("pandemonium_string_get_slice_count") }}
{{ force_mark_rendered("godot_string_get_slicec") }} {{ force_mark_rendered("pandemonium_string_get_slicec") }}
{{ force_mark_rendered("godot_string_hash64") }} {{ force_mark_rendered("pandemonium_string_hash64") }}
{{ force_mark_rendered("godot_string_hash_chars") }} {{ force_mark_rendered("pandemonium_string_hash_chars") }}
{{ force_mark_rendered("godot_string_hash_chars_with_len") }} {{ force_mark_rendered("pandemonium_string_hash_chars_with_len") }}
{{ force_mark_rendered("godot_string_hash_utf8_chars") }} {{ force_mark_rendered("pandemonium_string_hash_utf8_chars") }}
{{ force_mark_rendered("godot_string_hash_utf8_chars_with_len") }} {{ force_mark_rendered("pandemonium_string_hash_utf8_chars_with_len") }}
{{ force_mark_rendered("godot_string_hex_encode_buffer") }} {{ force_mark_rendered("pandemonium_string_hex_encode_buffer") }}
{{ force_mark_rendered("godot_string_hex_to_int64") }} {{ force_mark_rendered("pandemonium_string_hex_to_int64") }}
{{ force_mark_rendered("godot_string_hex_to_int64_with_prefix") }} {{ force_mark_rendered("pandemonium_string_hex_to_int64_with_prefix") }}
{{ force_mark_rendered("godot_string_hex_to_int_without_prefix") }} {{ force_mark_rendered("pandemonium_string_hex_to_int_without_prefix") }}
{{ force_mark_rendered("godot_string_is_numeric") }} {{ force_mark_rendered("pandemonium_string_is_numeric") }}
{{ force_mark_rendered("godot_string_is_resource_file") }} {{ force_mark_rendered("pandemonium_string_is_resource_file") }}
{{ force_mark_rendered("godot_string_lpad") }} {{ force_mark_rendered("pandemonium_string_lpad") }}
{{ force_mark_rendered("godot_string_lpad_with_custom_character") }} {{ force_mark_rendered("pandemonium_string_lpad_with_custom_character") }}
{{ force_mark_rendered("godot_string_md5") }} {{ force_mark_rendered("pandemonium_string_md5") }}
{{ force_mark_rendered("godot_string_name_destroy") }} {{ force_mark_rendered("pandemonium_string_name_destroy") }}
{{ force_mark_rendered("godot_string_name_get_data_unique_pointer") }} {{ force_mark_rendered("pandemonium_string_name_get_data_unique_pointer") }}
{{ force_mark_rendered("godot_string_name_get_hash") }} {{ force_mark_rendered("pandemonium_string_name_get_hash") }}
{{ force_mark_rendered("godot_string_name_get_name") }} {{ force_mark_rendered("pandemonium_string_name_get_name") }}
{{ force_mark_rendered("godot_string_name_new") }} {{ force_mark_rendered("pandemonium_string_name_new") }}
{{ force_mark_rendered("godot_string_name_new_data") }} {{ force_mark_rendered("pandemonium_string_name_new_data") }}
{{ force_mark_rendered("godot_string_name_operator_equal") }} {{ force_mark_rendered("pandemonium_string_name_operator_equal") }}
{{ force_mark_rendered("godot_string_name_operator_less") }} {{ force_mark_rendered("pandemonium_string_name_operator_less") }}
{{ force_mark_rendered("godot_string_naturalnocasecmp_to") }} {{ force_mark_rendered("pandemonium_string_naturalnocasecmp_to") }}
{{ force_mark_rendered("godot_string_num") }} {{ force_mark_rendered("pandemonium_string_num") }}
{{ force_mark_rendered("godot_string_num_int64") }} {{ force_mark_rendered("pandemonium_string_num_int64") }}
{{ force_mark_rendered("godot_string_num_int64_capitalized") }} {{ force_mark_rendered("pandemonium_string_num_int64_capitalized") }}
{{ force_mark_rendered("godot_string_num_real") }} {{ force_mark_rendered("pandemonium_string_num_real") }}
{{ force_mark_rendered("godot_string_num_scientific") }} {{ force_mark_rendered("pandemonium_string_num_scientific") }}
{{ force_mark_rendered("godot_string_num_with_decimals") }} {{ force_mark_rendered("pandemonium_string_num_with_decimals") }}
{{ force_mark_rendered("godot_string_operator_index") }} {{ force_mark_rendered("pandemonium_string_operator_index") }}
{{ force_mark_rendered("godot_string_operator_index_const") }} {{ force_mark_rendered("pandemonium_string_operator_index_const") }}
{{ force_mark_rendered("godot_string_parse_utf8") }} {{ force_mark_rendered("pandemonium_string_parse_utf8") }}
{{ force_mark_rendered("godot_string_parse_utf8_with_len") }} {{ force_mark_rendered("pandemonium_string_parse_utf8_with_len") }}
{{ force_mark_rendered("godot_string_path_to") }} {{ force_mark_rendered("pandemonium_string_path_to") }}
{{ force_mark_rendered("godot_string_path_to_file") }} {{ force_mark_rendered("pandemonium_string_path_to_file") }}
{{ force_mark_rendered("godot_string_replace_first") }} {{ force_mark_rendered("pandemonium_string_replace_first") }}
{{ force_mark_rendered("godot_string_rfind_from") }} {{ force_mark_rendered("pandemonium_string_rfind_from") }}
{{ force_mark_rendered("godot_string_rfindn_from") }} {{ force_mark_rendered("pandemonium_string_rfindn_from") }}
{{ force_mark_rendered("godot_string_rpad") }} {{ force_mark_rendered("pandemonium_string_rpad") }}
{{ force_mark_rendered("godot_string_rpad_with_custom_character") }} {{ force_mark_rendered("pandemonium_string_rpad_with_custom_character") }}
{{ force_mark_rendered("godot_string_simplify_path") }} {{ force_mark_rendered("pandemonium_string_simplify_path") }}
{{ force_mark_rendered("godot_string_split_allow_empty") }} {{ force_mark_rendered("pandemonium_string_split_allow_empty") }}
{{ force_mark_rendered("godot_string_split_floats_allows_empty") }} {{ force_mark_rendered("pandemonium_string_split_floats_allows_empty") }}
{{ force_mark_rendered("godot_string_split_floats_mk") }} {{ force_mark_rendered("pandemonium_string_split_floats_mk") }}
{{ force_mark_rendered("godot_string_split_floats_mk_allows_empty") }} {{ force_mark_rendered("pandemonium_string_split_floats_mk_allows_empty") }}
{{ force_mark_rendered("godot_string_split_ints") }} {{ force_mark_rendered("pandemonium_string_split_ints") }}
{{ force_mark_rendered("godot_string_split_ints_allows_empty") }} {{ force_mark_rendered("pandemonium_string_split_ints_allows_empty") }}
{{ force_mark_rendered("godot_string_split_ints_mk") }} {{ force_mark_rendered("pandemonium_string_split_ints_mk") }}
{{ force_mark_rendered("godot_string_split_ints_mk_allows_empty") }} {{ force_mark_rendered("pandemonium_string_split_ints_mk_allows_empty") }}
{{ force_mark_rendered("godot_string_split_spaces") }} {{ force_mark_rendered("pandemonium_string_split_spaces") }}
{{ force_mark_rendered("godot_string_sprintf") }} {{ force_mark_rendered("pandemonium_string_sprintf") }}
{{ force_mark_rendered("godot_string_to_double") }} {{ force_mark_rendered("pandemonium_string_to_double") }}
{{ force_mark_rendered("godot_string_to_int64") }} {{ force_mark_rendered("pandemonium_string_to_int64") }}
{{ force_mark_rendered("godot_string_unicode_char_to_double") }} {{ force_mark_rendered("pandemonium_string_unicode_char_to_double") }}
{{ force_mark_rendered("godot_string_utf8") }} {{ force_mark_rendered("pandemonium_string_utf8") }}
{{ force_mark_rendered("godot_string_wchar_to_int") }} {{ force_mark_rendered("pandemonium_string_wchar_to_int") }}
{{ force_mark_rendered("godot_string_wide_str") }} {{ force_mark_rendered("pandemonium_string_wide_str") }}
{{ force_mark_rendered("godot_string_word_wrap") }} {{ force_mark_rendered("pandemonium_string_word_wrap") }}
{{ force_mark_rendered("godot_string_xml_escape_with_quotes") }} {{ force_mark_rendered("pandemonium_string_xml_escape_with_quotes") }}
@cython.final @cython.final
cdef class GDString: cdef class GDString:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_string _gd_data cdef pandemonium_string _gd_data
@staticmethod @staticmethod
cdef inline GDString new() cdef inline GDString new()
@ -105,54 +105,54 @@ cdef class GDString:
cdef inline GDString new_with_wide_string(wchar_t *content, int size) cdef inline GDString new_with_wide_string(wchar_t *content, int size)
@staticmethod @staticmethod
cdef inline GDString from_ptr(const godot_string *_ptr) cdef inline GDString from_ptr(const pandemonium_string *_ptr)
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, str pystr=None): def __init__(self, str pystr=None):
if not pystr: if not pystr:
{{ force_mark_rendered("godot_string_new" )}} {{ force_mark_rendered("pandemonium_string_new" )}}
gdapi10.godot_string_new(&self._gd_data) gdapi10.pandemonium_string_new(&self._gd_data)
else: else:
pyobj_to_godot_string(pystr, &self._gd_data) pyobj_to_pandemonium_string(pystr, &self._gd_data)
@staticmethod @staticmethod
cdef inline GDString new(): cdef inline GDString new():
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef GDString ret = GDString.__new__(GDString) cdef GDString ret = GDString.__new__(GDString)
gdapi10.godot_string_new(&ret._gd_data) gdapi10.pandemonium_string_new(&ret._gd_data)
return ret return ret
@staticmethod @staticmethod
cdef inline GDString new_with_wide_string(wchar_t *content, int size): cdef inline GDString new_with_wide_string(wchar_t *content, int size):
{{ force_mark_rendered("godot_string_new_with_wide_string") }} {{ force_mark_rendered("pandemonium_string_new_with_wide_string") }}
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef GDString ret = GDString.__new__(GDString) cdef GDString ret = GDString.__new__(GDString)
gdapi10.godot_string_new_with_wide_string(&ret._gd_data, content, size) gdapi10.pandemonium_string_new_with_wide_string(&ret._gd_data, content, size)
return ret return ret
@staticmethod @staticmethod
cdef inline GDString from_ptr(const godot_string *_ptr): cdef inline GDString from_ptr(const pandemonium_string *_ptr):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef GDString ret = GDString.__new__(GDString) cdef GDString ret = GDString.__new__(GDString)
# `godot_string` is a cheap structure pointing on a refcounted buffer. # `pandemonium_string` is a cheap structure pointing on a refcounted buffer.
# Unlike it name could let think, `godot_string_new_copy` only # Unlike it name could let think, `pandemonium_string_new_copy` only
# increments the refcount of the underlying structure. # increments the refcount of the underlying structure.
{{ force_mark_rendered("godot_string_new_copy") }} {{ force_mark_rendered("pandemonium_string_new_copy") }}
gdapi10.godot_string_new_copy(&ret._gd_data, _ptr) gdapi10.pandemonium_string_new_copy(&ret._gd_data, _ptr)
return ret return ret
def __dealloc__(GDString self): def __dealloc__(GDString self):
# /!\ if `__init__` is skipped, `_gd_data` must be initialized by # /!\ if `__init__` is skipped, `_gd_data` must be initialized by
# hand otherwise we will get a segfault here # hand otherwise we will get a segfault here
{{ force_mark_rendered("godot_string_destroy" )}} {{ force_mark_rendered("pandemonium_string_destroy" )}}
gdapi10.godot_string_destroy(&self._gd_data) gdapi10.pandemonium_string_destroy(&self._gd_data)
def __repr__(GDString self): def __repr__(GDString self):
return f"<GDString({str(self)!r})>" return f"<GDString({str(self)!r})>"
def __str__(GDString self): def __str__(GDString self):
return godot_string_to_pyobj(&self._gd_data) return pandemonium_string_to_pyobj(&self._gd_data)
{{ render_operator_eq() | indent }} {{ render_operator_eq() | indent }}
{{ render_operator_ne() | indent }} {{ render_operator_ne() | indent }}
@ -188,9 +188,9 @@ cdef class GDString:
@staticmethod @staticmethod
def humanize_size(size_t size): def humanize_size(size_t size):
{{ force_mark_rendered("godot_string_humanize_size") }} {{ force_mark_rendered("pandemonium_string_humanize_size") }}
cdef GDString __ret = GDString.__new__(GDString) cdef GDString __ret = GDString.__new__(GDString)
__ret._gd_data = gdapi10.godot_string_humanize_size(size) __ret._gd_data = gdapi10.pandemonium_string_humanize_size(size)
return __ret return __ret
{{ render_method("insert") | indent }} {{ render_method("insert") | indent }}

View File

@ -3,32 +3,32 @@
{%- block pyx_header %} {%- block pyx_header %}
{% endblock -%} {% endblock -%}
{{ force_mark_rendered("godot_node_path_new_copy") }} {# NodePath is const, why does this exists in the first place ? #} {{ force_mark_rendered("pandemonium_node_path_new_copy") }} {# NodePath is const, why does this exists in the first place ? #}
@cython.final @cython.final
cdef class NodePath: cdef class NodePath:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_node_path _gd_data cdef pandemonium_node_path _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, from_): def __init__(self, from_):
{{ force_mark_rendered("godot_node_path_new") }} {{ force_mark_rendered("pandemonium_node_path_new") }}
cdef godot_string gd_from cdef pandemonium_string gd_from
try: try:
gdapi10.godot_node_path_new(&self._gd_data, &(<GDString?>from_)._gd_data) gdapi10.pandemonium_node_path_new(&self._gd_data, &(<GDString?>from_)._gd_data)
except TypeError: except TypeError:
if not isinstance(from_, str): if not isinstance(from_, str):
raise TypeError("`from_` must be str or GDString") raise TypeError("`from_` must be str or GDString")
pyobj_to_godot_string(from_, &gd_from) pyobj_to_pandemonium_string(from_, &gd_from)
gdapi10.godot_node_path_new(&self._gd_data, &gd_from) gdapi10.pandemonium_node_path_new(&self._gd_data, &gd_from)
gdapi10.godot_string_destroy(&gd_from) gdapi10.pandemonium_string_destroy(&gd_from)
def __dealloc__(NodePath self): def __dealloc__(NodePath self):
{{ force_mark_rendered("godot_node_path_destroy") }} {{ force_mark_rendered("pandemonium_node_path_destroy") }}
# /!\ if `__init__` is skipped, `_gd_data` must be initialized by # /!\ if `__init__` is skipped, `_gd_data` must be initialized by
# hand otherwise we will get a segfault here # hand otherwise we will get a segfault here
gdapi10.godot_node_path_destroy(&self._gd_data) gdapi10.pandemonium_node_path_destroy(&self._gd_data)
def __repr__(NodePath self): def __repr__(NodePath self):
return f"<NodePath({self.as_string()})>" return f"<NodePath({self.as_string()})>"

View File

@ -7,26 +7,26 @@
@cython.final @cython.final
cdef class Plane: cdef class Plane:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_plane _gd_data cdef pandemonium_plane _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, godot_real a, godot_real b, godot_real c, godot_real d): def __init__(self, pandemonium_real a, pandemonium_real b, pandemonium_real c, pandemonium_real d):
{{ force_mark_rendered("godot_plane_new_with_reals") }} {{ force_mark_rendered("pandemonium_plane_new_with_reals") }}
gdapi10.godot_plane_new_with_reals(&self._gd_data, a, b, c, d) gdapi10.pandemonium_plane_new_with_reals(&self._gd_data, a, b, c, d)
@staticmethod @staticmethod
def from_vectors(Vector3 v1 not None, Vector3 v2 not None, Vector3 v3 not None): def from_vectors(Vector3 v1 not None, Vector3 v2 not None, Vector3 v3 not None):
cdef Plane ret = Plane.__new__(Plane) cdef Plane ret = Plane.__new__(Plane)
{{ force_mark_rendered("godot_plane_new_with_vectors") }} {{ force_mark_rendered("pandemonium_plane_new_with_vectors") }}
gdapi10.godot_plane_new_with_vectors(&ret._gd_data, &v1._gd_data, &v2._gd_data, &v3._gd_data) gdapi10.pandemonium_plane_new_with_vectors(&ret._gd_data, &v1._gd_data, &v2._gd_data, &v3._gd_data)
return ret return ret
@staticmethod @staticmethod
def from_normal(Vector3 normal not None, godot_real d): def from_normal(Vector3 normal not None, pandemonium_real d):
cdef Plane ret = Plane.__new__(Plane) cdef Plane ret = Plane.__new__(Plane)
{{ force_mark_rendered("godot_plane_new_with_normal") }} {{ force_mark_rendered("pandemonium_plane_new_with_normal") }}
gdapi10.godot_plane_new_with_normal(&ret._gd_data, &normal._gd_data, d) gdapi10.pandemonium_plane_new_with_normal(&ret._gd_data, &normal._gd_data, d)
return ret return ret
def __repr__(Plane self): def __repr__(Plane self):
@ -54,24 +54,24 @@ cdef class Plane:
def intersects_segment(Plane self, Vector3 begin not None, Vector3 end not None): def intersects_segment(Plane self, Vector3 begin not None, Vector3 end not None):
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_plane_intersects_segment") }} {{ force_mark_rendered("pandemonium_plane_intersects_segment") }}
if gdapi10.godot_plane_intersects_segment(&self._gd_data, &ret._gd_data, &begin._gd_data, &end._gd_data): if gdapi10.pandemonium_plane_intersects_segment(&self._gd_data, &ret._gd_data, &begin._gd_data, &end._gd_data):
return ret return ret
else: else:
return None return None
def intersects_ray(Plane self, Vector3 from_ not None, Vector3 dir not None): def intersects_ray(Plane self, Vector3 from_ not None, Vector3 dir not None):
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_plane_intersects_ray") }} {{ force_mark_rendered("pandemonium_plane_intersects_ray") }}
if gdapi10.godot_plane_intersects_ray(&self._gd_data, &ret._gd_data, &from_._gd_data, &dir._gd_data): if gdapi10.pandemonium_plane_intersects_ray(&self._gd_data, &ret._gd_data, &from_._gd_data, &dir._gd_data):
return ret return ret
else: else:
return None return None
def intersect_3(Plane self, Plane b not None, Plane c not None): def intersect_3(Plane self, Plane b not None, Plane c not None):
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_plane_intersect_3") }} {{ force_mark_rendered("pandemonium_plane_intersect_3") }}
if gdapi10.godot_plane_intersect_3(&self._gd_data, &ret._gd_data, &b._gd_data, &c._gd_data): if gdapi10.pandemonium_plane_intersect_3(&self._gd_data, &ret._gd_data, &b._gd_data, &c._gd_data):
return ret return ret
else: else:
return None return None

View File

@ -7,36 +7,36 @@
@cython.final @cython.final
cdef class Quat: cdef class Quat:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_quat _gd_data cdef pandemonium_quat _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, x=0, y=0, z=0, w=0): def __init__(self, x=0, y=0, z=0, w=0):
{{ force_mark_rendered("godot_quat_new") }} {{ force_mark_rendered("pandemonium_quat_new") }}
gdapi10.godot_quat_new(&self._gd_data, x, y, z, w) gdapi10.pandemonium_quat_new(&self._gd_data, x, y, z, w)
@staticmethod @staticmethod
def from_axis_angle(Vector3 axis not None, godot_real angle): def from_axis_angle(Vector3 axis not None, pandemonium_real angle):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef Quat ret = Quat.__new__(Quat) cdef Quat ret = Quat.__new__(Quat)
{{ force_mark_rendered("godot_quat_new_with_axis_angle") }} {{ force_mark_rendered("pandemonium_quat_new_with_axis_angle") }}
gdapi10.godot_quat_new_with_axis_angle(&ret._gd_data, &axis._gd_data, angle) gdapi10.pandemonium_quat_new_with_axis_angle(&ret._gd_data, &axis._gd_data, angle)
return ret return ret
@staticmethod @staticmethod
def from_basis(Basis basis not None): def from_basis(Basis basis not None):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef Quat ret = Quat.__new__(Quat) cdef Quat ret = Quat.__new__(Quat)
{{ force_mark_rendered("godot_quat_new_with_basis") }} {{ force_mark_rendered("pandemonium_quat_new_with_basis") }}
gdapi11.godot_quat_new_with_basis(&ret._gd_data, &basis._gd_data) gdapi11.pandemonium_quat_new_with_basis(&ret._gd_data, &basis._gd_data)
return ret return ret
@staticmethod @staticmethod
def from_euler(Vector3 euler not None): def from_euler(Vector3 euler not None):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef Quat ret = Quat.__new__(Quat) cdef Quat ret = Quat.__new__(Quat)
{{ force_mark_rendered("godot_quat_new_with_euler") }} {{ force_mark_rendered("pandemonium_quat_new_with_euler") }}
gdapi11.godot_quat_new_with_euler(&ret._gd_data, &euler._gd_data) gdapi11.pandemonium_quat_new_with_euler(&ret._gd_data, &euler._gd_data)
return ret return ret
def __repr__(Quat self): def __repr__(Quat self):
@ -54,12 +54,12 @@ cdef class Quat:
{{ render_method("operator_subtract", py_name="__sub__") | indent }} {{ render_method("operator_subtract", py_name="__sub__") | indent }}
{{ render_method("operator_multiply", py_name="__mul__") | indent }} {{ render_method("operator_multiply", py_name="__mul__") | indent }}
def __truediv__(Quat self, godot_real val): def __truediv__(Quat self, pandemonium_real val):
if val == 0: if val == 0:
raise ZeroDivisionError raise ZeroDivisionError
cdef Quat ret = Quat.__new__(Quat) cdef Quat ret = Quat.__new__(Quat)
{{ force_mark_rendered("godot_quat_operator_divide") }} {{ force_mark_rendered("pandemonium_quat_operator_divide") }}
ret._gd_data = gdapi10.godot_quat_operator_divide(&self._gd_data, val) ret._gd_data = gdapi10.pandemonium_quat_operator_divide(&self._gd_data, val)
return ret return ret
{{ render_property("x", getter="get_x", setter="set_x") | indent }} {{ render_property("x", getter="get_x", setter="set_x") | indent }}

View File

@ -7,19 +7,19 @@
@cython.final @cython.final
cdef class Rect2: cdef class Rect2:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_rect2 _gd_data cdef pandemonium_rect2 _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, godot_real x=0.0, godot_real y=0.0, godot_real width=0.0, godot_real height=0.0): def __init__(self, pandemonium_real x=0.0, pandemonium_real y=0.0, pandemonium_real width=0.0, pandemonium_real height=0.0):
{{ force_mark_rendered("godot_rect2_new") }} {{ force_mark_rendered("pandemonium_rect2_new") }}
gdapi10.godot_rect2_new(&self._gd_data, x, y, width, height) gdapi10.pandemonium_rect2_new(&self._gd_data, x, y, width, height)
@staticmethod @staticmethod
def from_pos_size(Vector2 position not None, Vector2 size not None): def from_pos_size(Vector2 position not None, Vector2 size not None):
{{ force_mark_rendered("godot_rect2_new_with_position_and_size") }} {{ force_mark_rendered("pandemonium_rect2_new_with_position_and_size") }}
cdef Rect2 ret = Rect2.__new__(Rect2) cdef Rect2 ret = Rect2.__new__(Rect2)
gdapi10.godot_rect2_new_with_position_and_size(&ret._gd_data, &position._gd_data, &size._gd_data) gdapi10.pandemonium_rect2_new_with_position_and_size(&ret._gd_data, &position._gd_data, &size._gd_data)
return ret return ret
def __repr__(Rect2 self): def __repr__(Rect2 self):
@ -33,10 +33,10 @@ cdef class Rect2:
@property @property
def end(Rect2 self) -> Vector2: def end(Rect2 self) -> Vector2:
cdef godot_vector2 position = gdapi10.godot_rect2_get_position(&self._gd_data) cdef pandemonium_vector2 position = gdapi10.pandemonium_rect2_get_position(&self._gd_data)
cdef godot_vector2 size = gdapi10.godot_rect2_get_size(&self._gd_data) cdef pandemonium_vector2 size = gdapi10.pandemonium_rect2_get_size(&self._gd_data)
cdef Vector2 ret = Vector2.__new__(Vector2) cdef Vector2 ret = Vector2.__new__(Vector2)
ret._gd_data = gdapi10.godot_vector2_operator_add(&position, &size) ret._gd_data = gdapi10.pandemonium_vector2_operator_add(&position, &size)
return ret return ret
{{ render_method("as_string") | indent }} {{ render_method("as_string") | indent }}

View File

@ -17,21 +17,21 @@ def {{ py_name or spec.py_name }}({{ spec.klass.cy_type }} self{%- if args_witho
) -> {{ spec.return_type.py_type }}: ) -> {{ spec.return_type.py_type }}:
{% for arg in args_without_self %} {% for arg in args_without_self %}
{% if arg.is_variant %} {% if arg.is_variant %}
cdef godot_variant __var_{{ arg.name }} cdef pandemonium_variant __var_{{ arg.name }}
if not pyobj_to_godot_variant({{ arg.name }}, &__var_{{ arg.name }}): if not pyobj_to_pandemonium_variant({{ arg.name }}, &__var_{{ arg.name }}):
{% for initialized_arg in args_without_self %} {% for initialized_arg in args_without_self %}
{% if initialized_arg.name == arg.name %} {% if initialized_arg.name == arg.name %}
{% break %} {% break %}
{% endif %} {% endif %}
{% if initialized_arg.is_variant %} {% if initialized_arg.is_variant %}
gdapi10.godot_variant_destroy(&__var_{{ initialized_arg.name }}) gdapi10.pandemonium_variant_destroy(&__var_{{ initialized_arg.name }})
{% endif %} {% endif %}
{% endfor %} {% endfor %}
raise TypeError(f"Cannot convert `{ {{ arg.name}} !r}` to Godot Variant") raise TypeError(f"Cannot convert `{ {{ arg.name}} !r}` to Godot Variant")
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if spec.return_type.is_variant %} {% if spec.return_type.is_variant %}
cdef godot_variant __var_ret = ( cdef pandemonium_variant __var_ret = (
{%- elif spec.return_type.is_builtin %} {%- elif spec.return_type.is_builtin %}
cdef {{ spec.return_type.cy_type }} __ret = {{ spec.return_type.cy_type }}.__new__({{ spec.return_type.cy_type }}) cdef {{ spec.return_type.cy_type }} __ret = {{ spec.return_type.cy_type }}.__new__({{ spec.return_type.cy_type }})
__ret._gd_data = ( __ret._gd_data = (
@ -62,12 +62,12 @@ def {{ py_name or spec.py_name }}({{ spec.klass.cy_type }} self{%- if args_witho
)) ))
{% for arg in args_without_self %} {% for arg in args_without_self %}
{% if arg.is_variant %} {% if arg.is_variant %}
gdapi10.godot_variant_destroy(&__var_{{ arg.name }}) gdapi10.pandemonium_variant_destroy(&__var_{{ arg.name }})
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if spec.return_type.is_variant %} {% if spec.return_type.is_variant %}
cdef object __ret = godot_variant_to_pyobj(&__var_ret) cdef object __ret = pandemonium_variant_to_pyobj(&__var_ret)
gdapi10.godot_variant_destroy(&__var_ret) gdapi10.pandemonium_variant_destroy(&__var_ret)
return __ret return __ret
{% elif not spec.return_type.is_void %} {% elif not spec.return_type.is_void %}
return __ret return __ret

View File

@ -8,20 +8,20 @@ from godot.bindings cimport Resource
@cython.final @cython.final
cdef class RID: cdef class RID:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_rid _gd_data cdef pandemonium_rid _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, Resource from_=None): def __init__(self, Resource from_=None):
if from_ is not None: if from_ is not None:
{{ force_mark_rendered("godot_rid_new_with_resource") }} {{ force_mark_rendered("pandemonium_rid_new_with_resource") }}
gdapi10.godot_rid_new_with_resource( gdapi10.pandemonium_rid_new_with_resource(
&self._gd_data, &self._gd_data,
from_._gd_ptr from_._gd_ptr
) )
else: else:
{{ force_mark_rendered("godot_rid_new") }} {{ force_mark_rendered("pandemonium_rid_new") }}
gdapi10.godot_rid_new(&self._gd_data) gdapi10.pandemonium_rid_new(&self._gd_data)
def __repr__(RID self): def __repr__(RID self):
return f"<RID(id={self.get_id()})>" return f"<RID(id={self.get_id()})>"
@ -30,7 +30,7 @@ cdef class RID:
def from_resource(Resource resource not None): def from_resource(Resource resource not None):
# Call to __new__ bypasses __init__ constructor # Call to __new__ bypasses __init__ constructor
cdef RID ret = RID.__new__(RID) cdef RID ret = RID.__new__(RID)
gdapi10.godot_rid_new_with_resource(&ret._gd_data, resource._gd_ptr) gdapi10.pandemonium_rid_new_with_resource(&ret._gd_data, resource._gd_ptr)
return ret return ret
{{ render_operator_eq() | indent }} {{ render_operator_eq() | indent }}

View File

@ -7,17 +7,17 @@
@cython.final @cython.final
cdef class Transform: cdef class Transform:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_transform _gd_data cdef pandemonium_transform _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, x_axis=None, y_axis=None, z_axis=None, origin=None): def __init__(self, x_axis=None, y_axis=None, z_axis=None, origin=None):
if x_axis is None and y_axis is None and z_axis is None and origin is None: if x_axis is None and y_axis is None and z_axis is None and origin is None:
{{ force_mark_rendered("godot_transform_new_identity") }} {{ force_mark_rendered("pandemonium_transform_new_identity") }}
gdapi10.godot_transform_new_identity(&self._gd_data) gdapi10.pandemonium_transform_new_identity(&self._gd_data)
else: else:
{{ force_mark_rendered("godot_transform_new_with_axis_origin") }} {{ force_mark_rendered("pandemonium_transform_new_with_axis_origin") }}
gdapi10.godot_transform_new_with_axis_origin( gdapi10.pandemonium_transform_new_with_axis_origin(
&self._gd_data, &self._gd_data,
&(<Vector3?>x_axis)._gd_data, &(<Vector3?>x_axis)._gd_data,
&(<Vector3?>y_axis)._gd_data, &(<Vector3?>y_axis)._gd_data,
@ -28,15 +28,15 @@ cdef class Transform:
@staticmethod @staticmethod
def from_basis_origin(Basis basis not None, Vector3 origin not None): def from_basis_origin(Basis basis not None, Vector3 origin not None):
cdef Transform ret = Transform.__new__(Transform) cdef Transform ret = Transform.__new__(Transform)
{{ force_mark_rendered("godot_transform_new") }} {{ force_mark_rendered("pandemonium_transform_new") }}
gdapi10.godot_transform_new(&ret._gd_data, &basis._gd_data, &origin._gd_data) gdapi10.pandemonium_transform_new(&ret._gd_data, &basis._gd_data, &origin._gd_data)
return ret return ret
@staticmethod @staticmethod
def from_quat(Quat quat not None): def from_quat(Quat quat not None):
cdef Transform ret = Transform.__new__(Transform) cdef Transform ret = Transform.__new__(Transform)
{{ force_mark_rendered("godot_transform_new_with_quat") }} {{ force_mark_rendered("pandemonium_transform_new_with_quat") }}
gdapi11.godot_transform_new_with_quat(&ret._gd_data, &quat._gd_data) gdapi11.pandemonium_transform_new_with_quat(&ret._gd_data, &quat._gd_data)
return ret return ret
def __repr__(Transform self): def __repr__(Transform self):

View File

@ -7,17 +7,17 @@
@cython.final @cython.final
cdef class Transform2D: cdef class Transform2D:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_transform2d _gd_data cdef pandemonium_transform2d _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, x_axis=None, y_axis=None, origin=None): def __init__(self, x_axis=None, y_axis=None, origin=None):
if x_axis is None and y_axis is None and origin is None: if x_axis is None and y_axis is None and origin is None:
{{ force_mark_rendered("godot_transform2d_new_identity") }} {{ force_mark_rendered("pandemonium_transform2d_new_identity") }}
gdapi10.godot_transform2d_new_identity(&self._gd_data) gdapi10.pandemonium_transform2d_new_identity(&self._gd_data)
else: else:
{{ force_mark_rendered("godot_transform2d_new_axis_origin") }} {{ force_mark_rendered("pandemonium_transform2d_new_axis_origin") }}
gdapi10.godot_transform2d_new_axis_origin( gdapi10.pandemonium_transform2d_new_axis_origin(
&self._gd_data, &self._gd_data,
&(<Vector2?>x_axis)._gd_data, &(<Vector2?>x_axis)._gd_data,
&(<Vector2?>y_axis)._gd_data, &(<Vector2?>y_axis)._gd_data,
@ -25,10 +25,10 @@ cdef class Transform2D:
) )
@staticmethod @staticmethod
def from_rot_pos(godot_real rot, Vector2 pos not None): def from_rot_pos(pandemonium_real rot, Vector2 pos not None):
cdef Transform2D ret = Transform2D.__new__(Transform2D) cdef Transform2D ret = Transform2D.__new__(Transform2D)
{{ force_mark_rendered("godot_transform2d_new") }} {{ force_mark_rendered("pandemonium_transform2d_new") }}
gdapi10.godot_transform2d_new(&ret._gd_data, rot, &pos._gd_data) gdapi10.pandemonium_transform2d_new(&ret._gd_data, rot, &pos._gd_data)
return ret return ret
def __repr__(Transform2D self): def __repr__(Transform2D self):
@ -57,15 +57,15 @@ cdef class Transform2D:
cdef Rect2 ret_r2 cdef Rect2 ret_r2
try: try:
ret_v2 = Vector2.__new__(Vector2) ret_v2 = Vector2.__new__(Vector2)
{{ force_mark_rendered("godot_transform2d_xform_vector2") }} {{ force_mark_rendered("pandemonium_transform2d_xform_vector2") }}
ret_v2._gd_data = gdapi10.godot_transform2d_xform_vector2(&self._gd_data, &(<Vector2?>v)._gd_data) ret_v2._gd_data = gdapi10.pandemonium_transform2d_xform_vector2(&self._gd_data, &(<Vector2?>v)._gd_data)
return ret_v2 return ret_v2
except TypeError: except TypeError:
pass pass
try: try:
ret_r2 = Rect2.__new__(Rect2) ret_r2 = Rect2.__new__(Rect2)
{{ force_mark_rendered("godot_transform2d_xform_rect2") }} {{ force_mark_rendered("pandemonium_transform2d_xform_rect2") }}
ret_r2._gd_data = gdapi10.godot_transform2d_xform_rect2(&self._gd_data, &(<Rect2?>v)._gd_data) ret_r2._gd_data = gdapi10.pandemonium_transform2d_xform_rect2(&self._gd_data, &(<Rect2?>v)._gd_data)
return ret_r2 return ret_r2
except TypeError: except TypeError:
raise TypeError("`v` must be Vector2 or Rect2") raise TypeError("`v` must be Vector2 or Rect2")
@ -75,15 +75,15 @@ cdef class Transform2D:
cdef Rect2 ret_r2 cdef Rect2 ret_r2
try: try:
ret_v2 = Vector2.__new__(Vector2) ret_v2 = Vector2.__new__(Vector2)
{{ force_mark_rendered("godot_transform2d_xform_inv_vector2") }} {{ force_mark_rendered("pandemonium_transform2d_xform_inv_vector2") }}
ret_v2._gd_data = gdapi10.godot_transform2d_xform_inv_vector2(&self._gd_data, &(<Vector2?>v)._gd_data) ret_v2._gd_data = gdapi10.pandemonium_transform2d_xform_inv_vector2(&self._gd_data, &(<Vector2?>v)._gd_data)
return ret_v2 return ret_v2
except TypeError: except TypeError:
pass pass
try: try:
ret_r2 = Rect2.__new__(Rect2) ret_r2 = Rect2.__new__(Rect2)
{{ force_mark_rendered("godot_transform2d_xform_inv_rect2") }} {{ force_mark_rendered("pandemonium_transform2d_xform_inv_rect2") }}
ret_r2._gd_data = gdapi10.godot_transform2d_xform_inv_rect2(&self._gd_data, &(<Rect2?>v)._gd_data) ret_r2._gd_data = gdapi10.pandemonium_transform2d_xform_inv_rect2(&self._gd_data, &(<Rect2?>v)._gd_data)
return ret_r2 return ret_r2
except TypeError: except TypeError:
raise TypeError("`v` must be Vector2 or Rect2") raise TypeError("`v` must be Vector2 or Rect2")

View File

@ -5,26 +5,26 @@ import math
cdef inline Vector2 Vector2_multiply_vector(Vector2 self, Vector2 b): cdef inline Vector2 Vector2_multiply_vector(Vector2 self, Vector2 b):
cdef Vector2 ret = Vector2.__new__(Vector2) cdef Vector2 ret = Vector2.__new__(Vector2)
{{ force_mark_rendered("godot_vector2_operator_multiply_vector") }} {{ force_mark_rendered("pandemonium_vector2_operator_multiply_vector") }}
ret._gd_data = gdapi10.godot_vector2_operator_multiply_vector(&self._gd_data, &b._gd_data) ret._gd_data = gdapi10.pandemonium_vector2_operator_multiply_vector(&self._gd_data, &b._gd_data)
return ret return ret
cdef inline Vector2 Vector2_multiply_scalar(Vector2 self, godot_real b): cdef inline Vector2 Vector2_multiply_scalar(Vector2 self, pandemonium_real b):
cdef Vector2 ret = Vector2.__new__(Vector2) cdef Vector2 ret = Vector2.__new__(Vector2)
{{ force_mark_rendered("godot_vector2_operator_multiply_scalar") }} {{ force_mark_rendered("pandemonium_vector2_operator_multiply_scalar") }}
ret._gd_data = gdapi10.godot_vector2_operator_multiply_scalar(&self._gd_data, b) ret._gd_data = gdapi10.pandemonium_vector2_operator_multiply_scalar(&self._gd_data, b)
return ret return ret
cdef inline Vector2 Vector2_divide_vector(Vector2 self, Vector2 b): cdef inline Vector2 Vector2_divide_vector(Vector2 self, Vector2 b):
cdef Vector2 ret = Vector2.__new__(Vector2) cdef Vector2 ret = Vector2.__new__(Vector2)
{{ force_mark_rendered("godot_vector2_operator_divide_vector") }} {{ force_mark_rendered("pandemonium_vector2_operator_divide_vector") }}
ret._gd_data = gdapi10.godot_vector2_operator_divide_vector(&self._gd_data, &b._gd_data) ret._gd_data = gdapi10.pandemonium_vector2_operator_divide_vector(&self._gd_data, &b._gd_data)
return ret return ret
cdef inline Vector2 Vector2_divide_scalar(Vector2 self, godot_real b): cdef inline Vector2 Vector2_divide_scalar(Vector2 self, pandemonium_real b):
cdef Vector2 ret = Vector2.__new__(Vector2) cdef Vector2 ret = Vector2.__new__(Vector2)
{{ force_mark_rendered("godot_vector2_operator_divide_scalar") }} {{ force_mark_rendered("pandemonium_vector2_operator_divide_scalar") }}
ret._gd_data = gdapi10.godot_vector2_operator_divide_scalar(&self._gd_data, b) ret._gd_data = gdapi10.pandemonium_vector2_operator_divide_scalar(&self._gd_data, b)
return ret return ret
{% endblock -%} {% endblock -%}
@ -32,13 +32,13 @@ cdef inline Vector2 Vector2_divide_scalar(Vector2 self, godot_real b):
@cython.final @cython.final
cdef class Vector2: cdef class Vector2:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_vector2 _gd_data cdef pandemonium_vector2 _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, godot_real x=0.0, godot_real y=0.0): def __init__(self, pandemonium_real x=0.0, pandemonium_real y=0.0):
{{ force_mark_rendered("godot_vector2_new") }} {{ force_mark_rendered("pandemonium_vector2_new") }}
gdapi10.godot_vector2_new(&self._gd_data, x, y) gdapi10.pandemonium_vector2_new(&self._gd_data, x, y)
def __repr__(Vector2 self): def __repr__(Vector2 self):
return f"<Vector2(x={self.x}, y={self.y})>" return f"<Vector2(x={self.x}, y={self.y})>"

View File

@ -1,7 +1,7 @@
{%- block pxd_header %} {%- block pxd_header %}
{% endblock -%} {% endblock -%}
{%- block pyx_header %} {%- block pyx_header %}
from godot._hazmat.gdnative_api_struct cimport godot_vector3_axis from godot._hazmat.gdnative_api_struct cimport pandemonium_vector3_axis
import math import math
from enum import IntEnum from enum import IntEnum
@ -9,26 +9,26 @@ from enum import IntEnum
cdef inline Vector3_multiply_vector(Vector3 self, Vector3 b): cdef inline Vector3_multiply_vector(Vector3 self, Vector3 b):
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_vector3_operator_multiply_vector") }} {{ force_mark_rendered("pandemonium_vector3_operator_multiply_vector") }}
ret._gd_data = gdapi10.godot_vector3_operator_multiply_vector(&self._gd_data, &b._gd_data) ret._gd_data = gdapi10.pandemonium_vector3_operator_multiply_vector(&self._gd_data, &b._gd_data)
return ret return ret
cdef inline Vector3_multiply_scalar(Vector3 self, godot_real b): cdef inline Vector3_multiply_scalar(Vector3 self, pandemonium_real b):
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_vector3_operator_multiply_scalar") }} {{ force_mark_rendered("pandemonium_vector3_operator_multiply_scalar") }}
ret._gd_data = gdapi10.godot_vector3_operator_multiply_scalar(&self._gd_data, b) ret._gd_data = gdapi10.pandemonium_vector3_operator_multiply_scalar(&self._gd_data, b)
return ret return ret
cdef inline Vector3_divide_vector(Vector3 self, Vector3 b): cdef inline Vector3_divide_vector(Vector3 self, Vector3 b):
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_vector3_operator_divide_vector") }} {{ force_mark_rendered("pandemonium_vector3_operator_divide_vector") }}
ret._gd_data = gdapi10.godot_vector3_operator_divide_vector(&self._gd_data, &b._gd_data) ret._gd_data = gdapi10.pandemonium_vector3_operator_divide_vector(&self._gd_data, &b._gd_data)
return ret return ret
cdef inline Vector3_divide_scalar(Vector3 self, godot_real b): cdef inline Vector3_divide_scalar(Vector3 self, pandemonium_real b):
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
{{ force_mark_rendered("godot_vector3_operator_divide_scalar") }} {{ force_mark_rendered("pandemonium_vector3_operator_divide_scalar") }}
ret._gd_data = gdapi10.godot_vector3_operator_divide_scalar(&self._gd_data, b) ret._gd_data = gdapi10.pandemonium_vector3_operator_divide_scalar(&self._gd_data, b)
return ret return ret
{% endblock -%} {% endblock -%}
@ -37,46 +37,46 @@ cdef inline Vector3_divide_scalar(Vector3 self, godot_real b):
@cython.final @cython.final
cdef class Vector3: cdef class Vector3:
{% block cdef_attributes %} {% block cdef_attributes %}
cdef godot_vector3 _gd_data cdef pandemonium_vector3 _gd_data
{% endblock %} {% endblock %}
{% block python_defs %} {% block python_defs %}
def __init__(self, godot_real x=0.0, godot_real y=0.0, godot_real z=0.0): def __init__(self, pandemonium_real x=0.0, pandemonium_real y=0.0, pandemonium_real z=0.0):
{{ force_mark_rendered("godot_vector3_new") }} {{ force_mark_rendered("pandemonium_vector3_new") }}
gdapi10.godot_vector3_new(&self._gd_data, x, y, z) gdapi10.pandemonium_vector3_new(&self._gd_data, x, y, z)
def __repr__(self): def __repr__(self):
return f"<Vector3(x={self.x}, y={self.y}, z={self.z})>" return f"<Vector3(x={self.x}, y={self.y}, z={self.z})>"
@property @property
def x(self) -> godot_real: def x(self) -> pandemonium_real:
{{ force_mark_rendered("godot_vector3_get_axis") }} {{ force_mark_rendered("pandemonium_vector3_get_axis") }}
return gdapi10.godot_vector3_get_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_X) return gdapi10.pandemonium_vector3_get_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_X)
@x.setter @x.setter
def x(self, godot_real val) -> None: def x(self, pandemonium_real val) -> None:
{{ force_mark_rendered("godot_vector3_set_axis") }} {{ force_mark_rendered("pandemonium_vector3_set_axis") }}
gdapi10.godot_vector3_set_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_X, val) gdapi10.pandemonium_vector3_set_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_X, val)
@property @property
def y(self) -> godot_real: def y(self) -> pandemonium_real:
{{ force_mark_rendered("godot_vector3_get_axis") }} {{ force_mark_rendered("pandemonium_vector3_get_axis") }}
return gdapi10.godot_vector3_get_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_Y) return gdapi10.pandemonium_vector3_get_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Y)
@y.setter @y.setter
def y(self, godot_real val) -> None: def y(self, pandemonium_real val) -> None:
{{ force_mark_rendered("godot_vector3_set_axis") }} {{ force_mark_rendered("pandemonium_vector3_set_axis") }}
gdapi10.godot_vector3_set_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_Y, val) gdapi10.pandemonium_vector3_set_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Y, val)
@property @property
def z(self) -> godot_real: def z(self) -> pandemonium_real:
{{ force_mark_rendered("godot_vector3_get_axis") }} {{ force_mark_rendered("pandemonium_vector3_get_axis") }}
return gdapi10.godot_vector3_get_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_Z) return gdapi10.pandemonium_vector3_get_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Z)
@z.setter @z.setter
def z(self, godot_real val) -> None: def z(self, pandemonium_real val) -> None:
{{ force_mark_rendered("godot_vector3_set_axis") }} {{ force_mark_rendered("pandemonium_vector3_set_axis") }}
gdapi10.godot_vector3_set_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_Z, val) gdapi10.pandemonium_vector3_set_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Z, val)
{{ render_operator_eq() | indent }} {{ render_operator_eq() | indent }}
{{ render_operator_ne() | indent }} {{ render_operator_ne() | indent }}
@ -143,9 +143,9 @@ cdef class Vector3:
{%- block python_consts %} {%- block python_consts %}
AXIS = IntEnum("AXIS", { AXIS = IntEnum("AXIS", {
"X": godot_vector3_axis.GODOT_VECTOR3_AXIS_X, "X": pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_X,
"Y": godot_vector3_axis.GODOT_VECTOR3_AXIS_Y, "Y": pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Y,
"Z": godot_vector3_axis.GODOT_VECTOR3_AXIS_Z, "Z": pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Z,
}) })
ZERO = Vector3(0, 0, 0) # Zero vector. ZERO = Vector3(0, 0, 0) # Zero vector.

View File

@ -184,33 +184,33 @@ SAMPLE_CLASSES = {
SUPPORTED_TYPES = { SUPPORTED_TYPES = {
"void", "void",
"godot_bool", "pandemonium_bool",
"godot_int", "pandemonium_int",
"godot_real", "pandemonium_real",
"godot_string", "pandemonium_string",
"godot_variant", "pandemonium_variant",
"godot_object", "pandemonium_object",
"godot_aabb", "pandemonium_aabb",
"godot_array", "pandemonium_array",
"godot_basis", "pandemonium_basis",
"godot_color", "pandemonium_color",
"godot_dictionary", "pandemonium_dictionary",
"godot_node_path", "pandemonium_node_path",
"godot_plane", "pandemonium_plane",
"godot_quat", "pandemonium_quat",
"godot_rect2", "pandemonium_rect2",
"godot_rid", "pandemonium_rid",
"godot_transform", "pandemonium_transform",
"godot_transform2d", "pandemonium_transform2d",
"godot_vector2", "pandemonium_vector2",
"godot_vector3", "pandemonium_vector3",
"godot_pool_byte_array", "pandemonium_pool_byte_array",
"godot_pool_int_array", "pandemonium_pool_int_array",
"godot_pool_real_array", "pandemonium_pool_real_array",
"godot_pool_string_array", "pandemonium_pool_string_array",
"godot_pool_vector2_array", "pandemonium_pool_vector2_array",
"godot_pool_vector3_array", "pandemonium_pool_vector3_array",
"godot_pool_color_array", "pandemonium_pool_color_array",
} }
@ -357,8 +357,8 @@ def cook_data(data):
pcls, ecls = re.match(r"enum.(\w+)::(\w+)", type_).groups() pcls, ecls = re.match(r"enum.(\w+)::(\w+)", type_).groups()
return TypeSpec( return TypeSpec(
gdapi_type=type_, gdapi_type=type_,
c_type="godot_int", c_type="pandemonium_int",
cy_type="godot_int", cy_type="pandemonium_int",
py_type=f"{class_renames[pcls]}.{ecls}", py_type=f"{class_renames[pcls]}.{ecls}",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -369,7 +369,7 @@ def cook_data(data):
if "," in type_: if "," in type_:
return TypeSpec( return TypeSpec(
gdapi_type=type_, gdapi_type=type_,
c_type="godot_object", c_type="pandemonium_object",
cy_type="Resource", cy_type="Resource",
py_type=f"Union[{','.join([class_renames[x] for x in type_.split(',')])}]", py_type=f"Union[{','.join([class_renames[x] for x in type_.split(',')])}]",
is_object=True, is_object=True,
@ -377,7 +377,7 @@ def cook_data(data):
else: else:
return TypeSpec( return TypeSpec(
gdapi_type=type_, gdapi_type=type_,
c_type="godot_object", c_type="pandemonium_object",
cy_type=class_renames[type_], cy_type=class_renames[type_],
is_object=True, is_object=True,
) )
@ -392,46 +392,46 @@ def cook_data(data):
if not has_default_value: if not has_default_value:
return None return None
# Mostly ad-hoc stuff given default values format in api.json is broken # Mostly ad-hoc stuff given default values format in api.json is broken
if type in ("godot_bool", "godot_int", "godot_real", "godot_variant"): if type in ("pandemonium_bool", "pandemonium_int", "pandemonium_real", "pandemonium_variant"):
if value == "Null": if value == "Null":
return "None" return "None"
else: else:
return value return value
elif type == "godot_string": elif type == "pandemonium_string":
return f'"{value}"' return f'"{value}"'
elif type == "godot_object" and value in ("[Object:null]", "Null"): elif type == "pandemonium_object" and value in ("[Object:null]", "Null"):
return "None" return "None"
elif type == "godot_dictionary" and value == "{}": elif type == "pandemonium_dictionary" and value == "{}":
return "Dictionary()" return "Dictionary()"
elif type == "godot_vector2": elif type == "pandemonium_vector2":
return f"Vector2{value}" return f"Vector2{value}"
elif type == "godot_rect2": elif type == "pandemonium_rect2":
return f"Rect2{value}" return f"Rect2{value}"
elif type == "godot_vector3": elif type == "pandemonium_vector3":
return f"Vector3{value}" return f"Vector3{value}"
elif type == "godot_transform" and value == "1, 0, 0, 0, 1, 0, 0, 0, 1 - 0, 0, 0": elif type == "pandemonium_transform" and value == "1, 0, 0, 0, 1, 0, 0, 0, 1 - 0, 0, 0":
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 == "godot_transform2d" and value == "((1, 0), (0, 1), (0, 0))": elif type == "pandemonium_transform2d" and value == "((1, 0), (0, 1), (0, 0))":
return "Transform2D(Vector2(1, 0), Vector2(0, 1), Vector2(0, 0))" return "Transform2D(Vector2(1, 0), Vector2(0, 1), Vector2(0, 0))"
elif value == "[RID]": elif value == "[RID]":
return "RID()" return "RID()"
elif type == "godot_color": elif type == "pandemonium_color":
return f"Color({value})" return f"Color({value})"
elif type == "godot_pool_color_array" and value == "[PoolColorArray]": elif type == "pandemonium_pool_color_array" and value == "[PoolColorArray]":
return "PoolColorArray()" return "PoolColorArray()"
elif type == "godot_array" and value == "[]": elif type == "pandemonium_array" and value == "[]":
return f"Array()" return f"Array()"
elif type == "godot_pool_vector2_array" and value == "[]": elif type == "pandemonium_pool_vector2_array" and value == "[]":
return f"PoolVector2Array()" return f"PoolVector2Array()"
elif type == "godot_pool_vector3_array" and value == "[]": elif type == "pandemonium_pool_vector3_array" and value == "[]":
return f"PoolVector3Array()" return f"PoolVector3Array()"
elif type == "godot_pool_int_array" and value == "[]": elif type == "pandemonium_pool_int_array" and value == "[]":
return f"PoolIntArray()" return f"PoolIntArray()"
elif type == "godot_pool_real_array" and value == "[]": elif type == "pandemonium_pool_real_array" and value == "[]":
return f"PoolRealArray()" return f"PoolRealArray()"
elif type == "godot_pool_string_array" and value == "[]": elif type == "pandemonium_pool_string_array" and value == "[]":
return f"PoolStringArray()" return f"PoolStringArray()"
elif value == "Null": elif value == "Null":
return "None" return "None"

View File

@ -51,8 +51,8 @@ ALL_TYPES = [
*ALL_TYPES_EXCEPT_OBJECTS, *ALL_TYPES_EXCEPT_OBJECTS,
*TYPES_SIZED_INT, *TYPES_SIZED_INT,
TypeSpec( TypeSpec(
gdapi_type="godot_object", gdapi_type="pandemonium_object",
c_type="godot_object", c_type="pandemonium_object",
cy_type="object", cy_type="object",
py_type="Object", py_type="Object",
is_object=True, is_object=True,
@ -73,7 +73,7 @@ ALL_TYPES = [
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
), ),
# /!\ godot_real is a C float (note py_type is still `float` given that's how Python call all floating point numbers) # /!\ pandemonium_real is a C float (note py_type is still `float` given that's how Python call all floating point numbers)
TypeSpec( TypeSpec(
gdapi_type="double", gdapi_type="double",
c_type="double", c_type="double",
@ -100,16 +100,16 @@ ALL_TYPES = [
is_stack_only=True, is_stack_only=True,
), ),
TypeSpec( TypeSpec(
gdapi_type="godot_char_string", gdapi_type="pandemonium_char_string",
c_type="godot_char_string", c_type="pandemonium_char_string",
cy_type="godot_char_string", cy_type="pandemonium_char_string",
py_type="str", py_type="str",
is_builtin=True, is_builtin=True,
), ),
TypeSpec( TypeSpec(
gdapi_type="godot_string_name", gdapi_type="pandemonium_string_name",
c_type="godot_string_name", c_type="pandemonium_string_name",
cy_type="godot_string_name", cy_type="pandemonium_string_name",
py_type="str", py_type="str",
is_builtin=True, is_builtin=True,
), ),
@ -162,7 +162,7 @@ class BuiltinMethodSpec:
klass: TypeSpec klass: TypeSpec
# Name of the function in the GDNative C API # Name of the function in the GDNative C API
c_name: str c_name: str
# Basically gd_name without the `godot_<type>_` prefix # Basically gd_name without the `pandemonium_<type>_` prefix
py_name: str py_name: str
return_type: TypeSpec return_type: TypeSpec
args: List[ArgumentSpec] args: List[ArgumentSpec]
@ -186,14 +186,14 @@ env.filters["merge"] = lambda x, **kwargs: {**x, **kwargs}
def load_builtin_method_spec(func: dict, gdapi: str) -> BuiltinMethodSpec: def load_builtin_method_spec(func: dict, gdapi: str) -> BuiltinMethodSpec:
c_name = func["name"] c_name = func["name"]
assert c_name.startswith("godot_"), func assert c_name.startswith("pandemonium_"), func
for builtin_type in BUILTINS_TYPES: for builtin_type in BUILTINS_TYPES:
prefix = f"{builtin_type.c_type}_" prefix = f"{builtin_type.c_type}_"
if c_name.startswith(prefix): if c_name.startswith(prefix):
py_name = c_name[len(prefix) :] py_name = c_name[len(prefix) :]
break break
else: else:
# This function is not part of a builtin class (e.g. godot_print), we can ignore it # This function is not part of a builtin class (e.g. pandemonium_print), we can ignore it
return return
def _cook_type(raw_type): def _cook_type(raw_type):
@ -245,7 +245,7 @@ def pre_cook_patch_stuff(gdnative_api):
while revision: while revision:
for func in revision["api"]: for func in revision["api"]:
# `signed char` is used in some string methods to return comparison # `signed char` is used in some string methods to return comparison
# information (see `godot_string_casecmp_to`). # information (see `pandemonium_string_casecmp_to`).
# The type in two word messes with our (poor) type parsing. # The type in two word messes with our (poor) type parsing.
if func["return_type"] == "signed char": if func["return_type"] == "signed char":
func["return_type"] = "int8_t" func["return_type"] = "int8_t"
@ -261,7 +261,7 @@ def load_builtins_specs_from_gdnative_api_json(gdnative_api: dict) -> List[Built
for func in revision["api"]: for func in revision["api"]:
assert func["name"] not in specs assert func["name"] not in specs
# Ignore godot pool (generate by another script) # Ignore godot pool (generate by another script)
if func["name"].startswith("godot_pool_") or func["name"].startswith("godot_variant_"): if func["name"].startswith("pandemonium_pool_") or func["name"].startswith("pandemonium_variant_"):
continue continue
spec = load_builtin_method_spec(func, gdapi=revision_gdapi) spec = load_builtin_method_spec(func, gdapi=revision_gdapi)
if spec: if spec:

View File

@ -295,7 +295,7 @@ class PatchedAutoPxd(AutoPxd):
def visit_ArrayDecl(self, node): def visit_ArrayDecl(self, node):
# autopxd doesn't support array with an expression as size, but in: # autopxd doesn't support array with an expression as size, but in:
# typedef struct {uint8_t _dont_touch_that[GODOT_VECTOR3_SIZE];} godot_vector3; # typedef struct {uint8_t _dont_touch_that[GODOT_VECTOR3_SIZE];} pandemonium_vector3;
# `GODOT_VECTOR3_SIZE` gets resolved as `sizeof(void*)` :( # `GODOT_VECTOR3_SIZE` gets resolved as `sizeof(void*)` :(
if node.type.declname == "_dont_touch_that": if node.type.declname == "_dont_touch_that":
# Of course the 0 size is wrong, but it's not an issue given # Of course the 0 size is wrong, but it's not an issue given
@ -357,7 +357,7 @@ if __name__ == "__main__":
pxd_cdef = p.lines() pxd_cdef = p.lines()
# Remove the cdef part given we want to add the `nogil` option and # Remove the cdef part given we want to add the `nogil` option and
# we also want to add the `godot_method_flags` C inline code # we also want to add the `pandemonium_method_flags` C inline code
assert pxd_cdef[0].startswith("cdef extern from") assert pxd_cdef[0].startswith("cdef extern from")
pxd_cdef_body = "\n".join(pxd_cdef[1:]) pxd_cdef_body = "\n".join(pxd_cdef[1:])
@ -382,10 +382,10 @@ cdef extern from "{header_name}" nogil:
GODOT_METHOD_FLAG_FROM_SCRIPT = 64, GODOT_METHOD_FLAG_FROM_SCRIPT = 64,
GODOT_METHOD_FLAG_VARARG = 128, GODOT_METHOD_FLAG_VARARG = 128,
GODOT_METHOD_FLAGS_DEFAULT = GODOT_METHOD_FLAG_NORMAL GODOT_METHOD_FLAGS_DEFAULT = GODOT_METHOD_FLAG_NORMAL
}} godot_method_flags; }} pandemonium_method_flags;
\"\"\" \"\"\"
ctypedef enum godot_method_flags: ctypedef enum pandemonium_method_flags:
GODOT_METHOD_FLAG_NORMAL = 1 GODOT_METHOD_FLAG_NORMAL = 1
GODOT_METHOD_FLAG_EDITOR = 2 GODOT_METHOD_FLAG_EDITOR = 2
GODOT_METHOD_FLAG_NOSCRIPT = 4 GODOT_METHOD_FLAG_NOSCRIPT = 4

View File

@ -23,23 +23,23 @@ class TypeItem:
TYPES = [ TYPES = [
# Base types # Base types
TypeItem( TypeItem(
gd_pool=f"godot_pool_int_array", gd_pool=f"pandemonium_pool_int_array",
py_pool=f"PoolIntArray", py_pool=f"PoolIntArray",
gd_value=f"godot_int", gd_value=f"pandemonium_int",
py_value=f"godot_int", py_value=f"pandemonium_int",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
), ),
TypeItem( TypeItem(
gd_pool=f"godot_pool_real_array", gd_pool=f"pandemonium_pool_real_array",
py_pool=f"PoolRealArray", py_pool=f"PoolRealArray",
gd_value=f"godot_real", gd_value=f"pandemonium_real",
py_value=f"godot_real", py_value=f"pandemonium_real",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
), ),
TypeItem( TypeItem(
gd_pool="godot_pool_byte_array", gd_pool="pandemonium_pool_byte_array",
py_pool="PoolByteArray", py_pool="PoolByteArray",
gd_value="uint8_t", gd_value="uint8_t",
py_value="uint8_t", py_value="uint8_t",
@ -48,34 +48,34 @@ TYPES = [
), ),
# Stack only builtin types # Stack only builtin types
TypeItem( TypeItem(
gd_pool=f"godot_pool_vector2_array", gd_pool=f"pandemonium_pool_vector2_array",
py_pool=f"PoolVector2Array", py_pool=f"PoolVector2Array",
gd_value=f"godot_vector2", gd_value=f"pandemonium_vector2",
py_value=f"Vector2", py_value=f"Vector2",
is_base_type=False, is_base_type=False,
is_stack_only=True, is_stack_only=True,
), ),
TypeItem( TypeItem(
gd_pool=f"godot_pool_vector3_array", gd_pool=f"pandemonium_pool_vector3_array",
py_pool=f"PoolVector3Array", py_pool=f"PoolVector3Array",
gd_value=f"godot_vector3", gd_value=f"pandemonium_vector3",
py_value=f"Vector3", py_value=f"Vector3",
is_base_type=False, is_base_type=False,
is_stack_only=True, is_stack_only=True,
), ),
TypeItem( TypeItem(
gd_pool=f"godot_pool_color_array", gd_pool=f"pandemonium_pool_color_array",
py_pool=f"PoolColorArray", py_pool=f"PoolColorArray",
gd_value=f"godot_color", gd_value=f"pandemonium_color",
py_value=f"Color", py_value=f"Color",
is_base_type=False, is_base_type=False,
is_stack_only=True, is_stack_only=True,
), ),
# Stack&heap builtin types # Stack&heap builtin types
TypeItem( TypeItem(
gd_pool="godot_pool_string_array", gd_pool="pandemonium_pool_string_array",
py_pool="PoolStringArray", py_pool="PoolStringArray",
gd_value="godot_string", gd_value="pandemonium_string",
py_value="GDString", py_value="GDString",
is_base_type=False, is_base_type=False,
is_stack_only=False, is_stack_only=False,

View File

@ -2,8 +2,8 @@
{% if type['gd_value'] == type['py_value'] %} {% if type['gd_value'] == type['py_value'] %}
{{ dst }} = {{ src }} {{ dst }} = {{ src }}
{% else %} {% else %}
dst = godot_string_to_pyobj(&src) dst = pandemonium_string_to_pyobj(&src)
gdapi10.godot_string_destroy(&src) gdapi10.pandemonium_string_destroy(&src)
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
@ -61,10 +61,10 @@ cdef class {{ t.py_pool }}:
# Operators # Operators
def __getitem__(self, index): def __getitem__(self, index):
cdef godot_int size = self.size() cdef pandemonium_int size = self.size()
cdef godot_int start cdef pandemonium_int start
cdef godot_int stop cdef pandemonium_int stop
cdef godot_int step cdef pandemonium_int step
if isinstance(index, slice): if isinstance(index, slice):
step = index.step if index.step is not None else 1 step = index.step if index.step is not None else 1
if step == 0: if step == 0:
@ -87,7 +87,7 @@ cdef class {{ t.py_pool }}:
raise IndexError("list index out of range") raise IndexError("list index out of range")
return self.operator_getitem(index) return self.operator_getitem(index)
cdef inline {{ t.py_value }} operator_getitem(self, godot_int index): cdef inline {{ t.py_value }} operator_getitem(self, pandemonium_int index):
{% if t.is_base_type %} {% if t.is_base_type %}
return gdapi10.{{ t.gd_pool }}_get(&self._gd_data, index) return gdapi10.{{ t.gd_pool }}_get(&self._gd_data, index)
{% else %} {% else %}
@ -96,9 +96,9 @@ cdef class {{ t.py_pool }}:
return ret return ret
{% endif %} {% endif %}
cdef inline {{ t.py_pool }} operator_getslice(self, godot_int start, godot_int stop, godot_int step): cdef inline {{ t.py_pool }} operator_getslice(self, pandemonium_int start, pandemonium_int stop, pandemonium_int step):
cdef {{ t.py_pool }} ret = {{ t.py_pool }}.new() cdef {{ t.py_pool }} ret = {{ t.py_pool }}.new()
cdef godot_int size = self.size() cdef pandemonium_int size = self.size()
if start > size - 1: if start > size - 1:
start = size - 1 start = size - 1
@ -136,7 +136,7 @@ cdef class {{ t.py_pool }}:
) )
cdef const {{ t.gd_value }} *src_ptr = gdapi10.{{ t.gd_pool }}_read_access_ptr(src_access) cdef const {{ t.gd_value }} *src_ptr = gdapi10.{{ t.gd_pool }}_read_access_ptr(src_access)
cdef {{ t.gd_value }} *dst_ptr = gdapi10.{{ t.gd_pool }}_write_access_ptr(dst_access) cdef {{ t.gd_value }} *dst_ptr = gdapi10.{{ t.gd_pool }}_write_access_ptr(dst_access)
cdef godot_int i cdef pandemonium_int i
for i in range(items): for i in range(items):
{% if t.is_stack_only %} {% if t.is_stack_only %}
dst_ptr[i] = src_ptr[i * step + start] dst_ptr[i] = src_ptr[i * step + start]
@ -150,8 +150,8 @@ cdef class {{ t.py_pool }}:
return ret return ret
# TODO: support slice # TODO: support slice
def __setitem__(self, godot_int index, {{ t.py_value }} value): def __setitem__(self, pandemonium_int index, {{ t.py_value }} value):
cdef godot_int size cdef pandemonium_int size
size = self.size() size = self.size()
if index < 0: if index < 0:
index += size index += size
@ -164,8 +164,8 @@ cdef class {{ t.py_pool }}:
{% endif %} {% endif %}
# TODO: support slice # TODO: support slice
def __delitem__(self, godot_int index): def __delitem__(self, pandemonium_int index):
cdef godot_int size cdef pandemonium_int size
size = self.size() size = self.size()
if index < 0: if index < 0:
index += size index += size
@ -218,8 +218,8 @@ cdef class {{ t.py_pool }}:
cdef inline bint operator_equal(self, {{ t.py_pool }} other): cdef inline bint operator_equal(self, {{ t.py_pool }} other):
if other is None: if other is None:
return False return False
# TODO `godot_array_operator_equal` is missing in gdapi, submit a PR ? # TODO `pandemonium_array_operator_equal` is missing in gdapi, submit a PR ?
cdef godot_int size = self.size() cdef pandemonium_int size = self.size()
if size != other.size(): if size != other.size():
return False return False
@ -231,7 +231,7 @@ cdef class {{ t.py_pool }}:
) )
cdef const {{ t.gd_value }} *a_ptr = gdapi10.{{ t.gd_pool }}_read_access_ptr(a_access) cdef const {{ t.gd_value }} *a_ptr = gdapi10.{{ t.gd_pool }}_read_access_ptr(a_access)
cdef const {{ t.gd_value }} *b_ptr = gdapi10.{{ t.gd_pool }}_read_access_ptr(b_access) cdef const {{ t.gd_value }} *b_ptr = gdapi10.{{ t.gd_pool }}_read_access_ptr(b_access)
cdef godot_int i cdef pandemonium_int i
cdef bint ret = True cdef bint ret = True
for i in range(size): for i in range(size):
{% if t.is_base_type %} {% if t.is_base_type %}
@ -273,10 +273,10 @@ cdef class {{ t.py_pool }}:
gdapi10.{{ t.gd_pool }}_push_back(&self._gd_data, &data._gd_data) gdapi10.{{ t.gd_pool }}_push_back(&self._gd_data, &data._gd_data)
{% endif %} {% endif %}
cpdef inline void resize(self, godot_int size): cpdef inline void resize(self, pandemonium_int size):
gdapi10.{{ t.gd_pool }}_resize(&self._gd_data, size) gdapi10.{{ t.gd_pool }}_resize(&self._gd_data, size)
cdef inline godot_int size(self): cdef inline pandemonium_int size(self):
return gdapi10.{{ t.gd_pool }}_size(&self._gd_data) return gdapi10.{{ t.gd_pool }}_size(&self._gd_data)
# Raw access # Raw access

View File

@ -23,7 +23,7 @@ class TypeSpec:
is_base_type: bool = False is_base_type: bool = False
# Type doesn't use the heap (hence no need for freeing it) # Type doesn't use the heap (hence no need for freeing it)
is_stack_only: bool = False is_stack_only: bool = False
# Type is an enum (e.g. godot_error, Camera::KeepAspect) # Type is an enum (e.g. pandemonium_error, Camera::KeepAspect)
is_enum: bool = False is_enum: bool = False
@property @property
@ -32,7 +32,7 @@ class TypeSpec:
@property @property
def is_variant(self) -> bool: def is_variant(self) -> bool:
return self.c_type == "godot_variant" return self.c_type == "pandemonium_variant"
def __post_init__(self): def __post_init__(self):
self.py_type = self.py_type or self.cy_type self.py_type = self.py_type or self.cy_type
@ -50,22 +50,22 @@ TYPE_VOID = TypeSpec(
) )
TYPE_BOOL = TypeSpec( TYPE_BOOL = TypeSpec(
gdapi_type="bool", gdapi_type="bool",
c_type="godot_bool", c_type="pandemonium_bool",
cy_type="bint", cy_type="bint",
py_type="bool", py_type="bool",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_INT = TypeSpec( TYPE_INT = TypeSpec(
gdapi_type="int", c_type="godot_int", cy_type="int", is_base_type=True, is_stack_only=True gdapi_type="int", c_type="pandemonium_int", cy_type="int", is_base_type=True, is_stack_only=True
) )
TYPE_FLOAT = TypeSpec( TYPE_FLOAT = TypeSpec(
gdapi_type="float", c_type="godot_real", cy_type="float", is_base_type=True, is_stack_only=True gdapi_type="float", c_type="pandemonium_real", cy_type="float", is_base_type=True, is_stack_only=True
) )
TYPE_ERROR = TypeSpec( TYPE_ERROR = TypeSpec(
gdapi_type="enum.Error", gdapi_type="enum.Error",
c_type="godot_error", c_type="pandemonium_error",
cy_type="godot_error", cy_type="pandemonium_error",
py_type="Error", py_type="Error",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -73,8 +73,8 @@ TYPE_ERROR = TypeSpec(
) )
TYPE_VECTOR2_AXIS = TypeSpec( TYPE_VECTOR2_AXIS = TypeSpec(
gdapi_type="enum.Vector2::Axis", gdapi_type="enum.Vector2::Axis",
c_type="godot_vector2_axis", c_type="pandemonium_vector2_axis",
cy_type="godot_vector2_axis", cy_type="pandemonium_vector2_axis",
py_type="Vector2.Axis", py_type="Vector2.Axis",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -82,8 +82,8 @@ TYPE_VECTOR2_AXIS = TypeSpec(
) )
TYPE_VECTOR2I_AXIS = TypeSpec( TYPE_VECTOR2I_AXIS = TypeSpec(
gdapi_type="enum.Vector2i::Axis", gdapi_type="enum.Vector2i::Axis",
c_type="godot_vector2i_axis", c_type="pandemonium_vector2i_axis",
cy_type="godot_vector2i_axis", cy_type="pandemonium_vector2i_axis",
py_type="Vector2i.Axis", py_type="Vector2i.Axis",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -91,8 +91,8 @@ TYPE_VECTOR2I_AXIS = TypeSpec(
) )
TYPE_VECTOR3_AXIS = TypeSpec( TYPE_VECTOR3_AXIS = TypeSpec(
gdapi_type="enum.Vector3::Axis", gdapi_type="enum.Vector3::Axis",
c_type="godot_vector3_axis", c_type="pandemonium_vector3_axis",
cy_type="godot_vector3_axis", cy_type="pandemonium_vector3_axis",
py_type="Vector3.Axis", py_type="Vector3.Axis",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -100,8 +100,8 @@ TYPE_VECTOR3_AXIS = TypeSpec(
) )
TYPE_VECTOR3I_AXIS = TypeSpec( TYPE_VECTOR3I_AXIS = TypeSpec(
gdapi_type="enum.Vector3i::Axis", gdapi_type="enum.Vector3i::Axis",
c_type="godot_vector3i_axis", c_type="pandemonium_vector3i_axis",
cy_type="godot_vector3i_axis", cy_type="pandemonium_vector3i_axis",
py_type="Vector3i.Axis", py_type="Vector3i.Axis",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -109,8 +109,8 @@ TYPE_VECTOR3I_AXIS = TypeSpec(
) )
TYPE_VECTOR4_AXIS = TypeSpec( TYPE_VECTOR4_AXIS = TypeSpec(
gdapi_type="enum.Vector4::Axis", gdapi_type="enum.Vector4::Axis",
c_type="godot_vector4_axis", c_type="pandemonium_vector4_axis",
cy_type="godot_vector4_axis", cy_type="pandemonium_vector4_axis",
py_type="Vector4.Axis", py_type="Vector4.Axis",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -118,8 +118,8 @@ TYPE_VECTOR4_AXIS = TypeSpec(
) )
TYPE_VECTOR4I_AXIS = TypeSpec( TYPE_VECTOR4I_AXIS = TypeSpec(
gdapi_type="enum.Vector4i::Axis", gdapi_type="enum.Vector4i::Axis",
c_type="godot_vector4i_axis", c_type="pandemonium_vector4i_axis",
cy_type="godot_vector4i_axis", cy_type="pandemonium_vector4i_axis",
py_type="Vector4i.Axis", py_type="Vector4i.Axis",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -136,8 +136,8 @@ TYPE_PROJECTION_PLANES = TypeSpec(
) )
TYPE_VARIANT_TYPE = TypeSpec( TYPE_VARIANT_TYPE = TypeSpec(
gdapi_type="enum.Variant::Type", gdapi_type="enum.Variant::Type",
c_type="godot_variant_type", c_type="pandemonium_variant_type",
cy_type="godot_variant_type", cy_type="pandemonium_variant_type",
py_type="VariantType", py_type="VariantType",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -145,8 +145,8 @@ TYPE_VARIANT_TYPE = TypeSpec(
) )
TYPE_VARIANT_OPERATOR = TypeSpec( TYPE_VARIANT_OPERATOR = TypeSpec(
gdapi_type="enum.Variant::Operator", gdapi_type="enum.Variant::Operator",
c_type="godot_variant_operator", c_type="pandemonium_variant_operator",
cy_type="godot_variant_operator", cy_type="pandemonium_variant_operator",
py_type="VariantOperator", py_type="VariantOperator",
is_base_type=True, is_base_type=True,
is_stack_only=True, is_stack_only=True,
@ -155,11 +155,11 @@ TYPE_VARIANT_OPERATOR = TypeSpec(
# Stack&heap types # Stack&heap types
TYPE_VARIANT = TypeSpec( TYPE_VARIANT = TypeSpec(
gdapi_type="Variant", c_type="godot_variant", cy_type="object", is_builtin=True gdapi_type="Variant", c_type="pandemonium_variant", cy_type="object", is_builtin=True
) )
TYPE_STRING = TypeSpec( TYPE_STRING = TypeSpec(
gdapi_type="String", gdapi_type="String",
c_type="godot_string", c_type="pandemonium_string",
cy_type="GDString", cy_type="GDString",
py_type="Union[str, GDString]", py_type="Union[str, GDString]",
is_builtin=True, is_builtin=True,
@ -167,27 +167,27 @@ TYPE_STRING = TypeSpec(
# Stack only types # Stack only types
TYPE_AABB = TypeSpec( TYPE_AABB = TypeSpec(
gdapi_type="AABB", c_type="godot_aabb", cy_type="AABB", is_builtin=True, is_stack_only=True gdapi_type="AABB", c_type="pandemonium_aabb", cy_type="AABB", is_builtin=True, is_stack_only=True
) )
TYPE_ARRAY = TypeSpec( TYPE_ARRAY = TypeSpec(
gdapi_type="Array", c_type="godot_array", cy_type="Array", is_builtin=True, is_stack_only=True gdapi_type="Array", c_type="pandemonium_array", cy_type="Array", is_builtin=True, is_stack_only=True
) )
TYPE_BASIS = TypeSpec( TYPE_BASIS = TypeSpec(
gdapi_type="Basis", c_type="godot_basis", cy_type="Basis", is_builtin=True, is_stack_only=True gdapi_type="Basis", c_type="pandemonium_basis", cy_type="Basis", is_builtin=True, is_stack_only=True
) )
TYPE_COLOR = TypeSpec( TYPE_COLOR = TypeSpec(
gdapi_type="Color", c_type="godot_color", cy_type="Color", is_builtin=True, is_stack_only=True gdapi_type="Color", c_type="pandemonium_color", cy_type="Color", is_builtin=True, is_stack_only=True
) )
TYPE_DICTIONARY = TypeSpec( TYPE_DICTIONARY = TypeSpec(
gdapi_type="Dictionary", gdapi_type="Dictionary",
c_type="godot_dictionary", c_type="pandemonium_dictionary",
cy_type="Dictionary", cy_type="Dictionary",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_NODEPATH = TypeSpec( TYPE_NODEPATH = TypeSpec(
gdapi_type="NodePath", gdapi_type="NodePath",
c_type="godot_node_path", c_type="pandemonium_node_path",
cy_type="NodePath", cy_type="NodePath",
py_type="Union[str, NodePath]", py_type="Union[str, NodePath]",
is_builtin=True, is_builtin=True,
@ -195,163 +195,163 @@ TYPE_NODEPATH = TypeSpec(
) )
TYPE_STRING_NAME = TypeSpec( TYPE_STRING_NAME = TypeSpec(
gdapi_type="StringName", gdapi_type="StringName",
c_type="godot_string_name", c_type="pandemonium_string_name",
cy_type="StringName", cy_type="StringName",
py_type="Union[str, StringName]", py_type="Union[str, StringName]",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_PLANE = TypeSpec( TYPE_PLANE = TypeSpec(
gdapi_type="Plane", c_type="godot_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_QUAT = TypeSpec( TYPE_QUAT = TypeSpec(
gdapi_type="Quat", c_type="godot_quat", cy_type="Quat", is_builtin=True, is_stack_only=True gdapi_type="Quat", c_type="pandemonium_quat", cy_type="Quat", is_builtin=True, is_stack_only=True
) )
TYPE_RECT2 = TypeSpec( TYPE_RECT2 = TypeSpec(
gdapi_type="Rect2", c_type="godot_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
) )
TYPE_RECT2I = TypeSpec( TYPE_RECT2I = TypeSpec(
gdapi_type="Rect2i", c_type="godot_rect2i", cy_type="Rect2i", is_builtin=True, is_stack_only=True gdapi_type="Rect2i", c_type="pandemonium_rect2i", cy_type="Rect2i", is_builtin=True, is_stack_only=True
) )
TYPE_RID = TypeSpec( TYPE_RID = TypeSpec(
gdapi_type="RID", c_type="godot_rid", cy_type="RID", is_builtin=True, is_stack_only=True gdapi_type="RID", c_type="pandemonium_rid", cy_type="RID", is_builtin=True, is_stack_only=True
) )
TYPE_TRANSFORM = TypeSpec( TYPE_TRANSFORM = TypeSpec(
gdapi_type="Transform", gdapi_type="Transform",
c_type="godot_transform", c_type="pandemonium_transform",
cy_type="Transform", cy_type="Transform",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_TRANSFORM2D = TypeSpec( TYPE_TRANSFORM2D = TypeSpec(
gdapi_type="Transform2D", gdapi_type="Transform2D",
c_type="godot_transform2d", c_type="pandemonium_transform2d",
cy_type="Transform2D", cy_type="Transform2D",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_PROJECTION = TypeSpec( TYPE_PROJECTION = TypeSpec(
gdapi_type="Projection", gdapi_type="Projection",
c_type="godot_projection", c_type="pandemonium_projection",
cy_type="Projection", cy_type="Projection",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_VECTOR2 = TypeSpec( TYPE_VECTOR2 = TypeSpec(
gdapi_type="Vector2", gdapi_type="Vector2",
c_type="godot_vector2", c_type="pandemonium_vector2",
cy_type="Vector2", cy_type="Vector2",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_VECTOR2I = TypeSpec( TYPE_VECTOR2I = TypeSpec(
gdapi_type="Vector2i", gdapi_type="Vector2i",
c_type="godot_vector2i", c_type="pandemonium_vector2i",
cy_type="Vector2i", cy_type="Vector2i",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_VECTOR3 = TypeSpec( TYPE_VECTOR3 = TypeSpec(
gdapi_type="Vector3", gdapi_type="Vector3",
c_type="godot_vector3", c_type="pandemonium_vector3",
cy_type="Vector3", cy_type="Vector3",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_VECTOR3I = TypeSpec( TYPE_VECTOR3I = TypeSpec(
gdapi_type="Vector3i", gdapi_type="Vector3i",
c_type="godot_vector3i", c_type="pandemonium_vector3i",
cy_type="Vector3i", cy_type="Vector3i",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_VECTOR4 = TypeSpec( TYPE_VECTOR4 = TypeSpec(
gdapi_type="Vector4", gdapi_type="Vector4",
c_type="godot_vector4", c_type="pandemonium_vector4",
cy_type="Vector4", cy_type="Vector4",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_VECTOR4I = TypeSpec( TYPE_VECTOR4I = TypeSpec(
gdapi_type="Vector4i", gdapi_type="Vector4i",
c_type="godot_vector4i", c_type="pandemonium_vector4i",
cy_type="Vector4i", cy_type="Vector4i",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLBYTEARRAY = TypeSpec( TYPE_POOLBYTEARRAY = TypeSpec(
gdapi_type="PoolByteArray", gdapi_type="PoolByteArray",
c_type="godot_pool_byte_array", c_type="pandemonium_pool_byte_array",
cy_type="PoolByteArray", cy_type="PoolByteArray",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLINTARRAY = TypeSpec( TYPE_POOLINTARRAY = TypeSpec(
gdapi_type="PoolIntArray", gdapi_type="PoolIntArray",
c_type="godot_pool_int_array", c_type="pandemonium_pool_int_array",
cy_type="PoolIntArray", cy_type="PoolIntArray",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLREALARRAY = TypeSpec( TYPE_POOLREALARRAY = TypeSpec(
gdapi_type="PoolRealArray", gdapi_type="PoolRealArray",
c_type="godot_pool_real_array", c_type="pandemonium_pool_real_array",
cy_type="PoolRealArray", cy_type="PoolRealArray",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLSTRINGARRAY = TypeSpec( TYPE_POOLSTRINGARRAY = TypeSpec(
gdapi_type="PoolStringArray", gdapi_type="PoolStringArray",
c_type="godot_pool_string_array", c_type="pandemonium_pool_string_array",
cy_type="PoolStringArray", cy_type="PoolStringArray",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLVECTOR2ARRAY = TypeSpec( TYPE_POOLVECTOR2ARRAY = TypeSpec(
gdapi_type="PoolVector2Array", gdapi_type="PoolVector2Array",
c_type="godot_pool_vector2_array", c_type="pandemonium_pool_vector2_array",
cy_type="PoolVector2Array", cy_type="PoolVector2Array",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLVECTOR2IARRAY = TypeSpec( TYPE_POOLVECTOR2IARRAY = TypeSpec(
gdapi_type="PoolVector2iArray", gdapi_type="PoolVector2iArray",
c_type="godot_pool_vector2i_array", c_type="pandemonium_pool_vector2i_array",
cy_type="PoolVector2iArray", cy_type="PoolVector2iArray",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLVECTOR3ARRAY = TypeSpec( TYPE_POOLVECTOR3ARRAY = TypeSpec(
gdapi_type="PoolVector3Array", gdapi_type="PoolVector3Array",
c_type="godot_pool_vector3_array", c_type="pandemonium_pool_vector3_array",
cy_type="PoolVector3Array", cy_type="PoolVector3Array",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLVECTOR3IARRAY = TypeSpec( TYPE_POOLVECTOR3IARRAY = TypeSpec(
gdapi_type="PoolVector3iArray", gdapi_type="PoolVector3iArray",
c_type="godot_pool_vector3i_array", c_type="pandemonium_pool_vector3i_array",
cy_type="PoolVector3iArray", cy_type="PoolVector3iArray",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLVECTOR4ARRAY = TypeSpec( TYPE_POOLVECTOR4ARRAY = TypeSpec(
gdapi_type="PoolVector4Array", gdapi_type="PoolVector4Array",
c_type="godot_pool_vector4_array", c_type="pandemonium_pool_vector4_array",
cy_type="PoolVector4Array", cy_type="PoolVector4Array",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLVECTOR4IARRAY = TypeSpec( TYPE_POOLVECTOR4IARRAY = TypeSpec(
gdapi_type="PoolVector4iArray", gdapi_type="PoolVector4iArray",
c_type="godot_pool_vector4i_array", c_type="pandemonium_pool_vector4i_array",
cy_type="PoolVector4iArray", cy_type="PoolVector4iArray",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,
) )
TYPE_POOLCOLORARRAY = TypeSpec( TYPE_POOLCOLORARRAY = TypeSpec(
gdapi_type="PoolColorArray", gdapi_type="PoolColorArray",
c_type="godot_pool_color_array", c_type="pandemonium_pool_color_array",
cy_type="PoolColorArray", cy_type="PoolColorArray",
is_builtin=True, is_builtin=True,
is_stack_only=True, is_stack_only=True,

View File

@ -2,7 +2,7 @@
singleton=true singleton=true
load_once=true load_once=true
symbol_prefix="godot_" symbol_prefix="pandemonium_"
[entry] [entry]

View File

@ -10,7 +10,7 @@ from SCons.Errors import UserError
Import("env") Import("env")
def resolve_godot_download_url(major, minor, patch, extra, platform): def resolve_pandemonium_download_url(major, minor, patch, extra, platform):
version = f"{major}.{minor}.{patch}" if patch != 0 else f"{major}.{minor}" version = f"{major}.{minor}.{patch}" if patch != 0 else f"{major}.{minor}"
if extra == "stable": if extra == "stable":
return f"https://downloads.tuxfamily.org/godotengine/{version}/Godot_v{version}-{extra}_{platform}.zip" return f"https://downloads.tuxfamily.org/godotengine/{version}/Godot_v{version}-{extra}_{platform}.zip"
@ -18,7 +18,7 @@ def resolve_godot_download_url(major, minor, patch, extra, platform):
return f"https://downloads.tuxfamily.org/godotengine/{version}/{extra}/Godot_v{version}-{extra}_{platform}.zip" return f"https://downloads.tuxfamily.org/godotengine/{version}/{extra}/Godot_v{version}-{extra}_{platform}.zip"
def resolve_godot_binary_name(major, minor, patch, extra, platform): def resolve_pandemonium_binary_name(major, minor, patch, extra, platform):
version = f"{major}.{minor}.{patch}" if patch != 0 else f"{major}.{minor}" version = f"{major}.{minor}.{patch}" if patch != 0 else f"{major}.{minor}"
return f"Godot_v{version}-{extra}_{platform}" return f"Godot_v{version}-{extra}_{platform}"
@ -26,7 +26,7 @@ def resolve_godot_binary_name(major, minor, patch, extra, platform):
SConscript([f"{env['platform']}/SConscript"]) SConscript([f"{env['platform']}/SConscript"])
# Platform-dependant variables # Platform-dependant variables
assert "bits" in env assert "bits" in env
assert "godot_binary_download_platform" in env assert "pandemonium_binary_download_platform" in env
assert "cpython_build" in env assert "cpython_build" in env
assert "cpython_build_dir" in env assert "cpython_build_dir" in env
assert "DIST_SITE_PACKAGES" in env assert "DIST_SITE_PACKAGES" in env
@ -76,33 +76,33 @@ env.AddMethod(install_as, "InstallAs")
### Godot binary (to run tests) ### ### Godot binary (to run tests) ###
if not env["godot_binary"]: if not env["pandemonium_binary"]:
godot_download_url = resolve_godot_download_url( pandemonium_download_url = resolve_pandemonium_download_url(
*env["godot_binary_download_version"], env["godot_binary_download_platform"] *env["pandemonium_binary_download_version"], env["pandemonium_binary_download_platform"]
) )
godot_binary_name = resolve_godot_binary_name( pandemonium_binary_name = resolve_pandemonium_binary_name(
*env["godot_binary_download_version"], env["godot_binary_download_platform"] *env["pandemonium_binary_download_version"], env["pandemonium_binary_download_platform"]
) )
env["godot_binary"] = File(godot_binary_name) env["pandemonium_binary"] = File(pandemonium_binary_name)
godot_binary_zip_path = env.get("godot_binary_download_zip_path", godot_binary_name) pandemonium_binary_zip_path = env.get("pandemonium_binary_download_zip_path", pandemonium_binary_name)
def download_and_extract(target, source, env): def download_and_extract(target, source, env):
try: try:
with urlopen(godot_download_url) as rep: with urlopen(pandemonium_download_url) as rep:
zipfile = ZipFile(BytesIO(rep.read())) zipfile = ZipFile(BytesIO(rep.read()))
except HTTPError as exc: except HTTPError as exc:
# It seems SCons swallows HTTPError, so we have to wrap it # It seems SCons swallows HTTPError, so we have to wrap it
raise UserError(exc) from exc raise UserError(exc) from exc
if godot_binary_zip_path not in zipfile.namelist(): if pandemonium_binary_zip_path not in zipfile.namelist():
raise UserError(f"Archive doesn't contain {godot_binary_zip_path}") raise UserError(f"Archive doesn't contain {pandemonium_binary_zip_path}")
with open(target[0].abspath, "wb") as fd: with open(target[0].abspath, "wb") as fd:
fd.write(zipfile.open(godot_binary_zip_path).read()) fd.write(zipfile.open(pandemonium_binary_zip_path).read())
if env["HOST_OS"] != "win32": if env["HOST_OS"] != "win32":
os.chmod(target[0].abspath, 0o755) os.chmod(target[0].abspath, 0o755)
env.Command( env.Command(
env["godot_binary"], env["pandemonium_binary"],
None, None,
Action(download_and_extract, f"Download&extract {godot_download_url}"), Action(download_and_extract, f"Download&extract {pandemonium_download_url}"),
) )
env.NoClean(env["godot_binary"]) env.NoClean(env["pandemonium_binary"])

View File

@ -13,8 +13,8 @@ cpython_build = Dir("cpython_build")
env["bits"] = "64" env["bits"] = "64"
env["godot_binary_download_platform"] = "osx.64" env["pandemonium_binary_download_platform"] = "osx.64"
env["godot_binary_download_zip_path"] = "Godot.app/Contents/MacOS/Godot" env["pandemonium_binary_download_zip_path"] = "Godot.app/Contents/MacOS/Godot"
env["cpython_build"] = cpython_build env["cpython_build"] = cpython_build
env["cpython_build_dir"] = cpython_build env["cpython_build_dir"] = cpython_build
env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/lib/python3.8/site-packages") env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/lib/python3.8/site-packages")

View File

@ -13,7 +13,7 @@ cpython_build = Dir("cpython_build")
env["bits"] = "32" env["bits"] = "32"
env["godot_binary_download_platform"] = "win32.exe" env["pandemonium_binary_download_platform"] = "win32.exe"
env["cpython_build"] = cpython_build env["cpython_build"] = cpython_build
env["cpython_build_dir"] = cpython_build env["cpython_build_dir"] = cpython_build
env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/Lib/site-packages") env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/Lib/site-packages")

View File

@ -13,7 +13,7 @@ cpython_build = Dir("cpython_build")
env["bits"] = "64" env["bits"] = "64"
env["godot_binary_download_platform"] = "win64.exe" env["pandemonium_binary_download_platform"] = "win64.exe"
env["cpython_build"] = cpython_build env["cpython_build"] = cpython_build
env["cpython_build_dir"] = cpython_build env["cpython_build_dir"] = cpython_build
env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/Lib/site-packages") env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/Lib/site-packages")

View File

@ -14,9 +14,9 @@ cpython_build = Dir("cpython_build")
env["bits"] = "64" env["bits"] = "64"
if env["headless"]: if env["headless"]:
env["godot_binary_download_platform"] = "linux_headless.64" env["pandemonium_binary_download_platform"] = "linux_headless.64"
else: else:
env["godot_binary_download_platform"] = "x11.64" env["pandemonium_binary_download_platform"] = "x11.64"
env["cpython_build"] = cpython_build env["cpython_build"] = cpython_build
env["cpython_build_dir"] = cpython_build env["cpython_build_dir"] = cpython_build
env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/lib/python3.8/site-packages") env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/lib/python3.8/site-packages")

View File

@ -32,17 +32,17 @@ env.AppendUnique(CYTHON_COMPILE_DEPS=[libpythonscript])
SConscript(["godot/SConscript"]) SConscript(["godot/SConscript"])
# `_godot_api.h` is only for internal use between _godot and pythonscript # `_pandemonium_api.h` is only for internal use between _godot and pythonscript
# libraries, hence no need to provide it as part of the release # libraries, hence no need to provide it as part of the release
*mods, _ = env.CythonModule( *mods, _ = env.CythonModule(
["_godot", "_godot_api.h"], ["_godot", "_pandemonium_api.h"],
[ [
"_godot.pyx", "_godot.pyx",
"_godot_editor.pxi", "_pandemonium_editor.pxi",
"_godot_instance.pxi", "_pandemonium_instance.pxi",
"_godot_profiling.pxi", "_pandemonium_profiling.pxi",
"_godot_script.pxi", "_pandemonium_script.pxi",
"_godot_io.pxi", "_pandemonium_io.pxi",
], ],
) )
env.Install("$DIST_SITE_PACKAGES", mods) env.Install("$DIST_SITE_PACKAGES", mods)

View File

@ -5,15 +5,15 @@
# only expose C functions. # only expose C functions.
# Beside this module depend on the `godot.hazmat` module so it would be a bad # Beside this module depend on the `godot.hazmat` module so it would be a bad
# idea to make the `godot` module depend on it... # idea to make the `godot` module depend on it...
include "_godot_editor.pxi" include "_pandemonium_editor.pxi"
include "_godot_profiling.pxi" include "_pandemonium_profiling.pxi"
include "_godot_script.pxi" include "_pandemonium_script.pxi"
include "_godot_instance.pxi" include "_pandemonium_instance.pxi"
include "_godot_io.pxi" include "_pandemonium_io.pxi"
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_gdnative_init_options, pandemonium_gdnative_init_options,
godot_pluginscript_language_data, pandemonium_pluginscript_language_data,
) )
from godot._hazmat.internal cimport set_pythonscript_verbose, get_pythonscript_verbose from godot._hazmat.internal cimport set_pythonscript_verbose, get_pythonscript_verbose
from godot.builtins cimport GDString from godot.builtins cimport GDString
@ -35,7 +35,7 @@ def _setup_config_entry(name, default_value):
return ProjectSettings.get_setting(gdname) return ProjectSettings.get_setting(gdname)
cdef api godot_pluginscript_language_data *pythonscript_init() with gil: cdef api pandemonium_pluginscript_language_data *pythonscript_init() with gil:
# Pass argv arguments # Pass argv arguments
sys.argv = ["godot"] + [str(x) for x in OS.get_cmdline_args()] sys.argv = ["godot"] + [str(x) for x in OS.get_cmdline_args()]
@ -66,9 +66,9 @@ cdef api godot_pluginscript_language_data *pythonscript_init() with gil:
return NULL return NULL
cdef api void pythonscript_finish(godot_pluginscript_language_data *data) with gil: cdef api void pythonscript_finish(pandemonium_pluginscript_language_data *data) with gil:
# /!\ When this function is called, the Python interpreter is fully operational # /!\ When this function is called, the Python interpreter is fully operational
# and might be running user-created threads doing concurrent stuff. # and might be running user-created threads doing concurrent stuff.
# That will continue until `godot_gdnative_terminate` is called (which is # That will continue until `pandemonium_gdnative_terminate` is called (which is
# responsible for the actual teardown of the interpreter). # responsible for the actual teardown of the interpreter).
pass pass

View File

@ -3,35 +3,35 @@
from libc.stddef cimport wchar_t from libc.stddef cimport wchar_t
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_pluginscript_language_data, pandemonium_pluginscript_language_data,
godot_string, pandemonium_string,
godot_bool, pandemonium_bool,
godot_array, pandemonium_array,
godot_pool_string_array, pandemonium_pool_string_array,
godot_object, pandemonium_object,
godot_variant, pandemonium_variant,
godot_error, pandemonium_error,
godot_dictionary pandemonium_dictionary
) )
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10 from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
from godot._hazmat.conversion cimport ( from godot._hazmat.conversion cimport (
godot_string_to_pyobj, pandemonium_string_to_pyobj,
pyobj_to_godot_string, pyobj_to_pandemonium_string,
godot_variant_to_pyobj, pandemonium_variant_to_pyobj,
) )
cdef api godot_string pythonscript_get_template_source_code( cdef api pandemonium_string pythonscript_get_template_source_code(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
const godot_string *p_class_name, const pandemonium_string *p_class_name,
const godot_string *p_base_class_name const pandemonium_string *p_base_class_name
) with gil: ) with gil:
cdef str class_name cdef str class_name
if p_class_name == NULL: if p_class_name == NULL:
class_name = "MyExportedCls" class_name = "MyExportedCls"
else: else:
class_name = godot_string_to_pyobj(p_class_name) class_name = pandemonium_string_to_pyobj(p_class_name)
cdef str base_class_name = godot_string_to_pyobj(p_base_class_name) cdef str base_class_name = pandemonium_string_to_pyobj(p_base_class_name)
cdef str src = f"""from godot import exposed, export cdef str src = f"""from godot import exposed, export
from godot import * from godot import *
@ -50,73 +50,73 @@ class {class_name}({base_class_name}):
\"\"\" \"\"\"
pass pass
""" """
cdef godot_string ret cdef pandemonium_string ret
pyobj_to_godot_string(src, &ret) pyobj_to_pandemonium_string(src, &ret)
return ret return ret
cdef api godot_bool pythonscript_validate( cdef api pandemonium_bool pythonscript_validate(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
const godot_string *p_script, const pandemonium_string *p_script,
int *r_line_error, int *r_line_error,
int *r_col_error, int *r_col_error,
godot_string *r_test_error, pandemonium_string *r_test_error,
const godot_string *p_path, const pandemonium_string *p_path,
godot_pool_string_array *r_functions pandemonium_pool_string_array *r_functions
) with gil: ) with gil:
return True return True
cdef api int pythonscript_find_function( cdef api int pythonscript_find_function(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
const godot_string *p_function, const pandemonium_string *p_function,
const godot_string *p_code const pandemonium_string *p_code
) with gil: ) with gil:
return 0 return 0
cdef api godot_string pythonscript_make_function( cdef api pandemonium_string pythonscript_make_function(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
const godot_string *p_class, const pandemonium_string *p_class,
const godot_string *p_name, const pandemonium_string *p_name,
const godot_pool_string_array *p_args const pandemonium_pool_string_array *p_args
) with gil: ) with gil:
cdef str name = godot_string_to_pyobj(p_name) cdef str name = pandemonium_string_to_pyobj(p_name)
# TODO: replace this with PoolStringArray binding once implemented # TODO: replace this with PoolStringArray binding once implemented
cdef int i cdef int i
cdef godot_string gdarg cdef pandemonium_string gdarg
cdef list args_names = [] cdef list args_names = []
for i in range(gdapi10.godot_pool_string_array_size(p_args)): for i in range(gdapi10.pandemonium_pool_string_array_size(p_args)):
gdarg = gdapi10.godot_pool_string_array_get(p_args, i) gdarg = gdapi10.pandemonium_pool_string_array_get(p_args, i)
arg = godot_string_to_pyobj(&gdarg) arg = pandemonium_string_to_pyobj(&gdarg)
gdapi10.godot_string_destroy(&gdarg) gdapi10.pandemonium_string_destroy(&gdarg)
args_names.append(arg.split(":", 1)[0]) args_names.append(arg.split(":", 1)[0])
cdef str src = """\ cdef str src = """\
def {name}(self, { ','.join(args_names) }): def {name}(self, { ','.join(args_names) }):
pass pass
""" """
cdef godot_string ret cdef pandemonium_string ret
pyobj_to_godot_string(src, &ret) pyobj_to_pandemonium_string(src, &ret)
return ret return ret
cdef api godot_error pythonscript_complete_code( cdef api pandemonium_error pythonscript_complete_code(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
const godot_string *p_code, const pandemonium_string *p_code,
const godot_string *p_base_path, const pandemonium_string *p_base_path,
godot_object *p_owner, pandemonium_object *p_owner,
godot_array *r_options, pandemonium_array *r_options,
godot_bool *r_force, pandemonium_bool *r_force,
godot_string *r_call_hint pandemonium_string *r_call_hint
) with gil: ) with gil:
return godot_error.GODOT_OK return pandemonium_error.GODOT_OK
cdef api void pythonscript_auto_indent_code( cdef api void pythonscript_auto_indent_code(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
godot_string *p_code, pandemonium_string *p_code,
int p_from_line, int p_from_line,
int p_to_line int p_to_line
) with gil: ) with gil:
@ -128,16 +128,16 @@ cdef api void pythonscript_auto_indent_code(
# "[Pythonscript] Auto indent requires module `autopep8`, " # "[Pythonscript] Auto indent requires module `autopep8`, "
# "install it with `pip install autopep8`" # "install it with `pip install autopep8`"
# ) # )
# pycode = godot_string_to_pyobj(code).splitlines() # pycode = pandemonium_string_to_pyobj(code).splitlines()
# before = "\n".join(pycode[:from_line]) # before = "\n".join(pycode[:from_line])
# to_fix = "\n".join(pycode[from_line:to_line]) # to_fix = "\n".join(pycode[from_line:to_line])
# after = "\n".join(pycode[to_line:]) # after = "\n".join(pycode[to_line:])
# fixed = autopep8.fix_code(to_fix) # fixed = autopep8.fix_code(to_fix)
# final_code = "\n".join((before, fixed, after)) # final_code = "\n".join((before, fixed, after))
# # TODO: modify code instead of replace it when binding on godot_string # # TODO: modify code instead of replace it when binding on pandemonium_string
# # operation is available # # operation is available
# lib.godot_string_destroy(code) # lib.pandemonium_string_destroy(code)
# lib.godot_string_new_unicode_data(code, final_code, len(final_code)) # lib.pandemonium_string_new_unicode_data(code, final_code, len(final_code))
pass pass
@ -145,64 +145,64 @@ __global_constants = {}
cdef api void pythonscript_add_global_constant( cdef api void pythonscript_add_global_constant(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
const godot_string *p_variable, const pandemonium_string *p_variable,
const godot_variant *p_value const pandemonium_variant *p_value
) with gil: ) with gil:
# However, Godot add global constants very early (first as an empty variant # However, Godot add global constants very early (first as an empty variant
# placeholder before any script is loaded, then as a proper loaded script). # placeholder before any script is loaded, then as a proper loaded script).
# So it's possible this function get called before `pythonscript_script_init` # So it's possible this function get called before `pythonscript_script_init`
# (which is supposed to do the lazy `_initialize_bindings`). # (which is supposed to do the lazy `_initialize_bindings`).
_initialize_bindings() _initialize_bindings()
name = godot_string_to_pyobj(p_variable) name = pandemonium_string_to_pyobj(p_variable)
value = godot_variant_to_pyobj(p_value) value = pandemonium_variant_to_pyobj(p_value)
__global_constants[name] = value __global_constants[name] = value
cdef api godot_string pythonscript_debug_get_error( cdef api pandemonium_string pythonscript_debug_get_error(
godot_pluginscript_language_data *p_data pandemonium_pluginscript_language_data *p_data
) with gil: ) with gil:
cdef godot_string ret cdef pandemonium_string ret
pyobj_to_godot_string("Nothing", &ret) pyobj_to_pandemonium_string("Nothing", &ret)
return ret return ret
cdef api int pythonscript_debug_get_stack_level_count( cdef api int pythonscript_debug_get_stack_level_count(
godot_pluginscript_language_data *p_data pandemonium_pluginscript_language_data *p_data
) with gil: ) with gil:
return 1 return 1
cdef api int pythonscript_debug_get_stack_level_line( cdef api int pythonscript_debug_get_stack_level_line(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
int p_level int p_level
) with gil: ) with gil:
return 1 return 1
cdef api godot_string pythonscript_debug_get_stack_level_function( cdef api pandemonium_string pythonscript_debug_get_stack_level_function(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
int p_level int p_level
) with gil: ) with gil:
cdef godot_string ret cdef pandemonium_string ret
pyobj_to_godot_string("Nothing", &ret) pyobj_to_pandemonium_string("Nothing", &ret)
return ret return ret
cdef api godot_string pythonscript_debug_get_stack_level_source( cdef api pandemonium_string pythonscript_debug_get_stack_level_source(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
int p_level int p_level
) with gil: ) with gil:
cdef godot_string ret cdef pandemonium_string ret
pyobj_to_godot_string("Nothing", &ret) pyobj_to_pandemonium_string("Nothing", &ret)
return ret return ret
cdef api void pythonscript_debug_get_stack_level_locals( cdef api void pythonscript_debug_get_stack_level_locals(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
int p_level, int p_level,
godot_pool_string_array *p_locals, pandemonium_pool_string_array *p_locals,
godot_array *p_values, pandemonium_array *p_values,
int p_max_subitems, int p_max_subitems,
int p_max_depth int p_max_depth
) with gil: ) with gil:
@ -210,10 +210,10 @@ cdef api void pythonscript_debug_get_stack_level_locals(
cdef api void pythonscript_debug_get_stack_level_members( cdef api void pythonscript_debug_get_stack_level_members(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
int p_level, int p_level,
godot_pool_string_array *p_members, pandemonium_pool_string_array *p_members,
godot_array *p_values, pandemonium_array *p_values,
int p_max_subitems, int p_max_subitems,
int p_max_depth int p_max_depth
) with gil: ) with gil:
@ -221,36 +221,36 @@ cdef api void pythonscript_debug_get_stack_level_members(
cdef api void pythonscript_debug_get_globals( cdef api void pythonscript_debug_get_globals(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
godot_pool_string_array *p_locals, pandemonium_pool_string_array *p_locals,
godot_array *p_values, pandemonium_array *p_values,
int p_max_subitems, int p_max_subitems,
int p_max_depth int p_max_depth
) with gil: ) with gil:
pass pass
cdef api godot_string pythonscript_debug_parse_stack_level_expression( cdef api pandemonium_string pythonscript_debug_parse_stack_level_expression(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
int p_level, int p_level,
const godot_string *p_expression, const pandemonium_string *p_expression,
int p_max_subitems, int p_max_subitems,
int p_max_depth int p_max_depth
) with gil: ) with gil:
cdef godot_string ret cdef pandemonium_string ret
pyobj_to_godot_string("Nothing", &ret) pyobj_to_pandemonium_string("Nothing", &ret)
return ret return ret
cdef api void pythonscript_get_public_functions( cdef api void pythonscript_get_public_functions(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
godot_array *r_functions pandemonium_array *r_functions
) with gil: ) with gil:
pass pass
cdef api void pythonscript_get_public_constants( cdef api void pythonscript_get_public_constants(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
godot_dictionary *r_constants pandemonium_dictionary *r_constants
) with gil: ) with gil:
pass pass

View File

@ -4,31 +4,31 @@ from libc.stddef cimport wchar_t
from cpython cimport Py_INCREF, Py_DECREF, PyObject from cpython cimport Py_INCREF, Py_DECREF, PyObject
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_string, pandemonium_string,
godot_string_name, pandemonium_string_name,
godot_bool, pandemonium_bool,
godot_array, pandemonium_array,
godot_pool_string_array, pandemonium_pool_string_array,
godot_object, pandemonium_object,
godot_variant, pandemonium_variant,
godot_variant_call_error, pandemonium_variant_call_error,
godot_method_rpc_mode, pandemonium_method_rpc_mode,
godot_pluginscript_script_data, pandemonium_pluginscript_script_data,
godot_pluginscript_instance_data, pandemonium_pluginscript_instance_data,
godot_variant_call_error_error, pandemonium_variant_call_error_error,
godot_variant_type, pandemonium_variant_type,
) )
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10 from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
from godot._hazmat.conversion cimport ( from godot._hazmat.conversion cimport (
godot_variant_to_pyobj, pandemonium_variant_to_pyobj,
pyobj_to_godot_variant, pyobj_to_pandemonium_variant,
godot_string_name_to_pyobj, pandemonium_string_name_to_pyobj,
) )
cdef api godot_pluginscript_instance_data* pythonscript_instance_init( cdef api pandemonium_pluginscript_instance_data* pythonscript_instance_init(
godot_pluginscript_script_data *p_data, pandemonium_pluginscript_script_data *p_data,
godot_object *p_owner pandemonium_object *p_owner
) with gil: ) with gil:
cdef object instance = (<object>p_data)() cdef object instance = (<object>p_data)()
(<Object>instance)._gd_ptr = p_owner (<Object>instance)._gd_ptr = p_owner
@ -37,18 +37,18 @@ cdef api godot_pluginscript_instance_data* pythonscript_instance_init(
cdef api void pythonscript_instance_finish( cdef api void pythonscript_instance_finish(
godot_pluginscript_instance_data *p_data pandemonium_pluginscript_instance_data *p_data
) with gil: ) with gil:
Py_DECREF(<object>p_data) Py_DECREF(<object>p_data)
cdef api godot_bool pythonscript_instance_set_prop( cdef api pandemonium_bool pythonscript_instance_set_prop(
godot_pluginscript_instance_data *p_data, pandemonium_pluginscript_instance_data *p_data,
const godot_string *p_name, const pandemonium_string *p_name,
const godot_variant *p_value const pandemonium_variant *p_value
) with gil: ) with gil:
cdef object instance = <object>p_data cdef object instance = <object>p_data
cdef str key = godot_string_to_pyobj(p_name) cdef str key = pandemonium_string_to_pyobj(p_name)
# Should look among properties added by the script and it parents, # Should look among properties added by the script and it parents,
# not Godot native properties that are handled by the caller # not Godot native properties that are handled by the caller
@ -60,22 +60,22 @@ cdef api godot_bool pythonscript_instance_set_prop(
return False return False
try: try:
setattr(instance, key, godot_variant_to_pyobj(p_value)) setattr(instance, key, pandemonium_variant_to_pyobj(p_value))
return True return True
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
return False return False
cdef api godot_bool pythonscript_instance_get_prop( cdef api pandemonium_bool pythonscript_instance_get_prop(
godot_pluginscript_instance_data *p_data, pandemonium_pluginscript_instance_data *p_data,
const godot_string *p_name, const pandemonium_string *p_name,
godot_variant *r_ret pandemonium_variant *r_ret
) with gil: ) with gil:
cdef object instance = <object>p_data cdef object instance = <object>p_data
cdef object ret cdef object ret
cdef object field cdef object field
cdef str key = godot_string_to_pyobj(p_name) cdef str key = pandemonium_string_to_pyobj(p_name)
# Should look among properties added by the script and it parents, # Should look among properties added by the script and it parents,
# not Godot native properties that are handled by the caller # not Godot native properties that are handled by the caller
@ -86,8 +86,8 @@ cdef api godot_bool pythonscript_instance_get_prop(
try: try:
if isinstance(field, ExportedField): if isinstance(field, ExportedField):
ret = getattr(instance, godot_string_to_pyobj(p_name)) ret = getattr(instance, pandemonium_string_to_pyobj(p_name))
pyobj_to_godot_variant(ret, r_ret) pyobj_to_pandemonium_variant(ret, r_ret)
elif isinstance(field, SignalField): elif isinstance(field, SignalField):
# TODO: Not sure how to create a Variant::Signal from GDNative # TODO: Not sure how to create a Variant::Signal from GDNative
return False return False
@ -101,57 +101,57 @@ cdef api godot_bool pythonscript_instance_get_prop(
return False return False
cdef api godot_variant pythonscript_instance_call_method( cdef api pandemonium_variant pythonscript_instance_call_method(
godot_pluginscript_instance_data *p_data, pandemonium_pluginscript_instance_data *p_data,
const godot_string_name *p_method, const pandemonium_string_name *p_method,
const godot_variant **p_args, const pandemonium_variant **p_args,
int p_argcount, int p_argcount,
godot_variant_call_error *r_error pandemonium_variant_call_error *r_error
) with gil: ) with gil:
cdef godot_variant var_ret cdef pandemonium_variant var_ret
cdef object instance = <object>p_data cdef object instance = <object>p_data
cdef object fn cdef object fn
cdef str key = godot_string_name_to_pyobj(p_method) cdef str key = pandemonium_string_name_to_pyobj(p_method)
# TODO: optimize this by caching godot_string_name -> method lookup # TODO: optimize this by caching pandemonium_string_name -> method lookup
fn = instance.__exported.get(key) fn = instance.__exported.get(key)
if not callable(fn): if not callable(fn):
r_error.error = godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD r_error.error = pandemonium_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD
gdapi10.godot_variant_new_nil(&var_ret) gdapi10.pandemonium_variant_new_nil(&var_ret)
return var_ret return var_ret
cdef int i cdef int i
cdef list pyargs cdef list pyargs
cdef object ret cdef object ret
try: try:
pyargs = [godot_variant_to_pyobj(p_args[i]) for i in range(p_argcount)] pyargs = [pandemonium_variant_to_pyobj(p_args[i]) for i in range(p_argcount)]
ret = fn(instance, *pyargs) ret = fn(instance, *pyargs)
r_error.error = godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_OK r_error.error = pandemonium_variant_call_error_error.GODOT_CALL_ERROR_CALL_OK
pyobj_to_godot_variant(ret, &var_ret) pyobj_to_pandemonium_variant(ret, &var_ret)
return var_ret return var_ret
except NotImplementedError: except NotImplementedError:
r_error.error = godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD r_error.error = pandemonium_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD
except TypeError: except TypeError:
traceback.print_exc() traceback.print_exc()
# TODO: handle errors here # TODO: handle errors here
r_error.error = godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT r_error.error = pandemonium_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT
r_error.argument = 1 r_error.argument = 1
r_error.expected = godot_variant_type.GODOT_VARIANT_TYPE_NIL r_error.expected = pandemonium_variant_type.GODOT_VARIANT_TYPE_NIL
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
r_error.error = godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD r_error.error = pandemonium_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD
# TODO: also catch other exceptions types ? # TODO: also catch other exceptions types ?
# Something bad occured, return a default None variant # Something bad occured, return a default None variant
gdapi10.godot_variant_new_nil(&var_ret) gdapi10.pandemonium_variant_new_nil(&var_ret)
return var_ret return var_ret
cdef api void pythonscript_instance_notification( cdef api void pythonscript_instance_notification(
godot_pluginscript_instance_data *p_data, pandemonium_pluginscript_instance_data *p_data,
int p_notification int p_notification
) with gil: ) with gil:
cdef object instance = <object>p_data cdef object instance = <object>p_data
@ -170,12 +170,12 @@ cdef api void pythonscript_instance_notification(
# Useful ? # Useful ?
# cdef api void pythonscript_instance_refcount_incremented( # cdef api void pythonscript_instance_refcount_incremented(
# godot_pluginscript_instance_data *p_data # pandemonium_pluginscript_instance_data *p_data
# ) with gil: # ) with gil:
# pass # pass
# cdef api bool pythonscript_instance_refcount_decremented( # cdef api bool pythonscript_instance_refcount_decremented(
# godot_pluginscript_instance_data *p_data # pandemonium_pluginscript_instance_data *p_data
# ) with gil: # ) with gil:
# pass # pass

View File

@ -5,33 +5,33 @@ from io import TextIOBase
from threading import Lock from threading import Lock
from godot._hazmat.conversion cimport ( from godot._hazmat.conversion cimport (
godot_string_to_pyobj, pandemonium_string_to_pyobj,
pyobj_to_godot_string, pyobj_to_pandemonium_string,
godot_variant_to_pyobj, pandemonium_variant_to_pyobj,
) )
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_string, pandemonium_string,
godot_string_name, pandemonium_string_name,
godot_bool, pandemonium_bool,
godot_array, pandemonium_array,
godot_pool_string_array, pandemonium_pool_string_array,
godot_object, pandemonium_object,
godot_variant, pandemonium_variant,
godot_variant_call_error, pandemonium_variant_call_error,
godot_method_rpc_mode, pandemonium_method_rpc_mode,
godot_pluginscript_script_data, pandemonium_pluginscript_script_data,
godot_pluginscript_instance_data, pandemonium_pluginscript_instance_data,
godot_variant_call_error_error, pandemonium_variant_call_error_error,
godot_variant_type pandemonium_variant_type
) )
cpdef inline void godot_print(str pystr): cpdef inline void pandemonium_print(str pystr):
cdef godot_string gdstr cdef pandemonium_string gdstr
pyobj_to_godot_string(pystr, &gdstr) pyobj_to_pandemonium_string(pystr, &gdstr)
with nogil: with nogil:
gdapi10.godot_print(&gdstr) gdapi10.pandemonium_print(&gdstr)
gdapi10.godot_string_destroy(&gdstr) gdapi10.pandemonium_string_destroy(&gdstr)
class StdinCapture(TextIOBase): class StdinCapture(TextIOBase):
@ -112,11 +112,11 @@ class StdoutStderrCaptureToGodot(StdoutStderrCapture):
self.buffer = "" self.buffer = ""
def _write(self, buff): def _write(self, buff):
cdef godot_string gdstr cdef pandemonium_string gdstr
pyobj_to_godot_string(buff, &gdstr) pyobj_to_pandemonium_string(buff, &gdstr)
with nogil: with nogil:
gdapi10.godot_print(&gdstr) gdapi10.pandemonium_print(&gdstr)
gdapi10.godot_string_destroy(&gdstr) gdapi10.pandemonium_string_destroy(&gdstr)
cdef _capture_io_streams = None cdef _capture_io_streams = None

View File

@ -1,8 +1,8 @@
# cython: c_string_type=unicode, c_string_encoding=utf8 # cython: c_string_type=unicode, c_string_encoding=utf8
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_pluginscript_language_data, pandemonium_pluginscript_language_data,
godot_pluginscript_profiling_data, pandemonium_pluginscript_profiling_data,
) )
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10 from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
@ -11,7 +11,7 @@ from collections import defaultdict
from time import perf_counter from time import perf_counter
# TODO: should be greatly improved by using cdef struct and godot_string_name everywhere # TODO: should be greatly improved by using cdef struct and pandemonium_string_name everywhere
class MethProfile: class MethProfile:
@ -134,7 +134,7 @@ cdef object profiler = None
cdef api void pythonscript_profiling_start( cdef api void pythonscript_profiling_start(
godot_pluginscript_language_data *p_data pandemonium_pluginscript_language_data *p_data
) with gil: ) with gil:
global profiler global profiler
profiler = Profiler() profiler = Profiler()
@ -142,7 +142,7 @@ cdef api void pythonscript_profiling_start(
cdef api void pythonscript_profiling_stop( cdef api void pythonscript_profiling_stop(
godot_pluginscript_language_data *p_data pandemonium_pluginscript_language_data *p_data
) with gil: ) with gil:
global profiler global profiler
profiler = None profiler = None
@ -150,8 +150,8 @@ cdef api void pythonscript_profiling_stop(
cdef api int pythonscript_profiling_get_accumulated_data( cdef api int pythonscript_profiling_get_accumulated_data(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
godot_pluginscript_profiling_data *r_info, pandemonium_pluginscript_profiling_data *r_info,
int p_info_max int p_info_max
) with gil: ) with gil:
# Sort function to make sure we can display the most consuming ones # Sort function to make sure we can display the most consuming ones
@ -162,7 +162,7 @@ cdef api int pythonscript_profiling_get_accumulated_data(
cdef object signature cdef object signature
cdef object profile cdef object profile
for i, (signature, profile) in enumerate(sorted_and_limited): for i, (signature, profile) in enumerate(sorted_and_limited):
pyobj_to_godot_string_name(signature, &r_info[i].signature) pyobj_to_pandemonium_string_name(signature, &r_info[i].signature)
r_info[i].call_count = profile.call_count r_info[i].call_count = profile.call_count
r_info[i].total_time = int(profile.total_time * 1e6) r_info[i].total_time = int(profile.total_time * 1e6)
r_info[i].self_time = int(profile.self_time * 1e6) r_info[i].self_time = int(profile.self_time * 1e6)
@ -170,8 +170,8 @@ cdef api int pythonscript_profiling_get_accumulated_data(
cdef api int pythonscript_profiling_get_frame_data( cdef api int pythonscript_profiling_get_frame_data(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
godot_pluginscript_profiling_data *r_info, pandemonium_pluginscript_profiling_data *r_info,
int p_info_max int p_info_max
) with gil: ) with gil:
# Sort function to make sure we can display the most consuming ones # Sort function to make sure we can display the most consuming ones
@ -182,7 +182,7 @@ cdef api int pythonscript_profiling_get_frame_data(
cdef object signature cdef object signature
cdef object profile cdef object profile
for i, (signature, profile) in enumerate(sorted_and_limited): for i, (signature, profile) in enumerate(sorted_and_limited):
pyobj_to_godot_string_name(signature, &r_info[i].signature) pyobj_to_pandemonium_string_name(signature, &r_info[i].signature)
r_info[i].call_count = profile.last_frame_call_count r_info[i].call_count = profile.last_frame_call_count
r_info[i].total_time = int(profile.last_frame_total_time * 1e6) r_info[i].total_time = int(profile.last_frame_total_time * 1e6)
r_info[i].self_time = int(profile.last_frame_self_time * 1e6) r_info[i].self_time = int(profile.last_frame_self_time * 1e6)
@ -190,7 +190,7 @@ cdef api int pythonscript_profiling_get_frame_data(
cdef api void pythonscript_profiling_frame( cdef api void pythonscript_profiling_frame(
godot_pluginscript_language_data *p_data pandemonium_pluginscript_language_data *p_data
) with gil: ) with gil:
if profiler is not None: if profiler is not None:
profiler.next_frame() profiler.next_frame()

View File

@ -5,17 +5,17 @@ import importlib
from cpython.ref cimport PyObject from cpython.ref cimport PyObject
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_pluginscript_language_data, pandemonium_pluginscript_language_data,
godot_string, pandemonium_string,
godot_bool, pandemonium_bool,
godot_array, pandemonium_array,
godot_pool_string_array, pandemonium_pool_string_array,
godot_object, pandemonium_object,
godot_variant, pandemonium_variant,
godot_error, pandemonium_error,
godot_string_name, pandemonium_string_name,
godot_pluginscript_script_data, pandemonium_pluginscript_script_data,
godot_pluginscript_script_manifest, pandemonium_pluginscript_script_manifest,
GODOT_OK, GODOT_OK,
GODOT_ERR_UNAVAILABLE, GODOT_ERR_UNAVAILABLE,
GODOT_ERR_FILE_BAD_PATH, GODOT_ERR_FILE_BAD_PATH,
@ -25,10 +25,10 @@ from godot._hazmat.gdnative_api_struct cimport (
) )
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10 from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
from godot._hazmat.conversion cimport ( from godot._hazmat.conversion cimport (
godot_string_to_pyobj, pandemonium_string_to_pyobj,
pyobj_to_godot_string, pyobj_to_pandemonium_string,
pyobj_to_godot_string_name, pyobj_to_pandemonium_string_name,
pytype_to_godot_type, pytype_to_pandemonium_type,
) )
from godot._hazmat.internal cimport ( from godot._hazmat.internal cimport (
get_pythonscript_verbose, get_pythonscript_verbose,
@ -45,16 +45,16 @@ import traceback
from godot.tags import ExportedField, SignalField from godot.tags import ExportedField, SignalField
cdef inline godot_pluginscript_script_manifest _build_empty_script_manifest(): cdef inline pandemonium_pluginscript_script_manifest _build_empty_script_manifest():
cdef godot_pluginscript_script_manifest manifest cdef pandemonium_pluginscript_script_manifest manifest
manifest.data = NULL manifest.data = NULL
gdapi10.godot_string_name_new_data(&manifest.name, "") gdapi10.pandemonium_string_name_new_data(&manifest.name, "")
manifest.is_tool = False manifest.is_tool = False
gdapi10.godot_string_name_new_data(&manifest.base, "") gdapi10.pandemonium_string_name_new_data(&manifest.base, "")
gdapi10.godot_dictionary_new(&manifest.member_lines) gdapi10.pandemonium_dictionary_new(&manifest.member_lines)
gdapi10.godot_array_new(&manifest.methods) gdapi10.pandemonium_array_new(&manifest.methods)
gdapi10.godot_array_new(&manifest.signals) gdapi10.pandemonium_array_new(&manifest.signals)
gdapi10.godot_array_new(&manifest.properties) gdapi10.pandemonium_array_new(&manifest.properties)
return manifest return manifest
@ -88,7 +88,7 @@ cdef Dictionary _build_method_info(object meth, object methname):
cdef Dictionary _build_property_info(object prop): cdef Dictionary _build_property_info(object prop):
cdef Dictionary propinfo = Dictionary() cdef Dictionary propinfo = Dictionary()
propinfo["name"] = prop.name propinfo["name"] = prop.name
propinfo["type"] = pytype_to_godot_type(prop.type) propinfo["type"] = pytype_to_pandemonium_type(prop.type)
propinfo["hint"] = prop.hint propinfo["hint"] = prop.hint
propinfo["hint_string"] = prop.hint_string propinfo["hint_string"] = prop.hint_string
propinfo["usage"] = prop.usage propinfo["usage"] = prop.usage
@ -105,26 +105,26 @@ cdef inline object is_method(object meth):
return False return False
cdef godot_pluginscript_script_manifest _build_script_manifest(object cls): cdef pandemonium_pluginscript_script_manifest _build_script_manifest(object cls):
cdef godot_pluginscript_script_manifest manifest cdef pandemonium_pluginscript_script_manifest manifest
# No need to increase refcount here given `cls` is guaranteed to be kept # No need to increase refcount here given `cls` is guaranteed to be kept
# until we call `destroy_exposed_class` # until we call `destroy_exposed_class`
manifest.data = <PyObject*>cls manifest.data = <PyObject*>cls
pyobj_to_godot_string_name(cls.__name__, &manifest.name) pyobj_to_pandemonium_string_name(cls.__name__, &manifest.name)
manifest.is_tool = cls.__tool manifest.is_tool = cls.__tool
gdapi10.godot_dictionary_new(&manifest.member_lines) gdapi10.pandemonium_dictionary_new(&manifest.member_lines)
if cls.__bases__: if cls.__bases__:
# Only one Godot parent class (checked at class definition time) # Only one Godot parent class (checked at class definition time)
godot_parent_class = next( pandemonium_parent_class = next(
(b for b in cls.__bases__ if issubclass(b, Object)) (b for b in cls.__bases__ if issubclass(b, Object))
) )
if not godot_parent_class.__dict__.get("__exposed_python_class"): if not pandemonium_parent_class.__dict__.get("__exposed_python_class"):
base = godot_parent_class.__name__ base = pandemonium_parent_class.__name__
else: else:
# Pluginscript wants us to return the parent as a path # Pluginscript wants us to return the parent as a path
base = f"res://{godot_parent_class.__module__.replace('.', '/')}.py" base = f"res://{pandemonium_parent_class.__module__.replace('.', '/')}.py"
pyobj_to_godot_string_name(base, &manifest.base) pyobj_to_pandemonium_string_name(base, &manifest.base)
methods = Array() methods = Array()
signals = Array() signals = Array()
@ -137,25 +137,25 @@ cdef godot_pluginscript_script_manifest _build_script_manifest(object cls):
else: else:
assert is_method(v) assert is_method(v)
methods.append(_build_method_info(v, k)) methods.append(_build_method_info(v, k))
gdapi10.godot_array_new_copy(&manifest.methods, &methods._gd_data) gdapi10.pandemonium_array_new_copy(&manifest.methods, &methods._gd_data)
gdapi10.godot_array_new_copy(&manifest.signals, &signals._gd_data) gdapi10.pandemonium_array_new_copy(&manifest.signals, &signals._gd_data)
gdapi10.godot_array_new_copy(&manifest.properties, &properties._gd_data) gdapi10.pandemonium_array_new_copy(&manifest.properties, &properties._gd_data)
return manifest return manifest
cdef api godot_pluginscript_script_manifest pythonscript_script_init( cdef api pandemonium_pluginscript_script_manifest pythonscript_script_init(
godot_pluginscript_language_data *p_data, pandemonium_pluginscript_language_data *p_data,
const godot_string *p_path, const pandemonium_string *p_path,
const godot_string *p_source, const pandemonium_string *p_source,
godot_error *r_error pandemonium_error *r_error
) with gil: ) with gil:
# Godot class&singleton are not all available at Pythonscript bootstrap. # Godot class&singleton are not all available at Pythonscript bootstrap.
# Hence we wait until the Pythonscript start being actually used (i.e. until # Hence we wait until the Pythonscript start being actually used (i.e. until
# the first Python script is loaded) before initializing the bindings. # the first Python script is loaded) before initializing the bindings.
_initialize_bindings() _initialize_bindings()
cdef object path = godot_string_to_pyobj(p_path) cdef object path = pandemonium_string_to_pyobj(p_path)
if get_pythonscript_verbose(): if get_pythonscript_verbose():
print(f"Loading python script from {path}") print(f"Loading python script from {path}")
@ -223,7 +223,7 @@ cdef api godot_pluginscript_script_manifest pythonscript_script_init(
cdef api void pythonscript_script_finish( cdef api void pythonscript_script_finish(
godot_pluginscript_script_data *p_data pandemonium_pluginscript_script_data *p_data
) with gil: ) with gil:
cdef object cls = <object>p_data cdef object cls = <object>p_data
if get_pythonscript_verbose(): if get_pythonscript_verbose():

View File

@ -25,28 +25,28 @@ env.Install("$DIST_SITE_PACKAGES/godot", env.CythonModule("tags", "tags.pyx"))
# TODO: merge pool_arrays into builtins # TODO: merge pool_arrays into builtins
godot_pool_arrays_srcs = env.Command( pandemonium_pool_arrays_srcs = env.Command(
target=("pool_arrays.pyx", "pool_arrays.pxd"), target=("pool_arrays.pyx", "pool_arrays.pxd"),
source=("#/generation/generate_pool_arrays.py",), source=("#/generation/generate_pool_arrays.py",),
action="python ${SOURCE} --output ${TARGET}", action="python ${SOURCE} --output ${TARGET}",
) )
env.Depends( env.Depends(
godot_pool_arrays_srcs, pandemonium_pool_arrays_srcs,
["#/generation/generate_pool_arrays.py", env.Glob("#/generation/pool_arrays_templates/*")], ["#/generation/generate_pool_arrays.py", env.Glob("#/generation/pool_arrays_templates/*")],
) )
godot_builtins_srcs = env.Command( pandemonium_builtins_srcs = env.Command(
target=("builtins.pyx", "builtins.pxd"), target=("builtins.pyx", "builtins.pxd"),
source=("#/generation/generate_builtins.py", "${pandemonium_headers}/gdnative_api.json"), source=("#/generation/generate_builtins.py", "${pandemonium_headers}/gdnative_api.json"),
action="python ${SOURCES[0]} --input ${SOURCES[1]} --output ${TARGET}", action="python ${SOURCES[0]} --input ${SOURCES[1]} --output ${TARGET}",
) )
env.Depends( env.Depends(
godot_builtins_srcs, pandemonium_builtins_srcs,
["#/generation/generate_builtins.py", env.Glob("#/generation/builtins_templates/*")], ["#/generation/generate_builtins.py", env.Glob("#/generation/builtins_templates/*")],
) )
# TODO: remove this once pool_array is merged into builtins # TODO: remove this once pool_array is merged into builtins
env.Depends(godot_builtins_srcs, godot_pool_arrays_srcs) env.Depends(pandemonium_builtins_srcs, pandemonium_pool_arrays_srcs)
env.Install("$DIST_SITE_PACKAGES/godot", env.CythonModule("pool_arrays", "pool_arrays.pyx")) env.Install("$DIST_SITE_PACKAGES/godot", env.CythonModule("pool_arrays", "pool_arrays.pyx"))
@ -82,14 +82,14 @@ else:
bindings_env.AppendUnique(CFLAGS=["/Os"]) bindings_env.AppendUnique(CFLAGS=["/Os"])
godot_bindings_srcs = bindings_env.Command( pandemonium_bindings_srcs = bindings_env.Command(
target=("bindings.pyx", "bindings.pxd", "bindings.pyi"), target=("bindings.pyx", "bindings.pxd", "bindings.pyi"),
source=("#/generation/generate_bindings.py", "${pandemonium_headers}/api.json"), source=("#/generation/generate_bindings.py", "${pandemonium_headers}/api.json"),
action=("python ${SOURCES[0]} ${opts} --input ${SOURCES[1]} --output ${TARGET} "), action=("python ${SOURCES[0]} ${opts} --input ${SOURCES[1]} --output ${TARGET} "),
opts="--sample" if sample else "", opts="--sample" if sample else "",
) )
bindings_env.Depends( bindings_env.Depends(
godot_bindings_srcs, pandemonium_bindings_srcs,
["#/generation/generate_bindings.py", bindings_env.Glob("#/generation/bindings_templates/*")], ["#/generation/generate_bindings.py", bindings_env.Glob("#/generation/bindings_templates/*")],
) )

View File

@ -3,12 +3,12 @@ from libc.stdio cimport printf
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10 from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_string, pandemonium_string,
godot_string_name, pandemonium_string_name,
godot_int, pandemonium_int,
godot_vector2, pandemonium_vector2,
godot_variant, pandemonium_variant,
godot_variant_type, pandemonium_variant_type,
) )
from godot.builtins cimport GDString, NodePath from godot.builtins cimport GDString, NodePath
@ -27,15 +27,15 @@ ELSE:
DEF _STRING_CODEPOINT_LENGTH = 4 DEF _STRING_CODEPOINT_LENGTH = 4
cdef inline str godot_string_to_pyobj(const godot_string *p_gdstr): cdef inline str pandemonium_string_to_pyobj(const pandemonium_string *p_gdstr):
# TODO: unicode&windows support is most likely broken... # TODO: unicode&windows support is most likely broken...
cdef char *raw = <char*>gdapi10.godot_string_wide_str(p_gdstr) cdef char *raw = <char*>gdapi10.pandemonium_string_wide_str(p_gdstr)
cdef godot_int length = gdapi10.godot_string_length(p_gdstr) cdef pandemonium_int length = gdapi10.pandemonium_string_length(p_gdstr)
return raw[:length * _STRING_CODEPOINT_LENGTH].decode(_STRING_ENCODING) return raw[:length * _STRING_CODEPOINT_LENGTH].decode(_STRING_ENCODING)
# cdef char *raw = <char*>gdapi10.godot_string_wide_str(p_gdstr) # cdef char *raw = <char*>gdapi10.pandemonium_string_wide_str(p_gdstr)
# cdef godot_int length = gdapi10.godot_string_length(p_gdstr) # cdef pandemonium_int length = gdapi10.pandemonium_string_length(p_gdstr)
# printf("==========> godot_string_to_pyobj ") # printf("==========> pandemonium_string_to_pyobj ")
# cdef int i # cdef int i
# for i in range(length): # for i in range(length):
# printf("%c ", raw[i * 4]); # printf("%c ", raw[i * 4]);
@ -45,34 +45,34 @@ cdef inline str godot_string_to_pyobj(const godot_string *p_gdstr):
# return ret # return ret
cdef inline void pyobj_to_godot_string(str pystr, godot_string *p_gdstr): cdef inline void pyobj_to_pandemonium_string(str pystr, pandemonium_string *p_gdstr):
# TODO: unicode&windows support is most likely broken... # TODO: unicode&windows support is most likely broken...
cdef bytes raw = pystr.encode(_STRING_ENCODING) cdef bytes raw = pystr.encode(_STRING_ENCODING)
gdapi10.godot_string_new_with_wide_string( gdapi10.pandemonium_string_new_with_wide_string(
p_gdstr, (<wchar_t*><char*>raw), len(pystr) p_gdstr, (<wchar_t*><char*>raw), len(pystr)
) )
cdef inline str godot_string_name_to_pyobj(const godot_string_name *p_gdname): cdef inline str pandemonium_string_name_to_pyobj(const pandemonium_string_name *p_gdname):
cdef godot_string strname = gdapi10.godot_string_name_get_name(p_gdname) cdef pandemonium_string strname = gdapi10.pandemonium_string_name_get_name(p_gdname)
cdef ret = godot_string_to_pyobj(&strname) cdef ret = pandemonium_string_to_pyobj(&strname)
gdapi10.godot_string_destroy(&strname) gdapi10.pandemonium_string_destroy(&strname)
return ret return ret
cdef inline void pyobj_to_godot_string_name(str pystr, godot_string_name *p_gdname): cdef inline void pyobj_to_pandemonium_string_name(str pystr, pandemonium_string_name *p_gdname):
cdef godot_string strname cdef pandemonium_string strname
pyobj_to_godot_string(pystr, &strname) pyobj_to_pandemonium_string(pystr, &strname)
gdapi10.godot_string_name_new(p_gdname, &strname) gdapi10.pandemonium_string_name_new(p_gdname, &strname)
gdapi10.godot_string_destroy(&strname) gdapi10.pandemonium_string_destroy(&strname)
cdef object godot_variant_to_pyobj(const godot_variant *p_gdvar) cdef object pandemonium_variant_to_pyobj(const pandemonium_variant *p_gdvar)
cdef bint pyobj_to_godot_variant(object pyobj, godot_variant *p_var) cdef bint pyobj_to_pandemonium_variant(object pyobj, pandemonium_variant *p_var)
cdef bint is_pytype_compatible_with_godot_variant(object pytype) cdef bint is_pytype_compatible_with_pandemonium_variant(object pytype)
cdef object godot_type_to_pytype(godot_variant_type gdtype) cdef object pandemonium_type_to_pytype(pandemonium_variant_type gdtype)
cdef godot_variant_type pytype_to_godot_type(object pytype) cdef pandemonium_variant_type pytype_to_pandemonium_type(object pytype)
cdef GDString ensure_is_gdstring(object gdstring_or_pystr) cdef GDString ensure_is_gdstring(object gdstring_or_pystr)
cdef NodePath ensure_is_nodepath(object nodepath_or_pystr) cdef NodePath ensure_is_nodepath(object nodepath_or_pystr)
@ -80,10 +80,10 @@ cdef NodePath ensure_is_nodepath(object nodepath_or_pystr)
# TODO: finish this... # TODO: finish this...
# cdef inline object cook_slice(slice slice_, godot_int size, godot_int *r_start, godot_int *r_stop, godot_int *r_step, godot_int *r_items): # cdef inline object cook_slice(slice slice_, pandemonium_int size, pandemonium_int *r_start, pandemonium_int *r_stop, pandemonium_int *r_step, pandemonium_int *r_items):
# cdef godot_int start # cdef pandemonium_int start
# cdef godot_int stop # cdef pandemonium_int stop
# cdef godot_int step # cdef pandemonium_int step
# step = slice_.step if slice_.step is not None else 1 # step = slice_.step if slice_.step is not None else 1
# if step == 0: # if step == 0:
@ -103,7 +103,7 @@ cdef NodePath ensure_is_nodepath(object nodepath_or_pystr)
# return None # return None
# cdef inline godot_int cook_slice_start(godot_int size, godot_int start): # cdef inline pandemonium_int cook_slice_start(pandemonium_int size, pandemonium_int start):
# if start > size - 1: # if start > size - 1:
# return size - 1 # return size - 1
# elif start < 0: # elif start < 0:
@ -113,7 +113,7 @@ cdef NodePath ensure_is_nodepath(object nodepath_or_pystr)
# return start # return start
# cdef inline godot_int cook_slice_stop(godot_int size, godot_int stop): # cdef inline pandemonium_int cook_slice_stop(pandemonium_int size, pandemonium_int stop):
# if stop > size: # if stop > size:
# return size # return size
# elif stop < -size: # elif stop < -size:
@ -123,8 +123,8 @@ cdef NodePath ensure_is_nodepath(object nodepath_or_pystr)
# return stop # return stop
# cdef inline godot_int cook_slice_get_items(godot_int size, godot_int start, godot_int stop, godot_int step): # cdef inline pandemonium_int cook_slice_get_items(pandemonium_int size, pandemonium_int start, pandemonium_int stop, pandemonium_int step):
# cdef godot_int items # cdef pandemonium_int items
# if step > 0: # if step > 0:
# if start >= stop: # if start >= stop:
# return 0 # return 0

View File

@ -3,12 +3,12 @@ from libc.stdio cimport printf
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10 from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_string, pandemonium_string,
godot_string_name, pandemonium_string_name,
godot_int, pandemonium_int,
godot_vector2, pandemonium_vector2,
godot_variant, pandemonium_variant,
godot_variant_type, pandemonium_variant_type,
) )
from godot.bindings cimport Object from godot.bindings cimport Object
from godot.builtins cimport ( from godot.builtins cimport (
@ -40,56 +40,56 @@ from warnings import warn
GD_PY_TYPES = ( GD_PY_TYPES = (
(godot_variant_type.GODOT_VARIANT_TYPE_NIL, type(None)), (pandemonium_variant_type.GODOT_VARIANT_TYPE_NIL, type(None)),
(godot_variant_type.GODOT_VARIANT_TYPE_BOOL, bool), (pandemonium_variant_type.GODOT_VARIANT_TYPE_BOOL, bool),
(godot_variant_type.GODOT_VARIANT_TYPE_INT, int), (pandemonium_variant_type.GODOT_VARIANT_TYPE_INT, int),
(godot_variant_type.GODOT_VARIANT_TYPE_REAL, float), (pandemonium_variant_type.GODOT_VARIANT_TYPE_REAL, float),
(godot_variant_type.GODOT_VARIANT_TYPE_STRING, GDString), (pandemonium_variant_type.GODOT_VARIANT_TYPE_STRING, GDString),
(godot_variant_type.GODOT_VARIANT_TYPE_OBJECT, Object), (pandemonium_variant_type.GODOT_VARIANT_TYPE_OBJECT, Object),
(godot_variant_type.GODOT_VARIANT_TYPE_VECTOR2, Vector2), (pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR2, Vector2),
(godot_variant_type.GODOT_VARIANT_TYPE_RECT2, Rect2), (pandemonium_variant_type.GODOT_VARIANT_TYPE_RECT2, Rect2),
(godot_variant_type.GODOT_VARIANT_TYPE_VECTOR3, Vector3), (pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR3, Vector3),
(godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D, Transform2D), (pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D, Transform2D),
(godot_variant_type.GODOT_VARIANT_TYPE_PLANE, Plane), (pandemonium_variant_type.GODOT_VARIANT_TYPE_PLANE, Plane),
(godot_variant_type.GODOT_VARIANT_TYPE_QUAT, Quat), (pandemonium_variant_type.GODOT_VARIANT_TYPE_QUAT, Quat),
(godot_variant_type.GODOT_VARIANT_TYPE_AABB, AABB), (pandemonium_variant_type.GODOT_VARIANT_TYPE_AABB, AABB),
(godot_variant_type.GODOT_VARIANT_TYPE_BASIS, Basis), (pandemonium_variant_type.GODOT_VARIANT_TYPE_BASIS, Basis),
(godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM, Transform), (pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM, Transform),
(godot_variant_type.GODOT_VARIANT_TYPE_COLOR, Color), (pandemonium_variant_type.GODOT_VARIANT_TYPE_COLOR, Color),
(godot_variant_type.GODOT_VARIANT_TYPE_NODE_PATH, NodePath), (pandemonium_variant_type.GODOT_VARIANT_TYPE_NODE_PATH, NodePath),
(godot_variant_type.GODOT_VARIANT_TYPE_RID, RID), (pandemonium_variant_type.GODOT_VARIANT_TYPE_RID, RID),
(godot_variant_type.GODOT_VARIANT_TYPE_DICTIONARY, Dictionary), (pandemonium_variant_type.GODOT_VARIANT_TYPE_DICTIONARY, Dictionary),
(godot_variant_type.GODOT_VARIANT_TYPE_ARRAY, Array), (pandemonium_variant_type.GODOT_VARIANT_TYPE_ARRAY, Array),
( (
godot_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY, pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY,
PoolByteArray, PoolByteArray,
), ),
(godot_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY, PoolIntArray), (pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY, PoolIntArray),
( (
godot_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY, pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY,
PoolRealArray, PoolRealArray,
), ),
(godot_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, PoolStringArray), (pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, PoolStringArray),
( (
godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY,
PoolVector2Array, PoolVector2Array,
), ),
( (
godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY, pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY,
PoolVector3Array, PoolVector3Array,
), ),
( (
godot_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY, pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY,
PoolColorArray, PoolColorArray,
), ),
) )
cdef bint is_pytype_compatible_with_godot_variant(object pytype): cdef bint is_pytype_compatible_with_pandemonium_variant(object pytype):
return next((True for _, py in GD_PY_TYPES if py == pytype), issubclass(pytype, Object)) return next((True for _, py in GD_PY_TYPES if py == pytype), issubclass(pytype, Object))
cdef object godot_type_to_pytype(godot_variant_type gdtype): cdef object pandemonium_type_to_pytype(pandemonium_variant_type gdtype):
cdef pytype = next((py for gd, py in GD_PY_TYPES if gd == gdtype), None) cdef pytype = next((py for gd, py in GD_PY_TYPES if gd == gdtype), None)
if pytype is None: if pytype is None:
warn(f"No Python equivalent for Godot type `{gdtype}`") warn(f"No Python equivalent for Godot type `{gdtype}`")
@ -98,318 +98,318 @@ cdef object godot_type_to_pytype(godot_variant_type gdtype):
return pytype return pytype
cdef godot_variant_type pytype_to_godot_type(object pytype): cdef pandemonium_variant_type pytype_to_pandemonium_type(object pytype):
cdef gdtype = next((gd for gd, py in GD_PY_TYPES if py == pytype), None) cdef gdtype = next((gd for gd, py in GD_PY_TYPES if py == pytype), None)
if gdtype is None: if gdtype is None:
if issubclass(pytype, Object): if issubclass(pytype, Object):
return godot_variant_type.GODOT_VARIANT_TYPE_OBJECT return pandemonium_variant_type.GODOT_VARIANT_TYPE_OBJECT
else: else:
warn(f"No Godot equivalent for Python type `{pytype}`") warn(f"No Godot equivalent for Python type `{pytype}`")
return godot_variant_type.GODOT_VARIANT_TYPE_NIL return pandemonium_variant_type.GODOT_VARIANT_TYPE_NIL
return gdtype return gdtype
cdef object godot_variant_to_pyobj(const godot_variant *p_gdvar): cdef object pandemonium_variant_to_pyobj(const pandemonium_variant *p_gdvar):
cdef godot_variant_type gdtype = gdapi10.godot_variant_get_type(p_gdvar) cdef pandemonium_variant_type gdtype = gdapi10.pandemonium_variant_get_type(p_gdvar)
if gdtype == godot_variant_type.GODOT_VARIANT_TYPE_NIL: if gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_NIL:
return None return None
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_BOOL: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_BOOL:
return bool(gdapi10.godot_variant_as_bool(p_gdvar)) return bool(gdapi10.pandemonium_variant_as_bool(p_gdvar))
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_INT: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_INT:
return int(gdapi10.godot_variant_as_int(p_gdvar)) return int(gdapi10.pandemonium_variant_as_int(p_gdvar))
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_REAL: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_REAL:
return float(gdapi10.godot_variant_as_real(p_gdvar)) return float(gdapi10.pandemonium_variant_as_real(p_gdvar))
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_STRING: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_STRING:
return _godot_variant_to_pyobj_string(p_gdvar) return _pandemonium_variant_to_pyobj_string(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_VECTOR2: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR2:
return _godot_variant_to_pyobj_vector2(p_gdvar) return _pandemonium_variant_to_pyobj_vector2(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_RECT2: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_RECT2:
return _godot_variant_to_pyobj_rect2(p_gdvar) return _pandemonium_variant_to_pyobj_rect2(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_VECTOR3: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR3:
return _godot_variant_to_pyobj_vector3(p_gdvar) return _pandemonium_variant_to_pyobj_vector3(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D:
return _godot_variant_to_pyobj_transform2d(p_gdvar) return _pandemonium_variant_to_pyobj_transform2d(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_PLANE: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_PLANE:
return _godot_variant_to_pyobj_plane(p_gdvar) return _pandemonium_variant_to_pyobj_plane(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_QUAT: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_QUAT:
return _godot_variant_to_pyobj_quat(p_gdvar) return _pandemonium_variant_to_pyobj_quat(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_AABB: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_AABB:
return _godot_variant_to_pyobj_aabb(p_gdvar) return _pandemonium_variant_to_pyobj_aabb(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_BASIS: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_BASIS:
return _godot_variant_to_pyobj_basis(p_gdvar) return _pandemonium_variant_to_pyobj_basis(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM:
return _godot_variant_to_pyobj_transform(p_gdvar) return _pandemonium_variant_to_pyobj_transform(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_COLOR: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_COLOR:
return _godot_variant_to_pyobj_color(p_gdvar) return _pandemonium_variant_to_pyobj_color(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_NODE_PATH: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_NODE_PATH:
return _godot_variant_to_pyobj_node_path(p_gdvar) return _pandemonium_variant_to_pyobj_node_path(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_RID: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_RID:
return _godot_variant_to_pyobj_rid(p_gdvar) return _pandemonium_variant_to_pyobj_rid(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_OBJECT: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_OBJECT:
return _godot_variant_to_pyobj_object(p_gdvar) return _pandemonium_variant_to_pyobj_object(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_DICTIONARY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_DICTIONARY:
return _godot_variant_to_pyobj_dictionary(p_gdvar) return _pandemonium_variant_to_pyobj_dictionary(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_ARRAY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_ARRAY:
return _godot_variant_to_pyobj_array(p_gdvar) return _pandemonium_variant_to_pyobj_array(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY:
return _godot_variant_to_pyobj_pool_byte_array(p_gdvar) return _pandemonium_variant_to_pyobj_pool_byte_array(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY:
return _godot_variant_to_pyobj_pool_int_array(p_gdvar) return _pandemonium_variant_to_pyobj_pool_int_array(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY:
return _godot_variant_to_pyobj_pool_real_array(p_gdvar) return _pandemonium_variant_to_pyobj_pool_real_array(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY:
return _godot_variant_to_pyobj_pool_string_array(p_gdvar) return _pandemonium_variant_to_pyobj_pool_string_array(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY:
return _godot_variant_to_pyobj_pool_vector2_array(p_gdvar) return _pandemonium_variant_to_pyobj_pool_vector2_array(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY:
return _godot_variant_to_pyobj_pool_vector3_array(p_gdvar) return _pandemonium_variant_to_pyobj_pool_vector3_array(p_gdvar)
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY: elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY:
return _godot_variant_to_pyobj_pool_color_array(p_gdvar) return _pandemonium_variant_to_pyobj_pool_color_array(p_gdvar)
else: else:
warn(f"Unknown Variant type `{gdtype}` (this should never happen !)") warn(f"Unknown Variant type `{gdtype}` (this should never happen !)")
return None return None
cdef inline GDString _godot_variant_to_pyobj_string(const godot_variant *p_gdvar): cdef inline GDString _pandemonium_variant_to_pyobj_string(const pandemonium_variant *p_gdvar):
cdef GDString ret = GDString.__new__(GDString) cdef GDString ret = GDString.__new__(GDString)
ret._gd_data = gdapi10.godot_variant_as_string(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_string(p_gdvar)
return ret return ret
cdef inline Vector2 _godot_variant_to_pyobj_vector2(const godot_variant *p_gdvar): cdef inline Vector2 _pandemonium_variant_to_pyobj_vector2(const pandemonium_variant *p_gdvar):
cdef Vector2 ret = Vector2.__new__(Vector2) cdef Vector2 ret = Vector2.__new__(Vector2)
ret._gd_data = gdapi10.godot_variant_as_vector2(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_vector2(p_gdvar)
return ret return ret
cdef inline Rect2 _godot_variant_to_pyobj_rect2(const godot_variant *p_gdvar): cdef inline Rect2 _pandemonium_variant_to_pyobj_rect2(const pandemonium_variant *p_gdvar):
cdef Rect2 ret = Rect2.__new__(Rect2) cdef Rect2 ret = Rect2.__new__(Rect2)
ret._gd_data = gdapi10.godot_variant_as_rect2(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_rect2(p_gdvar)
return ret return ret
cdef inline Vector3 _godot_variant_to_pyobj_vector3(const godot_variant *p_gdvar): cdef inline Vector3 _pandemonium_variant_to_pyobj_vector3(const pandemonium_variant *p_gdvar):
cdef Vector3 ret = Vector3.__new__(Vector3) cdef Vector3 ret = Vector3.__new__(Vector3)
ret._gd_data = gdapi10.godot_variant_as_vector3(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_vector3(p_gdvar)
return ret return ret
cdef inline Transform2D _godot_variant_to_pyobj_transform2d(const godot_variant *p_gdvar): cdef inline Transform2D _pandemonium_variant_to_pyobj_transform2d(const pandemonium_variant *p_gdvar):
cdef Transform2D ret = Transform2D.__new__(Transform2D) cdef Transform2D ret = Transform2D.__new__(Transform2D)
ret._gd_data = gdapi10.godot_variant_as_transform2d(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_transform2d(p_gdvar)
return ret return ret
cdef inline Transform _godot_variant_to_pyobj_transform(const godot_variant *p_gdvar): cdef inline Transform _pandemonium_variant_to_pyobj_transform(const pandemonium_variant *p_gdvar):
cdef Transform ret = Transform.__new__(Transform) cdef Transform ret = Transform.__new__(Transform)
ret._gd_data = gdapi10.godot_variant_as_transform(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_transform(p_gdvar)
return ret return ret
cdef inline Plane _godot_variant_to_pyobj_plane(const godot_variant *p_gdvar): cdef inline Plane _pandemonium_variant_to_pyobj_plane(const pandemonium_variant *p_gdvar):
cdef Plane ret = Plane.__new__(Plane) cdef Plane ret = Plane.__new__(Plane)
ret._gd_data = gdapi10.godot_variant_as_plane(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_plane(p_gdvar)
return ret return ret
cdef inline Quat _godot_variant_to_pyobj_quat(const godot_variant *p_gdvar): cdef inline Quat _pandemonium_variant_to_pyobj_quat(const pandemonium_variant *p_gdvar):
cdef Quat ret = Quat.__new__(Quat) cdef Quat ret = Quat.__new__(Quat)
ret._gd_data = gdapi10.godot_variant_as_quat(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_quat(p_gdvar)
return ret return ret
cdef inline AABB _godot_variant_to_pyobj_aabb(const godot_variant *p_gdvar): cdef inline AABB _pandemonium_variant_to_pyobj_aabb(const pandemonium_variant *p_gdvar):
cdef AABB ret = AABB.__new__(AABB) cdef AABB ret = AABB.__new__(AABB)
ret._gd_data = gdapi10.godot_variant_as_aabb(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_aabb(p_gdvar)
return ret return ret
cdef inline Basis _godot_variant_to_pyobj_basis(const godot_variant *p_gdvar): cdef inline Basis _pandemonium_variant_to_pyobj_basis(const pandemonium_variant *p_gdvar):
cdef Basis ret = Basis.__new__(Basis) cdef Basis ret = Basis.__new__(Basis)
ret._gd_data = gdapi10.godot_variant_as_basis(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_basis(p_gdvar)
return ret return ret
cdef inline Color _godot_variant_to_pyobj_color(const godot_variant *p_gdvar): cdef inline Color _pandemonium_variant_to_pyobj_color(const pandemonium_variant *p_gdvar):
cdef Color ret = Color.__new__(Color) cdef Color ret = Color.__new__(Color)
ret._gd_data = gdapi10.godot_variant_as_color(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_color(p_gdvar)
return ret return ret
cdef inline NodePath _godot_variant_to_pyobj_node_path(const godot_variant *p_gdvar): cdef inline NodePath _pandemonium_variant_to_pyobj_node_path(const pandemonium_variant *p_gdvar):
cdef NodePath ret = NodePath.__new__(NodePath) cdef NodePath ret = NodePath.__new__(NodePath)
ret._gd_data = gdapi10.godot_variant_as_node_path(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_node_path(p_gdvar)
return ret return ret
cdef inline RID _godot_variant_to_pyobj_rid(const godot_variant *p_gdvar): cdef inline RID _pandemonium_variant_to_pyobj_rid(const pandemonium_variant *p_gdvar):
cdef RID ret = RID.__new__(RID) cdef RID ret = RID.__new__(RID)
ret._gd_data = gdapi10.godot_variant_as_rid(p_gdvar) ret._gd_data = gdapi10.pandemonium_variant_as_rid(p_gdvar)
return ret return ret
cdef inline Object _godot_variant_to_pyobj_object(const godot_variant *p_gdvar): cdef inline Object _pandemonium_variant_to_pyobj_object(const pandemonium_variant *p_gdvar):
# TODO: This conversion relies on godot String and lookup into bindings # TODO: This conversion relies on godot String and lookup into bindings
# modules, wouldn't it be better to create a `ObjectFromVariant` lazy # modules, wouldn't it be better to create a `ObjectFromVariant` lazy
# class instead ? # class instead ?
return Object.cast_from_variant(p_gdvar) return Object.cast_from_variant(p_gdvar)
cdef inline Dictionary _godot_variant_to_pyobj_dictionary(const godot_variant *p_gdvar): cdef inline Dictionary _pandemonium_variant_to_pyobj_dictionary(const pandemonium_variant *p_gdvar):
cdef Dictionary d = Dictionary.__new__(Dictionary) cdef Dictionary d = Dictionary.__new__(Dictionary)
d._gd_data = gdapi10.godot_variant_as_dictionary(p_gdvar) d._gd_data = gdapi10.pandemonium_variant_as_dictionary(p_gdvar)
return d return d
cdef inline Array _godot_variant_to_pyobj_array(const godot_variant *p_gdvar): cdef inline Array _pandemonium_variant_to_pyobj_array(const pandemonium_variant *p_gdvar):
cdef Array a = Array.__new__(Array) cdef Array a = Array.__new__(Array)
a._gd_data = gdapi10.godot_variant_as_array(p_gdvar) a._gd_data = gdapi10.pandemonium_variant_as_array(p_gdvar)
return a return a
cdef inline PoolByteArray _godot_variant_to_pyobj_pool_byte_array(const godot_variant *p_gdvar): cdef inline PoolByteArray _pandemonium_variant_to_pyobj_pool_byte_array(const pandemonium_variant *p_gdvar):
cdef PoolByteArray a = PoolByteArray.__new__(PoolByteArray) cdef PoolByteArray a = PoolByteArray.__new__(PoolByteArray)
a._gd_data = gdapi10.godot_variant_as_pool_byte_array(p_gdvar) a._gd_data = gdapi10.pandemonium_variant_as_pool_byte_array(p_gdvar)
return a return a
cdef inline PoolIntArray _godot_variant_to_pyobj_pool_int_array(const godot_variant *p_gdvar): cdef inline PoolIntArray _pandemonium_variant_to_pyobj_pool_int_array(const pandemonium_variant *p_gdvar):
cdef PoolIntArray a = PoolIntArray.__new__(PoolIntArray) cdef PoolIntArray a = PoolIntArray.__new__(PoolIntArray)
a._gd_data = gdapi10.godot_variant_as_pool_int_array(p_gdvar) a._gd_data = gdapi10.pandemonium_variant_as_pool_int_array(p_gdvar)
return a return a
cdef inline PoolRealArray _godot_variant_to_pyobj_pool_real_array(const godot_variant *p_gdvar): cdef inline PoolRealArray _pandemonium_variant_to_pyobj_pool_real_array(const pandemonium_variant *p_gdvar):
cdef PoolRealArray a = PoolRealArray.__new__(PoolRealArray) cdef PoolRealArray a = PoolRealArray.__new__(PoolRealArray)
a._gd_data = gdapi10.godot_variant_as_pool_real_array(p_gdvar) a._gd_data = gdapi10.pandemonium_variant_as_pool_real_array(p_gdvar)
return a return a
cdef inline PoolStringArray _godot_variant_to_pyobj_pool_string_array(const godot_variant *p_gdvar): cdef inline PoolStringArray _pandemonium_variant_to_pyobj_pool_string_array(const pandemonium_variant *p_gdvar):
cdef PoolStringArray a = PoolStringArray.__new__(PoolStringArray) cdef PoolStringArray a = PoolStringArray.__new__(PoolStringArray)
a._gd_data = gdapi10.godot_variant_as_pool_string_array(p_gdvar) a._gd_data = gdapi10.pandemonium_variant_as_pool_string_array(p_gdvar)
return a return a
cdef inline PoolVector2Array _godot_variant_to_pyobj_pool_vector2_array(const godot_variant *p_gdvar): cdef inline PoolVector2Array _pandemonium_variant_to_pyobj_pool_vector2_array(const pandemonium_variant *p_gdvar):
cdef PoolVector2Array a = PoolVector2Array.__new__(PoolVector2Array) cdef PoolVector2Array a = PoolVector2Array.__new__(PoolVector2Array)
a._gd_data = gdapi10.godot_variant_as_pool_vector2_array(p_gdvar) a._gd_data = gdapi10.pandemonium_variant_as_pool_vector2_array(p_gdvar)
return a return a
cdef inline PoolVector3Array _godot_variant_to_pyobj_pool_vector3_array(const godot_variant *p_gdvar): cdef inline PoolVector3Array _pandemonium_variant_to_pyobj_pool_vector3_array(const pandemonium_variant *p_gdvar):
cdef PoolVector3Array a = PoolVector3Array.__new__(PoolVector3Array) cdef PoolVector3Array a = PoolVector3Array.__new__(PoolVector3Array)
a._gd_data = gdapi10.godot_variant_as_pool_vector3_array(p_gdvar) a._gd_data = gdapi10.pandemonium_variant_as_pool_vector3_array(p_gdvar)
return a return a
cdef inline PoolColorArray _godot_variant_to_pyobj_pool_color_array(const godot_variant *p_gdvar): cdef inline PoolColorArray _pandemonium_variant_to_pyobj_pool_color_array(const pandemonium_variant *p_gdvar):
cdef PoolColorArray a = PoolColorArray.__new__(PoolColorArray) cdef PoolColorArray a = PoolColorArray.__new__(PoolColorArray)
a._gd_data = gdapi10.godot_variant_as_pool_color_array(p_gdvar) a._gd_data = gdapi10.pandemonium_variant_as_pool_color_array(p_gdvar)
return a return a
cdef bint pyobj_to_godot_variant(object pyobj, godot_variant *p_var): cdef bint pyobj_to_pandemonium_variant(object pyobj, pandemonium_variant *p_var):
if pyobj is None: if pyobj is None:
gdapi10.godot_variant_new_nil(p_var) gdapi10.pandemonium_variant_new_nil(p_var)
elif isinstance(pyobj, bool): elif isinstance(pyobj, bool):
gdapi10.godot_variant_new_bool(p_var, pyobj) gdapi10.pandemonium_variant_new_bool(p_var, pyobj)
elif isinstance(pyobj, int): elif isinstance(pyobj, int):
gdapi10.godot_variant_new_int(p_var, pyobj) gdapi10.pandemonium_variant_new_int(p_var, pyobj)
elif isinstance(pyobj, float): elif isinstance(pyobj, float):
gdapi10.godot_variant_new_real(p_var, pyobj) gdapi10.pandemonium_variant_new_real(p_var, pyobj)
elif isinstance(pyobj, str): elif isinstance(pyobj, str):
_pyobj_to_godot_variant_convert_string(pyobj, p_var) _pyobj_to_pandemonium_variant_convert_string(pyobj, p_var)
elif isinstance(pyobj, GDString): elif isinstance(pyobj, GDString):
gdapi10.godot_variant_new_string(p_var, &(<GDString>pyobj)._gd_data) gdapi10.pandemonium_variant_new_string(p_var, &(<GDString>pyobj)._gd_data)
elif isinstance(pyobj, Vector2): elif isinstance(pyobj, Vector2):
gdapi10.godot_variant_new_vector2(p_var, &(<Vector2>pyobj)._gd_data) gdapi10.pandemonium_variant_new_vector2(p_var, &(<Vector2>pyobj)._gd_data)
elif isinstance(pyobj, Vector3): elif isinstance(pyobj, Vector3):
gdapi10.godot_variant_new_vector3(p_var, &(<Vector3>pyobj)._gd_data) gdapi10.pandemonium_variant_new_vector3(p_var, &(<Vector3>pyobj)._gd_data)
elif isinstance(pyobj, Plane): elif isinstance(pyobj, Plane):
gdapi10.godot_variant_new_plane(p_var, &(<Plane>pyobj)._gd_data) gdapi10.pandemonium_variant_new_plane(p_var, &(<Plane>pyobj)._gd_data)
elif isinstance(pyobj, Quat): elif isinstance(pyobj, Quat):
gdapi10.godot_variant_new_quat(p_var, &(<Quat>pyobj)._gd_data) gdapi10.pandemonium_variant_new_quat(p_var, &(<Quat>pyobj)._gd_data)
elif isinstance(pyobj, AABB): elif isinstance(pyobj, AABB):
gdapi10.godot_variant_new_aabb(p_var, &(<AABB>pyobj)._gd_data) gdapi10.pandemonium_variant_new_aabb(p_var, &(<AABB>pyobj)._gd_data)
elif isinstance(pyobj, Basis): elif isinstance(pyobj, Basis):
gdapi10.godot_variant_new_basis(p_var, &(<Basis>pyobj)._gd_data) gdapi10.pandemonium_variant_new_basis(p_var, &(<Basis>pyobj)._gd_data)
elif isinstance(pyobj, Color): elif isinstance(pyobj, Color):
gdapi10.godot_variant_new_color(p_var, &(<Color>pyobj)._gd_data) gdapi10.pandemonium_variant_new_color(p_var, &(<Color>pyobj)._gd_data)
elif isinstance(pyobj, NodePath): elif isinstance(pyobj, NodePath):
gdapi10.godot_variant_new_node_path(p_var, &(<NodePath>pyobj)._gd_data) gdapi10.pandemonium_variant_new_node_path(p_var, &(<NodePath>pyobj)._gd_data)
elif isinstance(pyobj, RID): elif isinstance(pyobj, RID):
gdapi10.godot_variant_new_rid(p_var, &(<RID>pyobj)._gd_data) gdapi10.pandemonium_variant_new_rid(p_var, &(<RID>pyobj)._gd_data)
elif isinstance(pyobj, Rect2): elif isinstance(pyobj, Rect2):
gdapi10.godot_variant_new_rect2(p_var, &(<Rect2>pyobj)._gd_data) gdapi10.pandemonium_variant_new_rect2(p_var, &(<Rect2>pyobj)._gd_data)
elif isinstance(pyobj, Transform2D): elif isinstance(pyobj, Transform2D):
gdapi10.godot_variant_new_transform2d(p_var, &(<Transform2D>pyobj)._gd_data) gdapi10.pandemonium_variant_new_transform2d(p_var, &(<Transform2D>pyobj)._gd_data)
elif isinstance(pyobj, Transform): elif isinstance(pyobj, Transform):
gdapi10.godot_variant_new_transform(p_var, &(<Transform>pyobj)._gd_data) gdapi10.pandemonium_variant_new_transform(p_var, &(<Transform>pyobj)._gd_data)
elif isinstance(pyobj, Dictionary): elif isinstance(pyobj, Dictionary):
gdapi10.godot_variant_new_dictionary(p_var, &(<Dictionary>pyobj)._gd_data) gdapi10.pandemonium_variant_new_dictionary(p_var, &(<Dictionary>pyobj)._gd_data)
elif isinstance(pyobj, Array): elif isinstance(pyobj, Array):
gdapi10.godot_variant_new_array(p_var, &(<Array>pyobj)._gd_data) gdapi10.pandemonium_variant_new_array(p_var, &(<Array>pyobj)._gd_data)
elif isinstance(pyobj, PoolByteArray): elif isinstance(pyobj, PoolByteArray):
gdapi10.godot_variant_new_pool_byte_array(p_var, &(<PoolByteArray>pyobj)._gd_data) gdapi10.pandemonium_variant_new_pool_byte_array(p_var, &(<PoolByteArray>pyobj)._gd_data)
elif isinstance(pyobj, PoolIntArray): elif isinstance(pyobj, PoolIntArray):
gdapi10.godot_variant_new_pool_int_array(p_var, &(<PoolIntArray>pyobj)._gd_data) gdapi10.pandemonium_variant_new_pool_int_array(p_var, &(<PoolIntArray>pyobj)._gd_data)
elif isinstance(pyobj, PoolRealArray): elif isinstance(pyobj, PoolRealArray):
gdapi10.godot_variant_new_pool_real_array(p_var, &(<PoolRealArray>pyobj)._gd_data) gdapi10.pandemonium_variant_new_pool_real_array(p_var, &(<PoolRealArray>pyobj)._gd_data)
elif isinstance(pyobj, PoolStringArray): elif isinstance(pyobj, PoolStringArray):
gdapi10.godot_variant_new_pool_string_array(p_var, &(<PoolStringArray>pyobj)._gd_data) gdapi10.pandemonium_variant_new_pool_string_array(p_var, &(<PoolStringArray>pyobj)._gd_data)
elif isinstance(pyobj, PoolVector2Array): elif isinstance(pyobj, PoolVector2Array):
gdapi10.godot_variant_new_pool_vector2_array(p_var, &(<PoolVector2Array>pyobj)._gd_data) gdapi10.pandemonium_variant_new_pool_vector2_array(p_var, &(<PoolVector2Array>pyobj)._gd_data)
elif isinstance(pyobj, PoolVector3Array): elif isinstance(pyobj, PoolVector3Array):
gdapi10.godot_variant_new_pool_vector3_array(p_var, &(<PoolVector3Array>pyobj)._gd_data) gdapi10.pandemonium_variant_new_pool_vector3_array(p_var, &(<PoolVector3Array>pyobj)._gd_data)
elif isinstance(pyobj, PoolColorArray): elif isinstance(pyobj, PoolColorArray):
gdapi10.godot_variant_new_pool_color_array(p_var, &(<PoolColorArray>pyobj)._gd_data) gdapi10.pandemonium_variant_new_pool_color_array(p_var, &(<PoolColorArray>pyobj)._gd_data)
elif isinstance(pyobj, Object): elif isinstance(pyobj, Object):
gdapi10.godot_variant_new_object(p_var, (<Object>pyobj)._gd_ptr) gdapi10.pandemonium_variant_new_object(p_var, (<Object>pyobj)._gd_ptr)
else: else:
warn(f"Cannot convert `{type(pyobj)}` to Godot's Variant") warn(f"Cannot convert `{type(pyobj)}` to Godot's Variant")
gdapi10.godot_variant_new_nil(p_var) gdapi10.pandemonium_variant_new_nil(p_var)
return False return False
return True return True
# Needed to define gdstr in it own scope # Needed to define gdstr in it own scope
cdef inline void _pyobj_to_godot_variant_convert_string(object pyobj, godot_variant *p_var): cdef inline void _pyobj_to_pandemonium_variant_convert_string(object pyobj, pandemonium_variant *p_var):
cdef godot_string gdstr cdef pandemonium_string gdstr
pyobj_to_godot_string(pyobj, &gdstr) pyobj_to_pandemonium_string(pyobj, &gdstr)
try: try:
gdapi10.godot_variant_new_string(p_var, &gdstr) gdapi10.pandemonium_variant_new_string(p_var, &gdstr)
finally: finally:
gdapi10.godot_string_destroy(&gdstr) gdapi10.pandemonium_string_destroy(&gdstr)
cdef GDString ensure_is_gdstring(object gdstring_or_pystr): cdef GDString ensure_is_gdstring(object gdstring_or_pystr):

View File

@ -1,11 +1,11 @@
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_gdnative_core_api_struct, pandemonium_gdnative_core_api_struct,
godot_gdnative_core_1_1_api_struct, pandemonium_gdnative_core_1_1_api_struct,
godot_gdnative_core_1_2_api_struct, pandemonium_gdnative_core_1_2_api_struct,
godot_gdnative_ext_nativescript_api_struct, pandemonium_gdnative_ext_nativescript_api_struct,
godot_gdnative_ext_pluginscript_api_struct, pandemonium_gdnative_ext_pluginscript_api_struct,
godot_gdnative_ext_android_api_struct, pandemonium_gdnative_ext_android_api_struct,
godot_gdnative_ext_arvr_api_struct, pandemonium_gdnative_ext_arvr_api_struct,
) )
@ -20,19 +20,19 @@ cdef extern from * nogil:
#else #else
# define PYTHONSCRIPT_IMPORT # define PYTHONSCRIPT_IMPORT
#endif #endif
PYTHONSCRIPT_IMPORT extern const godot_gdnative_core_api_struct *pythonscript_gdapi10; PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_core_api_struct *pythonscript_gdapi10;
PYTHONSCRIPT_IMPORT extern const godot_gdnative_core_1_1_api_struct *pythonscript_gdapi11; PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_core_1_1_api_struct *pythonscript_gdapi11;
PYTHONSCRIPT_IMPORT extern const godot_gdnative_core_1_2_api_struct *pythonscript_gdapi12; PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_core_1_2_api_struct *pythonscript_gdapi12;
PYTHONSCRIPT_IMPORT extern const godot_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript; PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript;
PYTHONSCRIPT_IMPORT extern const godot_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript; PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript;
PYTHONSCRIPT_IMPORT extern const godot_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android; PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android;
PYTHONSCRIPT_IMPORT extern const godot_gdnative_ext_arvr_api_struct *pythonscript_gdapi_ext_arvr; PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_ext_arvr_api_struct *pythonscript_gdapi_ext_arvr;
""" """
cdef const godot_gdnative_core_api_struct *pythonscript_gdapi10 cdef const pandemonium_gdnative_core_api_struct *pythonscript_gdapi10
cdef const godot_gdnative_core_1_1_api_struct *pythonscript_gdapi11 cdef const pandemonium_gdnative_core_1_1_api_struct *pythonscript_gdapi11
cdef const godot_gdnative_core_1_2_api_struct *pythonscript_gdapi12 cdef const pandemonium_gdnative_core_1_2_api_struct *pythonscript_gdapi12
cdef const godot_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript cdef const pandemonium_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript
cdef const godot_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript cdef const pandemonium_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript
cdef const godot_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android cdef const pandemonium_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android
cdef const godot_gdnative_ext_arvr_api_struct *pythonscript_gdapi_ext_arvr cdef const pandemonium_gdnative_ext_arvr_api_struct *pythonscript_gdapi_ext_arvr

View File

@ -12,8 +12,8 @@ from godot._hazmat.gdapi cimport (
pythonscript_gdapi_ext_arvr as gdapi_ext_arvr, pythonscript_gdapi_ext_arvr as gdapi_ext_arvr,
) )
from godot._hazmat.conversion cimport ( from godot._hazmat.conversion cimport (
godot_string_to_pyobj, pandemonium_string_to_pyobj,
pyobj_to_godot_string, pyobj_to_pandemonium_string,
godot_variant_to_pyobj, pandemonium_variant_to_pyobj,
pyobj_to_godot_variant, pyobj_to_pandemonium_variant,
) )

View File

@ -2,17 +2,17 @@ import builtins
import enum import enum
from godot._hazmat.gdnative_api_struct cimport ( from godot._hazmat.gdnative_api_struct cimport (
godot_method_rpc_mode, pandemonium_method_rpc_mode,
godot_property_usage_flags, pandemonium_property_usage_flags,
godot_method_rpc_mode, pandemonium_method_rpc_mode,
godot_property_hint, pandemonium_property_hint,
godot_variant, pandemonium_variant,
) )
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10 from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
from godot._hazmat.conversion cimport ( from godot._hazmat.conversion cimport (
is_pytype_compatible_with_godot_variant, is_pytype_compatible_with_pandemonium_variant,
pyobj_to_godot_variant, pyobj_to_pandemonium_variant,
godot_variant_to_pyobj, pandemonium_variant_to_pyobj,
) )
from godot._hazmat.internal cimport get_exposed_class, set_exposed_class from godot._hazmat.internal cimport get_exposed_class, set_exposed_class
from godot.builtins cimport Array, Dictionary, GDString from godot.builtins cimport Array, Dictionary, GDString
@ -23,76 +23,76 @@ from godot.bindings cimport Object, Resource
class MethodRPCMode(enum.IntEnum): class MethodRPCMode(enum.IntEnum):
DISABLED = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_DISABLED DISABLED = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_DISABLED
REMOTE = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_REMOTE REMOTE = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_REMOTE
MASTER = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_MASTER MASTER = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_MASTER
PUPPET = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_PUPPET PUPPET = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_PUPPET
SLAVE = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_SLAVE SLAVE = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_SLAVE
REMOTESYNC = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_REMOTESYNC REMOTESYNC = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_REMOTESYNC
SYNC = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_SYNC SYNC = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_SYNC
MASTERSYNC = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_MASTERSYNC MASTERSYNC = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_MASTERSYNC
PUPPETSYNC = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_PUPPETSYNC PUPPETSYNC = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_PUPPETSYNC
class PropertyHint(enum.IntEnum): class PropertyHint(enum.IntEnum):
NONE = godot_property_hint.GODOT_PROPERTY_HINT_NONE NONE = pandemonium_property_hint.GODOT_PROPERTY_HINT_NONE
RANGE = godot_property_hint.GODOT_PROPERTY_HINT_RANGE RANGE = pandemonium_property_hint.GODOT_PROPERTY_HINT_RANGE
EXP_RANGE = godot_property_hint.GODOT_PROPERTY_HINT_EXP_RANGE EXP_RANGE = pandemonium_property_hint.GODOT_PROPERTY_HINT_EXP_RANGE
ENUM = godot_property_hint.GODOT_PROPERTY_HINT_ENUM ENUM = pandemonium_property_hint.GODOT_PROPERTY_HINT_ENUM
EXP_EASING = godot_property_hint.GODOT_PROPERTY_HINT_EXP_EASING EXP_EASING = pandemonium_property_hint.GODOT_PROPERTY_HINT_EXP_EASING
LENGTH = godot_property_hint.GODOT_PROPERTY_HINT_LENGTH LENGTH = pandemonium_property_hint.GODOT_PROPERTY_HINT_LENGTH
SPRITE_FRAME = godot_property_hint.GODOT_PROPERTY_HINT_SPRITE_FRAME SPRITE_FRAME = pandemonium_property_hint.GODOT_PROPERTY_HINT_SPRITE_FRAME
KEY_ACCEL = godot_property_hint.GODOT_PROPERTY_HINT_KEY_ACCEL KEY_ACCEL = pandemonium_property_hint.GODOT_PROPERTY_HINT_KEY_ACCEL
FLAGS = godot_property_hint.GODOT_PROPERTY_HINT_FLAGS FLAGS = pandemonium_property_hint.GODOT_PROPERTY_HINT_FLAGS
LAYERS_2D_RENDER = godot_property_hint.GODOT_PROPERTY_HINT_LAYERS_2D_RENDER LAYERS_2D_RENDER = pandemonium_property_hint.GODOT_PROPERTY_HINT_LAYERS_2D_RENDER
LAYERS_2D_PHYSICS = godot_property_hint.GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS LAYERS_2D_PHYSICS = pandemonium_property_hint.GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS
LAYERS_3D_RENDER = godot_property_hint.GODOT_PROPERTY_HINT_LAYERS_3D_RENDER LAYERS_3D_RENDER = pandemonium_property_hint.GODOT_PROPERTY_HINT_LAYERS_3D_RENDER
LAYERS_3D_PHYSICS = godot_property_hint.GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS LAYERS_3D_PHYSICS = pandemonium_property_hint.GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS
FILE = godot_property_hint.GODOT_PROPERTY_HINT_FILE FILE = pandemonium_property_hint.GODOT_PROPERTY_HINT_FILE
DIR = godot_property_hint.GODOT_PROPERTY_HINT_DIR DIR = pandemonium_property_hint.GODOT_PROPERTY_HINT_DIR
GLOBAL_FILE = godot_property_hint.GODOT_PROPERTY_HINT_GLOBAL_FILE GLOBAL_FILE = pandemonium_property_hint.GODOT_PROPERTY_HINT_GLOBAL_FILE
GLOBAL_DIR = godot_property_hint.GODOT_PROPERTY_HINT_GLOBAL_DIR GLOBAL_DIR = pandemonium_property_hint.GODOT_PROPERTY_HINT_GLOBAL_DIR
RESOURCE_TYPE = godot_property_hint.GODOT_PROPERTY_HINT_RESOURCE_TYPE RESOURCE_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_RESOURCE_TYPE
MULTILINE_TEXT = godot_property_hint.GODOT_PROPERTY_HINT_MULTILINE_TEXT MULTILINE_TEXT = pandemonium_property_hint.GODOT_PROPERTY_HINT_MULTILINE_TEXT
PLACEHOLDER_TEXT = godot_property_hint.GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT PLACEHOLDER_TEXT = pandemonium_property_hint.GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT
COLOR_NO_ALPHA = godot_property_hint.GODOT_PROPERTY_HINT_COLOR_NO_ALPHA COLOR_NO_ALPHA = pandemonium_property_hint.GODOT_PROPERTY_HINT_COLOR_NO_ALPHA
IMAGE_COMPRESS_LOSSY = godot_property_hint.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY IMAGE_COMPRESS_LOSSY = pandemonium_property_hint.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY
IMAGE_COMPRESS_LOSSLESS = godot_property_hint.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS IMAGE_COMPRESS_LOSSLESS = pandemonium_property_hint.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS
OBJECT_ID = godot_property_hint.GODOT_PROPERTY_HINT_OBJECT_ID OBJECT_ID = pandemonium_property_hint.GODOT_PROPERTY_HINT_OBJECT_ID
TYPE_STRING = godot_property_hint.GODOT_PROPERTY_HINT_TYPE_STRING TYPE_STRING = pandemonium_property_hint.GODOT_PROPERTY_HINT_TYPE_STRING
NODE_PATH_TO_EDITED_NODE = godot_property_hint.GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE NODE_PATH_TO_EDITED_NODE = pandemonium_property_hint.GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE
METHOD_OF_VARIANT_TYPE = godot_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE METHOD_OF_VARIANT_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE
METHOD_OF_BASE_TYPE = godot_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE METHOD_OF_BASE_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE
METHOD_OF_INSTANCE = godot_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE METHOD_OF_INSTANCE = pandemonium_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE
METHOD_OF_SCRIPT = godot_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT METHOD_OF_SCRIPT = pandemonium_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT
PROPERTY_OF_VARIANT_TYPE = godot_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE PROPERTY_OF_VARIANT_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE
PROPERTY_OF_BASE_TYPE = godot_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE PROPERTY_OF_BASE_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE
PROPERTY_OF_INSTANCE = godot_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE PROPERTY_OF_INSTANCE = pandemonium_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE
PROPERTY_OF_SCRIPT = godot_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT PROPERTY_OF_SCRIPT = pandemonium_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT
MAX = godot_property_hint.GODOT_PROPERTY_HINT_MAX MAX = pandemonium_property_hint.GODOT_PROPERTY_HINT_MAX
class PropertyUsageFlag(enum.IntFlag): class PropertyUsageFlag(enum.IntFlag):
STORAGE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_STORAGE STORAGE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_STORAGE
EDITOR = godot_property_usage_flags.GODOT_PROPERTY_USAGE_EDITOR EDITOR = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_EDITOR
NETWORK = godot_property_usage_flags.GODOT_PROPERTY_USAGE_NETWORK NETWORK = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_NETWORK
EDITOR_HELPER = godot_property_usage_flags.GODOT_PROPERTY_USAGE_EDITOR_HELPER EDITOR_HELPER = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_EDITOR_HELPER
CHECKABLE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_CHECKABLE CHECKABLE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_CHECKABLE
CHECKED = godot_property_usage_flags.GODOT_PROPERTY_USAGE_CHECKED CHECKED = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_CHECKED
INTERNATIONALIZED = godot_property_usage_flags.GODOT_PROPERTY_USAGE_INTERNATIONALIZED INTERNATIONALIZED = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_INTERNATIONALIZED
GROUP = godot_property_usage_flags.GODOT_PROPERTY_USAGE_GROUP GROUP = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_GROUP
CATEGORY = godot_property_usage_flags.GODOT_PROPERTY_USAGE_CATEGORY CATEGORY = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_CATEGORY
STORE_IF_NONZERO = godot_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NONZERO STORE_IF_NONZERO = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NONZERO
STORE_IF_NONONE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NONONE STORE_IF_NONONE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NONONE
NO_INSTANCE_STATE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE NO_INSTANCE_STATE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE
RESTART_IF_CHANGED = godot_property_usage_flags.GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED RESTART_IF_CHANGED = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED
SCRIPT_VARIABLE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE SCRIPT_VARIABLE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE
STORE_IF_NULL = godot_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NULL STORE_IF_NULL = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NULL
ANIMATE_AS_TRIGGER = godot_property_usage_flags.GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER ANIMATE_AS_TRIGGER = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER
UPDATE_ALL_IF_MODIFIED = godot_property_usage_flags.GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED UPDATE_ALL_IF_MODIFIED = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED
DEFAULT = godot_property_usage_flags.GODOT_PROPERTY_USAGE_DEFAULT DEFAULT = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_DEFAULT
DEFAULT_INTL = godot_property_usage_flags.GODOT_PROPERTY_USAGE_DEFAULT_INTL DEFAULT_INTL = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_DEFAULT_INTL
NOEDITOR = godot_property_usage_flags.GODOT_PROPERTY_USAGE_NOEDITOR NOEDITOR = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_NOEDITOR
# Expose RPC modes can be used both as a decorator and as a value to pass # Expose RPC modes can be used both as a decorator and as a value to pass
@ -161,17 +161,17 @@ class ExportedField:
type = Array if type == list else type type = Array if type == list else type
type = Dictionary if type == dict else type type = Dictionary if type == dict else type
if not is_pytype_compatible_with_godot_variant(type): if not is_pytype_compatible_with_pandemonium_variant(type):
raise ValueError(f"{type!r} type value not compatible with Godot") raise ValueError(f"{type!r} type value not compatible with Godot")
cdef godot_variant gd_default cdef pandemonium_variant gd_default
if default is not None: if default is not None:
# Convert `default` to a Godot-compatible value (e.g. str -> GDString) # Convert `default` to a Godot-compatible value (e.g. str -> GDString)
if not pyobj_to_godot_variant(default, &gd_default): if not pyobj_to_pandemonium_variant(default, &gd_default):
gdapi10.godot_variant_destroy(&gd_default) gdapi10.pandemonium_variant_destroy(&gd_default)
raise ValueError(f"{default!r} default value not compatible with Godot") raise ValueError(f"{default!r} default value not compatible with Godot")
default = godot_variant_to_pyobj(&gd_default) default = pandemonium_variant_to_pyobj(&gd_default)
gdapi10.godot_variant_destroy(&gd_default) gdapi10.pandemonium_variant_destroy(&gd_default)
if not isinstance(default, type): if not isinstance(default, type):
raise ValueError(f"{default!r} default value not compatible with {type!r} type") raise ValueError(f"{default!r} default value not compatible with {type!r} type")

View File

@ -3,7 +3,7 @@
* to the pythonscript plugin. * to the pythonscript plugin.
* It should be loaded by Godot's GDNative system (see the `pythonscript.gdnlib` * It should be loaded by Godot's GDNative system (see the `pythonscript.gdnlib`
* file in the example/test projects). * file in the example/test projects).
* As part of the loading, GDNative will call the `godot_gdnative_init` * As part of the loading, GDNative will call the `pandemonium_gdnative_init`
* function which will in turn initialize the CPython interpreter then register * function which will in turn initialize the CPython interpreter then register
* Python as a new language using Godot's Pluginscript system. * Python as a new language using Godot's Pluginscript system.
*/ */
@ -18,7 +18,7 @@
#include <gdnative_api_struct.gen.h> #include <gdnative_api_struct.gen.h>
#include "_godot_api.h" #include "_pandemonium_api.h"
static const char *PYTHONSCRIPT_RECOGNIZED_EXTENSIONS[] = { "py", "pyc", "pyo", "pyd", 0 }; static const char *PYTHONSCRIPT_RECOGNIZED_EXTENSIONS[] = { "py", "pyc", "pyo", "pyd", 0 };
@ -60,7 +60,7 @@ static const char *PYTHONSCRIPT_RESERVED_WORDS[] = {
}; };
static const char *PYTHONSCRIPT_COMMENT_DELIMITERS[] = { "#", "\"\"\"\"\"\"", 0 }; static const char *PYTHONSCRIPT_COMMENT_DELIMITERS[] = { "#", "\"\"\"\"\"\"", 0 };
static const char *PYTHONSCRIPT_STRING_DELIMITERS[] = { "\" \"", "' '", 0 }; static const char *PYTHONSCRIPT_STRING_DELIMITERS[] = { "\" \"", "' '", 0 };
static godot_pluginscript_language_desc desc; static pandemonium_pluginscript_language_desc desc;
static PyThreadState *gilstate = NULL; static PyThreadState *gilstate = NULL;
@ -74,38 +74,38 @@ static PyThreadState *gilstate = NULL;
#else #else
# define PYTHONSCRIPT_EXPORT # define PYTHONSCRIPT_EXPORT
#endif #endif
PYTHONSCRIPT_EXPORT const godot_gdnative_core_api_struct *pythonscript_gdapi10 = NULL; PYTHONSCRIPT_EXPORT const pandemonium_gdnative_core_api_struct *pythonscript_gdapi10 = NULL;
PYTHONSCRIPT_EXPORT const godot_gdnative_core_1_1_api_struct *pythonscript_gdapi11 = NULL; PYTHONSCRIPT_EXPORT const pandemonium_gdnative_core_1_1_api_struct *pythonscript_gdapi11 = NULL;
PYTHONSCRIPT_EXPORT const godot_gdnative_core_1_2_api_struct *pythonscript_gdapi12 = NULL; PYTHONSCRIPT_EXPORT const pandemonium_gdnative_core_1_2_api_struct *pythonscript_gdapi12 = NULL;
PYTHONSCRIPT_EXPORT const godot_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript = NULL; PYTHONSCRIPT_EXPORT const pandemonium_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript = NULL;
PYTHONSCRIPT_EXPORT const godot_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript = NULL; PYTHONSCRIPT_EXPORT const pandemonium_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript = NULL;
PYTHONSCRIPT_EXPORT const godot_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android = NULL; PYTHONSCRIPT_EXPORT const pandemonium_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android = NULL;
PYTHONSCRIPT_EXPORT const godot_gdnative_ext_arvr_api_struct *pythonscript_gdapi_ext_arvr = NULL; PYTHONSCRIPT_EXPORT const pandemonium_gdnative_ext_arvr_api_struct *pythonscript_gdapi_ext_arvr = NULL;
static void _register_gdapi(const godot_gdnative_init_options *options) { static void _register_gdapi(const pandemonium_gdnative_init_options *options) {
pythonscript_gdapi10 = (const godot_gdnative_core_api_struct *)options->api_struct; pythonscript_gdapi10 = (const pandemonium_gdnative_core_api_struct *)options->api_struct;
if (pythonscript_gdapi10->next) { if (pythonscript_gdapi10->next) {
pythonscript_gdapi11 = (const godot_gdnative_core_1_1_api_struct *)pythonscript_gdapi10->next; pythonscript_gdapi11 = (const pandemonium_gdnative_core_1_1_api_struct *)pythonscript_gdapi10->next;
if (pythonscript_gdapi11->next) { if (pythonscript_gdapi11->next) {
pythonscript_gdapi12 = (const godot_gdnative_core_1_2_api_struct *)pythonscript_gdapi11->next; pythonscript_gdapi12 = (const pandemonium_gdnative_core_1_2_api_struct *)pythonscript_gdapi11->next;
} }
} }
for (unsigned int i = 0; i < pythonscript_gdapi10->num_extensions; i++) { for (unsigned int i = 0; i < pythonscript_gdapi10->num_extensions; i++) {
const godot_gdnative_api_struct *ext = pythonscript_gdapi10->extensions[i]; const pandemonium_gdnative_api_struct *ext = pythonscript_gdapi10->extensions[i];
switch (ext->type) { switch (ext->type) {
case GDNATIVE_EXT_NATIVESCRIPT: case GDNATIVE_EXT_NATIVESCRIPT:
pythonscript_gdapi_ext_nativescript = (const godot_gdnative_ext_nativescript_api_struct *)ext; pythonscript_gdapi_ext_nativescript = (const pandemonium_gdnative_ext_nativescript_api_struct *)ext;
break; break;
case GDNATIVE_EXT_PLUGINSCRIPT: case GDNATIVE_EXT_PLUGINSCRIPT:
pythonscript_gdapi_ext_pluginscript = (const godot_gdnative_ext_pluginscript_api_struct *)ext; pythonscript_gdapi_ext_pluginscript = (const pandemonium_gdnative_ext_pluginscript_api_struct *)ext;
break; break;
case GDNATIVE_EXT_ANDROID: case GDNATIVE_EXT_ANDROID:
pythonscript_gdapi_ext_android = (const godot_gdnative_ext_android_api_struct *)ext; pythonscript_gdapi_ext_android = (const pandemonium_gdnative_ext_android_api_struct *)ext;
break; break;
case GDNATIVE_EXT_ARVR: case GDNATIVE_EXT_ARVR:
pythonscript_gdapi_ext_arvr = (const godot_gdnative_ext_arvr_api_struct *)ext; pythonscript_gdapi_ext_arvr = (const pandemonium_gdnative_ext_arvr_api_struct *)ext;
break; break;
default: default:
break; break;
@ -114,22 +114,22 @@ static void _register_gdapi(const godot_gdnative_init_options *options) {
} }
GDN_EXPORT void godot_gdnative_init(godot_gdnative_init_options *options) { GDN_EXPORT void pandemonium_gdnative_init(pandemonium_gdnative_init_options *options) {
// Registering the api should be the very first thing to do ! // Registering the api should be the very first thing to do !
_register_gdapi(options); _register_gdapi(options);
// Now those macros are usable // Now those macros are usable
#define GD_PRINT(c_msg) { \ #define GD_PRINT(c_msg) { \
godot_string gd_msg; \ pandemonium_string gd_msg; \
pythonscript_gdapi10->godot_string_new_with_wide_string( \ pythonscript_gdapi10->pandemonium_string_new_with_wide_string( \
&gd_msg, c_msg, -1); \ &gd_msg, c_msg, -1); \
pythonscript_gdapi10->godot_print(&gd_msg); \ pythonscript_gdapi10->pandemonium_print(&gd_msg); \
pythonscript_gdapi10->godot_string_destroy(&gd_msg); \ pythonscript_gdapi10->pandemonium_string_destroy(&gd_msg); \
} }
#define GD_ERROR_PRINT(msg) { \ #define GD_ERROR_PRINT(msg) { \
pythonscript_gdapi10->godot_print_error(msg, __func__, __FILE__, __LINE__); \ pythonscript_gdapi10->pandemonium_print_error(msg, __func__, __FILE__, __LINE__); \
} }
// Check for mandatory plugins // Check for mandatory plugins
@ -147,7 +147,7 @@ GDN_EXPORT void godot_gdnative_init(godot_gdnative_init_options *options) {
// Make sure the shared library has all it symbols loaded // Make sure the shared library has all it symbols loaded
// (strange bug with libpython3.x.so otherwise...) // (strange bug with libpython3.x.so otherwise...)
{ {
const wchar_t *wpath = pythonscript_gdapi10->godot_string_wide_str( const wchar_t *wpath = pythonscript_gdapi10->pandemonium_string_wide_str(
options->active_library_path options->active_library_path
); );
char path[300]; char path[300];
@ -167,11 +167,11 @@ GDN_EXPORT void godot_gdnative_init(godot_gdnative_init_options *options) {
// Retrieve path and set pythonhome // Retrieve path and set pythonhome
{ {
static wchar_t pythonhome[300]; static wchar_t pythonhome[300];
godot_string _pythonhome = pythonscript_gdapi10->godot_string_get_base_dir( pandemonium_string _pythonhome = pythonscript_gdapi10->pandemonium_string_get_base_dir(
options->active_library_path options->active_library_path
); );
wcsncpy(pythonhome, pythonscript_gdapi10->godot_string_wide_str(&_pythonhome), 300); wcsncpy(pythonhome, pythonscript_gdapi10->pandemonium_string_wide_str(&_pythonhome), 300);
pythonscript_gdapi10->godot_string_destroy(&_pythonhome); pythonscript_gdapi10->pandemonium_string_destroy(&_pythonhome);
Py_SetPythonHome(pythonhome); Py_SetPythonHome(pythonhome);
} }
// TODO: site.USER_SITE seems to point to an invalid location in ~/.local // TODO: site.USER_SITE seems to point to an invalid location in ~/.local
@ -246,18 +246,18 @@ GDN_EXPORT void godot_gdnative_init(godot_gdnative_init_options *options) {
desc.profiling_get_frame_data = pythonscript_profiling_get_frame_data; desc.profiling_get_frame_data = pythonscript_profiling_get_frame_data;
desc.profiling_frame = pythonscript_profiling_frame; desc.profiling_frame = pythonscript_profiling_frame;
} }
pythonscript_gdapi_ext_pluginscript->godot_pluginscript_register_language(&desc); pythonscript_gdapi_ext_pluginscript->pandemonium_pluginscript_register_language(&desc);
// Release the Kraken... er I mean the GIL ! // Release the Kraken... er I mean the GIL !
gilstate = PyEval_SaveThread(); gilstate = PyEval_SaveThread();
} }
GDN_EXPORT void godot_gdnative_singleton() { GDN_EXPORT void pandemonium_gdnative_singleton() {
} }
GDN_EXPORT void godot_gdnative_terminate() { GDN_EXPORT void pandemonium_gdnative_terminate() {
// Re-acquire the gil in order to finalize properly // Re-acquire the gil in order to finalize properly
PyEval_RestoreThread(gilstate); PyEval_RestoreThread(gilstate);

View File

@ -23,8 +23,8 @@ for test in ["bindings", "helloworld", "threading", "global_constants"]:
dist_symlink = env.Symlink(f"{test}/lib", "_lib_vendors") dist_symlink = env.Symlink(f"{test}/lib", "_lib_vendors")
target = env.Command( target = env.Command(
test, test,
["$godot_binary", dist_symlink], ["$pandemonium_binary", dist_symlink],
cmd_prefx + "${SOURCE.abspath} ${godot_args} --path ${TARGET} " + cmd_suffix, cmd_prefx + "${SOURCE.abspath} ${pandemonium_args} --path ${TARGET} " + cmd_suffix,
) )
env.Depends(target, env["DIST_ROOT"]) env.Depends(target, env["DIST_ROOT"])
env.AlwaysBuild(target) env.AlwaysBuild(target)

View File

@ -2,7 +2,7 @@
singleton=true singleton=true
load_once=true load_once=true
symbol_prefix="godot_" symbol_prefix="pandemonium_"
[entry] [entry]

View File

@ -124,18 +124,18 @@ def test_bad_instantiate(arg):
Array(arg) Array(arg)
def test_instantiate_with_non_godot_data(recwarn): def test_instantiate_with_non_pandemonium_data(recwarn):
with pytest.raises(TypeError): with pytest.raises(TypeError):
Array([object()]) Array([object()])
def test_append_with_non_godot_data(recwarn): def test_append_with_non_pandemonium_data(recwarn):
v = Array() v = Array()
with pytest.raises(TypeError): with pytest.raises(TypeError):
v.append(object()) v.append(object())
def test_add_with_non_godot_data(recwarn): def test_add_with_non_pandemonium_data(recwarn):
v = Array() v = Array()
with pytest.raises(TypeError): with pytest.raises(TypeError):
v += [object()] v += [object()]

View File

@ -73,7 +73,7 @@ def test_call_with_defaults_and_too_few_args(current_node):
def test_call_none_in_base_type_args(current_node): def test_call_none_in_base_type_args(current_node):
with pytest.raises(TypeError) as exc: with pytest.raises(TypeError) as exc:
# signature: def get_child(self, godot_int idx) # signature: def get_child(self, pandemonium_int idx)
current_node.get_child(None) current_node.get_child(None)
assert str(exc.value) == "an integer is required" assert str(exc.value) == "an integer is required"
@ -221,9 +221,9 @@ def test_virtual_to_string_customize(generate_obj):
node._to_string() node._to_string()
@pytest.fixture(params=["godot_class", "python_subclass"]) @pytest.fixture(params=["pandemonium_class", "python_subclass"])
def node_for_access(request, current_node, generate_obj): def node_for_access(request, current_node, generate_obj):
if request.param == "godot_class": if request.param == "pandemonium_class":
return generate_obj(Node) return generate_obj(Node)
else: else:
return current_node return current_node

View File

@ -8,7 +8,7 @@
# pyobj_to_gdobj, # pyobj_to_gdobj,
# gd_to_py_type, # gd_to_py_type,
# py_to_gd_type, # py_to_gd_type,
# godot_string_to_pyobj, # pandemonium_string_to_pyobj,
# ) # )
# from pythonscriptcffi import lib # from pythonscriptcffi import lib
@ -51,9 +51,9 @@
# @pytest.mark.parametrize("arg", ["", "foo", "l" + "o" * 25000 + "ong"]) # @pytest.mark.parametrize("arg", ["", "foo", "l" + "o" * 25000 + "ong"])
# def test_godot_string_to_pyobj(arg): # def test_pandemonium_string_to_pyobj(arg):
# gdstr = pyobj_to_gdobj(arg) # gdstr = pyobj_to_gdobj(arg)
# ret_arg = godot_string_to_pyobj(gdstr) # ret_arg = pandemonium_string_to_pyobj(gdstr)
# assert ret_arg == arg # assert ret_arg == arg

View File

@ -46,15 +46,15 @@ class access_from_python(Node):
self.outcome = global_import_outcome self.outcome = global_import_outcome
return return
from godot import globals as godot_globals from godot import globals as pandemonium_globals
godot_globals_dir = dir(godot_globals) pandemonium_globals_dir = dir(pandemonium_globals)
expected_godot_globals_dir = ["global_gd", "global_py"] expected_pandemonium_globals_dir = ["global_gd", "global_py"]
if godot_globals_dir != expected_godot_globals_dir: if pandemonium_globals_dir != expected_pandemonium_globals_dir:
self.outcome = f"Invalid `dir(godot.globals)` (expected: `{expected_godot_globals_dir}`, got `{godot_globals_dir}`)" self.outcome = f"Invalid `dir(godot.globals)` (expected: `{expected_pandemonium_globals_dir}`, got `{pandemonium_globals_dir}`)"
return return
for name, type in (("global_py", "Python"), ("global_gd", "GDScript")): for name, type in (("global_py", "Python"), ("global_gd", "GDScript")):
node_from_globals = getattr(godot_globals, name) node_from_globals = getattr(pandemonium_globals, name)
if str(node_from_globals.type) != type: if str(node_from_globals.type) != type:
self.outcome = ( self.outcome = (
f"Invalid Node type for `{path}` (expected `{type}`, got `{node.type}`)" f"Invalid Node type for `{path}` (expected `{type}`, got `{node.type}`)"

View File

@ -2,7 +2,7 @@
singleton=true singleton=true
load_once=true load_once=true
symbol_prefix="godot_" symbol_prefix="pandemonium_"
[entry] [entry]

View File

@ -2,7 +2,7 @@
singleton=true singleton=true
load_once=true load_once=true
symbol_prefix="godot_" symbol_prefix="pandemonium_"
[entry] [entry]

View File

@ -68,7 +68,7 @@ test_factory("run_python", f"{python} --version")
test_factory( test_factory(
"import_godot_module", "import_pandemonium_module",
[ [
python, python,
"-c", "-c",

View File

@ -2,7 +2,7 @@
singleton=true singleton=true
load_once=true load_once=true
symbol_prefix="godot_" symbol_prefix="pandemonium_"
[entry] [entry]

View File

@ -19,7 +19,7 @@ def test_simple_thread():
assert thread_said_hello assert thread_said_hello
def test_use_godot_from_thread(): def test_use_pandemonium_from_thread():
def target(): def target():
st = SurfaceTool() st = SurfaceTool()
st.begin(Mesh.PRIMITIVE_TRIANGLES) st.begin(Mesh.PRIMITIVE_TRIANGLES)

View File

@ -2,7 +2,7 @@
singleton=true singleton=true
load_once=true load_once=true
symbol_prefix="godot_" symbol_prefix="pandemonium_"
[entry] [entry]