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

TVPaint frame range definition #1425

Merged
merged 10 commits into from
Apr 30, 2021
9 changes: 5 additions & 4 deletions openpype/hosts/tvpaint/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ def set_context_settings(asset_doc=None):
handle_start = handles
handle_end = handles

frame_start -= int(handle_start)
frame_end += int(handle_end)
# Always start from 0 Mark In and set only Mark Out
mark_in = 0
mark_out = mark_in + (frame_end - frame_start) + handle_start + handle_end

execute_george("tv_markin {} set".format(frame_start - 1))
execute_george("tv_markout {} set".format(frame_end - 1))
execute_george("tv_markin {} set".format(mark_in))
execute_george("tv_markout {} set".format(mark_out))
37 changes: 37 additions & 0 deletions openpype/hosts/tvpaint/plugins/publish/collect_instance_frames.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import pyblish.api


class CollectOutputFrameRange(pyblish.api.ContextPlugin):
"""Collect frame start/end from context.

When instances are collected context does not contain `frameStart` and
`frameEnd` keys yet. They are collected in global plugin
`CollectAvalonEntities`.
"""
label = "Collect output frame range"
order = pyblish.api.CollectorOrder
hosts = ["tvpaint"]

def process(self, context):
for instance in context:
frame_start = instance.data.get("frameStart")
frame_end = instance.data.get("frameEnd")
if frame_start is not None and frame_end is not None:
self.log.debug(
"Instance {} already has set frames {}-{}".format(
str(instance), frame_start, frame_end
)
)
return

frame_start = context.data.get("frameStart")
frame_end = context.data.get("frameEnd")

instance.data["frameStart"] = frame_start
instance.data["frameEnd"] = frame_end

self.log.info(
"Set frames {}-{} on instance {} ".format(
frame_start, frame_end, str(instance)
)
)
3 changes: 0 additions & 3 deletions openpype/hosts/tvpaint/plugins/publish/collect_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ def process(self, context):

instance.data["publish"] = any_visible

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)
))
Expand Down
Loading