Advertisement
yaotungyu

key finder

Nov 25th, 2020 (edited)
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. cmds.file(q=1,exn=1)
  2.  
  3. cmds.lis
  4.  
  5. cmds.ls(type='reference')
  6.  
  7. detection_dict = {}
  8. for ac in  cmds.listConnections('Robot_Boomer_01RN.placeHolderList',type='animCurve'):
  9.     detection_dict[ac]=detect_stray_changes(ac)
  10. [a for a in detection_dict if detection_dict[a]==True]
  11. def detect_stray_changes(ctrl):
  12.     key_locs = []
  13.     tmin = cmds.playbackOptions(q=1,min=1)
  14.     cmds.currentTime(tmin,update=0)
  15.     next_key = cmds.findKeyframe( ctrl ,timeSlider=True, which="next" )
  16.     while next_key not in key_locs:
  17.         key_locs.append(next_key)
  18.         cmds.currentTime(next_key,update=0)
  19.         next_key = cmds.findKeyframe( ctrl ,timeSlider=True, which="next" )
  20.    
  21.     no_change=False
  22.     for key in key_locs:
  23.         if 'scale' in ctrl:
  24.             pass
  25.         else:
  26.             if cmds.getAttr(ctrl+'.output'    )!=0:
  27.                 no_change=True
  28.     return no_change
  29.    
  30.    
  31.    
  32. aa = cmds.keyframe('COG_gimbal_Ctrl_rotateX',iv=1,q=1)
  33. cmds.keyframe('COG_gimbal_Ctrl_rotateX',index=tuple(aa))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement