Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Problem:
- keyframes from camera tx, ty, tz, rx, ry, rz ranging from 1001 to 1195
- need to have their timing remapped, such that the new timing is sped up by 2x
- thus, the formula where kT = original frame, is ((kT - 1001) * 0.5) + 1001
- This will give us new keyframes from frames 1001 - 1098.
- New frame range after re-speed is 1001 - 1093, we just truncate frames 1094 - 1098.
- '''
- from pymel.core import *
- kfList = listConnections('VFX_0081_8220_Cam', plugs=False, type='animCurve')
- for kf in kfList:
- print ('kf is {}'.format(kf))
- # keyframe(kf, q=True, a=True, tc=True, vc=True) gets a list of key time/value tuples.
- for idx, k in enumerate(keyframe(kf, q=True, a=True, tc=True, vc=True)):
- print 'idx is {}, keyframe is {}'.format(idx, repr(k))
- kTime = k[0]
- kTimeNew = ((kTime - 1001) * 0.5) + 1001
- print 'new time is {}'.format(kTimeNew)
- keyframe(kf, e=True, index=idx, a=True, tc=kTimeNew)
- print keyframe(kf, q=True, index=idx, tc=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement