On 14/03/2013 at 05:17, xxxxxxxx wrote:
Hello everyone,
I'm working on a plugin written in python, and theres one thing i can't fix. I try to change the Renderpath from render to render, and i think it works, but for some reason it doesn't save the rendered image after the change in the path. No file output to anywhere. Here is the code:
def renderDocument(self, layerName) :
"""
Taking the document and rendering it according to the normal rendersettings of the document.
Ads '_LAYERNAME', LAYERNAME being the name of the layer, to the renderpath.
"""
doc = c4d.documents.GetActiveDocument()
renderData = doc.GetActiveRenderData().GetData()
xResolution = int(round(renderData[c4d.RDATA_XRES]))
yResolution = int(round(renderData[c4d.RDATA_YRES]))
if renderData[c4d.RDATA_PATH] != "":
print str(renderData[c4d.RDATA_PATH])
renderData[c4d.RDATA_PATH] = str(renderData[c4d.RDATA_PATH]) + "_" + str(layerName)
print str(renderData[c4d.RDATA_PATH])
c4d.EventAdd()
renderBmp = c4d.bitmaps.BaseBitmap()
renderBmp.Init(x=xResolution, y=yResolution, depth=32, )
result = documents.RenderDocument(doc, renderData, renderBmp, c4d.RENDERFLAGS_EXTERNAL)
if result==c4d.RENDERRESULT_OK:
c4d.bitmaps.ShowBitmap(renderBmp) # show image in pictureViewer
return True
If I comment the red section out (the path change) it renders fine. Also, the renderpath seems to change correctly between the two print statements. Furthermore, i checked things like RDATA_SAVEIMAGE, RDATA_GLOBALSAVE, and they are both set to one (hence true?) all the time.
Thanks for your help
Aurel