View Single Post
# 2 21-10-2017 , 01:59 AM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
Run this code in a Python tab. The "2" popping up throughout the code just means that while looping through the list, it will act on every other item, essentially its your "nth item" value. Let me know if there are any issues.

Code:
import maya.cmds as mc

object = mc.ls(selection =True)[0]
keys = mc.keyframe(object, query =True)

i = 0
while i < len(keys):
	mc.selectKey(object, k =True, time = (keys[i], keys[i]), add =True)
	i = i+2
print "Selected " + str(len(keys[::2])) + " keys: ", str(keys[::2])


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::