Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-07-14 13:40:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-07-14 13:40:26 +0400
commita305a7293923bb9221c37c1c7bb22106e8d9d182 (patch)
tree073e5d4e7d0ddfad58ff9be5951e7e139f14c001 /release
parente7877979af44da1662a6f908bd8b41de8e6abe14 (diff)
select parent/child now works for multiple selections ([/] keys)
Diffstat (limited to 'release')
-rw-r--r--release/scripts/op/object.py46
1 files changed, 32 insertions, 14 deletions
diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py
index e76218e4637..0353856ed20 100644
--- a/release/scripts/op/object.py
+++ b/release/scripts/op/object.py
@@ -113,24 +113,42 @@ class SelectHierarchy(bpy.types.Operator):
return context.object
def execute(self, context):
- obj = context.object
- if self.properties.direction == 'PARENT':
- parent = obj.parent
- if not parent:
- return {'CANCELLED'}
- obj_act = parent
- else:
- children = obj.children
- if len(children) != 1:
- return {'CANCELLED'}
- obj_act = children[0]
+ objs = context.selected_objects
+ obj_act = context.object
+
+ if context.object not in objs:
+ objs.append(context.object)
if not self.properties.extend:
- # obj.selected = False
+ # for obj in objs:
+ # obj.selected = False
bpy.ops.object.select_all(action='DESELECT')
- obj_act.selected = True
- context.scene.objects.active = obj_act
+ if self.properties.direction == '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'}
+
+ else:
+ children = []
+ for obj in objs:
+ children += list(obj.children)
+ for obj_iter in children:
+ obj_iter.selected = True
+
+ children.sort(key=lambda obj_iter: obj_iter.name)
+ context.scene.objects.active = children[0]
return {'FINISHED'}