Merge pull request #1214 from assimp/issue_1211
closes https://github.com/assimp/assimp/issues/1211: defensice handlingpull/1217/head
commit
63485bdd26
|
@ -119,7 +119,8 @@ def _init(self, target = None, parent = None):
|
||||||
|
|
||||||
if m == 'mName':
|
if m == 'mName':
|
||||||
obj = self.mName
|
obj = self.mName
|
||||||
target.name = str(obj.data.decode("utf-8"))
|
uni = unicode(obj.data, errors='ignore')
|
||||||
|
target.name = str( uni )
|
||||||
target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + x.name + ")"
|
target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + x.name + ")"
|
||||||
target.__class__.__str__ = lambda x: x.name
|
target.__class__.__str__ = lambda x: x.name
|
||||||
continue
|
continue
|
||||||
|
@ -439,7 +440,8 @@ def _get_properties(properties, length):
|
||||||
for p in [properties[i] for i in range(length)]:
|
for p in [properties[i] for i in range(length)]:
|
||||||
#the name
|
#the name
|
||||||
p = p.contents
|
p = p.contents
|
||||||
key = (str(p.mKey.data.decode("utf-8")).split('.')[1], p.mSemantic)
|
uni = unicode(p.mKey.data, errors='ignore')
|
||||||
|
key = (str(uni).split('.')[1], p.mSemantic)
|
||||||
|
|
||||||
#the data
|
#the data
|
||||||
from ctypes import POINTER, cast, c_int, c_float, sizeof
|
from ctypes import POINTER, cast, c_int, c_float, sizeof
|
||||||
|
@ -447,7 +449,9 @@ def _get_properties(properties, length):
|
||||||
arr = cast(p.mData, POINTER(c_float * int(p.mDataLength/sizeof(c_float)) )).contents
|
arr = cast(p.mData, POINTER(c_float * int(p.mDataLength/sizeof(c_float)) )).contents
|
||||||
value = [x for x in arr]
|
value = [x for x in arr]
|
||||||
elif p.mType == 3: #string can't be an array
|
elif p.mType == 3: #string can't be an array
|
||||||
value = cast(p.mData, POINTER(structs.MaterialPropertyString)).contents.data.decode("utf-8")
|
uni = unicode(cast(p.mData, POINTER(structs.MaterialPropertyString)).contents.data, errors='ignore')
|
||||||
|
value = uni
|
||||||
|
|
||||||
elif p.mType == 4:
|
elif p.mType == 4:
|
||||||
arr = cast(p.mData, POINTER(c_int * int(p.mDataLength/sizeof(c_int)) )).contents
|
arr = cast(p.mData, POINTER(c_int * int(p.mDataLength/sizeof(c_int)) )).contents
|
||||||
value = [x for x in arr]
|
value = [x for x in arr]
|
||||||
|
|
Loading…
Reference in New Issue