Jump to content

PerAnders

Regular Member
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

3 Poor

Profile Information

  • First Name
    Per-Anders
  • Last Name
    Edwards
  • C4D Ver
    20.057 Studio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Firstly thing - There is no way to directly access and change the value of the dropdown for the render setting within the Batch Renderer with Python AFAIK. Which means that while it's not very efficient your approach is not terrible when dealing with a body of files, don't feel bad about it, if it works then that's more important than if it works efficiently. Now onto ways you could improve your code : For a start I don't see anything in your script accessing the batch renderer to get the file. So that's done first by using the "GetBatchRender" function, e.g. batchRender = c4d.documents.GetBatchRender() count = batchRender.GetElementCount() for i in range(count): fileName = batchRender.GetElement(i) This goes through the whole list, but perhaps you only want to deal with the first (top most, just about to render) document, in which case you wouldn't do the for loop but would just do fileName = batchRender.GetElement(0). Next, you can just load in and save the file more directly than using CallCommand using the c4d.document.LoadDocument(file, flags). myDoc = c4d.documents.LoadDocument(fileName, c4d.SCENEFILTER_PROGRESSALLOWED) if myDoc is None: return At this point you now have an opened document and can see the progress as the file is loaded in. Your next step is to switch out the render data in that document. Just use the code you already have for that, it's fine. You shouldn't need the EventAdd() function calls in there though. The final step is to re-save your document, this time rather than using CallCommand again you can do it directly. With c4d.document.SaveDocument(doc, file, flags, format) result = c4d.documents.SaveDocument(myDoc, fileName, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_C4DEXPORT) if result is False: return At this point you should be able to start the batch render and be good to go. If you want you can do this programmatically again without having to use CallCommand by accessing the BatchRender object's SetRendering() function i.e. batchRender.SetRendering(c4d.BR_START) should do the job.

YOUTUBE CHANNEL:

ABOUT US:

C4D Cafe is the largest CINEMA 4D community. We provide facilities for discussion, showcasing and learning our favorite software :) Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, get your own private messenger, post status updates, manage your profile and much more. If you need to find solution to your problem or otherwise ask for help, Cafe is the right place.
×
×
  • Create New...