mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
feat(nks): source resolution Tag implementation
This commit is contained in:
parent
111697a3cd
commit
a345090b52
2 changed files with 39 additions and 1 deletions
|
|
@ -49,7 +49,8 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
|
|||
self.log.debug("__ data: {}".format(data))
|
||||
|
||||
# checking if tags are available
|
||||
self.log.debug("__ instance.data[name]: {}".format(instance.data["name"]))
|
||||
self.log.debug("__ instance.data[name]: {}".format(
|
||||
instance.data["name"]))
|
||||
self.log.debug("__ tags: {}".format(tags))
|
||||
|
||||
if not tags:
|
||||
|
|
@ -255,6 +256,21 @@ class CollectHierarchyContext(pyblish.api.ContextPlugin):
|
|||
"handle_end": handle_end
|
||||
})
|
||||
|
||||
# adding SourceResolution if Tag was present
|
||||
s_res = instance.data.get("sourceResolution")
|
||||
if s_res and instance.data.get("main"):
|
||||
item = instance.data["item"]
|
||||
self.log.debug("TrackItem: `{0}`".format(
|
||||
item))
|
||||
width = int(item.source().mediaSource().width())
|
||||
height = int(item.source().mediaSource().height())
|
||||
self.log.info("Source Width and Height are: `{0} x {1}`".format(
|
||||
width, height))
|
||||
in_info['custom_attributes'].update({
|
||||
"resolution_width": width,
|
||||
"resolution_height": height
|
||||
})
|
||||
|
||||
in_info['tasks'] = instance.data['tasks']
|
||||
|
||||
parents = instance.data.get('parents', [])
|
||||
|
|
|
|||
22
pype/plugins/nukestudio/publish/collect_tag_resolution.py
Normal file
22
pype/plugins/nukestudio/publish/collect_tag_resolution.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
from pyblish import api
|
||||
|
||||
|
||||
class CollectClipTagResolution(api.InstancePlugin):
|
||||
"""Collect Source Resolution from Tags of selected track items."""
|
||||
|
||||
order = api.CollectorOrder + 0.013
|
||||
label = "Collect Source Resolution"
|
||||
hosts = ["nukestudio"]
|
||||
families = ['clip']
|
||||
|
||||
def process(self, instance):
|
||||
# gets tags
|
||||
tags = instance.data["tags"]
|
||||
|
||||
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 "resolution" in t_family:
|
||||
instance.data["sourceResolution"] = True
|
||||
Loading…
Add table
Add a link
Reference in a new issue