[Bf-extensions-cvs] [04138bd] master: [Selection Sets] Added specials menu with options to remove bones and delete all sets

Ines Almeida noreply at git.blender.org
Wed Jul 6 09:23:17 CEST 2016


Commit: 04138bdf09c5835273ab10177e99f2ffd3f1bc44
Author: Ines Almeida
Date:   Wed Jul 6 08:24:45 2016 +0100
Branches: master
https://developer.blender.org/rBA04138bdf09c5835273ab10177e99f2ffd3f1bc44

[Selection Sets] Added specials menu with options to remove bones and delete all sets

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

M	bone_selection_sets.py

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

diff --git a/bone_selection_sets.py b/bone_selection_sets.py
index 904793a..5bb9011 100644
--- a/bone_selection_sets.py
+++ b/bone_selection_sets.py
@@ -18,7 +18,7 @@
 
 bl_info = {
     "name": "Bone Selection Sets",
-    "author": "Dan Eicher, Antony Riakiotakis, Inês Almeida",
+    "author": "Inês Almeida, Antony Riakiotakis, Dan Eicher",
     "version": (2, 0, 0),
     "blender": (2, 75, 0),
     "location": "Properties > Object Data (Armature) > Selection Sets",
@@ -66,8 +66,8 @@ class POSE_MT_selection_sets_specials(Menu):
     def draw(self, context):
         layout = self.layout
 
-        # TODO
-        #layout.operator("pose.selection_sets_sort", icon='SORTALPHA', text="Sort by Name").sort_type = 'NAME'
+        layout.operator("pose.selection_set_delete_all", icon='X')
+        layout.operator("pose.selection_set_remove_bones", icon='X')
 
 
 class POSE_PT_selection_sets(Panel):
@@ -104,8 +104,7 @@ class POSE_PT_selection_sets(Panel):
         col = row.column(align=True)
         col.operator("pose.selection_set_add", icon='ZOOMIN', text="")
         col.operator("pose.selection_set_remove", icon='ZOOMOUT', text="")
-        # TODO specials like sorting
-        #col.menu("POSE_MT_selection_sets_specials", icon='DOWNARROW_HLT', text="")
+        col.menu("POSE_MT_selection_sets_specials", icon='DOWNARROW_HLT', text="")
 
         # move up/down arrows
         if len(arm.selection_sets) > 0:
@@ -159,6 +158,37 @@ class NeedSelSetPluginOperator(PluginOperator):
         return False
 
 
+class POSE_OT_selection_set_delete_all(PluginOperator):
+    bl_idname = "pose.selection_set_delete_all"
+    bl_label = "Delete All Sets"
+    bl_description = "Deletes All Selection Sets"
+    bl_options = {'UNDO', 'REGISTER'}
+
+    def execute(self, context):
+        arm = context.object
+        arm.selection_sets.clear()
+        return {'FINISHED'}
+
+
+class POSE_OT_selection_set_remove_bones(PluginOperator):
+    bl_idname = "pose.selection_set_remove_bones"
+    bl_label = "Remove Bones from Sets"
+    bl_description = "Removes the Active Bones from All Sets"
+    bl_options = {'UNDO', 'REGISTER'}
+
+    def execute(self, context):
+        arm = context.object
+
+        # iterate only the selected bones in current pose that are not hidden
+        for bone in context.selected_pose_bones:
+            for selset in arm.selection_sets:
+                if bone.name in selset.bone_ids:
+                    idx = selset.bone_ids.find(bone.name)
+                    selset.bone_ids.remove(idx)
+
+        return {'FINISHED'}
+
+
 class POSE_OT_selection_set_move(NeedSelSetPluginOperator):
     bl_idname = "pose.selection_set_move"
     bl_label = "Move Selection Set in List"
@@ -357,6 +387,8 @@ classes = (
     POSE_UL_selection_set,
     SelectionEntry,
     SelectionSet,
+    POSE_OT_selection_set_delete_all,
+    POSE_OT_selection_set_remove_bones,
     POSE_OT_selection_set_move,
     POSE_OT_selection_set_add,
     POSE_OT_selection_set_remove,



More information about the Bf-extensions-cvs mailing list