Browse Source

Bugfix: Non-animated bones were using first available animation channel

Not every bone has an animation channel
Robert Carnecky 12 years ago
parent
commit
e94945d593

+ 6 - 5
utils/exporters/blender/2.66/scripts/addons/io_mesh_threejs/export_threejs.py

@@ -1042,16 +1042,17 @@ def rotation(bone, frame, action, armatureMatrix):
 
     if ngroups > 0:
 
-        index = 0
+        index = -1
 
         for i in range(ngroups):
             if action.groups[i].name == bone.name:
                 index = i
 
-        for channel in action.groups[index].channels:
-            if "quaternion" in channel.data_path:
-                hasChanged = handle_rotation_channel(channel, frame, rotation)
-                change = change or hasChanged
+        if index > -1:
+            for channel in action.groups[index].channels:
+                if "quaternion" in channel.data_path:
+                    hasChanged = handle_rotation_channel(channel, frame, rotation)
+                    change = change or hasChanged
 
     # animation in raw fcurves