THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/04/2011 at 12:52, xxxxxxxx wrote:
I've tried for hours now and ran out of ideas... basically all I want to do is make objects visible/invisible by keying their visibility attribute. The keys are being created, apparently, but they dont take effect. Instead of showing up red, the keyfram icons show up orange/yellowish, and only once I select something in the attribute editor do they turn red. I've tried a number of event messages to no avail - maybe I'm just missing the right one? Here's the code I'm using:
def setKey(self,doc,o,vis=True) :
trac = o.GetFirstCTrack()
if trac == None:
trackRender = c4d.CTrack(o, c4d.DescID( c4d.DescLevel(c4d.ID_BASEOBJECT_VISIBILITY_RENDER,c4d.DTYPE_LONG,0,)))
o.InsertTrackSorted(trackRender)
trackEditor = c4d.CTrack(o, c4d.DescID( c4d.DescLevel(c4d.ID_BASEOBJECT_VISIBILITY_EDITOR,c4d.DTYPE_LONG,0,)))
o.InsertTrackSorted(trackEditor)
trackEditor.SetAfter(c4d.CLOOP_CONSTANT)
curveRender = trackRender.GetCurve()
key = curveRender.AddKey(c4d.BaseTime(self.frame, doc.GetFps()))['key']
if vis:
key.SetValue(curveRender,0)
else:
key.SetValue(curveRender,1)
key.SetInterpolation(curveRender,c4d.CINTERPOLATION_LINEAR)
curveEditor = trackEditor.GetCurve()
key = curveEditor.AddKey(c4d.BaseTime(self.frame, doc.GetFps()))['key']
if vis:
key.SetValue(curveEditor,0)
else:
key.SetValue(curveEditor,1)
key.SetInterpolation(curveEditor,c4d.CINTERPOLATION_LINEAR)
key.SetTime(curveEditor,doc.GetTime()) # just tried this to see if it makes a difference - it doesnt
print key.GetValue() # comes out as 1.0 or 0.0
return True
Any ideas would be much appreciated!