Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1048 from pypeclub/3.0/bugfix/harmony_regex_filte…
Browse files Browse the repository at this point in the history
…ring

Harmony - use regex search for filtering allowed tasks in collecting …
  • Loading branch information
mkolar authored Feb 24, 2021
2 parents 7e97e8d + cc47f5d commit 708d296
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pype/hosts/harmony/plugins/publish/collect_palettes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Collect palettes from Harmony."""
import os
import json
import re

import pyblish.api
from avalon import harmony
Expand All @@ -11,8 +12,10 @@ class CollectPalettes(pyblish.api.ContextPlugin):
"""Gather palettes from scene when publishing templates."""

label = "Palettes"
order = pyblish.api.CollectorOrder
order = pyblish.api.CollectorOrder + 0.003
hosts = ["harmony"]
# list of regexes for task names where collecting should happen
allowed_tasks = []

def process(self, context):
"""Collector entry point."""
Expand All @@ -22,6 +25,13 @@ def process(self, context):
"function": f"PypeHarmony.Publish.{self_name}.getPalettes",
})["result"]

# skip collecting if not in allowed task
if self.allowed_tasks:
task_name = context.data["anatomyData"]["task"].lower()
if (not any([re.search(pattern, task_name)
for pattern in self.allowed_tasks])):
return

for name, id in palettes.items():
instance = context.create_instance(name)
instance.data.update({
Expand Down

0 comments on commit 708d296

Please sign in to comment.