Extensions:2.4/Py/Scripts/Animation/Bake Constraints

提供: wiki
< Extensions:2.4‎ | Py‎ | Scripts‎ | Animation
2011年11月18日 (金) 11:52時点におけるwiki>Mindrones botによる版 (Robot, removing unnecessary nav links; cosmetic changes)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索
Bake Constraints
Create unconstrained objects with motion curves that mimic the motion of a constrained object. For Armatures, create an Action that mimics each bone's movement.
UI location Group: Animation
Usage Modular, easy to read on creating/editing Ipo Curves.
Version 0.7 - 2008.07.18 Author(s) Roger Wickes
Blender 2.47 License N/A


Executable information
File name Animation Bake_Constraints.py
Python modules BPyArmature.py (be sure to delete BPyArmature.pyc after updating)


Links BlenderArtists forum thread

Motion Capture lab at Carnegie Mellon University


Support


Introduction

When using C3D Motion Capture, you import a set of empties that move where the markers moved on the actor. You then create a rig that is constrained to follow the empties. In order to work with or change that motion, you need a rig that has Ipo Curves directly associated with the armature itself, and does not depend on the empties. In general, it is useful to be able to 'record' the motion of an object, when that motion is derived from other object's locations and rotations, track to constraints, follow paths etc.

Usage

Use this script to create a clone and Ipo curves that match the actual location and rotation of the selected object. If the object is an armature, it also creates an Action that copies all the bones locrot and applies that as a locrot curve to the cloned bone.

Instructions

To install the script, extract the the Animation_Bake_Constraints.py file to your Blender Scripts folder, and the updated BPyArmature.py file to your bpymodules folder located just beneath the Scripts folder. As when replacing/updating any bpymodules script, delete the pre-compiled version (in this case BPyArmature.pyc).

Select the constrained object(s) to be baked. Set the frame range to bake Optionally, load the script and change usrDelta to change to offset of the clones, presently set to 1 x and 1 y unit from the original Run the script by

a) loading it in your text editor and running it as a python script, or,
b) if you put it in your scripts directory, re-registering your menus via the User Prefs button and then selecting it from a scripts menu in the Animation section.

Briefly, you:

  1. . Load your cleaned, constrained armature file (BVH or C3D)
  2. . Set your animation range to the focus area of interest (for example, frames 1300-1420)
  3. . Select the Constrained Armature in Object Mode
  4. . Run the Bake Constraints script. While it is baking, the oven light may go off (your Blender Screen may go black). Don't be alarmed, just watch the console window for progress and updates. Blender is just concentrating on running the script as fast as possible.
  5. . The script clones the Armature, removes all the constraints on the clone (making it a free man)
  6. . The script then creates an Action that copies the original motion, offset to begin at frame 1.
  7. . You can now delete the cloud, ik targets, and constrained armature to free up memory 

The Action contains LocRot Ipo curves for each bone for each frame of the animation, so it can take some time to process. The action is named after the clone; you can immediately change this to better reflect what the clone is doing by clicking in the Action Editor header, in the name field of the Action selector (the name will get a red background), and typing in the new name. The Action keys are relative to the T-pose of the character, sometimes called the rest or edit position. This is the orientation that the armature assumes when you tab into edit mode.

The clone should follow the original around,

   * offset in space (by the location-rotation vector usrDelta, by default set to (10,10,0)) and
   * offset in time by usrACTION (if True, the clone will start the action at frame 1, otherwise it will start the action simultaneous with the cloud). 

The clone should perform the same motion as the original. TClones, offset from the original by usrDelta in space and back to frame 1 in time (by default), are created and have an Ipo curve that matches the selected object's constrained/computed motion. If the object is an armature, then every bone will have an Ipo curve, and an Action is created that groups all the bone's curves together.

The cloned objects are selected after script completion. Note that Actions will be offset to start at frame 1.

Links

Notes

Softbodies, cloth and other objects that are "moved" by simulations are not actually moved. The object center stays were it is and the object's mesh vertices are displaced, almost like shape keys. Therefore, this script will not "clone" one of these type objects. Simply duplicate them through the UI. To bake the loc/rot of objects moved by the Blender Game Engine, use the Game->Record Game Physics to IPO menu selection.


History

0.1: initial release
0.2: bakes Loc and Rot for the bones within Armature object
0.3: add manual to script library
0.4: bake multiple objects
0.5: bakes armatures
0.6: cleanup svn submission.
0.7: cloned children are linked to their cloned parents. If the parents are not cloned, the clone children are optionally linked to the original parents (usrParent flag).

Editor Info

Editor's note: use http://wiki.blender.org/index.php?title=Special:Upload&wpDestFile=Bake_Constraints.zip to update file