mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
New family ue_yeticache, new creator and extractor
This commit is contained in:
parent
87ed2f960d
commit
d498afbf48
5 changed files with 106 additions and 3 deletions
|
|
@ -0,0 +1,39 @@
|
|||
from openpype.hosts.maya.api import (
|
||||
lib,
|
||||
plugin
|
||||
)
|
||||
from openpype.lib import NumberDef
|
||||
|
||||
|
||||
class CreateYetiCache(plugin.MayaCreator):
|
||||
"""Output for procedural plugin nodes of Yeti """
|
||||
|
||||
identifier = "io.openpype.creators.maya.unrealyeticache"
|
||||
label = "Unreal Yeti Cache"
|
||||
family = "ue_yeticache"
|
||||
icon = "pagelines"
|
||||
|
||||
def get_instance_attr_defs(self):
|
||||
|
||||
defs = [
|
||||
NumberDef("preroll",
|
||||
label="Preroll",
|
||||
minimum=0,
|
||||
default=0,
|
||||
decimals=0)
|
||||
]
|
||||
|
||||
# Add animation data without step and handles
|
||||
defs.extend(lib.collect_animation_defs())
|
||||
remove = {"step", "handleStart", "handleEnd"}
|
||||
defs = [attr_def for attr_def in defs if attr_def.key not in remove]
|
||||
|
||||
# Add samples after frame range
|
||||
defs.append(
|
||||
NumberDef("samples",
|
||||
label="Samples",
|
||||
default=3,
|
||||
decimals=0)
|
||||
)
|
||||
|
||||
return defs
|
||||
|
|
@ -39,7 +39,7 @@ class CollectYetiCache(pyblish.api.InstancePlugin):
|
|||
|
||||
order = pyblish.api.CollectorOrder + 0.45
|
||||
label = "Collect Yeti Cache"
|
||||
families = ["yetiRig", "yeticache"]
|
||||
families = ["yetiRig", "yeticache", "ue_yeticache"]
|
||||
hosts = ["maya"]
|
||||
|
||||
def process(self, instance):
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
import os
|
||||
import json
|
||||
|
||||
from maya import cmds
|
||||
|
||||
from openpype.pipeline import publish
|
||||
|
||||
|
||||
class ExtractYetiCache(publish.Extractor):
|
||||
"""Producing Yeti cache files using scene time range.
|
||||
|
||||
This will extract Yeti cache file sequence and fur settings.
|
||||
"""
|
||||
|
||||
label = "Extract Yeti Cache"
|
||||
hosts = ["maya"]
|
||||
families = ["ue_yeticache"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
yeti_nodes = cmds.ls(instance, type="pgYetiMaya")
|
||||
if not yeti_nodes:
|
||||
raise RuntimeError("No pgYetiMaya nodes found in the instance")
|
||||
|
||||
# Define extract output file path
|
||||
dirname = self.staging_dir(instance)
|
||||
|
||||
# Collect information for writing cache
|
||||
start_frame = instance.data["frameStartHandle"]
|
||||
end_frame = instance.data["frameEndHandle"]
|
||||
preroll = instance.data["preroll"]
|
||||
if preroll > 0:
|
||||
start_frame -= preroll
|
||||
|
||||
kwargs = {}
|
||||
samples = instance.data.get("samples", 0)
|
||||
if samples == 0:
|
||||
kwargs.update({"sampleTimes": "0.0 1.0"})
|
||||
else:
|
||||
kwargs.update({"samples": samples})
|
||||
|
||||
self.log.debug(f"Writing out cache {start_frame} - {end_frame}")
|
||||
filename = "{0}.abc".format(instance.name)
|
||||
path = os.path.join(dirname, filename)
|
||||
cmds.pgYetiCommand(yeti_nodes,
|
||||
writeAlembic=path,
|
||||
range=(start_frame, end_frame),
|
||||
asUnrealAbc=True,
|
||||
**kwargs)
|
||||
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
representation = {
|
||||
'name': 'abc',
|
||||
'ext': 'abc',
|
||||
'files': filename,
|
||||
'stagingDir': dirname
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
|
||||
self.log.debug(f"Extracted {instance} to {dirname}")
|
||||
|
|
@ -62,7 +62,8 @@ class CollectResourcesPath(pyblish.api.InstancePlugin):
|
|||
"effect",
|
||||
"staticMesh",
|
||||
"skeletalMesh",
|
||||
"xgen"
|
||||
"xgen",
|
||||
"ue_yeticache"
|
||||
]
|
||||
|
||||
def process(self, instance):
|
||||
|
|
|
|||
|
|
@ -139,7 +139,8 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
"simpleUnrealTexture",
|
||||
"online",
|
||||
"uasset",
|
||||
"blendScene"
|
||||
"blendScene",
|
||||
"ue_yeticache"
|
||||
]
|
||||
|
||||
default_template_name = "publish"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue