Scott Ayers
09-20-2010, 10:26 PM
I've started to convert some of my Coffee time line stuff. And one of the things I can't figure out is how to update(refresh) the time line after I've made key changes to the curves.
EventAdd() causes the script to re-run and add keys when I don't want to add them.
So I need another way to refresh the time line at the end of my scripts.
Here's a little example that adds a new key to a curve when I execute the script.
But the new key doesn't show up until I manually move the scrubber: import c4d
def main():
obj = doc.SearchObject("Cube") #Find this object
track = obj.GetFirstCTrack() #Get it's first animation track
if not track: return # if it doesn't have any tracks. End the script
curve = track.GetCurve() #Get the curve for the track found
count = curve.GetKeyCount() #Count how many keys are on it
time = doc.GetTime() #Get the time
frame = time.GetFrame(doc.GetFps()) #Get the FPS
#Adds a new key for the first track. Where the scrubber is located
added = curve.AddKey(time)
print count #prints the total number of keys in the first track
Does anyone know how to force the time line to update in Python so any changes show up immediately without having to do any scrubbing?
-ScottA
EventAdd() causes the script to re-run and add keys when I don't want to add them.
So I need another way to refresh the time line at the end of my scripts.
Here's a little example that adds a new key to a curve when I execute the script.
But the new key doesn't show up until I manually move the scrubber: import c4d
def main():
obj = doc.SearchObject("Cube") #Find this object
track = obj.GetFirstCTrack() #Get it's first animation track
if not track: return # if it doesn't have any tracks. End the script
curve = track.GetCurve() #Get the curve for the track found
count = curve.GetKeyCount() #Count how many keys are on it
time = doc.GetTime() #Get the time
frame = time.GetFrame(doc.GetFps()) #Get the FPS
#Adds a new key for the first track. Where the scrubber is located
added = curve.AddKey(time)
print count #prints the total number of keys in the first track
Does anyone know how to force the time line to update in Python so any changes show up immediately without having to do any scrubbing?
-ScottA
