fix(nks): removing handles from collectors and shifting all towards use of handleStart/End

This commit is contained in:
Jakub Jezek 2019-07-09 11:13:58 +02:00
parent cb1784a84b
commit 5913bdf34e
9 changed files with 48 additions and 41 deletions

View file

@ -90,9 +90,9 @@ class CollectClips(api.ContextPlugin):
"asset": data["item"].name(),
"family": "clip",
"families": [],
"handles": projectdata.get("handles", 0),
"handleStart": 0,
"handleEnd": 0,
"handles": 0,
"handleStart": projectdata.get("handles", 0),
"handleEnd": projectdata.get("handles", 0),
"version": version
}
)

View file

@ -28,7 +28,6 @@ class CollectClipHandles(api.ContextPlugin):
handles = int(instance.data["handles"])
handle_start = int(instance.data["handleStart"])
handle_end = int(instance.data["handleEnd"])
self.log.debug("_ instance.name: `{}`".format(instance.data["name"]))
if instance.data.get("main"):
name = instance.data["asset"]
@ -42,7 +41,7 @@ class CollectClipHandles(api.ContextPlugin):
})
for instance in filtered_instances:
if not instance.data.get("main"):
if not instance.data.get("main") and not instance.data.get("handleTag"):
self.log.debug("Synchronize handles on: `{}`".format(
instance.data["name"]))
name = instance.data["asset"]

View file

@ -186,10 +186,13 @@ class CollectHierarchyContext(pyblish.api.ContextPlugin):
name = instance.data["asset"]
# get handles
handles = int(instance.data["handles"])
handle_start = int(instance.data["handleStart"] + handles)
handle_end = int(instance.data["handleEnd"] + handles)
# handles = int(instance.data["handles"])
# handle_start = int(instance.data["handleStart"] + handles)
# handle_end = int(instance.data["handleEnd"] + handles)
# new way of dealing with handles (start/end)
handle_start = int(instance.data["handleStart"])
handle_end = int(instance.data["handleEnd"])
# instance.data['startFrame'] = (
# instance.data["item"].timelineIn() - handle_start
# )

View file

