mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Implement Arnold .ass standin extraction from Houdini (also support .ass.gz)
This commit is contained in:
parent
c6eb14ab62
commit
b3bdf12fff
4 changed files with 115 additions and 4 deletions
|
|
@ -180,8 +180,11 @@ def get_output_parameter(node):
|
|||
return node.parm("filename")
|
||||
elif node_type == "comp":
|
||||
return node.parm("copoutput")
|
||||
else:
|
||||
raise TypeError("Node type '%s' not supported" % node_type)
|
||||
elif node_type == "arnold":
|
||||
if node.evalParm("ar_ass_export_enable"):
|
||||
return node.parm("ar_ass_file")
|
||||
|
||||
raise TypeError("Node type '%s' not supported" % node_type)
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
|
|||
51
openpype/hosts/houdini/plugins/create/create_arnold_ass.py
Normal file
51
openpype/hosts/houdini/plugins/create/create_arnold_ass.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import hou
|
||||
|
||||
from avalon import houdini
|
||||
|
||||
|
||||
class CreateArnoldAss(houdini.Creator):
|
||||
"""Arnold .ass Archive"""
|
||||
|
||||
label = "Arnold ASS"
|
||||
family = "ass"
|
||||
icon = "magic"
|
||||
defaults = ["Main"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CreateArnoldAss, self).__init__(*args, **kwargs)
|
||||
|
||||
# Remove the active, we are checking the bypass flag of the nodes
|
||||
self.data.pop("active", None)
|
||||
|
||||
self.data.update({"node_type": "arnold"})
|
||||
|
||||
def process(self):
|
||||
node = super(CreateArnoldAss, self).process()
|
||||
|
||||
basename = node.name()
|
||||
node.setName(basename + "_ASS", unique_name=True)
|
||||
|
||||
# Hide Properties Tab on Arnold ROP since that's used
|
||||
# for rendering instead of .ass Archive Export
|
||||
parm_template_group = node.parmTemplateGroup()
|
||||
parm_template_group.hideFolder("Properties", True)
|
||||
node.setParmTemplateGroup(parm_template_group)
|
||||
|
||||
parms = {
|
||||
# Render frame range
|
||||
"trange": 1,
|
||||
|
||||
# Arnold ROP settings
|
||||
"ar_ass_file": '$HIP/pyblish/`chs("subset")`.$F4.ass.gz',
|
||||
"ar_ass_export_enable": 1
|
||||
}
|
||||
node.setParms(parms)
|
||||
|
||||
# Lock the ASS export attribute
|
||||
node.parm("ar_ass_export_enable").lock(True)
|
||||
|
||||
# Lock some Avalon attributes
|
||||
to_lock = ["family", "id"]
|
||||
for name in to_lock:
|
||||
parm = node.parm(name)
|
||||
parm.lock(True)
|
||||
|
|
@ -5,12 +5,21 @@ import pyblish.api
|
|||
from openpype.hosts.houdini.api import lib
|
||||
|
||||
|
||||
def splitext(name, allowed_multidot_extensions):
|
||||
|
||||
for ext in allowed_multidot_extensions:
|
||||
if name.endswith(ext):
|
||||
return name[:-len(ext)], ext
|
||||
|
||||
return os.path.splitext(name)
|
||||
|
||||
|
||||
class CollectFrames(pyblish.api.InstancePlugin):
|
||||
"""Collect all frames which would be saved from the ROP nodes"""
|
||||
|
||||
order = pyblish.api.CollectorOrder
|
||||
label = "Collect Frames"
|
||||
families = ["vdbcache", "imagesequence"]
|
||||
families = ["vdbcache", "imagesequence", "ass"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
|
|
@ -19,7 +28,8 @@ class CollectFrames(pyblish.api.InstancePlugin):
|
|||
output_parm = lib.get_output_parameter(ropnode)
|
||||
output = output_parm.eval()
|
||||
|
||||
_, ext = os.path.splitext(output)
|
||||
_, ext = splitext(output,
|
||||
allowed_multidot_extensions=[".ass.gz"])
|
||||
file_name = os.path.basename(output)
|
||||
result = file_name
|
||||
|
||||
|
|
|
|||
47
openpype/hosts/houdini/plugins/publish/extract_ass.py
Normal file
47
openpype/hosts/houdini/plugins/publish/extract_ass.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import os
|
||||
|
||||
import pyblish.api
|
||||
import openpype.api
|
||||
from openpype.hosts.houdini.api.lib import render_rop
|
||||
|
||||
|
||||
class ExtractAss(openpype.api.Extractor):
|
||||
|
||||
order = pyblish.api.ExtractorOrder + 0.1
|
||||
label = "Extract Ass"
|
||||
families = ["ass"]
|
||||
hosts = ["houdini"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
import hou
|
||||
|
||||
ropnode = instance[0]
|
||||
|
||||
# Get the filename from the filename parameter
|
||||
# `.evalParm(parameter)` will make sure all tokens are resolved
|
||||
output = ropnode.evalParm("ar_ass_file")
|
||||
staging_dir = os.path.dirname(output)
|
||||
instance.data["stagingDir"] = staging_dir
|
||||
file_name = os.path.basename(output)
|
||||
|
||||
# We run the render
|
||||
self.log.info("Writing ASS '%s' to '%s'" % (file_name, staging_dir))
|
||||
|
||||
render_rop(ropnode)
|
||||
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
# Allow ass.gz extension as well
|
||||
ext = "ass.gz" if file_name.endswith(".ass.gz") else "ass"
|
||||
|
||||
representation = {
|
||||
'name': 'ass',
|
||||
'ext': ext,
|
||||
"files": instance.data["frames"],
|
||||
"stagingDir": staging_dir,
|
||||
"frameStart": instance.data["frameStart"],
|
||||
"frameEnd": instance.data["frameEnd"],
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
Loading…
Add table
Add a link
Reference in a new issue