mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Change assertions to KnownPublishError
This commit is contained in:
parent
096f913fe6
commit
7dc6158fb8
1 changed files with 10 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ import pyblish.api
|
|||
|
||||
from openpype.lib import get_version_from_path
|
||||
from openpype.tests.lib import is_in_tests
|
||||
from openpype.pipeline import KnownPublishError
|
||||
|
||||
|
||||
class CollectSceneVersion(pyblish.api.ContextPlugin):
|
||||
|
|
@ -38,18 +39,24 @@ class CollectSceneVersion(pyblish.api.ContextPlugin):
|
|||
if (
|
||||
os.environ.get("HEADLESS_PUBLISH")
|
||||
and not is_in_tests()
|
||||
and context.data["hostName"] in self.skip_hosts_headless_publish):
|
||||
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"
|
||||
if not context.data.get('currentFile'):
|
||||
raise KnownPublishError("Cannot get current workfile path. "
|
||||
"Make sure your scene is saved.")
|
||||
|
||||
filename = os.path.basename(context.data.get('currentFile'))
|
||||
|
||||
if '<shell>' in filename:
|
||||
return
|
||||
|
||||
version = get_version_from_path(filename)
|
||||
assert version, "Cannot determine version"
|
||||
if version is None:
|
||||
raise KnownPublishError("Unable to retrieve version number from "
|
||||
"filename: {}".format(filename))
|
||||
|
||||
rootVersion = int(version)
|
||||
context.data['version'] = rootVersion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue