On 14/09/2013 at 15:08, xxxxxxxx wrote:
I am trying to delete all animation tracks in the document.
The following code successfully removes all tracks except those under "Shader Properties" in the shader effector objects—for instance, the gradient property. Do I need to access these particular tracks through some other means? Are these tracks somehow different from the others?
Thanks.
import c4d
from c4d import documents
def GetNextObject(obj) :
if obj==None:
return None
if obj.GetDown() :
return obj.GetDown()
while not obj.GetNext() and obj.GetUp() :
obj = obj.GetUp()
#print (obj)
return obj.GetNext()
def RemoveTracks(obj) :
for track in obj.GetCTracks() :
#if (track.GetCurve().GetKeyCount() > 0) :
track.Remove()
def main() :
obj = doc.GetFirstObject()
if obj==None: return
while obj:
RemoveTracks(obj)
obj = GetNextObject(obj)
c4d.EventAdd()
if __name__=='__main__':
main()