Created
December 6, 2016 00:56
-
-
Save splinecraft/82c595ce9d1e7db8bde9b3dab6fb9fa7 to your computer and use it in GitHub Desktop.
Set a key at the current frame and delete all other keys on selected controls/object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pymel.core as pm | |
| current_frame = pm.getCurrentTime() | |
| curves = pm.findKeyframe(curve=True) | |
| first_key = 0.0 | |
| last_key = 0.0 | |
| for curve in curves: | |
| key = pm.findKeyframe(curve, which='first') | |
| if key < first_key: | |
| first_key = key | |
| key = pm.findKeyframe(curve, which='last') | |
| if key > last_key: | |
| last_key = key | |
| pm.setKeyframe(insert=True) | |
| pm.cutKey(clear=True, time=(first_key, current_frame-1)) | |
| pm.cutKey(clear=True, time=(current_frame+1, last_key)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment