diff --git a/pype/plugins/hiero/publish/collect_calculate_retime.py b/pype/plugins/hiero/publish/collect_calculate_retime.py index 1b2f047da24..77da76d801a 100644 --- a/pype/plugins/hiero/publish/collect_calculate_retime.py +++ b/pype/plugins/hiero/publish/collect_calculate_retime.py @@ -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 @@ -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)): + handle_end += (margin_out) + self.log.debug("margin: handle_start: '{0}', handle_end: '{1}'".format(handle_start, handle_end)) # add all data to Instance @@ -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"])) diff --git a/pype/plugins/hiero/publish/collect_clips.py b/pype/plugins/hiero/publish/collect_clips.py index 44de68224d5..c8e5bf71e2e 100644 --- a/pype/plugins/hiero/publish/collect_clips.py +++ b/pype/plugins/hiero/publish/collect_clips.py @@ -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()) @@ -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, diff --git a/pype/plugins/hiero/publish/collect_frame_ranges.py b/pype/plugins/hiero/publish/collect_frame_ranges.py index 19a46d80b15..333aa9f6c41 100644 --- a/pype/plugins/hiero/publish/collect_frame_ranges.py +++ b/pype/plugins/hiero/publish/collect_frame_ranges.py @@ -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"] diff --git a/pype/plugins/hiero/publish/collect_plates.py b/pype/plugins/hiero/publish/collect_plates.py index 7b671ef718b..b3fe5fd7e72 100644 --- a/pype/plugins/hiero/publish/collect_plates.py +++ b/pype/plugins/hiero/publish/collect_plates.py @@ -144,9 +144,7 @@ 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") @@ -154,7 +152,7 @@ def process(self, instance): 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 @@ -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( diff --git a/pype/plugins/hiero/publish/collect_review.py b/pype/plugins/hiero/publish/collect_review.py index f1767b2a681..7c7de8750b6 100644 --- a/pype/plugins/hiero/publish/collect_review.py +++ b/pype/plugins/hiero/publish/collect_review.py @@ -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 @@ -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: diff --git a/pype/plugins/hiero/publish/collect_tag_framestart.py b/pype/plugins/hiero/publish/collect_tag_framestart.py index 0d14271aa5a..e1ea98de011 100644 --- a/pype/plugins/hiero/publish/collect_tag_framestart.py +++ b/pype/plugins/hiero/publish/collect_tag_framestart.py @@ -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(