Fix T45291: empty bytes/string nodes seems to be valid... *sigh*

This commit is contained in:
Bastien Montagne 2015-07-03 16:54:26 +02:00
parent 318e225c69
commit 7937fe22df
Notes: blender-bot 2023-02-14 19:55:22 +01:00
Referenced by issue #45291, Import fbx in Blender get Error
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
"version": (3, 4, 1),
"version": (3, 4, 2),
"blender": (2, 74, 0),
"location": "File > Import-Export",
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",

View File

@ -76,7 +76,7 @@ def elem_find_iter(elem, id_search):
def elem_find_first_string(elem, id_search):
fbx_item = elem_find_first(elem, id_search)
if fbx_item is not None:
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')
@ -85,7 +85,7 @@ def elem_find_first_string(elem, id_search):
def elem_find_first_string_as_bytes(elem, id_search):
fbx_item = elem_find_first(elem, id_search)
if fbx_item is not None:
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] # Keep it as bytes as requested...
@ -94,7 +94,7 @@ def elem_find_first_string_as_bytes(elem, id_search):
def elem_find_first_bytes(elem, id_search, decode=True):
fbx_item = elem_find_first(elem, id_search)
if fbx_item is not None:
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.BYTES)
return fbx_item.props[0]