Results 1 to 3 of 3
  1. #1

    FBX export scene with multitake

    Hello, blender users and coders

    I wonder if there is a way to export complex animated scene from blender to .fbx file with multiple "takes".
    I know that blender .fbx exporter can grab actions from action editor and export it as "takes".
    The problem is that I need to export whole SCENE that has several character rigs as single fbx file where characters (rigs) follow the same animation track at once. Not same per each rig but for the whole scene.
    There are 2 possible options with default fbx (binary) export script:
    export_opt1.png

    with "All Actions" or "NLA Strips" checked I get all animations from each rig, like: Char1.Idle, Char1.Dance, Char1.Idle, Char2.Dance and so on. So when I start animation only one character is moving.

    with "All actions" or "NLA Strips" unchecked I get almost what I want: all characters start moving at once when I play animation, but the problem that I get only one "Scene" animation. And I see no way how to separate this long animation in parts and give it names as it possible for example in Unity:
    unity_takes.png

    I know that it is possible to store such "takes" split from one original animation in fbx file.
    But I donít know the way how to do it.
    Unity can't export back to .fbx. I am also not sure that my blender file can be successfully imported in other 3d software for further exporting to .fbx.
    Does anybody know how to solve this problem with splitting animation of the complex scene in several "takes" and export it like that to .fbx file?

    I found pieces of code in "export_fbx_bin.py" file that seems possible to solve my problem with a bit editing. But I am not very experienced in python and blender API especially, so I have failed in this task.
    code.png

    Are there anybody who is able to make corresponding adjustments to those lines of code?
    Or anybody who can show me another solution for this task?

    Any help would be greatly appreciated



  2. #2
    I solved my problem. I can share my temporary solution.
    I know it is very “unpythonic” and artificial.
    First of all add list of animation takes at the top of “export_fbx_bin.py” in format [“name”, start_frame, end_frame]:
    Code:
    Takes=[['Take01',1,251], ['Take02',251,501], ['Take03',501,751]]
    Then find function “fbx_animations_do” and replace following lines at the end
    Code:
    astack_key = get_blender_anim_stack_key(scene, ref_id)
        alayer_key = get_blender_anim_layer_key(scene, ref_id)
        name = (get_blenderID_name(ref_id) if ref_id else scene.name).encode()
    with this

    Code:
    if ref_id:
            astack_key = get_blender_anim_stack_key(scene, ref_id)
            alayer_key = get_blender_anim_layer_key(scene, ref_id)
        else:
            astack_key = get_blenderID_key(scene) + "|" + Takes[fbx_animations_do.counter][0] + "|AnimStack"
            alayer_key = get_blenderID_key(scene) + "|" + Takes[fbx_animations_do.counter][0] + "|AnimLayer"
        name = (get_blenderID_name(ref_id) if ref_id else scene.name).encode()
        fbx_animations_do.counter+=1
    after function:
    Code:
    fbx_animations_do.counter=0
    now at “def fbx_animations(scene_data)” change following lines:
    Code:
    # Global (containing everything) animstack, only if not exporting NLA strips and/or all actions.
        if not scene_data.settings.bake_anim_use_nla_strips and not scene_data.settings.bake_anim_use_all_actions:
            add_anim(animations, animated, fbx_animations_do(scene_data, None, scene.frame_start, scene.frame_end, False))
    with this:
    Code:
        if not scene_data.settings.bake_anim_use_nla_strips and not scene_data.settings.bake_anim_use_all_actions:
            for take in Takes:
                add_anim(animations, animated, fbx_animations_do(scene_data, None, take[1], take[2], False))

    I tried to save old functionality (export with “All actions” checked) but it seems to be broken.
    Anyway you can export “default scene” animation split in several takes with this script, and restore original one for other purposes.
    Or even better you can change script in correct way if you are more experienced in python and blender API than me )
    Last edited by vetaal; 21-Apr-17 at 03:14.



  3. #3
    I also find problem with original script that if you left "simplify" option on it can remove static animation take from final .fbx file.
    I had one static animation 250 frames long (dont ask me why I need it, it is just eployer claim) and exporter seems to optimize it and throw it away.

    Where is correct forum (if that one is not) to post those 'bugs?' and suggestions so developers could see it?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •