minor edits, pep8 - also correct float -> double promotion for blf.

This commit is contained in:
Campbell Barton
2011-08-30 10:49:58 +00:00
parent 6c9ee34dd8
commit b20c9b0ba3
14 changed files with 62 additions and 59 deletions

View File

@@ -686,26 +686,30 @@ class ClearAllRestrictRender(Operator):
obj.hide_render = False
return {'FINISHED'}
class TransformsToDeltasAnim(bpy.types.Operator):
class TransformsToDeltasAnim(Operator):
'''Convert object animation for normal transforms to delta transforms'''
bl_idname = "object.anim_transforms_to_deltas"
bl_label = "Animated Transforms to Deltas"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(cls, context):
obs = context.selected_editable_objects
return (obs is not None)
def execute(self, context):
for obj in context.selected_editable_objects:
# get animation data
adt = obj.animation_data
if (adt is None) or (adt.action is None):
self.report({'WARNING'}, "No animation data to convert on object: " + obj.name)
self.report({'WARNING'},
"No animation data to convert on object: %r" %
obj.name)
continue
# if F-Curve uses standard transform path, just append "delta_" to this path
# if F-Curve uses standard transform path
# just append "delta_" to this path
for fcu in adt.action.fcurves:
if fcu.data_path == "location":
fcu.data_path = "delta_location"
@@ -716,13 +720,14 @@ class TransformsToDeltasAnim(bpy.types.Operator):
elif fcu.data_path == "rotation_quaternion":
fcu.data_path = "delta_rotation_quaternion"
obj.rotation_quaternion.identity()
#elif fcu.data_path == "rotation_axis_angle": # XXX: currently not implemented
# fcu.data_path = "delta_rotation_axis_angle"
# XXX: currently not implemented
# elif fcu.data_path == "rotation_axis_angle":
# fcu.data_path = "delta_rotation_axis_angle"
elif fcu.data_path == "scale":
fcu.data_path = "delta_scale"
obj.scale = (1, 1, 1)
obj.scale = 1.0, 1.0, 1.0
# hack: force animsys flush by changing frame, so that deltas get run
context.scene.frame_set(context.scene.frame_current)
return {'FINISHED'}