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-23 09:49:12 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-07-23 09:49:12 +0400
commit9a0e0027f810be044767c946c6e93cdcc484dd91 (patch)
tree3e876bc210f721f7c80a5e3d1de9838da2a50a8b
parent37bb55b7bc2947bc5093d58789871e728cd9e48d (diff)
fix for error in select hierarchy if no children exist.
-rw-r--r--release/scripts/op/object.py52
1 files changed, 27 insertions, 25 deletions
diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py
index 2df1250251e..0b052195541 100644
--- a/release/scripts/op/object.py
+++ b/release/scripts/op/object.py
@@ -113,44 +113,46 @@ class SelectHierarchy(bpy.types.Operator):
return context.object
def execute(self, context):
- objs = context.selected_objects
+ select_new = []
+ act_new = None
+
+
+ selected_objects = 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.select = False
- bpy.ops.object.select_all(action='DESELECT')
+ if context.object not in selected_objects:
+ selected_objects.append(context.object)
if self.properties.direction == 'PARENT':
- parents = []
- for obj in objs:
+ for obj in selected_objects:
parent = obj.parent
if parent:
- parents.append(parent)
-
if obj_act == obj:
- context.scene.objects.active = parent
+ act_new = parent
- parent.select = True
-
- if parents:
- return {'CANCELLED'}
+ select_new.append(parent)
else:
- children = []
- for obj in objs:
- children += list(obj.children)
- for obj_iter in children:
- obj_iter.select = True
+ for obj in selected_objects:
+ select_new.extend(obj.children)
- children.sort(key=lambda obj_iter: obj_iter.name)
- context.scene.objects.active = children[0]
+ if select_new:
+ select_new.sort(key=lambda obj_iter: obj_iter.name)
+ act_new = select_new[0]
- return {'FINISHED'}
+ # dont edit any object settings above this
+ if select_new:
+ if not self.properties.extend:
+ bpy.ops.object.select_all(action='DESELECT')
+
+ for obj in select_new:
+ obj.select = True
+
+ context.scene.objects.active = act_new
+ return {'FINISHED'}
+
+ return {'CANCELLED'}
class SubdivisionSet(bpy.types.Operator):