diff options
author | Demeter Dzadik <demeter@blender.studio> | 2022-01-20 16:21:16 +0300 |
---|---|---|
committer | Demeter Dzadik <demeter@blender.studio> | 2022-01-25 12:58:39 +0300 |
commit | e641ac2d8a2baa146478d902a4222a3243a4f764 (patch) | |
tree | dbb2166df6ff849a8fa0d2ce58e0a9b13f8721bc /rigify/ui.py | |
parent | 84f5f4699232decc2f1a8694312680b9e5159462 (diff) |
Rigify: Add ability to disable installed feature sets
This patch is a continuation of D8519, was also suggested in T88711#1170152.
It adds a checkbox for each feature set in the Rigify Preferences, to disable/enable that feature set without having to completely remove it from the file system.
Challenges that were hopefully successfully tackled:
- Keep list in sync when user manually adds or removes things through the file system instead of the "add/remove feature set" buttons in the UI.
- Avoid re-building the feature set list all the time so that the checkbox states can actually be stored when the user exits Blender.
- Disabling a feature set means calling its unregister function, then rebuilding the rig types and metarigs lists/menus.
- Some renaming slipped in because I found the variable name "feature_set" a bit confusing. If needed, I could split this change into a separate patch or just forget about it, but I think the longer names help here.
Testing would be welcome, since things turned out a bit more tricky than expected.
In a follow-up patch I would like to do a code quality pass, to split the code a bit better here. There is a bit too much stuff in __init__.py in particular. I will get started on that when this gets close to being finalized.
Reviewed By: angavrilov
Differential Revision: https://developer.blender.org/D12260
Diffstat (limited to 'rigify/ui.py')
-rw-r--r-- | rigify/ui.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rigify/ui.py b/rigify/ui.py index 59dbf9b6..eac8b673 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -54,7 +54,7 @@ def build_type_list(context, rigify_types): for r in sorted(rig_lists.rigs): if (context.object.data.active_feature_set in ('all', rig_lists.rigs[r]['feature_set']) - or len(feature_set_list.get_installed_list()) == 0 + or len(feature_set_list.get_enabled_modules_names()) == 0 ): a = rigify_types.add() a.name = r @@ -191,7 +191,7 @@ class DATA_PT_rigify_samples(bpy.types.Panel): id_store.rigify_active_type = 0 # Rig type list - if len(feature_set_list.get_installed_list()) > 0: + if len(feature_set_list.get_enabled_modules_names()) > 0: row = layout.row() row.prop(context.object.data, "active_feature_set") row = layout.row() @@ -609,7 +609,7 @@ class BONE_PT_rigify_buttons(bpy.types.Panel): build_type_list(context, id_store.rigify_types) # Rig type field - if len(feature_set_list.get_installed_list()) > 0: + if len(feature_set_list.get_enabled_modules_names()) > 0: row = layout.row() row.prop(context.object.data, "active_feature_set") row = layout.row() |