select pattern for bones
authorCampbell Barton <ideasman42@gmail.com>
Tue, 1 Dec 2009 14:48:36 +0000 (14:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 1 Dec 2009 14:48:36 +0000 (14:48 +0000)
release/scripts/op/object.py
release/scripts/ui/space_view3d.py

index 89ba38860b3552c62c4a1be403622ea5feadc7a8..af864edee4f2de9d8e3ed7108b855cd494665ee9 100644 (file)
@@ -40,11 +40,20 @@ class SelectPattern(bpy.types.Operator):
         else:
             pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper())
 
-        for ob in context.visible_objects:
-            if pattern_match(ob.name, self.properties.pattern):
-                ob.selected = True
+        obj = context.object
+        if obj and obj.mode == 'POSE':
+            items = obj.data.bones
+        elif obj and obj.type == 'ARMATURE' and obj.mode == 'EDIT':
+            items = obj.data.edit_bones
+        else:
+            items = context.visible_objects
+
+        # Can be pose bones or objects
+        for item in items:
+            if pattern_match(item.name, self.properties.pattern):
+                item.selected = True
             elif not self.properties.extend:
-                ob.selected = False
+                item.selected = False
 
         return ('FINISHED',)
 
@@ -54,7 +63,6 @@ class SelectPattern(bpy.types.Operator):
         return ('RUNNING_MODAL',)
     
     def draw(self, context):
-        print("WoW")
         layout = self.layout
         props = self.properties
         
@@ -62,7 +70,6 @@ class SelectPattern(bpy.types.Operator):
         row = layout.row()
         row.prop(props, "case_sensitive")
         row.prop(props, "extend")
-        
 
 
 class SubsurfSet(bpy.types.Operator):
index c100cde5a20cce16f070f4ce2f9a6899ba85008c..871f0e30270c3a8c3b7218e66e0226efa852277e 100644 (file)
@@ -407,6 +407,8 @@ class VIEW3D_MT_select_pose(bpy.types.Menu):
         props = layout.operator("pose.select_hierarchy", text="Extend Child")
         props.extend = True
         props.direction = 'CHILD'
+        
+        layout.operator("object.select_pattern", text="Select Pattern...")
 
 
 class VIEW3D_MT_select_particle(bpy.types.Menu):
@@ -597,6 +599,8 @@ class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
         props = layout.operator("armature.select_hierarchy", text="Extend Child")
         props.extend = True
         props.direction = 'CHILD'
+        
+        layout.operator("object.select_pattern", text="Select Pattern...")
 
 
 class VIEW3D_MT_select_face(bpy.types.Menu):# XXX no matching enum