mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
* Tweak log levels and message to be more informative to artist in report page * Tweak levels and clarity of logs * Tweak levels and clarity of logs + tweak grammar * Cosmetics * Improve logging * Simplify logging * Convert to debug log if it's skipping thumbnail integration if there's no thumbnail whatsoever to integrate * Tweak to debug since they only show representation ids hardly understandable to the artist * Match logging message across hosts + include filepath for full clarity * Tweak message to clarify it only starts checking and not that it requires filling + to debug log * Tweak to debug log if there's basically no thumbnail to integrate at the end * Tweak log levels - Artist doesn't care what's prepared, especially since afterwards it's logged what gets written to the database anyway * Log clearly it's processing a legacy instance * Cosmetics
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
import os
|
|
import pyblish.api
|
|
|
|
from openpype.lib import get_version_from_path
|
|
from openpype.tests.lib import is_in_tests
|
|
|
|
|
|
class CollectSceneVersion(pyblish.api.ContextPlugin):
|
|
"""Finds version in the filename or passes the one found in the context
|
|
Arguments:
|
|
version (int, optional): version number of the publish
|
|
"""
|
|
|
|
order = pyblish.api.CollectorOrder
|
|
label = 'Collect Scene Version'
|
|
# configurable in Settings
|
|
hosts = [
|
|
"aftereffects",
|
|
"blender",
|
|
"celaction",
|
|
"fusion",
|
|
"harmony",
|
|
"hiero",
|
|
"houdini",
|
|
"maya",
|
|
"nuke",
|
|
"photoshop",
|
|
"resolve",
|
|
"tvpaint"
|
|
]
|
|
|
|
# in some cases of headless publishing (for example webpublisher using PS)
|
|
# you want to ignore version from name and let integrate use next version
|
|
skip_hosts_headless_publish = []
|
|
|
|
def process(self, context):
|
|
# tests should be close to regular publish as possible
|
|
if (
|
|
os.environ.get("HEADLESS_PUBLISH")
|
|
and not is_in_tests()
|
|
and context.data["hostName"] in self.skip_hosts_headless_publish):
|
|
self.log.debug("Skipping for headless publishing")
|
|
return
|
|
|
|
assert context.data.get('currentFile'), "Cannot get current file"
|
|
filename = os.path.basename(context.data.get('currentFile'))
|
|
|
|
if '<shell>' in filename:
|
|
return
|
|
|
|
self.log.debug(
|
|
"Collecting scene version from filename: {}".format(filename)
|
|
)
|
|
|
|
version = get_version_from_path(filename)
|
|
assert version, "Cannot determine version"
|
|
|
|
rootVersion = int(version)
|
|
context.data['version'] = rootVersion
|
|
self.log.info('Scene Version: %s' % context.data.get('version'))
|