[Bf-extensions-cvs] [d0425df] master: FBX Import: Fix cornercase where some files only have one weight in case it's the same for all vertices...

Bastien Montagne noreply at git.blender.org
Wed Jul 30 15:08:14 CEST 2014


Commit: d0425df1ef2f868bffbe09b551c2af5213b5c67c
Author: Bastien Montagne
Date:   Wed Jul 30 15:07:04 2014 +0200
Branches: master
https://developer.blender.org/rBAd0425df1ef2f868bffbe09b551c2af5213b5c67c

FBX Import: Fix cornercase where some files only have one weight in case it's the same for all vertices...

Issue found by jrestemeier (Jens Restemeier), thanks!

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

M	io_scene_fbx/import_fbx.py

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

diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 6caffbf..71641c1 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1153,7 +1153,12 @@ def blen_read_shape(fbx_tmpl, fbx_sdata, fbx_bcdata, meshes, scene, global_matri
     weight = elem_prop_first(elem_find_first(fbx_bcdata, b'DeformPercent'), default=100.0) / 100.0
     vgweights = tuple(vgw / 100.0 for vgw in elem_prop_first(elem_find_first(fbx_bcdata, b'FullWeights'), default=()))
 
-    assert(len(vgweights) == len(indices) == len(dvcos))
+    # Special case, in case all weights are the same, FullWeight can have only one element - *sigh!*
+    nbr_indices = len(indices)
+    if len(vgweights) == 1 and nbr_indices > 1:
+        vgweights = (vgweights[0],) * nbr_indices
+
+    assert(len(vgweights) == nbr_indices == len(dvcos))
     create_vg = bool(set(vgweights) - {1.0})
 
     keyblocks = []



More information about the Bf-extensions-cvs mailing list