ayon-core/openpype/plugins/publish/validate_version.py
Roy Nieterau abf0d2b6a0 Add houdini for validate version
(cherry picked from commit bc55371de067c75511fb7f906989cd4f3c2f5aaf)
2022-01-14 18:00:01 +01:00

29 lines
972 B
Python

import pyblish.api
class ValidateVersion(pyblish.api.InstancePlugin):
"""Validate instance version.
Pype is not allowing overwiting previously published versions.
"""
order = pyblish.api.ValidatorOrder
label = "Validate Version"
hosts = ["nuke", "maya", "houdini", "blender", "standalonepublisher"]
optional = False
active = True
def process(self, instance):
version = instance.data.get("version")
latest_version = instance.data.get("latestVersion")
if latest_version is not None:
msg = (
"Version `{0}` from instance `{1}` that you are trying to"
" publish, already exists in the database. Version in"
" database: `{2}`. Please version up your workfile to a higher"
" version number than: `{2}`."
).format(version, instance.data["name"], latest_version)
assert (int(version) > int(latest_version)), msg