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

Hiero: fixing source frame from correct object #1362

Merged
merged 3 commits into from
Apr 20, 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
48 changes: 32 additions & 16 deletions pype/plugins/hiero/publish/collect_calculate_retime.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,38 @@ class CollectCalculateRetime(api.InstancePlugin):
def process(self, instance):
margin_in = instance.data["retimeMarginIn"]
margin_out = instance.data["retimeMarginOut"]
self.log.debug("margin_in: '{0}', margin_out: '{1}'".format(margin_in, margin_out))
self.log.debug(
"margin_in: '{0}', margin_out: '{1}'".format(
margin_in, margin_out))

handle_start = instance.data["handleStart"]
handle_end = instance.data["handleEnd"]

track_item = instance.data["item"]
clip = track_item.source()
mediaSource = clip.mediaSource()
file_info = mediaSource.fileinfos().pop()
start_frame = file_info.startFrame()

# define basic clip frame range variables
timeline_in = int(track_item.timelineIn())
timeline_out = int(track_item.timelineOut())
source_in = int(track_item.sourceIn())
source_out = int(track_item.sourceOut())
source_in = int(clip.sourceIn())
source_out = int(clip.sourceOut())
speed = track_item.playbackSpeed()
self.log.debug("_BEFORE: \n timeline_in: `{0}`,\n timeline_out: `{1}`,\
\n source_in: `{2}`,\n source_out: `{3}`,\n speed: `{4}`,\n handle_start: `{5}`,\n handle_end: `{6}`".format(
timeline_in,
timeline_out,
source_in,
source_out,
speed,
handle_start,
handle_end
))
self.log.debug(
"_BEFORE: \n timeline_in: `{0}`,\n timeline_out: `{1}`,\
\n source_in: `{2}`,\n source_out: `{3}`,\n speed: `{4}`, \
\n handle_start: `{5}`,\n handle_end: `{6}`".format(
timeline_in,
timeline_out,
source_in,
source_out,
speed,
handle_start,
handle_end
)
)

# loop withing subtrack items
source_in_change = 0
Expand Down Expand Up @@ -102,8 +111,16 @@ def process(self, instance):

source_in += int(source_in_change)
source_out += int(source_out_change * speed)
handle_start += (margin_in)
handle_end += (margin_out)

# make sure there are frames for margin in
if (track_item.handleInLength() >= margin_in) and (
source_in - (handle_start + margin_in >= start_frame)):
handle_start += (margin_in)
# make sure there are frames for margin out
if (track_item.handleOutLength() >= margin_out) and (
(source_out + handle_end + margin_out) <= (start_frame + track_item.sourceDuration() - 1)):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (107 > 79 characters)

handle_end += (margin_out)

self.log.debug("margin: handle_start: '{0}', handle_end: '{1}'".format(handle_start, handle_end))

# add all data to Instance
Expand All @@ -115,7 +132,6 @@ def process(self, instance):
(handle_end * 1000) / 1000.0))
instance.data["speed"] = speed

self.log.debug("timeWarpNodes: {}".format(instance.data["timeWarpNodes"]))
self.log.debug("sourceIn: {}".format(instance.data["sourceIn"]))
self.log.debug("sourceOut: {}".format(instance.data["sourceOut"]))
self.log.debug("speed: {}".format(instance.data["speed"]))
6 changes: 3 additions & 3 deletions pype/plugins/hiero/publish/collect_clips.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def process(self, context):

asset = item.name()
track = item.parent()
clip = item.source()
source = item.source().mediaSource()
source_path = source.firstpath()
clip_in = int(item.timelineIn())
Expand Down Expand Up @@ -130,10 +131,9 @@ def process(self, context):
"isSequence": is_sequence,
"track": track.name(),
"trackIndex": track_index,
"sourceFirst": source_first_frame,
"effects": effects,
"sourceIn": int(item.sourceIn()),
"sourceOut": int(item.sourceOut()),
"sourceIn": int(clip.sourceIn()),
"sourceOut": int(clip.sourceOut()),
"mediaDuration": int(source.duration()),
"clipIn": clip_in,
"clipOut": clip_out,
Expand Down
25 changes: 18 additions & 7 deletions pype/plugins/hiero/publish/collect_frame_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,35 @@


class CollectClipFrameRanges(pyblish.api.InstancePlugin):
"""Collect all frame range data: source(In,Out), timeline(In,Out), edit_(in, out), f(start, end)"""
"""Collect all frame range data.

Collecting data:
sourceIn, sourceOut with handles,
clipIn, clipOut with handles,
clipDuration with handles
frameStart, frameEnd
"""

