Skip to content

Commit

Permalink
Add pyblish family whitelist for photoshop
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementHector committed Feb 14, 2022
1 parent a6c2802 commit 687d4b7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
13 changes: 13 additions & 0 deletions openpype/hosts/photoshop/plugins/publish/collect_instances.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import pyblish.api

from openpype.hosts.photoshop import api as photoshop
Expand Down Expand Up @@ -25,6 +27,11 @@ def process(self, context):
layers = stub.get_layers()
layers_meta = stub.get_layers_metadata()
instance_names = []

families_whitelist = os.getenv("PYBLISH_FAMILY_WHITELIST")
if families_whitelist:
families_whitelist = families_whitelist.split(',')

for layer in layers:
layer_data = stub.read(layer, layers_meta)

Expand All @@ -36,6 +43,12 @@ def process(self, context):
if "container" in layer_data["id"]:
continue

if families_whitelist:
if layer_data["family"] not in families_whitelist:
self.log.info("Skipped instance with not whitelisted "
"family: {}".format(layer_data["family"]))
continue

# child_layers = [*layer.Layers]
# self.log.debug("child_layers {}".format(child_layers))
# if not child_layers:
Expand Down
10 changes: 10 additions & 0 deletions openpype/hosts/photoshop/plugins/publish/collect_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ class CollectReview(pyblish.api.ContextPlugin):

def process(self, context):
family = "review"

families_whitelist = os.getenv("PYBLISH_FAMILY_WHITELIST")
if families_whitelist:
families_whitelist = families_whitelist.split(',')
if families_whitelist:
if family not in families_whitelist:
self.log.info("Skipped instance with not whitelisted "
"family: {}".format(family))
return

task = os.getenv("AVALON_TASK", None)
subset = family + task.capitalize()

Expand Down
9 changes: 9 additions & 0 deletions openpype/hosts/photoshop/plugins/publish/collect_workfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ def process(self, context):
staging_dir = os.path.dirname(file_path)
base_name = os.path.basename(file_path)

families_whitelist = os.getenv("PYBLISH_FAMILY_WHITELIST")
if families_whitelist:
families_whitelist = families_whitelist.split(',')
if families_whitelist:
if 'workfile' not in families_whitelist:
self.log.info("Skipped instance with not whitelisted "
"family: {}".format('workfile'))
return

# Create instance
instance = context.create_instance(subset)
instance.data.update({
Expand Down

0 comments on commit 687d4b7

Please sign in to comment.