mirror of
https://github.com/Relintai/gdnative_python.git
synced 2025-01-19 15:07:17 +01:00
Mass replace godot to pandemonium pt1.
This commit is contained in:
parent
f2c01c272e
commit
e9f699aabd
6
.github/workflows_off/build.yml
vendored
6
.github/workflows_off/build.yml
vendored
@ -65,7 +65,7 @@ jobs:
|
||||
pip install -U pip
|
||||
pip install -r requirements.txt
|
||||
# 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 'CC = "${{ env.CC }}"' >> custom.py
|
||||
- name: 'Build project'
|
||||
@ -126,7 +126,7 @@ jobs:
|
||||
python -m pip install --user -U pip
|
||||
python -m pip install --user -r requirements.txt
|
||||
# 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 'MSVC_USE_SCRIPT = True' >> custom.py
|
||||
echo 'TARGET_ARCH = "${{ matrix.VS_ARCH }}"' >> custom.py
|
||||
@ -198,7 +198,7 @@ jobs:
|
||||
pip install -U pip
|
||||
pip install -r requirements.txt
|
||||
# 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 'CC = "${{ env.CC }}"' >> custom.py
|
||||
- name: 'Build project'
|
||||
|
13
README.rst
13
README.rst
@ -86,16 +86,7 @@ Godot-Python requires Python >= 3.7 and a C compiler.
|
||||
Godot GDNative header
|
||||
---------------------
|
||||
|
||||
|
||||
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>`_.
|
||||
|
||||
TODO (need to be copied from the gdnative module)
|
||||
|
||||
Linux
|
||||
-----
|
||||
@ -263,7 +254,7 @@ use that the static library and binary for building and tests.
|
||||
|
||||
.. 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
|
||||
|
14
SConstruct
14
SConstruct
@ -17,10 +17,10 @@ def extract_version():
|
||||
return gl["__version__"]
|
||||
|
||||
|
||||
def godot_binary_converter(val, env):
|
||||
def pandemonium_binary_converter(val, env):
|
||||
file = File(val)
|
||||
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
|
||||
return file
|
||||
# Provided value is version information with format <major>.<minor>.<patch>[-<extra>]
|
||||
@ -31,8 +31,8 @@ def godot_binary_converter(val, env):
|
||||
raise UserError(
|
||||
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")
|
||||
# `godot_binary` is set to None to indicate it should be downloaded
|
||||
env["pandemonium_binary_download_version"] = (major, minor, patch, extra or "stable")
|
||||
# `pandemonium_binary` is set to None to indicate it should be downloaded
|
||||
return None
|
||||
|
||||
|
||||
@ -47,14 +47,14 @@ vars.Add(
|
||||
)
|
||||
vars.Add("pytest_args", "Pytest arguments passed to tests functions", "")
|
||||
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(
|
||||
"godot_binary",
|
||||
"pandemonium_binary",
|
||||
"Path to Godot binary or version of Godot to use",
|
||||
default="3.2.2",
|
||||
converter=godot_binary_converter,
|
||||
converter=pandemonium_binary_converter,
|
||||
)
|
||||
vars.Add("pandemonium_headers", "Path to Godot GDnative headers", "")
|
||||
vars.Add("debugger", "Run test with a debugger", "")
|
||||
|
@ -3,7 +3,7 @@ Import("env")
|
||||
for test in ["pong", "pong_multiplayer"]:
|
||||
dist_symlink = env.Symlink(f"{test}/addons", "$DIST_ROOT/addons")
|
||||
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)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
symbol_prefix="pandemonium_"
|
||||
|
||||
[entry]
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
symbol_prefix="pandemonium_"
|
||||
|
||||
[entry]
|
||||
|
||||
|
@ -13,114 +13,114 @@ __ERR_MSG_BINDING_NOT_AVAILABLE = "No Godot binding available"
|
||||
|
||||
|
||||
class Error(IntFlag):
|
||||
OK = godot_error.GODOT_OK
|
||||
FAILED = godot_error.GODOT_FAILED
|
||||
ERR_UNAVAILABLE = godot_error.GODOT_ERR_UNAVAILABLE
|
||||
ERR_UNCONFIGURED = godot_error.GODOT_ERR_UNCONFIGURED
|
||||
ERR_UNAUTHORIZED = godot_error.GODOT_ERR_UNAUTHORIZED
|
||||
ERR_PARAMETER_RANGE_ERROR = godot_error.GODOT_ERR_PARAMETER_RANGE_ERROR
|
||||
ERR_OUT_OF_MEMORY = godot_error.GODOT_ERR_OUT_OF_MEMORY
|
||||
ERR_FILE_NOT_FOUND = godot_error.GODOT_ERR_FILE_NOT_FOUND
|
||||
ERR_FILE_BAD_DRIVE = godot_error.GODOT_ERR_FILE_BAD_DRIVE
|
||||
ERR_FILE_BAD_PATH = godot_error.GODOT_ERR_FILE_BAD_PATH
|
||||
ERR_FILE_NO_PERMISSION = godot_error.GODOT_ERR_FILE_NO_PERMISSION
|
||||
ERR_FILE_ALREADY_IN_USE = godot_error.GODOT_ERR_FILE_ALREADY_IN_USE
|
||||
ERR_FILE_CANT_OPEN = godot_error.GODOT_ERR_FILE_CANT_OPEN
|
||||
ERR_FILE_CANT_WRITE = godot_error.GODOT_ERR_FILE_CANT_WRITE
|
||||
ERR_FILE_CANT_READ = godot_error.GODOT_ERR_FILE_CANT_READ
|
||||
ERR_FILE_UNRECOGNIZED = godot_error.GODOT_ERR_FILE_UNRECOGNIZED
|
||||
ERR_FILE_CORRUPT = godot_error.GODOT_ERR_FILE_CORRUPT
|
||||
ERR_FILE_MISSING_DEPENDENCIES = godot_error.GODOT_ERR_FILE_MISSING_DEPENDENCIES
|
||||
ERR_FILE_EOF = godot_error.GODOT_ERR_FILE_EOF
|
||||
ERR_CANT_OPEN = godot_error.GODOT_ERR_CANT_OPEN
|
||||
ERR_CANT_CREATE = godot_error.GODOT_ERR_CANT_CREATE
|
||||
ERR_QUERY_FAILED = godot_error.GODOT_ERR_QUERY_FAILED
|
||||
ERR_ALREADY_IN_USE = godot_error.GODOT_ERR_ALREADY_IN_USE
|
||||
ERR_LOCKED = godot_error.GODOT_ERR_LOCKED
|
||||
ERR_TIMEOUT = godot_error.GODOT_ERR_TIMEOUT
|
||||
ERR_CANT_CONNECT = godot_error.GODOT_ERR_CANT_CONNECT
|
||||
ERR_CANT_RESOLVE = godot_error.GODOT_ERR_CANT_RESOLVE
|
||||
ERR_CONNECTION_ERROR = godot_error.GODOT_ERR_CONNECTION_ERROR
|
||||
ERR_CANT_ACQUIRE_RESOURCE = godot_error.GODOT_ERR_CANT_ACQUIRE_RESOURCE
|
||||
ERR_CANT_FORK = godot_error.GODOT_ERR_CANT_FORK
|
||||
ERR_INVALID_DATA = godot_error.GODOT_ERR_INVALID_DATA
|
||||
ERR_INVALID_PARAMETER = godot_error.GODOT_ERR_INVALID_PARAMETER
|
||||
ERR_ALREADY_EXISTS = godot_error.GODOT_ERR_ALREADY_EXISTS
|
||||
ERR_DOES_NOT_EXIST = godot_error.GODOT_ERR_DOES_NOT_EXIST
|
||||
ERR_DATABASE_CANT_READ = godot_error.GODOT_ERR_DATABASE_CANT_READ
|
||||
ERR_DATABASE_CANT_WRITE = godot_error.GODOT_ERR_DATABASE_CANT_WRITE
|
||||
ERR_COMPILATION_FAILED = godot_error.GODOT_ERR_COMPILATION_FAILED
|
||||
ERR_METHOD_NOT_FOUND = godot_error.GODOT_ERR_METHOD_NOT_FOUND
|
||||
ERR_LINK_FAILED = godot_error.GODOT_ERR_LINK_FAILED
|
||||
ERR_SCRIPT_FAILED = godot_error.GODOT_ERR_SCRIPT_FAILED
|
||||
ERR_CYCLIC_LINK = godot_error.GODOT_ERR_CYCLIC_LINK
|
||||
ERR_INVALID_DECLARATION = godot_error.GODOT_ERR_INVALID_DECLARATION
|
||||
ERR_DUPLICATE_SYMBOL = godot_error.GODOT_ERR_DUPLICATE_SYMBOL
|
||||
ERR_PARSE_ERROR = godot_error.GODOT_ERR_PARSE_ERROR
|
||||
ERR_BUSY = godot_error.GODOT_ERR_BUSY
|
||||
ERR_SKIP = godot_error.GODOT_ERR_SKIP
|
||||
ERR_HELP = godot_error.GODOT_ERR_HELP
|
||||
ERR_BUG = godot_error.GODOT_ERR_BUG
|
||||
ERR_PRINTER_ON_FIRE = godot_error.GODOT_ERR_PRINTER_ON_FIRE
|
||||
OK = pandemonium_error.GODOT_OK
|
||||
FAILED = pandemonium_error.GODOT_FAILED
|
||||
ERR_UNAVAILABLE = pandemonium_error.GODOT_ERR_UNAVAILABLE
|
||||
ERR_UNCONFIGURED = pandemonium_error.GODOT_ERR_UNCONFIGURED
|
||||
ERR_UNAUTHORIZED = pandemonium_error.GODOT_ERR_UNAUTHORIZED
|
||||
ERR_PARAMETER_RANGE_ERROR = pandemonium_error.GODOT_ERR_PARAMETER_RANGE_ERROR
|
||||
ERR_OUT_OF_MEMORY = pandemonium_error.GODOT_ERR_OUT_OF_MEMORY
|
||||
ERR_FILE_NOT_FOUND = pandemonium_error.GODOT_ERR_FILE_NOT_FOUND
|
||||
ERR_FILE_BAD_DRIVE = pandemonium_error.GODOT_ERR_FILE_BAD_DRIVE
|
||||
ERR_FILE_BAD_PATH = pandemonium_error.GODOT_ERR_FILE_BAD_PATH
|
||||
ERR_FILE_NO_PERMISSION = pandemonium_error.GODOT_ERR_FILE_NO_PERMISSION
|
||||
ERR_FILE_ALREADY_IN_USE = pandemonium_error.GODOT_ERR_FILE_ALREADY_IN_USE
|
||||
ERR_FILE_CANT_OPEN = pandemonium_error.GODOT_ERR_FILE_CANT_OPEN
|
||||
ERR_FILE_CANT_WRITE = pandemonium_error.GODOT_ERR_FILE_CANT_WRITE
|
||||
ERR_FILE_CANT_READ = pandemonium_error.GODOT_ERR_FILE_CANT_READ
|
||||
ERR_FILE_UNRECOGNIZED = pandemonium_error.GODOT_ERR_FILE_UNRECOGNIZED
|
||||
ERR_FILE_CORRUPT = pandemonium_error.GODOT_ERR_FILE_CORRUPT
|
||||
ERR_FILE_MISSING_DEPENDENCIES = pandemonium_error.GODOT_ERR_FILE_MISSING_DEPENDENCIES
|
||||
ERR_FILE_EOF = pandemonium_error.GODOT_ERR_FILE_EOF
|
||||
ERR_CANT_OPEN = pandemonium_error.GODOT_ERR_CANT_OPEN
|
||||
ERR_CANT_CREATE = pandemonium_error.GODOT_ERR_CANT_CREATE
|
||||
ERR_QUERY_FAILED = pandemonium_error.GODOT_ERR_QUERY_FAILED
|
||||
ERR_ALREADY_IN_USE = pandemonium_error.GODOT_ERR_ALREADY_IN_USE
|
||||
ERR_LOCKED = pandemonium_error.GODOT_ERR_LOCKED
|
||||
ERR_TIMEOUT = pandemonium_error.GODOT_ERR_TIMEOUT
|
||||
ERR_CANT_CONNECT = pandemonium_error.GODOT_ERR_CANT_CONNECT
|
||||
ERR_CANT_RESOLVE = pandemonium_error.GODOT_ERR_CANT_RESOLVE
|
||||
ERR_CONNECTION_ERROR = pandemonium_error.GODOT_ERR_CONNECTION_ERROR
|
||||
ERR_CANT_ACQUIRE_RESOURCE = pandemonium_error.GODOT_ERR_CANT_ACQUIRE_RESOURCE
|
||||
ERR_CANT_FORK = pandemonium_error.GODOT_ERR_CANT_FORK
|
||||
ERR_INVALID_DATA = pandemonium_error.GODOT_ERR_INVALID_DATA
|
||||
ERR_INVALID_PARAMETER = pandemonium_error.GODOT_ERR_INVALID_PARAMETER
|
||||
ERR_ALREADY_EXISTS = pandemonium_error.GODOT_ERR_ALREADY_EXISTS
|
||||
ERR_DOES_NOT_EXIST = pandemonium_error.GODOT_ERR_DOES_NOT_EXIST
|
||||
ERR_DATABASE_CANT_READ = pandemonium_error.GODOT_ERR_DATABASE_CANT_READ
|
||||
ERR_DATABASE_CANT_WRITE = pandemonium_error.GODOT_ERR_DATABASE_CANT_WRITE
|
||||
ERR_COMPILATION_FAILED = pandemonium_error.GODOT_ERR_COMPILATION_FAILED
|
||||
ERR_METHOD_NOT_FOUND = pandemonium_error.GODOT_ERR_METHOD_NOT_FOUND
|
||||
ERR_LINK_FAILED = pandemonium_error.GODOT_ERR_LINK_FAILED
|
||||
ERR_SCRIPT_FAILED = pandemonium_error.GODOT_ERR_SCRIPT_FAILED
|
||||
ERR_CYCLIC_LINK = pandemonium_error.GODOT_ERR_CYCLIC_LINK
|
||||
ERR_INVALID_DECLARATION = pandemonium_error.GODOT_ERR_INVALID_DECLARATION
|
||||
ERR_DUPLICATE_SYMBOL = pandemonium_error.GODOT_ERR_DUPLICATE_SYMBOL
|
||||
ERR_PARSE_ERROR = pandemonium_error.GODOT_ERR_PARSE_ERROR
|
||||
ERR_BUSY = pandemonium_error.GODOT_ERR_BUSY
|
||||
ERR_SKIP = pandemonium_error.GODOT_ERR_SKIP
|
||||
ERR_HELP = pandemonium_error.GODOT_ERR_HELP
|
||||
ERR_BUG = pandemonium_error.GODOT_ERR_BUG
|
||||
ERR_PRINTER_ON_FIRE = pandemonium_error.GODOT_ERR_PRINTER_ON_FIRE
|
||||
|
||||
|
||||
class VariantType(IntFlag):
|
||||
NIL = godot_variant_type.GODOT_VARIANT_TYPE_NIL
|
||||
BOOL = godot_variant_type.GODOT_VARIANT_TYPE_BOOL
|
||||
INT = godot_variant_type.GODOT_VARIANT_TYPE_INT
|
||||
REAL = godot_variant_type.GODOT_VARIANT_TYPE_REAL
|
||||
STRING = godot_variant_type.GODOT_VARIANT_TYPE_STRING
|
||||
VECTOR2 = godot_variant_type.GODOT_VARIANT_TYPE_VECTOR2
|
||||
RECT2 = godot_variant_type.GODOT_VARIANT_TYPE_RECT2
|
||||
VECTOR3 = godot_variant_type.GODOT_VARIANT_TYPE_VECTOR3
|
||||
TRANSFORM2D = godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D
|
||||
PLANE = godot_variant_type.GODOT_VARIANT_TYPE_PLANE
|
||||
QUAT = godot_variant_type.GODOT_VARIANT_TYPE_QUAT
|
||||
AABB = godot_variant_type.GODOT_VARIANT_TYPE_AABB
|
||||
BASIS = godot_variant_type.GODOT_VARIANT_TYPE_BASIS
|
||||
TRANSFORM = godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM
|
||||
COLOR = godot_variant_type.GODOT_VARIANT_TYPE_COLOR
|
||||
NODE_PATH = godot_variant_type.GODOT_VARIANT_TYPE_NODE_PATH
|
||||
RID = godot_variant_type.GODOT_VARIANT_TYPE_RID
|
||||
OBJECT = godot_variant_type.GODOT_VARIANT_TYPE_OBJECT
|
||||
DICTIONARY = godot_variant_type.GODOT_VARIANT_TYPE_DICTIONARY
|
||||
ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_ARRAY
|
||||
POOL_BYTE_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY
|
||||
POOL_INT_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY
|
||||
POOL_REAL_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY
|
||||
POOL_STRING_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY
|
||||
POOL_VECTOR2_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY
|
||||
POOL_VECTOR3_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY
|
||||
POOL_COLOR_ARRAY = godot_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY
|
||||
NIL = pandemonium_variant_type.GODOT_VARIANT_TYPE_NIL
|
||||
BOOL = pandemonium_variant_type.GODOT_VARIANT_TYPE_BOOL
|
||||
INT = pandemonium_variant_type.GODOT_VARIANT_TYPE_INT
|
||||
REAL = pandemonium_variant_type.GODOT_VARIANT_TYPE_REAL
|
||||
STRING = pandemonium_variant_type.GODOT_VARIANT_TYPE_STRING
|
||||
VECTOR2 = pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR2
|
||||
RECT2 = pandemonium_variant_type.GODOT_VARIANT_TYPE_RECT2
|
||||
VECTOR3 = pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR3
|
||||
TRANSFORM2D = pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D
|
||||
PLANE = pandemonium_variant_type.GODOT_VARIANT_TYPE_PLANE
|
||||
QUAT = pandemonium_variant_type.GODOT_VARIANT_TYPE_QUAT
|
||||
AABB = pandemonium_variant_type.GODOT_VARIANT_TYPE_AABB
|
||||
BASIS = pandemonium_variant_type.GODOT_VARIANT_TYPE_BASIS
|
||||
TRANSFORM = pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM
|
||||
COLOR = pandemonium_variant_type.GODOT_VARIANT_TYPE_COLOR
|
||||
NODE_PATH = pandemonium_variant_type.GODOT_VARIANT_TYPE_NODE_PATH
|
||||
RID = pandemonium_variant_type.GODOT_VARIANT_TYPE_RID
|
||||
OBJECT = pandemonium_variant_type.GODOT_VARIANT_TYPE_OBJECT
|
||||
DICTIONARY = pandemonium_variant_type.GODOT_VARIANT_TYPE_DICTIONARY
|
||||
ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_ARRAY
|
||||
POOL_BYTE_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY
|
||||
POOL_INT_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY
|
||||
POOL_REAL_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY
|
||||
POOL_STRING_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY
|
||||
POOL_VECTOR2_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY
|
||||
POOL_VECTOR3_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY
|
||||
POOL_COLOR_ARRAY = pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY
|
||||
|
||||
|
||||
class VariantOperator(IntFlag):
|
||||
EQUAL = godot_variant_operator.GODOT_VARIANT_OP_EQUAL
|
||||
NOT_EQUAL = godot_variant_operator.GODOT_VARIANT_OP_NOT_EQUAL
|
||||
LESS = godot_variant_operator.GODOT_VARIANT_OP_LESS
|
||||
LESS_EQUAL = godot_variant_operator.GODOT_VARIANT_OP_LESS_EQUAL
|
||||
GREATER = godot_variant_operator.GODOT_VARIANT_OP_GREATER
|
||||
GREATER_EQUAL = godot_variant_operator.GODOT_VARIANT_OP_GREATER_EQUAL
|
||||
ADD = godot_variant_operator.GODOT_VARIANT_OP_ADD
|
||||
SUBTRACT = godot_variant_operator.GODOT_VARIANT_OP_SUBTRACT
|
||||
MULTIPLY = godot_variant_operator.GODOT_VARIANT_OP_MULTIPLY
|
||||
DIVIDE = godot_variant_operator.GODOT_VARIANT_OP_DIVIDE
|
||||
NEGATE = godot_variant_operator.GODOT_VARIANT_OP_NEGATE
|
||||
POSITIVE = godot_variant_operator.GODOT_VARIANT_OP_POSITIVE
|
||||
MODULE = godot_variant_operator.GODOT_VARIANT_OP_MODULE
|
||||
STRING_CONCAT = godot_variant_operator.GODOT_VARIANT_OP_STRING_CONCAT
|
||||
SHIFT_LEFT = godot_variant_operator.GODOT_VARIANT_OP_SHIFT_LEFT
|
||||
SHIFT_RIGHT = godot_variant_operator.GODOT_VARIANT_OP_SHIFT_RIGHT
|
||||
BIT_AND = godot_variant_operator.GODOT_VARIANT_OP_BIT_AND
|
||||
BIT_OR = godot_variant_operator.GODOT_VARIANT_OP_BIT_OR
|
||||
BIT_XOR = godot_variant_operator.GODOT_VARIANT_OP_BIT_XOR
|
||||
BIT_NEGATE = godot_variant_operator.GODOT_VARIANT_OP_BIT_NEGATE
|
||||
AND = godot_variant_operator.GODOT_VARIANT_OP_AND
|
||||
OR = godot_variant_operator.GODOT_VARIANT_OP_OR
|
||||
XOR = godot_variant_operator.GODOT_VARIANT_OP_XOR
|
||||
NOT = godot_variant_operator.GODOT_VARIANT_OP_NOT
|
||||
IN = godot_variant_operator.GODOT_VARIANT_OP_IN
|
||||
MAX = godot_variant_operator.GODOT_VARIANT_OP_MAX
|
||||
EQUAL = pandemonium_variant_operator.GODOT_VARIANT_OP_EQUAL
|
||||
NOT_EQUAL = pandemonium_variant_operator.GODOT_VARIANT_OP_NOT_EQUAL
|
||||
LESS = pandemonium_variant_operator.GODOT_VARIANT_OP_LESS
|
||||
LESS_EQUAL = pandemonium_variant_operator.GODOT_VARIANT_OP_LESS_EQUAL
|
||||
GREATER = pandemonium_variant_operator.GODOT_VARIANT_OP_GREATER
|
||||
GREATER_EQUAL = pandemonium_variant_operator.GODOT_VARIANT_OP_GREATER_EQUAL
|
||||
ADD = pandemonium_variant_operator.GODOT_VARIANT_OP_ADD
|
||||
SUBTRACT = pandemonium_variant_operator.GODOT_VARIANT_OP_SUBTRACT
|
||||
MULTIPLY = pandemonium_variant_operator.GODOT_VARIANT_OP_MULTIPLY
|
||||
DIVIDE = pandemonium_variant_operator.GODOT_VARIANT_OP_DIVIDE
|
||||
NEGATE = pandemonium_variant_operator.GODOT_VARIANT_OP_NEGATE
|
||||
POSITIVE = pandemonium_variant_operator.GODOT_VARIANT_OP_POSITIVE
|
||||
MODULE = pandemonium_variant_operator.GODOT_VARIANT_OP_MODULE
|
||||
STRING_CONCAT = pandemonium_variant_operator.GODOT_VARIANT_OP_STRING_CONCAT
|
||||
SHIFT_LEFT = pandemonium_variant_operator.GODOT_VARIANT_OP_SHIFT_LEFT
|
||||
SHIFT_RIGHT = pandemonium_variant_operator.GODOT_VARIANT_OP_SHIFT_RIGHT
|
||||
BIT_AND = pandemonium_variant_operator.GODOT_VARIANT_OP_BIT_AND
|
||||
BIT_OR = pandemonium_variant_operator.GODOT_VARIANT_OP_BIT_OR
|
||||
BIT_XOR = pandemonium_variant_operator.GODOT_VARIANT_OP_BIT_XOR
|
||||
BIT_NEGATE = pandemonium_variant_operator.GODOT_VARIANT_OP_BIT_NEGATE
|
||||
AND = pandemonium_variant_operator.GODOT_VARIANT_OP_AND
|
||||
OR = pandemonium_variant_operator.GODOT_VARIANT_OP_OR
|
||||
XOR = pandemonium_variant_operator.GODOT_VARIANT_OP_XOR
|
||||
NOT = pandemonium_variant_operator.GODOT_VARIANT_OP_NOT
|
||||
IN = pandemonium_variant_operator.GODOT_VARIANT_OP_IN
|
||||
MAX = pandemonium_variant_operator.GODOT_VARIANT_OP_MAX
|
||||
|
||||
|
||||
### Classes ###
|
||||
@ -145,12 +145,12 @@ class VariantOperator(IntFlag):
|
||||
# (where at this point Godot should have finished it initialization).
|
||||
|
||||
{% set early_needed_bindings = ["_OS", "_ProjectSettings"] %}
|
||||
cdef godot_object *_ptr
|
||||
cdef pandemonium_object *_ptr
|
||||
{% for cls in classes %}
|
||||
{% if cls.name in early_needed_bindings %}
|
||||
{{ render_class_gdapi_ptrs_init(cls) }}
|
||||
{% if cls.singleton %}
|
||||
_ptr = gdapi10.godot_global_get_singleton("{{ cls.singleton }}")
|
||||
_ptr = gdapi10.pandemonium_global_get_singleton("{{ cls.singleton }}")
|
||||
if _ptr != NULL:
|
||||
{{ cls.singleton }} = {{ cls.name }}.from_ptr(_ptr)
|
||||
else:
|
||||
@ -181,7 +181,7 @@ cdef void _initialize_bindings():
|
||||
{{ render_class_gdapi_ptrs_init(cls) | indent }}
|
||||
{%- if 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:
|
||||
print('Cannot retreive singleton {{ cls.singleton }}')
|
||||
{%- endif %}
|
||||
|
@ -4,16 +4,16 @@
|
||||
|
||||
cdef class {{ cls.name }}({{ cls.base_class }}):
|
||||
{% if not cls.base_class %}
|
||||
cdef godot_object *_gd_ptr
|
||||
cdef pandemonium_object *_gd_ptr
|
||||
|
||||
@staticmethod
|
||||
cdef inline Object cast_from_variant(const godot_variant *p_gdvar)
|
||||
cdef inline Object cast_from_variant(const pandemonium_variant *p_gdvar)
|
||||
|
||||
@staticmethod
|
||||
cdef inline Object cast_from_ptr(godot_object *ptr)
|
||||
cdef inline Object cast_from_ptr(pandemonium_object *ptr)
|
||||
|
||||
{% endif %}
|
||||
@staticmethod
|
||||
cdef {{ cls.name }} from_ptr(godot_object *_ptr)
|
||||
cdef {{ cls.name }} from_ptr(pandemonium_object *_ptr)
|
||||
|
||||
{% endmacro %}
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
{% if not cls.singleton %}
|
||||
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 %}
|
||||
|
||||
{% for method in cls.methods %}
|
||||
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 %}
|
||||
|
||||
{% endmacro %}
|
||||
@ -24,11 +24,11 @@ from cpython.object cimport PyObject_GenericGetAttr, PyObject_GenericSetAttr
|
||||
{% endif %}
|
||||
|
||||
{% if not cls.singleton %}
|
||||
cdef godot_class_constructor __{{ cls.name }}_constructor = NULL
|
||||
cdef pandemonium_class_constructor __{{ cls.name }}_constructor = NULL
|
||||
{% endif %}
|
||||
|
||||
{% 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 %}
|
||||
|
||||
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 :'(
|
||||
def free(self):
|
||||
with nogil:
|
||||
gdapi10.godot_object_destroy(self._gd_ptr)
|
||||
gdapi10.pandemonium_object_destroy(self._gd_ptr)
|
||||
|
||||
def __init__(self):
|
||||
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}>"
|
||||
|
||||
@staticmethod
|
||||
cdef inline Object cast_from_variant(const godot_variant *p_gdvar):
|
||||
cdef godot_object *ptr = gdapi10.godot_variant_as_object(p_gdvar)
|
||||
cdef inline Object cast_from_variant(const pandemonium_variant *p_gdvar):
|
||||
cdef pandemonium_object *ptr = gdapi10.pandemonium_variant_as_object(p_gdvar)
|
||||
# Retreive class
|
||||
cdef GDString classname = GDString.__new__(GDString)
|
||||
with nogil:
|
||||
gdapi10.godot_method_bind_ptrcall(
|
||||
gdapi10.pandemonium_method_bind_ptrcall(
|
||||
__methbind__Object__get_class,
|
||||
ptr,
|
||||
NULL,
|
||||
@ -61,11 +61,11 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
|
||||
return globals()[str(classname)]._from_ptr(<size_t>ptr)
|
||||
|
||||
@staticmethod
|
||||
cdef inline Object cast_from_ptr(godot_object *ptr):
|
||||
cdef inline Object cast_from_ptr(pandemonium_object *ptr):
|
||||
# Retreive class
|
||||
cdef GDString classname = GDString.__new__(GDString)
|
||||
with nogil:
|
||||
gdapi10.godot_method_bind_ptrcall(
|
||||
gdapi10.pandemonium_method_bind_ptrcall(
|
||||
__methbind__Object__get_class,
|
||||
ptr,
|
||||
NULL,
|
||||
@ -139,14 +139,14 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
|
||||
def __init__(self):
|
||||
if __{{ cls.name }}_constructor == NULL:
|
||||
raise NotImplementedError(__ERR_MSG_BINDING_NOT_AVAILABLE)
|
||||
cdef godot_bool __ret
|
||||
cdef pandemonium_bool __ret
|
||||
with nogil:
|
||||
self._gd_ptr = __{{ cls["name"] }}_constructor()
|
||||
|
||||
if self._gd_ptr is NULL:
|
||||
raise MemoryError
|
||||
|
||||
gdapi10.godot_method_bind_ptrcall(
|
||||
gdapi10.pandemonium_method_bind_ptrcall(
|
||||
__methbind__Reference__init_ref,
|
||||
self._gd_ptr,
|
||||
NULL,
|
||||
@ -172,24 +172,24 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
|
||||
raise RuntimeError(f"Refcounted Godot object must be created with `{ cls.__name__ }()`")
|
||||
|
||||
def __dealloc__(self):
|
||||
cdef godot_bool __ret
|
||||
cdef pandemonium_bool __ret
|
||||
if self._gd_ptr == NULL:
|
||||
return
|
||||
with nogil:
|
||||
gdapi10.godot_method_bind_ptrcall(
|
||||
gdapi10.pandemonium_method_bind_ptrcall(
|
||||
__methbind__Reference__unreference,
|
||||
self._gd_ptr,
|
||||
NULL,
|
||||
&__ret
|
||||
)
|
||||
if __ret:
|
||||
gdapi10.godot_object_destroy(self._gd_ptr)
|
||||
gdapi10.pandemonium_object_destroy(self._gd_ptr)
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
@staticmethod
|
||||
cdef {{ cls.name }} from_ptr(godot_object *_ptr):
|
||||
cdef {{ cls.name }} from_ptr(pandemonium_object *_ptr):
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
cdef {{ cls.name }} wrapper = {{ cls.name }}.__new__({{ cls.name }})
|
||||
wrapper._gd_ptr = _ptr
|
||||
@ -202,7 +202,7 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
|
||||
{% if not cls.singleton and cls.instantiable %}
|
||||
@classmethod
|
||||
def _new(cls):
|
||||
cdef godot_object* ptr = __{{ cls.name }}_constructor()
|
||||
cdef pandemonium_object* ptr = __{{ cls.name }}_constructor()
|
||||
if ptr is NULL:
|
||||
raise MemoryError
|
||||
return <size_t>ptr
|
||||
@ -212,9 +212,9 @@ cdef class {{ cls.name }}({{ cls.base_class }}):
|
||||
def _from_ptr(ptr):
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
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 !
|
||||
wrapper._gd_ptr = <godot_object *><size_t>ptr
|
||||
wrapper._gd_ptr = <pandemonium_object *><size_t>ptr
|
||||
{% if cls.is_reference %}
|
||||
# Note we steal the reference from the caller given we
|
||||
# don't call `Reference.reference` here
|
||||
|
@ -15,7 +15,7 @@ __methbind__{{ cls.name }}__{{ method.name }}
|
||||
{% macro render_method_signature(method) %}
|
||||
{{ method.name }}(self,
|
||||
{%- 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 }}
|
||||
{%- else %}
|
||||
{{ arg.type.cy_type }} {{ arg.name }}
|
||||
@ -42,12 +42,12 @@ if {{ retval }} == NULL:
|
||||
return None
|
||||
else:
|
||||
return Object.cast_from_ptr({{ retval }})
|
||||
{% elif method.return_type.c_type == "godot_variant" %}
|
||||
{% elif method.return_type.c_type == "pandemonium_variant" %}
|
||||
try:
|
||||
return godot_variant_to_pyobj(&{{ retval }})
|
||||
return pandemonium_variant_to_pyobj(&{{ retval }})
|
||||
finally:
|
||||
with nogil:
|
||||
gdapi10.godot_variant_destroy(&{{ retval }})
|
||||
gdapi10.pandemonium_variant_destroy(&{{ retval }})
|
||||
{% elif method.return_type.is_enum %}
|
||||
return {{ method.return_type.py_type }}({{ retval }})
|
||||
{% else %}
|
||||
@ -63,10 +63,10 @@ cdef const void *{{ argsval }}[{{ method.arguments | length }}]
|
||||
{% for arg in method.arguments %}
|
||||
{% set i = loop.index - 1 %}
|
||||
# {{ 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 }})
|
||||
{{ 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 }})
|
||||
{{ argsval }}[{{ i }}] = <void*>(&__nodepath_{{ arg.name }}._gd_data)
|
||||
{% elif arg.type.is_object %}
|
||||
@ -75,13 +75,13 @@ cdef NodePath __nodepath_{{ arg.name }} = ensure_is_nodepath({{ arg.name }})
|
||||
{%- else %}
|
||||
{{ argsval }}[{{ i }}] = <void*>{{ arg.name }}._gd_ptr
|
||||
{%- endif %}
|
||||
{% elif arg.type.c_type == "godot_variant" %}
|
||||
cdef godot_variant __var_{{ arg.name }}
|
||||
pyobj_to_godot_variant({{ arg.name }}, &__var_{{ arg.name }})
|
||||
{% elif arg.type.c_type == "pandemonium_variant" %}
|
||||
cdef pandemonium_variant __var_{{ arg.name }}
|
||||
pyobj_to_pandemonium_variant({{ arg.name }}, &__var_{{ arg.name }})
|
||||
{{ argsval }}[{{ i }}] = <void*>(&__var_{{ arg.name }})
|
||||
{% elif arg.type.is_builtin %}
|
||||
{{ 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
|
||||
cdef double {{ arg.name }}_d = <double>{{ arg.name }};
|
||||
{{ argsval }}[{{ i }}] = &{{ arg.name }}_d
|
||||
@ -95,9 +95,9 @@ cdef double {{ arg.name }}_d = <double>{{ arg.name }};
|
||||
{% macro _render_method_destroy_args(method) %}
|
||||
{% for arg in method.arguments %}
|
||||
{% set i = loop.index - 1 %}
|
||||
{% if arg.type.c_type == "godot_variant" %}
|
||||
{% if arg.type.c_type == "pandemonium_variant" %}
|
||||
with nogil:
|
||||
gdapi10.godot_variant_destroy(&__var_{{ arg.name }})
|
||||
gdapi10.pandemonium_variant_destroy(&__var_{{ arg.name }})
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{%- endmacro %}
|
||||
@ -111,16 +111,16 @@ with nogil:
|
||||
# in case of Reference, Godot will try to decrease the
|
||||
# refcount if the pointer is valid !
|
||||
# (see https://github.com/godotengine/godot/issues/35609)
|
||||
cdef godot_object *{{ retval }} = NULL
|
||||
cdef pandemonium_object *{{ retval }} = NULL
|
||||
{% set retval_as_arg = "&{}".format(retval) %}
|
||||
{% elif method.return_type.c_type == "godot_variant" %}
|
||||
cdef godot_variant {{ retval }}
|
||||
{% elif method.return_type.c_type == "pandemonium_variant" %}
|
||||
cdef pandemonium_variant {{ retval }}
|
||||
{% set retval_as_arg = "&{}".format(retval) %}
|
||||
{% elif method.return_type.is_builtin %}
|
||||
{% set cy_type = method.return_type.cy_type %}
|
||||
cdef {{ cy_type }} {{ retval }} = {{ cy_type }}.__new__({{ cy_type }})
|
||||
{% 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
|
||||
cdef double {{ 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:
|
||||
raise NotImplementedError(__ERR_MSG_BINDING_NOT_AVAILABLE)
|
||||
with nogil:
|
||||
gdapi10.godot_method_bind_ptrcall(
|
||||
gdapi10.pandemonium_method_bind_ptrcall(
|
||||
{{ get_method_bind_register_name(cls, method) }},
|
||||
self._gd_ptr,
|
||||
{% if (method.arguments | length ) != 0 %}
|
||||
|
@ -6,13 +6,13 @@
|
||||
@cython.final
|
||||
cdef class AABB:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_aabb _gd_data
|
||||
cdef pandemonium_aabb _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, Vector3 pos not None=Vector3(), Vector3 size not None=Vector3()):
|
||||
{{ force_mark_rendered("godot_aabb_new" )}}
|
||||
gdapi10.godot_aabb_new(&self._gd_data, &pos._gd_data, &size._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_aabb_new" )}}
|
||||
gdapi10.pandemonium_aabb_new(&self._gd_data, &pos._gd_data, &size._gd_data)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<AABB({self.as_string()})>"
|
||||
@ -20,33 +20,33 @@ cdef class AABB:
|
||||
@property
|
||||
def position(AABB self) -> Vector3:
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_aabb_get_position" )}}
|
||||
ret._gd_data = gdapi10.godot_aabb_get_position(&self._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_aabb_get_position" )}}
|
||||
ret._gd_data = gdapi10.pandemonium_aabb_get_position(&self._gd_data)
|
||||
return ret
|
||||
|
||||
@position.setter
|
||||
def position(AABB self, Vector3 val not None) -> None:
|
||||
{{ force_mark_rendered("godot_aabb_set_position" )}}
|
||||
gdapi10.godot_aabb_set_position(&self._gd_data, &val._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_aabb_set_position" )}}
|
||||
gdapi10.pandemonium_aabb_set_position(&self._gd_data, &val._gd_data)
|
||||
|
||||
@property
|
||||
def size(AABB self) -> Vector3:
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_aabb_get_size" )}}
|
||||
ret._gd_data = gdapi10.godot_aabb_get_size(&self._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_aabb_get_size" )}}
|
||||
ret._gd_data = gdapi10.pandemonium_aabb_get_size(&self._gd_data)
|
||||
return ret
|
||||
|
||||
@size.setter
|
||||
def size(AABB self, Vector3 val not None) -> None:
|
||||
{{ force_mark_rendered("godot_aabb_set_size" )}}
|
||||
gdapi10.godot_aabb_set_size(&self._gd_data, &val._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_aabb_set_size" )}}
|
||||
gdapi10.pandemonium_aabb_set_size(&self._gd_data, &val._gd_data)
|
||||
|
||||
@property
|
||||
def end(AABB self) -> Vector3:
|
||||
cdef godot_vector3 position = gdapi10.godot_aabb_get_position(&self._gd_data)
|
||||
cdef godot_vector3 size = gdapi10.godot_aabb_get_size(&self._gd_data)
|
||||
cdef pandemonium_vector3 position = gdapi10.pandemonium_aabb_get_position(&self._gd_data)
|
||||
cdef pandemonium_vector3 size = gdapi10.pandemonium_aabb_get_size(&self._gd_data)
|
||||
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
|
||||
|
||||
{{ render_operator_eq() | indent }}
|
||||
|
@ -4,28 +4,28 @@
|
||||
{% endblock -%}
|
||||
|
||||
{# TODO: conversion from pool arrays is not supported #}
|
||||
{{ force_mark_rendered("godot_array_new_pool_byte_array") }}
|
||||
{{ force_mark_rendered("godot_array_new_pool_color_array") }}
|
||||
{{ force_mark_rendered("godot_array_new_pool_int_array") }}
|
||||
{{ force_mark_rendered("godot_array_new_pool_real_array") }}
|
||||
{{ force_mark_rendered("godot_array_new_pool_string_array") }}
|
||||
{{ force_mark_rendered("godot_array_new_pool_vector2_array") }}
|
||||
{{ force_mark_rendered("godot_array_new_pool_vector3_array") }}
|
||||
{{ force_mark_rendered("pandemonium_array_new_pool_byte_array") }}
|
||||
{{ force_mark_rendered("pandemonium_array_new_pool_color_array") }}
|
||||
{{ force_mark_rendered("pandemonium_array_new_pool_int_array") }}
|
||||
{{ force_mark_rendered("pandemonium_array_new_pool_real_array") }}
|
||||
{{ force_mark_rendered("pandemonium_array_new_pool_string_array") }}
|
||||
{{ force_mark_rendered("pandemonium_array_new_pool_vector2_array") }}
|
||||
{{ force_mark_rendered("pandemonium_array_new_pool_vector3_array") }}
|
||||
{# 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
|
||||
cdef class Array:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_array _gd_data
|
||||
cdef pandemonium_array _gd_data
|
||||
|
||||
@staticmethod
|
||||
cdef inline Array new()
|
||||
|
||||
@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 Array operator_add(self, Array items)
|
||||
cdef inline operator_iadd(self, Array items)
|
||||
@ -33,15 +33,15 @@ cdef class Array:
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, iterable=None):
|
||||
{{ force_mark_rendered("godot_array_new") }}
|
||||
{{ force_mark_rendered("godot_array_duplicate") }}
|
||||
{{ force_mark_rendered("pandemonium_array_new") }}
|
||||
{{ force_mark_rendered("pandemonium_array_duplicate") }}
|
||||
if not iterable:
|
||||
gdapi10.godot_array_new(&self._gd_data)
|
||||
gdapi10.pandemonium_array_new(&self._gd_data)
|
||||
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
|
||||
else:
|
||||
gdapi10.godot_array_new(&self._gd_data)
|
||||
gdapi10.pandemonium_array_new(&self._gd_data)
|
||||
for x in iterable:
|
||||
self.append(x)
|
||||
|
||||
@ -49,44 +49,44 @@ cdef class Array:
|
||||
cdef inline Array new():
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
cdef Array ret = Array.__new__(Array)
|
||||
gdapi10.godot_array_new(&ret._gd_data)
|
||||
gdapi10.pandemonium_array_new(&ret._gd_data)
|
||||
return ret
|
||||
|
||||
@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
|
||||
cdef Array ret = Array.__new__(Array)
|
||||
# `godot_array` is a cheap structure pointing on a refcounted vector
|
||||
# of variants. Unlike it name could let think, `godot_array_new_copy`
|
||||
# `pandemonium_array` is a cheap structure pointing on a refcounted vector
|
||||
# of variants. Unlike it name could let think, `pandemonium_array_new_copy`
|
||||
# only increment the refcount of the underlying structure.
|
||||
{{ force_mark_rendered("godot_array_new_copy") }}
|
||||
gdapi10.godot_array_new_copy(&ret._gd_data, _ptr)
|
||||
{{ force_mark_rendered("pandemonium_array_new_copy") }}
|
||||
gdapi10.pandemonium_array_new_copy(&ret._gd_data, _ptr)
|
||||
return ret
|
||||
|
||||
def __dealloc__(self):
|
||||
# /!\ if `__init__` is skipped, `_gd_data` must be initialized by
|
||||
# hand otherwise we will get a segfault here
|
||||
{{ force_mark_rendered("godot_array_destroy") }}
|
||||
gdapi10.godot_array_destroy(&self._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_array_destroy") }}
|
||||
gdapi10.pandemonium_array_destroy(&self._gd_data)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<{type(self).__name__}([{', '.join([repr(x) for x in self])}])>"
|
||||
|
||||
# Operators
|
||||
|
||||
cdef inline Array operator_getslice(self, godot_int start, godot_int stop, godot_int step):
|
||||
{{ force_mark_rendered("godot_array_slice") }}
|
||||
cdef inline Array operator_getslice(self, pandemonium_int start, pandemonium_int stop, pandemonium_int step):
|
||||
{{ force_mark_rendered("pandemonium_array_slice") }}
|
||||
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
|
||||
|
||||
# TODO: support slice
|
||||
def __getitem__(self, index):
|
||||
{{ force_mark_rendered("godot_array_operator_index") }}
|
||||
cdef godot_int size = self.size()
|
||||
cdef godot_int start
|
||||
cdef godot_int stop
|
||||
cdef godot_int step
|
||||
{{ force_mark_rendered("pandemonium_array_operator_index") }}
|
||||
cdef pandemonium_int size = self.size()
|
||||
cdef pandemonium_int start
|
||||
cdef pandemonium_int stop
|
||||
cdef pandemonium_int step
|
||||
|
||||
if isinstance(index, slice):
|
||||
step = index.step if index.step is not None else 1
|
||||
@ -105,28 +105,28 @@ cdef class Array:
|
||||
if index < 0 or index >= size:
|
||||
raise IndexError("list index out of range")
|
||||
|
||||
cdef godot_variant *p_ret = gdapi10.godot_array_operator_index(&self._gd_data, index)
|
||||
return godot_variant_to_pyobj(p_ret)
|
||||
cdef pandemonium_variant *p_ret = gdapi10.pandemonium_array_operator_index(&self._gd_data, index)
|
||||
return pandemonium_variant_to_pyobj(p_ret)
|
||||
|
||||
# TODO: support slice
|
||||
def __setitem__(self, godot_int index, object value):
|
||||
cdef godot_int size = self.size()
|
||||
def __setitem__(self, pandemonium_int index, object value):
|
||||
cdef pandemonium_int size = self.size()
|
||||
index = size + index if index < 0 else index
|
||||
if abs(index) >= size:
|
||||
raise IndexError("list index out of range")
|
||||
|
||||
cdef godot_variant *p_ret = gdapi10.godot_array_operator_index(&self._gd_data, index)
|
||||
gdapi10.godot_variant_destroy(p_ret)
|
||||
pyobj_to_godot_variant(value, p_ret)
|
||||
cdef pandemonium_variant *p_ret = gdapi10.pandemonium_array_operator_index(&self._gd_data, index)
|
||||
gdapi10.pandemonium_variant_destroy(p_ret)
|
||||
pyobj_to_pandemonium_variant(value, p_ret)
|
||||
|
||||
# TODO: support slice
|
||||
def __delitem__(self, godot_int index):
|
||||
cdef godot_int size = self.size()
|
||||
def __delitem__(self, pandemonium_int index):
|
||||
cdef pandemonium_int size = self.size()
|
||||
index = size + index if index < 0 else index
|
||||
if abs(index) >= size:
|
||||
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):
|
||||
# TODO: mid iteration mutation should throw exception ?
|
||||
@ -141,15 +141,15 @@ cdef class Array:
|
||||
return self.duplicate(True)
|
||||
|
||||
cdef inline bint operator_equal(self, Array other):
|
||||
# TODO `godot_array_operator_equal` is missing in gdapi, submit a PR ?
|
||||
cdef godot_int size = self.size()
|
||||
# TODO `pandemonium_array_operator_equal` is missing in gdapi, submit a PR ?
|
||||
cdef pandemonium_int size = self.size()
|
||||
if size != other.size():
|
||||
return False
|
||||
cdef int i
|
||||
for i in range(size):
|
||||
if not gdapi10.godot_variant_operator_equal(
|
||||
gdapi10.godot_array_operator_index(&self._gd_data, i),
|
||||
gdapi10.godot_array_operator_index(&other._gd_data, i)
|
||||
if not gdapi10.pandemonium_variant_operator_equal(
|
||||
gdapi10.pandemonium_array_operator_index(&self._gd_data, i),
|
||||
gdapi10.pandemonium_array_operator_index(&other._gd_data, i)
|
||||
):
|
||||
return False
|
||||
return True
|
||||
@ -167,9 +167,9 @@ cdef class Array:
|
||||
return True
|
||||
|
||||
cdef inline operator_iadd(self, Array items):
|
||||
cdef godot_int self_size = self.size()
|
||||
cdef godot_int items_size = items.size()
|
||||
gdapi10.godot_array_resize(&self._gd_data, self_size + items_size)
|
||||
cdef pandemonium_int self_size = self.size()
|
||||
cdef pandemonium_int items_size = items.size()
|
||||
gdapi10.pandemonium_array_resize(&self._gd_data, self_size + items_size)
|
||||
cdef int i
|
||||
for i in range(items_size):
|
||||
Array.set(self, self_size + i, items.get(i))
|
||||
@ -184,10 +184,10 @@ cdef class Array:
|
||||
return self
|
||||
|
||||
cdef inline Array operator_add(self, Array items):
|
||||
cdef godot_int self_size = self.size()
|
||||
cdef godot_int items_size = items.size()
|
||||
cdef pandemonium_int self_size = self.size()
|
||||
cdef pandemonium_int items_size = items.size()
|
||||
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
|
||||
for i in range(self_size):
|
||||
Array.set(ret, i, self.get(i))
|
||||
@ -234,11 +234,11 @@ cdef class Array:
|
||||
{{ render_method("rfind") | indent }}
|
||||
{{ render_method("sort") | indent }}
|
||||
{#- 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("bsearch") | indent }}
|
||||
{#- 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("max") | indent }}
|
||||
{{ render_method("min") | indent }}
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
cdef inline Basis Basis_multiply_vector(Basis self, Basis b):
|
||||
cdef Basis ret = Basis.__new__(Basis)
|
||||
{{ force_mark_rendered("godot_basis_operator_multiply_vector") }}
|
||||
ret._gd_data = gdapi10.godot_basis_operator_multiply_vector(&self._gd_data, &b._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_basis_operator_multiply_vector") }}
|
||||
ret._gd_data = gdapi10.pandemonium_basis_operator_multiply_vector(&self._gd_data, &b._gd_data)
|
||||
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)
|
||||
{{ force_mark_rendered("godot_basis_operator_multiply_scalar") }}
|
||||
ret._gd_data = gdapi10.godot_basis_operator_multiply_scalar(&self._gd_data, b)
|
||||
{{ force_mark_rendered("pandemonium_basis_operator_multiply_scalar") }}
|
||||
ret._gd_data = gdapi10.pandemonium_basis_operator_multiply_scalar(&self._gd_data, b)
|
||||
return ret
|
||||
|
||||
{%- endblock %}
|
||||
@ -19,27 +19,27 @@ cdef inline Basis Basis_multiply_scalar(Basis self, godot_real b):
|
||||
@cython.final
|
||||
cdef class Basis:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_basis _gd_data
|
||||
cdef pandemonium_basis _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
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("godot_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)
|
||||
{{ force_mark_rendered("pandemonium_basis_new") }} {# We always use the `with_rows` version #}
|
||||
{{ force_mark_rendered("pandemonium_basis_new_with_rows") }}
|
||||
gdapi10.pandemonium_basis_new_with_rows(&self._gd_data, &(<Vector3>x)._gd_data, &(<Vector3>y)._gd_data, &(<Vector3>z)._gd_data)
|
||||
|
||||
@staticmethod
|
||||
def from_euler(from_):
|
||||
cdef Basis ret = Basis.__new__(Basis)
|
||||
try:
|
||||
{{ force_mark_rendered("godot_basis_new_with_euler") }}
|
||||
gdapi10.godot_basis_new_with_euler(&ret._gd_data, &(<Vector3?>from_)._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_basis_new_with_euler") }}
|
||||
gdapi10.pandemonium_basis_new_with_euler(&ret._gd_data, &(<Vector3?>from_)._gd_data)
|
||||
return ret
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
{{ force_mark_rendered("godot_basis_new_with_euler_quat") }}
|
||||
gdapi10.godot_basis_new_with_euler_quat(&ret._gd_data, &(<Quat?>from_)._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_basis_new_with_euler_quat") }}
|
||||
gdapi10.pandemonium_basis_new_with_euler_quat(&ret._gd_data, &(<Quat?>from_)._gd_data)
|
||||
return ret
|
||||
except TypeError:
|
||||
raise TypeError('`from_` must be Quat or Vector3')
|
||||
@ -47,8 +47,8 @@ cdef class Basis:
|
||||
@staticmethod
|
||||
def from_axis_angle(Vector3 axis not None, phi):
|
||||
cdef Basis ret = Basis.__new__(Basis)
|
||||
{{ force_mark_rendered("godot_basis_new_with_axis_and_angle") }}
|
||||
gdapi10.godot_basis_new_with_axis_and_angle(&ret._gd_data, &axis._gd_data, phi)
|
||||
{{ force_mark_rendered("pandemonium_basis_new_with_axis_and_angle") }}
|
||||
gdapi10.pandemonium_basis_new_with_axis_and_angle(&ret._gd_data, &axis._gd_data, phi)
|
||||
return ret
|
||||
|
||||
def __repr__(self):
|
||||
@ -57,38 +57,38 @@ cdef class Basis:
|
||||
@property
|
||||
def x(Basis self) -> Vector3:
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_basis_get_axis") }}
|
||||
ret._gd_data = gdapi10.godot_basis_get_axis(&self._gd_data, 0)
|
||||
{{ force_mark_rendered("pandemonium_basis_get_axis") }}
|
||||
ret._gd_data = gdapi10.pandemonium_basis_get_axis(&self._gd_data, 0)
|
||||
return ret
|
||||
|
||||
@x.setter
|
||||
def x(Basis self, Vector3 val not None) -> None:
|
||||
{{ force_mark_rendered("godot_basis_set_axis") }}
|
||||
gdapi10.godot_basis_set_axis(&self._gd_data, 0, &val._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_basis_set_axis") }}
|
||||
gdapi10.pandemonium_basis_set_axis(&self._gd_data, 0, &val._gd_data)
|
||||
|
||||
@property
|
||||
def y(Basis self) -> Vector3:
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_basis_get_axis") }}
|
||||
ret._gd_data = gdapi10.godot_basis_get_axis(&self._gd_data, 1)
|
||||
{{ force_mark_rendered("pandemonium_basis_get_axis") }}
|
||||
ret._gd_data = gdapi10.pandemonium_basis_get_axis(&self._gd_data, 1)
|
||||
return ret
|
||||
|
||||
@y.setter
|
||||
def y(Basis self, Vector3 val not None) -> None:
|
||||
{{ force_mark_rendered("godot_basis_set_axis") }}
|
||||
gdapi10.godot_basis_set_axis(&self._gd_data, 1, &val._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_basis_set_axis") }}
|
||||
gdapi10.pandemonium_basis_set_axis(&self._gd_data, 1, &val._gd_data)
|
||||
|
||||
@property
|
||||
def z(Basis self) -> Vector3:
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_basis_get_axis") }}
|
||||
ret._gd_data = gdapi10.godot_basis_get_axis(&self._gd_data, 2)
|
||||
{{ force_mark_rendered("pandemonium_basis_get_axis") }}
|
||||
ret._gd_data = gdapi10.pandemonium_basis_get_axis(&self._gd_data, 2)
|
||||
return ret
|
||||
|
||||
@z.setter
|
||||
def z(Basis self, Vector3 val not None) -> None:
|
||||
{{ force_mark_rendered("godot_basis_set_axis") }}
|
||||
gdapi10.godot_basis_set_axis(&self._gd_data, 2, &val._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_basis_set_axis") }}
|
||||
gdapi10.pandemonium_basis_set_axis(&self._gd_data, 2, &val._gd_data)
|
||||
|
||||
{{ render_operator_eq() | indent }}
|
||||
{{ render_operator_ne() | indent }}
|
||||
|
@ -8,17 +8,17 @@ from libc.stdint cimport uint8_t
|
||||
@cython.final
|
||||
cdef class Color:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_color _gd_data
|
||||
cdef pandemonium_color _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% 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:
|
||||
{{ force_mark_rendered("godot_color_new_rgb")}}
|
||||
gdapi10.godot_color_new_rgb(&self._gd_data, r, g, b)
|
||||
{{ force_mark_rendered("pandemonium_color_new_rgb")}}
|
||||
gdapi10.pandemonium_color_new_rgb(&self._gd_data, r, g, b)
|
||||
else:
|
||||
{{ force_mark_rendered("godot_color_new_rgba")}}
|
||||
gdapi10.godot_color_new_rgba(&self._gd_data, r, g, b, a)
|
||||
{{ force_mark_rendered("pandemonium_color_new_rgba")}}
|
||||
gdapi10.pandemonium_color_new_rgba(&self._gd_data, r, g, b, a)
|
||||
|
||||
def __repr__(self):
|
||||
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):
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
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
|
||||
|
||||
@property
|
||||
|
@ -4,18 +4,18 @@
|
||||
{% endblock -%}
|
||||
|
||||
{# 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
|
||||
cdef class Dictionary:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_dictionary _gd_data
|
||||
cdef pandemonium_dictionary _gd_data
|
||||
|
||||
@staticmethod
|
||||
cdef inline Dictionary new()
|
||||
|
||||
@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 bint operator_equal(self, Dictionary other)
|
||||
@ -23,18 +23,18 @@ cdef class Dictionary:
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, iterable=None):
|
||||
{{ force_mark_rendered("godot_dictionary_new") }}
|
||||
{{ force_mark_rendered("pandemonium_dictionary_new") }}
|
||||
if not iterable:
|
||||
gdapi10.godot_dictionary_new(&self._gd_data)
|
||||
gdapi10.pandemonium_dictionary_new(&self._gd_data)
|
||||
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
|
||||
elif isinstance(iterable, dict):
|
||||
gdapi10.godot_dictionary_new(&self._gd_data)
|
||||
gdapi10.pandemonium_dictionary_new(&self._gd_data)
|
||||
for k, v in iterable.items():
|
||||
self[k] = v
|
||||
else:
|
||||
gdapi10.godot_dictionary_new(&self._gd_data)
|
||||
gdapi10.pandemonium_dictionary_new(&self._gd_data)
|
||||
try:
|
||||
for k, v in iterable:
|
||||
self[k] = v
|
||||
@ -42,27 +42,27 @@ cdef class Dictionary:
|
||||
raise ValueError("dictionary update sequence element has length 1; 2 is required")
|
||||
|
||||
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
|
||||
# hand otherwise we will get a segfault here
|
||||
gdapi10.godot_dictionary_destroy(&self._gd_data)
|
||||
gdapi10.pandemonium_dictionary_destroy(&self._gd_data)
|
||||
|
||||
@staticmethod
|
||||
cdef inline Dictionary new():
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
cdef Dictionary ret = Dictionary.__new__(Dictionary)
|
||||
gdapi10.godot_dictionary_new(&ret._gd_data)
|
||||
gdapi10.pandemonium_dictionary_new(&ret._gd_data)
|
||||
return ret
|
||||
|
||||
@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
|
||||
cdef Dictionary ret = Dictionary.__new__(Dictionary)
|
||||
# `godot_dictionary` is a cheap structure pointing on a refcounted hashmap
|
||||
# of variants. Unlike it name could let think, `godot_dictionary_new_copy`
|
||||
# `pandemonium_dictionary` is a cheap structure pointing on a refcounted hashmap
|
||||
# of variants. Unlike it name could let think, `pandemonium_dictionary_new_copy`
|
||||
# only increment the refcount of the underlying structure.
|
||||
{{ force_mark_rendered("godot_dictionary_new_copy") }}
|
||||
gdapi10.godot_dictionary_new_copy(&ret._gd_data, _ptr)
|
||||
{{ force_mark_rendered("pandemonium_dictionary_new_copy") }}
|
||||
gdapi10.pandemonium_dictionary_new_copy(&ret._gd_data, _ptr)
|
||||
return ret
|
||||
|
||||
def __repr__(self):
|
||||
@ -76,38 +76,38 @@ cdef class Dictionary:
|
||||
return f"<Dictionary({repr_dict})>"
|
||||
|
||||
def __getitem__(self, object key):
|
||||
{{ force_mark_rendered("godot_dictionary_operator_index") }}
|
||||
cdef godot_variant var_key
|
||||
if not pyobj_to_godot_variant(key, &var_key):
|
||||
{{ force_mark_rendered("pandemonium_dictionary_operator_index") }}
|
||||
cdef pandemonium_variant var_key
|
||||
if not pyobj_to_pandemonium_variant(key, &var_key):
|
||||
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)
|
||||
gdapi10.godot_variant_destroy(&var_key)
|
||||
cdef pandemonium_variant *p_var_ret = gdapi10.pandemonium_dictionary_operator_index(&self._gd_data, &var_key)
|
||||
gdapi10.pandemonium_variant_destroy(&var_key)
|
||||
if p_var_ret == NULL:
|
||||
raise KeyError(key)
|
||||
else:
|
||||
return godot_variant_to_pyobj(p_var_ret)
|
||||
return pandemonium_variant_to_pyobj(p_var_ret)
|
||||
|
||||
{{ render_method("set", py_name="__setitem__") | indent }}
|
||||
|
||||
def __delitem__(self, object key):
|
||||
{{ force_mark_rendered("godot_dictionary_erase_with_return") }}
|
||||
cdef godot_variant var_key
|
||||
if not pyobj_to_godot_variant(key, &var_key):
|
||||
{{ force_mark_rendered("pandemonium_dictionary_erase_with_return") }}
|
||||
cdef pandemonium_variant var_key
|
||||
if not pyobj_to_pandemonium_variant(key, &var_key):
|
||||
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)
|
||||
gdapi10.godot_variant_destroy(&var_key)
|
||||
cdef pandemonium_bool ret = gdapi11.pandemonium_dictionary_erase_with_return(&self._gd_data, &var_key)
|
||||
gdapi10.pandemonium_variant_destroy(&var_key)
|
||||
if not ret:
|
||||
raise KeyError(key)
|
||||
|
||||
def __iter__(self):
|
||||
{{ force_mark_rendered("godot_dictionary_next") }}
|
||||
cdef godot_variant *p_key = NULL
|
||||
{{ force_mark_rendered("pandemonium_dictionary_next") }}
|
||||
cdef pandemonium_variant *p_key = NULL
|
||||
# TODO: mid iteration mutation should throw exception ?
|
||||
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:
|
||||
return
|
||||
yield godot_variant_to_pyobj(p_key)
|
||||
yield pandemonium_variant_to_pyobj(p_key)
|
||||
|
||||
def __copy__(self):
|
||||
return self.duplicate(False)
|
||||
@ -116,32 +116,32 @@ cdef class Dictionary:
|
||||
return self.duplicate(True)
|
||||
|
||||
def get(self, object key, object default=None):
|
||||
{{ force_mark_rendered("godot_dictionary_get") }}
|
||||
{{ force_mark_rendered("godot_dictionary_get_with_default") }}
|
||||
cdef godot_variant var_key
|
||||
pyobj_to_godot_variant(key, &var_key)
|
||||
cdef godot_variant var_ret
|
||||
cdef godot_variant var_default
|
||||
{{ force_mark_rendered("pandemonium_dictionary_get") }}
|
||||
{{ force_mark_rendered("pandemonium_dictionary_get_with_default") }}
|
||||
cdef pandemonium_variant var_key
|
||||
pyobj_to_pandemonium_variant(key, &var_key)
|
||||
cdef pandemonium_variant var_ret
|
||||
cdef pandemonium_variant var_default
|
||||
if default is not None:
|
||||
pyobj_to_godot_variant(default, &var_default)
|
||||
var_ret = gdapi11.godot_dictionary_get_with_default(&self._gd_data, &var_key, &var_default)
|
||||
gdapi10.godot_variant_destroy(&var_default)
|
||||
pyobj_to_pandemonium_variant(default, &var_default)
|
||||
var_ret = gdapi11.pandemonium_dictionary_get_with_default(&self._gd_data, &var_key, &var_default)
|
||||
gdapi10.pandemonium_variant_destroy(&var_default)
|
||||
else:
|
||||
var_ret = gdapi10.godot_dictionary_get(&self._gd_data, &var_key)
|
||||
gdapi10.godot_variant_destroy(&var_key)
|
||||
cdef object ret = godot_variant_to_pyobj(&var_ret)
|
||||
gdapi10.godot_variant_destroy(&var_ret)
|
||||
var_ret = gdapi10.pandemonium_dictionary_get(&self._gd_data, &var_key)
|
||||
gdapi10.pandemonium_variant_destroy(&var_key)
|
||||
cdef object ret = pandemonium_variant_to_pyobj(&var_ret)
|
||||
gdapi10.pandemonium_variant_destroy(&var_ret)
|
||||
return ret
|
||||
|
||||
cdef inline operator_update(self, Dictionary items):
|
||||
cdef godot_variant *p_value
|
||||
cdef godot_variant *p_key = NULL
|
||||
cdef pandemonium_variant *p_value
|
||||
cdef pandemonium_variant *p_key = NULL
|
||||
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:
|
||||
break
|
||||
p_value = gdapi10.godot_dictionary_operator_index(&items._gd_data, p_key)
|
||||
gdapi10.godot_dictionary_set(&self._gd_data, p_key, p_value)
|
||||
p_value = gdapi10.pandemonium_dictionary_operator_index(&items._gd_data, p_key)
|
||||
gdapi10.pandemonium_dictionary_set(&self._gd_data, p_key, p_value)
|
||||
return self
|
||||
|
||||
def update(self, other):
|
||||
@ -156,20 +156,20 @@ cdef class Dictionary:
|
||||
raise TypeError("other must be godot.Dictionary or dict")
|
||||
|
||||
def items(self):
|
||||
cdef godot_variant *p_key = NULL
|
||||
cdef godot_variant *p_value
|
||||
cdef pandemonium_variant *p_key = NULL
|
||||
cdef pandemonium_variant *p_value
|
||||
# TODO: mid iteration mutation should throw exception ?
|
||||
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:
|
||||
return
|
||||
p_value = gdapi10.godot_dictionary_operator_index(&self._gd_data, p_key)
|
||||
yield godot_variant_to_pyobj(p_key), godot_variant_to_pyobj(p_value)
|
||||
p_value = gdapi10.pandemonium_dictionary_operator_index(&self._gd_data, p_key)
|
||||
yield pandemonium_variant_to_pyobj(p_key), pandemonium_variant_to_pyobj(p_value)
|
||||
|
||||
cdef inline bint operator_equal(self, Dictionary other):
|
||||
if other is None:
|
||||
return False
|
||||
cdef godot_int size = self.size()
|
||||
cdef pandemonium_int size = self.size()
|
||||
if size != other.size():
|
||||
return False
|
||||
# TODO: gdnative should provide a function to do that
|
||||
@ -177,7 +177,7 @@ cdef class Dictionary:
|
||||
|
||||
def __eq__(self, other):
|
||||
{# see https://github.com/godotengine/godot/issues/27615 #}
|
||||
{{ force_mark_rendered("godot_dictionary_operator_equal") }}
|
||||
{{ force_mark_rendered("pandemonium_dictionary_operator_equal") }}
|
||||
try:
|
||||
return Dictionary.operator_equal(self, <Dictionary?>other)
|
||||
except TypeError:
|
||||
|
@ -4,99 +4,99 @@
|
||||
from libc.stdint cimport int8_t
|
||||
{% endblock -%}
|
||||
|
||||
{# godot_char_string is not really a bultin type...#}
|
||||
{{ force_mark_rendered("godot_char_string_destroy") }}
|
||||
{{ force_mark_rendered("godot_char_string_get_data") }}
|
||||
{{ force_mark_rendered("godot_char_string_length") }}
|
||||
{# pandemonium_char_string is not really a bultin type...#}
|
||||
{{ force_mark_rendered("pandemonium_char_string_destroy") }}
|
||||
{{ force_mark_rendered("pandemonium_char_string_get_data") }}
|
||||
{{ force_mark_rendered("pandemonium_char_string_length") }}
|
||||
{# Those methods are present in gdnative_api.json but not in the Godot documentation... #}
|
||||
{{ force_mark_rendered("godot_string_ascii") }}
|
||||
{{ force_mark_rendered("godot_string_ascii_extended") }}
|
||||
{{ force_mark_rendered("godot_string_begins_with_char_array") }}
|
||||
{{ force_mark_rendered("godot_string_c_escape_multiline") }}
|
||||
{{ force_mark_rendered("godot_string_camelcase_to_underscore") }}
|
||||
{{ force_mark_rendered("godot_string_camelcase_to_underscore_lowercased") }}
|
||||
{{ force_mark_rendered("godot_string_char_lowercase") }}
|
||||
{{ force_mark_rendered("godot_string_char_to_double") }}
|
||||
{{ force_mark_rendered("godot_string_char_to_int") }}
|
||||
{{ force_mark_rendered("godot_string_char_to_int64_with_len") }}
|
||||
{{ force_mark_rendered("godot_string_char_to_int_with_len") }}
|
||||
{{ force_mark_rendered("godot_string_char_uppercase") }}
|
||||
{{ force_mark_rendered("godot_string_chars_to_utf8") }}
|
||||
{{ force_mark_rendered("godot_string_chars_to_utf8_with_len") }}
|
||||
{{ force_mark_rendered("godot_string_chr") }}
|
||||
{{ force_mark_rendered("godot_string_find_from") }}
|
||||
{{ force_mark_rendered("godot_string_findmk") }}
|
||||
{{ force_mark_rendered("godot_string_findmk_from") }}
|
||||
{{ force_mark_rendered("godot_string_findmk_from_in_place") }}
|
||||
{{ force_mark_rendered("godot_string_findn_from") }}
|
||||
{{ force_mark_rendered("godot_string_format_with_custom_placeholder") }}
|
||||
{{ force_mark_rendered("godot_string_get_slice") }}
|
||||
{{ force_mark_rendered("godot_string_get_slice_count") }}
|
||||
{{ force_mark_rendered("godot_string_get_slicec") }}
|
||||
{{ force_mark_rendered("godot_string_hash64") }}
|
||||
{{ force_mark_rendered("godot_string_hash_chars") }}
|
||||
{{ force_mark_rendered("godot_string_hash_chars_with_len") }}
|
||||
{{ force_mark_rendered("godot_string_hash_utf8_chars") }}
|
||||
{{ force_mark_rendered("godot_string_hash_utf8_chars_with_len") }}
|
||||
{{ force_mark_rendered("godot_string_hex_encode_buffer") }}
|
||||
{{ force_mark_rendered("godot_string_hex_to_int64") }}
|
||||
{{ force_mark_rendered("godot_string_hex_to_int64_with_prefix") }}
|
||||
{{ force_mark_rendered("godot_string_hex_to_int_without_prefix") }}
|
||||
{{ force_mark_rendered("godot_string_is_numeric") }}
|
||||
{{ force_mark_rendered("godot_string_is_resource_file") }}
|
||||
{{ force_mark_rendered("godot_string_lpad") }}
|
||||
{{ force_mark_rendered("godot_string_lpad_with_custom_character") }}
|
||||
{{ force_mark_rendered("godot_string_md5") }}
|
||||
{{ force_mark_rendered("godot_string_name_destroy") }}
|
||||
{{ force_mark_rendered("godot_string_name_get_data_unique_pointer") }}
|
||||
{{ force_mark_rendered("godot_string_name_get_hash") }}
|
||||
{{ force_mark_rendered("godot_string_name_get_name") }}
|
||||
{{ force_mark_rendered("godot_string_name_new") }}
|
||||
{{ force_mark_rendered("godot_string_name_new_data") }}
|
||||
{{ force_mark_rendered("godot_string_name_operator_equal") }}
|
||||
{{ force_mark_rendered("godot_string_name_operator_less") }}
|
||||
{{ force_mark_rendered("godot_string_naturalnocasecmp_to") }}
|
||||
{{ force_mark_rendered("godot_string_num") }}
|
||||
{{ force_mark_rendered("godot_string_num_int64") }}
|
||||
{{ force_mark_rendered("godot_string_num_int64_capitalized") }}
|
||||
{{ force_mark_rendered("godot_string_num_real") }}
|
||||
{{ force_mark_rendered("godot_string_num_scientific") }}
|
||||
{{ force_mark_rendered("godot_string_num_with_decimals") }}
|
||||
{{ force_mark_rendered("godot_string_operator_index") }}
|
||||
{{ force_mark_rendered("godot_string_operator_index_const") }}
|
||||
{{ force_mark_rendered("godot_string_parse_utf8") }}
|
||||
{{ force_mark_rendered("godot_string_parse_utf8_with_len") }}
|
||||
{{ force_mark_rendered("godot_string_path_to") }}
|
||||
{{ force_mark_rendered("godot_string_path_to_file") }}
|
||||
{{ force_mark_rendered("godot_string_replace_first") }}
|
||||
{{ force_mark_rendered("godot_string_rfind_from") }}
|
||||
{{ force_mark_rendered("godot_string_rfindn_from") }}
|
||||
{{ force_mark_rendered("godot_string_rpad") }}
|
||||
{{ force_mark_rendered("godot_string_rpad_with_custom_character") }}
|
||||
{{ force_mark_rendered("godot_string_simplify_path") }}
|
||||
{{ force_mark_rendered("godot_string_split_allow_empty") }}
|
||||
{{ force_mark_rendered("godot_string_split_floats_allows_empty") }}
|
||||
{{ force_mark_rendered("godot_string_split_floats_mk") }}
|
||||
{{ force_mark_rendered("godot_string_split_floats_mk_allows_empty") }}
|
||||
{{ force_mark_rendered("godot_string_split_ints") }}
|
||||
{{ force_mark_rendered("godot_string_split_ints_allows_empty") }}
|
||||
{{ force_mark_rendered("godot_string_split_ints_mk") }}
|
||||
{{ force_mark_rendered("godot_string_split_ints_mk_allows_empty") }}
|
||||
{{ force_mark_rendered("godot_string_split_spaces") }}
|
||||
{{ force_mark_rendered("godot_string_sprintf") }}
|
||||
{{ force_mark_rendered("godot_string_to_double") }}
|
||||
{{ force_mark_rendered("godot_string_to_int64") }}
|
||||
{{ force_mark_rendered("godot_string_unicode_char_to_double") }}
|
||||
{{ force_mark_rendered("godot_string_utf8") }}
|
||||
{{ force_mark_rendered("godot_string_wchar_to_int") }}
|
||||
{{ force_mark_rendered("godot_string_wide_str") }}
|
||||
{{ force_mark_rendered("godot_string_word_wrap") }}
|
||||
{{ force_mark_rendered("godot_string_xml_escape_with_quotes") }}
|
||||
{{ force_mark_rendered("pandemonium_string_ascii") }}
|
||||
{{ force_mark_rendered("pandemonium_string_ascii_extended") }}
|
||||
{{ force_mark_rendered("pandemonium_string_begins_with_char_array") }}
|
||||
{{ force_mark_rendered("pandemonium_string_c_escape_multiline") }}
|
||||
{{ force_mark_rendered("pandemonium_string_camelcase_to_underscore") }}
|
||||
{{ force_mark_rendered("pandemonium_string_camelcase_to_underscore_lowercased") }}
|
||||
{{ force_mark_rendered("pandemonium_string_char_lowercase") }}
|
||||
{{ force_mark_rendered("pandemonium_string_char_to_double") }}
|
||||
{{ force_mark_rendered("pandemonium_string_char_to_int") }}
|
||||
{{ force_mark_rendered("pandemonium_string_char_to_int64_with_len") }}
|
||||
{{ force_mark_rendered("pandemonium_string_char_to_int_with_len") }}
|
||||
{{ force_mark_rendered("pandemonium_string_char_uppercase") }}
|
||||
{{ force_mark_rendered("pandemonium_string_chars_to_utf8") }}
|
||||
{{ force_mark_rendered("pandemonium_string_chars_to_utf8_with_len") }}
|
||||
{{ force_mark_rendered("pandemonium_string_chr") }}
|
||||
{{ force_mark_rendered("pandemonium_string_find_from") }}
|
||||
{{ force_mark_rendered("pandemonium_string_findmk") }}
|
||||
{{ force_mark_rendered("pandemonium_string_findmk_from") }}
|
||||
{{ force_mark_rendered("pandemonium_string_findmk_from_in_place") }}
|
||||
{{ force_mark_rendered("pandemonium_string_findn_from") }}
|
||||
{{ force_mark_rendered("pandemonium_string_format_with_custom_placeholder") }}
|
||||
{{ force_mark_rendered("pandemonium_string_get_slice") }}
|
||||
{{ force_mark_rendered("pandemonium_string_get_slice_count") }}
|
||||
{{ force_mark_rendered("pandemonium_string_get_slicec") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hash64") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hash_chars") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hash_chars_with_len") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hash_utf8_chars") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hash_utf8_chars_with_len") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hex_encode_buffer") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hex_to_int64") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hex_to_int64_with_prefix") }}
|
||||
{{ force_mark_rendered("pandemonium_string_hex_to_int_without_prefix") }}
|
||||
{{ force_mark_rendered("pandemonium_string_is_numeric") }}
|
||||
{{ force_mark_rendered("pandemonium_string_is_resource_file") }}
|
||||
{{ force_mark_rendered("pandemonium_string_lpad") }}
|
||||
{{ force_mark_rendered("pandemonium_string_lpad_with_custom_character") }}
|
||||
{{ force_mark_rendered("pandemonium_string_md5") }}
|
||||
{{ force_mark_rendered("pandemonium_string_name_destroy") }}
|
||||
{{ force_mark_rendered("pandemonium_string_name_get_data_unique_pointer") }}
|
||||
{{ force_mark_rendered("pandemonium_string_name_get_hash") }}
|
||||
{{ force_mark_rendered("pandemonium_string_name_get_name") }}
|
||||
{{ force_mark_rendered("pandemonium_string_name_new") }}
|
||||
{{ force_mark_rendered("pandemonium_string_name_new_data") }}
|
||||
{{ force_mark_rendered("pandemonium_string_name_operator_equal") }}
|
||||
{{ force_mark_rendered("pandemonium_string_name_operator_less") }}
|
||||
{{ force_mark_rendered("pandemonium_string_naturalnocasecmp_to") }}
|
||||
{{ force_mark_rendered("pandemonium_string_num") }}
|
||||
{{ force_mark_rendered("pandemonium_string_num_int64") }}
|
||||
{{ force_mark_rendered("pandemonium_string_num_int64_capitalized") }}
|
||||
{{ force_mark_rendered("pandemonium_string_num_real") }}
|
||||
{{ force_mark_rendered("pandemonium_string_num_scientific") }}
|
||||
{{ force_mark_rendered("pandemonium_string_num_with_decimals") }}
|
||||
{{ force_mark_rendered("pandemonium_string_operator_index") }}
|
||||
{{ force_mark_rendered("pandemonium_string_operator_index_const") }}
|
||||
{{ force_mark_rendered("pandemonium_string_parse_utf8") }}
|
||||
{{ force_mark_rendered("pandemonium_string_parse_utf8_with_len") }}
|
||||
{{ force_mark_rendered("pandemonium_string_path_to") }}
|
||||
{{ force_mark_rendered("pandemonium_string_path_to_file") }}
|
||||
{{ force_mark_rendered("pandemonium_string_replace_first") }}
|
||||
{{ force_mark_rendered("pandemonium_string_rfind_from") }}
|
||||
{{ force_mark_rendered("pandemonium_string_rfindn_from") }}
|
||||
{{ force_mark_rendered("pandemonium_string_rpad") }}
|
||||
{{ force_mark_rendered("pandemonium_string_rpad_with_custom_character") }}
|
||||
{{ force_mark_rendered("pandemonium_string_simplify_path") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_allow_empty") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_floats_allows_empty") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_floats_mk") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_floats_mk_allows_empty") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_ints") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_ints_allows_empty") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_ints_mk") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_ints_mk_allows_empty") }}
|
||||
{{ force_mark_rendered("pandemonium_string_split_spaces") }}
|
||||
{{ force_mark_rendered("pandemonium_string_sprintf") }}
|
||||
{{ force_mark_rendered("pandemonium_string_to_double") }}
|
||||
{{ force_mark_rendered("pandemonium_string_to_int64") }}
|
||||
{{ force_mark_rendered("pandemonium_string_unicode_char_to_double") }}
|
||||
{{ force_mark_rendered("pandemonium_string_utf8") }}
|
||||
{{ force_mark_rendered("pandemonium_string_wchar_to_int") }}
|
||||
{{ force_mark_rendered("pandemonium_string_wide_str") }}
|
||||
{{ force_mark_rendered("pandemonium_string_word_wrap") }}
|
||||
{{ force_mark_rendered("pandemonium_string_xml_escape_with_quotes") }}
|
||||
|
||||
@cython.final
|
||||
cdef class GDString:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_string _gd_data
|
||||
cdef pandemonium_string _gd_data
|
||||
|
||||
@staticmethod
|
||||
cdef inline GDString new()
|
||||
@ -105,54 +105,54 @@ cdef class GDString:
|
||||
cdef inline GDString new_with_wide_string(wchar_t *content, int size)
|
||||
|
||||
@staticmethod
|
||||
cdef inline GDString from_ptr(const godot_string *_ptr)
|
||||
cdef inline GDString from_ptr(const pandemonium_string *_ptr)
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, str pystr=None):
|
||||
if not pystr:
|
||||
{{ force_mark_rendered("godot_string_new" )}}
|
||||
gdapi10.godot_string_new(&self._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_string_new" )}}
|
||||
gdapi10.pandemonium_string_new(&self._gd_data)
|
||||
else:
|
||||
pyobj_to_godot_string(pystr, &self._gd_data)
|
||||
pyobj_to_pandemonium_string(pystr, &self._gd_data)
|
||||
|
||||
@staticmethod
|
||||
cdef inline GDString new():
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
cdef GDString ret = GDString.__new__(GDString)
|
||||
gdapi10.godot_string_new(&ret._gd_data)
|
||||
gdapi10.pandemonium_string_new(&ret._gd_data)
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
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
|
||||
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
|
||||
|
||||
@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
|
||||
cdef GDString ret = GDString.__new__(GDString)
|
||||
# `godot_string` is a cheap structure pointing on a refcounted buffer.
|
||||
# Unlike it name could let think, `godot_string_new_copy` only
|
||||
# `pandemonium_string` is a cheap structure pointing on a refcounted buffer.
|
||||
# Unlike it name could let think, `pandemonium_string_new_copy` only
|
||||
# increments the refcount of the underlying structure.
|
||||
{{ force_mark_rendered("godot_string_new_copy") }}
|
||||
gdapi10.godot_string_new_copy(&ret._gd_data, _ptr)
|
||||
{{ force_mark_rendered("pandemonium_string_new_copy") }}
|
||||
gdapi10.pandemonium_string_new_copy(&ret._gd_data, _ptr)
|
||||
return ret
|
||||
|
||||
def __dealloc__(GDString self):
|
||||
# /!\ if `__init__` is skipped, `_gd_data` must be initialized by
|
||||
# hand otherwise we will get a segfault here
|
||||
{{ force_mark_rendered("godot_string_destroy" )}}
|
||||
gdapi10.godot_string_destroy(&self._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_string_destroy" )}}
|
||||
gdapi10.pandemonium_string_destroy(&self._gd_data)
|
||||
|
||||
def __repr__(GDString self):
|
||||
return f"<GDString({str(self)!r})>"
|
||||
|
||||
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_ne() | indent }}
|
||||
@ -188,9 +188,9 @@ cdef class GDString:
|
||||
|
||||
@staticmethod
|
||||
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)
|
||||
__ret._gd_data = gdapi10.godot_string_humanize_size(size)
|
||||
__ret._gd_data = gdapi10.pandemonium_string_humanize_size(size)
|
||||
return __ret
|
||||
|
||||
{{ render_method("insert") | indent }}
|
||||
|
@ -3,32 +3,32 @@
|
||||
{%- block pyx_header %}
|
||||
{% 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
|
||||
cdef class NodePath:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_node_path _gd_data
|
||||
cdef pandemonium_node_path _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, from_):
|
||||
{{ force_mark_rendered("godot_node_path_new") }}
|
||||
cdef godot_string gd_from
|
||||
{{ force_mark_rendered("pandemonium_node_path_new") }}
|
||||
cdef pandemonium_string gd_from
|
||||
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:
|
||||
if not isinstance(from_, str):
|
||||
raise TypeError("`from_` must be str or GDString")
|
||||
pyobj_to_godot_string(from_, &gd_from)
|
||||
gdapi10.godot_node_path_new(&self._gd_data, &gd_from)
|
||||
gdapi10.godot_string_destroy(&gd_from)
|
||||
pyobj_to_pandemonium_string(from_, &gd_from)
|
||||
gdapi10.pandemonium_node_path_new(&self._gd_data, &gd_from)
|
||||
gdapi10.pandemonium_string_destroy(&gd_from)
|
||||
|
||||
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
|
||||
# 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):
|
||||
return f"<NodePath({self.as_string()})>"
|
||||
|
@ -7,26 +7,26 @@
|
||||
@cython.final
|
||||
cdef class Plane:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_plane _gd_data
|
||||
cdef pandemonium_plane _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, godot_real a, godot_real b, godot_real c, godot_real d):
|
||||
{{ force_mark_rendered("godot_plane_new_with_reals") }}
|
||||
gdapi10.godot_plane_new_with_reals(&self._gd_data, a, b, c, d)
|
||||
def __init__(self, pandemonium_real a, pandemonium_real b, pandemonium_real c, pandemonium_real d):
|
||||
{{ force_mark_rendered("pandemonium_plane_new_with_reals") }}
|
||||
gdapi10.pandemonium_plane_new_with_reals(&self._gd_data, a, b, c, d)
|
||||
|
||||
@staticmethod
|
||||
def from_vectors(Vector3 v1 not None, Vector3 v2 not None, Vector3 v3 not None):
|
||||
cdef Plane ret = Plane.__new__(Plane)
|
||||
{{ force_mark_rendered("godot_plane_new_with_vectors") }}
|
||||
gdapi10.godot_plane_new_with_vectors(&ret._gd_data, &v1._gd_data, &v2._gd_data, &v3._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_plane_new_with_vectors") }}
|
||||
gdapi10.pandemonium_plane_new_with_vectors(&ret._gd_data, &v1._gd_data, &v2._gd_data, &v3._gd_data)
|
||||
return ret
|
||||
|
||||
@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)
|
||||
{{ force_mark_rendered("godot_plane_new_with_normal") }}
|
||||
gdapi10.godot_plane_new_with_normal(&ret._gd_data, &normal._gd_data, d)
|
||||
{{ force_mark_rendered("pandemonium_plane_new_with_normal") }}
|
||||
gdapi10.pandemonium_plane_new_with_normal(&ret._gd_data, &normal._gd_data, d)
|
||||
return ret
|
||||
|
||||
def __repr__(Plane self):
|
||||
@ -54,24 +54,24 @@ cdef class Plane:
|
||||
|
||||
def intersects_segment(Plane self, Vector3 begin not None, Vector3 end not None):
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_plane_intersects_segment") }}
|
||||
if gdapi10.godot_plane_intersects_segment(&self._gd_data, &ret._gd_data, &begin._gd_data, &end._gd_data):
|
||||
{{ force_mark_rendered("pandemonium_plane_intersects_segment") }}
|
||||
if gdapi10.pandemonium_plane_intersects_segment(&self._gd_data, &ret._gd_data, &begin._gd_data, &end._gd_data):
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def intersects_ray(Plane self, Vector3 from_ not None, Vector3 dir not None):
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_plane_intersects_ray") }}
|
||||
if gdapi10.godot_plane_intersects_ray(&self._gd_data, &ret._gd_data, &from_._gd_data, &dir._gd_data):
|
||||
{{ force_mark_rendered("pandemonium_plane_intersects_ray") }}
|
||||
if gdapi10.pandemonium_plane_intersects_ray(&self._gd_data, &ret._gd_data, &from_._gd_data, &dir._gd_data):
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
||||
def intersect_3(Plane self, Plane b not None, Plane c not None):
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_plane_intersect_3") }}
|
||||
if gdapi10.godot_plane_intersect_3(&self._gd_data, &ret._gd_data, &b._gd_data, &c._gd_data):
|
||||
{{ force_mark_rendered("pandemonium_plane_intersect_3") }}
|
||||
if gdapi10.pandemonium_plane_intersect_3(&self._gd_data, &ret._gd_data, &b._gd_data, &c._gd_data):
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
@ -7,36 +7,36 @@
|
||||
@cython.final
|
||||
cdef class Quat:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_quat _gd_data
|
||||
cdef pandemonium_quat _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, x=0, y=0, z=0, w=0):
|
||||
{{ force_mark_rendered("godot_quat_new") }}
|
||||
gdapi10.godot_quat_new(&self._gd_data, x, y, z, w)
|
||||
{{ force_mark_rendered("pandemonium_quat_new") }}
|
||||
gdapi10.pandemonium_quat_new(&self._gd_data, x, y, z, w)
|
||||
|
||||
@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
|
||||
cdef Quat ret = Quat.__new__(Quat)
|
||||
{{ force_mark_rendered("godot_quat_new_with_axis_angle") }}
|
||||
gdapi10.godot_quat_new_with_axis_angle(&ret._gd_data, &axis._gd_data, angle)
|
||||
{{ force_mark_rendered("pandemonium_quat_new_with_axis_angle") }}
|
||||
gdapi10.pandemonium_quat_new_with_axis_angle(&ret._gd_data, &axis._gd_data, angle)
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
def from_basis(Basis basis not None):
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
cdef Quat ret = Quat.__new__(Quat)
|
||||
{{ force_mark_rendered("godot_quat_new_with_basis") }}
|
||||
gdapi11.godot_quat_new_with_basis(&ret._gd_data, &basis._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_quat_new_with_basis") }}
|
||||
gdapi11.pandemonium_quat_new_with_basis(&ret._gd_data, &basis._gd_data)
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
def from_euler(Vector3 euler not None):
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
cdef Quat ret = Quat.__new__(Quat)
|
||||
{{ force_mark_rendered("godot_quat_new_with_euler") }}
|
||||
gdapi11.godot_quat_new_with_euler(&ret._gd_data, &euler._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_quat_new_with_euler") }}
|
||||
gdapi11.pandemonium_quat_new_with_euler(&ret._gd_data, &euler._gd_data)
|
||||
return ret
|
||||
|
||||
def __repr__(Quat self):
|
||||
@ -54,12 +54,12 @@ cdef class Quat:
|
||||
{{ render_method("operator_subtract", py_name="__sub__") | 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:
|
||||
raise ZeroDivisionError
|
||||
cdef Quat ret = Quat.__new__(Quat)
|
||||
{{ force_mark_rendered("godot_quat_operator_divide") }}
|
||||
ret._gd_data = gdapi10.godot_quat_operator_divide(&self._gd_data, val)
|
||||
{{ force_mark_rendered("pandemonium_quat_operator_divide") }}
|
||||
ret._gd_data = gdapi10.pandemonium_quat_operator_divide(&self._gd_data, val)
|
||||
return ret
|
||||
|
||||
{{ render_property("x", getter="get_x", setter="set_x") | indent }}
|
||||
|
@ -7,19 +7,19 @@
|
||||
@cython.final
|
||||
cdef class Rect2:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_rect2 _gd_data
|
||||
cdef pandemonium_rect2 _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% 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):
|
||||
{{ force_mark_rendered("godot_rect2_new") }}
|
||||
gdapi10.godot_rect2_new(&self._gd_data, x, y, width, height)
|
||||
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("pandemonium_rect2_new") }}
|
||||
gdapi10.pandemonium_rect2_new(&self._gd_data, x, y, width, height)
|
||||
|
||||
@staticmethod
|
||||
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)
|
||||
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
|
||||
|
||||
def __repr__(Rect2 self):
|
||||
@ -33,10 +33,10 @@ cdef class Rect2:
|
||||
|
||||
@property
|
||||
def end(Rect2 self) -> Vector2:
|
||||
cdef godot_vector2 position = gdapi10.godot_rect2_get_position(&self._gd_data)
|
||||
cdef godot_vector2 size = gdapi10.godot_rect2_get_size(&self._gd_data)
|
||||
cdef pandemonium_vector2 position = gdapi10.pandemonium_rect2_get_position(&self._gd_data)
|
||||
cdef pandemonium_vector2 size = gdapi10.pandemonium_rect2_get_size(&self._gd_data)
|
||||
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
|
||||
|
||||
{{ render_method("as_string") | indent }}
|
||||
|
@ -17,21 +17,21 @@ def {{ py_name or spec.py_name }}({{ spec.klass.cy_type }} self{%- if args_witho
|
||||
) -> {{ spec.return_type.py_type }}:
|
||||
{% for arg in args_without_self %}
|
||||
{% if arg.is_variant %}
|
||||
cdef godot_variant __var_{{ arg.name }}
|
||||
if not pyobj_to_godot_variant({{ arg.name }}, &__var_{{ arg.name }}):
|
||||
cdef pandemonium_variant __var_{{ arg.name }}
|
||||
if not pyobj_to_pandemonium_variant({{ arg.name }}, &__var_{{ arg.name }}):
|
||||
{% for initialized_arg in args_without_self %}
|
||||
{% if initialized_arg.name == arg.name %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% if initialized_arg.is_variant %}
|
||||
gdapi10.godot_variant_destroy(&__var_{{ initialized_arg.name }})
|
||||
gdapi10.pandemonium_variant_destroy(&__var_{{ initialized_arg.name }})
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
raise TypeError(f"Cannot convert `{ {{ arg.name}} !r}` to Godot Variant")
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if spec.return_type.is_variant %}
|
||||
cdef godot_variant __var_ret = (
|
||||
cdef pandemonium_variant __var_ret = (
|
||||
{%- elif spec.return_type.is_builtin %}
|
||||
cdef {{ spec.return_type.cy_type }} __ret = {{ spec.return_type.cy_type }}.__new__({{ spec.return_type.cy_type }})
|
||||
__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 %}
|
||||
{% if arg.is_variant %}
|
||||
gdapi10.godot_variant_destroy(&__var_{{ arg.name }})
|
||||
gdapi10.pandemonium_variant_destroy(&__var_{{ arg.name }})
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if spec.return_type.is_variant %}
|
||||
cdef object __ret = godot_variant_to_pyobj(&__var_ret)
|
||||
gdapi10.godot_variant_destroy(&__var_ret)
|
||||
cdef object __ret = pandemonium_variant_to_pyobj(&__var_ret)
|
||||
gdapi10.pandemonium_variant_destroy(&__var_ret)
|
||||
return __ret
|
||||
{% elif not spec.return_type.is_void %}
|
||||
return __ret
|
||||
|
@ -8,20 +8,20 @@ from godot.bindings cimport Resource
|
||||
@cython.final
|
||||
cdef class RID:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_rid _gd_data
|
||||
cdef pandemonium_rid _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, Resource from_=None):
|
||||
if from_ is not None:
|
||||
{{ force_mark_rendered("godot_rid_new_with_resource") }}
|
||||
gdapi10.godot_rid_new_with_resource(
|
||||
{{ force_mark_rendered("pandemonium_rid_new_with_resource") }}
|
||||
gdapi10.pandemonium_rid_new_with_resource(
|
||||
&self._gd_data,
|
||||
from_._gd_ptr
|
||||
)
|
||||
else:
|
||||
{{ force_mark_rendered("godot_rid_new") }}
|
||||
gdapi10.godot_rid_new(&self._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_rid_new") }}
|
||||
gdapi10.pandemonium_rid_new(&self._gd_data)
|
||||
|
||||
def __repr__(RID self):
|
||||
return f"<RID(id={self.get_id()})>"
|
||||
@ -30,7 +30,7 @@ cdef class RID:
|
||||
def from_resource(Resource resource not None):
|
||||
# Call to __new__ bypasses __init__ constructor
|
||||
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
|
||||
|
||||
{{ render_operator_eq() | indent }}
|
||||
|
@ -7,17 +7,17 @@
|
||||
@cython.final
|
||||
cdef class Transform:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_transform _gd_data
|
||||
cdef pandemonium_transform _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
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:
|
||||
{{ force_mark_rendered("godot_transform_new_identity") }}
|
||||
gdapi10.godot_transform_new_identity(&self._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform_new_identity") }}
|
||||
gdapi10.pandemonium_transform_new_identity(&self._gd_data)
|
||||
else:
|
||||
{{ force_mark_rendered("godot_transform_new_with_axis_origin") }}
|
||||
gdapi10.godot_transform_new_with_axis_origin(
|
||||
{{ force_mark_rendered("pandemonium_transform_new_with_axis_origin") }}
|
||||
gdapi10.pandemonium_transform_new_with_axis_origin(
|
||||
&self._gd_data,
|
||||
&(<Vector3?>x_axis)._gd_data,
|
||||
&(<Vector3?>y_axis)._gd_data,
|
||||
@ -28,15 +28,15 @@ cdef class Transform:
|
||||
@staticmethod
|
||||
def from_basis_origin(Basis basis not None, Vector3 origin not None):
|
||||
cdef Transform ret = Transform.__new__(Transform)
|
||||
{{ force_mark_rendered("godot_transform_new") }}
|
||||
gdapi10.godot_transform_new(&ret._gd_data, &basis._gd_data, &origin._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform_new") }}
|
||||
gdapi10.pandemonium_transform_new(&ret._gd_data, &basis._gd_data, &origin._gd_data)
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
def from_quat(Quat quat not None):
|
||||
cdef Transform ret = Transform.__new__(Transform)
|
||||
{{ force_mark_rendered("godot_transform_new_with_quat") }}
|
||||
gdapi11.godot_transform_new_with_quat(&ret._gd_data, &quat._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform_new_with_quat") }}
|
||||
gdapi11.pandemonium_transform_new_with_quat(&ret._gd_data, &quat._gd_data)
|
||||
return ret
|
||||
|
||||
def __repr__(Transform self):
|
||||
|
@ -7,17 +7,17 @@
|
||||
@cython.final
|
||||
cdef class Transform2D:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_transform2d _gd_data
|
||||
cdef pandemonium_transform2d _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
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:
|
||||
{{ force_mark_rendered("godot_transform2d_new_identity") }}
|
||||
gdapi10.godot_transform2d_new_identity(&self._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform2d_new_identity") }}
|
||||
gdapi10.pandemonium_transform2d_new_identity(&self._gd_data)
|
||||
else:
|
||||
{{ force_mark_rendered("godot_transform2d_new_axis_origin") }}
|
||||
gdapi10.godot_transform2d_new_axis_origin(
|
||||
{{ force_mark_rendered("pandemonium_transform2d_new_axis_origin") }}
|
||||
gdapi10.pandemonium_transform2d_new_axis_origin(
|
||||
&self._gd_data,
|
||||
&(<Vector2?>x_axis)._gd_data,
|
||||
&(<Vector2?>y_axis)._gd_data,
|
||||
@ -25,10 +25,10 @@ cdef class Transform2D:
|
||||
)
|
||||
|
||||
@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)
|
||||
{{ force_mark_rendered("godot_transform2d_new") }}
|
||||
gdapi10.godot_transform2d_new(&ret._gd_data, rot, &pos._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform2d_new") }}
|
||||
gdapi10.pandemonium_transform2d_new(&ret._gd_data, rot, &pos._gd_data)
|
||||
return ret
|
||||
|
||||
def __repr__(Transform2D self):
|
||||
@ -57,15 +57,15 @@ cdef class Transform2D:
|
||||
cdef Rect2 ret_r2
|
||||
try:
|
||||
ret_v2 = Vector2.__new__(Vector2)
|
||||
{{ force_mark_rendered("godot_transform2d_xform_vector2") }}
|
||||
ret_v2._gd_data = gdapi10.godot_transform2d_xform_vector2(&self._gd_data, &(<Vector2?>v)._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform2d_xform_vector2") }}
|
||||
ret_v2._gd_data = gdapi10.pandemonium_transform2d_xform_vector2(&self._gd_data, &(<Vector2?>v)._gd_data)
|
||||
return ret_v2
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
ret_r2 = Rect2.__new__(Rect2)
|
||||
{{ force_mark_rendered("godot_transform2d_xform_rect2") }}
|
||||
ret_r2._gd_data = gdapi10.godot_transform2d_xform_rect2(&self._gd_data, &(<Rect2?>v)._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform2d_xform_rect2") }}
|
||||
ret_r2._gd_data = gdapi10.pandemonium_transform2d_xform_rect2(&self._gd_data, &(<Rect2?>v)._gd_data)
|
||||
return ret_r2
|
||||
except TypeError:
|
||||
raise TypeError("`v` must be Vector2 or Rect2")
|
||||
@ -75,15 +75,15 @@ cdef class Transform2D:
|
||||
cdef Rect2 ret_r2
|
||||
try:
|
||||
ret_v2 = Vector2.__new__(Vector2)
|
||||
{{ force_mark_rendered("godot_transform2d_xform_inv_vector2") }}
|
||||
ret_v2._gd_data = gdapi10.godot_transform2d_xform_inv_vector2(&self._gd_data, &(<Vector2?>v)._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform2d_xform_inv_vector2") }}
|
||||
ret_v2._gd_data = gdapi10.pandemonium_transform2d_xform_inv_vector2(&self._gd_data, &(<Vector2?>v)._gd_data)
|
||||
return ret_v2
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
ret_r2 = Rect2.__new__(Rect2)
|
||||
{{ force_mark_rendered("godot_transform2d_xform_inv_rect2") }}
|
||||
ret_r2._gd_data = gdapi10.godot_transform2d_xform_inv_rect2(&self._gd_data, &(<Rect2?>v)._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_transform2d_xform_inv_rect2") }}
|
||||
ret_r2._gd_data = gdapi10.pandemonium_transform2d_xform_inv_rect2(&self._gd_data, &(<Rect2?>v)._gd_data)
|
||||
return ret_r2
|
||||
except TypeError:
|
||||
raise TypeError("`v` must be Vector2 or Rect2")
|
||||
|
@ -5,26 +5,26 @@ import math
|
||||
|
||||
cdef inline Vector2 Vector2_multiply_vector(Vector2 self, Vector2 b):
|
||||
cdef Vector2 ret = Vector2.__new__(Vector2)
|
||||
{{ force_mark_rendered("godot_vector2_operator_multiply_vector") }}
|
||||
ret._gd_data = gdapi10.godot_vector2_operator_multiply_vector(&self._gd_data, &b._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_vector2_operator_multiply_vector") }}
|
||||
ret._gd_data = gdapi10.pandemonium_vector2_operator_multiply_vector(&self._gd_data, &b._gd_data)
|
||||
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)
|
||||
{{ force_mark_rendered("godot_vector2_operator_multiply_scalar") }}
|
||||
ret._gd_data = gdapi10.godot_vector2_operator_multiply_scalar(&self._gd_data, b)
|
||||
{{ force_mark_rendered("pandemonium_vector2_operator_multiply_scalar") }}
|
||||
ret._gd_data = gdapi10.pandemonium_vector2_operator_multiply_scalar(&self._gd_data, b)
|
||||
return ret
|
||||
|
||||
cdef inline Vector2 Vector2_divide_vector(Vector2 self, Vector2 b):
|
||||
cdef Vector2 ret = Vector2.__new__(Vector2)
|
||||
{{ force_mark_rendered("godot_vector2_operator_divide_vector") }}
|
||||
ret._gd_data = gdapi10.godot_vector2_operator_divide_vector(&self._gd_data, &b._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_vector2_operator_divide_vector") }}
|
||||
ret._gd_data = gdapi10.pandemonium_vector2_operator_divide_vector(&self._gd_data, &b._gd_data)
|
||||
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)
|
||||
{{ force_mark_rendered("godot_vector2_operator_divide_scalar") }}
|
||||
ret._gd_data = gdapi10.godot_vector2_operator_divide_scalar(&self._gd_data, b)
|
||||
{{ force_mark_rendered("pandemonium_vector2_operator_divide_scalar") }}
|
||||
ret._gd_data = gdapi10.pandemonium_vector2_operator_divide_scalar(&self._gd_data, b)
|
||||
return ret
|
||||
{% endblock -%}
|
||||
|
||||
@ -32,13 +32,13 @@ cdef inline Vector2 Vector2_divide_scalar(Vector2 self, godot_real b):
|
||||
@cython.final
|
||||
cdef class Vector2:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_vector2 _gd_data
|
||||
cdef pandemonium_vector2 _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, godot_real x=0.0, godot_real y=0.0):
|
||||
{{ force_mark_rendered("godot_vector2_new") }}
|
||||
gdapi10.godot_vector2_new(&self._gd_data, x, y)
|
||||
def __init__(self, pandemonium_real x=0.0, pandemonium_real y=0.0):
|
||||
{{ force_mark_rendered("pandemonium_vector2_new") }}
|
||||
gdapi10.pandemonium_vector2_new(&self._gd_data, x, y)
|
||||
|
||||
def __repr__(Vector2 self):
|
||||
return f"<Vector2(x={self.x}, y={self.y})>"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{%- block pxd_header %}
|
||||
{% endblock -%}
|
||||
{%- 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
|
||||
from enum import IntEnum
|
||||
@ -9,26 +9,26 @@ from enum import IntEnum
|
||||
|
||||
cdef inline Vector3_multiply_vector(Vector3 self, Vector3 b):
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_vector3_operator_multiply_vector") }}
|
||||
ret._gd_data = gdapi10.godot_vector3_operator_multiply_vector(&self._gd_data, &b._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_vector3_operator_multiply_vector") }}
|
||||
ret._gd_data = gdapi10.pandemonium_vector3_operator_multiply_vector(&self._gd_data, &b._gd_data)
|
||||
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)
|
||||
{{ force_mark_rendered("godot_vector3_operator_multiply_scalar") }}
|
||||
ret._gd_data = gdapi10.godot_vector3_operator_multiply_scalar(&self._gd_data, b)
|
||||
{{ force_mark_rendered("pandemonium_vector3_operator_multiply_scalar") }}
|
||||
ret._gd_data = gdapi10.pandemonium_vector3_operator_multiply_scalar(&self._gd_data, b)
|
||||
return ret
|
||||
|
||||
cdef inline Vector3_divide_vector(Vector3 self, Vector3 b):
|
||||
cdef Vector3 ret = Vector3.__new__(Vector3)
|
||||
{{ force_mark_rendered("godot_vector3_operator_divide_vector") }}
|
||||
ret._gd_data = gdapi10.godot_vector3_operator_divide_vector(&self._gd_data, &b._gd_data)
|
||||
{{ force_mark_rendered("pandemonium_vector3_operator_divide_vector") }}
|
||||
ret._gd_data = gdapi10.pandemonium_vector3_operator_divide_vector(&self._gd_data, &b._gd_data)
|
||||
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)
|
||||
{{ force_mark_rendered("godot_vector3_operator_divide_scalar") }}
|
||||
ret._gd_data = gdapi10.godot_vector3_operator_divide_scalar(&self._gd_data, b)
|
||||
{{ force_mark_rendered("pandemonium_vector3_operator_divide_scalar") }}
|
||||
ret._gd_data = gdapi10.pandemonium_vector3_operator_divide_scalar(&self._gd_data, b)
|
||||
return ret
|
||||
|
||||
{% endblock -%}
|
||||
@ -37,46 +37,46 @@ cdef inline Vector3_divide_scalar(Vector3 self, godot_real b):
|
||||
@cython.final
|
||||
cdef class Vector3:
|
||||
{% block cdef_attributes %}
|
||||
cdef godot_vector3 _gd_data
|
||||
cdef pandemonium_vector3 _gd_data
|
||||
{% endblock %}
|
||||
|
||||
{% block python_defs %}
|
||||
def __init__(self, godot_real x=0.0, godot_real y=0.0, godot_real z=0.0):
|
||||
{{ force_mark_rendered("godot_vector3_new") }}
|
||||
gdapi10.godot_vector3_new(&self._gd_data, x, y, z)
|
||||
def __init__(self, pandemonium_real x=0.0, pandemonium_real y=0.0, pandemonium_real z=0.0):
|
||||
{{ force_mark_rendered("pandemonium_vector3_new") }}
|
||||
gdapi10.pandemonium_vector3_new(&self._gd_data, x, y, z)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Vector3(x={self.x}, y={self.y}, z={self.z})>"
|
||||
|
||||
@property
|
||||
def x(self) -> godot_real:
|
||||
{{ force_mark_rendered("godot_vector3_get_axis") }}
|
||||
return gdapi10.godot_vector3_get_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_X)
|
||||
def x(self) -> pandemonium_real:
|
||||
{{ force_mark_rendered("pandemonium_vector3_get_axis") }}
|
||||
return gdapi10.pandemonium_vector3_get_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_X)
|
||||
|
||||
@x.setter
|
||||
def x(self, godot_real val) -> None:
|
||||
{{ force_mark_rendered("godot_vector3_set_axis") }}
|
||||
gdapi10.godot_vector3_set_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_X, val)
|
||||
def x(self, pandemonium_real val) -> None:
|
||||
{{ force_mark_rendered("pandemonium_vector3_set_axis") }}
|
||||
gdapi10.pandemonium_vector3_set_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_X, val)
|
||||
|
||||
@property
|
||||
def y(self) -> godot_real:
|
||||
{{ force_mark_rendered("godot_vector3_get_axis") }}
|
||||
return gdapi10.godot_vector3_get_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_Y)
|
||||
def y(self) -> pandemonium_real:
|
||||
{{ force_mark_rendered("pandemonium_vector3_get_axis") }}
|
||||
return gdapi10.pandemonium_vector3_get_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Y)
|
||||
|
||||
@y.setter
|
||||
def y(self, godot_real val) -> None:
|
||||
{{ force_mark_rendered("godot_vector3_set_axis") }}
|
||||
gdapi10.godot_vector3_set_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_Y, val)
|
||||
def y(self, pandemonium_real val) -> None:
|
||||
{{ force_mark_rendered("pandemonium_vector3_set_axis") }}
|
||||
gdapi10.pandemonium_vector3_set_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Y, val)
|
||||
|
||||
@property
|
||||
def z(self) -> godot_real:
|
||||
{{ force_mark_rendered("godot_vector3_get_axis") }}
|
||||
return gdapi10.godot_vector3_get_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_Z)
|
||||
def z(self) -> pandemonium_real:
|
||||
{{ force_mark_rendered("pandemonium_vector3_get_axis") }}
|
||||
return gdapi10.pandemonium_vector3_get_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Z)
|
||||
|
||||
@z.setter
|
||||
def z(self, godot_real val) -> None:
|
||||
{{ force_mark_rendered("godot_vector3_set_axis") }}
|
||||
gdapi10.godot_vector3_set_axis(&self._gd_data, godot_vector3_axis.GODOT_VECTOR3_AXIS_Z, val)
|
||||
def z(self, pandemonium_real val) -> None:
|
||||
{{ force_mark_rendered("pandemonium_vector3_set_axis") }}
|
||||
gdapi10.pandemonium_vector3_set_axis(&self._gd_data, pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Z, val)
|
||||
|
||||
{{ render_operator_eq() | indent }}
|
||||
{{ render_operator_ne() | indent }}
|
||||
@ -143,9 +143,9 @@ cdef class Vector3:
|
||||
|
||||
{%- block python_consts %}
|
||||
AXIS = IntEnum("AXIS", {
|
||||
"X": godot_vector3_axis.GODOT_VECTOR3_AXIS_X,
|
||||
"Y": godot_vector3_axis.GODOT_VECTOR3_AXIS_Y,
|
||||
"Z": godot_vector3_axis.GODOT_VECTOR3_AXIS_Z,
|
||||
"X": pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_X,
|
||||
"Y": pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Y,
|
||||
"Z": pandemonium_vector3_axis.GODOT_VECTOR3_AXIS_Z,
|
||||
})
|
||||
|
||||
ZERO = Vector3(0, 0, 0) # Zero vector.
|
||||
|
@ -184,33 +184,33 @@ SAMPLE_CLASSES = {
|
||||
|
||||
SUPPORTED_TYPES = {
|
||||
"void",
|
||||
"godot_bool",
|
||||
"godot_int",
|
||||
"godot_real",
|
||||
"godot_string",
|
||||
"godot_variant",
|
||||
"godot_object",
|
||||
"godot_aabb",
|
||||
"godot_array",
|
||||
"godot_basis",
|
||||
"godot_color",
|
||||
"godot_dictionary",
|
||||
"godot_node_path",
|
||||
"godot_plane",
|
||||
"godot_quat",
|
||||
"godot_rect2",
|
||||
"godot_rid",
|
||||
"godot_transform",
|
||||
"godot_transform2d",
|
||||
"godot_vector2",
|
||||
"godot_vector3",
|
||||
"godot_pool_byte_array",
|
||||
"godot_pool_int_array",
|
||||
"godot_pool_real_array",
|
||||
"godot_pool_string_array",
|
||||
"godot_pool_vector2_array",
|
||||
"godot_pool_vector3_array",
|
||||
"godot_pool_color_array",
|
||||
"pandemonium_bool",
|
||||
"pandemonium_int",
|
||||
"pandemonium_real",
|
||||
"pandemonium_string",
|
||||
"pandemonium_variant",
|
||||
"pandemonium_object",
|
||||
"pandemonium_aabb",
|
||||
"pandemonium_array",
|
||||
"pandemonium_basis",
|
||||
"pandemonium_color",
|
||||
"pandemonium_dictionary",
|
||||
"pandemonium_node_path",
|
||||
"pandemonium_plane",
|
||||
"pandemonium_quat",
|
||||
"pandemonium_rect2",
|
||||
"pandemonium_rid",
|
||||
"pandemonium_transform",
|
||||
"pandemonium_transform2d",
|
||||
"pandemonium_vector2",
|
||||
"pandemonium_vector3",
|
||||
"pandemonium_pool_byte_array",
|
||||
"pandemonium_pool_int_array",
|
||||
"pandemonium_pool_real_array",
|
||||
"pandemonium_pool_string_array",
|
||||
"pandemonium_pool_vector2_array",
|
||||
"pandemonium_pool_vector3_array",
|
||||
"pandemonium_pool_color_array",
|
||||
}
|
||||
|
||||
|
||||
@ -357,8 +357,8 @@ def cook_data(data):
|
||||
pcls, ecls = re.match(r"enum.(\w+)::(\w+)", type_).groups()
|
||||
return TypeSpec(
|
||||
gdapi_type=type_,
|
||||
c_type="godot_int",
|
||||
cy_type="godot_int",
|
||||
c_type="pandemonium_int",
|
||||
cy_type="pandemonium_int",
|
||||
py_type=f"{class_renames[pcls]}.{ecls}",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -369,7 +369,7 @@ def cook_data(data):
|
||||
if "," in type_:
|
||||
return TypeSpec(
|
||||
gdapi_type=type_,
|
||||
c_type="godot_object",
|
||||
c_type="pandemonium_object",
|
||||
cy_type="Resource",
|
||||
py_type=f"Union[{','.join([class_renames[x] for x in type_.split(',')])}]",
|
||||
is_object=True,
|
||||
@ -377,7 +377,7 @@ def cook_data(data):
|
||||
else:
|
||||
return TypeSpec(
|
||||
gdapi_type=type_,
|
||||
c_type="godot_object",
|
||||
c_type="pandemonium_object",
|
||||
cy_type=class_renames[type_],
|
||||
is_object=True,
|
||||
)
|
||||
@ -392,46 +392,46 @@ def cook_data(data):
|
||||
if not has_default_value:
|
||||
return None
|
||||
# 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":
|
||||
return "None"
|
||||
else:
|
||||
return value
|
||||
elif type == "godot_string":
|
||||
elif type == "pandemonium_string":
|
||||
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"
|
||||
elif type == "godot_dictionary" and value == "{}":
|
||||
elif type == "pandemonium_dictionary" and value == "{}":
|
||||
return "Dictionary()"
|
||||
elif type == "godot_vector2":
|
||||
elif type == "pandemonium_vector2":
|
||||
return f"Vector2{value}"
|
||||
elif type == "godot_rect2":
|
||||
elif type == "pandemonium_rect2":
|
||||
return f"Rect2{value}"
|
||||
elif type == "godot_vector3":
|
||||
elif type == "pandemonium_vector3":
|
||||
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 (
|
||||
"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))"
|
||||
elif value == "[RID]":
|
||||
return "RID()"
|
||||
elif type == "godot_color":
|
||||
elif type == "pandemonium_color":
|
||||
return f"Color({value})"
|
||||
elif type == "godot_pool_color_array" and value == "[PoolColorArray]":
|
||||
elif type == "pandemonium_pool_color_array" and value == "[PoolColorArray]":
|
||||
return "PoolColorArray()"
|
||||
elif type == "godot_array" and value == "[]":
|
||||
elif type == "pandemonium_array" and value == "[]":
|
||||
return f"Array()"
|
||||
elif type == "godot_pool_vector2_array" and value == "[]":
|
||||
elif type == "pandemonium_pool_vector2_array" and value == "[]":
|
||||
return f"PoolVector2Array()"
|
||||
elif type == "godot_pool_vector3_array" and value == "[]":
|
||||
elif type == "pandemonium_pool_vector3_array" and value == "[]":
|
||||
return f"PoolVector3Array()"
|
||||
elif type == "godot_pool_int_array" and value == "[]":
|
||||
elif type == "pandemonium_pool_int_array" and value == "[]":
|
||||
return f"PoolIntArray()"
|
||||
elif type == "godot_pool_real_array" and value == "[]":
|
||||
elif type == "pandemonium_pool_real_array" and value == "[]":
|
||||
return f"PoolRealArray()"
|
||||
elif type == "godot_pool_string_array" and value == "[]":
|
||||
elif type == "pandemonium_pool_string_array" and value == "[]":
|
||||
return f"PoolStringArray()"
|
||||
elif value == "Null":
|
||||
return "None"
|
||||
|
@ -51,8 +51,8 @@ ALL_TYPES = [
|
||||
*ALL_TYPES_EXCEPT_OBJECTS,
|
||||
*TYPES_SIZED_INT,
|
||||
TypeSpec(
|
||||
gdapi_type="godot_object",
|
||||
c_type="godot_object",
|
||||
gdapi_type="pandemonium_object",
|
||||
c_type="pandemonium_object",
|
||||
cy_type="object",
|
||||
py_type="Object",
|
||||
is_object=True,
|
||||
@ -73,7 +73,7 @@ ALL_TYPES = [
|
||||
is_base_type=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(
|
||||
gdapi_type="double",
|
||||
c_type="double",
|
||||
@ -100,16 +100,16 @@ ALL_TYPES = [
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="godot_char_string",
|
||||
c_type="godot_char_string",
|
||||
cy_type="godot_char_string",
|
||||
gdapi_type="pandemonium_char_string",
|
||||
c_type="pandemonium_char_string",
|
||||
cy_type="pandemonium_char_string",
|
||||
py_type="str",
|
||||
is_builtin=True,
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="godot_string_name",
|
||||
c_type="godot_string_name",
|
||||
cy_type="godot_string_name",
|
||||
gdapi_type="pandemonium_string_name",
|
||||
c_type="pandemonium_string_name",
|
||||
cy_type="pandemonium_string_name",
|
||||
py_type="str",
|
||||
is_builtin=True,
|
||||
),
|
||||
@ -162,7 +162,7 @@ class BuiltinMethodSpec:
|
||||
klass: TypeSpec
|
||||
# Name of the function in the GDNative C API
|
||||
c_name: str
|
||||
# Basically gd_name without the `godot_<type>_` prefix
|
||||
# Basically gd_name without the `pandemonium_<type>_` prefix
|
||||
py_name: str
|
||||
return_type: TypeSpec
|
||||
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:
|
||||
c_name = func["name"]
|
||||
assert c_name.startswith("godot_"), func
|
||||
assert c_name.startswith("pandemonium_"), func
|
||||
for builtin_type in BUILTINS_TYPES:
|
||||
prefix = f"{builtin_type.c_type}_"
|
||||
if c_name.startswith(prefix):
|
||||
py_name = c_name[len(prefix) :]
|
||||
break
|
||||
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
|
||||
|
||||
def _cook_type(raw_type):
|
||||
@ -245,7 +245,7 @@ def pre_cook_patch_stuff(gdnative_api):
|
||||
while revision:
|
||||
for func in revision["api"]:
|
||||
# `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.
|
||||
if func["return_type"] == "signed char":
|
||||
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"]:
|
||||
assert func["name"] not in specs
|
||||
# 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
|
||||
spec = load_builtin_method_spec(func, gdapi=revision_gdapi)
|
||||
if spec:
|
||||
|
@ -295,7 +295,7 @@ class PatchedAutoPxd(AutoPxd):
|
||||
|
||||
def visit_ArrayDecl(self, node):
|
||||
# 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*)` :(
|
||||
if node.type.declname == "_dont_touch_that":
|
||||
# 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()
|
||||
# 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")
|
||||
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_VARARG = 128,
|
||||
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_EDITOR = 2
|
||||
GODOT_METHOD_FLAG_NOSCRIPT = 4
|
||||
|
@ -23,23 +23,23 @@ class TypeItem:
|
||||
TYPES = [
|
||||
# Base types
|
||||
TypeItem(
|
||||
gd_pool=f"godot_pool_int_array",
|
||||
gd_pool=f"pandemonium_pool_int_array",
|
||||
py_pool=f"PoolIntArray",
|
||||
gd_value=f"godot_int",
|
||||
py_value=f"godot_int",
|
||||
gd_value=f"pandemonium_int",
|
||||
py_value=f"pandemonium_int",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeItem(
|
||||
gd_pool=f"godot_pool_real_array",
|
||||
gd_pool=f"pandemonium_pool_real_array",
|
||||
py_pool=f"PoolRealArray",
|
||||
gd_value=f"godot_real",
|
||||
py_value=f"godot_real",
|
||||
gd_value=f"pandemonium_real",
|
||||
py_value=f"pandemonium_real",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeItem(
|
||||
gd_pool="godot_pool_byte_array",
|
||||
gd_pool="pandemonium_pool_byte_array",
|
||||
py_pool="PoolByteArray",
|
||||
gd_value="uint8_t",
|
||||
py_value="uint8_t",
|
||||
@ -48,34 +48,34 @@ TYPES = [
|
||||
),
|
||||
# Stack only builtin types
|
||||
TypeItem(
|
||||
gd_pool=f"godot_pool_vector2_array",
|
||||
gd_pool=f"pandemonium_pool_vector2_array",
|
||||
py_pool=f"PoolVector2Array",
|
||||
gd_value=f"godot_vector2",
|
||||
gd_value=f"pandemonium_vector2",
|
||||
py_value=f"Vector2",
|
||||
is_base_type=False,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeItem(
|
||||
gd_pool=f"godot_pool_vector3_array",
|
||||
gd_pool=f"pandemonium_pool_vector3_array",
|
||||
py_pool=f"PoolVector3Array",
|
||||
gd_value=f"godot_vector3",
|
||||
gd_value=f"pandemonium_vector3",
|
||||
py_value=f"Vector3",
|
||||
is_base_type=False,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeItem(
|
||||
gd_pool=f"godot_pool_color_array",
|
||||
gd_pool=f"pandemonium_pool_color_array",
|
||||
py_pool=f"PoolColorArray",
|
||||
gd_value=f"godot_color",
|
||||
gd_value=f"pandemonium_color",
|
||||
py_value=f"Color",
|
||||
is_base_type=False,
|
||||
is_stack_only=True,
|
||||
),
|
||||
# Stack&heap builtin types
|
||||
TypeItem(
|
||||
gd_pool="godot_pool_string_array",
|
||||
gd_pool="pandemonium_pool_string_array",
|
||||
py_pool="PoolStringArray",
|
||||
gd_value="godot_string",
|
||||
gd_value="pandemonium_string",
|
||||
py_value="GDString",
|
||||
is_base_type=False,
|
||||
is_stack_only=False,
|
||||
|
@ -2,8 +2,8 @@
|
||||
{% if type['gd_value'] == type['py_value'] %}
|
||||
{{ dst }} = {{ src }}
|
||||
{% else %}
|
||||
dst = godot_string_to_pyobj(&src)
|
||||
gdapi10.godot_string_destroy(&src)
|
||||
dst = pandemonium_string_to_pyobj(&src)
|
||||
gdapi10.pandemonium_string_destroy(&src)
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
@ -61,10 +61,10 @@ cdef class {{ t.py_pool }}:
|
||||
# Operators
|
||||
|
||||
def __getitem__(self, index):
|
||||
cdef godot_int size = self.size()
|
||||
cdef godot_int start
|
||||
cdef godot_int stop
|
||||
cdef godot_int step
|
||||
cdef pandemonium_int size = self.size()
|
||||
cdef pandemonium_int start
|
||||
cdef pandemonium_int stop
|
||||
cdef pandemonium_int step
|
||||
if isinstance(index, slice):
|
||||
step = index.step if index.step is not None else 1
|
||||
if step == 0:
|
||||
@ -87,7 +87,7 @@ cdef class {{ t.py_pool }}:
|
||||
raise IndexError("list index out of range")
|
||||
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 %}
|
||||
return gdapi10.{{ t.gd_pool }}_get(&self._gd_data, index)
|
||||
{% else %}
|
||||
@ -96,9 +96,9 @@ cdef class {{ t.py_pool }}:
|
||||
return ret
|
||||
{% 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 godot_int size = self.size()
|
||||
cdef pandemonium_int size = self.size()
|
||||
|
||||
if 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 {{ 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):
|
||||
{% if t.is_stack_only %}
|
||||
dst_ptr[i] = src_ptr[i * step + start]
|
||||
@ -150,8 +150,8 @@ cdef class {{ t.py_pool }}:
|
||||
return ret
|
||||
|
||||
# TODO: support slice
|
||||
def __setitem__(self, godot_int index, {{ t.py_value }} value):
|
||||
cdef godot_int size
|
||||
def __setitem__(self, pandemonium_int index, {{ t.py_value }} value):
|
||||
cdef pandemonium_int size
|
||||
size = self.size()
|
||||
if index < 0:
|
||||
index += size
|
||||
@ -164,8 +164,8 @@ cdef class {{ t.py_pool }}:
|
||||
{% endif %}
|
||||
|
||||
# TODO: support slice
|
||||
def __delitem__(self, godot_int index):
|
||||
cdef godot_int size
|
||||
def __delitem__(self, pandemonium_int index):
|
||||
cdef pandemonium_int size
|
||||
size = self.size()
|
||||
if index < 0:
|
||||
index += size
|
||||
@ -218,8 +218,8 @@ cdef class {{ t.py_pool }}:
|
||||
cdef inline bint operator_equal(self, {{ t.py_pool }} other):
|
||||
if other is None:
|
||||
return False
|
||||
# TODO `godot_array_operator_equal` is missing in gdapi, submit a PR ?
|
||||
cdef godot_int size = self.size()
|
||||
# TODO `pandemonium_array_operator_equal` is missing in gdapi, submit a PR ?
|
||||
cdef pandemonium_int size = self.size()
|
||||
if size != other.size():
|
||||
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 }} *b_ptr = gdapi10.{{ t.gd_pool }}_read_access_ptr(b_access)
|
||||
cdef godot_int i
|
||||
cdef pandemonium_int i
|
||||
cdef bint ret = True
|
||||
for i in range(size):
|
||||
{% 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)
|
||||
{% 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)
|
||||
|
||||
cdef inline godot_int size(self):
|
||||
cdef inline pandemonium_int size(self):
|
||||
return gdapi10.{{ t.gd_pool }}_size(&self._gd_data)
|
||||
|
||||
# Raw access
|
||||
|
@ -23,7 +23,7 @@ class TypeSpec:
|
||||
is_base_type: bool = False
|
||||
# Type doesn't use the heap (hence no need for freeing it)
|
||||
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
|
||||
|
||||
@property
|
||||
@ -32,7 +32,7 @@ class TypeSpec:
|
||||
|
||||
@property
|
||||
def is_variant(self) -> bool:
|
||||
return self.c_type == "godot_variant"
|
||||
return self.c_type == "pandemonium_variant"
|
||||
|
||||
def __post_init__(self):
|
||||
self.py_type = self.py_type or self.cy_type
|
||||
@ -50,22 +50,22 @@ TYPE_VOID = TypeSpec(
|
||||
)
|
||||
TYPE_BOOL = TypeSpec(
|
||||
gdapi_type="bool",
|
||||
c_type="godot_bool",
|
||||
c_type="pandemonium_bool",
|
||||
cy_type="bint",
|
||||
py_type="bool",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
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(
|
||||
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(
|
||||
gdapi_type="enum.Error",
|
||||
c_type="godot_error",
|
||||
cy_type="godot_error",
|
||||
c_type="pandemonium_error",
|
||||
cy_type="pandemonium_error",
|
||||
py_type="Error",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -73,8 +73,8 @@ TYPE_ERROR = TypeSpec(
|
||||
)
|
||||
TYPE_VECTOR2_AXIS = TypeSpec(
|
||||
gdapi_type="enum.Vector2::Axis",
|
||||
c_type="godot_vector2_axis",
|
||||
cy_type="godot_vector2_axis",
|
||||
c_type="pandemonium_vector2_axis",
|
||||
cy_type="pandemonium_vector2_axis",
|
||||
py_type="Vector2.Axis",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -82,8 +82,8 @@ TYPE_VECTOR2_AXIS = TypeSpec(
|
||||
)
|
||||
TYPE_VECTOR2I_AXIS = TypeSpec(
|
||||
gdapi_type="enum.Vector2i::Axis",
|
||||
c_type="godot_vector2i_axis",
|
||||
cy_type="godot_vector2i_axis",
|
||||
c_type="pandemonium_vector2i_axis",
|
||||
cy_type="pandemonium_vector2i_axis",
|
||||
py_type="Vector2i.Axis",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -91,8 +91,8 @@ TYPE_VECTOR2I_AXIS = TypeSpec(
|
||||
)
|
||||
TYPE_VECTOR3_AXIS = TypeSpec(
|
||||
gdapi_type="enum.Vector3::Axis",
|
||||
c_type="godot_vector3_axis",
|
||||
cy_type="godot_vector3_axis",
|
||||
c_type="pandemonium_vector3_axis",
|
||||
cy_type="pandemonium_vector3_axis",
|
||||
py_type="Vector3.Axis",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -100,8 +100,8 @@ TYPE_VECTOR3_AXIS = TypeSpec(
|
||||
)
|
||||
TYPE_VECTOR3I_AXIS = TypeSpec(
|
||||
gdapi_type="enum.Vector3i::Axis",
|
||||
c_type="godot_vector3i_axis",
|
||||
cy_type="godot_vector3i_axis",
|
||||
c_type="pandemonium_vector3i_axis",
|
||||
cy_type="pandemonium_vector3i_axis",
|
||||
py_type="Vector3i.Axis",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -109,8 +109,8 @@ TYPE_VECTOR3I_AXIS = TypeSpec(
|
||||
)
|
||||
TYPE_VECTOR4_AXIS = TypeSpec(
|
||||
gdapi_type="enum.Vector4::Axis",
|
||||
c_type="godot_vector4_axis",
|
||||
cy_type="godot_vector4_axis",
|
||||
c_type="pandemonium_vector4_axis",
|
||||
cy_type="pandemonium_vector4_axis",
|
||||
py_type="Vector4.Axis",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -118,8 +118,8 @@ TYPE_VECTOR4_AXIS = TypeSpec(
|
||||
)
|
||||
TYPE_VECTOR4I_AXIS = TypeSpec(
|
||||
gdapi_type="enum.Vector4i::Axis",
|
||||
c_type="godot_vector4i_axis",
|
||||
cy_type="godot_vector4i_axis",
|
||||
c_type="pandemonium_vector4i_axis",
|
||||
cy_type="pandemonium_vector4i_axis",
|
||||
py_type="Vector4i.Axis",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -136,8 +136,8 @@ TYPE_PROJECTION_PLANES = TypeSpec(
|
||||
)
|
||||
TYPE_VARIANT_TYPE = TypeSpec(
|
||||
gdapi_type="enum.Variant::Type",
|
||||
c_type="godot_variant_type",
|
||||
cy_type="godot_variant_type",
|
||||
c_type="pandemonium_variant_type",
|
||||
cy_type="pandemonium_variant_type",
|
||||
py_type="VariantType",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -145,8 +145,8 @@ TYPE_VARIANT_TYPE = TypeSpec(
|
||||
)
|
||||
TYPE_VARIANT_OPERATOR = TypeSpec(
|
||||
gdapi_type="enum.Variant::Operator",
|
||||
c_type="godot_variant_operator",
|
||||
cy_type="godot_variant_operator",
|
||||
c_type="pandemonium_variant_operator",
|
||||
cy_type="pandemonium_variant_operator",
|
||||
py_type="VariantOperator",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
@ -155,11 +155,11 @@ TYPE_VARIANT_OPERATOR = TypeSpec(
|
||||
|
||||
# Stack&heap types
|
||||
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(
|
||||
gdapi_type="String",
|
||||
c_type="godot_string",
|
||||
c_type="pandemonium_string",
|
||||
cy_type="GDString",
|
||||
py_type="Union[str, GDString]",
|
||||
is_builtin=True,
|
||||
@ -167,27 +167,27 @@ TYPE_STRING = TypeSpec(
|
||||
|
||||
# Stack only types
|
||||
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(
|
||||
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(
|
||||
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(
|
||||
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(
|
||||
gdapi_type="Dictionary",
|
||||
c_type="godot_dictionary",
|
||||
c_type="pandemonium_dictionary",
|
||||
cy_type="Dictionary",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_NODEPATH = TypeSpec(
|
||||
gdapi_type="NodePath",
|
||||
c_type="godot_node_path",
|
||||
c_type="pandemonium_node_path",
|
||||
cy_type="NodePath",
|
||||
py_type="Union[str, NodePath]",
|
||||
is_builtin=True,
|
||||
@ -195,163 +195,163 @@ TYPE_NODEPATH = TypeSpec(
|
||||
)
|
||||
TYPE_STRING_NAME = TypeSpec(
|
||||
gdapi_type="StringName",
|
||||
c_type="godot_string_name",
|
||||
c_type="pandemonium_string_name",
|
||||
cy_type="StringName",
|
||||
py_type="Union[str, StringName]",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
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(
|
||||
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(
|
||||
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(
|
||||
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(
|
||||
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(
|
||||
gdapi_type="Transform",
|
||||
c_type="godot_transform",
|
||||
c_type="pandemonium_transform",
|
||||
cy_type="Transform",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_TRANSFORM2D = TypeSpec(
|
||||
gdapi_type="Transform2D",
|
||||
c_type="godot_transform2d",
|
||||
c_type="pandemonium_transform2d",
|
||||
cy_type="Transform2D",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_PROJECTION = TypeSpec(
|
||||
gdapi_type="Projection",
|
||||
c_type="godot_projection",
|
||||
c_type="pandemonium_projection",
|
||||
cy_type="Projection",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_VECTOR2 = TypeSpec(
|
||||
gdapi_type="Vector2",
|
||||
c_type="godot_vector2",
|
||||
c_type="pandemonium_vector2",
|
||||
cy_type="Vector2",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_VECTOR2I = TypeSpec(
|
||||
gdapi_type="Vector2i",
|
||||
c_type="godot_vector2i",
|
||||
c_type="pandemonium_vector2i",
|
||||
cy_type="Vector2i",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_VECTOR3 = TypeSpec(
|
||||
gdapi_type="Vector3",
|
||||
c_type="godot_vector3",
|
||||
c_type="pandemonium_vector3",
|
||||
cy_type="Vector3",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_VECTOR3I = TypeSpec(
|
||||
gdapi_type="Vector3i",
|
||||
c_type="godot_vector3i",
|
||||
c_type="pandemonium_vector3i",
|
||||
cy_type="Vector3i",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_VECTOR4 = TypeSpec(
|
||||
gdapi_type="Vector4",
|
||||
c_type="godot_vector4",
|
||||
c_type="pandemonium_vector4",
|
||||
cy_type="Vector4",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_VECTOR4I = TypeSpec(
|
||||
gdapi_type="Vector4i",
|
||||
c_type="godot_vector4i",
|
||||
c_type="pandemonium_vector4i",
|
||||
cy_type="Vector4i",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLBYTEARRAY = TypeSpec(
|
||||
gdapi_type="PoolByteArray",
|
||||
c_type="godot_pool_byte_array",
|
||||
c_type="pandemonium_pool_byte_array",
|
||||
cy_type="PoolByteArray",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLINTARRAY = TypeSpec(
|
||||
gdapi_type="PoolIntArray",
|
||||
c_type="godot_pool_int_array",
|
||||
c_type="pandemonium_pool_int_array",
|
||||
cy_type="PoolIntArray",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLREALARRAY = TypeSpec(
|
||||
gdapi_type="PoolRealArray",
|
||||
c_type="godot_pool_real_array",
|
||||
c_type="pandemonium_pool_real_array",
|
||||
cy_type="PoolRealArray",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLSTRINGARRAY = TypeSpec(
|
||||
gdapi_type="PoolStringArray",
|
||||
c_type="godot_pool_string_array",
|
||||
c_type="pandemonium_pool_string_array",
|
||||
cy_type="PoolStringArray",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLVECTOR2ARRAY = TypeSpec(
|
||||
gdapi_type="PoolVector2Array",
|
||||
c_type="godot_pool_vector2_array",
|
||||
c_type="pandemonium_pool_vector2_array",
|
||||
cy_type="PoolVector2Array",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLVECTOR2IARRAY = TypeSpec(
|
||||
gdapi_type="PoolVector2iArray",
|
||||
c_type="godot_pool_vector2i_array",
|
||||
c_type="pandemonium_pool_vector2i_array",
|
||||
cy_type="PoolVector2iArray",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLVECTOR3ARRAY = TypeSpec(
|
||||
gdapi_type="PoolVector3Array",
|
||||
c_type="godot_pool_vector3_array",
|
||||
c_type="pandemonium_pool_vector3_array",
|
||||
cy_type="PoolVector3Array",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLVECTOR3IARRAY = TypeSpec(
|
||||
gdapi_type="PoolVector3iArray",
|
||||
c_type="godot_pool_vector3i_array",
|
||||
c_type="pandemonium_pool_vector3i_array",
|
||||
cy_type="PoolVector3iArray",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLVECTOR4ARRAY = TypeSpec(
|
||||
gdapi_type="PoolVector4Array",
|
||||
c_type="godot_pool_vector4_array",
|
||||
c_type="pandemonium_pool_vector4_array",
|
||||
cy_type="PoolVector4Array",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLVECTOR4IARRAY = TypeSpec(
|
||||
gdapi_type="PoolVector4iArray",
|
||||
c_type="godot_pool_vector4i_array",
|
||||
c_type="pandemonium_pool_vector4i_array",
|
||||
cy_type="PoolVector4iArray",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
)
|
||||
TYPE_POOLCOLORARRAY = TypeSpec(
|
||||
gdapi_type="PoolColorArray",
|
||||
c_type="godot_pool_color_array",
|
||||
c_type="pandemonium_pool_color_array",
|
||||
cy_type="PoolColorArray",
|
||||
is_builtin=True,
|
||||
is_stack_only=True,
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
symbol_prefix="pandemonium_"
|
||||
|
||||
[entry]
|
||||
|
||||
|
@ -10,7 +10,7 @@ from SCons.Errors import UserError
|
||||
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}"
|
||||
if extra == "stable":
|
||||
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"
|
||||
|
||||
|
||||
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}"
|
||||
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"])
|
||||
# Platform-dependant variables
|
||||
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_dir" in env
|
||||
assert "DIST_SITE_PACKAGES" in env
|
||||
@ -76,33 +76,33 @@ env.AddMethod(install_as, "InstallAs")
|
||||
### Godot binary (to run tests) ###
|
||||
|
||||
|
||||
if not env["godot_binary"]:
|
||||
godot_download_url = resolve_godot_download_url(
|
||||
*env["godot_binary_download_version"], env["godot_binary_download_platform"]
|
||||
if not env["pandemonium_binary"]:
|
||||
pandemonium_download_url = resolve_pandemonium_download_url(
|
||||
*env["pandemonium_binary_download_version"], env["pandemonium_binary_download_platform"]
|
||||
)
|
||||
godot_binary_name = resolve_godot_binary_name(
|
||||
*env["godot_binary_download_version"], env["godot_binary_download_platform"]
|
||||
pandemonium_binary_name = resolve_pandemonium_binary_name(
|
||||
*env["pandemonium_binary_download_version"], env["pandemonium_binary_download_platform"]
|
||||
)
|
||||
env["godot_binary"] = File(godot_binary_name)
|
||||
godot_binary_zip_path = env.get("godot_binary_download_zip_path", godot_binary_name)
|
||||
env["pandemonium_binary"] = File(pandemonium_binary_name)
|
||||
pandemonium_binary_zip_path = env.get("pandemonium_binary_download_zip_path", pandemonium_binary_name)
|
||||
|
||||
def download_and_extract(target, source, env):
|
||||
try:
|
||||
with urlopen(godot_download_url) as rep:
|
||||
with urlopen(pandemonium_download_url) as rep:
|
||||
zipfile = ZipFile(BytesIO(rep.read()))
|
||||
except HTTPError as exc:
|
||||
# It seems SCons swallows HTTPError, so we have to wrap it
|
||||
raise UserError(exc) from exc
|
||||
if godot_binary_zip_path not in zipfile.namelist():
|
||||
raise UserError(f"Archive doesn't contain {godot_binary_zip_path}")
|
||||
if pandemonium_binary_zip_path not in zipfile.namelist():
|
||||
raise UserError(f"Archive doesn't contain {pandemonium_binary_zip_path}")
|
||||
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":
|
||||
os.chmod(target[0].abspath, 0o755)
|
||||
|
||||
env.Command(
|
||||
env["godot_binary"],
|
||||
env["pandemonium_binary"],
|
||||
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"])
|
||||
|
@ -13,8 +13,8 @@ cpython_build = Dir("cpython_build")
|
||||
|
||||
|
||||
env["bits"] = "64"
|
||||
env["godot_binary_download_platform"] = "osx.64"
|
||||
env["godot_binary_download_zip_path"] = "Godot.app/Contents/MacOS/Godot"
|
||||
env["pandemonium_binary_download_platform"] = "osx.64"
|
||||
env["pandemonium_binary_download_zip_path"] = "Godot.app/Contents/MacOS/Godot"
|
||||
env["cpython_build"] = cpython_build
|
||||
env["cpython_build_dir"] = cpython_build
|
||||
env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/lib/python3.8/site-packages")
|
||||
|
@ -13,7 +13,7 @@ cpython_build = Dir("cpython_build")
|
||||
|
||||
|
||||
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_dir"] = cpython_build
|
||||
env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/Lib/site-packages")
|
||||
|
@ -13,7 +13,7 @@ cpython_build = Dir("cpython_build")
|
||||
|
||||
|
||||
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_dir"] = cpython_build
|
||||
env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/Lib/site-packages")
|
||||
|
@ -14,9 +14,9 @@ cpython_build = Dir("cpython_build")
|
||||
|
||||
env["bits"] = "64"
|
||||
if env["headless"]:
|
||||
env["godot_binary_download_platform"] = "linux_headless.64"
|
||||
env["pandemonium_binary_download_platform"] = "linux_headless.64"
|
||||
else:
|
||||
env["godot_binary_download_platform"] = "x11.64"
|
||||
env["pandemonium_binary_download_platform"] = "x11.64"
|
||||
env["cpython_build"] = cpython_build
|
||||
env["cpython_build_dir"] = cpython_build
|
||||
env["DIST_SITE_PACKAGES"] = Dir(f"{env['DIST_PLATFORM']}/lib/python3.8/site-packages")
|
||||
|
@ -32,17 +32,17 @@ env.AppendUnique(CYTHON_COMPILE_DEPS=[libpythonscript])
|
||||
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
|
||||
*mods, _ = env.CythonModule(
|
||||
["_godot", "_godot_api.h"],
|
||||
["_godot", "_pandemonium_api.h"],
|
||||
[
|
||||
"_godot.pyx",
|
||||
"_godot_editor.pxi",
|
||||
"_godot_instance.pxi",
|
||||
"_godot_profiling.pxi",
|
||||
"_godot_script.pxi",
|
||||
"_godot_io.pxi",
|
||||
"_pandemonium_editor.pxi",
|
||||
"_pandemonium_instance.pxi",
|
||||
"_pandemonium_profiling.pxi",
|
||||
"_pandemonium_script.pxi",
|
||||
"_pandemonium_io.pxi",
|
||||
],
|
||||
)
|
||||
env.Install("$DIST_SITE_PACKAGES", mods)
|
||||
|
@ -5,15 +5,15 @@
|
||||
# only expose C functions.
|
||||
# Beside this module depend on the `godot.hazmat` module so it would be a bad
|
||||
# idea to make the `godot` module depend on it...
|
||||
include "_godot_editor.pxi"
|
||||
include "_godot_profiling.pxi"
|
||||
include "_godot_script.pxi"
|
||||
include "_godot_instance.pxi"
|
||||
include "_godot_io.pxi"
|
||||
include "_pandemonium_editor.pxi"
|
||||
include "_pandemonium_profiling.pxi"
|
||||
include "_pandemonium_script.pxi"
|
||||
include "_pandemonium_instance.pxi"
|
||||
include "_pandemonium_io.pxi"
|
||||
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_gdnative_init_options,
|
||||
godot_pluginscript_language_data,
|
||||
pandemonium_gdnative_init_options,
|
||||
pandemonium_pluginscript_language_data,
|
||||
)
|
||||
from godot._hazmat.internal cimport set_pythonscript_verbose, get_pythonscript_verbose
|
||||
from godot.builtins cimport GDString
|
||||
@ -35,7 +35,7 @@ def _setup_config_entry(name, default_value):
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
# 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).
|
||||
pass
|
||||
|
@ -3,35 +3,35 @@
|
||||
from libc.stddef cimport wchar_t
|
||||
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_pluginscript_language_data,
|
||||
godot_string,
|
||||
godot_bool,
|
||||
godot_array,
|
||||
godot_pool_string_array,
|
||||
godot_object,
|
||||
godot_variant,
|
||||
godot_error,
|
||||
godot_dictionary
|
||||
pandemonium_pluginscript_language_data,
|
||||
pandemonium_string,
|
||||
pandemonium_bool,
|
||||
pandemonium_array,
|
||||
pandemonium_pool_string_array,
|
||||
pandemonium_object,
|
||||
pandemonium_variant,
|
||||
pandemonium_error,
|
||||
pandemonium_dictionary
|
||||
)
|
||||
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
|
||||
from godot._hazmat.conversion cimport (
|
||||
godot_string_to_pyobj,
|
||||
pyobj_to_godot_string,
|
||||
godot_variant_to_pyobj,
|
||||
pandemonium_string_to_pyobj,
|
||||
pyobj_to_pandemonium_string,
|
||||
pandemonium_variant_to_pyobj,
|
||||
)
|
||||
|
||||
|
||||
cdef api godot_string pythonscript_get_template_source_code(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
const godot_string *p_class_name,
|
||||
const godot_string *p_base_class_name
|
||||
cdef api pandemonium_string pythonscript_get_template_source_code(
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
const pandemonium_string *p_class_name,
|
||||
const pandemonium_string *p_base_class_name
|
||||
) with gil:
|
||||
cdef str class_name
|
||||
if p_class_name == NULL:
|
||||
class_name = "MyExportedCls"
|
||||
else:
|
||||
class_name = godot_string_to_pyobj(p_class_name)
|
||||
cdef str base_class_name = godot_string_to_pyobj(p_base_class_name)
|
||||
class_name = pandemonium_string_to_pyobj(p_class_name)
|
||||
cdef str base_class_name = pandemonium_string_to_pyobj(p_base_class_name)
|
||||
cdef str src = f"""from godot import exposed, export
|
||||
from godot import *
|
||||
|
||||
@ -50,73 +50,73 @@ class {class_name}({base_class_name}):
|
||||
\"\"\"
|
||||
pass
|
||||
"""
|
||||
cdef godot_string ret
|
||||
pyobj_to_godot_string(src, &ret)
|
||||
cdef pandemonium_string ret
|
||||
pyobj_to_pandemonium_string(src, &ret)
|
||||
return ret
|
||||
|
||||
|
||||
cdef api godot_bool pythonscript_validate(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
const godot_string *p_script,
|
||||
cdef api pandemonium_bool pythonscript_validate(
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
const pandemonium_string *p_script,
|
||||
int *r_line_error,
|
||||
int *r_col_error,
|
||||
godot_string *r_test_error,
|
||||
const godot_string *p_path,
|
||||
godot_pool_string_array *r_functions
|
||||
pandemonium_string *r_test_error,
|
||||
const pandemonium_string *p_path,
|
||||
pandemonium_pool_string_array *r_functions
|
||||
) with gil:
|
||||
return True
|
||||
|
||||
|
||||
cdef api int pythonscript_find_function(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
const godot_string *p_function,
|
||||
const godot_string *p_code
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
const pandemonium_string *p_function,
|
||||
const pandemonium_string *p_code
|
||||
) with gil:
|
||||
return 0
|
||||
|
||||
|
||||
cdef api godot_string pythonscript_make_function(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
const godot_string *p_class,
|
||||
const godot_string *p_name,
|
||||
const godot_pool_string_array *p_args
|
||||
cdef api pandemonium_string pythonscript_make_function(
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
const pandemonium_string *p_class,
|
||||
const pandemonium_string *p_name,
|
||||
const pandemonium_pool_string_array *p_args
|
||||
) 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
|
||||
cdef int i
|
||||
cdef godot_string gdarg
|
||||
cdef pandemonium_string gdarg
|
||||
cdef list args_names = []
|
||||
for i in range(gdapi10.godot_pool_string_array_size(p_args)):
|
||||
gdarg = gdapi10.godot_pool_string_array_get(p_args, i)
|
||||
arg = godot_string_to_pyobj(&gdarg)
|
||||
gdapi10.godot_string_destroy(&gdarg)
|
||||
for i in range(gdapi10.pandemonium_pool_string_array_size(p_args)):
|
||||
gdarg = gdapi10.pandemonium_pool_string_array_get(p_args, i)
|
||||
arg = pandemonium_string_to_pyobj(&gdarg)
|
||||
gdapi10.pandemonium_string_destroy(&gdarg)
|
||||
args_names.append(arg.split(":", 1)[0])
|
||||
|
||||
cdef str src = """\
|
||||
def {name}(self, { ','.join(args_names) }):
|
||||
pass
|
||||
"""
|
||||
cdef godot_string ret
|
||||
pyobj_to_godot_string(src, &ret)
|
||||
cdef pandemonium_string ret
|
||||
pyobj_to_pandemonium_string(src, &ret)
|
||||
return ret
|
||||
|
||||
|
||||
cdef api godot_error pythonscript_complete_code(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
const godot_string *p_code,
|
||||
const godot_string *p_base_path,
|
||||
godot_object *p_owner,
|
||||
godot_array *r_options,
|
||||
godot_bool *r_force,
|
||||
godot_string *r_call_hint
|
||||
cdef api pandemonium_error pythonscript_complete_code(
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
const pandemonium_string *p_code,
|
||||
const pandemonium_string *p_base_path,
|
||||
pandemonium_object *p_owner,
|
||||
pandemonium_array *r_options,
|
||||
pandemonium_bool *r_force,
|
||||
pandemonium_string *r_call_hint
|
||||
) with gil:
|
||||
return godot_error.GODOT_OK
|
||||
return pandemonium_error.GODOT_OK
|
||||
|
||||
|
||||
cdef api void pythonscript_auto_indent_code(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
godot_string *p_code,
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
pandemonium_string *p_code,
|
||||
int p_from_line,
|
||||
int p_to_line
|
||||
) with gil:
|
||||
@ -128,16 +128,16 @@ cdef api void pythonscript_auto_indent_code(
|
||||
# "[Pythonscript] Auto indent requires module `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])
|
||||
# to_fix = "\n".join(pycode[from_line:to_line])
|
||||
# after = "\n".join(pycode[to_line:])
|
||||
# fixed = autopep8.fix_code(to_fix)
|
||||
# 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
|
||||
# lib.godot_string_destroy(code)
|
||||
# lib.godot_string_new_unicode_data(code, final_code, len(final_code))
|
||||
# lib.pandemonium_string_destroy(code)
|
||||
# lib.pandemonium_string_new_unicode_data(code, final_code, len(final_code))
|
||||
pass
|
||||
|
||||
|
||||
@ -145,64 +145,64 @@ __global_constants = {}
|
||||
|
||||
|
||||
cdef api void pythonscript_add_global_constant(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
const godot_string *p_variable,
|
||||
const godot_variant *p_value
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
const pandemonium_string *p_variable,
|
||||
const pandemonium_variant *p_value
|
||||
) with gil:
|
||||
# However, Godot add global constants very early (first as an empty variant
|
||||
# placeholder before any script is loaded, then as a proper loaded script).
|
||||
# So it's possible this function get called before `pythonscript_script_init`
|
||||
# (which is supposed to do the lazy `_initialize_bindings`).
|
||||
_initialize_bindings()
|
||||
name = godot_string_to_pyobj(p_variable)
|
||||
value = godot_variant_to_pyobj(p_value)
|
||||
name = pandemonium_string_to_pyobj(p_variable)
|
||||
value = pandemonium_variant_to_pyobj(p_value)
|
||||
__global_constants[name] = value
|
||||
|
||||
|
||||
cdef api godot_string pythonscript_debug_get_error(
|
||||
godot_pluginscript_language_data *p_data
|
||||
cdef api pandemonium_string pythonscript_debug_get_error(
|
||||
pandemonium_pluginscript_language_data *p_data
|
||||
) with gil:
|
||||
cdef godot_string ret
|
||||
pyobj_to_godot_string("Nothing", &ret)
|
||||
cdef pandemonium_string ret
|
||||
pyobj_to_pandemonium_string("Nothing", &ret)
|
||||
return ret
|
||||
|
||||
|
||||
cdef api int pythonscript_debug_get_stack_level_count(
|
||||
godot_pluginscript_language_data *p_data
|
||||
pandemonium_pluginscript_language_data *p_data
|
||||
) with gil:
|
||||
return 1
|
||||
|
||||
|
||||
cdef api int pythonscript_debug_get_stack_level_line(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
int p_level
|
||||
) with gil:
|
||||
return 1
|
||||
|
||||
|
||||
cdef api godot_string pythonscript_debug_get_stack_level_function(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
cdef api pandemonium_string pythonscript_debug_get_stack_level_function(
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
int p_level
|
||||
) with gil:
|
||||
cdef godot_string ret
|
||||
pyobj_to_godot_string("Nothing", &ret)
|
||||
cdef pandemonium_string ret
|
||||
pyobj_to_pandemonium_string("Nothing", &ret)
|
||||
return ret
|
||||
|
||||
|
||||
cdef api godot_string pythonscript_debug_get_stack_level_source(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
cdef api pandemonium_string pythonscript_debug_get_stack_level_source(
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
int p_level
|
||||
) with gil:
|
||||
cdef godot_string ret
|
||||
pyobj_to_godot_string("Nothing", &ret)
|
||||
cdef pandemonium_string ret
|
||||
pyobj_to_pandemonium_string("Nothing", &ret)
|
||||
return ret
|
||||
|
||||
|
||||
cdef api void pythonscript_debug_get_stack_level_locals(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
int p_level,
|
||||
godot_pool_string_array *p_locals,
|
||||
godot_array *p_values,
|
||||
pandemonium_pool_string_array *p_locals,
|
||||
pandemonium_array *p_values,
|
||||
int p_max_subitems,
|
||||
int p_max_depth
|
||||
) with gil:
|
||||
@ -210,10 +210,10 @@ cdef api void pythonscript_debug_get_stack_level_locals(
|
||||
|
||||
|
||||
cdef api void pythonscript_debug_get_stack_level_members(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
int p_level,
|
||||
godot_pool_string_array *p_members,
|
||||
godot_array *p_values,
|
||||
pandemonium_pool_string_array *p_members,
|
||||
pandemonium_array *p_values,
|
||||
int p_max_subitems,
|
||||
int p_max_depth
|
||||
) with gil:
|
||||
@ -221,36 +221,36 @@ cdef api void pythonscript_debug_get_stack_level_members(
|
||||
|
||||
|
||||
cdef api void pythonscript_debug_get_globals(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
godot_pool_string_array *p_locals,
|
||||
godot_array *p_values,
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
pandemonium_pool_string_array *p_locals,
|
||||
pandemonium_array *p_values,
|
||||
int p_max_subitems,
|
||||
int p_max_depth
|
||||
) with gil:
|
||||
pass
|
||||
|
||||
|
||||
cdef api godot_string pythonscript_debug_parse_stack_level_expression(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
cdef api pandemonium_string pythonscript_debug_parse_stack_level_expression(
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
int p_level,
|
||||
const godot_string *p_expression,
|
||||
const pandemonium_string *p_expression,
|
||||
int p_max_subitems,
|
||||
int p_max_depth
|
||||
) with gil:
|
||||
cdef godot_string ret
|
||||
pyobj_to_godot_string("Nothing", &ret)
|
||||
cdef pandemonium_string ret
|
||||
pyobj_to_pandemonium_string("Nothing", &ret)
|
||||
return ret
|
||||
|
||||
|
||||
cdef api void pythonscript_get_public_functions(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
godot_array *r_functions
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
pandemonium_array *r_functions
|
||||
) with gil:
|
||||
pass
|
||||
|
||||
|
||||
cdef api void pythonscript_get_public_constants(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
godot_dictionary *r_constants
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
pandemonium_dictionary *r_constants
|
||||
) with gil:
|
||||
pass
|
||||
|
@ -4,31 +4,31 @@ from libc.stddef cimport wchar_t
|
||||
from cpython cimport Py_INCREF, Py_DECREF, PyObject
|
||||
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_string,
|
||||
godot_string_name,
|
||||
godot_bool,
|
||||
godot_array,
|
||||
godot_pool_string_array,
|
||||
godot_object,
|
||||
godot_variant,
|
||||
godot_variant_call_error,
|
||||
godot_method_rpc_mode,
|
||||
godot_pluginscript_script_data,
|
||||
godot_pluginscript_instance_data,
|
||||
godot_variant_call_error_error,
|
||||
godot_variant_type,
|
||||
pandemonium_string,
|
||||
pandemonium_string_name,
|
||||
pandemonium_bool,
|
||||
pandemonium_array,
|
||||
pandemonium_pool_string_array,
|
||||
pandemonium_object,
|
||||
pandemonium_variant,
|
||||
pandemonium_variant_call_error,
|
||||
pandemonium_method_rpc_mode,
|
||||
pandemonium_pluginscript_script_data,
|
||||
pandemonium_pluginscript_instance_data,
|
||||
pandemonium_variant_call_error_error,
|
||||
pandemonium_variant_type,
|
||||
)
|
||||
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
|
||||
from godot._hazmat.conversion cimport (
|
||||
godot_variant_to_pyobj,
|
||||
pyobj_to_godot_variant,
|
||||
godot_string_name_to_pyobj,
|
||||
pandemonium_variant_to_pyobj,
|
||||
pyobj_to_pandemonium_variant,
|
||||
pandemonium_string_name_to_pyobj,
|
||||
)
|
||||
|
||||
|
||||
cdef api godot_pluginscript_instance_data* pythonscript_instance_init(
|
||||
godot_pluginscript_script_data *p_data,
|
||||
godot_object *p_owner
|
||||
cdef api pandemonium_pluginscript_instance_data* pythonscript_instance_init(
|
||||
pandemonium_pluginscript_script_data *p_data,
|
||||
pandemonium_object *p_owner
|
||||
) with gil:
|
||||
cdef object instance = (<object>p_data)()
|
||||
(<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(
|
||||
godot_pluginscript_instance_data *p_data
|
||||
pandemonium_pluginscript_instance_data *p_data
|
||||
) with gil:
|
||||
Py_DECREF(<object>p_data)
|
||||
|
||||
|
||||
cdef api godot_bool pythonscript_instance_set_prop(
|
||||
godot_pluginscript_instance_data *p_data,
|
||||
const godot_string *p_name,
|
||||
const godot_variant *p_value
|
||||
cdef api pandemonium_bool pythonscript_instance_set_prop(
|
||||
pandemonium_pluginscript_instance_data *p_data,
|
||||
const pandemonium_string *p_name,
|
||||
const pandemonium_variant *p_value
|
||||
) with gil:
|
||||
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,
|
||||
# not Godot native properties that are handled by the caller
|
||||
@ -60,22 +60,22 @@ cdef api godot_bool pythonscript_instance_set_prop(
|
||||
return False
|
||||
|
||||
try:
|
||||
setattr(instance, key, godot_variant_to_pyobj(p_value))
|
||||
setattr(instance, key, pandemonium_variant_to_pyobj(p_value))
|
||||
return True
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
|
||||
cdef api godot_bool pythonscript_instance_get_prop(
|
||||
godot_pluginscript_instance_data *p_data,
|
||||
const godot_string *p_name,
|
||||
godot_variant *r_ret
|
||||
cdef api pandemonium_bool pythonscript_instance_get_prop(
|
||||
pandemonium_pluginscript_instance_data *p_data,
|
||||
const pandemonium_string *p_name,
|
||||
pandemonium_variant *r_ret
|
||||
) with gil:
|
||||
cdef object instance = <object>p_data
|
||||
cdef object ret
|
||||
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,
|
||||
# not Godot native properties that are handled by the caller
|
||||
@ -86,8 +86,8 @@ cdef api godot_bool pythonscript_instance_get_prop(
|
||||
|
||||
try:
|
||||
if isinstance(field, ExportedField):
|
||||
ret = getattr(instance, godot_string_to_pyobj(p_name))
|
||||
pyobj_to_godot_variant(ret, r_ret)
|
||||
ret = getattr(instance, pandemonium_string_to_pyobj(p_name))
|
||||
pyobj_to_pandemonium_variant(ret, r_ret)
|
||||
elif isinstance(field, SignalField):
|
||||
# TODO: Not sure how to create a Variant::Signal from GDNative
|
||||
return False
|
||||
@ -101,57 +101,57 @@ cdef api godot_bool pythonscript_instance_get_prop(
|
||||
return False
|
||||
|
||||
|
||||
cdef api godot_variant pythonscript_instance_call_method(
|
||||
godot_pluginscript_instance_data *p_data,
|
||||
const godot_string_name *p_method,
|
||||
const godot_variant **p_args,
|
||||
cdef api pandemonium_variant pythonscript_instance_call_method(
|
||||
pandemonium_pluginscript_instance_data *p_data,
|
||||
const pandemonium_string_name *p_method,
|
||||
const pandemonium_variant **p_args,
|
||||
int p_argcount,
|
||||
godot_variant_call_error *r_error
|
||||
pandemonium_variant_call_error *r_error
|
||||
) with gil:
|
||||
cdef godot_variant var_ret
|
||||
cdef pandemonium_variant var_ret
|
||||
cdef object instance = <object>p_data
|
||||
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)
|
||||
if not callable(fn):
|
||||
r_error.error = godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD
|
||||
gdapi10.godot_variant_new_nil(&var_ret)
|
||||
r_error.error = pandemonium_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD
|
||||
gdapi10.pandemonium_variant_new_nil(&var_ret)
|
||||
return var_ret
|
||||
|
||||
cdef int i
|
||||
cdef list pyargs
|
||||
cdef object ret
|
||||
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)
|
||||
r_error.error = godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_OK
|
||||
pyobj_to_godot_variant(ret, &var_ret)
|
||||
r_error.error = pandemonium_variant_call_error_error.GODOT_CALL_ERROR_CALL_OK
|
||||
pyobj_to_pandemonium_variant(ret, &var_ret)
|
||||
return var_ret
|
||||
|
||||
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:
|
||||
traceback.print_exc()
|
||||
# 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.expected = godot_variant_type.GODOT_VARIANT_TYPE_NIL
|
||||
r_error.expected = pandemonium_variant_type.GODOT_VARIANT_TYPE_NIL
|
||||
except Exception:
|
||||
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 ?
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
cdef api void pythonscript_instance_notification(
|
||||
godot_pluginscript_instance_data *p_data,
|
||||
pandemonium_pluginscript_instance_data *p_data,
|
||||
int p_notification
|
||||
) with gil:
|
||||
cdef object instance = <object>p_data
|
||||
@ -170,12 +170,12 @@ cdef api void pythonscript_instance_notification(
|
||||
# Useful ?
|
||||
|
||||
# cdef api void pythonscript_instance_refcount_incremented(
|
||||
# godot_pluginscript_instance_data *p_data
|
||||
# pandemonium_pluginscript_instance_data *p_data
|
||||
# ) with gil:
|
||||
# pass
|
||||
|
||||
|
||||
# cdef api bool pythonscript_instance_refcount_decremented(
|
||||
# godot_pluginscript_instance_data *p_data
|
||||
# pandemonium_pluginscript_instance_data *p_data
|
||||
# ) with gil:
|
||||
# pass
|
||||
|
@ -5,33 +5,33 @@ from io import TextIOBase
|
||||
from threading import Lock
|
||||
|
||||
from godot._hazmat.conversion cimport (
|
||||
godot_string_to_pyobj,
|
||||
pyobj_to_godot_string,
|
||||
godot_variant_to_pyobj,
|
||||
pandemonium_string_to_pyobj,
|
||||
pyobj_to_pandemonium_string,
|
||||
pandemonium_variant_to_pyobj,
|
||||
)
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_string,
|
||||
godot_string_name,
|
||||
godot_bool,
|
||||
godot_array,
|
||||
godot_pool_string_array,
|
||||
godot_object,
|
||||
godot_variant,
|
||||
godot_variant_call_error,
|
||||
godot_method_rpc_mode,
|
||||
godot_pluginscript_script_data,
|
||||
godot_pluginscript_instance_data,
|
||||
godot_variant_call_error_error,
|
||||
godot_variant_type
|
||||
pandemonium_string,
|
||||
pandemonium_string_name,
|
||||
pandemonium_bool,
|
||||
pandemonium_array,
|
||||
pandemonium_pool_string_array,
|
||||
pandemonium_object,
|
||||
pandemonium_variant,
|
||||
pandemonium_variant_call_error,
|
||||
pandemonium_method_rpc_mode,
|
||||
pandemonium_pluginscript_script_data,
|
||||
pandemonium_pluginscript_instance_data,
|
||||
pandemonium_variant_call_error_error,
|
||||
pandemonium_variant_type
|
||||
)
|
||||
|
||||
|
||||
cpdef inline void godot_print(str pystr):
|
||||
cdef godot_string gdstr
|
||||
pyobj_to_godot_string(pystr, &gdstr)
|
||||
cpdef inline void pandemonium_print(str pystr):
|
||||
cdef pandemonium_string gdstr
|
||||
pyobj_to_pandemonium_string(pystr, &gdstr)
|
||||
with nogil:
|
||||
gdapi10.godot_print(&gdstr)
|
||||
gdapi10.godot_string_destroy(&gdstr)
|
||||
gdapi10.pandemonium_print(&gdstr)
|
||||
gdapi10.pandemonium_string_destroy(&gdstr)
|
||||
|
||||
|
||||
class StdinCapture(TextIOBase):
|
||||
@ -112,11 +112,11 @@ class StdoutStderrCaptureToGodot(StdoutStderrCapture):
|
||||
self.buffer = ""
|
||||
|
||||
def _write(self, buff):
|
||||
cdef godot_string gdstr
|
||||
pyobj_to_godot_string(buff, &gdstr)
|
||||
cdef pandemonium_string gdstr
|
||||
pyobj_to_pandemonium_string(buff, &gdstr)
|
||||
with nogil:
|
||||
gdapi10.godot_print(&gdstr)
|
||||
gdapi10.godot_string_destroy(&gdstr)
|
||||
gdapi10.pandemonium_print(&gdstr)
|
||||
gdapi10.pandemonium_string_destroy(&gdstr)
|
||||
|
||||
|
||||
cdef _capture_io_streams = None
|
||||
|
@ -1,8 +1,8 @@
|
||||
# cython: c_string_type=unicode, c_string_encoding=utf8
|
||||
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_pluginscript_language_data,
|
||||
godot_pluginscript_profiling_data,
|
||||
pandemonium_pluginscript_language_data,
|
||||
pandemonium_pluginscript_profiling_data,
|
||||
)
|
||||
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
|
||||
|
||||
@ -11,7 +11,7 @@ from collections import defaultdict
|
||||
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:
|
||||
@ -134,7 +134,7 @@ cdef object profiler = None
|
||||
|
||||
|
||||
cdef api void pythonscript_profiling_start(
|
||||
godot_pluginscript_language_data *p_data
|
||||
pandemonium_pluginscript_language_data *p_data
|
||||
) with gil:
|
||||
global profiler
|
||||
profiler = Profiler()
|
||||
@ -142,7 +142,7 @@ cdef api void pythonscript_profiling_start(
|
||||
|
||||
|
||||
cdef api void pythonscript_profiling_stop(
|
||||
godot_pluginscript_language_data *p_data
|
||||
pandemonium_pluginscript_language_data *p_data
|
||||
) with gil:
|
||||
global profiler
|
||||
profiler = None
|
||||
@ -150,8 +150,8 @@ cdef api void pythonscript_profiling_stop(
|
||||
|
||||
|
||||
cdef api int pythonscript_profiling_get_accumulated_data(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
godot_pluginscript_profiling_data *r_info,
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
pandemonium_pluginscript_profiling_data *r_info,
|
||||
int p_info_max
|
||||
) with gil:
|
||||
# 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 profile
|
||||
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].total_time = int(profile.total_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(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
godot_pluginscript_profiling_data *r_info,
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
pandemonium_pluginscript_profiling_data *r_info,
|
||||
int p_info_max
|
||||
) with gil:
|
||||
# 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 profile
|
||||
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].total_time = int(profile.last_frame_total_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(
|
||||
godot_pluginscript_language_data *p_data
|
||||
pandemonium_pluginscript_language_data *p_data
|
||||
) with gil:
|
||||
if profiler is not None:
|
||||
profiler.next_frame()
|
||||
|
@ -5,17 +5,17 @@ import importlib
|
||||
from cpython.ref cimport PyObject
|
||||
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_pluginscript_language_data,
|
||||
godot_string,
|
||||
godot_bool,
|
||||
godot_array,
|
||||
godot_pool_string_array,
|
||||
godot_object,
|
||||
godot_variant,
|
||||
godot_error,
|
||||
godot_string_name,
|
||||
godot_pluginscript_script_data,
|
||||
godot_pluginscript_script_manifest,
|
||||
pandemonium_pluginscript_language_data,
|
||||
pandemonium_string,
|
||||
pandemonium_bool,
|
||||
pandemonium_array,
|
||||
pandemonium_pool_string_array,
|
||||
pandemonium_object,
|
||||
pandemonium_variant,
|
||||
pandemonium_error,
|
||||
pandemonium_string_name,
|
||||
pandemonium_pluginscript_script_data,
|
||||
pandemonium_pluginscript_script_manifest,
|
||||
GODOT_OK,
|
||||
GODOT_ERR_UNAVAILABLE,
|
||||
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.conversion cimport (
|
||||
godot_string_to_pyobj,
|
||||
pyobj_to_godot_string,
|
||||
pyobj_to_godot_string_name,
|
||||
pytype_to_godot_type,
|
||||
pandemonium_string_to_pyobj,
|
||||
pyobj_to_pandemonium_string,
|
||||
pyobj_to_pandemonium_string_name,
|
||||
pytype_to_pandemonium_type,
|
||||
)
|
||||
from godot._hazmat.internal cimport (
|
||||
get_pythonscript_verbose,
|
||||
@ -45,16 +45,16 @@ import traceback
|
||||
from godot.tags import ExportedField, SignalField
|
||||
|
||||
|
||||
cdef inline godot_pluginscript_script_manifest _build_empty_script_manifest():
|
||||
cdef godot_pluginscript_script_manifest manifest
|
||||
cdef inline pandemonium_pluginscript_script_manifest _build_empty_script_manifest():
|
||||
cdef pandemonium_pluginscript_script_manifest manifest
|
||||
manifest.data = NULL
|
||||
gdapi10.godot_string_name_new_data(&manifest.name, "")
|
||||
gdapi10.pandemonium_string_name_new_data(&manifest.name, "")
|
||||
manifest.is_tool = False
|
||||
gdapi10.godot_string_name_new_data(&manifest.base, "")
|
||||
gdapi10.godot_dictionary_new(&manifest.member_lines)
|
||||
gdapi10.godot_array_new(&manifest.methods)
|
||||
gdapi10.godot_array_new(&manifest.signals)
|
||||
gdapi10.godot_array_new(&manifest.properties)
|
||||
gdapi10.pandemonium_string_name_new_data(&manifest.base, "")
|
||||
gdapi10.pandemonium_dictionary_new(&manifest.member_lines)
|
||||
gdapi10.pandemonium_array_new(&manifest.methods)
|
||||
gdapi10.pandemonium_array_new(&manifest.signals)
|
||||
gdapi10.pandemonium_array_new(&manifest.properties)
|
||||
return manifest
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ cdef Dictionary _build_method_info(object meth, object methname):
|
||||
cdef Dictionary _build_property_info(object prop):
|
||||
cdef Dictionary propinfo = Dictionary()
|
||||
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_string"] = prop.hint_string
|
||||
propinfo["usage"] = prop.usage
|
||||
@ -105,26 +105,26 @@ cdef inline object is_method(object meth):
|
||||
|
||||
return False
|
||||
|
||||
cdef godot_pluginscript_script_manifest _build_script_manifest(object cls):
|
||||
cdef godot_pluginscript_script_manifest manifest
|
||||
cdef pandemonium_pluginscript_script_manifest _build_script_manifest(object cls):
|
||||
cdef pandemonium_pluginscript_script_manifest manifest
|
||||
# No need to increase refcount here given `cls` is guaranteed to be kept
|
||||
# until we call `destroy_exposed_class`
|
||||
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
|
||||
gdapi10.godot_dictionary_new(&manifest.member_lines)
|
||||
gdapi10.pandemonium_dictionary_new(&manifest.member_lines)
|
||||
|
||||
if cls.__bases__:
|
||||
# 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))
|
||||
)
|
||||
if not godot_parent_class.__dict__.get("__exposed_python_class"):
|
||||
base = godot_parent_class.__name__
|
||||
if not pandemonium_parent_class.__dict__.get("__exposed_python_class"):
|
||||
base = pandemonium_parent_class.__name__
|
||||
else:
|
||||
# Pluginscript wants us to return the parent as a path
|
||||
base = f"res://{godot_parent_class.__module__.replace('.', '/')}.py"
|
||||
pyobj_to_godot_string_name(base, &manifest.base)
|
||||
base = f"res://{pandemonium_parent_class.__module__.replace('.', '/')}.py"
|
||||
pyobj_to_pandemonium_string_name(base, &manifest.base)
|
||||
|
||||
methods = Array()
|
||||
signals = Array()
|
||||
@ -137,25 +137,25 @@ cdef godot_pluginscript_script_manifest _build_script_manifest(object cls):
|
||||
else:
|
||||
assert is_method(v)
|
||||
methods.append(_build_method_info(v, k))
|
||||
gdapi10.godot_array_new_copy(&manifest.methods, &methods._gd_data)
|
||||
gdapi10.godot_array_new_copy(&manifest.signals, &signals._gd_data)
|
||||
gdapi10.godot_array_new_copy(&manifest.properties, &properties._gd_data)
|
||||
gdapi10.pandemonium_array_new_copy(&manifest.methods, &methods._gd_data)
|
||||
gdapi10.pandemonium_array_new_copy(&manifest.signals, &signals._gd_data)
|
||||
gdapi10.pandemonium_array_new_copy(&manifest.properties, &properties._gd_data)
|
||||
|
||||
return manifest
|
||||
|
||||
|
||||
cdef api godot_pluginscript_script_manifest pythonscript_script_init(
|
||||
godot_pluginscript_language_data *p_data,
|
||||
const godot_string *p_path,
|
||||
const godot_string *p_source,
|
||||
godot_error *r_error
|
||||
cdef api pandemonium_pluginscript_script_manifest pythonscript_script_init(
|
||||
pandemonium_pluginscript_language_data *p_data,
|
||||
const pandemonium_string *p_path,
|
||||
const pandemonium_string *p_source,
|
||||
pandemonium_error *r_error
|
||||
) with gil:
|
||||
# Godot class&singleton are not all available at Pythonscript bootstrap.
|
||||
# Hence we wait until the Pythonscript start being actually used (i.e. until
|
||||
# the first Python script is loaded) before initializing the 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():
|
||||
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(
|
||||
godot_pluginscript_script_data *p_data
|
||||
pandemonium_pluginscript_script_data *p_data
|
||||
) with gil:
|
||||
cdef object cls = <object>p_data
|
||||
if get_pythonscript_verbose():
|
||||
|
@ -25,28 +25,28 @@ env.Install("$DIST_SITE_PACKAGES/godot", env.CythonModule("tags", "tags.pyx"))
|
||||
|
||||
|
||||
# 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"),
|
||||
source=("#/generation/generate_pool_arrays.py",),
|
||||
action="python ${SOURCE} --output ${TARGET}",
|
||||
)
|
||||
env.Depends(
|
||||
godot_pool_arrays_srcs,
|
||||
pandemonium_pool_arrays_srcs,
|
||||
["#/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"),
|
||||
source=("#/generation/generate_builtins.py", "${pandemonium_headers}/gdnative_api.json"),
|
||||
action="python ${SOURCES[0]} --input ${SOURCES[1]} --output ${TARGET}",
|
||||
)
|
||||
env.Depends(
|
||||
godot_builtins_srcs,
|
||||
pandemonium_builtins_srcs,
|
||||
["#/generation/generate_builtins.py", env.Glob("#/generation/builtins_templates/*")],
|
||||
)
|
||||
# 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"))
|
||||
@ -82,14 +82,14 @@ else:
|
||||
bindings_env.AppendUnique(CFLAGS=["/Os"])
|
||||
|
||||
|
||||
godot_bindings_srcs = bindings_env.Command(
|
||||
pandemonium_bindings_srcs = bindings_env.Command(
|
||||
target=("bindings.pyx", "bindings.pxd", "bindings.pyi"),
|
||||
source=("#/generation/generate_bindings.py", "${pandemonium_headers}/api.json"),
|
||||
action=("python ${SOURCES[0]} ${opts} --input ${SOURCES[1]} --output ${TARGET} "),
|
||||
opts="--sample" if sample else "",
|
||||
)
|
||||
bindings_env.Depends(
|
||||
godot_bindings_srcs,
|
||||
pandemonium_bindings_srcs,
|
||||
["#/generation/generate_bindings.py", bindings_env.Glob("#/generation/bindings_templates/*")],
|
||||
)
|
||||
|
||||
|
@ -3,12 +3,12 @@ from libc.stdio cimport printf
|
||||
|
||||
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_string,
|
||||
godot_string_name,
|
||||
godot_int,
|
||||
godot_vector2,
|
||||
godot_variant,
|
||||
godot_variant_type,
|
||||
pandemonium_string,
|
||||
pandemonium_string_name,
|
||||
pandemonium_int,
|
||||
pandemonium_vector2,
|
||||
pandemonium_variant,
|
||||
pandemonium_variant_type,
|
||||
)
|
||||
from godot.builtins cimport GDString, NodePath
|
||||
|
||||
@ -27,15 +27,15 @@ ELSE:
|
||||
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...
|
||||
cdef char *raw = <char*>gdapi10.godot_string_wide_str(p_gdstr)
|
||||
cdef godot_int length = gdapi10.godot_string_length(p_gdstr)
|
||||
cdef char *raw = <char*>gdapi10.pandemonium_string_wide_str(p_gdstr)
|
||||
cdef pandemonium_int length = gdapi10.pandemonium_string_length(p_gdstr)
|
||||
return raw[:length * _STRING_CODEPOINT_LENGTH].decode(_STRING_ENCODING)
|
||||
|
||||
# cdef char *raw = <char*>gdapi10.godot_string_wide_str(p_gdstr)
|
||||
# cdef godot_int length = gdapi10.godot_string_length(p_gdstr)
|
||||
# printf("==========> godot_string_to_pyobj ")
|
||||
# cdef char *raw = <char*>gdapi10.pandemonium_string_wide_str(p_gdstr)
|
||||
# cdef pandemonium_int length = gdapi10.pandemonium_string_length(p_gdstr)
|
||||
# printf("==========> pandemonium_string_to_pyobj ")
|
||||
# cdef int i
|
||||
# for i in range(length):
|
||||
# printf("%c ", raw[i * 4]);
|
||||
@ -45,34 +45,34 @@ cdef inline str godot_string_to_pyobj(const godot_string *p_gdstr):
|
||||
# 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...
|
||||
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)
|
||||
)
|
||||
|
||||
|
||||
cdef inline str godot_string_name_to_pyobj(const godot_string_name *p_gdname):
|
||||
cdef godot_string strname = gdapi10.godot_string_name_get_name(p_gdname)
|
||||
cdef ret = godot_string_to_pyobj(&strname)
|
||||
gdapi10.godot_string_destroy(&strname)
|
||||
cdef inline str pandemonium_string_name_to_pyobj(const pandemonium_string_name *p_gdname):
|
||||
cdef pandemonium_string strname = gdapi10.pandemonium_string_name_get_name(p_gdname)
|
||||
cdef ret = pandemonium_string_to_pyobj(&strname)
|
||||
gdapi10.pandemonium_string_destroy(&strname)
|
||||
return ret
|
||||
|
||||
|
||||
cdef inline void pyobj_to_godot_string_name(str pystr, godot_string_name *p_gdname):
|
||||
cdef godot_string strname
|
||||
pyobj_to_godot_string(pystr, &strname)
|
||||
gdapi10.godot_string_name_new(p_gdname, &strname)
|
||||
gdapi10.godot_string_destroy(&strname)
|
||||
cdef inline void pyobj_to_pandemonium_string_name(str pystr, pandemonium_string_name *p_gdname):
|
||||
cdef pandemonium_string strname
|
||||
pyobj_to_pandemonium_string(pystr, &strname)
|
||||
gdapi10.pandemonium_string_name_new(p_gdname, &strname)
|
||||
gdapi10.pandemonium_string_destroy(&strname)
|
||||
|
||||
|
||||
cdef object godot_variant_to_pyobj(const godot_variant *p_gdvar)
|
||||
cdef bint pyobj_to_godot_variant(object pyobj, godot_variant *p_var)
|
||||
cdef object pandemonium_variant_to_pyobj(const pandemonium_variant *p_gdvar)
|
||||
cdef bint pyobj_to_pandemonium_variant(object pyobj, pandemonium_variant *p_var)
|
||||
|
||||
cdef bint is_pytype_compatible_with_godot_variant(object pytype)
|
||||
cdef object godot_type_to_pytype(godot_variant_type gdtype)
|
||||
cdef godot_variant_type pytype_to_godot_type(object pytype)
|
||||
cdef bint is_pytype_compatible_with_pandemonium_variant(object pytype)
|
||||
cdef object pandemonium_type_to_pytype(pandemonium_variant_type gdtype)
|
||||
cdef pandemonium_variant_type pytype_to_pandemonium_type(object pytype)
|
||||
|
||||
cdef GDString ensure_is_gdstring(object gdstring_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...
|
||||
|
||||
# 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 godot_int start
|
||||
# cdef godot_int stop
|
||||
# cdef godot_int step
|
||||
# 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 pandemonium_int start
|
||||
# cdef pandemonium_int stop
|
||||
# cdef pandemonium_int step
|
||||
|
||||
# step = slice_.step if slice_.step is not None else 1
|
||||
# if step == 0:
|
||||
@ -103,7 +103,7 @@ cdef NodePath ensure_is_nodepath(object nodepath_or_pystr)
|
||||
# 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:
|
||||
# return size - 1
|
||||
# elif start < 0:
|
||||
@ -113,7 +113,7 @@ cdef NodePath ensure_is_nodepath(object nodepath_or_pystr)
|
||||
# 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:
|
||||
# return size
|
||||
# elif stop < -size:
|
||||
@ -123,8 +123,8 @@ cdef NodePath ensure_is_nodepath(object nodepath_or_pystr)
|
||||
# return stop
|
||||
|
||||
|
||||
# cdef inline godot_int cook_slice_get_items(godot_int size, godot_int start, godot_int stop, godot_int step):
|
||||
# cdef godot_int items
|
||||
# cdef inline pandemonium_int cook_slice_get_items(pandemonium_int size, pandemonium_int start, pandemonium_int stop, pandemonium_int step):
|
||||
# cdef pandemonium_int items
|
||||
# if step > 0:
|
||||
# if start >= stop:
|
||||
# return 0
|
||||
|
@ -3,12 +3,12 @@ from libc.stdio cimport printf
|
||||
|
||||
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_string,
|
||||
godot_string_name,
|
||||
godot_int,
|
||||
godot_vector2,
|
||||
godot_variant,
|
||||
godot_variant_type,
|
||||
pandemonium_string,
|
||||
pandemonium_string_name,
|
||||
pandemonium_int,
|
||||
pandemonium_vector2,
|
||||
pandemonium_variant,
|
||||
pandemonium_variant_type,
|
||||
)
|
||||
from godot.bindings cimport Object
|
||||
from godot.builtins cimport (
|
||||
@ -40,56 +40,56 @@ from warnings import warn
|
||||
|
||||
|
||||
GD_PY_TYPES = (
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_NIL, type(None)),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_BOOL, bool),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_INT, int),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_REAL, float),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_STRING, GDString),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_OBJECT, Object),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_VECTOR2, Vector2),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_RECT2, Rect2),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_VECTOR3, Vector3),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D, Transform2D),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_PLANE, Plane),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_QUAT, Quat),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_AABB, AABB),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_BASIS, Basis),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM, Transform),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_COLOR, Color),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_NODE_PATH, NodePath),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_RID, RID),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_DICTIONARY, Dictionary),
|
||||
(godot_variant_type.GODOT_VARIANT_TYPE_ARRAY, Array),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_NIL, type(None)),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_BOOL, bool),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_INT, int),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_REAL, float),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_STRING, GDString),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_OBJECT, Object),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR2, Vector2),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_RECT2, Rect2),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR3, Vector3),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D, Transform2D),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_PLANE, Plane),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_QUAT, Quat),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_AABB, AABB),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_BASIS, Basis),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM, Transform),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_COLOR, Color),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_NODE_PATH, NodePath),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_RID, RID),
|
||||
(pandemonium_variant_type.GODOT_VARIANT_TYPE_DICTIONARY, Dictionary),
|
||||
(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,
|
||||
),
|
||||
(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,
|
||||
),
|
||||
(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,
|
||||
),
|
||||
(
|
||||
godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY,
|
||||
pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY,
|
||||
PoolVector3Array,
|
||||
),
|
||||
(
|
||||
godot_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY,
|
||||
pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY,
|
||||
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))
|
||||
|
||||
|
||||
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)
|
||||
if pytype is None:
|
||||
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
|
||||
|
||||
|
||||
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)
|
||||
if gdtype is None:
|
||||
if issubclass(pytype, Object):
|
||||
return godot_variant_type.GODOT_VARIANT_TYPE_OBJECT
|
||||
return pandemonium_variant_type.GODOT_VARIANT_TYPE_OBJECT
|
||||
else:
|
||||
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
|
||||
|
||||
|
||||
cdef object godot_variant_to_pyobj(const godot_variant *p_gdvar):
|
||||
cdef godot_variant_type gdtype = gdapi10.godot_variant_get_type(p_gdvar)
|
||||
cdef object pandemonium_variant_to_pyobj(const pandemonium_variant *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
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_BOOL:
|
||||
return bool(gdapi10.godot_variant_as_bool(p_gdvar))
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_BOOL:
|
||||
return bool(gdapi10.pandemonium_variant_as_bool(p_gdvar))
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_INT:
|
||||
return int(gdapi10.godot_variant_as_int(p_gdvar))
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_INT:
|
||||
return int(gdapi10.pandemonium_variant_as_int(p_gdvar))
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_REAL:
|
||||
return float(gdapi10.godot_variant_as_real(p_gdvar))
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_REAL:
|
||||
return float(gdapi10.pandemonium_variant_as_real(p_gdvar))
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_STRING:
|
||||
return _godot_variant_to_pyobj_string(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_STRING:
|
||||
return _pandemonium_variant_to_pyobj_string(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_VECTOR2:
|
||||
return _godot_variant_to_pyobj_vector2(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR2:
|
||||
return _pandemonium_variant_to_pyobj_vector2(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_RECT2:
|
||||
return _godot_variant_to_pyobj_rect2(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_RECT2:
|
||||
return _pandemonium_variant_to_pyobj_rect2(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_VECTOR3:
|
||||
return _godot_variant_to_pyobj_vector3(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_VECTOR3:
|
||||
return _pandemonium_variant_to_pyobj_vector3(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D:
|
||||
return _godot_variant_to_pyobj_transform2d(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM2D:
|
||||
return _pandemonium_variant_to_pyobj_transform2d(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_PLANE:
|
||||
return _godot_variant_to_pyobj_plane(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_PLANE:
|
||||
return _pandemonium_variant_to_pyobj_plane(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_QUAT:
|
||||
return _godot_variant_to_pyobj_quat(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_QUAT:
|
||||
return _pandemonium_variant_to_pyobj_quat(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_AABB:
|
||||
return _godot_variant_to_pyobj_aabb(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_AABB:
|
||||
return _pandemonium_variant_to_pyobj_aabb(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_BASIS:
|
||||
return _godot_variant_to_pyobj_basis(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_BASIS:
|
||||
return _pandemonium_variant_to_pyobj_basis(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_TRANSFORM:
|
||||
return _godot_variant_to_pyobj_transform(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_TRANSFORM:
|
||||
return _pandemonium_variant_to_pyobj_transform(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_COLOR:
|
||||
return _godot_variant_to_pyobj_color(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_COLOR:
|
||||
return _pandemonium_variant_to_pyobj_color(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_NODE_PATH:
|
||||
return _godot_variant_to_pyobj_node_path(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_NODE_PATH:
|
||||
return _pandemonium_variant_to_pyobj_node_path(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_RID:
|
||||
return _godot_variant_to_pyobj_rid(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_RID:
|
||||
return _pandemonium_variant_to_pyobj_rid(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_OBJECT:
|
||||
return _godot_variant_to_pyobj_object(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_OBJECT:
|
||||
return _pandemonium_variant_to_pyobj_object(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_DICTIONARY:
|
||||
return _godot_variant_to_pyobj_dictionary(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_DICTIONARY:
|
||||
return _pandemonium_variant_to_pyobj_dictionary(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_ARRAY:
|
||||
return _godot_variant_to_pyobj_array(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_ARRAY:
|
||||
return _pandemonium_variant_to_pyobj_array(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY:
|
||||
return _godot_variant_to_pyobj_pool_byte_array(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY:
|
||||
return _pandemonium_variant_to_pyobj_pool_byte_array(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY:
|
||||
return _godot_variant_to_pyobj_pool_int_array(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_INT_ARRAY:
|
||||
return _pandemonium_variant_to_pyobj_pool_int_array(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY:
|
||||
return _godot_variant_to_pyobj_pool_real_array(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY:
|
||||
return _pandemonium_variant_to_pyobj_pool_real_array(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY:
|
||||
return _godot_variant_to_pyobj_pool_string_array(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY:
|
||||
return _pandemonium_variant_to_pyobj_pool_string_array(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY:
|
||||
return _godot_variant_to_pyobj_pool_vector2_array(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY:
|
||||
return _pandemonium_variant_to_pyobj_pool_vector2_array(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY:
|
||||
return _godot_variant_to_pyobj_pool_vector3_array(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY:
|
||||
return _pandemonium_variant_to_pyobj_pool_vector3_array(p_gdvar)
|
||||
|
||||
elif gdtype == godot_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY:
|
||||
return _godot_variant_to_pyobj_pool_color_array(p_gdvar)
|
||||
elif gdtype == pandemonium_variant_type.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY:
|
||||
return _pandemonium_variant_to_pyobj_pool_color_array(p_gdvar)
|
||||
|
||||
else:
|
||||
warn(f"Unknown Variant type `{gdtype}` (this should never happen !)")
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_string(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_string(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_vector2(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_vector2(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_rect2(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_rect2(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_vector3(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_vector3(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_transform2d(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_transform2d(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_transform(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_transform(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_plane(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_plane(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_quat(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_quat(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_aabb(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_aabb(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_basis(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_basis(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_color(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_color(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_node_path(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_node_path(p_gdvar)
|
||||
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)
|
||||
ret._gd_data = gdapi10.godot_variant_as_rid(p_gdvar)
|
||||
ret._gd_data = gdapi10.pandemonium_variant_as_rid(p_gdvar)
|
||||
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
|
||||
# modules, wouldn't it be better to create a `ObjectFromVariant` lazy
|
||||
# class instead ?
|
||||
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)
|
||||
d._gd_data = gdapi10.godot_variant_as_dictionary(p_gdvar)
|
||||
d._gd_data = gdapi10.pandemonium_variant_as_dictionary(p_gdvar)
|
||||
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)
|
||||
a._gd_data = gdapi10.godot_variant_as_array(p_gdvar)
|
||||
a._gd_data = gdapi10.pandemonium_variant_as_array(p_gdvar)
|
||||
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)
|
||||
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
|
||||
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
|
||||
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:
|
||||
gdapi10.godot_variant_new_nil(p_var)
|
||||
gdapi10.pandemonium_variant_new_nil(p_var)
|
||||
elif isinstance(pyobj, bool):
|
||||
gdapi10.godot_variant_new_bool(p_var, pyobj)
|
||||
gdapi10.pandemonium_variant_new_bool(p_var, pyobj)
|
||||
elif isinstance(pyobj, int):
|
||||
gdapi10.godot_variant_new_int(p_var, pyobj)
|
||||
gdapi10.pandemonium_variant_new_int(p_var, pyobj)
|
||||
elif isinstance(pyobj, float):
|
||||
gdapi10.godot_variant_new_real(p_var, pyobj)
|
||||
gdapi10.pandemonium_variant_new_real(p_var, pyobj)
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
gdapi10.godot_variant_new_object(p_var, (<Object>pyobj)._gd_ptr)
|
||||
gdapi10.pandemonium_variant_new_object(p_var, (<Object>pyobj)._gd_ptr)
|
||||
else:
|
||||
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 True
|
||||
|
||||
|
||||
# Needed to define gdstr in it own scope
|
||||
cdef inline void _pyobj_to_godot_variant_convert_string(object pyobj, godot_variant *p_var):
|
||||
cdef godot_string gdstr
|
||||
pyobj_to_godot_string(pyobj, &gdstr)
|
||||
cdef inline void _pyobj_to_pandemonium_variant_convert_string(object pyobj, pandemonium_variant *p_var):
|
||||
cdef pandemonium_string gdstr
|
||||
pyobj_to_pandemonium_string(pyobj, &gdstr)
|
||||
try:
|
||||
gdapi10.godot_variant_new_string(p_var, &gdstr)
|
||||
gdapi10.pandemonium_variant_new_string(p_var, &gdstr)
|
||||
finally:
|
||||
gdapi10.godot_string_destroy(&gdstr)
|
||||
gdapi10.pandemonium_string_destroy(&gdstr)
|
||||
|
||||
|
||||
cdef GDString ensure_is_gdstring(object gdstring_or_pystr):
|
||||
|
@ -1,11 +1,11 @@
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_gdnative_core_api_struct,
|
||||
godot_gdnative_core_1_1_api_struct,
|
||||
godot_gdnative_core_1_2_api_struct,
|
||||
godot_gdnative_ext_nativescript_api_struct,
|
||||
godot_gdnative_ext_pluginscript_api_struct,
|
||||
godot_gdnative_ext_android_api_struct,
|
||||
godot_gdnative_ext_arvr_api_struct,
|
||||
pandemonium_gdnative_core_api_struct,
|
||||
pandemonium_gdnative_core_1_1_api_struct,
|
||||
pandemonium_gdnative_core_1_2_api_struct,
|
||||
pandemonium_gdnative_ext_nativescript_api_struct,
|
||||
pandemonium_gdnative_ext_pluginscript_api_struct,
|
||||
pandemonium_gdnative_ext_android_api_struct,
|
||||
pandemonium_gdnative_ext_arvr_api_struct,
|
||||
)
|
||||
|
||||
|
||||
@ -20,19 +20,19 @@ cdef extern from * nogil:
|
||||
#else
|
||||
# define PYTHONSCRIPT_IMPORT
|
||||
#endif
|
||||
PYTHONSCRIPT_IMPORT extern const godot_gdnative_core_api_struct *pythonscript_gdapi10;
|
||||
PYTHONSCRIPT_IMPORT extern const godot_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 godot_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 godot_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_core_api_struct *pythonscript_gdapi10;
|
||||
PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_core_1_1_api_struct *pythonscript_gdapi11;
|
||||
PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_core_1_2_api_struct *pythonscript_gdapi12;
|
||||
PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript;
|
||||
PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript;
|
||||
PYTHONSCRIPT_IMPORT extern const pandemonium_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android;
|
||||
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 godot_gdnative_core_1_1_api_struct *pythonscript_gdapi11
|
||||
cdef const godot_gdnative_core_1_2_api_struct *pythonscript_gdapi12
|
||||
cdef const godot_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript
|
||||
cdef const godot_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript
|
||||
cdef const godot_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_core_api_struct *pythonscript_gdapi10
|
||||
cdef const pandemonium_gdnative_core_1_1_api_struct *pythonscript_gdapi11
|
||||
cdef const pandemonium_gdnative_core_1_2_api_struct *pythonscript_gdapi12
|
||||
cdef const pandemonium_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript
|
||||
cdef const pandemonium_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript
|
||||
cdef const pandemonium_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android
|
||||
cdef const pandemonium_gdnative_ext_arvr_api_struct *pythonscript_gdapi_ext_arvr
|
||||
|
@ -12,8 +12,8 @@ from godot._hazmat.gdapi cimport (
|
||||
pythonscript_gdapi_ext_arvr as gdapi_ext_arvr,
|
||||
)
|
||||
from godot._hazmat.conversion cimport (
|
||||
godot_string_to_pyobj,
|
||||
pyobj_to_godot_string,
|
||||
godot_variant_to_pyobj,
|
||||
pyobj_to_godot_variant,
|
||||
pandemonium_string_to_pyobj,
|
||||
pyobj_to_pandemonium_string,
|
||||
pandemonium_variant_to_pyobj,
|
||||
pyobj_to_pandemonium_variant,
|
||||
)
|
||||
|
@ -2,17 +2,17 @@ import builtins
|
||||
import enum
|
||||
|
||||
from godot._hazmat.gdnative_api_struct cimport (
|
||||
godot_method_rpc_mode,
|
||||
godot_property_usage_flags,
|
||||
godot_method_rpc_mode,
|
||||
godot_property_hint,
|
||||
godot_variant,
|
||||
pandemonium_method_rpc_mode,
|
||||
pandemonium_property_usage_flags,
|
||||
pandemonium_method_rpc_mode,
|
||||
pandemonium_property_hint,
|
||||
pandemonium_variant,
|
||||
)
|
||||
from godot._hazmat.gdapi cimport pythonscript_gdapi10 as gdapi10
|
||||
from godot._hazmat.conversion cimport (
|
||||
is_pytype_compatible_with_godot_variant,
|
||||
pyobj_to_godot_variant,
|
||||
godot_variant_to_pyobj,
|
||||
is_pytype_compatible_with_pandemonium_variant,
|
||||
pyobj_to_pandemonium_variant,
|
||||
pandemonium_variant_to_pyobj,
|
||||
)
|
||||
from godot._hazmat.internal cimport get_exposed_class, set_exposed_class
|
||||
from godot.builtins cimport Array, Dictionary, GDString
|
||||
@ -23,76 +23,76 @@ from godot.bindings cimport Object, Resource
|
||||
|
||||
|
||||
class MethodRPCMode(enum.IntEnum):
|
||||
DISABLED = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_DISABLED
|
||||
REMOTE = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_REMOTE
|
||||
MASTER = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_MASTER
|
||||
PUPPET = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_PUPPET
|
||||
SLAVE = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_SLAVE
|
||||
REMOTESYNC = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_REMOTESYNC
|
||||
SYNC = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_SYNC
|
||||
MASTERSYNC = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_MASTERSYNC
|
||||
PUPPETSYNC = godot_method_rpc_mode.GODOT_METHOD_RPC_MODE_PUPPETSYNC
|
||||
DISABLED = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_DISABLED
|
||||
REMOTE = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_REMOTE
|
||||
MASTER = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_MASTER
|
||||
PUPPET = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_PUPPET
|
||||
SLAVE = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_SLAVE
|
||||
REMOTESYNC = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_REMOTESYNC
|
||||
SYNC = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_SYNC
|
||||
MASTERSYNC = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_MASTERSYNC
|
||||
PUPPETSYNC = pandemonium_method_rpc_mode.GODOT_METHOD_RPC_MODE_PUPPETSYNC
|
||||
|
||||
|
||||
class PropertyHint(enum.IntEnum):
|
||||
NONE = godot_property_hint.GODOT_PROPERTY_HINT_NONE
|
||||
RANGE = godot_property_hint.GODOT_PROPERTY_HINT_RANGE
|
||||
EXP_RANGE = godot_property_hint.GODOT_PROPERTY_HINT_EXP_RANGE
|
||||
ENUM = godot_property_hint.GODOT_PROPERTY_HINT_ENUM
|
||||
EXP_EASING = godot_property_hint.GODOT_PROPERTY_HINT_EXP_EASING
|
||||
LENGTH = godot_property_hint.GODOT_PROPERTY_HINT_LENGTH
|
||||
SPRITE_FRAME = godot_property_hint.GODOT_PROPERTY_HINT_SPRITE_FRAME
|
||||
KEY_ACCEL = godot_property_hint.GODOT_PROPERTY_HINT_KEY_ACCEL
|
||||
FLAGS = godot_property_hint.GODOT_PROPERTY_HINT_FLAGS
|
||||
LAYERS_2D_RENDER = godot_property_hint.GODOT_PROPERTY_HINT_LAYERS_2D_RENDER
|
||||
LAYERS_2D_PHYSICS = godot_property_hint.GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS
|
||||
LAYERS_3D_RENDER = godot_property_hint.GODOT_PROPERTY_HINT_LAYERS_3D_RENDER
|
||||
LAYERS_3D_PHYSICS = godot_property_hint.GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS
|
||||
FILE = godot_property_hint.GODOT_PROPERTY_HINT_FILE
|
||||
DIR = godot_property_hint.GODOT_PROPERTY_HINT_DIR
|
||||
GLOBAL_FILE = godot_property_hint.GODOT_PROPERTY_HINT_GLOBAL_FILE
|
||||
GLOBAL_DIR = godot_property_hint.GODOT_PROPERTY_HINT_GLOBAL_DIR
|
||||
RESOURCE_TYPE = godot_property_hint.GODOT_PROPERTY_HINT_RESOURCE_TYPE
|
||||
MULTILINE_TEXT = godot_property_hint.GODOT_PROPERTY_HINT_MULTILINE_TEXT
|
||||
PLACEHOLDER_TEXT = godot_property_hint.GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT
|
||||
COLOR_NO_ALPHA = godot_property_hint.GODOT_PROPERTY_HINT_COLOR_NO_ALPHA
|
||||
IMAGE_COMPRESS_LOSSY = godot_property_hint.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY
|
||||
IMAGE_COMPRESS_LOSSLESS = godot_property_hint.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS
|
||||
OBJECT_ID = godot_property_hint.GODOT_PROPERTY_HINT_OBJECT_ID
|
||||
TYPE_STRING = godot_property_hint.GODOT_PROPERTY_HINT_TYPE_STRING
|
||||
NODE_PATH_TO_EDITED_NODE = godot_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_BASE_TYPE = godot_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE
|
||||
METHOD_OF_INSTANCE = godot_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE
|
||||
METHOD_OF_SCRIPT = godot_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT
|
||||
PROPERTY_OF_VARIANT_TYPE = godot_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_INSTANCE = godot_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE
|
||||
PROPERTY_OF_SCRIPT = godot_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT
|
||||
MAX = godot_property_hint.GODOT_PROPERTY_HINT_MAX
|
||||
NONE = pandemonium_property_hint.GODOT_PROPERTY_HINT_NONE
|
||||
RANGE = pandemonium_property_hint.GODOT_PROPERTY_HINT_RANGE
|
||||
EXP_RANGE = pandemonium_property_hint.GODOT_PROPERTY_HINT_EXP_RANGE
|
||||
ENUM = pandemonium_property_hint.GODOT_PROPERTY_HINT_ENUM
|
||||
EXP_EASING = pandemonium_property_hint.GODOT_PROPERTY_HINT_EXP_EASING
|
||||
LENGTH = pandemonium_property_hint.GODOT_PROPERTY_HINT_LENGTH
|
||||
SPRITE_FRAME = pandemonium_property_hint.GODOT_PROPERTY_HINT_SPRITE_FRAME
|
||||
KEY_ACCEL = pandemonium_property_hint.GODOT_PROPERTY_HINT_KEY_ACCEL
|
||||
FLAGS = pandemonium_property_hint.GODOT_PROPERTY_HINT_FLAGS
|
||||
LAYERS_2D_RENDER = pandemonium_property_hint.GODOT_PROPERTY_HINT_LAYERS_2D_RENDER
|
||||
LAYERS_2D_PHYSICS = pandemonium_property_hint.GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS
|
||||
LAYERS_3D_RENDER = pandemonium_property_hint.GODOT_PROPERTY_HINT_LAYERS_3D_RENDER
|
||||
LAYERS_3D_PHYSICS = pandemonium_property_hint.GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS
|
||||
FILE = pandemonium_property_hint.GODOT_PROPERTY_HINT_FILE
|
||||
DIR = pandemonium_property_hint.GODOT_PROPERTY_HINT_DIR
|
||||
GLOBAL_FILE = pandemonium_property_hint.GODOT_PROPERTY_HINT_GLOBAL_FILE
|
||||
GLOBAL_DIR = pandemonium_property_hint.GODOT_PROPERTY_HINT_GLOBAL_DIR
|
||||
RESOURCE_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_RESOURCE_TYPE
|
||||
MULTILINE_TEXT = pandemonium_property_hint.GODOT_PROPERTY_HINT_MULTILINE_TEXT
|
||||
PLACEHOLDER_TEXT = pandemonium_property_hint.GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT
|
||||
COLOR_NO_ALPHA = pandemonium_property_hint.GODOT_PROPERTY_HINT_COLOR_NO_ALPHA
|
||||
IMAGE_COMPRESS_LOSSY = pandemonium_property_hint.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY
|
||||
IMAGE_COMPRESS_LOSSLESS = pandemonium_property_hint.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS
|
||||
OBJECT_ID = pandemonium_property_hint.GODOT_PROPERTY_HINT_OBJECT_ID
|
||||
TYPE_STRING = pandemonium_property_hint.GODOT_PROPERTY_HINT_TYPE_STRING
|
||||
NODE_PATH_TO_EDITED_NODE = pandemonium_property_hint.GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE
|
||||
METHOD_OF_VARIANT_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE
|
||||
METHOD_OF_BASE_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE
|
||||
METHOD_OF_INSTANCE = pandemonium_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE
|
||||
METHOD_OF_SCRIPT = pandemonium_property_hint.GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT
|
||||
PROPERTY_OF_VARIANT_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE
|
||||
PROPERTY_OF_BASE_TYPE = pandemonium_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE
|
||||
PROPERTY_OF_INSTANCE = pandemonium_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE
|
||||
PROPERTY_OF_SCRIPT = pandemonium_property_hint.GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT
|
||||
MAX = pandemonium_property_hint.GODOT_PROPERTY_HINT_MAX
|
||||
|
||||
|
||||
class PropertyUsageFlag(enum.IntFlag):
|
||||
STORAGE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_STORAGE
|
||||
EDITOR = godot_property_usage_flags.GODOT_PROPERTY_USAGE_EDITOR
|
||||
NETWORK = godot_property_usage_flags.GODOT_PROPERTY_USAGE_NETWORK
|
||||
EDITOR_HELPER = godot_property_usage_flags.GODOT_PROPERTY_USAGE_EDITOR_HELPER
|
||||
CHECKABLE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_CHECKABLE
|
||||
CHECKED = godot_property_usage_flags.GODOT_PROPERTY_USAGE_CHECKED
|
||||
INTERNATIONALIZED = godot_property_usage_flags.GODOT_PROPERTY_USAGE_INTERNATIONALIZED
|
||||
GROUP = godot_property_usage_flags.GODOT_PROPERTY_USAGE_GROUP
|
||||
CATEGORY = godot_property_usage_flags.GODOT_PROPERTY_USAGE_CATEGORY
|
||||
STORE_IF_NONZERO = godot_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NONZERO
|
||||
STORE_IF_NONONE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NONONE
|
||||
NO_INSTANCE_STATE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE
|
||||
RESTART_IF_CHANGED = godot_property_usage_flags.GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED
|
||||
SCRIPT_VARIABLE = godot_property_usage_flags.GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE
|
||||
STORE_IF_NULL = godot_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NULL
|
||||
ANIMATE_AS_TRIGGER = godot_property_usage_flags.GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER
|
||||
UPDATE_ALL_IF_MODIFIED = godot_property_usage_flags.GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED
|
||||
DEFAULT = godot_property_usage_flags.GODOT_PROPERTY_USAGE_DEFAULT
|
||||
DEFAULT_INTL = godot_property_usage_flags.GODOT_PROPERTY_USAGE_DEFAULT_INTL
|
||||
NOEDITOR = godot_property_usage_flags.GODOT_PROPERTY_USAGE_NOEDITOR
|
||||
STORAGE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_STORAGE
|
||||
EDITOR = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_EDITOR
|
||||
NETWORK = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_NETWORK
|
||||
EDITOR_HELPER = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_EDITOR_HELPER
|
||||
CHECKABLE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_CHECKABLE
|
||||
CHECKED = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_CHECKED
|
||||
INTERNATIONALIZED = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_INTERNATIONALIZED
|
||||
GROUP = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_GROUP
|
||||
CATEGORY = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_CATEGORY
|
||||
STORE_IF_NONZERO = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NONZERO
|
||||
STORE_IF_NONONE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NONONE
|
||||
NO_INSTANCE_STATE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE
|
||||
RESTART_IF_CHANGED = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED
|
||||
SCRIPT_VARIABLE = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE
|
||||
STORE_IF_NULL = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_STORE_IF_NULL
|
||||
ANIMATE_AS_TRIGGER = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER
|
||||
UPDATE_ALL_IF_MODIFIED = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED
|
||||
DEFAULT = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_DEFAULT
|
||||
DEFAULT_INTL = pandemonium_property_usage_flags.GODOT_PROPERTY_USAGE_DEFAULT_INTL
|
||||
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
|
||||
@ -161,17 +161,17 @@ class ExportedField:
|
||||
type = Array if type == list 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")
|
||||
|
||||
cdef godot_variant gd_default
|
||||
cdef pandemonium_variant gd_default
|
||||
if default is not None:
|
||||
# Convert `default` to a Godot-compatible value (e.g. str -> GDString)
|
||||
if not pyobj_to_godot_variant(default, &gd_default):
|
||||
gdapi10.godot_variant_destroy(&gd_default)
|
||||
if not pyobj_to_pandemonium_variant(default, &gd_default):
|
||||
gdapi10.pandemonium_variant_destroy(&gd_default)
|
||||
raise ValueError(f"{default!r} default value not compatible with Godot")
|
||||
default = godot_variant_to_pyobj(&gd_default)
|
||||
gdapi10.godot_variant_destroy(&gd_default)
|
||||
default = pandemonium_variant_to_pyobj(&gd_default)
|
||||
gdapi10.pandemonium_variant_destroy(&gd_default)
|
||||
|
||||
if not isinstance(default, type):
|
||||
raise ValueError(f"{default!r} default value not compatible with {type!r} type")
|
||||
|
@ -3,7 +3,7 @@
|
||||
* to the pythonscript plugin.
|
||||
* It should be loaded by Godot's GDNative system (see the `pythonscript.gdnlib`
|
||||
* 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
|
||||
* Python as a new language using Godot's Pluginscript system.
|
||||
*/
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
#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 };
|
||||
@ -60,7 +60,7 @@ static const char *PYTHONSCRIPT_RESERVED_WORDS[] = {
|
||||
};
|
||||
static const char *PYTHONSCRIPT_COMMENT_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;
|
||||
|
||||
|
||||
@ -74,38 +74,38 @@ static PyThreadState *gilstate = NULL;
|
||||
#else
|
||||
# define PYTHONSCRIPT_EXPORT
|
||||
#endif
|
||||
PYTHONSCRIPT_EXPORT const godot_gdnative_core_api_struct *pythonscript_gdapi10 = NULL;
|
||||
PYTHONSCRIPT_EXPORT const godot_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 godot_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 godot_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_core_api_struct *pythonscript_gdapi10 = NULL;
|
||||
PYTHONSCRIPT_EXPORT const pandemonium_gdnative_core_1_1_api_struct *pythonscript_gdapi11 = NULL;
|
||||
PYTHONSCRIPT_EXPORT const pandemonium_gdnative_core_1_2_api_struct *pythonscript_gdapi12 = NULL;
|
||||
PYTHONSCRIPT_EXPORT const pandemonium_gdnative_ext_nativescript_api_struct *pythonscript_gdapi_ext_nativescript = NULL;
|
||||
PYTHONSCRIPT_EXPORT const pandemonium_gdnative_ext_pluginscript_api_struct *pythonscript_gdapi_ext_pluginscript = NULL;
|
||||
PYTHONSCRIPT_EXPORT const pandemonium_gdnative_ext_android_api_struct *pythonscript_gdapi_ext_android = 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) {
|
||||
pythonscript_gdapi10 = (const godot_gdnative_core_api_struct *)options->api_struct;
|
||||
static void _register_gdapi(const pandemonium_gdnative_init_options *options) {
|
||||
pythonscript_gdapi10 = (const pandemonium_gdnative_core_api_struct *)options->api_struct;
|
||||
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) {
|
||||
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++) {
|
||||
const godot_gdnative_api_struct *ext = pythonscript_gdapi10->extensions[i];
|
||||
const pandemonium_gdnative_api_struct *ext = pythonscript_gdapi10->extensions[i];
|
||||
switch (ext->type) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
default:
|
||||
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 !
|
||||
_register_gdapi(options);
|
||||
|
||||
// Now those macros are usable
|
||||
|
||||
#define GD_PRINT(c_msg) { \
|
||||
godot_string gd_msg; \
|
||||
pythonscript_gdapi10->godot_string_new_with_wide_string( \
|
||||
pandemonium_string gd_msg; \
|
||||
pythonscript_gdapi10->pandemonium_string_new_with_wide_string( \
|
||||
&gd_msg, c_msg, -1); \
|
||||
pythonscript_gdapi10->godot_print(&gd_msg); \
|
||||
pythonscript_gdapi10->godot_string_destroy(&gd_msg); \
|
||||
pythonscript_gdapi10->pandemonium_print(&gd_msg); \
|
||||
pythonscript_gdapi10->pandemonium_string_destroy(&gd_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
|
||||
@ -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
|
||||
// (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
|
||||
);
|
||||
char path[300];
|
||||
@ -167,11 +167,11 @@ GDN_EXPORT void godot_gdnative_init(godot_gdnative_init_options *options) {
|
||||
// Retrieve path and set pythonhome
|
||||
{
|
||||
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
|
||||
);
|
||||
wcsncpy(pythonhome, pythonscript_gdapi10->godot_string_wide_str(&_pythonhome), 300);
|
||||
pythonscript_gdapi10->godot_string_destroy(&_pythonhome);
|
||||
wcsncpy(pythonhome, pythonscript_gdapi10->pandemonium_string_wide_str(&_pythonhome), 300);
|
||||
pythonscript_gdapi10->pandemonium_string_destroy(&_pythonhome);
|
||||
Py_SetPythonHome(pythonhome);
|
||||
}
|
||||
// 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_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 !
|
||||
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
|
||||
PyEval_RestoreThread(gilstate);
|
||||
|
||||
|
@ -23,8 +23,8 @@ for test in ["bindings", "helloworld", "threading", "global_constants"]:
|
||||
dist_symlink = env.Symlink(f"{test}/lib", "_lib_vendors")
|
||||
target = env.Command(
|
||||
test,
|
||||
["$godot_binary", dist_symlink],
|
||||
cmd_prefx + "${SOURCE.abspath} ${godot_args} --path ${TARGET} " + cmd_suffix,
|
||||
["$pandemonium_binary", dist_symlink],
|
||||
cmd_prefx + "${SOURCE.abspath} ${pandemonium_args} --path ${TARGET} " + cmd_suffix,
|
||||
)
|
||||
env.Depends(target, env["DIST_ROOT"])
|
||||
env.AlwaysBuild(target)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
symbol_prefix="pandemonium_"
|
||||
|
||||
[entry]
|
||||
|
||||
|
@ -124,18 +124,18 @@ def test_bad_instantiate(arg):
|
||||
Array(arg)
|
||||
|
||||
|
||||
def test_instantiate_with_non_godot_data(recwarn):
|
||||
def test_instantiate_with_non_pandemonium_data(recwarn):
|
||||
with pytest.raises(TypeError):
|
||||
Array([object()])
|
||||
|
||||
|
||||
def test_append_with_non_godot_data(recwarn):
|
||||
def test_append_with_non_pandemonium_data(recwarn):
|
||||
v = Array()
|
||||
with pytest.raises(TypeError):
|
||||
v.append(object())
|
||||
|
||||
|
||||
def test_add_with_non_godot_data(recwarn):
|
||||
def test_add_with_non_pandemonium_data(recwarn):
|
||||
v = Array()
|
||||
with pytest.raises(TypeError):
|
||||
v += [object()]
|
||||
|
@ -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):
|
||||
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)
|
||||
assert str(exc.value) == "an integer is required"
|
||||
|
||||
@ -221,9 +221,9 @@ def test_virtual_to_string_customize(generate_obj):
|
||||
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):
|
||||
if request.param == "godot_class":
|
||||
if request.param == "pandemonium_class":
|
||||
return generate_obj(Node)
|
||||
else:
|
||||
return current_node
|
||||
|
@ -8,7 +8,7 @@
|
||||
# pyobj_to_gdobj,
|
||||
# gd_to_py_type,
|
||||
# py_to_gd_type,
|
||||
# godot_string_to_pyobj,
|
||||
# pandemonium_string_to_pyobj,
|
||||
# )
|
||||
# from pythonscriptcffi import lib
|
||||
|
||||
@ -51,9 +51,9 @@
|
||||
|
||||
|
||||
# @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)
|
||||
# ret_arg = godot_string_to_pyobj(gdstr)
|
||||
# ret_arg = pandemonium_string_to_pyobj(gdstr)
|
||||
# assert ret_arg == arg
|
||||
|
||||
|
||||
|
@ -46,15 +46,15 @@ class access_from_python(Node):
|
||||
self.outcome = global_import_outcome
|
||||
return
|
||||
|
||||
from godot import globals as godot_globals
|
||||
from godot import globals as pandemonium_globals
|
||||
|
||||
godot_globals_dir = dir(godot_globals)
|
||||
expected_godot_globals_dir = ["global_gd", "global_py"]
|
||||
if godot_globals_dir != expected_godot_globals_dir:
|
||||
self.outcome = f"Invalid `dir(godot.globals)` (expected: `{expected_godot_globals_dir}`, got `{godot_globals_dir}`)"
|
||||
pandemonium_globals_dir = dir(pandemonium_globals)
|
||||
expected_pandemonium_globals_dir = ["global_gd", "global_py"]
|
||||
if pandemonium_globals_dir != expected_pandemonium_globals_dir:
|
||||
self.outcome = f"Invalid `dir(godot.globals)` (expected: `{expected_pandemonium_globals_dir}`, got `{pandemonium_globals_dir}`)"
|
||||
return
|
||||
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:
|
||||
self.outcome = (
|
||||
f"Invalid Node type for `{path}` (expected `{type}`, got `{node.type}`)"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
symbol_prefix="pandemonium_"
|
||||
|
||||
[entry]
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
symbol_prefix="pandemonium_"
|
||||
|
||||
[entry]
|
||||
|
||||
|
@ -68,7 +68,7 @@ test_factory("run_python", f"{python} --version")
|
||||
|
||||
|
||||
test_factory(
|
||||
"import_godot_module",
|
||||
"import_pandemonium_module",
|
||||
[
|
||||
python,
|
||||
"-c",
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
symbol_prefix="pandemonium_"
|
||||
|
||||
[entry]
|
||||
|
||||
|
@ -19,7 +19,7 @@ def test_simple_thread():
|
||||
assert thread_said_hello
|
||||
|
||||
|
||||
def test_use_godot_from_thread():
|
||||
def test_use_pandemonium_from_thread():
|
||||
def target():
|
||||
st = SurfaceTool()
|
||||
st.begin(Mesh.PRIMITIVE_TRIANGLES)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_"
|
||||
symbol_prefix="pandemonium_"
|
||||
|
||||
[entry]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user