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

This commit is contained in:
Lucio Rossi 2017-07-28 12:02:53 +02:00
parent 263804791a
commit 89f470d0ca
3 changed files with 21 additions and 14 deletions

View File

@ -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]

View File

@ -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":

View File

@ -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