Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Count keyframes of active document
from c4d import gui
import shutil
num = 0
def countObjectKeyframe(obj):
global num
tracks = obj.GetCTracks()
for track in tracks:
curve = track.GetCurve()
num += curve.GetKeyCount()
for tag in obj.GetTags():
for track in tag.GetCTracks():
num += track.GetCurve().GetKeyCount()
for child in obj.GetChildren():
countObjectKeyframe(child)
def countMaterialKeyframe(mat):
pass
def main():
global num
for obj in doc.GetObjects():
countObjectKeyframe(obj)
for mat in doc.GetMaterials():
countMaterialKeyframe(mat)
gui.MessageDialog("Keyframe Count: %d" % num)
if __name__=='__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment