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 to get octane aov manager in python

    General Talk
    python sdk
    4
    7
    1.4k
    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.
    • R
      render_exe
      last edited by

      hello there!

      I want to get every attribute in octane aov manager in python, but I don't know the way, can you help me? Thank you!
      88e15a39-3dae-489a-a925-21dd7a4ed57f-image.png
      d9a78197-0c1b-4994-bc8c-36255637b8ea-image.png

      DunhouD ferdinandF 2 Replies Last reply Reply Quote 0
      • DunhouD
        Dunhou @render_exe
        last edited by

        Hei @render_exe !

        First of all , I think Octane is out of supports in cafe , you should connect to otoy ( but I think that is a not a good conversation experience and you mostly get no feedback) Octane refuse to provide any sdk as I know , I don't know why that happened 😕

        But as this question , I have an octane api helper, here is a little example to read aov data of octane, hope it helps
        Note: I delete some subdata conditions for read. but it is all like Z-Depth aov.

        Cheers~

        from typing import Optional
        import c4d
        from dataclasses import dataclass
        from pprint import pprint
        
        # Octane render
        ID_OCTANE_VIDEO_POST = 1029525
        
        SET_RENDERAOV_IN_CNT=3700
        SET_RENDERAOV_INPUT_0=3740
        VP_COLOR_SPACE      = 1028
        # RenderPassAOV_h
        RNDAOV_NAME=900
        RNDAOV_ENABLED=994
        RNDAOV_TYPE=995
        RNDAOV_TYPE_NAME=1101
        
        RNDAOV_ZDEPTH=255
        RNDAOV_ZDEPTH_MAX=3392
        RNDAOV_ZDEPTH_ENVDEPTH=3397
        
        @dataclass
        class OctaneAOVData:
            aov_shader: c4d.BaseShader
            aov_enabled: bool
            aov_name: str
            aov_type: int
            aov_subdata: list
        
        class OctaneVideoPostHelper:
            
            def __init__(self):
                self.vp: c4d.documents.BaseVideoPost = self.get_videopost(doc)
            
            def get_videopost(self, doc: c4d.documents.BaseDocument) -> c4d.documents.BaseVideoPost:
                """Get the Octane video post"""
                rdata: c4d.documents.RenderData = doc.GetActiveRenderData()
                vpost: c4d.documents.BaseVideoPost = rdata.GetFirstVideoPost()
                octVp: c4d.documents.BaseVideoPost = None
        
                # 获取Octane VP
                while vpost:
                    print(vpost.GetType())
                    if vpost.GetType() == ID_OCTANE_VIDEO_POST:
                        octVp = vpost
                    vpost = vpost.GetNext()
        
                return octVp 
          
            def list_vpdata(self):
        
                if self.vp is None:
                    raise RuntimeError("Can't get the Octane VideoPost")
                
                bc: c4d.BaseContainer = self.vp.GetDataInstance()
        
                for key in range(len(bc)):
                    key = bc.GetIndexId(key)
                    try:
                        print(f"Key: {key}, Value: {bc[key]}, DataType{bc.GetType(key)}")
                    except AttributeError:
                        print("Entry:{0} is DataType {1} and can't be printed in Python".format(key, bc.GetType(key)))
        
            def read_aov(self) -> list[OctaneAOVData]:
                
                if self.vp is None:
                    raise RuntimeError("Can't get the Octane VideoPost")
        
                aovCnt = self.vp[SET_RENDERAOV_IN_CNT]
                
                print ("--- OCTANERENDER ---")
                print ("Name:", self.vp.GetName())
                print ("Color space:", self.vp[VP_COLOR_SPACE])
                print ("AOV count:", aovCnt)
                print ("--- OCTANERENDER ---")
                
                aovs: list[OctaneAOVData] = []
                
                for i in range(0, aovCnt):
                    aov = self.vp[SET_RENDERAOV_INPUT_0+i]
                    aov_enabled = aov[RNDAOV_ENABLED]
                    aov_name = aov[RNDAOV_NAME]
                    aov_type = aov[RNDAOV_TYPE]
                    aov_subdata = None
                    
                    # Z-Depth
                    if aov_type == RNDAOV_ZDEPTH:
                        aov_subdata = [
                            aov[RNDAOV_ZDEPTH_MAX],
                            aov[RNDAOV_ZDEPTH_ENVDEPTH]
                            ]
                        print ("Subdata: Z-depth max:",aov[RNDAOV_ZDEPTH_MAX]," Env.depth:",aov[RNDAOV_ZDEPTH_ENVDEPTH])
                    
                    aovs.append(OctaneAOVData(aov_shader=aov,
                                              aov_enabled=aov_enabled,
                                              aov_name=aov_name,
                                              aov_type=aov_type,
                                              aov_subdata=aov_subdata))
                return aovs
               
        # Execute
        if __name__=='__main__':
            oc = OctaneVideoPostHelper()
            pprint(oc.read_aov())
            
        

        https://boghma.com
        https://github.com/DunHouGo

        T R 2 Replies Last reply Reply Quote 0
        • T
          Tng @Dunhou
          last edited by

          @Dunhou said in How to get octane aov manager in python:

          First of all , I think Octane is out of supports in cafe , you should connect to otoy ( but I think that is a not a good conversation experience and you mostly get no feedback) Octane refuse to provide any sdk as I know , I don't know why that happened 😕

          I've managed to get help from Aoktar in the forum, but you have to be persistent and kinda spam the post every two weeks haha.

          One question, since i'm trying to do the same; build some automation with C4D/Octane/Redshift, is your Octane api helper available anywhere ? I'm stuck on a few topics like AOV and the BaseContainer options

          DunhouD 1 Reply Last reply Reply Quote 0
          • DunhouD
            Dunhou @Tng
            last edited by

            @Tng Yeah, you are right, you must send more than 3 and get one feedback , and wait for a loooooooong time.

            And yes , I would make it open source once it is done ( at least a basic structure ), but it is a habit thing to me so not enough times always. I have a redshift api on github. but with octane , it has so many problems , octane don't use xppresso or node editor but a custom userarea and refuse to provide any sdk , you can't even get a selected node. but anyway , I have a bare-bone one now , it worked with light material aov and somethings else . but I don't know how long it will takes me( consider I have some artworks to do and some plugins development plan before it ).

            Cheers~

            https://boghma.com
            https://github.com/DunHouGo

            T 1 Reply Last reply Reply Quote 0
            • R
              render_exe @Dunhou
              last edited by

              @Dunhou Thank you, I will read and test the code, thank you.
              Cheers~

              1 Reply Last reply Reply Quote 0
              • T
                Tng @Dunhou
                last edited by

                @Dunhou I know about your redshift api that's why i asked about octane since i didn't find it on your github 🙂 Would you be open to collaboration on the Octane API ? Here is my discord if you wanna talk about it : ShivaMist#8262

                1 Reply Last reply Reply Quote 0
                • ferdinandF ferdinand moved this topic from Cinema 4D SDK on
                • ferdinandF
                  ferdinand @render_exe
                  last edited by

                  Hello @render_exe,

                  Thank you for reaching out to us. Unfortunately, as already pointed out by @Dunhou, questions about third party APIs are out of scope of support:

                  Forum Guidelines: Scope of Support

                  We cannot provide support on learning either C++, Python or one of its popular third party libraries.

                  Thank you @Dunhou for providing such a nice community answer. Since this topic is not about the Cinema 4D SDK, I have moved it to General Talk.

                  Cheers,
                  Ferdinand

                  MAXON SDK Specialist
                  developers.maxon.net

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