SOLVED: Why can't I add simple renderdata?



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



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

Log in to reply