Merged changes in the trunk up to revision 39826.
Made a major amount of conflict resolution for code adaptation to the animation system updates introduced in the Pepper branch recently merged to the trunk. Resolved conflicts: source/blender/blenkernel/intern/anim_sys.c source/blender/blenkernel/intern/library.c source/blender/editors/animation/anim_channels_defines.c source/blender/editors/animation/anim_channels_edit.c source/blender/editors/animation/anim_filter.c source/blender/editors/animation/keyframes_draw.c source/blender/editors/animation/keyframes_edit.c source/blender/editors/include/ED_anim_api.h source/blender/editors/space_nla/nla_buttons.c source/blender/editors/space_nla/nla_channels.c source/blender/makesdna/DNA_action_types.h source/blender/makesdna/intern/makesdna.c source/blender/makesrna/intern/rna_main_api.c
This commit is contained in:
@@ -84,8 +84,7 @@ def bake(frame_start,
|
||||
do_pose=True,
|
||||
do_object=True,
|
||||
do_constraint_clear=False,
|
||||
action=None,
|
||||
):
|
||||
action=None):
|
||||
|
||||
scene = bpy.context.scene
|
||||
obj = bpy.context.object
|
||||
@@ -200,19 +199,32 @@ class BakeAction(Operator):
|
||||
bl_label = "Bake Action"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
frame_start = IntProperty(name="Start Frame",
|
||||
frame_start = IntProperty(
|
||||
name="Start Frame",
|
||||
description="Start frame for baking",
|
||||
default=1, min=1, max=300000)
|
||||
frame_end = IntProperty(name="End Frame",
|
||||
min=0, max=300000,
|
||||
default=1,
|
||||
)
|
||||
frame_end = IntProperty(
|
||||
name="End Frame",
|
||||
description="End frame for baking",
|
||||
default=250, min=1, max=300000)
|
||||
step = IntProperty(name="Frame Step",
|
||||
min=1, max=300000,
|
||||
default=250,
|
||||
)
|
||||
step = IntProperty(
|
||||
name="Frame Step",
|
||||
description="Frame Step",
|
||||
default=1, min=1, max=120)
|
||||
only_selected = BoolProperty(name="Only Selected",
|
||||
default=True)
|
||||
clear_consraints = BoolProperty(name="Clear Constraints",
|
||||
default=False)
|
||||
min=1, max=120,
|
||||
default=1,
|
||||
)
|
||||
only_selected = BoolProperty(
|
||||
name="Only Selected",
|
||||
default=True,
|
||||
)
|
||||
clear_consraints = BoolProperty(
|
||||
name="Clear Constraints",
|
||||
default=False,
|
||||
)
|
||||
bake_types = EnumProperty(
|
||||
name="Bake Data",
|
||||
options={'ENUM_FLAG'},
|
||||
@@ -256,3 +268,36 @@ class BakeAction(Operator):
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_dialog(self)
|
||||
|
||||
|
||||
class ClearUselessActions(Operator):
|
||||
'''Mark actions with no F-Curves for deletion after save+reload of file preserving "action libraries"'''
|
||||
bl_idname = "anim.clear_useless_actions"
|
||||
bl_label = "Clear Useless Actions"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
only_unused = BoolProperty(name="Only Unused",
|
||||
description="Only unused (Fake User only) actions get considered",
|
||||
default=True)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return len(bpy.data.actions) != 0
|
||||
|
||||
def execute(self, context):
|
||||
removed = 0
|
||||
|
||||
for action in bpy.data.actions:
|
||||
# if only user is "fake" user...
|
||||
if ((self.only_unused is False) or
|
||||
(action.use_fake_user and action.users == 1)):
|
||||
|
||||
# if it has F-Curves, then it's a "action library" (i.e. walk, wave, jump, etc.)
|
||||
# and should be left alone as that's what fake users are for!
|
||||
if not action.fcurves:
|
||||
# mark action for deletion
|
||||
action.user_clear()
|
||||
removed += 1
|
||||
|
||||
self.report({'INFO'}, "Removed %d empty and/or fake-user only Actions" % (removed))
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -685,3 +685,49 @@ class ClearAllRestrictRender(Operator):
|
||||
for obj in context.scene.objects:
|
||||
obj.hide_render = False
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
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: %r" %
|
||||
obj.name)
|
||||
continue
|
||||
|
||||
# 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"
|
||||
obj.location.zero()
|
||||
elif fcu.data_path == "rotation_euler":
|
||||
fcu.data_path = "delta_rotation_euler"
|
||||
obj.rotation_euler.zero()
|
||||
elif fcu.data_path == "rotation_quaternion":
|
||||
fcu.data_path = "delta_rotation_quaternion"
|
||||
obj.rotation_quaternion.identity()
|
||||
# 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.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'}
|
||||
|
||||
Reference in New Issue
Block a user