Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    VideoPost Question

    PYTHON Development
    0
    3
    419
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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))
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post