Merged in tokejepsen/pype/bugfix/maya_validate_attributes (pull request #276)

Long/Short attribute names and plugin optional

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Toke Jepsen 2019-09-02 15:13:46 +00:00 committed by Milan Kolar
commit ca2ee7adcb

View file

@ -20,6 +20,7 @@ class ValidateAttributes(pyblish.api.ContextPlugin):
label = "Attributes" label = "Attributes"
hosts = ["maya"] hosts = ["maya"]
actions = [pype.api.RepairContextAction] actions = [pype.api.RepairContextAction]
optional = True
def process(self, context): def process(self, context):
# Check for preset existence. # Check for preset existence.
@ -74,8 +75,12 @@ class ValidateAttributes(pyblish.api.ContextPlugin):
presets_to_validate = attributes[name] presets_to_validate = attributes[name]
for attribute in node.listAttr(): for attribute in node.listAttr():
if attribute.attrName() in presets_to_validate: names = [attribute.shortName(), attribute.longName()]
expected = presets_to_validate[attribute.attrName()] attribute_name = list(
set(names) & set(presets_to_validate.keys())
)
if attribute_name:
expected = presets_to_validate[attribute_name[0]]
if attribute.get() != expected: if attribute.get() != expected:
invalid_attributes.append( invalid_attributes.append(
{ {