Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Flag outdated containers on startup and publish. #309

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion pype/hosts/photoshop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,48 @@
import os
import sys

from avalon import api
from avalon import api, io
from avalon.vendor import Qt
from pype import lib
import pyblish.api


def check_inventory():
if not lib.any_outdated():
return

host = api.registered_host()
outdated_containers = []
for container in host.ls():
representation = container['representation']
representation_doc = io.find_one(
{
"_id": io.ObjectId(representation),
"type": "representation"
},
projection={"parent": True}
)
if representation_doc and not lib.is_latest(representation_doc):
outdated_containers.append(container)

# Warn about outdated containers.
print("Starting new QApplication..")
app = Qt.QtWidgets.QApplication(sys.argv)

message_box = Qt.QtWidgets.QMessageBox()
message_box.setIcon(Qt.QtWidgets.QMessageBox.Warning)
msg = "There are outdated containers in the scene."
message_box.setText(msg)
message_box.exec_()

# Garbage collect QApplication.
del app
iLLiCiTiT marked this conversation as resolved.
Show resolved Hide resolved


def application_launch():
check_inventory()


def install():
print("Installing Pype config...")

Expand All @@ -27,6 +66,8 @@ def install():
"instanceToggled", on_pyblish_instance_toggled
)

api.on("application.launched", application_launch)


def on_pyblish_instance_toggled(instance, old_value, new_value):
"""Toggle layer visibility on instance toggles."""
Expand Down
2 changes: 1 addition & 1 deletion pype/plugins/global/publish/validate_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ValidateContainers(pyblish.api.ContextPlugin):

label = "Validate Containers"
order = pyblish.api.ValidatorOrder
hosts = ["maya", "houdini", "nuke"]
hosts = ["maya", "houdini", "nuke", "photoshop"]
optional = True
actions = [ShowInventory]

Expand Down