Welcome to this new blog post!
Today we are going to have a look at how you can use the animation rig retargeting feature to build your layout scenes.
Widget Connector width 900 url https://www.youtube.com/watch?v=S7_e69pSzfQ&feature=youtu.be height 600
...
Please find below the script used in the video:
Code Block | ||||
---|---|---|---|---|
| ||||
import AtomsMaya
import tempfile
# parameters for the script
node = "tcAgentGroupNode1"
rig_scene = "C:/projects/atomsDemo/scenes/labrador.mb"
start = 1
end = 50
# find the agent ids, if no agent is selected we use all the agents
ids = cmds.getAttr("%s.agentSelection" % node)
if not ids:
ids = list(range(len(AtomsMaya.getAgentGroup(node).agents())))
# exporting the fbxs
_, temp_fbx = tempfile.mkstemp('.fbx')
for i in ids:
cmds.tcAtomsFbxExporter(fileName=temp_fbx, agentGroup=node, agentId=ids, frameStart=start, frameEnd=end)
# retargeting the fbxs on the animation rig
ma_files = []
for i in ids:
_, temp_ma = tempfile.mkstemp('.ma')
# the fbx exporter create fbx files with 4 digit padding
file_path = temp_fbx.replace(".fbx", "%04d.fbx" % i)
print file_path
cmds.file(rig_scene, o=True, f=True)
cmds.tcAnimationRigRetarget(fileName=file_path)
# saving the file to a different temp location
cmds.file(rn=temp_ma)
cmds.file(save=True)
ma_files.append(temp_ma)
# importing all the retargeted character in a brand new scene
cmds.file(new=True, f=True)
for m in ma_files:
cmds.file(m, i=True)
|