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

    SOLVED: Why can't I add simple renderdata?

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 336 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 15/09/2011 at 17:17, xxxxxxxx wrote:

      Hello,

      I am making a simple script that does the following

      1. Runs through a simple loop that iterates different scene cameras (controlled with User data ID:17)
      2. Changes the Renderoutput path (c4d.RDATA_PATH) based upon this loop
      3. Renders the image with this filename.

      I am able to get steps 1 and 3 working fine. However 2 doesnt update in the render settings. The c4d.RDATA_PATH function won't actually write the change to the render setting. Is there a better method for approching this problem. I thought that there would be a render function that had a path argument, rather than getting it from the render setting.

      I know this is somthing really simple, but i cant seem to find out what i am doing wrong guys.

        
      import c4d  
      from c4d import bitmaps, documents  
        
      c4d.CallCommand(1024314) # Clear Python Log  
      c4d.CallCommand(1022604) # Open Python Log  
        
      def PreviewLoop() :  
        doc          = documents.GetActiveDocument()  
        rd           = doc.GetActiveRenderData().GetData()   
        
        for i in xrange(5) :  
        
            rd[c4d.RDATA_PATH] = r'C:	emp0' + str(i+1) #Iterate Render Path      
            op[c4d.ID_USERDATA, 17] = i+4 #Iterate Seleceted Camera  
            c4d.EventAdd()  
             
            print str(rd[c4d.RDATA_PATH]) # Preview path Confirmation  
         
            bmp = bitmaps.BaseBitmap()  
            bmp.Init(x=1024, y=576, depth=32) #Initiate Render Resolution  
            documents.RenderDocument(doc, rd, bmp, c4d.RENDERFLAGS_EXTERNAL)  
            bitmaps.ShowBitmap(bmp) #Launch Picture Viewer  
        
      PreviewLoop()  
        
      print 'Done!'  
        
      

      Any ideas? thanks.

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 15/09/2011 at 18:34, xxxxxxxx wrote:

        Looks like i solved it 🙂

        Had something to do with     rd           = doc.GetActiveRenderData(). I  moved the GetData() to the documents.RenderDocument argument...

        Here is the updated code.

          
          
        import c4d  
        from c4d import bitmaps, documents  
          
        c4d.CallCommand(1024314) # Clear Python Log  
        c4d.CallCommand(1022604) # Open Python Log  
          
        def PreviewLoop() :  
          doc          = documents.GetActiveDocument()  
          rd           = doc.GetActiveRenderData()   
          
          op[c4d.ID_USERDATA, 14] = 0 # Disable any Analaglyph Preview settings  
          
          
          print 'Rendering Preview...' # Preview Confirmation.        
          for i in xrange(5) :  
          
              rd[c4d.RDATA_PATH] = r'C:\ViewX	emp0' + str(i+1) #Iterate Render Path      
              op[c4d.ID_USERDATA, 17] = i+4 #Iterate Seleceted Camera  
              c4d.EventAdd()  
               
              print str(rd[c4d.RDATA_PATH]) # Preview path Confirmation  
           
              bmp = bitmaps.BaseBitmap()  
              bmp.Init(x=1024, y=576, depth=32) #Initiate Render Resolution  
              documents.RenderDocument(doc, rd.GetData(), bmp, c4d.RENDERFLAGS_EXTERNAL)  
              bitmaps.ShowBitmap(bmp) #Launch Picture Viewer  
          
        PreviewLoop()  
          
        print 'Done!'  
          
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post