Hello @Cairyn,
here is the promised answer, please excuse the long wait. I have tested the flags now myself with R21, R23 and S24. All three versions behave identical and do the following for the listed flags:
RENDERFLAGS_OPEN_PICTUREVIEWER
: Will not do anything. The rendering will not be added to the Picture Viewer (PC) and and the PC will not be opened.
RENDERFLAGS_CREATE_PICTUREVIEWER
: PC will not be opened, but an image with the size (-1, -1) will be created with a memory/chip icon next to it in the PC. The image will not contain the results of the rendering.
RENDERFLAGS_SHOWERRORS
: RenderDocument
seems to be unable to handle AssetError
/RENDERRESULT_ASSETMISSING
and will freeze Cinema 4D in this case.
c4d.bitmaps.ShowBitmap()
: Is working fine regarding opening an image in the PC.
At the bottom you can find a script version stating the same. I have created an issue/bug report for that behaviour.
Cheers,
Ferdinand
import c4d
RENDERRESULT_LOOKUP = {
c4d.RENDERRESULT_OK: "RENDERRESULT_OK",
c4d.RENDERRESULT_OUTOFMEMORY: "RENDERRESULT_OUTOFMEMORY",
c4d.RENDERRESULT_ASSETMISSING: "RENDERRESULT_ASSETMISSING",
c4d.RENDERRESULT_SAVINGFAILED: "RENDERRESULT_SAVINGFAILED",
c4d.RENDERRESULT_USERBREAK: "RENDERRESULT_USERBREAK",
c4d.RENDERRESULT_GICACHEMISSING: "RENDERRESULT_GICACHEMISSING",
c4d.RENDERRESULT_NOMACHINE: "RENDERRESULT_NOMACHINE",
c4d.RENDERRESULT_PROJECTNOTFOUND: "RENDERRESULT_PROJECTNOTFOUND",
c4d.RENDERRESULT_ERRORLOADINGPROJECT: "RENDERRESULT_ERRORLOADINGPROJECT",
c4d.RENDERRESULT_NOOUTPUTSPECIFIED: "RENDERRESULT_NOOUTPUTSPECIFIED",
}
def main():
"""
"""
# The active render data container.
rd = doc.GetActiveRenderData()
bc = rd.GetData()
# The render size, we are looking at it because for
# RENDERFLAGS_CREATE_PICTUREVIEWER, Cinema 4D, the Picture Viewer, will
# create an image with the size of (-1, -1), at least that is what is
# being displayed in the Picture Viewer.
width = int(rd[c4d.RDATA_XRES])
height = int(rd[c4d.RDATA_YRES])
print ("render resolution:", width, height)
# The bitmap to render into.
bmp = c4d.bitmaps.MultipassBitmap(width, height, c4d.COLORMODE_RGB)
bmp.AddChannel(True, True)
# Invoke c4d.documents.RenderDocument with some flags, I have tested all
# flags with R21, R23 and S24 and they all behave identically in these
# versions.
RenderDocument = lambda f: c4d.documents.RenderDocument(doc, bc, bmp, f)
# Will literally not do anything ...
res = RenderDocument(c4d.RENDERFLAGS_OPEN_PICTUREVIEWER)
print("RENDERFLAGS_OPEN_PICTUREVIEWER:", RENDERRESULT_LOOKUP[res])
# Will not open the picture viewer, but create an "image" with the size
# (-1, -1) and a chip/memory icon as the preview.
# res = RenderDocument(c4d.RENDERFLAGS_CREATE_PICTUREVIEWER)
# print("RENDERFLAGS_OPEN_PICTUREVIEWER:", RENDERRESULT_LOOKUP[res])
# Will freeze Cinema 4D when an Asset Error is being raised, i.e., when
# res should be `RENDERRESULT_ASSETMISSING`. To invoke an Asset Error,
# simply rename or delete the asset and force Cinema to rebuild the
# caches for the scene by for example reloading the scene.
# res = RenderDocument(c4d.RENDERFLAGS_SHOWERRORS)
# print("RENDERFLAGS_SHOWERRORS:", RENDERRESULT_LOOKUP[res])
# Will properly open the rendered image in the Picture Viewer.
c4d.bitmaps.ShowBitmap(bmp)
if __name__ == '__main__':
main()