[Bf-extensions-cvs] [4dbe344d] blender2.8: Fix FBX import of armatures.

Bastien Montagne noreply at git.blender.org
Mon Sep 24 14:51:21 CEST 2018


Commit: 4dbe344d05248c6df35aa53a99b0c76b29089997
Author: Bastien Montagne
Date:   Mon Sep 24 11:25:14 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBA4dbe344d05248c6df35aa53a99b0c76b29089997

Fix FBX import of armatures.

Some typos, and missing named parameters...

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

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 6b83387d..92817fa2 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": (4, 10, 2),
+    "version": (4, 10, 3),
     "blender": (2, 80, 0),
     "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 ee569f28..444ebbf9 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -457,7 +457,7 @@ def add_vgroup_to_objects(vg_indices, vg_weights, vg_name, objects):
             # We replace/override here...
             vg = obj.vertex_groups.get(vg_name)
             if vg is None:
-                vg = obj.vertex_groups.new(vg_name)
+                vg = obj.vertex_groups.new(name=vg_name)
             for i, w in zip(vg_indices, vg_weights):
                 vg.add((i,), w, 'REPLACE')
 
@@ -601,7 +601,7 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
         else:  # Euler
             props[1] = (bl_obj.path_from_id("rotation_euler"), 3, grpname or "Euler Rotation")
 
-    blen_curves = [action.fcurves.new(prop, channel, grpname)
+    blen_curves = [action.fcurves.new(prop, index=channel, action_group=grpname)
                    for prop, nbr_channels, grpname in props for channel in range(nbr_channels)]
 
     if isinstance(item, Material):
@@ -613,7 +613,7 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
                 value[channel] = v
 
             for fc, v in zip(blen_curves, value):
-                fc.keyframe_points.insert(frame, v, {'NEEDED', 'FAST'}).interpolation = 'LINEAR'
+                fc.keyframe_points.insert(frame, v, options={'NEEDED', 'FAST'}).interpolation = 'LINEAR'
 
     elif isinstance(item, ShapeKey):
         for frame, values in blen_read_animations_curves_iter(fbx_curves, anim_offset, 0, fps):
@@ -624,7 +624,7 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
                 value = v / 100.0
 
             for fc, v in zip(blen_curves, (value,)):
-                fc.keyframe_points.insert(frame, v, {'NEEDED', 'FAST'}).interpolation = 'LINEAR'
+                fc.keyframe_points.insert(frame, v, options={'NEEDED', 'FAST'}).interpolation = 'LINEAR'
 
     elif isinstance(item, Camera):
         for frame, values in blen_read_animations_curves_iter(fbx_curves, anim_offset, 0, fps):
@@ -635,7 +635,7 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
                 value = v
 
             for fc, v in zip(blen_curves, (value,)):
-                fc.keyframe_points.insert(frame, v, {'NEEDED', 'FAST'}).interpolation = 'LINEAR'
+                fc.keyframe_points.insert(frame, v, options={'NEEDED', 'FAST'}).interpolation = 'LINEAR'
 
     else:  # Object or PoseBone:
         if item.is_bone:
@@ -686,7 +686,7 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
                 rot = rot.to_euler(rot_mode, rot_prev)
                 rot_prev = rot
             for fc, value in zip(blen_curves, chain(loc, rot, sca)):
-                fc.keyframe_points.insert(frame, value, {'NEEDED', 'FAST'}).interpolation = 'LINEAR'
+                fc.keyframe_points.insert(frame, value, options={'NEEDED', 'FAST'}).interpolation = 'LINEAR'
 
     # Since we inserted our keyframes in 'FAST' mode, we have to update the fcurves now.
     for fc in blen_curves:
@@ -1987,7 +1987,7 @@ class FbxImportHelperNode:
 
             # instance in scene
             view_layer.collections.active.collection.objects.link(obj)
-            obj.select_set('Select')
+            obj.select_set('SELECT')
 
             return obj
 
@@ -2114,12 +2114,12 @@ class FbxImportHelperNode:
 
             # instance in scene
             view_layer.collections.active.collection.objects.link(arm)
-            obj.select_set('Select')
+            arm.select_set('SELECT')
 
             # Add bones:
 
             # Switch to Edit mode.
-            scene.objects.active = arm
+            view_layer.objects.active = arm
             is_hidden = arm.hide_viewport
             arm.hide_viewport = False  # Can't switch to Edit mode hidden objects...
             bpy.ops.object.mode_set(mode='EDIT')



More information about the Bf-extensions-cvs mailing list