mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Validate required modules for AssetCreator action.
This commit is contained in:
parent
f5e5e407d3
commit
7b6eaf433a
1 changed files with 17 additions and 8 deletions
|
|
@ -1,9 +1,4 @@
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import acre
|
|
||||||
|
|
||||||
from avalon import api, lib
|
from avalon import api, lib
|
||||||
from pype.tools import assetcreator
|
|
||||||
|
|
||||||
from pype.api import Logger
|
from pype.api import Logger
|
||||||
|
|
||||||
|
|
@ -19,9 +14,23 @@ class AssetCreator(api.Action):
|
||||||
|
|
||||||
def is_compatible(self, session):
|
def is_compatible(self, session):
|
||||||
"""Return whether the action is compatible with the session"""
|
"""Return whether the action is compatible with the session"""
|
||||||
if "AVALON_PROJECT" in session:
|
compatible = True
|
||||||
return True
|
|
||||||
return False
|
# Check required modules.
|
||||||
|
module_names = [
|
||||||
|
"ftrack_api", "ftrack_api_old", "pype.tools.assetcreator"
|
||||||
|
]
|
||||||
|
for name in module_names:
|
||||||
|
try:
|
||||||
|
__import__(name)
|
||||||
|
except ImportError:
|
||||||
|
compatible = False
|
||||||
|
|
||||||
|
# Check session environment.
|
||||||
|
if "AVALON_PROJECT" not in session:
|
||||||
|
compatible = False
|
||||||
|
|
||||||
|
return compatible
|
||||||
|
|
||||||
def process(self, session, **kwargs):
|
def process(self, session, **kwargs):
|
||||||
asset = ''
|
asset = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue