Rokoko / rokoko-studio-live-blender

Rokoko Studio Live plugin for Blender
GNU Lesser General Public License v3.0
326 stars 38 forks source link

Batch Retarget animations #77

Closed MediaMoots closed 2 years ago

MediaMoots commented 2 years ago

I have a bunch of FBX animations (100~) that I would like to retarget, would it be possible to make a batch retarget feature?

Thanks.

MediaMoots commented 2 years ago

Made a script to retarget all Armatures in the Source collection to the Armature in the Target collection.

Make sure to first set the bone name retargets on a sample animation, then save that list.

import bpy

targetCollection = bpy.data.collections['Target']
targetArmature = targetCollection.objects['Armature']

sourceCollection = bpy.data.collections['Source']
sourceArmatures = sourceCollection.objects

for src in sourceArmatures:
    try:
        if src.type == 'ARMATURE':
            bpy.data.scenes["Scene"].rsl_retargeting_armature_target = targetArmature
            bpy.data.scenes["Scene"].rsl_retargeting_armature_source = src
            bpy.ops.rsl.build_bone_list()
            bpy.ops.rsl.retarget_animation()
    except:
        print('Error')
        pass