diff --git a/port/PyAssimp/pyassimp/core.py b/port/PyAssimp/pyassimp/core.py index c781f27c9..ca6d8629a 100644 --- a/port/PyAssimp/pyassimp/core.py +++ b/port/PyAssimp/pyassimp/core.py @@ -366,16 +366,14 @@ def export_blob(scene, --------- Pointer to structs.ExportDataBlob ''' - from ctypes import pointer - exportBlobPtr = _assimp_lib.export_blob(pointer(scene), file_type.encode("ascii"), processing) + exportBlobPtr = _assimp_lib.export_blob(ctypes.pointer(scene), file_type.encode("ascii"), processing) if exportBlobPtr == 0: raise AssimpError('Could not export scene to blob!') return exportBlobPtr def release(scene): - from ctypes import pointer - _assimp_lib.release(pointer(scene)) + _assimp_lib.release(ctypes.pointer(scene)) def _finalize_texture(tex, target): setattr(target, "achformathint", tex.achFormatHint) @@ -439,24 +437,22 @@ def _finalize_mesh(mesh, target): setattr(target, 'faces', faces) def _init_metadata_entry(entry): - from ctypes import POINTER, c_bool, c_int32, c_uint64, c_float, c_double, cast - entry.type = entry.mType if entry.type == structs.MetadataEntry.AI_BOOL: - entry.data = cast(entry.mData, POINTER(c_bool)).contents.value + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_bool)).contents.value elif entry.type == structs.MetadataEntry.AI_INT32: - entry.data = cast(entry.mData, POINTER(c_int32)).contents.value + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_int32)).contents.value elif entry.type == structs.MetadataEntry.AI_UINT64: - entry.data = cast(entry.mData, POINTER(c_uint64)).contents.value + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_uint64)).contents.value elif entry.type == structs.MetadataEntry.AI_FLOAT: - entry.data = cast(entry.mData, POINTER(c_float)).contents.value + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_float)).contents.value elif entry.type == structs.MetadataEntry.AI_DOUBLE: - entry.data = cast(entry.mData, POINTER(c_double)).contents.value + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_double)).contents.value elif entry.type == structs.MetadataEntry.AI_AISTRING: - assimp_string = cast(entry.mData, POINTER(structs.String)).contents + assimp_string = ctypes.cast(entry.mData, ctypes.POINTER(structs.String)).contents entry.data = _convert_assimp_string(assimp_string) elif entry.type == structs.MetadataEntry.AI_AIVECTOR3D: - assimp_vector = cast(entry.mData, POINTER(structs.Vector3D)).contents + assimp_vector = ctypes.cast(entry.mData, ctypes.POINTER(structs.Vector3D)).contents entry.data = make_tuple(assimp_vector) return entry @@ -510,15 +506,18 @@ def _get_properties(properties, length): key = (key.split('.')[1], p.mSemantic) #the data - from ctypes import POINTER, cast, c_int, c_float, sizeof if p.mType == 1: - arr = cast(p.mData, POINTER(c_float * int(p.mDataLength/sizeof(c_float)) )).contents + arr = ctypes.cast(p.mData, + ctypes.POINTER(ctypes.c_float * int(p.mDataLength/ctypes.sizeof(ctypes.c_float))) + ).contents value = [x for x in arr] elif p.mType == 3: #string can't be an array - value = _convert_assimp_string(cast(p.mData, POINTER(structs.MaterialPropertyString)).contents) + value = _convert_assimp_string(ctypes.cast(p.mData, ctypes.POINTER(structs.MaterialPropertyString)).contents) elif p.mType == 4: - arr = cast(p.mData, POINTER(c_int * int(p.mDataLength/sizeof(c_int)) )).contents + arr = ctypes.cast(p.mData, + ctypes.POINTER(ctypes.c_int * int(p.mDataLength/ctypes.sizeof(ctypes.c_int))) + ).contents value = [x for x in arr] else: value = p.mData[:p.mDataLength] @@ -538,7 +537,9 @@ def decompose_matrix(matrix): rotation = structs.Quaternion() position = structs.Vector3D() - from ctypes import byref, pointer - _assimp_lib.dll.aiDecomposeMatrix(pointer(matrix), byref(scaling), byref(rotation), byref(position)) + _assimp_lib.dll.aiDecomposeMatrix(ctypes.pointer(matrix), + ctypes.byref(scaling), + ctypes.byref(rotation), + ctypes.byref(position)) return scaling._init(), rotation._init(), position._init() diff --git a/scripts/StepImporter/CppGenerator.py b/scripts/StepImporter/CppGenerator.py index f081d882a..b9dba9902 100644 --- a/scripts/StepImporter/CppGenerator.py +++ b/scripts/StepImporter/CppGenerator.py @@ -151,10 +151,7 @@ def handle_unset_args(field,entity,schema,argnum): return n+template_allow_optional.format() def get_single_conversion(field,schema,argnum=0,classname='?'): - typen = field.type name = field.name - if field.collection: - typen = 'LIST' return template_convert_single.format(name=name,argnum=argnum,classname=classname,full_type=field.fullspec) def count_args_up(entity,schema):