forked from ynput/OpenPype
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ynput#2387 from pypeclub/feature/OP-2053_Add-valid…
…ator-to-check-correct-version-of-extension-for-PS-and-AE Add validator to check correct version of extension for PS and AE
- Loading branch information
Showing
12 changed files
with
224 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Close AE after publish. For Webpublishing only.""" | ||
import pyblish.api | ||
|
||
from avalon import aftereffects | ||
|
||
|
||
class CloseAE(pyblish.api.ContextPlugin): | ||
"""Close AE after publish. For Webpublishing only. | ||
""" | ||
|
||
order = pyblish.api.IntegratorOrder + 14 | ||
label = "Close AE" | ||
optional = True | ||
active = True | ||
|
||
hosts = ["aftereffects"] | ||
targets = ["remotepublish"] | ||
|
||
def process(self, context): | ||
self.log.info("CloseAE") | ||
|
||
stub = aftereffects.stub() | ||
self.log.info("Shutting down AE") | ||
stub.save() | ||
stub.close() | ||
self.log.info("AE closed") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
openpype/hosts/aftereffects/plugins/publish/collect_extension_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import os | ||
import re | ||
import pyblish.api | ||
|
||
from avalon import aftereffects | ||
|
||
|
||
class CollectExtensionVersion(pyblish.api.ContextPlugin): | ||
""" Pulls and compares version of installed extension. | ||
It is recommended to use same extension as in provided Openpype code. | ||
Please use Anastasiy’s Extension Manager or ZXPInstaller to update | ||
extension in case of an error. | ||
You can locate extension.zxp in your installed Openpype code in | ||
`repos/avalon-core/avalon/aftereffects` | ||
""" | ||
# This technically should be a validator, but other collectors might be | ||
# impacted with usage of obsolete extension, so collector that runs first | ||
# was chosen | ||
order = pyblish.api.CollectorOrder - 0.5 | ||
label = "Collect extension version" | ||
hosts = ["aftereffects"] | ||
|
||
optional = True | ||
active = True | ||
|
||
def process(self, context): | ||
installed_version = aftereffects.stub().get_extension_version() | ||
|
||
if not installed_version: | ||
raise ValueError("Unknown version, probably old extension") | ||
|
||
manifest_url = os.path.join(os.path.dirname(aftereffects.__file__), | ||
"extension", "CSXS", "manifest.xml") | ||
|
||
if not os.path.exists(manifest_url): | ||
self.log.debug("Unable to locate extension manifest, not checking") | ||
return | ||
|
||
expected_version = None | ||
with open(manifest_url) as fp: | ||
content = fp.read() | ||
found = re.findall(r'(ExtensionBundleVersion=")([0-9\.]+)(")', | ||
content) | ||
if found: | ||
expected_version = found[0][1] | ||
|
||
if expected_version != installed_version: | ||
msg = ( | ||
"Expected version '{}' found '{}'\n Please update" | ||
" your installed extension, it might not work properly." | ||
).format(expected_version, installed_version) | ||
|
||
raise ValueError(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
openpype/hosts/photoshop/plugins/publish/collect_extension_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import os | ||
import re | ||
import pyblish.api | ||
|
||
from avalon import photoshop | ||
|
||
|
||
class CollectExtensionVersion(pyblish.api.ContextPlugin): | ||
""" Pulls and compares version of installed extension. | ||
It is recommended to use same extension as in provided Openpype code. | ||
Please use Anastasiy’s Extension Manager or ZXPInstaller to update | ||
extension in case of an error. | ||
You can locate extension.zxp in your installed Openpype code in | ||
`repos/avalon-core/avalon/photoshop` | ||
""" | ||
# This technically should be a validator, but other collectors might be | ||
# impacted with usage of obsolete extension, so collector that runs first | ||
# was chosen | ||
order = pyblish.api.CollectorOrder - 0.5 | ||
label = "Collect extension version" | ||
hosts = ["photoshop"] | ||
|
||
optional = True | ||
active = True | ||
|
||
def process(self, context): | ||
installed_version = photoshop.stub().get_extension_version() | ||
|
||
if not installed_version: | ||
raise ValueError("Unknown version, probably old extension") | ||
|
||
manifest_url = os.path.join(os.path.dirname(photoshop.__file__), | ||
"extension", "CSXS", "manifest.xml") | ||
|
||
if not os.path.exists(manifest_url): | ||
self.log.debug("Unable to locate extension manifest, not checking") | ||
return | ||
|
||
expected_version = None | ||
with open(manifest_url) as fp: | ||
content = fp.read() | ||
|
||
found = re.findall(r'(ExtensionBundleVersion=")([0-10\.]+)(")', | ||
content) | ||
if found: | ||
expected_version = found[0][1] | ||
|
||
if expected_version != installed_version: | ||
msg = "Expected version '{}' found '{}'\n".format( | ||
expected_version, installed_version) | ||
msg += "Please update your installed extension, it might not work " | ||
msg += "properly." | ||
|
||
raise ValueError(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule avalon-core
updated
from 7e5efd to 85c656
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters