Iterating the Take System and Dead RenderData



  • On 30/03/2016 at 18:13, xxxxxxxx wrote:

    I want to go through every take and get the assigned render data. As you may know, there's an override camera and render data. When I go and get the render data, if it's going to be overrided, it returns the designated render data. Perfect. However, when there isn't an assigned render data to that particular take, it returns a dead c4d.documents.RenderData object.

    How would I go about getting the active render data for those takes that aren't being overrided?

    Here's the code. Set up a scene with a few takes. Make a few Render Settings and apply them to a take or two. Leave a couple of the 'override render settings' blank as well.

    import c4d
    #Welcome to the world of Python
      
    def GetNextObject( op ) :
        if op == None:
          return None
        if op.GetDown() :
          return op.GetDown()
        while not op.GetNext() and op.GetUp() :
          op = op.GetUp()
        return op.GetNext()  
      
    def main() :
        doc = c4d.documents.GetActiveDocument()
        rdata = doc.GetActiveRenderData()
        clone = rdata.GetClone()
        
        takesToRender = []
        takeData = doc.GetTakeData()
        take = takeData.GetMainTake()
        while take:
            takesToRender.append( take )
            take = GetNextObject( take )
            
        for take in takesToRender:
            rdata = take.GetRenderData( takeData )
            print rdata
      
    if __name__=='__main__':
        main()
    

    Any help would be greatly appreciated.
    Thanks!



  • On 31/03/2016 at 02:30, xxxxxxxx wrote:

    Hi,

    Originally posted by xxxxxxxx

    How would I go about getting the active render data for those takes that aren't being overridden?

    Use GetEffectiveRenderData() instead of GetRenderData(). This functions takes care of returning the inherited render data.
    Note GetEffectiveRenderData() returns a tuple with the actual render data and take.



  • On 31/03/2016 at 11:48, xxxxxxxx wrote:

    Awesome! This is exactly what I was looking for!

    Thank you!


Log in to reply