forked from bartvdbraak/blender
use more conventional names in rigid body script.
This commit is contained in:
parent
753890d0e8
commit
8445a56b48
@ -129,17 +129,17 @@ def align_objects(context,
|
||||
|
||||
flag_first = True
|
||||
|
||||
objs = []
|
||||
objects = []
|
||||
|
||||
for obj in context.selected_objects:
|
||||
matrix_world = obj.matrix_world.copy()
|
||||
bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
|
||||
objs.append((obj, bb_world))
|
||||
objects.append((obj, bb_world))
|
||||
|
||||
if not objs:
|
||||
if not objects:
|
||||
return False
|
||||
|
||||
for obj, bb_world in objs:
|
||||
for obj, bb_world in objects:
|
||||
|
||||
if bb_quality and obj.type == 'MESH':
|
||||
GBB = GlobalBB_HQ(obj)
|
||||
@ -201,7 +201,7 @@ def align_objects(context,
|
||||
|
||||
# Main Loop
|
||||
|
||||
for obj, bb_world in objs:
|
||||
for obj, bb_world in objects:
|
||||
matrix_world = obj.matrix_world.copy()
|
||||
bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
|
||||
|
||||
|
@ -37,21 +37,21 @@ class CopyRigidbodySettings(Operator):
|
||||
|
||||
def execute(self, context):
|
||||
obj = context.object
|
||||
scn = context.scene
|
||||
scene = context.scene
|
||||
|
||||
# deselect all but mesh objects
|
||||
for o in context.selected_objects:
|
||||
if o.type != 'MESH':
|
||||
o.select = False
|
||||
|
||||
sel = context.selected_objects
|
||||
if sel:
|
||||
objects = context.selected_objects
|
||||
if objects:
|
||||
# add selected objects to active one groups and recalculate
|
||||
bpy.ops.group.objects_add_active()
|
||||
scn.frame_set(scn.frame_current)
|
||||
scene.frame_set(scene.frame_current)
|
||||
|
||||
# copy settings
|
||||
for o in sel:
|
||||
for o in objects:
|
||||
if o.rigid_body is None:
|
||||
continue
|
||||
|
||||
@ -106,7 +106,7 @@ class BakeToKeyframes(Operator):
|
||||
|
||||
def execute(self, context):
|
||||
bake = []
|
||||
objs = []
|
||||
objects = []
|
||||
scene = context.scene
|
||||
frame_orig = scene.frame_current
|
||||
frames = list(range(self.frame_start, self.frame_end + 1, self.step))
|
||||
@ -116,23 +116,23 @@ class BakeToKeyframes(Operator):
|
||||
if not obj.rigid_body or obj.rigid_body.type != 'ACTIVE':
|
||||
obj.select = False
|
||||
|
||||
objs = context.selected_objects
|
||||
objects = context.selected_objects
|
||||
|
||||
if objs:
|
||||
if objects:
|
||||
# store transformation data
|
||||
for f in list(range(self.frame_start, self.frame_end + 1)):
|
||||
scene.frame_set(f)
|
||||
if f in frames:
|
||||
mat = {}
|
||||
for i, obj in enumerate(objs):
|
||||
for i, obj in enumerate(objects):
|
||||
mat[i] = obj.matrix_world.copy()
|
||||
bake.append(mat)
|
||||
|
||||
# apply transformations as keyframes
|
||||
for i, f in enumerate(frames):
|
||||
scene.frame_set(f)
|
||||
obj_prev = objs[0]
|
||||
for j, obj in enumerate(objs):
|
||||
obj_prev = objects[0]
|
||||
for j, obj in enumerate(objects):
|
||||
mat = bake[i][j]
|
||||
|
||||
obj.location = mat.to_translation()
|
||||
@ -156,7 +156,7 @@ class BakeToKeyframes(Operator):
|
||||
bpy.ops.rigidbody.objects_remove()
|
||||
|
||||
# clean up keyframes
|
||||
for obj in objs:
|
||||
for obj in objects:
|
||||
action = obj.animation_data.action
|
||||
for fcu in action.fcurves:
|
||||
keyframe_points = fcu.keyframe_points
|
||||
@ -214,15 +214,15 @@ class ConnectRigidBodies(Operator):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.object
|
||||
objs = context.selected_objects
|
||||
return (obj and obj.rigid_body and (len(objs) > 1))
|
||||
objects = context.selected_objects
|
||||
return (obj and obj.rigid_body and (len(objects) > 1))
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
objs = context.selected_objects
|
||||
objects = context.selected_objects
|
||||
obj_act = context.active_object
|
||||
|
||||
for obj in objs:
|
||||
for obj in objects:
|
||||
if obj == obj_act:
|
||||
continue
|
||||
if self.pivot_type == 'ACTIVE':
|
||||
|
Loading…
Reference in New Issue
Block a user