[Bf-extensions-cvs] [efb6a25] fbx_io_development: Arg, forgot to copy over ultimate changes about FBX import of shapes anim... :/
Bastien Montagne
noreply at git.blender.org
Thu Jul 10 21:45:52 CEST 2014
Commit: efb6a259d87ddb73a09b3fbc481478e5035509d6
Author: Bastien Montagne
Date: Thu Jul 10 21:45:20 2014 +0200
https://developer.blender.org/rBAefb6a259d87ddb73a09b3fbc481478e5035509d6
Arg, forgot to copy over ultimate changes about FBX import of shapes anim... :/
===================================================================
M io_scene_fbx/import_fbx.py
===================================================================
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index d4a5378..b2a4a11 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -704,7 +704,7 @@ def blen_read_animations_action_object(action, ob, obpath, grpname, cnodes, glob
fc.update()
-def blen_read_animations_action_shapes(action, kb, cnodes, fps):
+def blen_read_animations_action_shapes(action, kb, curves, fps):
"""
'Bake' shapekeys' value into the action.
"""
@@ -712,9 +712,8 @@ def blen_read_animations_action_shapes(action, kb, cnodes, fps):
kbpath = kb.path_from_id("value")
blen_curves = [action.fcurves.new(kbpath, 0, "Key")]
- for acn_uuid, (curves, fbxprop) in cnodes.items():
- for ac_uuid, ((fbx_acdata, _blen_data), channel) in curves.items():
- fbx_curves.append((fbxprop, channel, fbx_acdata))
+ for ac_uuid, ((fbx_acdata, _blen_data), channel) in curves.items():
+ fbx_curves.append((b'DeformPercent', channel, fbx_acdata))
# We assume for now blen init point is frame 1.0, while FBX ktime init point is 0.
for frame, values in blen_read_animations_curves_iter(fbx_curves, 1.0, 0, fps):
@@ -723,7 +722,7 @@ def blen_read_animations_action_shapes(action, kb, cnodes, fps):
assert(fbxprop == b'DeformPercent')
value = v / 100.0
- for fc, v in zip(blen_curves, tuple(value)):
+ for fc, v in zip(blen_curves, (value,)):
fc.keyframe_points.insert(frame, v, {'NEEDED', 'FAST'}).interpolation = 'LINEAR'
# Since we inserted our keyframes in 'FAST' mode, we have to update the fcurves now.
@@ -758,17 +757,17 @@ def blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene, global
grpname = ob.name
blen_read_animations_action_object(action, ob, obpath, grpname, cnodes, global_matrix, scene.render.fps)
- print(shapes)
- for keyblocks, cnodes in shapes.values():
- for kb in keyblocks:
- id_data = kb.id_data
- key = (as_uuid, al_uuid, id_data)
- action = actions.get(key)
- if action is None:
- action_name = "|".join((id_data.name, stack_name, layer_name))
- actions[key] = action = bpy.data.actions.new(action_name)
- action.use_fake_user = True
- blen_read_animations_action_shapes(action, kb, cnodes, scene.render.fps)
+ for shape_anim_data in shapes.values():
+ for keyblocks, curves in shape_anim_data:
+ for kb in keyblocks:
+ id_data = kb.id_data
+ key = (as_uuid, al_uuid, id_data)
+ action = actions.get(key)
+ if action is None:
+ action_name = "|".join((id_data.name, stack_name, layer_name))
+ actions[key] = action = bpy.data.actions.new(action_name)
+ action.use_fake_user = True
+ blen_read_animations_action_shapes(action, kb, curves, scene.render.fps)
# ----
# Mesh
@@ -1883,8 +1882,6 @@ def load(operator, context, filepath="",
fbx_tmpl_alayer = fbx_template_get((b'AnimationLayer', b'FbxAnimLayer'))
stacks = {}
- print(blend_shape_channels)
-
# AnimationStacks.
for as_uuid, fbx_asitem in fbx_table_nodes.items():
fbx_asdata, _blen_data = fbx_asitem
@@ -1945,8 +1942,8 @@ def load(operator, context, filepath="",
for ob, ob_prop in objs:
# No need to keep curvenode FBX data here, contains nothing useful for us.
objects.setdefault(ob, {})[acn_uuid] = (cnode, ob_prop)
- print(shps)
- shapes[acn_uuid] = [(keyblocks, cnode) for keyblocks in shps]
+ for keyblocks in shps:
+ shapes.setdefault(acn_uuid, []).append((keyblocks, cnode))
# AnimationCurves (real animation data).
for ac_uuid, fbx_acitem in fbx_table_nodes.items():
@@ -1962,7 +1959,7 @@ def load(operator, context, filepath="",
continue
# Note this is an infamous simplification of the compound props stuff,
# seems to be standard naming but we'll probably have to be smarter to handle more exotic files?
- channel = {b'd|X': 0, b'd|Y': 1, b'd|Z': 2, b'DeformPercent': 0}.get(acn_ctype.props[3], None)
+ channel = {b'd|X': 0, b'd|Y': 1, b'd|Z': 2, b'd|DeformPercent': 0}.get(acn_ctype.props[3], None)
if channel is None:
continue
curvenodes[acn_uuid][ac_uuid] = (fbx_acitem, channel)
More information about the Bf-extensions-cvs
mailing list