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
    • Admin
    • Login

    Iterating the Take System and Dead RenderData

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 286 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 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!

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

        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.

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

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

          Awesome! This is exactly what I was looking for!

          Thank you!

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