[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30306] trunk/blender/release/scripts/op/ object.py: select parent/child now works for multiple selections ([/] keys)
Campbell Barton
ideasman42 at gmail.com
Wed Jul 14 11:40:27 CEST 2010
Revision: 30306
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30306
Author: campbellbarton
Date: 2010-07-14 11:40:26 +0200 (Wed, 14 Jul 2010)
Log Message:
-----------
select parent/child now works for multiple selections ([/] keys)
Modified Paths:
--------------
trunk/blender/release/scripts/op/object.py
Modified: trunk/blender/release/scripts/op/object.py
===================================================================
--- trunk/blender/release/scripts/op/object.py 2010-07-14 09:31:09 UTC (rev 30305)
+++ trunk/blender/release/scripts/op/object.py 2010-07-14 09:40:26 UTC (rev 30306)
@@ -113,25 +113,43 @@
return context.object
def execute(self, context):
- obj = context.object
+ objs = context.selected_objects
+ obj_act = context.object
+
+ if context.object not in objs:
+ objs.append(context.object)
+
+ if not self.properties.extend:
+ # for obj in objs:
+ # obj.selected = False
+ bpy.ops.object.select_all(action='DESELECT')
+
if self.properties.direction == 'PARENT':
- parent = obj.parent
- if not parent:
+ parents = []
+ for obj in objs:
+ parent = obj.parent
+
+ if parent:
+ parents.append(parent)
+
+ if obj_act == obj:
+ context.scene.objects.active = parent
+
+ parent.selected = True
+
+ if parents:
return {'CANCELLED'}
- obj_act = parent
+
else:
- children = obj.children
- if len(children) != 1:
- return {'CANCELLED'}
- obj_act = children[0]
+ children = []
+ for obj in objs:
+ children += list(obj.children)
+ for obj_iter in children:
+ obj_iter.selected = True
- if not self.properties.extend:
- # obj.selected = False
- bpy.ops.object.select_all(action='DESELECT')
+ children.sort(key=lambda obj_iter: obj_iter.name)
+ context.scene.objects.active = children[0]
- obj_act.selected = True
- context.scene.objects.active = obj_act
-
return {'FINISHED'}
More information about the Bf-blender-cvs
mailing list