diff --git a/BMapBindings/PyBMap/PyBMap/bmap.py b/BMapBindings/PyBMap/PyBMap/bmap.py index 1b6c7af..0ed4285 100644 --- a/BMapBindings/PyBMap/PyBMap/bmap.py +++ b/BMapBindings/PyBMap/PyBMap/bmap.py @@ -46,6 +46,7 @@ class bm_VxVector3(ctypes.Structure): ('z', bm_CKFLOAT), ] bm_VxVector3_p = ctypes.POINTER(bm_VxVector3) +bm_VxVector3_pp = ctypes.POINTER(bm_VxVector3_p) class bm_VxColor(ctypes.Structure): _fields_ = [ ('r', bm_CKFLOAT), @@ -223,7 +224,7 @@ BMMeshTrans_PrepareVertexCount = _create_bmap_func('BMMeshTrans_PrepareVertexCou # @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition. # @param out_mem[out] Type: LibCmo::VxMath::VxVector3*. Use ctypes.byref(data) pass it. # @return True if no error, otherwise False. -BMMeshTrans_PrepareVertex = _create_bmap_func('BMMeshTrans_PrepareVertex', [bm_void_p, bm_VxVector2_pp]) +BMMeshTrans_PrepareVertex = _create_bmap_func('BMMeshTrans_PrepareVertex', [bm_void_p, bm_VxVector3_pp]) ## BMMeshTrans_PrepareNormalCount # @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition. # @param count[in] Type: LibCmo::CKDWORD. @@ -233,7 +234,7 @@ BMMeshTrans_PrepareNormalCount = _create_bmap_func('BMMeshTrans_PrepareNormalCou # @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition. # @param out_mem[out] Type: LibCmo::VxMath::VxVector3*. Use ctypes.byref(data) pass it. # @return True if no error, otherwise False. -BMMeshTrans_PrepareNormal = _create_bmap_func('BMMeshTrans_PrepareNormal', [bm_void_p, bm_VxVector2_pp]) +BMMeshTrans_PrepareNormal = _create_bmap_func('BMMeshTrans_PrepareNormal', [bm_void_p, bm_VxVector3_pp]) ## BMMeshTrans_PrepareUVCount # @param trans[in] Type: BMap::BMMeshTransition*. The pointer to corresponding BMMeshTransition. # @param count[in] Type: LibCmo::CKDWORD. @@ -651,13 +652,13 @@ BMMesh_SetVertexCount = _create_bmap_func('BMMesh_SetVertexCount', [bm_void_p, b # @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing. # @param out_mem[out] Type: LibCmo::VxMath::VxVector3*. Use ctypes.byref(data) pass it. # @return True if no error, otherwise False. -BMMesh_GetVertexPositions = _create_bmap_func('BMMesh_GetVertexPositions', [bm_void_p, bm_CKID, bm_VxVector2_pp]) +BMMesh_GetVertexPositions = _create_bmap_func('BMMesh_GetVertexPositions', [bm_void_p, bm_CKID, bm_VxVector3_pp]) ## BMMesh_GetVertexNormals # @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile. # @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing. # @param out_mem[out] Type: LibCmo::VxMath::VxVector3*. Use ctypes.byref(data) pass it. # @return True if no error, otherwise False. -BMMesh_GetVertexNormals = _create_bmap_func('BMMesh_GetVertexNormals', [bm_void_p, bm_CKID, bm_VxVector2_pp]) +BMMesh_GetVertexNormals = _create_bmap_func('BMMesh_GetVertexNormals', [bm_void_p, bm_CKID, bm_VxVector3_pp]) ## BMMesh_GetVertexUVs # @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile. # @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing. diff --git a/BMapBindings/PyBMap/PyBMap/bmap_wrapper.py b/BMapBindings/PyBMap/PyBMap/bmap_wrapper.py index b51f758..1e3886a 100644 --- a/BMapBindings/PyBMap/PyBMap/bmap_wrapper.py +++ b/BMapBindings/PyBMap/PyBMap/bmap_wrapper.py @@ -48,13 +48,15 @@ class _AbstractCKObject(_AbstractPointer): return bmap.bm_CKID(self.__mCKID) def __eq__(self, obj: object) -> bool: + if not _AbstractPointer.__eq__(self, obj): return False + if isinstance(obj, self.__class__): - return obj.__mRawPointer == self.__mRawPointer and obj.__mCKID == self.__mCKID + return obj.__mCKID == self.__mCKID else: return False def __hash__(self) -> int: - return hash((self.__mRawPointer, self.__mCKID)) + return hash((_AbstractPointer.__hash__(self), self.__mCKID)) #endregion @@ -119,6 +121,7 @@ def _ckfaceindices_iterator(pindices: bmap.bm_CKDWORD_p, count: int) -> typing.I ret.i2 = pindices[idx + 1] ret.i3 = pindices[idx + 2] idx += 3 + yield ret #endregion @@ -429,7 +432,7 @@ class BMMesh(BMObject): def get_vertex_uvs(self) -> typing.Iterator[virtools_types.VxVector2]: raw_vector: bmap.bm_VxVector2_p = bmap.bm_VxVector2_p() bmap.BMMesh_GetVertexUVs(self._get_pointer(), self._get_ckid(), ctypes.byref(raw_vector)) - _vxvector2_iterator(raw_vector, self.get_vertex_count()) + return _vxvector2_iterator(raw_vector, self.get_vertex_count()) def set_vertex_uvs(self, itor: typing.Iterator[virtools_types.VxVector2]) -> None: raw_vector: bmap.bm_VxVector2_p = bmap.bm_VxVector2_p() @@ -457,13 +460,13 @@ class BMMesh(BMObject): def get_face_material_slot_indexs(self) -> typing.Iterator[int]: raw_idx: bmap.bm_CKWORD_p = bmap.bm_CKWORD_p() - bmap.BMMesh_GetFaceIndices(self._get_pointer(), self._get_ckid(), ctypes.byref(raw_idx)) + bmap.BMMesh_GetFaceMaterialSlotIndexs(self._get_pointer(), self._get_ckid(), ctypes.byref(raw_idx)) for i in range(self.get_face_count()): yield raw_idx[i] def set_face_material_slot_indexs(self, itor: typing.Iterator[int]) -> None: raw_idx: bmap.bm_CKWORD_p = bmap.bm_CKWORD_p() - bmap.BMMesh_GetFaceIndices(self._get_pointer(), self._get_ckid(), ctypes.byref(raw_idx)) + bmap.BMMesh_GetFaceMaterialSlotIndexs(self._get_pointer(), self._get_ckid(), ctypes.byref(raw_idx)) for i in range(self.get_face_count()): raw_idx[i] = next(itor) diff --git a/BMapBindings/PyBMap/PyBMap/virtools_types.py b/BMapBindings/PyBMap/PyBMap/virtools_types.py index 7f943b4..bdff974 100644 --- a/BMapBindings/PyBMap/PyBMap/virtools_types.py +++ b/BMapBindings/PyBMap/PyBMap/virtools_types.py @@ -136,42 +136,42 @@ class VxMatrix(): The Matrix representation. The bracket statement exactly equal with Virtools. """ - __mData: list[list[float]] + data: list[list[float]] def __init__(self): # init array - self.__mData = [[0] * 4 for i in range(4)] + self.data = [[0] * 4 for i in range(4)] # set to identy self.reset() def _get_raw(self) -> list[list[float]]: - return self.__mData + return self.data def reset(self) -> None: # reset to identy for i in range(4): for j in range(4): - self.__mData[i][j] = 0.0 + self.data[i][j] = 0.0 - self.__mData[0][0] = 1.0 - self.__mData[1][1] = 1.0 - self.__mData[2][2] = 1.0 - self.__mData[3][3] = 1.0 + self.data[0][0] = 1.0 + self.data[1][1] = 1.0 + self.data[2][2] = 1.0 + self.data[3][3] = 1.0 def from_const(self, cm: ConstVxMatrix) -> None: ( - self.__mData[0][0], self.__mData[0][1], self.__mData[0][2], self.__mData[0][3], - self.__mData[1][0], self.__mData[1][1], self.__mData[1][2], self.__mData[1][3], - self.__mData[2][0], self.__mData[2][1], self.__mData[2][2], self.__mData[2][3], - self.__mData[3][0], self.__mData[3][1], self.__mData[3][2], self.__mData[3][3] + self.data[0][0], self.data[0][1], self.data[0][2], self.data[0][3], + self.data[1][0], self.data[1][1], self.data[1][2], self.data[1][3], + self.data[2][0], self.data[2][1], self.data[2][2], self.data[2][3], + self.data[3][0], self.data[3][1], self.data[3][2], self.data[3][3] ) = cm def to_const(self) -> ConstVxMatrix: return ( - self.__mData[0][0], self.__mData[0][1], self.__mData[0][2], self.__mData[0][3], - self.__mData[1][0], self.__mData[1][1], self.__mData[1][2], self.__mData[1][3], - self.__mData[2][0], self.__mData[2][1], self.__mData[2][2], self.__mData[2][3], - self.__mData[3][0], self.__mData[3][1], self.__mData[3][2], self.__mData[3][3] + self.data[0][0], self.data[0][1], self.data[0][2], self.data[0][3], + self.data[1][0], self.data[1][1], self.data[1][2], self.data[1][3], + self.data[2][0], self.data[2][1], self.data[2][2], self.data[2][3], + self.data[3][0], self.data[3][1], self.data[3][2], self.data[3][3] ) class CK_TEXTURE_SAVEOPTIONS(enum.IntEnum): diff --git a/CodeGen/BMapBindings/PythonWriter.java b/CodeGen/BMapBindings/PythonWriter.java index e3d3c48..c1ea399 100644 --- a/CodeGen/BMapBindings/PythonWriter.java +++ b/CodeGen/BMapBindings/PythonWriter.java @@ -21,7 +21,7 @@ public class PythonWriter { cache.put("CK_ID", "CKID"); cache.put("BMFile", "void"); cache.put("BMMeshTransition", "void"); - cache.put("VxVector3", "VxVector2"); + cache.put("VxVector3", "VxVector3"); cache.put("VxVector2", "VxVector2"); cache.put("VxColor", "VxColor"); cache.put("VxMatrix", "VxMatrix"); diff --git a/CodeGen/BMapBindings/snippets/header.py b/CodeGen/BMapBindings/snippets/header.py index 794fa9e..d9d37b9 100644 --- a/CodeGen/BMapBindings/snippets/header.py +++ b/CodeGen/BMapBindings/snippets/header.py @@ -46,6 +46,7 @@ class bm_VxVector3(ctypes.Structure): ('z', bm_CKFLOAT), ] bm_VxVector3_p = ctypes.POINTER(bm_VxVector3) +bm_VxVector3_pp = ctypes.POINTER(bm_VxVector3_p) class bm_VxColor(ctypes.Structure): _fields_ = [ ('r', bm_CKFLOAT),