API changes? Animation add-on doesn't work since 2.63

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
kayyy
Posts: 0
Joined: Tue Mar 05, 2013 6:44 pm
Location: Frankfurt, Germany

API changes? Animation add-on doesn't work since 2.63

Post by kayyy »

My FlipAnimation add-on works fine until version 2.62 but refuses to work on newer versions. The main purpose of it is taking a range of keyframes of the currently active action and perform a Copy Pose and Paste X-flipped Pose on every relevant frame. So depending on the selected mode, either the whole action is mirrored or a specified range is processed and appended.

Now starting with 2.63 it 'pretends' to work but the pasted poses are not X-flipped. The code fragment which I guess is to blame for:

Code: Select all

        for frame_item in self.keyframe_bone_dict.items ():
            frame = frame_item[0]
            bones = frame_item[1]
            context.scene.frame_set(frame)
            bpy.ops.pose.select_all(action='DESELECT')
            for bone_item in bones.items ():
                bone = bone_item[0]
                bpy.context.active_object.data.bones[bone].select = True
            bpy.ops.pose.copy()
            if self.append_mode:
                context.scene.frame_set(frame + self.append_frames_offset)
            bpy.ops.pose.paste(flipped=True)
keyframe_bone_dict contains for every frame to touch a dictionary of all affected bones. So I iterate over all keyframes, select the bones that have a keyframe defined here. Then copy the pose and do a paste X-flipped pose either at the current frame or at another frame that is append_frames_offset away. There are pasted keyframes at the right positions but their values are not X-flipped.

I studied the API changes at Blender API changes at http://www.blender.org/documentation/bl ... ml#to-2-63 but did not find any suspect thing. Only some minor changes to KeyingSets like name => bl_label.

Is there anything else changed? Or what else could lead to the changed behaviour?

I just started to read about how to submit code to bf-extensions Trackers and then I ran into this issue while testing with different versions. Now I really stuck as I am new to add-on development. Thanks a lot for your help

More info:
Video: http://www.youtube.com/watch?v=GChWp0W5lnA
Code: https://github.com/kayy/FlipAnimation
Blog: http://www.scio.de/en/blog-a-news/scio- ... in-blender

kayyy
Posts: 0
Joined: Tue Mar 05, 2013 6:44 pm
Location: Frankfurt, Germany

Post by kayyy »

I did some further investigation and found out that after the paste pose operator returned successfully the follwing debug statement
print (context.active_pose_bone, " (after): ", context.active_pose_bone.rotation_quaternion)
showed reasonable i.e. correct values for the considered bone's keyframe. But after the add-on has finished, the same keys are either unchanged or have neglegible changes in their quaternion members (0 - 1%). Sometimes the affected bone has changed slightly. Really strange :-(

Post Reply