Enables or disables all Emission in the scene
-
Hi everyone,
I’m looking for a way to globally enable or disable all emission in a Cinema 4D scene using Redshift — ideally without having to iterate through each material. I’d like to control this via Python.
Is there a way to access the global emission toggle through Redshift’s render overrides? (C4D+RS latest versions)
Any pointers would be much appreciated
Thanks in advance!
-
Hello @itstanthony,
Thank you for reaching out to us. Please have a look at Access renderer specific settings with python for the details of how and why. The ID you are looking for is
REDSHIFT_RENDERER_EMISSION_ENABLE
.Cheers,
Ferdinand"""Demonstrates how to access Redshift render engine render settings attached to render data. """ import c4d def main(): """Entry point. """ # doc in predefined in script manger scripts, so this would not be # necessary, but since you did call GetActiveDocument() I copied this # here. doc = c4d.documents.GetActiveDocument() if not isinstance(doc, c4d.documents.BaseDocument): raise RuntimeError("Could not access active document.") renderData = doc.GetActiveRenderData() # The elements in the render settings are video post plugins. Some of # the common entries, e.g., Output/Save are mapped automatically to the # render data, for everything that is optional, we must access the # corresponding BaseVideoPost. Your idea with FindPlugin was not bad, but # that will only give you the BasePlugin and not the actual video post # instance associated with the concrete render data instance. # We could also get the Redshift id like you did with RDATA_RENDERENGINE, # but this assumes that the Redshift is indeed the active render engine. # So, for me it is a bit more comfy to hard-code it. redshiftRenderEngineId = 1036219 # Iterate over the video post to find one matching the render engine. videoPost = renderData.GetFirstVideoPost() while (videoPost): if videoPost.CheckType(redshiftRenderEngineId): break videoPost = videoPost.GetNext() if not isinstance(videoPost, c4d.documents.BaseVideoPost): raise RuntimeError( f"Could not access video post for '{redshiftRenderEngineId = }'") # Disable the emisssion in Globals/Other Overrides videoPost[c4d.REDSHIFT_RENDERER_EMISSION_ENABLE] = False c4d.EventAdd() if __name__ == '__main__': main()
-
Hi Ferdinand,
Thanks a lot for the clear explanation and for taking the time to share the code. The part about accessing BaseVideoPost and using REDSHIFT_RENDERER_EMISSION_ENABLE was spot on. Exactly what I needed. Works perfectly!
Really appreciate it.
Anthony