mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +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 pype.tools import assetcreator
|
||||
|
||||
from pype.api import Logger
|
||||
|
||||
|
|
@ -19,9 +14,23 @@ class AssetCreator(api.Action):
|
|||
|
||||
def is_compatible(self, session):
|
||||
"""Return whether the action is compatible with the session"""
|
||||
if "AVALON_PROJECT" in session:
|
||||
return True
|
||||
return False
|
||||
compatible = True
|
||||
|
||||
# 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):
|
||||
asset = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue