Anim Cupboard: Add Selection Sets to Animation Panel #81
@ -8,6 +8,7 @@ from .operators import lock_curves
|
|||||||
from .operators import bake_anim_across_armatures
|
from .operators import bake_anim_across_armatures
|
||||||
from . import easy_constraints
|
from . import easy_constraints
|
||||||
from . import warn_about_broken_libraries
|
from . import warn_about_broken_libraries
|
||||||
|
from . import bone_selection_sets
|
||||||
|
|
||||||
bl_info = {
|
bl_info = {
|
||||||
'name': "Animation Cupboard",
|
'name': "Animation Cupboard",
|
||||||
@ -25,7 +26,8 @@ modules = (
|
|||||||
lock_curves,
|
lock_curves,
|
||||||
bake_anim_across_armatures,
|
bake_anim_across_armatures,
|
||||||
easy_constraints,
|
easy_constraints,
|
||||||
warn_about_broken_libraries
|
warn_about_broken_libraries,
|
||||||
|
bone_selection_sets,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -56,8 +58,10 @@ def register_unregister_modules(modules: List, register: bool):
|
|||||||
elif hasattr(m, 'unregister'):
|
elif hasattr(m, 'unregister'):
|
||||||
m.unregister()
|
m.unregister()
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
register_unregister_modules(modules, True)
|
register_unregister_modules(modules, True)
|
||||||
|
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
register_unregister_modules(modules, False)
|
register_unregister_modules(modules, False)
|
||||||
|
84
scripts-blender/addons/anim_cupboard/bone_selection_sets.py
Normal file
84
scripts-blender/addons/anim_cupboard/bone_selection_sets.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import bpy
|
||||||
|
from addon_utils import check, paths, enable
|
||||||
|
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
# RELEASE SCRIPTS: official scripts distributed in Blender releases
|
||||||
|
|
||||||
|
addon_enabled = False
|
||||||
|
paths_list = paths()
|
||||||
|
addon_list = []
|
||||||
|
for path in paths_list:
|
||||||
|
for mod_name, mod_path in bpy.path.module_names(path):
|
||||||
|
if mod_name == 'bone_selection_sets':
|
||||||
|
is_enabled, is_loaded = check(mod_name)
|
||||||
|
addon_enabled = is_enabled
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
class POSE_PT_selection_sets_view3d(bpy.types.Panel):
|
||||||
|
bl_label = "Selection Sets"
|
||||||
|
bl_space_type = 'VIEW_3D'
|
||||||
|
bl_region_type = 'UI'
|
||||||
|
bl_category = 'Animation'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.mode == 'POSE' and context.active_pose_bone
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
if not addon_enabled:
|
||||||
|
layout.label(text="Addon 'Bone Selection Sets' not Enabled", icon="ERROR")
|
||||||
|
return
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
registry = [
|
||||||
|
POSE_PT_selection_sets_view3d,
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user