port/PyAssimp/pyassimp/core.py: convert_assimp_string now switches on
version instead of just catching the exception if unicode is not defined & _init_face uses is None instead of == Nonepull/2392/head
parent
ee79ac0f17
commit
1614b7bea4
|
@ -65,10 +65,10 @@ def make_tuple(ai_obj, type = None):
|
||||||
|
|
||||||
# Returns unicode object for Python 2, and str object for Python 3.
|
# Returns unicode object for Python 2, and str object for Python 3.
|
||||||
def _convert_assimp_string(assimp_string):
|
def _convert_assimp_string(assimp_string):
|
||||||
try:
|
if sys.version_info >= (3, 0):
|
||||||
return unicode(assimp_string.data, errors='ignore')
|
|
||||||
except UnicodeError:
|
|
||||||
return str(assimp_string.data, errors='ignore')
|
return str(assimp_string.data, errors='ignore')
|
||||||
|
else:
|
||||||
|
return unicode(assimp_string.data, errors='ignore')
|
||||||
|
|
||||||
# It is faster and more correct to have an init function for each assimp class
|
# It is faster and more correct to have an init function for each assimp class
|
||||||
def _init_face(aiFace):
|
def _init_face(aiFace):
|
||||||
|
@ -303,7 +303,7 @@ def load(filename,
|
||||||
# unsigned int pLength,
|
# unsigned int pLength,
|
||||||
# unsigned int pFlags,
|
# unsigned int pFlags,
|
||||||
# const char* pHint)
|
# const char* pHint)
|
||||||
if file_type == None:
|
if file_type is None:
|
||||||
raise AssimpError('File type must be specified when passing file objects!')
|
raise AssimpError('File type must be specified when passing file objects!')
|
||||||
data = filename.read()
|
data = filename.read()
|
||||||
model = _assimp_lib.load_mem(data,
|
model = _assimp_lib.load_mem(data,
|
||||||
|
|
Loading…
Reference in New Issue