rigidbody: code cleanup

Use bpy.data.objects.new() instead of the object.add() operator.
This commit is contained in:
Sergej Reich
2013-02-21 19:04:36 +00:00
parent 822a06920b
commit 9c08d1c649

View File

@@ -235,11 +235,13 @@ class ConnectRigidBodies(Operator):
loc = obj.location
else:
loc = (obj_act.location + obj.location) / 2.0
# TODO: use bpy.data.objects.new(...)
bpy.ops.object.add(type='EMPTY',
view_align=False,
enter_editmode=False,
location=loc)
ob = bpy.data.objects.new("Constraint", object_data=None)
ob.location = loc
context.scene.objects.link(ob)
context.scene.objects.active = ob
ob.select = True
bpy.ops.rigidbody.constraint_add()
con_obj = context.active_object
con_obj.empty_draw_type = 'ARROWS'