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

TVPaint Start Frame #1844

Merged
merged 5 commits into from
Jul 27, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def process(self, context):
"sceneMarkInState": mark_in_state == "set",
"sceneMarkOut": int(mark_out_frame),
"sceneMarkOutState": mark_out_state == "set",
"sceneStartFrame": int(lib.execute_george("tv_startframe")),
"sceneBgColor": self._get_bg_color()
}
self.log.debug(
Expand Down
10 changes: 9 additions & 1 deletion openpype/hosts/tvpaint/plugins/publish/extract_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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.
scene_start_frame = instance.context.data["sceneStartFrame"]
difference = scene_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 Expand Up @@ -98,7 +106,7 @@ def process(self, instance):
self.log.warning((
"Lowering representation range to {} frames."
" Changed frame end {} -> {}"
).format(output_range + 1, mark_out, new_mark_out))
).format(output_range + 1, mark_out, new_output_frame_end))
output_frame_end = new_output_frame_end

# -------------------------------------------------------------------
Expand Down
27 changes: 27 additions & 0 deletions openpype/hosts/tvpaint/plugins/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."
5 changes: 5 additions & 0 deletions openpype/settings/defaults/project_settings/tvpaint.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"optional": true,
"active": true
},
"ValidateStartFrame": {
"enabled": false,
"optional": true,
"active": true
},
"ValidateAssetName": {
"enabled": true,
"optional": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@
}
]
},
{
"type": "schema_template",
"name": "template_publish_plugin",
"template_data": [
{
"key": "ValidateStartFrame",
"label": "Validate Scene Start Frame",
"docstring": "Validate first frame of scene is set to '0'."
}
]
},
{
"type": "schema_template",
"name": "template_publish_plugin",
Expand Down