Cannot update values of BaseContainer of VideoPost
shrvnn last edited by a_block
I am using Indigo Renderer plugin in Cinema4D for rendering. I am trying to automate rendering. For that I need to change the value of Save Image path under Indigo Renderer settings in C4D Render Setttings.
I have successfully accessed the value of Save Image path through code. But on modifying it doesn't reflect in render settings or even if I again fetch the values by repeating the same code. The values are not updated at all.
rd = doc.GetActiveRenderData() vp = rd.GetFirstVideoPost() while(vp.GetName() != "Indigo Renderer"): vp = vp.GetNext() if(vp is None): return bc = vp.GetData() #Getting the correct value as in Render Setting UI print bc[c4d.RS_IMAGE_SAVE_PATH] #Updating the file path bc[c4d.RS_IMAGE_SAVE_PATH] = "FileName" #Repeating the code to get the value after changing rd = doc.GetActiveRenderData() vp = rd.GetFirstVideoPost() while(vp.GetName() != "Indigo Renderer"): vp = vp.GetNext() if(vp is None): return bc = vp.GetData() print rd[c4d.RS_IMAGE_SAVE_PATH] #The image path is not updated.
I have also tried GetDataInstance() and then update, but didnt work.
s_bach last edited by s_bach
I don't have Indigo Renderer so I can't make any statement about this specific scenario.
But I can give some general advice on editing parameters and using the API.
First, when searching for specific comment it is probably better to check for the ID of an element instead of the name. Sou you can use .GetType() to get the ID of the video post.
gpuVideoPost.SetParameter(c4d.VP_GPURENDERER_DEVICES_OVERRIDE_PREFS, True, c4d.DESCFLAGS_SET_0) gpuVideoPost.SetParameter(c4d.VP_GPURENDERER_DEVICE_CPU_OFFLINE, False, c4d.DESCFLAGS_SET_0)
Finally, when you change something in the document or a component of the document you must inform Cinema 4D that something has changed. Only then Cinema will update the GUI. This is done by calling c4d.EventAdd().
shrvnn last edited by
That really worked! Thank you so much Sebastian! I had almost hit a wall solving this.
shrvnn last edited by
I am facing a new problem. You said that c4d.EventAdd() will update the GUI.
I am actually changing the Renderer from plugin which is called using CommandLine. When I make change, the value in drop down for Renderer changes from Standard to Indigo Renderer, but the sub menu doesn't refresh. The submenu has options like Output, Save, Material Override and so on.
When I manually change it back to Standard and again back to Indigo renderer or any, the sub menu is refreshed and respective values are reflected. First it remain same as that of Standard Renderer.
Is there any other way to update render settings menu?
s_bach last edited by
I'm not really sure I understand what you are doing. Are you operating in a command line version of Cinema? Or is you code reacting to some command line arguments? Are you operating on the currently active BaseDocument?
As I said, I don't have Indigo Renderer so I can't test this specific scenario.
But when you "change" the renderer, you also have to "create" that renderer video post when operating in a new document. So it is not enough just to change the
This example shows how to set and create the "Hardware" renderer:
renderData = doc.GetActiveRenderData() if renderData is None: return # set Hardware as active renderer bc = renderData.GetDataInstance() bc[c4d.RDATA_RENDERENGINE] = c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE # add Hardware post effect # in Python a BaseList2D object must be created videoPost = c4d.BaseList2D(c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE) renderData.InsertVideoPost(videoPost) c4d.EventAdd()
You find general information on RenderData also in the C++ documentation: RenderData Manual.