Tried searching around a bit but could not find anything on it.
I am trying to access Multi-Pass via Python, add some Masks with Object ID/ Material ID and unique names.
The script log gives me some pointers on how to address the individual properties but not how to initially enable multipass (it’s normally disabled by default in a new scene) and add a new mask.
# Access to the corresponding scene hook
mp_settings = doc.FindSceneHook(1037467)
# Enable multipass
if mp_settings[c4d.CORONA_MULTIPASS_ENABLE] == 0:
mp_settings[c4d.CORONA_MULTIPASS_ENABLE] = 1
Get passes list
# Passes are stored under a c4d.GeListHead object
# First we get the scene hook that stores multipass settings
# and the branch for passes
hook = c4d.documents.GetActiveDocument().FindSceneHook(1037467)
branch = hook.GetBranchInfo()
# Then we look for the list head
if branch:
head = [b.get('head') for b in branch if b.get('id') == 1037373]
if head:
head = head[0]
return head
Then you can handle the passes list from the head level or the nodes level depending on your needs.
Regarding Scene Hook I don’t know ( I’m just hacking my way through Cinema’s Python SDK), you have to ask the devs ! But it seems like a way to store specific data at the document level ( multipass, corona nodes ) without parenting / nesting it inside an already existing Cinema 4d object (like c4d.GetWorldContainer() / c4d.SetWorldContainer()). It’s specific to C++ plugins.
Managed to finish my plugin for our artists.
It’s a plugin that makes it possible for you to select objects and shaders in a scene and then automatically populate the multi-pass window with masks carrying the same name as the object/shader.
There is also a button to clear the existings masks.
It’s very simple in terms of functionality but it saves a ton of work with things like interior scenes etc.