[Bf-extensions-cvs] [89f470d0] master: Fix: T52167 Rigify 0.5 "Rigify Type" lags bone properties panel

Lucio Rossi noreply at git.blender.org
Fri Jul 28 12:05:34 CEST 2017


Commit: 89f470d0cac3057c1365738caf1fdc258a468679
Author: Lucio Rossi
Date:   Fri Jul 28 12:02:53 2017 +0200
Branches: master
https://developer.blender.org/rBA89f470d0cac3057c1365738caf1fdc258a468679

Fix: T52167 Rigify 0.5 "Rigify Type" lags bone properties panel

===================================================================

M	rigify/rig_lists.py
M	rigify/ui.py
M	rigify/utils.py

===================================================================

diff --git a/rigify/rig_lists.py b/rigify/rig_lists.py
index 8de8528e..edca1090 100644
--- a/rigify/rig_lists.py
+++ b/rigify/rig_lists.py
@@ -24,7 +24,9 @@ from . import utils
 def get_rig_list(path):
     """ Recursively searches for rig types, and returns a list.
     """
+    rigs_dict = dict()
     rigs = []
+    implementation_rigs = []
     MODULE_DIR = os.path.dirname(__file__)
     RIG_DIR_ABS = os.path.join(MODULE_DIR, utils.RIG_DIR)
     SEARCH_DIR_ABS = os.path.join(RIG_DIR_ABS, path)
@@ -50,8 +52,9 @@ def get_rig_list(path):
                 rigs += [f]
             else:
                 # Check for sub-rigs
-                ls = get_rig_list(os.path.join(path, f, ""))  # "" adds a final slash
-                rigs.extend(["%s.%s" % (f, l) for l in ls])
+                sub_dict = get_rig_list(os.path.join(path, f, ""))  # "" adds a final slash
+                rigs.extend(["%s.%s" % (f, l) for l in sub_dict['rig_list']])
+                implementation_rigs.extend(["%s.%s" % (f, l) for l in sub_dict['implementation_rigs']])
         elif f.endswith(".py"):
             # Check straight-up python files
             t = f[:-3]
@@ -59,8 +62,14 @@ def get_rig_list(path):
             rig = utils.get_rig_type(module_name)
             if hasattr(rig, "Rig"):
                 rigs += [t]
+            if hasattr(rig, 'IMPLEMENTATION') and rig.IMPLEMENTATION:
+                implementation_rigs += [t]
     rigs.sort()
-    return rigs
+
+    rigs_dict['rig_list'] = rigs
+    rigs_dict['implementation_rigs'] = implementation_rigs
+
+    return rigs_dict
 
 
 def get_collection_list(rig_list):
@@ -73,6 +82,8 @@ def get_collection_list(rig_list):
 
 
 # Public variables
-rig_list = get_rig_list("")
+rigs_dict = get_rig_list("")
+rig_list = rigs_dict['rig_list']
+implementation_rigs = rigs_dict['implementation_rigs']
 collection_list = get_collection_list(rig_list)
 col_enum_list = [("All", "All", ""), ("None", "None", "")] + [(c, c, "") for c in collection_list]
diff --git a/rigify/ui.py b/rigify/ui.py
index 5850e23e..77e06f01 100644
--- a/rigify/ui.py
+++ b/rigify/ui.py
@@ -567,12 +567,9 @@ class BONE_PT_rigify_buttons(bpy.types.Panel):
 
     @classmethod
     def poll(cls, context):
-        if not context.armature or not context.active_pose_bone:
-            return False
-        obj = context.object
-        if obj:
-            return obj.mode == 'POSE' and context.active_object.data.get("rig_id") is None
-        return False
+
+        return context.object.type == 'ARMATURE' and context.active_pose_bone\
+               and context.active_object.data.get("rig_id") is None
 
     def draw(self, context):
         C = context
@@ -588,8 +585,7 @@ class BONE_PT_rigify_buttons(bpy.types.Panel):
             id_store.rigify_types.remove(0)
 
         for r in rig_lists.rig_list:
-            rig = get_rig_type(r)
-            if hasattr(rig, 'IMPLEMENTATION') and rig.IMPLEMENTATION:
+            if r in rig_lists.implementation_rigs:
                 continue
             # collection = r.split('.')[0]  # UNUSED
             if collection_name == "All":
diff --git a/rigify/utils.py b/rigify/utils.py
index dd324962..9601035d 100644
--- a/rigify/utils.py
+++ b/rigify/utils.py
@@ -909,7 +909,7 @@ def get_rig_type(rig_type):
     """
     name = ".%s.%s" % (RIG_DIR, rig_type)
     submod = importlib.import_module(name, package=MODULE_NAME)
-    imp.reload(submod)
+    importlib.reload(submod)
     return submod
 
 
@@ -919,7 +919,7 @@ def get_metarig_module(metarig_name, path=METARIG_DIR):
 
     name = ".%s.%s" % (path, metarig_name)
     submod = importlib.import_module(name, package=MODULE_NAME)
-    imp.reload(submod)
+    importlib.reload(submod)
     return submod



More information about the Bf-extensions-cvs mailing list