How to adjust output path in Python Batchrender class?



  • Hi , i am batch rendering images with different output path in Python , i want to adjust the output path when i add image render to render queue in Python

    Is there any way to finish that ?i Google a lot and look through documents , but there is no explicit way to do that ..

    I really need this function cause i need render thousand of images in C4D , and if no solution , i have to manually adjust the render queue output path , which would be a disaster to me , kill my great designer dream in baby.

    Thanks if you have any ideas ! Love you .



  • I guess you could

    • load the file you want to render with LoadDocument()
    • change the c4d.RDATA_PATH in the document's render settings
    • save the file with SaveDocument()
    • and add that saved document to the render queue, so the render queue's "Output File" uses the document's render path


  • Hi sorry I overlook your answers,

    There is no way to directly change the path in the RenderQueue to do so, you have to edit the document.
    So before adding a document, you need to load them, then define the path in the render setting and then resave the file.
    Here a quick example.

    import c4d
    
    # Load the document
    docPath = r"PATHtoc4dFile.c4d"
    doc = c4d.documents.LoadDocument(docPath, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS, None)
    
    # Retrieves the active render setting
    renderData = doc.GetActiveRenderData()
    
    # Set the new path for the picture
    renderData[c4d.RDATA_PATH] = r"MyPicturePath.exr"
    
    # Save the document
    c4d.documents.SaveDocument(doc, docPath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_C4DEXPORT)
    

    Cheers,
    Maxime.


Log in to reply