mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge branch 'bugfix/129-nks_coupe_small_fixes' into feature/PYPE-654-nks-cut-reference-videos
This commit is contained in:
commit
7ac7600611
2 changed files with 81 additions and 32 deletions
|
|
@ -47,11 +47,32 @@ class CollectClips(api.ContextPlugin):
|
|||
track = item.parent()
|
||||
source = item.source().mediaSource()
|
||||
source_path = source.firstpath()
|
||||
clip_in = int(item.timelineIn())
|
||||
clip_out = int(item.timelineOut())
|
||||
file_head = source.filenameHead()
|
||||
file_info = next((f for f in source.fileinfos()), None)
|
||||
source_first_frame = file_info.startFrame()
|
||||
is_sequence = False
|
||||
|
||||
self.log.debug(
|
||||
"__ assets_shared: {}".format(context.data["assetsShared"]))
|
||||
match_range = next(
|
||||
(k for k, v in context.data["assetsShared"].items()
|
||||
if (v.get("_clipIn", 0) == clip_in)
|
||||
and (v.get("_clipOut", 0) == clip_out)
|
||||
), False)
|
||||
|
||||
if asset in str(match_range):
|
||||
match_range = False
|
||||
|
||||
assert (not match_range), (
|
||||
"matching clip: {asset}"
|
||||
" timeline range ({clip_in}:{clip_out})"
|
||||
" conflicting with {match_range}"
|
||||
" >> rename any of clips to be the same as the other <<"
|
||||
).format(
|
||||
**locals())
|
||||
|
||||
if not source.singleFile():
|
||||
self.log.info("Single file")
|
||||
is_sequence = True
|
||||
|
|
@ -89,31 +110,31 @@ class CollectClips(api.ContextPlugin):
|
|||
)
|
||||
|
||||
data.update({
|
||||
"name": "{0}_{1}".format(track.name(), item.name()),
|
||||
"item": item,
|
||||
"source": source,
|
||||
"timecodeStart": str(source.timecodeStart()),
|
||||
"timelineTimecodeStart": str(sequence.timecodeStart()),
|
||||
"sourcePath": source_path,
|
||||
"sourceFileHead": file_head,
|
||||
"isSequence": is_sequence,
|
||||
"track": track.name(),
|
||||
"trackIndex": track_index,
|
||||
"sourceFirst": source_first_frame,
|
||||
"effects": effects,
|
||||
"sourceIn": int(item.sourceIn()),
|
||||
"sourceOut": int(item.sourceOut()),
|
||||
"mediaDuration": source.duration(),
|
||||
"clipIn": int(item.timelineIn()),
|
||||
"clipOut": int(item.timelineOut()),
|
||||
"clipDuration": (
|
||||
int(item.timelineOut()) - int(
|
||||
item.timelineIn())) + 1,
|
||||
"asset": asset,
|
||||
"family": "clip",
|
||||
"families": [],
|
||||
"handleStart": projectdata.get("handleStart", 0),
|
||||
"handleEnd": projectdata.get("handleEnd", 0)})
|
||||
"name": "{0}_{1}".format(track.name(), item.name()),
|
||||
"item": item,
|
||||
"source": source,
|
||||
"timecodeStart": str(source.timecodeStart()),
|
||||
"timelineTimecodeStart": str(sequence.timecodeStart()),
|
||||
"sourcePath": source_path,
|
||||
"sourceFileHead": file_head,
|
||||
"isSequence": is_sequence,
|
||||
"track": track.name(),
|
||||
"trackIndex": track_index,
|
||||
"sourceFirst": source_first_frame,
|
||||
"effects": effects,
|
||||
"sourceIn": int(item.sourceIn()),
|
||||
"sourceOut": int(item.sourceOut()),
|
||||
"mediaDuration": source.duration(),
|
||||
"clipIn": clip_in,
|
||||
"clipOut": clip_out,
|
||||
"clipDuration": (
|
||||
int(item.timelineOut()) - int(
|
||||
item.timelineIn())) + 1,
|
||||
"asset": asset,
|
||||
"family": "clip",
|
||||
"families": [],
|
||||
"handleStart": projectdata.get("handleStart", 0),
|
||||
"handleEnd": projectdata.get("handleEnd", 0)})
|
||||
|
||||
instance = context.create_instance(**data)
|
||||
|
||||
|
|
@ -121,7 +142,10 @@ class CollectClips(api.ContextPlugin):
|
|||
self.log.info("Created instance.data: {}".format(instance.data))
|
||||
self.log.debug(">> effects: {}".format(instance.data["effects"]))
|
||||
|
||||
context.data["assetsShared"][asset] = dict()
|
||||
context.data["assetsShared"][asset] = {
|
||||
"_clipIn": clip_in,
|
||||
"_clipOut": clip_out
|
||||
}
|
||||
|
||||
# from now we are collecting only subtrackitems on
|
||||
# track with no video items
|
||||
|
|
|
|||
|
|
@ -37,11 +37,13 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
|
|||
assets_shared = context.data.get("assetsShared")
|
||||
tags = instance.data.get("tags", None)
|
||||
clip = instance.data["item"]
|
||||
asset = instance.data.get("asset")
|
||||
asset = instance.data["asset"]
|
||||
sequence = context.data['activeSequence']
|
||||
width = int(sequence.format().width())
|
||||
height = int(sequence.format().height())
|
||||
pixel_aspect = sequence.format().pixelAspect()
|
||||
clip_in = instance.data["clipIn"]
|
||||
clip_out = instance.data["clipOut"]
|
||||
fps = context.data["fps"]
|
||||
|
||||
# build data for inner nukestudio project property
|
||||
|
|
@ -72,6 +74,24 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
|
|||
|
||||
# and finding only hierarchical tag
|
||||
if "hierarchy" in t_type.lower():
|
||||
match = next(
|
||||
(k for k, v in assets_shared.items()
|
||||
if (v["_clipIn"] == clip_in)
|
||||
and (v["_clipOut"] == clip_out)
|
||||
), False)
|
||||
self.log.warning("Clip matching name: {}".format(match))
|
||||
self.log.debug(
|
||||
"__ assets_shared[match]: {}".format(
|
||||
assets_shared[match]))
|
||||
# check if hierarchy key is in match
|
||||
if not assets_shared[match].get("hierarchy"):
|
||||
match = False
|
||||
assert not match, (
|
||||
"Two clips above each other with"
|
||||
" hierarchy tag are not allowed"
|
||||
" >> keep hierarchy tag only in one of them <<"
|
||||
)
|
||||
|
||||
d_metadata = dict()
|
||||
parents = list()
|
||||
|
||||
|
|
@ -82,7 +102,8 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
|
|||
if "shot" in template.lower():
|
||||
instance.data["asset"] = [
|
||||
t for t in template.split('/')][-1]
|
||||
template = "/".join([t for t in template.split('/')][0:-1])
|
||||
template = "/".join(
|
||||
[t for t in template.split('/')][0:-1])
|
||||
|
||||
# take template from Tag.note and break it into parts
|
||||
template_split = template.split("/")
|
||||
|
|
@ -149,8 +170,12 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
|
|||
instance.data["hierarchy"] = hierarchy
|
||||
instance.data["parents"] = parents
|
||||
|
||||
self.log.info(
|
||||
"clip: {asset}[{clip_in}:{clip_out}]".format(
|
||||
**locals()))
|
||||
# adding to asset shared dict
|
||||
self.log.debug("__ assets_shared: {}".format(assets_shared))
|
||||
self.log.debug(
|
||||
"__ assets_shared: {}".format(assets_shared))
|
||||
if assets_shared.get(asset):
|
||||
self.log.debug("Adding to shared assets: `{}`".format(
|
||||
asset))
|
||||
|
|
@ -166,7 +191,7 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
|
|||
"resolutionHeight": height,
|
||||
"pixelAspect": pixel_aspect,
|
||||
"fps": fps,
|
||||
"tasks": instance.data["tasks"]
|
||||
"tasks": instance.data["tasks"]
|
||||
})
|
||||
|
||||
# adding frame start if any on instance
|
||||
|
|
@ -175,8 +200,8 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
|
|||
asset_shared.update({
|
||||
"startingFrame": start_frame
|
||||
})
|
||||
|
||||
|
||||
self.log.debug(
|
||||
"assets_shared: {assets_shared}".format(**locals()))
|
||||
|
||||
class CollectHierarchyContext(pyblish.api.ContextPlugin):
|
||||
'''Collecting Hierarchy from instaces and building
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue