-
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 #45 from quadproduction/release/1.8.0
Release/1.8.0
- Loading branch information
Showing
13 changed files
with
508 additions
and
22 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
quad_pyblish_module/plugins/blender/publish/collect_asset_frames_data.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,27 @@ | ||
import pyblish.api | ||
|
||
|
||
class CollectAssetFramesData(pyblish.api.ContextPlugin): | ||
"""Collect asset frames data into context.""" | ||
|
||
order = pyblish.api.CollectorOrder - 0.099 | ||
label = "Collect Asset Frames Data" | ||
|
||
def process(self, context): | ||
asset_entity = context.data["assetEntity"] | ||
|
||
if asset_entity['type'] != 'asset': | ||
self.log.info("Given entity is not of type asset. Frames values will not be overridden.") | ||
return | ||
|
||
asset_entity_data = asset_entity['data'] | ||
|
||
metadata_in = asset_entity_data.get('in', None) | ||
if metadata_in is not None: | ||
self.log.info("'In' value found for given asset in asset entity metadatas. Will replace default frameStart value.") | ||
context.data['frameStart'] = int(metadata_in) | ||
|
||
metadata_out = asset_entity_data.get('out') | ||
if metadata_out is not None: | ||
self.log.info("'Out' value found for given asset in asset entity metadatas. Will replace default frameEnd value.") | ||
context.data['frameEnd'] = int(metadata_out) |
35 changes: 35 additions & 0 deletions
35
quad_pyblish_module/plugins/blender/publish/validate_frame_start.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,35 @@ | ||
import bpy | ||
|
||
import pyblish.api | ||
|
||
import openpype.hosts.blender.api.action | ||
from openpype.pipeline.publish import ValidateContentsOrder | ||
from openpype.pipeline import ( | ||
PublishXmlValidationError, | ||
OptionalPyblishPluginMixin, | ||
) | ||
|
||
|
||
class ValidateFrameStart( | ||
OptionalPyblishPluginMixin, | ||
pyblish.api.ContextPlugin): | ||
"""Ensure frameStart is equal to the value wanted by OpenPype.""" | ||
|
||
order = ValidateContentsOrder | ||
hosts = ["blender"] | ||
families = ["*"] | ||
label = "Frame Start" | ||
actions = [openpype.hosts.blender.api.action.SelectInvalidAction] | ||
optional = True | ||
|
||
def process(self, context): | ||
registered_frame_start = context.data.get('frameStart', None) | ||
if registered_frame_start is None: | ||
raise RuntimeError( | ||
"Can't retrieve frame start information from OpenPype." | ||
) | ||
scene_frame_start = bpy.context.scene.frame_start | ||
if registered_frame_start != scene_frame_start: | ||
raise RuntimeError( | ||
f"Frame start for scene ({scene_frame_start}) if different from OpenPype's frame start ({registered_frame_start}).)" | ||
) |
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
Empty file.
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,9 @@ | ||
from enum import Enum | ||
|
||
|
||
class ColorMatches(Enum): | ||
REF = 'grain' | ||
UTIL = 'yellowColor' | ||
BG = 'blue' | ||
CH = 'red' | ||
PNG = "violet" |
15 changes: 15 additions & 0 deletions
15
quad_pyblish_module/plugins/photoshop/publish/help/validate_blendmode.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>BlendMode Error</title> | ||
<description> | ||
## Invalid blendMode on layer or group | ||
|
||
Layer must be in Normal blend and Groups in PassThrought. | ||
|
||
### How to repair? | ||
|
||
You can fix this with "repair" button on the right and press Refresh publishing button at the bottom right. | ||
</description> | ||
</error> | ||
</root> |
27 changes: 27 additions & 0 deletions
27
quad_pyblish_module/plugins/photoshop/publish/help/validate_layers_organization.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,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<root> | ||
<error id="main"> | ||
<title>Layer Organization</title> | ||
<description> | ||
## Invalid Organization | ||
|
||
Layers aren't properly organized: | ||
|
||
- Layers must all be in ONE group | ||
- No groups are allowed in groups | ||
|
||
Or you have color problem of your layers, only the following are authorized: | ||
|
||
- REF = Green | ||
- UTIL = Yellow | ||
- BG = Blue | ||
- CH = Red | ||
- PNG = Violet | ||
|
||
### How to repair? | ||
|
||
You can select the default layers with the "Select Layers" button on the right and correct them. | ||
</description> | ||
|
||
</error> | ||
</root> |
31 changes: 31 additions & 0 deletions
31
quad_pyblish_module/plugins/photoshop/publish/help/validate_nomenclature.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,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<root> | ||
<error id="main"> | ||
<title>Subset name</title> | ||
<description> | ||
## Invalid Nomenclature | ||
|
||
Layer name doesn't has the correct name, based on the following recommendations : | ||
- Green layers corresponds to 'REF' and should be named : | ||
- 'XX_REF' for groups | ||
- 'XX_REF_[layer name]' for layers | ||
- Yellow layers corresponds to 'UTIL' and should be named : | ||
- 'XX_UTIL' for groups | ||
- 'XX_UTIL_[layer name]' for layers | ||
- Blue layers corresponds to 'BG' and should be named : | ||
- '[layer number]_BG' for groups | ||
- '[layer number]_BG _[layer name]' for layers | ||
- Red layers corresponds to 'CH' and should be named : | ||
- '[layer number]_CH' for groups | ||
- '[layer number]_CH _[layer name]' for layers | ||
|
||
|
||
{msg} | ||
|
||
### How to repair? | ||
|
||
You can fix this with "repair" button on the right and press Refresh publishing button at the bottom right. | ||
</description> | ||
|
||
</error> | ||
</root> |
73 changes: 73 additions & 0 deletions
73
quad_pyblish_module/plugins/photoshop/publish/validate_blendmode.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,73 @@ | ||
import pyblish.api | ||
from openpype.pipeline.publish import ( | ||
ValidateContentsOrder, | ||
PublishXmlValidationError, | ||
OptionalPyblishPluginMixin | ||
) | ||
from openpype.hosts.photoshop import api as photoshop | ||
|
||
|
||
class ValidateBlendModeRepair(pyblish.api.Action): | ||
"""Repair the instance asset.""" | ||
|
||
label = "Repair" | ||
icon = "wrench" | ||
on = "failed" | ||
|
||
def process(self, context, plugin): | ||
|
||
stub = photoshop.stub() | ||
failed = context.data['transientData'][ValidateBlendMode.__name__] | ||
|
||
for layer, info in failed.items(): | ||
stub.set_blendmode(layer_name=layer, blendMode_name=info["defaultBlendMode"]) | ||
|
||
|
||
class ValidateBlendMode( | ||
OptionalPyblishPluginMixin, | ||
pyblish.api.ContextPlugin | ||
): | ||
"""Validate if the blendMode is set properly on Layers, NORMAL, and Groups, PASSTHROUGH | ||
""" | ||
|
||
label = "Validate BlendMode" | ||
hosts = ["photoshop"] | ||
order = ValidateContentsOrder | ||
families = ["image"] | ||
actions = [ValidateBlendModeRepair] | ||
optional = True | ||
active = False | ||
|
||
def process(self, context): | ||
|
||
if not self.is_active(context.data): | ||
return | ||
|
||
PASSTHROUGH = "passThrough" | ||
NORMAL = "normal" | ||
returnDict = {} | ||
msg = "" | ||
|
||
stub = photoshop.stub() | ||
layers = stub.get_layers() | ||
|
||
for layer in layers: | ||
layerDict = {} | ||
if (layer.group and layer.blendMode != PASSTHROUGH) or (not layer.group and layer.blendMode != NORMAL): | ||
layerDict["actualBlendMode"] = layer.blendMode | ||
layerDict["defaultBlendMode"] = PASSTHROUGH if layer.group else NORMAL | ||
returnDict[layer.name] = layerDict | ||
|
||
typeStr = "Group" if layer.group else "Layer" | ||
msg = "{}\n\n The {} {} is set to {}.".format(msg, typeStr, layer.name, layer.blendMode) | ||
|
||
else: | ||
continue | ||
|
||
if returnDict: | ||
if not context.data.get('transientData'): | ||
context.data['transientData'] = dict() | ||
|
||
context.data['transientData'][self.__class__.__name__] = returnDict | ||
|
||
raise PublishXmlValidationError(self, msg) |
Oops, something went wrong.