Addons directory (#4893)

* Add addons directory

* add addons dir to modules dirs automatically

---------

Co-authored-by: iLLiCiTiT <jakub.trllo@gmail.com>
This commit is contained in:
Toke Jepsen 2023-05-12 16:44:44 +02:00 committed by GitHub
parent ce1e45f708
commit ab357eb03e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

6
.gitignore vendored
View file

@ -112,3 +112,9 @@ tools/run_eventserver.*
tools/dev_* tools/dev_*
.github_changelog_generator .github_changelog_generator
# Addons
########
/openpype/addons/*
!/openpype/addons/README.md

View file

@ -0,0 +1,3 @@
This directory is for storing external addons that needs to be included in the pipeline when distributed.
The directory is ignored by Git, but included in the zip and installation files.

View file

@ -311,6 +311,7 @@ def _load_modules():
# Look for OpenPype modules in paths defined with `get_module_dirs` # Look for OpenPype modules in paths defined with `get_module_dirs`
# - dynamically imported OpenPype modules and addons # - dynamically imported OpenPype modules and addons
module_dirs = get_module_dirs() module_dirs = get_module_dirs()
# Add current directory at first place # Add current directory at first place
# - has small differences in import logic # - has small differences in import logic
current_dir = os.path.abspath(os.path.dirname(__file__)) current_dir = os.path.abspath(os.path.dirname(__file__))
@ -318,8 +319,11 @@ def _load_modules():
module_dirs.insert(0, hosts_dir) module_dirs.insert(0, hosts_dir)
module_dirs.insert(0, current_dir) module_dirs.insert(0, current_dir)
addons_dir = os.path.join(os.path.dirname(current_dir), "addons")
module_dirs.append(addons_dir)
processed_paths = set() processed_paths = set()
for dirpath in module_dirs: for dirpath in frozenset(module_dirs):
# Skip already processed paths # Skip already processed paths
if dirpath in processed_paths: if dirpath in processed_paths:
continue continue