mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
add families into frame range collector and improve the validation report in frame range validator
This commit is contained in:
parent
dcfad64320
commit
1b79767e7b
8 changed files with 62 additions and 72 deletions
23
openpype/hosts/max/plugins/publish/collect_frame_range.py
Normal file
23
openpype/hosts/max/plugins/publish/collect_frame_range.py
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Collect instance members."""
|
||||||
|
import pyblish.api
|
||||||
|
from pymxs import runtime as rt
|
||||||
|
|
||||||
|
|
||||||
|
class CollectFrameRange(pyblish.api.InstancePlugin):
|
||||||
|
"""Collect Set Members."""
|
||||||
|
|
||||||
|
order = pyblish.api.CollectorOrder + 0.01
|
||||||
|
label = "Collect Frame Range"
|
||||||
|
hosts = ['max']
|
||||||
|
families = ["camera", "maxrender",
|
||||||
|
"pointcache", "pointcloud",
|
||||||
|
"review"]
|
||||||
|
|
||||||
|
def process(self, instance):
|
||||||
|
if instance.data["family"] == "maxrender":
|
||||||
|
instance.data["frameStart"] = int(rt.rendStart)
|
||||||
|
instance.data["frameEnd"] = int(rt.rendEnd)
|
||||||
|
else:
|
||||||
|
instance.data["frameStart"] = int(rt.animationRange.start)
|
||||||
|
instance.data["frameEnd"] = int(rt.animationRange.end)
|
||||||
|
|
@ -29,8 +29,6 @@ class CollectReview(pyblish.api.InstancePlugin,
|
||||||
attr_values = self.get_attr_values_from_data(instance.data)
|
attr_values = self.get_attr_values_from_data(instance.data)
|
||||||
data = {
|
data = {
|
||||||
"review_camera": camera_name,
|
"review_camera": camera_name,
|
||||||
"frameStart": instance.context.data["frameStart"],
|
|
||||||
"frameEnd": instance.context.data["frameEnd"],
|
|
||||||
"fps": instance.context.data["fps"],
|
"fps": instance.context.data["fps"],
|
||||||
"dspGeometry": attr_values.get("dspGeometry"),
|
"dspGeometry": attr_values.get("dspGeometry"),
|
||||||
"dspShapes": attr_values.get("dspShapes"),
|
"dspShapes": attr_values.get("dspShapes"),
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ class ExtractCameraAlembic(publish.Extractor, OptionalPyblishPluginMixin):
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
if not self.is_active(instance.data):
|
if not self.is_active(instance.data):
|
||||||
return
|
return
|
||||||
start = float(instance.data.get("frameStartHandle", 1))
|
start = instance.data["frameStart"]
|
||||||
end = float(instance.data.get("frameEndHandle", 1))
|
end = instance.data["frameEnd"]
|
||||||
|
|
||||||
self.log.info("Extracting Camera ...")
|
self.log.info("Extracting Camera ...")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ class ExtractAlembic(publish.Extractor):
|
||||||
families = ["pointcache"]
|
families = ["pointcache"]
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
start = float(instance.data.get("frameStartHandle", 1))
|
start = instance.data["frameStart"]
|
||||||
end = float(instance.data.get("frameEndHandle", 1))
|
end = instance.data["frameEnd"]
|
||||||
|
|
||||||
self.log.debug("Extracting pointcache ...")
|
self.log.debug("Extracting pointcache ...")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ class ExtractPointCloud(publish.Extractor):
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
self.settings = self.get_setting(instance)
|
self.settings = self.get_setting(instance)
|
||||||
start = int(instance.context.data.get("frameStart"))
|
start = instance.data["frameStart"]
|
||||||
end = int(instance.context.data.get("frameEnd"))
|
end = instance.data["frameEnd"]
|
||||||
self.log.info("Extracting PRT...")
|
self.log.info("Extracting PRT...")
|
||||||
|
|
||||||
stagingdir = self.staging_dir(instance)
|
stagingdir = self.staging_dir(instance)
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ class ExtractRedshiftProxy(publish.Extractor):
|
||||||
families = ["redshiftproxy"]
|
families = ["redshiftproxy"]
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
start = int(instance.context.data.get("frameStart"))
|
start = instance.data["frameStart"]
|
||||||
end = int(instance.context.data.get("frameEnd"))
|
end = instance.data["frameEnd"]
|
||||||
|
|
||||||
self.log.debug("Extracting Redshift Proxy...")
|
self.log.debug("Extracting Redshift Proxy...")
|
||||||
stagingdir = self.staging_dir(instance)
|
stagingdir = self.staging_dir(instance)
|
||||||
|
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
import pyblish.api
|
|
||||||
|
|
||||||
from pymxs import runtime as rt
|
|
||||||
from openpype.pipeline.publish import (
|
|
||||||
RepairAction,
|
|
||||||
ValidateContentsOrder,
|
|
||||||
PublishValidationError
|
|
||||||
)
|
|
||||||
from openpype.hosts.max.api.lib import get_frame_range, set_timeline
|
|
||||||
|
|
||||||
|
|
||||||
class ValidateAnimationTimeline(pyblish.api.InstancePlugin):
|
|
||||||
"""
|
|
||||||
Validates Animation Timeline for Preview Animation in Max
|
|
||||||
"""
|
|
||||||
|
|
||||||
label = "Animation Timeline for Review"
|
|
||||||
order = ValidateContentsOrder
|
|
||||||
families = ["review"]
|
|
||||||
hosts = ["max"]
|
|
||||||
actions = [RepairAction]
|
|
||||||
|
|
||||||
def process(self, instance):
|
|
||||||
frame_range = get_frame_range()
|
|
||||||
frame_start_handle = frame_range["frameStart"] - int(
|
|
||||||
frame_range["handleStart"]
|
|
||||||
)
|
|
||||||
frame_end_handle = frame_range["frameEnd"] + int(
|
|
||||||
frame_range["handleEnd"]
|
|
||||||
)
|
|
||||||
if rt.animationRange.start != frame_start_handle or (
|
|
||||||
rt.animationRange.end != frame_end_handle
|
|
||||||
):
|
|
||||||
raise PublishValidationError("Incorrect animation timeline "
|
|
||||||
"set for preview animation.. "
|
|
||||||
"\nYou can use repair action to "
|
|
||||||
"the correct animation timeline")
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def repair(cls, instance):
|
|
||||||
frame_range = get_frame_range()
|
|
||||||
frame_start_handle = frame_range["frameStart"] - int(
|
|
||||||
frame_range["handleStart"]
|
|
||||||
)
|
|
||||||
frame_end_handle = frame_range["frameEnd"] + int(
|
|
||||||
frame_range["handleEnd"]
|
|
||||||
)
|
|
||||||
set_timeline(frame_start_handle, frame_end_handle)
|
|
||||||
|
|
@ -9,6 +9,7 @@ from openpype.pipeline.publish import (
|
||||||
ValidateContentsOrder,
|
ValidateContentsOrder,
|
||||||
PublishValidationError
|
PublishValidationError
|
||||||
)
|
)
|
||||||
|
from openpype.hosts.max.api.lib import get_frame_range, set_timeline
|
||||||
|
|
||||||
|
|
||||||
class ValidateFrameRange(pyblish.api.InstancePlugin,
|
class ValidateFrameRange(pyblish.api.InstancePlugin,
|
||||||
|
|
@ -29,7 +30,7 @@ class ValidateFrameRange(pyblish.api.InstancePlugin,
|
||||||
order = ValidateContentsOrder
|
order = ValidateContentsOrder
|
||||||
families = ["camera", "maxrender",
|
families = ["camera", "maxrender",
|
||||||
"pointcache", "pointcloud",
|
"pointcache", "pointcloud",
|
||||||
"review", "redshiftproxy"]
|
"review"]
|
||||||
hosts = ["max"]
|
hosts = ["max"]
|
||||||
optional = True
|
optional = True
|
||||||
actions = [RepairAction]
|
actions = [RepairAction]
|
||||||
|
|
@ -38,29 +39,45 @@ class ValidateFrameRange(pyblish.api.InstancePlugin,
|
||||||
if not self.is_active(instance.data):
|
if not self.is_active(instance.data):
|
||||||
self.log.info("Skipping validation...")
|
self.log.info("Skipping validation...")
|
||||||
return
|
return
|
||||||
context = instance.context
|
|
||||||
|
|
||||||
frame_start = int(context.data.get("frameStart"))
|
frame_range = get_frame_range()
|
||||||
frame_end = int(context.data.get("frameEnd"))
|
|
||||||
|
|
||||||
inst_frame_start = int(instance.data.get("frameStart"))
|
|
||||||
inst_frame_end = int(instance.data.get("frameEnd"))
|
|
||||||
|
|
||||||
|
inst_frame_start = instance.data.get("frameStart")
|
||||||
|
inst_frame_end = instance.data.get("frameEnd")
|
||||||
|
frame_start_handle = frame_range["frameStart"] - int(
|
||||||
|
frame_range["handleStart"]
|
||||||
|
)
|
||||||
|
frame_end_handle = frame_range["frameEnd"] + int(
|
||||||
|
frame_range["handleEnd"]
|
||||||
|
)
|
||||||
errors = []
|
errors = []
|
||||||
if frame_start != inst_frame_start:
|
if frame_start_handle != inst_frame_start:
|
||||||
errors.append(
|
errors.append(
|
||||||
f"Start frame ({inst_frame_start}) on instance does not match " # noqa
|
f"Start frame ({inst_frame_start}) on instance does not match " # noqa
|
||||||
f"with the start frame ({frame_start}) set on the asset data. ") # noqa
|
f"with the start frame ({frame_start_handle}) set on the asset data. ") # noqa
|
||||||
if frame_end != inst_frame_end:
|
if frame_end_handle != inst_frame_end:
|
||||||
errors.append(
|
errors.append(
|
||||||
f"End frame ({inst_frame_end}) on instance does not match "
|
f"End frame ({inst_frame_end}) on instance does not match "
|
||||||
f"with the end frame ({frame_start}) from the asset data. ")
|
f"with the end frame ({frame_end_handle}) from the asset data. ")
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
errors.append("You can use repair action to fix it.")
|
errors.append("You can use repair action to fix it.")
|
||||||
raise PublishValidationError("\n".join(errors))
|
report = "Frame range settings are incorrect.\n\n"
|
||||||
|
for error in errors:
|
||||||
|
report += "- {}\n\n".format(error)
|
||||||
|
raise PublishValidationError(report, title="Frame Range incorrect")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def repair(cls, instance):
|
def repair(cls, instance):
|
||||||
rt.rendStart = instance.context.data.get("frameStart")
|
frame_range = get_frame_range()
|
||||||
rt.rendEnd = instance.context.data.get("frameEnd")
|
frame_start_handle = frame_range["frameStart"] - int(
|
||||||
|
frame_range["handleStart"]
|
||||||
|
)
|
||||||
|
frame_end_handle = frame_range["frameEnd"] + int(
|
||||||
|
frame_range["handleEnd"]
|
||||||
|
)
|
||||||
|
if instance.data["family"] == "maxrender":
|
||||||
|
rt.rendStart = frame_start_handle
|
||||||
|
rt.rendEnd = frame_end_handle
|
||||||
|
else:
|
||||||
|
set_timeline(frame_start_handle, frame_end_handle)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue