ayon-core/pype/plugins/nukestudio/publish/validate_names.py
2019-05-23 15:10:05 +02:00

31 lines
973 B
Python

from pyblish import api
class ValidateNames(api.InstancePlugin):
"""Validate sequence, video track and track item names.
When creating output directories with the name of an item, ending with a
whitespace will fail the extraction.
Exact matching to optimize processing.
"""
order = api.ValidatorOrder
families = ["clip"]
match = api.Exact
label = "Names"
hosts = ["nukestudio"]
def process(self, instance):
item = instance.data["item"]
msg = "Track item \"{0}\" ends with a whitespace."
assert not item.name().endswith(" "), msg.format(item.name())
msg = "Video track \"{0}\" ends with a whitespace."
msg = msg.format(item.parent().name())
assert not item.parent().name().endswith(" "), msg
msg = "Sequence \"{0}\" ends with a whitespace."
msg = msg.format(item.parent().parent().name())
assert not item.parent().parent().name().endswith(" "), msg