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

propagate the number of inputs of the subnetwork to the HDA and support publishing HDAs with spare parameters #172

Merged
4 changes: 3 additions & 1 deletion client/ayon_houdini/plugins/create/create_hda.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ def create_instance_node(
name=type_name,
description=node_name,
hda_file_name="$HIP/{}.hda".format(node_name),
ignore_external_references=True
ignore_external_references=True,
min_num_inputs=0,
max_num_inputs=len(to_hda.inputs()) or 1,
)
hda_node.layoutChildren()
elif self._check_existing(folder_path, node_name):
Expand Down
19 changes: 17 additions & 2 deletions client/ayon_houdini/plugins/publish/extract_hda.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import os
from pprint import pformat
import hou
import pyblish.api
from ayon_houdini.api import plugin
Expand All @@ -13,17 +12,33 @@ class ExtractHDA(plugin.HoudiniExtractorPlugin):
families = ["hda"]

def process(self, instance):
self.log.info(pformat(instance.data))

hda_node = hou.node(instance.data.get("instance_node"))
hda_def = hda_node.type().definition()
hda_options = hda_def.options()
hda_options.setSaveInitialParmsAndContents(True)
hda_options.setSaveSpareParms(True)
BigRoy marked this conversation as resolved.
Show resolved Hide resolved

next_version = instance.data["anatomyData"]["version"]
self.log.info("setting version: {}".format(next_version))
hda_def.setVersion(str(next_version))
hda_def.setOptions(hda_options)

# Get `Extra` AYON parameters
parm_group = hda_node.parmTemplateGroup()
parm_folder = parm_group.findFolder("Extra") # This name is a hard coded name in AYON.
assert parm_folder, f"Extra parm folder does not exist: {hda_node.path()}"

# Remove `Extra` AYON parameters
parm_group.remove(parm_folder.name())
hda_node.setParmTemplateGroup(parm_group)

# Save the HDA file
hda_def.save(hda_def.libraryFilePath(), hda_node, hda_options)

# Add `Extra` AYON parameters back
parm_group.append(parm_folder)
hda_node.setParmTemplateGroup(parm_group)

if "representations" not in instance.data:
instance.data["representations"] = []
Expand Down