Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-01-22 11:52:33 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-01-22 13:09:28 +0300
commit5804465558100a079aa19680928824d2dbcdd63f (patch)
tree2d035725c25b8e6d4bd01969abc770f2aeb7531c
parent80a53718a56a3639da42f6cc8ebd884bc625dec8 (diff)
Fix T53841: Can not import .obj or .fbx generated from Marvelous Designer
FBX part at least - note that we are actualy coping with totally invalid FBX file, strings there should always be in utf-8 encoding as per offcial FBX doc... But this error-handling does not hurt really. Based in D3012 by Philipp Oeser (@lichtwerk). To be backported to 2.79a.
-rw-r--r--io_scene_fbx/__init__.py2
-rw-r--r--io_scene_fbx/import_fbx.py16
2 files changed, 9 insertions, 9 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 0521d616..55200d13 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
- "version": (3, 7, 16),
+ "version": (3, 7, 17),
"blender": (2, 79, 0),
"location": "File > Import-Export",
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 17f27c64..ca2f7710 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -82,7 +82,7 @@ def elem_find_first_string(elem, id_search):
if fbx_item is not None and fbx_item.props: # Do not error on complete empty properties (see T45291).
assert(len(fbx_item.props) == 1)
assert(fbx_item.props_type[0] == data_types.STRING)
- return fbx_item.props[0].decode('utf-8')
+ return fbx_item.props[0].decode('utf-8', 'replace')
return None
@@ -124,14 +124,14 @@ def elem_name_ensure_class(elem, clss=...):
elem_name, elem_class = elem_split_name_class(elem)
if clss is not ...:
assert(elem_class == clss)
- return elem_name.decode('utf-8')
+ return elem_name.decode('utf-8', 'replace')
def elem_name_ensure_classes(elem, clss=...):
elem_name, elem_class = elem_split_name_class(elem)
if clss is not ...:
assert(elem_class in clss)
- return elem_name.decode('utf-8')
+ return elem_name.decode('utf-8', 'replace')
def elem_split_name_class_nodeattr(elem):
@@ -308,13 +308,13 @@ def blen_read_custom_properties(fbx_obj, blen_obj, settings):
# Special case for 3DS Max user properties:
assert(fbx_prop.props[1] == b'KString')
assert(fbx_prop.props_type[4] == data_types.STRING)
- items = fbx_prop.props[4].decode('utf-8')
+ items = fbx_prop.props[4].decode('utf-8', 'replace')
for item in items.split('\r\n'):
if item:
prop_name, prop_value = item.split('=', 1)
blen_obj[prop_name.strip()] = prop_value.strip()
else:
- prop_name = fbx_prop.props[0].decode('utf-8')
+ prop_name = fbx_prop.props[0].decode('utf-8', 'replace')
prop_type = fbx_prop.props[1]
if prop_type in {b'Vector', b'Vector3D', b'Color', b'ColorRGB'}:
assert(fbx_prop.props_type[4:7] == bytes((data_types.FLOAT64,)) * 3)
@@ -330,7 +330,7 @@ def blen_read_custom_properties(fbx_obj, blen_obj, settings):
blen_obj[prop_name] = fbx_prop.props[4]
elif prop_type == b'KString':
assert(fbx_prop.props_type[4] == data_types.STRING)
- blen_obj[prop_name] = fbx_prop.props[4].decode('utf-8')
+ blen_obj[prop_name] = fbx_prop.props[4].decode('utf-8', 'replace')
elif prop_type in {b'Number', b'double', b'Double'}:
assert(fbx_prop.props_type[4] == data_types.FLOAT64)
blen_obj[prop_name] = fbx_prop.props[4]
@@ -344,13 +344,13 @@ def blen_read_custom_properties(fbx_obj, blen_obj, settings):
assert(fbx_prop.props_type[4:6] == bytes((data_types.INT32, data_types.STRING)))
val = fbx_prop.props[4]
if settings.use_custom_props_enum_as_string and fbx_prop.props[5]:
- enum_items = fbx_prop.props[5].decode('utf-8').split('~')
+ enum_items = fbx_prop.props[5].decode('utf-8', 'replace').split('~')
assert(val >= 0 and val < len(enum_items))
blen_obj[prop_name] = enum_items[val]
else:
blen_obj[prop_name] = val
else:
- print ("WARNING: User property type '%s' is not supported" % prop_type.decode('utf-8'))
+ print ("WARNING: User property type '%s' is not supported" % prop_type.decode('utf-8', 'replace'))
def blen_read_object_transform_do(transform_data):