small tweaks on loader and extractor & use raise PublishValidationError for each instead of using reports append list of error.

This commit is contained in:
Kayla Man 2023-10-05 19:17:25 +08:00
parent 1c92b6b43b
commit fa11a2bfdc
3 changed files with 15 additions and 17 deletions

View file

@ -49,8 +49,7 @@ class PointCloudLoader(load.LoaderPlugin):
update_custom_attribute_data(
node, node_list)
with maintained_selection():
rt.Select(node_list)
for prt in rt.Selection:
for prt in node_list:
prt.filename = path
lib.imprint(container["instance_node"], {
"representation": str(representation["_id"])

View file

@ -42,18 +42,17 @@ class ExtractTyCache(publish.Extractor):
with maintained_selection():
job_args = None
has_tyc_spline = (
True
if instance.data["tycache_type"] == "tycachespline"
else False
)
if instance.data["tycache_type"] == "tycache":
job_args = self.export_particle(
instance.data["members"],
start, end, path,
additional_attributes)
elif instance.data["tycache_type"] == "tycachespline":
job_args = self.export_particle(
instance.data["members"],
start, end, path,
additional_attributes,
tycache_spline_enabled=True)
tycache_spline_enabled=has_tyc_spline)
for job in job_args:
rt.Execute(job)

View file

@ -23,15 +23,14 @@ class ValidateTyFlowData(pyblish.api.InstancePlugin):
invalid_object = self.get_tyflow_object(instance)
if invalid_object:
report.append(f"Non tyFlow object found: {invalid_object}")
raise PublishValidationError(
f"Non tyFlow object found: {invalid_object}")
invalid_operator = self.get_tyflow_operator(instance)
if invalid_operator:
report.append((
raise PublishValidationError((
"tyFlow ExportParticle operator not "
f"found: {invalid_operator}"))
if report:
raise PublishValidationError(f"{report}")
def get_tyflow_object(self, instance):
"""Get the nodes which are not tyFlow object(s)
@ -46,7 +45,7 @@ class ValidateTyFlowData(pyblish.api.InstancePlugin):
"""
invalid = []
container = instance.data["instance_node"]
self.log.info(f"Validating tyFlow container for {container}")
self.log.debug(f"Validating tyFlow container for {container}")
selection_list = instance.data["members"]
for sel in selection_list:
@ -61,7 +60,8 @@ class ValidateTyFlowData(pyblish.api.InstancePlugin):
return invalid
def get_tyflow_operator(self, instance):
"""_summary_
"""Check if the Export Particle Operators in the node
connections.
Args:
instance (str): instance node
@ -73,7 +73,7 @@ class ValidateTyFlowData(pyblish.api.InstancePlugin):
"""
invalid = []
container = instance.data["instance_node"]
self.log.info(f"Validating tyFlow object for {container}")
self.log.debug(f"Validating tyFlow object for {container}")
selection_list = instance.data["members"]
bool_list = []
for sel in selection_list:
@ -88,7 +88,7 @@ class ValidateTyFlowData(pyblish.api.InstancePlugin):
# if the export_particles property is not there
# it means there is not a "Export Particle" operator
if "True" not in bool_list:
self.log.error("Operator 'Export Particles' not found!")
self.log.error("Operator 'Export Particles' not found.")
invalid.append(sel)
return invalid