Display tag keyframe [SOLVED]
On 16/06/2016 at 19:34, xxxxxxxx wrote:
Pulling my hair out trying to keyframe the current visibility % for a display tag on the currently active object in C4D R15 using Python
I'm trying to keyframe it at 0%, change it to 100% a few seconds later and then keyframe that.
Can someone help please with some tips or example code? I can make keyframes, move around the timeline, etc without issue just stuck on how to do display tag keyframe specifically.
On 16/06/2016 at 22:05, xxxxxxxx wrote:
#This script creates the visibility track on the display tag #Then adds two keys to the track's curve import c4d def main() : obj = doc.GetActiveObject() if not obj: return False tag = obj.GetTag(5613) #Get the display tag if not tag: return False tag[c4d.DISPLAYTAG_AFFECT_VISIBILITY] = True if not tag.FindCTrack(c4d.DescID(c4d.DescLevel(c4d.DISPLAYTAG_VISIBILITY))) : visTrack = c4d.CTrack(tag, c4d.DescID(c4d.DescLevel(c4d.DISPLAYTAG_VISIBILITY))) tag.InsertTrackSorted(visTrack) curve = visTrack.GetCurve() ckey = curve.AddKey(c4d.BaseTime(0.0))['key'] #Creates a key at frame 0 ckey.SetValue(curve, 0.4) #40% ckey = curve.AddKey(c4d.BaseTime(1.0))['key'] #Creates a key at frame 30 ckey.SetValue(curve, 1.0) #100% c4d.EventAdd() c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW) #Update the viewport and the red dot icon if __name__=='__main__': main()
On 17/06/2016 at 01:24, xxxxxxxx wrote:
as you can see in Scott's example animation data is stored in a animation track represented by the class CTrack. For each animated parameter the host object stores a CTrack object. This CTrack can be obtained with FindCTrack(), if no Ctrack exsists one can be created and then added to the host object using InsertTrackSorted().
On 17/06/2016 at 08:46, xxxxxxxx wrote:
Thank you Scott for the demonstration and Sebastian for the explanation! It finally works :D