mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge pull request #1334 from pypeclub/feature/3.0_tvpaint_validate_marks
TV Paint: Validate mark in and out.
This commit is contained in:
commit
937cfbce2e
6 changed files with 100 additions and 31 deletions
|
|
@ -34,8 +34,8 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
instance_data["name"] = name
|
||||
instance_data["label"] = "{} [{}-{}]".format(
|
||||
name,
|
||||
context.data["sceneFrameStart"],
|
||||
context.data["sceneFrameEnd"]
|
||||
context.data["sceneMarkIn"] + 1,
|
||||
context.data["sceneMarkOut"] + 1
|
||||
)
|
||||
|
||||
active = instance_data.get("active", True)
|
||||
|
|
@ -78,8 +78,8 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
if instance is None:
|
||||
continue
|
||||
|
||||
instance.data["frameStart"] = context.data["sceneFrameStart"]
|
||||
instance.data["frameEnd"] = context.data["sceneFrameEnd"]
|
||||
instance.data["frameStart"] = context.data["sceneMarkIn"] + 1
|
||||
instance.data["frameEnd"] = context.data["sceneMarkOut"] + 1
|
||||
|
||||
self.log.debug("Created instance: {}\n{}".format(
|
||||
instance, json.dumps(instance.data, indent=4)
|
||||
|
|
|
|||
|
|
@ -122,36 +122,26 @@ class CollectWorkfileData(pyblish.api.ContextPlugin):
|
|||
width = int(workfile_info_parts.pop(-1))
|
||||
workfile_path = " ".join(workfile_info_parts).replace("\"", "")
|
||||
|
||||
frame_start, frame_end = self.collect_clip_frames()
|
||||
# Marks return as "{frame - 1} {state} ", example "0 set".
|
||||
result = lib.execute_george("tv_markin")
|
||||
mark_in_frame, mark_in_state, _ = result.split(" ")
|
||||
|
||||
result = lib.execute_george("tv_markout")
|
||||
mark_out_frame, mark_out_state, _ = result.split(" ")
|
||||
|
||||
scene_data = {
|
||||
"currentFile": workfile_path,
|
||||
"sceneWidth": width,
|
||||
"sceneHeight": height,
|
||||
"scenePixelAspect": pixel_apsect,
|
||||
"sceneFrameStart": frame_start,
|
||||
"sceneFrameEnd": frame_end,
|
||||
"sceneFps": frame_rate,
|
||||
"sceneFieldOrder": field_order
|
||||
"sceneFieldOrder": field_order,
|
||||
"sceneMarkIn": int(mark_in_frame),
|
||||
"sceneMarkInState": mark_in_state == "set",
|
||||
"sceneMarkOut": int(mark_out_frame),
|
||||
"sceneMarkOutState": mark_out_state == "set"
|
||||
}
|
||||
self.log.debug(
|
||||
"Scene data: {}".format(json.dumps(scene_data, indent=4))
|
||||
)
|
||||
context.data.update(scene_data)
|
||||
|
||||
def collect_clip_frames(self):
|
||||
clip_info_str = lib.execute_george("tv_clipinfo")
|
||||
self.log.debug("Clip info: {}".format(clip_info_str))
|
||||
clip_info_items = clip_info_str.split(" ")
|
||||
# Color index - not used
|
||||
clip_info_items.pop(-1)
|
||||
clip_info_items.pop(-1)
|
||||
|
||||
mark_out = int(clip_info_items.pop(-1))
|
||||
frame_end = mark_out + 1
|
||||
clip_info_items.pop(-1)
|
||||
|
||||
mark_in = int(clip_info_items.pop(-1))
|
||||
frame_start = mark_in + 1
|
||||
clip_info_items.pop(-1)
|
||||
|
||||
return frame_start, frame_end
|
||||
|
|
|
|||
64
openpype/hosts/tvpaint/plugins/publish/validate_marks.py
Normal file
64
openpype/hosts/tvpaint/plugins/publish/validate_marks.py
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import json
|
||||
|
||||
import pyblish.api
|
||||
from avalon.tvpaint import lib
|
||||
|
||||
|
||||
class ValidateMarksRepair(pyblish.api.Action):
|
||||
"""Repair the marks."""
|
||||
|
||||
label = "Repair"
|
||||
icon = "wrench"
|
||||
on = "failed"
|
||||
|
||||
def process(self, context, plugin):
|
||||
expected_data = ValidateMarks.get_expected_data(context)
|
||||
|
||||
expected_data["markIn"] -= 1
|
||||
expected_data["markOut"] -= 1
|
||||
|
||||
lib.execute_george("tv_markin {} set".format(expected_data["markIn"]))
|
||||
lib.execute_george(
|
||||
"tv_markout {} set".format(expected_data["markOut"])
|
||||
)
|
||||
|
||||
|
||||
class ValidateMarks(pyblish.api.ContextPlugin):
|
||||
"""Validate mark in and out are enabled."""
|
||||
|
||||
label = "Validate Marks"
|
||||
order = pyblish.api.ValidatorOrder
|
||||
optional = True
|
||||
actions = [ValidateMarksRepair]
|
||||
|
||||
@staticmethod
|
||||
def get_expected_data(context):
|
||||
return {
|
||||
"markIn": int(context.data["frameStart"]),
|
||||
"markInState": True,
|
||||
"markOut": int(context.data["frameEnd"]),
|
||||
"markOutState": True
|
||||
}
|
||||
|
||||
def process(self, context):
|
||||
current_data = {
|
||||
"markIn": context.data["sceneMarkIn"] + 1,
|
||||
"markInState": context.data["sceneMarkInState"],
|
||||
"markOut": context.data["sceneMarkOut"] + 1,
|
||||
"markOutState": context.data["sceneMarkOutState"]
|
||||
}
|
||||
expected_data = self.get_expected_data(context)
|
||||
invalid = {}
|
||||
for k in current_data.keys():
|
||||
if current_data[k] != expected_data[k]:
|
||||
invalid[k] = {
|
||||
"current": current_data[k],
|
||||
"expected": expected_data[k]
|
||||
}
|
||||
|
||||
if invalid:
|
||||
raise AssertionError(
|
||||
"Marks does not match database:\n{}".format(
|
||||
json.dumps(invalid, sort_keys=True, indent=4)
|
||||
)
|
||||
)
|
||||
|
|
@ -13,8 +13,6 @@ class ValidateProjectSettings(pyblish.api.ContextPlugin):
|
|||
|
||||
def process(self, context):
|
||||
scene_data = {
|
||||
"frameStart": context.data.get("sceneFrameStart"),
|
||||
"frameEnd": context.data.get("sceneFrameEnd"),
|
||||
"fps": context.data.get("sceneFps"),
|
||||
"resolutionWidth": context.data.get("sceneWidth"),
|
||||
"resolutionHeight": context.data.get("sceneHeight"),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
{
|
||||
"publish": {
|
||||
"ValidateMissingLayers": {
|
||||
"ValidateProjectSettings": {
|
||||
"enabled": true,
|
||||
"optional": true,
|
||||
"active": true
|
||||
},
|
||||
"ValidateMarks": {
|
||||
"enabled": true,
|
||||
"optional": true,
|
||||
"active": true
|
||||
|
|
|
|||
|
|
@ -17,8 +17,20 @@
|
|||
"name": "template_publish_plugin",
|
||||
"template_data": [
|
||||
{
|
||||
"key": "ValidateMissingLayers",
|
||||
"label": "ValidateMissingLayers"
|
||||
"key": "ValidateProjectSettings",
|
||||
"label": "ValidateProjectSettings",
|
||||
"docstring": "Validate if FPS and Resolution match shot data"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "schema_template",
|
||||
"name": "template_publish_plugin",
|
||||
"template_data": [
|
||||
{
|
||||
"key": "ValidateMarks",
|
||||
"label": "Validate MarkIn/Out",
|
||||
"docstring": "Validate MarkIn/Out match Frame start/end on shot data"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue