Jump to content

Sign in to follow this  

set fileFormat RendeSettings 16bitFloat

Recommended Posts

Hi all,


For Cinema R18 I created a script that automates my render settings. Setting the file path to the right location, and the file format to Open EXR 16bit Float.

As of Release R19, setting the EXR to 16bit float using python is not possible anymore, or at least that is what I'm told.

Now with the release of R20 I do really want to start using the new Cinema 4D. So I'm going to try to fix my script once again (instead of sticking to R18)


Here is the code for R18 which works fine:

import c4d
from c4d import gui
#Welcome to the world of Python

def main():
    rd = doc.GetActiveRenderData()
    container = rd.GetData()
    # OpenEXR
    container[c4d.RDATA_FORMAT] = c4d.FILTER_EXR
    saveOptions = container.GetContainerInstance(c4d.RDATA_SAVEOPTIONS)
    # OpenEXR options
    bc = c4d.BaseContainer()
    bc[0] = 3 # ZIP
    bc[1] = True # clamp to half float
    # save OpenEXR options
    # save render data
    doc.GetActiveRenderData()[c4d.RDATA_FORMATDEPTH] = c4d.RDATA_MULTIPASS_SAVEDEPTH_32
    doc.GetActiveRenderData()[c4d.RDATA_MULTIPASS_SAVEIMAGE] = True
    saveOptions = container.GetContainerInstance(c4d.RDATA_MULTIPASS_SAVEOPTIONS)
    # OpenEXR options
    bcMP = c4d.BaseContainer()
    bcMP[0] = 3 # ZIP
    bcMP[1] = True # clamp to half float
    # save OpenEXR options
    # save render data
    doc.GetActiveRenderData()[c4d.RDATA_MULTIPASS_SAVEONEFILE] = c4d.SAVEBIT_MULTILAYER = False
    doc.GetActiveRenderData()[c4d.RDATA_TRUECOLORDITHERING] = False  
    doc.GetActiveRenderData()[c4d.RDATA_INCLUDESOUND] = False
    gui.MessageDialog('outputformat set to EXR')
    print 'outputformat set to EXR'

if __name__=='__main__':

The main problem in R19 and R20 is not being able to control the checkbox 'Use 16 Bit Floats' (see attached screenshot).

Dragging the checkbox to the script editor gives me the following:


I have no idea what to do with this. (my guess is that the python hook is not yet created)


Now I'm trying to create a workaround. I thought of loading my render preset from the content browser:

c4d.documents.MergeDocument(doc,'preset://user.lib4d/Render Settings/RenderSettings',1)

 Alas, merging documents does not merge the render settings.


So in short my question: is it in anyway possible to set the output format to 'openEXR - 16bit Float' using python. Even if this requires an extensive workaround?


Hope someone can help me, so I can start using C4D R20.


All the best,


Bas van Bergen



Screen Shot 2018-09-28 at 16.05.51.png

Share this post

Link to post

We get a similar request, not so long ago on plugincafe.MAXON.net forum.

https://plugincafe.MAXON.net/topic/11033/setting-quicktime-options/4 note GetImageSettingsDictionary/SetImageSettingsDictionary are introduced in the R20 version and there is no workaround for previous version.




Share this post

Link to post
  • Topic Author
  • Wow! Thanks a lot Graphos! In this thread they refer to:


    This is exactly the part I was looking for, this literally does what needs to be done.

    They even refer in this treat to a post I made a year ago, where it turns out it can't be done in R19 like I said.



    Now with R20 it seems they fixed the problem using GetImageSettingsDictionary() / SetImageSettingsDictionary().


    Thanks again for the link to the topic!


     Just for reference, I'll post the code that fixes my problem:

    Image Settings Dictionary
    Configures OpenEXR output render format with SetImageSettingsDictionary() then reads these with GetImageSettingsDictionary().
    import c4d
    from c4d import bitmaps
    import MAXON
    def main():
        # Retrieves render data and its container
        renderData = doc.GetActiveRenderData()
        bc = renderData.GetDataInstance()
        # Gets image filters options
        saveOptions = bc.GetContainerInstance(c4d.RDATA_SAVEOPTIONS)
        # Sets OpenEXR output format
        bc[c4d.RDATA_FORMAT] = c4d.FILTER_EXR
        # Defines OpenEXR settings
        compressionmethodID = MAXON.InternedId('net.MAXON.mediasession.openexr.export.compressionmethod')
        halffloatID = MAXON.InternedId('net.MAXON.mediasession.openexr.export.halffloat')
        layernumberingID = MAXON.InternedId('net.MAXON.mediasession.openexr.export.layernumbering')
        # Configures OpenEXR format options with a MAXON.DataDictionary
        exportSettings = MAXON.DataDictionary()
        exportSettings.Set(compressionmethodID, MAXON.Id("zip"))
        exportSettings.Set(halffloatID, True)
        exportSettings.Set(layernumberingID, False)
        # Stores settings in render data container
        bitmaps.SetImageSettingsDictionary(exportSettings, saveOptions, c4d.FILTER_EXR)
        # Updates Cinema 4D
        # Retrieves OpenEXR images settings
        settings = bitmaps.GetImageSettingsDictionary(saveOptions, c4d.FILTER_EXR)
        # Reads and prints OpenEXR format options
        print("openexr.export.compressionmethod: " + str(settings.Get(compressionmethodID)))
        print("openexr.export.halffloat: " + str(settings.Get(halffloatID)))
        print("openexr.export.layernumbering: " + str(settings.Get(layernumberingID)))
    if __name__=='__main__':


    Share this post

    Link to post

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    Sign in to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    • Create New...