[Bf-extensions-cvs] [0f1b2e7e] master: Fix T54354: FBX addon fails on "blen_read_shape" for fome fbx files.

Bastien Montagne noreply at git.blender.org
Mon Mar 19 16:24:48 CET 2018


Commit: 0f1b2e7ea7a5b957f39fd5e41ae96ae288323b25
Author: Bastien Montagne
Date:   Mon Mar 19 16:23:36 2018 +0100
Branches: master
https://developer.blender.org/rBA0f1b2e7ea7a5b957f39fd5e41ae96ae288323b25

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.

===================================================================

M	io_scene_fbx/__init__.py
M	io_scene_fbx/import_fbx.py

===================================================================

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 948d9cb4..9611cb1f 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, 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",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index c0d7b758..446be0ff 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -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)



More information about the Bf-extensions-cvs mailing list