/
Crowd to layout

Crowd to layout

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.



Please find below the script used in the video:

import AtomsMaya
import tempfile

# parameters for the script
node = "tcAgentGroupNode1"
rig_scene = "/path/to/rig"
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)
    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 characters in a brand new scene
cmds.file(new=True, f=True)
for m in ma_files:
    cmds.file(m, i=True)
    
    

Related content

Animation Rig Retargeting (Maya Only)
Animation Rig Retargeting (Maya Only)
More like this
Fbx exporter
More like this
Alembic exporter (AtomsUnreal)
Alembic exporter (AtomsUnreal)
More like this
Animation export - Houdini
Animation export - Houdini
More like this
Fbx exporter (AtomsUnreal)
Fbx exporter (AtomsUnreal)
More like this
Animation export
More like this

Copyright © 2017, Toolchefs LTD.