Skip to content

Instantly share code, notes, and snippets.

@baku89
Created December 5, 2015 04:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baku89/e17253586682e4210631 to your computer and use it in GitHub Desktop.
Save baku89/e17253586682e4210631 to your computer and use it in GitHub Desktop.
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