Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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 do I access Redshift AOV settings from Python?

    Cinema 4D SDK
    3
    3
    1.6k
    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.
    • jcooperJ
      jcooper
      last edited by jcooper

      So once I have the BasicVideoPost object for the Redshift settings:

      rdata = doc.GetActiveRenderData()
      vpost = rdata.GetFirstVideoPost()
      assert vpost.GetType() == 1036219
      

      How do I access the data highlighted in red in the gui screencap below?

      rsrs.png

      Querying the REDSHIFT_RENDERER_AOV_COUNT:

      num_aovs = vpost[c4d.REDSHIFT_RENDERER_AOV_COUNT]
      

      yields 3, as I would expect, but from there I don't know how to get/set the settings data for any of those three AOVs.

      Update: I noticed relevant constants in vprsrenderer.h called REDSHIFT_RENDERER_AOV_LAYER_FIRST and REDSHIFT_RENDERER_AOV_LAYER_LAST, but trying to access any data using these results in a traceback:

      aov_layer = vpost[c4d.REDSHIFT_RENDERER_AOV_LAYER_FIRST]
      
      Traceback (most recent call last):
        File "console", line 1, in <module>
      AttributeError: Parameter value not accessible (object unknown in Python)
      

      JOHN COOPER I TECHNICAL DIRECTOR
      PSYOP LA

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi @jcooper, thanks for reaching out us 😉

        With regard to your question, the code below should help you getting things sorted out

        import c4d
        import c4d.documents
        import redshift
        
        def PrintAOVs(vpRS):
            aovs = redshift.RendererGetAOVs(vpRS)
            for aov in aovs:
                print("-----------------------------------------------------------")
                print("Name                  :%s" % aov.GetParameter(c4d.REDSHIFT_AOV_NAME))
                print("Type                  :%d" % aov.GetParameter(c4d.REDSHIFT_AOV_TYPE))
                print("Enabled               :%s" % ("Yes" if aov.GetParameter(c4d.REDSHIFT_AOV_ENABLED) else "No"))
                print("Multi-Pass            :%s" % ("Yes" if aov.GetParameter(c4d.REDSHIFT_AOV_MULTIPASS_ENABLED) else "No"))
                print("Direct                :%s" % ("Yes" if aov.GetParameter(c4d.REDSHIFT_AOV_FILE_ENABLED) else "No"))
                print("Direct Path           :%s" % aov.GetParameter(c4d.REDSHIFT_AOV_FILE_PATH))
                #print("Direct Effective Path :%s" % aov.GetParameter(c4d.REDSHIFT_AOV_FILE_EFFECTIVE_PATH)) # Available from 2.6.44/3.0.05
        
        def main():
            doc = c4d.documents.GetActiveDocument()
            renderdata = doc.GetActiveRenderData()
        
            # Get the Redshift videoPost and render settings
            vprs = redshift.FindAddVideoPost(renderdata, redshift.VPrsrenderer)
            if vprs is None:
                return
        
            PrintAOVs(vprs)
        
        if __name__=='__main__':
            main()
        

        Last but not the least, I recommend to check also the Redshift official forum where it's likely that questions like yours could have been already answered.

        Best, R

        1 Reply Last reply Reply Quote 1
        • lasselauchL
          lasselauch
          last edited by

          Wow, thanks for the example, @r_gigante.

          Was it always possible to import a redshift module? Or is there any info from which version on (C4D / Redshift) this is possible!?

          Thanks,
          Lasse

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