Jump to content

basvanbergen

Limited Member
  • Posts

    8
  • Joined

  • Last visited

Profile Information

  • First Name
    Bas
  • Last Name
    van Bergen
  • Location
    Amsterdam

HW | SW Information

  • Renderer
    Arnold
  • OS
    Windows
  • CPU
    AMD
  • GPU
    CPU

Recent Profile Visitors

1,391 profile views

basvanbergen's Achievements

Newbie

Newbie (1/14)

  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Wow! Thanks a lot Graphos! In this thread they refer to: https://github.com/PluginCafe/cinema4d_py_sdk/blob/master/scripts/release20/imagesettingsdictionary.py 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. https://plugincafe.MAXON.net/topic/10528/13980_render-settings-file-format-options-r19 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 Example: c4d.bitmaps.SetImageSettingsDictionary() c4d.bitmaps.GetImageSettingsDictionary() 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 c4d.EventAdd() # 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__': main()
  2. 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 saveOptions.SetContainer(0,bc) # save render data rd.SetData(container) doc.GetActiveRenderData()[c4d.RDATA_FORMATDEPTH] = c4d.RDATA_MULTIPASS_SAVEDEPTH_32 #multipass doc.GetActiveRenderData()[c4d.RDATA_MULTIPASS_SAVEIMAGE] = True container[c4d.RDATA_MULTIPASS_SAVEFORMAT] = c4d.FILTER_EXR 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 saveOptions.SetContainer(0,bcMP) # save render data rd.SetData(container) doc.GetActiveRenderData()[c4d.RDATA_MULTIPASS_SAVEDEPTH] = c4d.RDATA_MULTIPASS_SAVEDEPTH_32 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__': 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: foo[1852142638,1835104367,1848536421,1684627827,1702065001,1869491823,1885695589,2020748901,2020634482,1949198433,1818650220,1868657664,c4d.MEDIASESSION_PROPS_NET_MAXON_MEDIASESSION_OPENEXR_EXPORT_HALFFLOAT] 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
×
×
  • Create New...