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

    How to check BaseVideoPost? (Bug?)

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 589 Views
    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 Offline
      Helper
      last edited by

      On 11/03/2018 at 09:07, xxxxxxxx wrote:

      Hello, plugincafe:)
      I want to add some effects to my render settings such as AO, Hair render, GI, etc.
      Logically, these effects should be added only once but if I'm executing this via Python script, it's adding these render settings, again and again.

      for example, in this code, I'm adding AO effect to my render settings.

        1. import c4d
        2.   
        3. def main(doc) :
        4.     
        5.     doc.StartUndo()
        6.     
        7.     renderData = doc.GetActiveRenderData() #Current renderdata
        8.     aoEffect = c4d.documents.BaseVideoPost(300001045) #Ambient Occlusion
        9.     renderData.InsertVideoPost(aoEffect) #Add AO to renderdata
        10.     
        11.     doc.AddUndo(c4d.UNDOTYPE_NEW, aoEffect)
        12.     doc.EndUndo()
        13.   
        14. if __name__=='__main__':
        15.     main(doc)
        16.     c4d.EventAdd()
      
      

      When I'm manually performing this action via render settings, C4D hides this option from Effects popup menu since it's already added.

      But when I'm doing this via my python script, it generates multiple AO effects. Seems like this is a bug/limitation.

      I would like to check if the desired effect is already added to the render settings but they only option that I found is  RenderData.GetFirstVideoPost()
      I wonder if it is possible to find the desired effect and execute the code only if that effect is not added.

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

        On 12/03/2018 at 03:05, xxxxxxxx wrote:

        Hi,

        actually you are already half way there. Get the first VideoPost via GetFirstVideoPost() and then iterate through all via GetNext() comparing it's type ID (GetType()).

        While in C++ documentation, the BaseVideoPost manual actually has a code snippet doing exactly this and shouldn't be hard to do the same in Python. Which is not supposed to mean, you shouldn't ask, if you run into problems, of course.

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

          On 12/03/2018 at 03:21, xxxxxxxx wrote:

          I forgot: This is not a bug at all.

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