Fix T54354: FBX addon fails on "blen_read_shape" for fome fbx files.

Code would break on empty shapekey names, and was actually broken in
all cases where Blender would have to alter the shapekey name when
creating it.
This commit is contained in:
Bastien Montagne 2018-03-19 16:23:36 +01:00
parent fbc03fdd10
commit 0f1b2e7ea7
Notes: blender-bot 2023-02-14 19:31:00 +01:00
Referenced by issue #54354, FBX addon fails on "blen_read_shape" for fome fbx files
2 changed files with 4 additions and 5 deletions

View File

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

View File

@ -1298,18 +1298,17 @@ def blen_read_shape(fbx_tmpl, fbx_sdata, fbx_bcdata, meshes, scene):
if me.shape_keys is None:
objects[0].shape_key_add(name="Basis", from_mix=False)
objects[0].shape_key_add(name=elem_name_utf8, from_mix=False)
kb = objects[0].shape_key_add(name=elem_name_utf8, from_mix=False)
me.shape_keys.use_relative = True # Should already be set as such.
kb = me.shape_keys.key_blocks[elem_name_utf8]
for idx, co in vcos:
kb.data[idx].co[:] = co
kb.value = weight
# Add vgroup if necessary.
if create_vg:
add_vgroup_to_objects(indices, vgweights, elem_name_utf8, objects)
kb.vertex_group = elem_name_utf8
vgoups = add_vgroup_to_objects(indices, vgweights, kb.name, objects)
kb.vertex_group = kb.name
keyblocks.append(kb)