Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-09-28 12:51:33 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-09-29 11:03:27 +0300
commit73784e78de99cb647870cbd93ef497f3e437a1a6 (patch)
tree8271cbc2766c9d02e8bcdf8ba837dfd47336b136 /rigify/rig_lists.py
parentc34c7c0c4a328176813f3e5cc2ed672a3ae292b2 (diff)
Rigify: implement a new reload process to support Reload Scripts properly.
Due to dynamically loaded rig modules, Rigify has to implement reload by purging all non-core modules from memory, or class inheritance checks won't work right after reload.
Diffstat (limited to 'rigify/rig_lists.py')
-rw-r--r--rigify/rig_lists.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/rigify/rig_lists.py b/rigify/rig_lists.py
index 018bbbac..49cc9545 100644
--- a/rigify/rig_lists.py
+++ b/rigify/rig_lists.py
@@ -20,7 +20,8 @@ import os
import traceback
import importlib
-from . import utils
+from .utils.rig import RIG_DIR
+
from . import feature_set_list
@@ -76,15 +77,16 @@ def get_rigs(base_dir, base_path, *, path=[], feature_set=feature_set_list.DEFAU
# Public variables
+rigs = {}
+implementation_rigs = {}
+
def get_internal_rigs():
+ global rigs, implementation_rigs
+
BASE_RIGIFY_DIR = os.path.dirname(__file__)
BASE_RIGIFY_PATH = __name__.split('.')[:-1]
- return get_rigs(os.path.join(BASE_RIGIFY_DIR, utils.RIG_DIR), [*BASE_RIGIFY_PATH, utils.RIG_DIR])
-
-
-rigs, implementation_rigs = get_internal_rigs()
-
+ rigs, implementation_rigs = get_rigs(os.path.join(BASE_RIGIFY_DIR, RIG_DIR), [*BASE_RIGIFY_PATH, RIG_DIR])
def get_external_rigs(set_list):
# Clear and fill rigify rigs and implementation rigs public variables
@@ -97,7 +99,7 @@ def get_external_rigs(set_list):
# Get external rigs
for feature_set in set_list:
try:
- base_dir, base_path = feature_set_list.get_dir_path(feature_set, utils.RIG_DIR)
+ base_dir, base_path = feature_set_list.get_dir_path(feature_set, RIG_DIR)
external_rigs, external_impl_rigs = get_rigs(base_dir, base_path, feature_set=feature_set)
except Exception: