install project specific plugins (publish, load and create) found in {PYPE_PROJECT_PLUGINS}/{project_name}

This commit is contained in:
iLLiCiTiT 2020-02-28 14:59:10 +01:00
parent f2bca6ad1b
commit 8997da158a

View file

@ -11,6 +11,7 @@ log = logging.getLogger(__name__)
__version__ = "2.5.0"
PROJECT_PLUGINS_PATH = os.environ.get("PYPE_PROJECT_PLUGINS")
PACKAGE_DIR = os.path.dirname(__file__)
PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins")
@ -72,6 +73,18 @@ def install():
pyblish.register_discovery_filter(filter_pyblish_plugins)
avalon.register_plugin_path(avalon.Loader, LOAD_PATH)
# Register project specific plugins
project_name = os.environ.get("AVALON_PROJECT")
if PROJECT_PLUGINS_PATH and project_name:
for path in PROJECT_PLUGINS_PATH.split(os.pathsep):
if not path:
continue
plugin_path = os.path.join(path, project_name)
if os.path.exists(plugin_path):
pyblish.register_plugin_path(plugin_path)
avalon.register_plugin_path(avalon.Loader, plugin_path)
avalon.register_plugin_path(avalon.Creator, plugin_path)
# apply monkey patched discover to original one
avalon.discover = patched_discover