mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Skips audio collection in editorial contexts.
Prevents duplicate audio collection when editorial context already handles audio processing. - Introduces function to get audio instances. - Checks for existing audio instances to avoid duplication. - Skips default audio collection if audio is already provided.
This commit is contained in:
parent
2cfb52ce02
commit
b1cba11f6b
1 changed files with 31 additions and 0 deletions
|
|
@ -46,6 +46,19 @@ class CollectAudio(pyblish.api.ContextPlugin):
|
|||
audio_product_name = "audioMain"
|
||||
|
||||
def process(self, context):
|
||||
# Make sure Editorial related products are excluded
|
||||
# since those are maintained by ExtractOtioAudioTracks
|
||||
audio_instances = self.get_audio_instances(context)
|
||||
self.log.debug("Audio instances: {}".format(len(audio_instances)))
|
||||
|
||||
# QUESTION: perhaps there is a better way to do this?
|
||||
# This is having limitation for cases where no audio instance
|
||||
# is found but still in editorial context. We should perhaps rather
|
||||
# check if the instance is in particular editorial context.
|
||||
if len(audio_instances) >= 1:
|
||||
self.log.info("Audio provided from related instances")
|
||||
return
|
||||
|
||||
# Fake filtering by family inside context plugin
|
||||
filtered_instances = []
|
||||
for instance in pyblish.api.instances_by_plugin(
|
||||
|
|
@ -102,6 +115,24 @@ class CollectAudio(pyblish.api.ContextPlugin):
|
|||
}]
|
||||
self.log.debug("Audio Data added to instance ...")
|
||||
|
||||
def get_audio_instances(self, context):
|
||||
"""Return only instances which are having audio in families
|
||||
|
||||
Args:
|
||||
context (pyblish.context): context of publisher
|
||||
|
||||
Returns:
|
||||
list: list of selected instances
|
||||
"""
|
||||
return [
|
||||
_i for _i in context
|
||||
# filter only those with audio product type or family
|
||||
# and also with reviewAudio data key
|
||||
if bool("audio" in (
|
||||
_i.data.get("families", []) + [_i.data["productType"]])
|
||||
) or _i.data.get("reviewAudio")
|
||||
]
|
||||
|
||||
def query_representations(self, project_name, folder_paths):
|
||||
"""Query representations related to audio products for passed folders.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue