Thursday, March 24, 2011

Animation Goodie - Propagate Pose Tool

As I mentioned in an earlier post here (gee... it's been a while), while animating, I found that it would be nice to have a tool for making tweaks to some controls in already-keyed poses, and having those changes get "propagated" (i.e. copied) over to successive keyframes (where the control was "static", or in a "hold").

Let's see a little diagram of what I mean:

Previously, if you had gone through blocking out some sequence of actions, and then find that some hand pose (or something like that) which is held for a number of keyframes in a row looks quite bad and you need to tweak it, you'd need to go through a little "Ctrl-Pageup Ctrl-V dance" (i.e. jump to next keyframe, then paste pose) to get this change applied to those poses too (remembering to firstly Copy the Pose, and also to enable Auto-Keying). You could also have gone through and used the Animation Editors, and duplicated/adjusted curve values too, but going down that route is also a lot of monkey-work that a computer could do for you in many cases.

This afternoon, I finished coding a tool to do this. Grab a recent SVN build or wait for the 2.57 in the next week or so (?) to try it out. Read on for a little "release log" for this...


How this works
The basic idea is that the tool starts from the current frame, and reads off whatever pose is set there on the bones at the time. It could of course have tried to read off the values from whatever keyframe was there originally, but there are good reasons why that doesn't happen: firstly, so that you don't need to insert a keyframe first before propagating (though you can if you wish), and secondly, so that if you've scrubbed off a keyframe and go about blocking a pose there, you can still have this saved on the keyframe you intended (more details on this later).

Now, once it has the pose to apply, it goes through the keyframes following the one of interest, applying this pose to those keyframes (NOTE: all handles are flattened during this process. It may not be ideal in some cases, but things get murky otherwise). However, this poses one problem: how does the tool decide when to stop applying the pose? If you think about some of the holds in your animation, they won't always be holds... some will have to 'end' at some point, with some motion (i.e. the past 8 hours of hard labour, which you probably won't want clobbered!).

Available "Modes" - 'Termination' Methods
This tool has several "modes", which determine how it decides when to stop overwriting keyframes.
  1. While Held - This is the "default" mode when you select the "Pose Propagate" tool (from the Pose -> Propagate menu), and is also the most complicated of the modes available, as it tries to guess when to stop propagating by examining the pauses in the animation curves per control (i.e. all F-Curves for a bone, instead of per F-Curve).
  2. Next Keyframe - This is also available from the Pose -> Propagate menu as "To Next Keyframe", and simply copies the pose to the first keyframe after (but not including any keyframe on) the current frame
  3. Last Keyframe - This option is not presented in the UI, but will simply replace every single keyframe within the F-Curves for the selected controls which occur after the current frame
  4. Before Frame - This option needs to be used in conjunction with the "end_frame" property. The aforementioned property defines the upper-bound for the frame range within which keyframes will be affected (with the lower bound being the current frame). This option is best suited for use from scripts due to the difficulties in setting this frame value, though it is possible to set this manually via the Operator Redo if necessary

Common Use Cases
Now for the part that you've been waiting for: how to use this tool. Here I'll present a few mini tutorials on how to accomplish some useful tasks using this.

Use Case 1 - Change a static pose over several keyframes
This is the scenario that motivated this whole tool.
  1. Change the current frame to the first of the keyframes in the static chain of keyframes to modify. 
    • Static chains of keyframes are those which have dark bands between them (i.e. long-keyframes, indicating holds). You may need to enable the "Selected Only" DopeSheet filtering option in order to see these controls clearly. 
    • It is ok if you're just a few frames before it this keyframe, though it's best to position the current frame on that keyframe for good measure
  2. Start tweaking the pose until you're happy with it
  3. Select all the controls that you've changed (or whose pose you want to propagate)
  4. Pose -> Propagate -> Pose Propagate
  5. The keyframes that have been modified will be selected now.

Use Case 2 - Ensuring pose tweaks end up on a keyframe
This is the scenario I mentioned earlier, when you've been tweaking a pose, but accidentally scrubbed off the keyframe you intended to apply these tweaks to.

This tool can be used to "save" this situation if the current frame is not on any keyframe and sitting before the intended keyframe with no other keyframes between the current frame and that keyframe. In this case:
  1. Select all controls that you've tweaked (or perhaps you haven't, and just want to do something like moving some breakdown pose over onto an existing keyframe to get a "moving hold" easily)
  2. Pose -> Propagate -> To Next Keyframe
  3. The target keyframe should now have the pose that you intended it to have. No trace of the pose will be stored on the current frame, since you don't have a keyframe there (unless you decide to insert one there now)

5 comments:

  1. whoaa great tools Aligorith. Thank You ^__^ I was hoping that you can explain in depth on how to work on constraint, particulary the child of constraint, which is i use much in animation.

    for example, how can i manage to pass a spoon from one character to another, and easily change the constraint influence in between and to deal with bone local or global coordinate or something like that, which is very confusing for me :)

    ReplyDelete
  2. THanks for this Aligorith! I can see the "Last" Mode being used when editing a cycle. Ie the first frame is always the last frame, so if I modify either end, both ends will update. That is, if I understand this tool correctly.

    ReplyDelete
  3. MikeB: ah no, that's not how it works now, but what you suggest is actually an interesting idea to have. I was thinking more along the lines of a "make cyclic" operator for the action editor, though this way probably sounds a bit more organic

    ReplyDelete
  4. Hi Aligorith! great feature :)

    Aparentally "Use Case 1" don't work if you
    work with autokey checked.

    Thanks :)

    ReplyDelete
  5. this is sooo useful, thank you. Hope you're doing better post-quake too :-)

    A feature like this one, that would propagate to all keyframes with a specific marker name, or better yet, a marker prefix/suffix, would be soooooo useful. Thus all changes to a keyframe on a marker with the prefix of, say "standing" for example, would propagate to that bone on all keyframes with a prefix of "standing". That would save tons of time(for me anyway).

    I eagerly await the daily reading of commits in SVN to find yours, thanks for everything you've done for the Blender world over :-)

    ReplyDelete