mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #492 from ynput/enhancement/AY-5146_Hiero--enhancing-effect-publishing-categorization
Hiero: enhancing effect publishing categorization - AY-5146
This commit is contained in:
commit
2aa62067dd
5 changed files with 43 additions and 5 deletions
|
|
@ -12,6 +12,7 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
|
|||
settings_category = "hiero"
|
||||
|
||||
effect_categories = []
|
||||
effect_tracks = []
|
||||
|
||||
def process(self, instance):
|
||||
product_type = "effect"
|
||||
|
|
@ -74,6 +75,7 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
|
|||
|
||||
product_name_split.insert(0, "effect")
|
||||
|
||||
# Categorize effects by class.
|
||||
effect_categories = {
|
||||
x["name"]: x["effect_classes"] for x in self.effect_categories
|
||||
}
|
||||
|
|
@ -84,7 +86,6 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
|
|||
category_by_effect[cls] = key
|
||||
|
||||
effects_categorized = {k: {} for k in effect_categories.keys()}
|
||||
effects_categorized[""] = {}
|
||||
for key, value in effects.items():
|
||||
if key == "assignTo":
|
||||
continue
|
||||
|
|
@ -95,8 +96,29 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
|
|||
if cls in value["class"]:
|
||||
found_cls = cls
|
||||
|
||||
if not found_cls:
|
||||
continue
|
||||
|
||||
effects_categorized[category_by_effect[found_cls]][key] = value
|
||||
|
||||
# Categorize effects by track name.
|
||||
track_names_by_category = {
|
||||
x["name"]: x["track_names"] for x in self.effect_tracks
|
||||
}
|
||||
for category, track_names in track_names_by_category.items():
|
||||
for key, value in effects.items():
|
||||
if key == "assignTo":
|
||||
continue
|
||||
|
||||
if value["track"] not in track_names:
|
||||
continue
|
||||
|
||||
if category in effects_categorized:
|
||||
effects_categorized[category][key] = value
|
||||
else:
|
||||
effects_categorized[category] = {key: value}
|
||||
|
||||
# Ensure required `assignTo` data member exists.
|
||||
categories = list(effects_categorized.keys())
|
||||
for category in categories:
|
||||
if not effects_categorized[category]:
|
||||
|
|
@ -105,6 +127,10 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
|
|||
|
||||
effects_categorized[category]["assignTo"] = effects["assignTo"]
|
||||
|
||||
# If no effects have been categorized, publish all effects together.
|
||||
if not effects_categorized:
|
||||
effects_categorized[""] = effects
|
||||
|
||||
for category, effects in effects_categorized.items():
|
||||
product_name = "".join(product_name_split)
|
||||
product_name += category.capitalize()
|
||||
|
|
|
|||
|
|
@ -235,7 +235,8 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
|
|||
"productName": product_name,
|
||||
"productType": product_type,
|
||||
"family": product_type,
|
||||
"families": [product_type]
|
||||
"families": [product_type],
|
||||
"integrate": False,
|
||||
})
|
||||
|
||||
instance = context.create_instance(**data)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Package declaring AYON addon 'hiero' version."""
|
||||
__version__ = "0.2.0"
|
||||
__version__ = "0.2.1"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
name = "hiero"
|
||||
title = "Hiero"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
client_dir = "ayon_hiero"
|
||||
|
||||
ayon_required_addons = {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,21 @@ class CollectClipEffectsDefModel(BaseSettingsModel):
|
|||
return normalize_name(value)
|
||||
|
||||
|
||||
class CollectClipEffectsTracksModel(BaseSettingsModel):
|
||||
_layout = "expanded"
|
||||
name: str = SettingsField("", title="Name")
|
||||
track_names: list[str] = SettingsField("", title="Track Names")
|
||||
|
||||
|
||||
class CollectClipEffectsModel(BaseSettingsModel):
|
||||
effect_categories: list[CollectClipEffectsDefModel] = SettingsField(
|
||||
default_factory=list, title="Effect Categories"
|
||||
)
|
||||
|
||||
effect_tracks: list[CollectClipEffectsTracksModel] = SettingsField(
|
||||
default_factory=list, title="Effect Tracks"
|
||||
)
|
||||
|
||||
@validator("effect_categories")
|
||||
def validate_unique_outputs(cls, value):
|
||||
ensure_unique_names(value)
|
||||
|
|
@ -40,6 +50,7 @@ class PublishPluginsModel(BaseSettingsModel):
|
|||
|
||||
DEFAULT_PUBLISH_PLUGIN_SETTINGS = {
|
||||
"CollectClipEffectsModel": {
|
||||
"effect_categories": []
|
||||
"effect_categories": [],
|
||||
"effect_tracks": []
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue