yaotungyu

cycle filler

Jun 14th, 2021 (edited)
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. tmin = cmds.playbackOptions(q=1,min=1)
  2. tmax = cmds.playbackOptions(q=1,max=1)
  3.  
  4. namespaces = list(set([i.split(':')[0] for i in cmds.ls(sl=1) if ':' in i]))
  5.  
  6.  
  7. _ctrl_ = 'nurbsCircle1'
  8.  
  9. infinity_type = cmds.setInfinity(_ctrl_,attribute='t',q=1,poi=1)[0]
  10.  
  11. first_key = cmds.keyframe(_ctrl_,attribute='tx',q=1)[0]
  12. last_key = cmds.keyframe(_ctrl_,attribute='tx',q=1)[-1]
  13. cycle_length = last_key-first_key
  14.  
  15.  
  16. cmds.copyKey(_ctrl_,t=(first_key,last_key))
  17.  
  18. paste_position = last_key
  19. while paste_position + cycle_length <= tmax + cycle_length:
  20.     cmds.pasteKey(_ctrl_,t=(paste_position,paste_position))
  21.     paste_position += cycle_length
  22.    
  23. paste_position = first_key - cycle_length
  24. while paste_position >= tmin + 30 - cycle_length:
  25.     cmds.pasteKey(_ctrl_,t=(paste_position,paste_position),o='merge')
  26.     paste_position -= cycle_length
  27. #    cmds.pasteKey(_ctrl_,t=(paste_position,paste_position))
Add Comment
Please, Sign In to add comment