I imported actions from another application into Blender. Unfortunately, the import created a key frame for every frame. There are so many key frames, that my computer can barely load the file, much less allow me to edit the actions. I want to delete every 3rd keyframe using a python script. How would I go about this?
I have gotten access to the action by doing:
actions = Armature.NLA.GetActions()
print actions
print actions[‘HugeAction’]
But I do not see how I access the key frame data associated with that action. Any help would be appreciated.
Thanks!
In case anyone else tried to achieve this, here is how I eventually did it:
def main() :
eul = 0.001
actions=Armature.NLA.GetActions()
defaultAction = actions['DefaultAction']
sce = Scene.GetCurrent()
context = sce.getRenderingContext()
fs = context.sFrame
fe = context.eFrame
fc = context.currentFrame()
#for i in range(1, 40):
# context.currentFrame(i)
# Blender.Window.RedrawAll()
channelStartIndex = 10
channelEndIndex = 13
channelsComplete = -1
for name in defaultAction.getChannelNames() :
channelsComplete +=1
print "%d:%s" % (channelsComplete, name)
if channelsComplete < channelStartIndex :
continue
for curve in defaultAction.getChannelIpo(name).curves :
print " Name:%s Points:%d" % (curve.name, len(curve.bezierPoints))
delete = False
bezIndex = 0
for bPoint in curve.bezierPoints :
print " BPoint:%d %d " % (bPoint.pt[0], bPoint.pt[1])
delete = not delete
if delete :
curve.delBezier(bezIndex)
else :
bezIndex += 1
if channelsComplete > channelEndIndex :
return
if name == ‘main’:
main()