Created
December 5, 2015 04:33
-
-
Save baku89/e17253586682e4210631 to your computer and use it in GitHub Desktop.
Count keyframes of active document
This file contains 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
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