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

Harmony - add regex search to filter allowed task names for collectin… #1047

Merged
merged 1 commit into from
Feb 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pype/plugins/harmony/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 @@ -13,7 +14,8 @@ class CollectPalettes(pyblish.api.ContextPlugin):
label = "Palettes"
order = pyblish.api.CollectorOrder + 0.003
hosts = ["harmony"]
allowed_tasks = [] # list of task names where collecting should happen
# list of regexes for task names where collecting should happen
allowed_tasks = []

def process(self, context):
"""Collector entry point."""
Expand All @@ -25,9 +27,9 @@ def process(self, context):

# skip collecting if not in allowed task
if self.allowed_tasks:
self.allowed_tasks = [task.lower() for task in self.allowed_tasks]
if context.data["anatomyData"]["task"].lower() \
not in 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():
Expand Down