mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
updated plugins
This commit is contained in:
parent
03c111f58d
commit
59fe720e8c
3 changed files with 77 additions and 4 deletions
|
|
@ -19,6 +19,9 @@ class CreatePointCache(houdini.Creator):
|
|||
# create an ordered dict with the existing data first
|
||||
data = OrderedDict(**self.data)
|
||||
|
||||
# Set node type to create for output
|
||||
data["node_type"] = "alembic"
|
||||
|
||||
# Collect animation data for point cache exporting
|
||||
start, end = hou.playbar.timelineRange()
|
||||
data["startFrame"] = start
|
||||
|
|
|
|||
|
|
@ -6,6 +6,23 @@ from avalon.houdini import lib
|
|||
|
||||
|
||||
class CollectInstances(pyblish.api.ContextPlugin):
|
||||
"""Gather instances by all node in out graph and pre-defined attributes
|
||||
|
||||
This collector takes into account assets that are associated with
|
||||
an specific node and marked with a unique identifier;
|
||||
|
||||
Identifier:
|
||||
id (str): "pyblish.avalon.instance
|
||||
|
||||
Specific node:
|
||||
The specific node is important because it dictates in which way the subset
|
||||
is being exported.
|
||||
|
||||
alembic: will export Alembic file which supports cascading attributes
|
||||
like 'cbId' and 'path'
|
||||
geometry: Can export a wide range of file types, default out
|
||||
|
||||
"""
|
||||
|
||||
label = "Collect Instances"
|
||||
order = pyblish.api.CollectorOrder
|
||||
|
|
@ -14,21 +31,39 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
def process(self, context):
|
||||
|
||||
instances = []
|
||||
keys = ["active", "id", "family", "asset", "subset"]
|
||||
|
||||
nodes = hou.node("/out").children()
|
||||
for node in nodes:
|
||||
if node.parm("id"):
|
||||
|
||||
if not node.parm("id"):
|
||||
continue
|
||||
|
||||
if not node.parm("id") != "pyblish.avalon.instance":
|
||||
if node.parm("id").eval() != "pyblish.avalon.instance":
|
||||
continue
|
||||
|
||||
has_family = node.parm("family")
|
||||
has_family = node.parm("family").eval()
|
||||
assert has_family, "'%s' is missing 'family'" % node.name()
|
||||
|
||||
# TODO: Ensure not all data passes through!
|
||||
data = lib.read(node)
|
||||
|
||||
# temporarily translation of `active` to `publish` till issue has
|
||||
# been resolved, https://github.com/pyblish/pyblish-base/issues/307
|
||||
if "active" in data:
|
||||
data["publish"] = data["active"]
|
||||
|
||||
instance = context.create_instance(data.get("name", node.name()))
|
||||
|
||||
instance[:] = [node]
|
||||
instance.data.update(data)
|
||||
|
||||
instances.append(instance)
|
||||
|
||||
def sort_by_family(instance):
|
||||
"""Sort by family"""
|
||||
return instance.data.get("families", instance.data.get("family"))
|
||||
|
||||
# Sort/grouped by family (preserving local index)
|
||||
context[:] = sorted(context, key=sort_by_family)
|
||||
|
||||
return context
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
import os
|
||||
|
||||
import hou
|
||||
|
||||
import pyblish.api
|
||||
import colorbleed.api
|
||||
from colorbleed.houdini import lib
|
||||
|
||||
|
||||
class ExtractAlembic(colorbleed.api.Extractor):
|
||||
|
||||
order = pyblish.api.ExtractorOrder
|
||||
label = "Extract Pointcache (Alembic)"
|
||||
hosts = ["houdini"]
|
||||
families = ["colorbleed.pointcache"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
staging_dir = self.staging_dir(instance)
|
||||
|
||||
file_name = "{}.abc".format(instance.data["subset"])
|
||||
tmp_filepath = os.path.join(staging_dir, file_name)
|
||||
|
||||
ropnode = instance[0]
|
||||
attributes = {"trange": 1,
|
||||
"f1": instance.data["startFrame"],
|
||||
"f2": instance.data["endFrame"]}
|
||||
|
||||
with lib.attribute_values(ropnode, attributes):
|
||||
ropnode.execute()
|
||||
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = []
|
||||
|
||||
instance.data["files"].append(tmp_filepath)
|
||||
Loading…
Add table
Add a link
Reference in a new issue