add custom object buffer



  • 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.



  • 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?



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

    other channels like specular / mat_uv / etc working fine



  • 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



  • 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!



  • 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



  • 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!


Log in to reply