@ -57,9 +57,12 @@ class CollectPlates(api.InstancePlugin):
data['asset'], data["subset"], os.path.splitext(data["sourcePath"])[1]
)
# # Timeline data.
# handle_start = int(instance.data["handleStart"] + data["handles"])
# handle_end = int(instance.data["handleEnd"] + data["handles"])
# Timeline data.
handle_start = int(instance.data["handleStart"] + data["handles"])
handle_end = int(instance.data["handleEnd"] + data["handles"])
handle_start = int(instance.data["handleStart"])
handle_end = int(instance.data["handleEnd"])
source_in_h = data["sourceIn"] - handle_start
source_out_h = data["sourceOut"] + handle_end
@ -153,7 +156,6 @@ class CollectPlatesData(api.InstancePlugin):
item = instance.data["item"]
# get handles
handles = int(instance.data["handles"])
handle_start = int(instance.data["handleStart"])
handle_end = int(instance.data["handleEnd"])
@ -184,7 +186,7 @@ class CollectPlatesData(api.InstancePlugin):
fps = instance.data["fps"]
# test output
self.log.debug("__ handles: {}".format(handles))
self.log.debug("__ handles: {}".format(handle_start))
self.log.debug("__ handle_start: {}".format(handle_start))
self.log.debug("__ handle_end: {}".format(handle_end))
self.log.debug("__ frame_start: {}".format(frame_start))
@ -220,7 +222,7 @@ class CollectPlatesData(api.InstancePlugin):
# add to data of representation
version_data.update({
"handles": handles,
"handles": handle_start,
"handleStart": handle_start,
"handleEnd": handle_end,
"sourceIn": source_in,

View file

@ -44,8 +44,7 @@ class CollectShots(api.ContextPlugin):
# Get handles.
data["handleStart"] = instance.data["handleStart"]
data["handleStart"] += data["handles"]
data["handleEnd"] = instance.data["handleEnd"] + data["handles"]
data["handleEnd"] = instance.data["handleEnd"]
# Frame-ranges with handles.
data["sourceInH"] = data["sourceIn"] - data["handleStart"]

View file

@ -13,40 +13,45 @@ class CollectClipTagHandles(api.ContextPlugin):
def process(self, context):
assets_shared = context.data.get("assetsShared")
for instance in context[:]:
self.log.info("Instance.name: `{}`".format(
instance.data["name"]))
# gets tags
tags = instance.data["tags"]
assets_shared_a = assets_shared[instance.data["asset"]]
tag_occurance = 0
for t in tags:
t_metadata = dict(t["metadata"])
t_family = t_metadata.get("tag.family", "")
# gets only task family tags and collect labels
if "handles" in t_family:
tag_occurance += 1
# restore handleStart/End to 0 at first occurance of Tag
if tag_occurance == 1:
instance.data["handleTag"] = True
instance.data["handleStart"] = 0
instance.data["handleEnd"] = 0
# gets value of handles
t_value = int(t_metadata.get("tag.value", ""))
# gets arguments if there are any
t_args = t_metadata.get("tag.args", "")
assert t_args, self.log.error("Tag with Handles is missing Args. Use only handle start/end")
# distribute handles
if not t_args:
# add handles to both sides
instance.data['handles'] = t_value
self.log.info("Collected Handles: `{}`".format(
instance.data['handles']))
else:
t_args = json.loads(t_args.replace("'", "\""))
# add in start
if 'start' in t_args['where']:
instance.data["handleStart"] += t_value
self.log.info("Collected Handle Start: `{}`".format(
instance.data["handleStart"]))
t_args = json.loads(t_args.replace("'", "\""))
# add in start
if 'start' in t_args['where']:
instance.data["handleStart"] += t_value
self.log.info("Collected Handle Start: `{}`".format(
instance.data["handleStart"]))
# add in end
if 'end' in t_args['where']:
instance.data["handleEnd"] += t_value
self.log.info("Collected Handle End: `{}`".format(
instance.data["handleEnd"]))
# add in end
if 'end' in t_args['where']:
instance.data["handleEnd"] += t_value
self.log.info("Collected Handle End: `{}`".format(
instance.data["handleEnd"]))
# adding handles to asset_shared on context
if instance.data.get("handleEnd"):

View file

@ -27,9 +27,8 @@ class ExtractAudioFile(pype.api.Extractor):
staging_dir = instance.data["stagingDir"]
# get handles from context
handles = instance.data["handles"]
handle_start = instance.data["handleStart"] + handles
handle_end = instance.data["handleEnd"] + handles
handle_start = instance.data["handleStart"]
handle_end = instance.data["handleEnd"]
# get sequence from context
sequence = context.data["activeSequence"]

View file

@ -39,12 +39,12 @@ class ExtractPlate(pype.api.Extractor):
item = instance.data["item"]
start_frame = item.mapTimelineToSource(
item.timelineIn() - (
instance.data["handleStart"] + instance.data["handles"]
instance.data["handleStart"]
)
)
end_frame = item.mapTimelineToSource(
item.timelineOut() + (
instance.data["handleEnd"] + instance.data["handles"]
instance.data["handleEnd"]
)
)
framerate = item.sequence().framerate().toFloat()

View file

@ -97,12 +97,12 @@ class ExtractReview(pype.api.Extractor):
# Adding movie representation.
start_frame = int(
instance.data["sourceIn"] - (
instance.data["handleStart"] + instance.data["handles"]
instance.data["handleStart"]
)
)
end_frame = int(
instance.data["sourceOut"] + (
instance.data["handleEnd"] + instance.data["handles"]
instance.data["handleEnd"]
)
)
representation = {