cwisbg

Animation Offset

Apr 9th, 2015
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. # Animation Offset
  2. # Select mesh and run
  3. #
  4. duplicates = 1
  5. #
  6. from pymel.core import *
  7. sl = selected()
  8. for s in sl:
  9.     skin = listConnections(s.inMesh)
  10.     for d in range(0,duplicates):
  11.         name = s+"_duper"
  12.         dup = duplicate(s,n=name)
  13.         timeOff = createNode("timeOffset")
  14.         rename(timeOff, name+"_timeOffset")
  15.         skin[0].outputGeometry[0] >> timeOff.inGeometry;
  16.         timeOff.outGeometry >> dup[0].inMesh;
  17.         addAttr(dup,ln="animationOffset",at="double",min=1,max=30,dv=1)
  18.         setAttr(dup[0].animationOffset,e=1, keyable=1)
  19.         offsetter = d+1
  20.         setAttr(dup[0].animationOffset,offsetter)
  21.         adder = dup[0]+".animationOffset;"
  22.         print adder
  23.         expression(string=timeOff+".time = time*30+"+adder)
  24.         unLockList = [".tx",".ty",".tz",".rx",".ry",".rz",".sx",".sy",".sz"]
  25.         for un in unLockList:
  26.             setAttr(dup[0]+un,lock=0)
Advertisement
Add Comment
Please, Sign In to add comment