Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

TVPaint Start Frame #1839

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pype/plugins/tvpaint/publish/collect_workfile_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def process(self, context):
"sceneMarkIn": int(mark_in_frame),
"sceneMarkInState": mark_in_state == "set",
"sceneMarkOut": int(mark_out_frame),
"sceneMarkOutState": mark_out_state == "set"
"sceneMarkOutState": mark_out_state == "set",
"sceneStartFrame": int(lib.execute_george("tv_startframe"))
}
self.log.debug(
"Scene data: {}".format(json.dumps(scene_data, indent=4))
Expand Down
8 changes: 8 additions & 0 deletions pype/plugins/tvpaint/publish/extract_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ def process(self, instance):
family_lowered = instance.data["family"].lower()
mark_in = instance.context.data["sceneMarkIn"]
mark_out = instance.context.data["sceneMarkOut"]

# Scene start frame offsets the output files, so we need to offset the
# marks.
start_frame = instance.context.data["sceneStartFrame"]
difference = start_frame - mark_in
mark_in += difference
mark_out += difference

# Frame start/end may be stored as float
frame_start = int(instance.data["frameStart"])
frame_end = int(instance.data["frameEnd"])
Expand Down
27 changes: 27 additions & 0 deletions pype/plugins/tvpaint/publish/validate_start_frame.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pyblish.api
from avalon.tvpaint import lib


class RepairStartFrame(pyblish.api.Action):
"""Repair start frame."""

label = "Repair"
icon = "wrench"
on = "failed"

def process(self, context, plugin):
lib.execute_george("tv_startframe 0")


class ValidateStartFrame(pyblish.api.ContextPlugin):
"""Validate start frame being at frame 0."""

label = "Validate Start Frame"
order = pyblish.api.ValidatorOrder
hosts = ["tvpaint"]
actions = [RepairStartFrame]
optional = True

def process(self, context):
start_frame = lib.execute_george("tv_startframe")
assert int(start_frame) == 0, "Start frame has to be frame 0."