clean up the code across the tycache families

This commit is contained in:
Kayla Man 2023-10-20 11:20:58 +08:00
parent eb28f19fcf
commit 404a4dedfc
3 changed files with 14 additions and 19 deletions

View file

@ -25,7 +25,7 @@ class TyCacheLoader(load.LoaderPlugin):
def load(self, context, name=None, namespace=None, data=None):
"""Load tyCache"""
from pymxs import runtime as rt
filepath = os.path.normpath(self.filepath_from_context(context))
filepath = self.filepath_from_context(context)
obj = rt.tyCache()
obj.filename = filepath

View file

@ -8,8 +8,7 @@ from openpype.pipeline import publish
class ExtractTyCache(publish.Extractor):
"""
Extract tycache format with tyFlow operators.
"""Extract tycache format with tyFlow operators.
Notes:
- TyCache only works for TyFlow Pro Plugin.
@ -89,7 +88,6 @@ class ExtractTyCache(publish.Extractor):
"""
filenames = []
# should we include frame 0 ?
for frame in range(int(start_frame), int(end_frame) + 1):
filename = f"{instance.name}__tyPart_{frame:05}.tyc"
filenames.append(filename)
@ -146,7 +144,7 @@ class ExtractTyCache(publish.Extractor):
opt_list = []
for member in members:
obj = member.baseobject
# TODO: to see if it can be used maxscript instead
# TODO: see if it can use maxscript instead
anim_names = rt.GetSubAnimNames(obj)
for anim_name in anim_names:
sub_anim = rt.GetSubAnim(obj, anim_name)

View file

@ -4,8 +4,7 @@ from pymxs import runtime as rt
class ValidateTyFlowData(pyblish.api.InstancePlugin):
"""Validate that TyFlow plugins or
relevant operators being set correctly."""
"""Validate TyFlow plugins or relevant operators are set correctly."""
order = pyblish.api.ValidatorOrder
families = ["pointcloud", "tycache"]
@ -31,9 +30,9 @@ class ValidateTyFlowData(pyblish.api.InstancePlugin):
if invalid_object or invalid_operator:
raise PublishValidationError(
"issues occurred",
description="Container should only include tyFlow object\n "
"and tyflow operator 'Export Particle' should be in \n"
"the tyFlow editor")
description="Container should only include tyFlow object "
"and tyflow operator 'Export Particle' should be in "
"the tyFlow editor.")
def get_tyflow_object(self, instance):
"""Get the nodes which are not tyFlow object(s)
@ -43,19 +42,17 @@ class ValidateTyFlowData(pyblish.api.InstancePlugin):
instance (pyblish.api.Instance): instance
Returns:
invalid(list): list of invalid nodes which are not
tyFlow object(s) and editable mesh(es).
list: invalid nodes which are not tyFlow
object(s) and editable mesh(es).
"""
invalid = []
container = instance.data["instance_node"]
self.log.debug(f"Validating tyFlow container for {container}")
selection_list = instance.data["members"]
for sel in selection_list:
if rt.ClassOf(sel) not in [rt.tyFlow, rt.Editable_Mesh]:
invalid.append(sel)
return invalid
allowed_classes = [rt.tyFlow, rt.Editable_Mesh]
return [
member for member in instance.data["members"]
if rt.ClassOf(member) not in allowed_classes
]
def get_tyflow_operator(self, instance):
"""Check if the Export Particle Operators in the node