From 963d6fb18ffaecf5eba00b940f29ebcecf60a28d Mon Sep 17 00:00:00 2001 From: Toke Jepsen Date: Sun, 3 Nov 2019 18:41:23 +0000 Subject: [PATCH] Validate containers. --- .../global/publish/validate_containers.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pype/plugins/global/publish/validate_containers.py diff --git a/pype/plugins/global/publish/validate_containers.py b/pype/plugins/global/publish/validate_containers.py new file mode 100644 index 0000000000..44cb5def3c --- /dev/null +++ b/pype/plugins/global/publish/validate_containers.py @@ -0,0 +1,28 @@ +import pyblish.api + +import pype.lib +from avalon.tools import cbsceneinventory + + +class ShowInventory(pyblish.api.Action): + + label = "Show Inventory" + icon = "briefcase" + on = "failed" + + def process(self, context, plugin): + cbsceneinventory.show() + + +class ValidateContainers(pyblish.api.ContextPlugin): + """Containers are must be updated to latest version on publish.""" + + label = "Validate Containers" + order = pyblish.api.ValidatorOrder + hosts = ["maya", "houdini", "nuke"] + optional = True + actions = [ShowInventory] + + def process(self, context): + if pype.lib.any_outdated(): + raise ValueError("There are outdated containers in the scene.")