Anim Cupboard: Add Selection Sets to Animation Panel #81

Merged
Nick Alberelli merged 4 commits from feature/anim-cupboard-selection-set into main 2023-06-16 14:12:17 +02:00
Showing only changes of commit ed74d71e59 - Show all commits

View File

@ -5,8 +5,6 @@ from addon_utils import check, paths
import sys
# RELEASE SCRIPTS: official scripts distributed in Blender releases
addon_enabled = False
@ -15,6 +13,7 @@ def check_addon_enabled():
for mod_name, mod_path in bpy.path.module_names(path):
if mod_name == 'bone_selection_sets':
is_enabled, is_loaded = check(mod_name)
sys.path.append(dir)
return is_enabled
return False
@ -34,50 +33,10 @@ class POSE_PT_selection_sets_view3d(bpy.types.Panel):
if not check_addon_enabled():
layout.label(text="Addon 'Bone Selection Sets' not Enabled", icon="ERROR")
return
import bone_selection_sets
from bone_selection_sets import POSE_PT_selection_sets
arm = context.object
row = layout.row()
row.enabled = context.mode == 'POSE'
# UI list
rows = 4 if len(arm.selection_sets) > 0 else 1
row.template_list(
"POSE_UL_selection_set",
"", # type and unique id
arm,
"selection_sets", # pointer to the CollectionProperty
arm,
"active_selection_set", # pointer to the active identifier
rows=rows,
)
# add/remove/specials UI list Menu
col = row.column(align=True)
col.operator("pose.selection_set_add", icon='ADD', text="")
col.operator("pose.selection_set_remove", icon='REMOVE', text="")
col.menu("POSE_MT_selection_sets_context_menu", icon='DOWNARROW_HLT', text="")
# move up/down arrows
if len(arm.selection_sets) > 0:
col.separator()
col.operator(
"pose.selection_set_move", icon='TRIA_UP', text=""
).direction = 'UP'
col.operator(
"pose.selection_set_move", icon='TRIA_DOWN', text=""
).direction = 'DOWN'
# buttons
row = layout.row()
sub = row.row(align=True)
sub.operator("pose.selection_set_assign", text="Assign")
sub.operator("pose.selection_set_unassign", text="Remove")
sub = row.row(align=True)
sub.operator("pose.selection_set_select", text="Select")
sub.operator("pose.selection_set_deselect", text="Deselect")
POSE_PT_selection_sets.draw(self, context)
registry = [