Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to set an explicit AOV identifier for USD render product using attribute ayon:aov_identifier #120

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ def get_aov_identifier(self, render_product):
str: The AOV identifier

"""
# Allow explicit naming through custom attribute on the render product
aov_identifier = render_product.GetPrim().GetAttribute(
"ayon:aov_identifier").Get()
Copy link
Contributor

@MustafaJafar MustafaJafar Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was returning None on my side because my wrangle was time dependent.
This fixes the issue.

Suggested change
"ayon:aov_identifier").Get()
"ayon:aov_identifier").Get(time=0)

image

Copy link
Contributor

@MustafaJafar MustafaJafar Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: using time 0 may not be recommended although it's being used with render targets here

Anyways, we can use the earliest time.
but keep in mind, we still need to add this 👇 import at the top.

from pxr import Usd
Suggested change
"ayon:aov_identifier").Get()
"ayon:aov_identifier").Get(time=Usd.TimeCode.EarliestTime())

if aov_identifier:
self.log.debug(
"Using explicit ayon:aov_identifier on render product"
" '{render_product}': {aov_identifier}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a missing f here

Suggested change
" '{render_product}': {aov_identifier}")
f" '{render_product}': {aov_identifier}")

return str(aov_identifier)

targets = render_product.GetOrderedVarsRel().GetTargets()
if len(targets) > 1:
# Cryptomattes usually are combined render vars, for example:
Expand Down