-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from quadproduction/release/1.11.0
release/1.11.0
- Loading branch information
Showing
20 changed files
with
259 additions
and
382 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
quad_pyblish_module/plugins/photoshop/publish/help/validate_layers_name_uniqueness.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<root> | ||
<error id="main"> | ||
<title>Unique Layer Name Validator</title> | ||
<description> | ||
## Multiple element names aren't unique | ||
|
||
Layers or Groups share the same name, this is not valid. | ||
|
||
### How to repair? | ||
|
||
You can select the detected layers with the "Select Layers" button on the right, then you need to change the names and make them all unique. | ||
</description> | ||
</error> | ||
</root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
quad_pyblish_module/plugins/photoshop/publish/validate_layers_name_uniqueness.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import pyblish.api | ||
from openpype.pipeline.publish import ( | ||
ValidateContentsOrder, | ||
PublishXmlValidationError, | ||
OptionalPyblishPluginMixin | ||
) | ||
from openpype.hosts.photoshop import api as photoshop | ||
|
||
|
||
class ValidateLayersNameUniquenessRepair(pyblish.api.Action): | ||
"""Select the layers that haven't a unique name""" | ||
|
||
label = "Select Layers" | ||
icon = "briefcase" | ||
on = "failed" | ||
|
||
def process(self, context, plugin): | ||
stub = photoshop.stub() | ||
stub.select_layers(layer for layer in context.data['transientData'][ValidateLayersNameUniqueness.__name__]) | ||
|
||
return True | ||
|
||
|
||
class ValidateLayersNameUniqueness( | ||
OptionalPyblishPluginMixin, | ||
pyblish.api.ContextPlugin | ||
): | ||
"""Validate if all the layers have unique names""" | ||
|
||
label = "Validate Layers Name Uniqueness" | ||
hosts = ["photoshop"] | ||
order = ValidateContentsOrder | ||
families = ["image"] | ||
actions = [ValidateLayersNameUniquenessRepair] | ||
optional = True | ||
active = True | ||
|
||
def process(self, context): | ||
if not self.is_active(context.data): | ||
return | ||
|
||
return_list = list() | ||
msg = "" | ||
|
||
stub = photoshop.stub() | ||
layers = stub.get_layers() | ||
|
||
layer_list = [layer.name for layer in layers] | ||
duplicates = set() | ||
|
||
for layer in layers: | ||
if layer_list.count(layer.name) == 1: | ||
continue | ||
|
||
return_list.append(layer) | ||
if layer.name not in duplicates: | ||
duplicates.add(layer.name) | ||
msg = "{}\n\n The name {} is not unique.".format(msg, layer.name) | ||
|
||
if return_list: | ||
if not context.data.get('transientData'): | ||
context.data['transientData'] = dict() | ||
|
||
context.data['transientData'][self.__class__.__name__] = return_list | ||
raise PublishXmlValidationError(self, msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.