On 08/09/2013 at 15:54, xxxxxxxx wrote:
Originally posted by xxxxxxxx
This is what I'm doing by hand manually. That I'm trying to do with code:
-Make a copy of my current scene (document)
-Execute the RPV rendering in the copy
-Go back to the original scene and continue working. While the other document is rendering.
These are actually the exact steps I do in my PV Render Queue plugin. It is a nasty
workaround, but I couldn't find another way to simulate the "Render to Picture Viewer" button
than to actually call it.
A snippet from my plugin's source code:
CMD_RENDERPV = 12099
def RenderFile(self, file\_) :
file\_.done = True
flags = c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS
doc = c4d.documents.LoadDocument(file\_.filename, flags)
if not doc:
print "Document could not be opened:", file\_.filename
return
active_doc = c4d.documents.GetActiveDocument()
c4d.documents.InsertBaseDocument(doc)
c4d.documents.SetActiveDocument(doc)
c4d.CallCommand(CMD_RENDERPV)
c4d.documents.KillDocument(doc)
if active_doc() :
c4d.documents.SetActiveDocument(active_doc)
Instead of loading a new document, you'd create a clone.
Best regards,
-Niklas