diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-11-20 21:44:17 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-11-20 21:44:17 +0300 |
commit | b83c1181425040f1e10d0826bb8e218ed8ee938a (patch) | |
tree | 09f786f1cb66da72cb761d9511c7a02b19d64c0e /io_scene_fbx/import_fbx.py | |
parent | 4a27fce1d15e989dc6fef33d8e68d44bb2d67e75 (diff) |
FBX Import: Long time request/todo: assign first read action to object automatically.
This does by no mean handle complex setups, but most common basic situations
should be read correctly, and it's much more user-friendly!
Diffstat (limited to 'io_scene_fbx/import_fbx.py')
-rw-r--r-- | io_scene_fbx/import_fbx.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py index fdf6b9b5..d821672d 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -587,7 +587,8 @@ def blen_read_animations_action_item(action, item, cnodes, fps): def blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene): """ Recreate an action per stack/layer/object combinations. - Note actions are not linked to objects, this is up to the user! + Only the first found action is linked to objects, more complex setups are not handled, + it's up to user to reproduce them! """ from bpy.types import ShapeKey @@ -603,12 +604,19 @@ def blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene): id_data = item.bl_obj if id_data is None: continue + # Create new action if needed (should always be needed! 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 + # If none yet assigned, assign this action to id_data. + if not id_data.animation_data: + id_data.animation_data_create() + if not id_data.animation_data.action: + id_data.animation_data.action = action + # And actually populate the action! blen_read_animations_action_item(action, item, cnodes, scene.render.fps) |