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
    • Recent
    • Tags
    • Users
    • Login

    add custom object buffer

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 570 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 05/03/2014 at 01:56, xxxxxxxx wrote:

      Hi,

      i want to add a custom object buffer to my render settings.

      http://pastebin.com/NMiHQSSG

      i was only able to add an "empty" channel yet. maybe there is some issue in the GetDataInstance() - using the wrong object or something similar.

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

        On 05/03/2014 at 02:23, xxxxxxxx wrote:

        buffer = c4d.BaseList2D(c4d.Zmultipass)
        buffer.GetDataInstance()[c4d.MULTIPASSOBJECT_TYPE] = c4dd.MULTIPASSOBJECT_OBJECTBUFFER

        this seems not to be enough to initialize the channels as a Object Buffer. Maybe there is some kind of init function needed?

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

          On 05/03/2014 at 07:48, xxxxxxxx wrote:

          other channels like specular / mat_uv / etc working fine

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

            On 05/03/2014 at 10:00, xxxxxxxx wrote:

            Maybe this will help?

              
            #This script checks to see if the first Multi-Pass item is an object buffer  
            #If it is.. Then it changes it's name and GroupID# value  
            #If not..   Then it creates an object buffer and changes it's name and GroupID# value  
              
            import c4d  
            def main() :  
              
              rd = doc.GetActiveRenderData()  #Get the render settings  
              mp = rd.GetFirstMultipass()     #Get the first Multi-Pass item  
              
              #If the first item in the Multi-Pass list is already an object buffer  
              #We'll just change it's name and GroupID# to 3  
              while mp:  
                  if mp.GetTypeName() == "Object Buffer":  
                      mp.SetName("My Buffer")  
                      mp[c4d.MULTIPASSOBJECT_OBJECTBUFFER] = 3       
                      break          #We're done. So lets get outta this loop  
                            
                  mp = mp.GetNext()  #Otherwise..Get the next Multi-Pass item  
              
              
              #If the first item in the Multi-Pass list is not an object buffer  
              #We'll add it...then change it's name and Group# to 3  
              if not mp:  
                  rd[c4d.RDATA_MULTIPASS_ENABLE]= True   #Enable the Multi-Pass option  
                  buffer = c4d.BaseList2D(c4d.Zmultipass)  
                  buffer.GetDataInstance()[c4d.MULTIPASSOBJECT_TYPE] = c4d.VPBUFFER_OBJECTBUFFER  
                  buffer.SetName("My Buffer")  
                  buffer[c4d.MULTIPASSOBJECT_OBJECTBUFFER] = 3          
                  rd.InsertMultipass(buffer)  
                    
              rd.Message(c4d.MSG_UPDATE)   #Tell c4d you changed the render settings      
              c4d.EventAdd()  
              
            if __name__=='__main__':  
              main()
            

            -ScottA

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

              On 21/05/2014 at 21:04, xxxxxxxx wrote:

              is there anyway to remove an object buffer from the multipass list? I only saw functions for adding

              Thanks!

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

                On 22/05/2014 at 08:14, xxxxxxxx wrote:

                The MP gui is a tree gui gizmo similar to the OM gui.
                You can traverse through it the same way you traverse through the OM tree. And get one of the children.
                Then you can edit or delete that specific child object.

                #This is how to delete a specific Object Buffer  
                  
                import c4d  
                def main() :  
                  
                  rd = doc.GetActiveRenderData()  #Get the render settings  
                  mp = rd.GetFirstMultipass()     #Get the first Multi-Pass item  
                    
                  #The Multi-Pass option is a tree gui type gizmo like the OM tree  
                  #Use GetNext() to step down to get each child object in the tree  
                  #Either one at a time...or with a loop  
                  if mp.GetTypeName() == "Object Buffer":   #<---The topmost object in the tree gizmo  
                      firstBuffer = mp  
                      secondBuffer = mp.GetNext()  
                      thirdBuffer = secondBuffer.GetNext()  
                        
                      if secondBuffer is not None: secondBuffer.Remove()  
                        
                  rd.Message(c4d.MSG_UPDATE)    #Tell c4d you changed the render settings      
                  c4d.EventAdd()  
                  
                if __name__=='__main__':  
                  main()
                

                -ScottA

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

                  On 22/05/2014 at 09:30, xxxxxxxx wrote:

                  Oh that makes sense. Wish the would make that more clear in the documentation. Thanks Scott!

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