order = pyblish.api.CollectorOrder + 0.101
label = "Collect Frame Ranges"
hosts = ["hiero"]

def process(self, instance):

data = dict()
data = {}
track_item = instance.data["item"]
item_handle_in = int(track_item.handleInLength())
item_handle_out = int(track_item.handleOutLength())

# Timeline data.
handle_start = instance.data["handleStart"]
handle_end = instance.data["handleEnd"]

source_in_h = instance.data("sourceInH",
instance.data("sourceIn") - handle_start)
source_out_h = instance.data("sourceOutH",
instance.data("sourceOut") + handle_end)
source_in_h = instance.data(
"sourceInH",
(instance.data("sourceIn") + item_handle_in) - handle_start)
source_out_h = instance.data(
"sourceOutH",
(instance.data("sourceOut") - item_handle_out) + handle_end)

timeline_in = instance.data["clipIn"]
timeline_out = instance.data["clipOut"]
Expand Down
7 changes: 2 additions & 5 deletions pype/plugins/hiero/publish/collect_plates.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,15 @@ def process(self, instance):
"version": version
})

source_first_frame = instance.data.get("sourceFirst")
source_file_head = instance.data.get("sourceFileHead")
self.log.debug("source_first_frame: `{}`".format(source_first_frame))

if instance.data.get("isSequence", False):
self.log.info("Is sequence of files")
file = os.path.basename(source_file)
ext = os.path.splitext(file)[-1][1:]
self.log.debug("source_file_head: `{}`".format(source_file_head))
head = source_file_head[:-1]
start_frame = int(source_first_frame + instance.data["sourceInH"])
start_frame = int(instance.data["sourceInH"])
duration = int(
instance.data["sourceOutH"] - instance.data["sourceInH"])
end_frame = start_frame + duration
Expand Down Expand Up @@ -192,8 +190,7 @@ def process(self, instance):
instance.data["representations"].append(
plates_mov_representation)

thumb_frame = instance.data["sourceInH"] + (
(instance.data["sourceOutH"] - instance.data["sourceInH"]) / 2)
thumb_frame = item.sourceIn() + (item.sourceDuration() / 2)
thumb_file = "{}_{}{}".format(head, thumb_frame, ".png")
thumb_path = os.path.join(staging_dir, thumb_file)
self.log.debug("__ thumb_path: `{}`, frame: `{}`".format(
Expand Down
8 changes: 3 additions & 5 deletions pype/plugins/hiero/publish/collect_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class CollectReview(api.InstancePlugin):
families = ["plate"]

def process(self, instance):
is_sequence = instance.data["isSequence"]

# Exclude non-tagged instances.
tagged = False
Expand Down Expand Up @@ -90,20 +89,19 @@ def process(self, instance):
ext = os.path.splitext(file)[-1]

# detect if sequence
if not is_sequence:
if not self.detect_sequence(file)[-1]:
# is video file
files = file
else:
files = list()
source_first = instance.data["sourceFirst"]
self.log.debug("_ file: {}".format(file))
spliter, padding = self.detect_sequence(file)
self.log.debug("_ spliter, padding: {}, {}".format(
spliter, padding))
base_name = file.split(spliter)[0]
collection = clique.Collection(base_name, ext, padding, set(range(
int(source_first + rev_inst.data.get("sourceInH")),
int(source_first + rev_inst.data.get("sourceOutH") + 1))))
int(rev_inst.data.get("sourceInH")),
int(rev_inst.data.get("sourceOutH") + 1))))
self.log.debug("_ collection: {}".format(collection))
real_files = os.listdir(file_dir)
for item in collection:
Expand Down
6 changes: 1 addition & 5 deletions pype/plugins/hiero/publish/collect_tag_framestart.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ def process(self, instance):
start_frame = int(start_frame)
except ValueError:
if "source" in t_value:
source_first = instance.data["sourceFirst"]
if source_first == 0:
source_first = 1
self.log.info("Start frame on `{0}`".format(source_first))
source_in = instance.data["sourceIn"]
self.log.info("Start frame on `{0}`".format(source_in))
start_frame = source_first + source_in
start_frame = source_in

instance.data["startingFrame"] = start_frame
self.log.info("Start frame on `{0}` set to `{1}`".format(
Expand Down