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

Render layer name collector #67

Merged
merged 10 commits into from
Sep 20, 2024
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import os

import pyblish.api
from ayon_core.pipeline.create import get_product_name
from ayon_core.pipeline.farm.patterning import match_aov_pattern
from ayon_core.pipeline.farm.pyblish_functions import (
get_product_name_and_group_from_template
)
from ayon_core.pipeline.publish import (
apply_plugin_settings_automatically,
get_plugin_settings,
apply_plugin_settings_automatically
)
from ayon_houdini.api import plugin

Expand Down Expand Up @@ -62,23 +65,23 @@ def process(self, instance):

# Create Instance for each AOV.
context = instance.context
expectedFiles = next(iter(instance.data["expectedFiles"]), {})
expected_files = next(iter(instance.data["expectedFiles"]), {})

product_type = "render" # is always render
product_group = get_product_name(
context.data["projectName"],
context.data["taskEntity"]["name"],
context.data["taskEntity"]["taskType"],
context.data["hostName"],
product_type,
instance.data["productName"]
)

for aov_name, aov_filepaths in expectedFiles.items():
product_name = product_group

for aov_name, aov_filepaths in expected_files.items():
dynamic_data = {}
if aov_name:
product_name = "{}_{}".format(product_name, aov_name)
dynamic_data["aov"] = aov_name
antirotor marked this conversation as resolved.
Show resolved Hide resolved

product_name, product_group = get_product_name_and_group_from_template(
project_name=context.data["projectName"],
task_entity=context.data["taskEntity"],
host_name=context.data["hostName"],
product_type=product_type,
variant=instance.data["productName"],
dynamic_data = dynamic_data,
antirotor marked this conversation as resolved.
Show resolved Hide resolved
)

# Create instance for each AOV
aov_instance = context.create_instance(product_name)
Expand Down
27 changes: 27 additions & 0 deletions client/ayon_houdini/plugins/publish/collect_renderlayer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Collect Render layer name from ROP.

This simple collector will take name of the ROP node and set it as the render
layer name for the instance.

This aligns with the behavior of Maya and possibly others, even though there
is nothing like render layer explicitly in Houdini.

"""
import hou
import pyblish.api
from ayon_houdini.api import plugin


class CollectRendelayerFromROP(plugin.HoudiniInstancePlugin):
label = "Collect Render layer name from ROP"
order = pyblish.api.CollectorOrder - 0.499
families = ["mantra_rop",
"karma_rop",
"redshift_rop",
"arnold_rop",
"vray_rop",
"usdrender"]

def process(self, instance):
rop = hou.node(instance.data.get("instance_node"))
instance.data["renderlayer"] = rop.name()
2 changes: 1 addition & 1 deletion package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
client_dir = "ayon_houdini"

ayon_required_addons = {
"core": ">0.4.1",
"core": ">=0.4.4",
}
ayon_compatible_addons = {}