mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
feat(resolve): activating publish on instances
This commit is contained in:
parent
1f65c27c1b
commit
dbf0438f36
2 changed files with 38 additions and 17 deletions
|
|
@ -61,6 +61,9 @@ def install():
|
|||
avalon.register_plugin_path(avalon.Creator, CREATE_PATH)
|
||||
avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
|
||||
|
||||
# register callback for switching publishable
|
||||
pyblish.register_callback("instanceToggled", on_pyblish_instance_toggled)
|
||||
|
||||
get_resolve_module()
|
||||
|
||||
|
||||
|
|
@ -83,6 +86,9 @@ def uninstall():
|
|||
avalon.deregister_plugin_path(avalon.Creator, CREATE_PATH)
|
||||
avalon.deregister_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
|
||||
|
||||
# register callback for switching publishable
|
||||
pyblish.deregister_callback("instanceToggled", on_pyblish_instance_toggled)
|
||||
|
||||
|
||||
def containerise(track_item,
|
||||
name,
|
||||
|
|
@ -241,3 +247,18 @@ def reset_selection():
|
|||
"""Deselect all selected nodes
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def on_pyblish_instance_toggled(instance, old_value, new_value):
|
||||
"""Toggle node passthrough states on instance toggles."""
|
||||
|
||||
log.info("instance toggle: {}, old_value: {}, new_value:{} ".format(
|
||||
instance, old_value, new_value))
|
||||
|
||||
from pype.hosts.resolve import (
|
||||
set_publish_attribute
|
||||
)
|
||||
|
||||
# Whether instances should be passthrough based on new value
|
||||
track_item = instance.data["item"]
|
||||
set_publish_attribute(track_item, new_value)
|
||||
|
|
|
|||
|
|
@ -22,21 +22,21 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
len(selected_track_items)))
|
||||
|
||||
for track_item_data in selected_track_items:
|
||||
self.log.debug(pformat(track_item_data))
|
||||
|
||||
data = dict()
|
||||
track_item = track_item_data["clip"]["item"]
|
||||
self.log.debug(track_item)
|
||||
|
||||
# get pype tag data
|
||||
tag_parsed_data = resolve.get_track_item_pype_tag(track_item)
|
||||
self.log.debug(pformat(tag_parsed_data))
|
||||
tag_data = resolve.get_track_item_pype_tag(track_item)
|
||||
self.log.debug(f"__ tag_data: {pformat(tag_data)}")
|
||||
|
||||
if not tag_parsed_data:
|
||||
if not tag_data:
|
||||
continue
|
||||
|
||||
if tag_parsed_data.get("id") != "pyblish.avalon.instance":
|
||||
if tag_data.get("id") != "pyblish.avalon.instance":
|
||||
continue
|
||||
|
||||
compound_source_prop = tag_parsed_data["sourceProperties"]
|
||||
compound_source_prop = tag_data["sourceProperties"]
|
||||
self.log.debug(f"compound_source_prop: {compound_source_prop}")
|
||||
|
||||
# source = track_item_data.GetMediaPoolItem()
|
||||
|
|
@ -44,27 +44,27 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
source_path = os.path.normpath(
|
||||
compound_source_prop["File Path"])
|
||||
source_name = compound_source_prop["File Name"]
|
||||
source_id = tag_parsed_data["sourceId"]
|
||||
source_id = tag_data["sourceId"]
|
||||
self.log.debug(f"source_path: {source_path}")
|
||||
self.log.debug(f"source_name: {source_name}")
|
||||
self.log.debug(f"source_id: {source_id}")
|
||||
|
||||
# add tag data to instance data
|
||||
data.update({
|
||||
k: v for k, v in tag_parsed_data.items()
|
||||
k: v for k, v in tag_data.items()
|
||||
if k not in ("id", "applieswhole", "label")
|
||||
})
|
||||
|
||||
asset = tag_parsed_data["asset"]
|
||||
subset = tag_parsed_data["subset"]
|
||||
review = tag_parsed_data["review"]
|
||||
asset = tag_data["asset"]
|
||||
subset = tag_data["subset"]
|
||||
review = tag_data["review"]
|
||||
|
||||
# insert family into families
|
||||
family = tag_parsed_data["family"]
|
||||
families = [str(f) for f in tag_parsed_data["families"]]
|
||||
family = tag_data["family"]
|
||||
families = [str(f) for f in tag_data["families"]]
|
||||
families.insert(0, str(family))
|
||||
|
||||
track = tag_parsed_data["track_data"]["name"]
|
||||
track = tag_data["track_data"]["name"]
|
||||
base_name = os.path.basename(source_path)
|
||||
file_head = os.path.splitext(base_name)[0]
|
||||
# source_first_frame = int(file_info.startFrame())
|
||||
|
|
@ -78,9 +78,9 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
"asset": asset,
|
||||
"item": track_item,
|
||||
"families": families,
|
||||
|
||||
"publish": resolve.get_publish_attribute(track_item),
|
||||
# tags
|
||||
"tags": tag_parsed_data,
|
||||
"tags": tag_data,
|
||||
|
||||
# track item attributes
|
||||
"track": track,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue