Skip to content

Commit

Permalink
Merge pull request #492 from ynput/enhancement/AY-5146_Hiero--enhanci…
Browse files Browse the repository at this point in the history
…ng-effect-publishing-categorization

Hiero: enhancing effect publishing categorization - AY-5146
  • Loading branch information
jakubjezek001 authored Jun 7, 2024
2 parents 473cd3d + d323844 commit 2aa6206
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
settings_category = "hiero"

effect_categories = []
effect_tracks = []

def process(self, instance):
product_type = "effect"
Expand Down Expand Up @@ -74,6 +75,7 @@ def process(self, instance):

product_name_split.insert(0, "effect")

# Categorize effects by class.
effect_categories = {
x["name"]: x["effect_classes"] for x in self.effect_categories
}
Expand All @@ -84,7 +86,6 @@ def process(self, instance):
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
Expand All @@ -95,8 +96,29 @@ def process(self, instance):
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]:
Expand All @@ -105,6 +127,10 @@ def process(self, instance):

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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ def create_shot_instance(self, context, **data):
"productName": product_name,
"productType": product_type,
"family": product_type,
"families": [product_type]
"families": [product_type],
"integrate": False,
})

instance = context.create_instance(**data)
Expand Down
2 changes: 1 addition & 1 deletion server_addon/hiero/client/ayon_hiero/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring AYON addon 'hiero' version."""
__version__ = "0.2.0"
__version__ = "0.2.1"
2 changes: 1 addition & 1 deletion server_addon/hiero/package.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "hiero"
title = "Hiero"
version = "0.2.0"
version = "0.2.1"
client_dir = "ayon_hiero"

ayon_required_addons = {
Expand Down
13 changes: 12 additions & 1 deletion server_addon/hiero/server/settings/publish_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,21 @@ def validate_name(cls, value):
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)
Expand All @@ -40,6 +50,7 @@ class PublishPluginsModel(BaseSettingsModel):

DEFAULT_PUBLISH_PLUGIN_SETTINGS = {
"CollectClipEffectsModel": {
"effect_categories": []
"effect_categories": [],
"effect_tracks": []
}
}

0 comments on commit 2aa6206

Please sign in to comment.