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>2013-01-28 16:24:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-28 16:24:25 +0400
commit1c2d5eeeef6551b38a1ad3d1ebe180d78d03c94a (patch)
tree5f0bb05c6020fe3321b74455b38021b639983bc5 /release/scripts/startup/bl_operators/rigidbody.py
parent0bf264f7ef523012be8fcd45f6c648ca11b657d1 (diff)
fix for rigid body assuming active object would be selected, also don't check length of selected objects in poll function (getting and throwing away object selection array on every redraw is no good).
Diffstat (limited to 'release/scripts/startup/bl_operators/rigidbody.py')
-rw-r--r--release/scripts/startup/bl_operators/rigidbody.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py
index dd5b68884d3..94465fa6561 100644
--- a/release/scripts/startup/bl_operators/rigidbody.py
+++ b/release/scripts/startup/bl_operators/rigidbody.py
@@ -214,13 +214,14 @@ class ConnectRigidBodies(Operator):
@classmethod
def poll(cls, context):
obj = context.object
- objects = context.selected_objects
- return (obj and obj.rigid_body and (len(objects) > 1))
+ return (obj and obj.rigid_body)
def execute(self, context):
+ scene = context.scene
objects = context.selected_objects
obj_act = context.active_object
+ change = False
for obj in objects:
if obj == obj_act:
@@ -237,10 +238,15 @@ class ConnectRigidBodies(Operator):
con.type = self.con_type
con.object1 = obj_act
con.object2 = obj
- # restore selection
- bpy.ops.object.select_all(action='DESELECT')
- for obj in objs:
- obj.select = True;
- bpy.context.scene.objects.active = obj_act
-
- return {'FINISHED'}
+ change = True
+
+ if change:
+ # restore selection
+ bpy.ops.object.select_all(action='DESELECT')
+ for obj in objects:
+ obj.select = True;
+ scene.objects.active = obj_act
+ return {'FINISHED'}
+ else:
+ self.report({'WARNING'}, "No other objects selected")
+ return {'CANCELLED'}