0
$\begingroup$

The quaternion rotations on this bone (Bip01 Non Accum) is messed up, and they need to be flipped. All the keyframes from 532 to 592 need to have their quat rotations flipped and inserted as new keyframes. I just want to find a way to script it so I can just box select all the affected keyframes and flip their rotations, then insert them as new keyframes overwriting their old ones. At the bottom is a script that does the operator combo, but it only works on the active keyframe(In the picture, it would be frame 532), meaning I still need to move to the next affected keyframe and active the script on it's keyframe and so on. How would I change it to apply to multiple selected keyframes in one go?

Rotations are wrong, they should be -0.704, -0.700, -0.119, 0.000340

import bpy

def flip_selected_keyframes():
    bpy.ops.pose.quaternions_flip()
    bpy.ops.anim.keyframe_insert()

flip_selected_keyframes()
$\endgroup$
3
  • $\begingroup$ Wellcome, try using S key with the 2D cursor in the Graphics View. $\endgroup$ Commented Mar 7 at 0:11
  • $\begingroup$ I'm confused by what you mean, graphics view? Do you mean the Graph Editor? That's just the scale shortcut, and it doesn't apply to all rotations anyways. It only changes the x rotation, and not in the way it needs to be changed. In the picture, the correct rotations would be -0.704, -0.700, -0.119, 0.000340. Scale doesn't help with that. $\endgroup$ Commented Mar 8 at 2:39
  • $\begingroup$ Sorry, that was the Graph Editor. I'll post the answer later. $\endgroup$ Commented Mar 8 at 3:53

1 Answer 1

0
$\begingroup$

You can invert quaternion values ​​using scaling just like in the UV editor.

  1. Set the pivot to the 2D cursor in the header
  2. Set y value of the cursor to zero in the View tab of the sidebar,

enter image description here

  1. Then press key S Y -1 or ctrl+M.

enter image description here

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.