Skip to content

Commit

Permalink
add cryptomatte into collect render layers
Browse files Browse the repository at this point in the history
  • Loading branch information
moonyuet committed Jan 17, 2023
1 parent 8ad8aa9 commit 92e3d10
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions openpype/hosts/maya/api/lib_renderproducts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ class RenderProductsRenderman(ARenderProducts):
"""

renderer = "renderman"
unmerged_aovs = {"PxrCryptomatte"}

def get_render_products(self):
"""Get all AOVs.
Expand Down Expand Up @@ -1181,6 +1182,17 @@ def get_render_products(self):
if not display_types.get(display["driverNode"]["type"]):
continue

has_cryptomatte = cmds.ls(type=self.unmerged_aovs)
matte_enabled = False
if has_cryptomatte:
for cryptomatte in has_cryptomatte:
cryptomatte_aov = cryptomatte
matte_name = "cryptomatte"
rman_globals = cmds.listConnections(cryptomatte +
".message")
if rman_globals:
matte_enabled = True

aov_name = name
if aov_name == "rmanDefaultDisplay":
aov_name = "beauty"
Expand All @@ -1199,6 +1211,15 @@ def get_render_products(self):
camera=camera,
multipart=True
)

if has_cryptomatte and matte_enabled:
cryptomatte = RenderProduct(
productName=matte_name,
aov=cryptomatte_aov,
ext=extensions,
camera=camera,
multipart=True
)
else:
# this code should handle the case where no multipart
# capable format is selected. But since it involves
Expand All @@ -1218,6 +1239,9 @@ def get_render_products(self):

products.append(product)

if has_cryptomatte and matte_enabled:
products.append(cryptomatte)

return products

def get_files(self, product):
Expand Down

0 comments on commit 92e3d10

Please sign in to comment.