nuke: refactory Missing frames validator

This commit is contained in:
Jakub Jezek 2022-07-25 12:28:43 +02:00
parent 7cb68975d3
commit c5258fb295
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
2 changed files with 48 additions and 17 deletions

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<error id="main">
<title>Rendered Frames</title>
<description>
## Missing Rendered Frames
Render node "{node_name}" is set to "Use existing frames", but frames are missing.
### How to repair?
1. Use Repair button.
2. Set different target.
2. Hit Reload button on the publisher.
</description>
</error>
</root>

View file

@ -1,7 +1,7 @@
import os
import pyblish.api
from openpype.api import ValidationException
import clique
from openpype.pipeline import PublishXmlValidationError
@pyblish.api.log
@ -36,7 +36,7 @@ class RepairActionBase(pyblish.api.Action):
class RepairCollectionActionToLocal(RepairActionBase):
label = "Repair > rerender with `Local` machine"
label = "Repair - rerender with \"Local\""
def process(self, context, plugin):
instances = self.get_instance(context, plugin)
@ -44,7 +44,7 @@ class RepairCollectionActionToLocal(RepairActionBase):
class RepairCollectionActionToFarm(RepairActionBase):
label = "Repair > rerender `On farm` with remote machines"
label = "Repair - rerender with \"On farm\""
def process(self, context, plugin):
instances = self.get_instance(context, plugin)
@ -63,6 +63,10 @@ class ValidateRenderedFrames(pyblish.api.InstancePlugin):
def process(self, instance):
f_data = {
"node_name": instance[0]["name"].value()
}
for repre in instance.data["representations"]:
if not repre.get("files"):
@ -71,7 +75,8 @@ class ValidateRenderedFrames(pyblish.api.InstancePlugin):
"Check properties of write node (group) and"
"select 'Local' option in 'Publish' dropdown.")
self.log.error(msg)
raise ValidationException(msg)
raise PublishXmlValidationError(
self, msg, formatting_data=f_data)
if isinstance(repre["files"], str):
return
@ -82,30 +87,33 @@ class ValidateRenderedFrames(pyblish.api.InstancePlugin):
collection = collections[0]
fstartH = instance.data["frameStartHandle"]
fendH = instance.data["frameEndHandle"]
f_start_h = instance.data["frameStartHandle"]
f_end_h = instance.data["frameEndHandle"]
frame_length = int(fendH - fstartH + 1)
frame_length = int(f_end_h - f_start_h + 1)
if frame_length != 1:
if len(collections) != 1:
msg = "There are multiple collections in the folder"
self.log.error(msg)
raise ValidationException(msg)
raise PublishXmlValidationError(
self, msg, formatting_data=f_data)
if not collection.is_contiguous():
msg = "Some frames appear to be missing"
self.log.error(msg)
raise ValidationException(msg)
raise PublishXmlValidationError(
self, msg, formatting_data=f_data)
collected_frames_len = int(len(collection.indexes))
collected_frames_len = len(collection.indexes)
coll_start = min(collection.indexes)
coll_end = max(collection.indexes)
self.log.info("frame_length: {}".format(frame_length))
self.log.info("collected_frames_len: {}".format(
collected_frames_len))
self.log.info("fstartH-fendH: {}-{}".format(fstartH, fendH))
self.log.info("f_start_h-f_end_h: {}-{}".format(
f_start_h, f_end_h))
self.log.info(
"coll_start-coll_end: {}-{}".format(coll_start, coll_end))
@ -116,13 +124,19 @@ class ValidateRenderedFrames(pyblish.api.InstancePlugin):
if ("slate" in instance.data["families"]) \
and (frame_length != collected_frames_len):
collected_frames_len -= 1
fstartH += 1
f_start_h += 1
assert ((collected_frames_len >= frame_length)
and (coll_start <= fstartH)
and (coll_end >= fendH)), (
"{} missing frames. Use repair to render all frames"
).format(__name__)
if (
collected_frames_len >= frame_length
and coll_start <= f_start_h
and coll_end >= f_end_h
):
raise PublishXmlValidationError(
self, (
"{} missing frames. Use repair to "
"render all frames"
).format(__name__), formatting_data=f_data
)
instance.data["collection"] = collection