VideoPost Question



  • On 31/05/2016 at 10:57, xxxxxxxx wrote:

    Hey all,

    I have a litle problem with Video Posts, I feel kinda dumb about this topic, because it seems so simple and I still can't get it to work.

    If have this code here:

    doc = c4d.documents.GetActiveDocument()
    rd = doc.GetActiveRenderData()
    if rd.GetFirstVideoPost() != c4d.BaseList2D(1001008) : #This is the Color Correction VP
    	rd.InsertVideoPost(c4d.BaseList2D(1001008))
      
    
    

    What I am trying to do, is when the user enters a special View in my plugin I want to load the CC VP into the render settings, but what I don't want is, that the VP gets imported more than once.

    I don't really know why, but the VP gets imported every time. 
    I hope someone can help me with this :)

    greetings, 
    neon



  • On 01/06/2016 at 02:19, xxxxxxxx wrote:

    Hi neon,

    two things:

    You are only comparing the first VideoPost, which will fail, when there's already another VP added. Instead you will need a loop to check all VPs.

    You shouldn't compare the objects. That's bound to fail an d I'm pretty sure, that's your actual problem. With your comparison:

    if rd.GetFirstVideoPost() != c4d.BaseList2D(1001008) :
    

    you are comparing the VideoPost object to a freshly created one.
    Instead you should check the type of the VP.
    Something like this:

    vp = rd.GetFirstVideoPost()
    while vp is not None:
      if vp.CheckType(1001008) :
        break
      vp = vp.GetNext()
    if vp is None:
      rd.InsertVideoPost(c4d.BaseList2D(1001008))
    


  • On 01/06/2016 at 08:08, xxxxxxxx wrote:

    Hi Andreas,

    thank you for your reply.
    I wasn't aware of the vp objects, and that it would fail.
    Now I know how to compare the video post properly :)

    Also thank you for your example code!

    greetings, 
    neon


Log in to reply