tornavis/source/blender/makesdna/DNA_nla_types.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

97 lines
2.6 KiB
C
Raw Normal View History

/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
2002-10-12 13:37:38 +02:00
/** \file
* \ingroup DNA
*/
#pragma once
2011-12-30 08:25:49 +01:00
Two wonderful new NLA & Armature editing features! - FORWARD CYCLING & MATCHING Up to no now, adding multiple actions in NLA with walkcycles required to animate them standing still, as if walking on a conveyor belt. The stride option then makes the object itself move forward, trying to keep the foot stuck on the floor (with poor results!). This option now allows to make walk cycles moving forward. By indicating a reference Offset Bone, the NLA system will use that bone to detect the correct offset for the Armature Pose to make it seamlessly going forward. Best of all, this option works as for cyclic Action Strips as well as for individual Action Strips. Note that for individual strips, you have to set the strip on "Hold". (Might become automatic detected later). Here's an example edit image for NLA: http://www.blender.org/bf/nla_match-cycle.jpg And the animation for it: http://download.blender.org/demo/test/2.43/0001_0150_match.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_matching.blend Using this kind of cycling works pretty straightforward, and is a lot easier to setup than Stride Bones. To be further tested: - Blending cycles - matching rotation for the bones as well. - ACTION MODIFIERS (motion deformors) The above option was actually required for this feature. Typically walk cycles are constructed with certain Bones to be the handles, controlling for example the torso or feet. An Action Modifier allows you to use a Curve Path to deform the motion of these controlling bones. This uses the existing Curve Deformation option. Modifiers can be added per Action Strip, each controlling a channel (bone) by choice, and even allows to layer multiple modifiers on top of each other (several paths deforming motion). This option is using the dependency graph, so editing the Curve will give realtime changes in the Armature. The previous walkcycle, controlled by two curves: http://download.blender.org/demo/test/2.43/0001_0150_deform.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_actiondeform.blend Action Modifiers can be added in the NLA Properties Panel. Per Modifier you have to indicate the channel and a Curve Object. You can copy modifiers from one strip to another using CTRL+C (only copies to active Object strips). Setting up a correct Curve Path has to be carefully done: - Use SHIFT+A "Curve Path" in top view, or ensure the path is not rotated. - make sure the center point of the Curve Object is at the center of the Armature (or above) - move the first point of the curve to the center point as well. - check if the path starts from this first point, you can change it using (in Curve EditMode) the option Wkey -> "Switch Direction" - Make sure alignment uses the correct axis; if the Armature walks into the negative Y direction, you have to set in Object Buttons, "Anim settings" Panel, the correct Track option. (Note; option will probably move to the Modifier later). This is a good reason to make such paths automatic (on a command). Is on the todo list. Also note this: - the Curve Path extends in beginning and ending, that's (for now) the default, and allows to use multiple paths. Make sure paths begin and end horizontal. - Moving the Curve in Object Mode will change the "mapping" (as if the landscape a character walks over moves). Moving the Curve in Edit Mode will change the actual position of the deformation. - Speed (Ipos) on paths is not supported yet, will be done. - The Curve "Stretch" deform option doesn't work. - Modifiers are executed *after* all actions in NLA are evaluated, there's no support yet for blending multiple strips with Modifiers. - This doesn't work yet for time-mapping... This commit is mostly for review by character animators... some details or working methods might change. This feature can also be used for other modifiers, such as noise (Perlin) or the mythical "Oomph" (frequency control) and of course Python. Special thanks to Bassam & Matt for research & design help. Have fun!
2006-10-31 16:51:57 +01:00
#include "DNA_listBase.h"
2002-10-12 13:37:38 +02:00
struct Ipo;
Big commit with work on Groups & Libraries: -> Any Group Duplicate now can get local timing and local NLA override. This enables to control the entire animation system of the Group. Two methods for this have been implemented. 1) The quick way: just give the duplicator a "Startframe" offset. 2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator to override NLA/action of any Grouped Object. For "Group NLA" to work, an ActionStrip needs to know which Object in a group it controls. On adding a strip, the code checks if an Action was already used by an Object in the Group, and assigns it automatic to that Object. You can also set this in the Nkey "Properties" panel for the strip. Change in NLA: the SHIFT+A "Add strip" command now always adds strips to the active Object. (It used to check where mouse was). This allows to add NLA strips to Objects that didn't have actions/nla yet. Important note: In Blender, duplicates are fully procedural and generated on the fly for each redraw. This means that redraw speed equals to stepping through frames, when using animated Duplicated Groups. -> Recoded entire duplicator system The old method was antique and clumsy, using globals and full temporal copies of Object. The new system is nicer in control, faster, and since it doesn't use temporal object copies anymore, it works better with Derived Mesh and DisplayList and rendering. By centralizing the code for duplicating, more options can be easier added. Features to note: - Duplicates now draw selected/unselected based on its Duplicator setting. - Same goes for the drawtype (wire, solid, selection outline, etc) - Duplicated Groups can be normally selected too Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a listing of all groups, allowing to add Group instances immediate. -> Library System - SHIFT+F4 data browse now shows the entire path for linked data - Outliner draws Library Icons to denote linked data - Outliner operation added: "Make Local" for library data. - Outliner now also draws Groups in regular view, allowing to unlink too. -> Fixes - depsgraph missed signal update for bone-parented Objects - on reading file, the entire database was tagged to "recalc" fully, causing unnecessary slowdown on reading. Might have missed stuff... :)
2005-12-11 14:23:30 +01:00
struct Object;
struct bAction;
2002-10-12 13:37:38 +02:00
/** Simple uniform modifier structure, assumed it can hold all type info. */
Two wonderful new NLA & Armature editing features! - FORWARD CYCLING & MATCHING Up to no now, adding multiple actions in NLA with walkcycles required to animate them standing still, as if walking on a conveyor belt. The stride option then makes the object itself move forward, trying to keep the foot stuck on the floor (with poor results!). This option now allows to make walk cycles moving forward. By indicating a reference Offset Bone, the NLA system will use that bone to detect the correct offset for the Armature Pose to make it seamlessly going forward. Best of all, this option works as for cyclic Action Strips as well as for individual Action Strips. Note that for individual strips, you have to set the strip on "Hold". (Might become automatic detected later). Here's an example edit image for NLA: http://www.blender.org/bf/nla_match-cycle.jpg And the animation for it: http://download.blender.org/demo/test/2.43/0001_0150_match.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_matching.blend Using this kind of cycling works pretty straightforward, and is a lot easier to setup than Stride Bones. To be further tested: - Blending cycles - matching rotation for the bones as well. - ACTION MODIFIERS (motion deformors) The above option was actually required for this feature. Typically walk cycles are constructed with certain Bones to be the handles, controlling for example the torso or feet. An Action Modifier allows you to use a Curve Path to deform the motion of these controlling bones. This uses the existing Curve Deformation option. Modifiers can be added per Action Strip, each controlling a channel (bone) by choice, and even allows to layer multiple modifiers on top of each other (several paths deforming motion). This option is using the dependency graph, so editing the Curve will give realtime changes in the Armature. The previous walkcycle, controlled by two curves: http://download.blender.org/demo/test/2.43/0001_0150_deform.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_actiondeform.blend Action Modifiers can be added in the NLA Properties Panel. Per Modifier you have to indicate the channel and a Curve Object. You can copy modifiers from one strip to another using CTRL+C (only copies to active Object strips). Setting up a correct Curve Path has to be carefully done: - Use SHIFT+A "Curve Path" in top view, or ensure the path is not rotated. - make sure the center point of the Curve Object is at the center of the Armature (or above) - move the first point of the curve to the center point as well. - check if the path starts from this first point, you can change it using (in Curve EditMode) the option Wkey -> "Switch Direction" - Make sure alignment uses the correct axis; if the Armature walks into the negative Y direction, you have to set in Object Buttons, "Anim settings" Panel, the correct Track option. (Note; option will probably move to the Modifier later). This is a good reason to make such paths automatic (on a command). Is on the todo list. Also note this: - the Curve Path extends in beginning and ending, that's (for now) the default, and allows to use multiple paths. Make sure paths begin and end horizontal. - Moving the Curve in Object Mode will change the "mapping" (as if the landscape a character walks over moves). Moving the Curve in Edit Mode will change the actual position of the deformation. - Speed (Ipos) on paths is not supported yet, will be done. - The Curve "Stretch" deform option doesn't work. - Modifiers are executed *after* all actions in NLA are evaluated, there's no support yet for blending multiple strips with Modifiers. - This doesn't work yet for time-mapping... This commit is mostly for review by character animators... some details or working methods might change. This feature can also be used for other modifiers, such as noise (Perlin) or the mythical "Oomph" (frequency control) and of course Python. Special thanks to Bassam & Matt for research & design help. Have fun!
2006-10-31 16:51:57 +01:00
typedef struct bActionModifier {
struct bActionModifier *next, *prev;
short type, flag;
char channel[32];
/* noise modifier */
float noisesize, turbul;
short channels;
/* path deform modifier */
short no_rot_axis;
struct Object *ob;
Two wonderful new NLA & Armature editing features! - FORWARD CYCLING & MATCHING Up to no now, adding multiple actions in NLA with walkcycles required to animate them standing still, as if walking on a conveyor belt. The stride option then makes the object itself move forward, trying to keep the foot stuck on the floor (with poor results!). This option now allows to make walk cycles moving forward. By indicating a reference Offset Bone, the NLA system will use that bone to detect the correct offset for the Armature Pose to make it seamlessly going forward. Best of all, this option works as for cyclic Action Strips as well as for individual Action Strips. Note that for individual strips, you have to set the strip on "Hold". (Might become automatic detected later). Here's an example edit image for NLA: http://www.blender.org/bf/nla_match-cycle.jpg And the animation for it: http://download.blender.org/demo/test/2.43/0001_0150_match.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_matching.blend Using this kind of cycling works pretty straightforward, and is a lot easier to setup than Stride Bones. To be further tested: - Blending cycles - matching rotation for the bones as well. - ACTION MODIFIERS (motion deformors) The above option was actually required for this feature. Typically walk cycles are constructed with certain Bones to be the handles, controlling for example the torso or feet. An Action Modifier allows you to use a Curve Path to deform the motion of these controlling bones. This uses the existing Curve Deformation option. Modifiers can be added per Action Strip, each controlling a channel (bone) by choice, and even allows to layer multiple modifiers on top of each other (several paths deforming motion). This option is using the dependency graph, so editing the Curve will give realtime changes in the Armature. The previous walkcycle, controlled by two curves: http://download.blender.org/demo/test/2.43/0001_0150_deform.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_actiondeform.blend Action Modifiers can be added in the NLA Properties Panel. Per Modifier you have to indicate the channel and a Curve Object. You can copy modifiers from one strip to another using CTRL+C (only copies to active Object strips). Setting up a correct Curve Path has to be carefully done: - Use SHIFT+A "Curve Path" in top view, or ensure the path is not rotated. - make sure the center point of the Curve Object is at the center of the Armature (or above) - move the first point of the curve to the center point as well. - check if the path starts from this first point, you can change it using (in Curve EditMode) the option Wkey -> "Switch Direction" - Make sure alignment uses the correct axis; if the Armature walks into the negative Y direction, you have to set in Object Buttons, "Anim settings" Panel, the correct Track option. (Note; option will probably move to the Modifier later). This is a good reason to make such paths automatic (on a command). Is on the todo list. Also note this: - the Curve Path extends in beginning and ending, that's (for now) the default, and allows to use multiple paths. Make sure paths begin and end horizontal. - Moving the Curve in Object Mode will change the "mapping" (as if the landscape a character walks over moves). Moving the Curve in Edit Mode will change the actual position of the deformation. - Speed (Ipos) on paths is not supported yet, will be done. - The Curve "Stretch" deform option doesn't work. - Modifiers are executed *after* all actions in NLA are evaluated, there's no support yet for blending multiple strips with Modifiers. - This doesn't work yet for time-mapping... This commit is mostly for review by character animators... some details or working methods might change. This feature can also be used for other modifiers, such as noise (Perlin) or the mythical "Oomph" (frequency control) and of course Python. Special thanks to Bassam & Matt for research & design help. Have fun!
2006-10-31 16:51:57 +01:00
} bActionModifier;
// /* NLA-Modifier Types (UNUSED) */
// enum {
// ACTSTRIP_MOD_DEFORM = 0,
// ACTSTRIP_MOD_NOISE = 1,
// };
Two wonderful new NLA & Armature editing features! - FORWARD CYCLING & MATCHING Up to no now, adding multiple actions in NLA with walkcycles required to animate them standing still, as if walking on a conveyor belt. The stride option then makes the object itself move forward, trying to keep the foot stuck on the floor (with poor results!). This option now allows to make walk cycles moving forward. By indicating a reference Offset Bone, the NLA system will use that bone to detect the correct offset for the Armature Pose to make it seamlessly going forward. Best of all, this option works as for cyclic Action Strips as well as for individual Action Strips. Note that for individual strips, you have to set the strip on "Hold". (Might become automatic detected later). Here's an example edit image for NLA: http://www.blender.org/bf/nla_match-cycle.jpg And the animation for it: http://download.blender.org/demo/test/2.43/0001_0150_match.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_matching.blend Using this kind of cycling works pretty straightforward, and is a lot easier to setup than Stride Bones. To be further tested: - Blending cycles - matching rotation for the bones as well. - ACTION MODIFIERS (motion deformors) The above option was actually required for this feature. Typically walk cycles are constructed with certain Bones to be the handles, controlling for example the torso or feet. An Action Modifier allows you to use a Curve Path to deform the motion of these controlling bones. This uses the existing Curve Deformation option. Modifiers can be added per Action Strip, each controlling a channel (bone) by choice, and even allows to layer multiple modifiers on top of each other (several paths deforming motion). This option is using the dependency graph, so editing the Curve will give realtime changes in the Armature. The previous walkcycle, controlled by two curves: http://download.blender.org/demo/test/2.43/0001_0150_deform.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_actiondeform.blend Action Modifiers can be added in the NLA Properties Panel. Per Modifier you have to indicate the channel and a Curve Object. You can copy modifiers from one strip to another using CTRL+C (only copies to active Object strips). Setting up a correct Curve Path has to be carefully done: - Use SHIFT+A "Curve Path" in top view, or ensure the path is not rotated. - make sure the center point of the Curve Object is at the center of the Armature (or above) - move the first point of the curve to the center point as well. - check if the path starts from this first point, you can change it using (in Curve EditMode) the option Wkey -> "Switch Direction" - Make sure alignment uses the correct axis; if the Armature walks into the negative Y direction, you have to set in Object Buttons, "Anim settings" Panel, the correct Track option. (Note; option will probably move to the Modifier later). This is a good reason to make such paths automatic (on a command). Is on the todo list. Also note this: - the Curve Path extends in beginning and ending, that's (for now) the default, and allows to use multiple paths. Make sure paths begin and end horizontal. - Moving the Curve in Object Mode will change the "mapping" (as if the landscape a character walks over moves). Moving the Curve in Edit Mode will change the actual position of the deformation. - Speed (Ipos) on paths is not supported yet, will be done. - The Curve "Stretch" deform option doesn't work. - Modifiers are executed *after* all actions in NLA are evaluated, there's no support yet for blending multiple strips with Modifiers. - This doesn't work yet for time-mapping... This commit is mostly for review by character animators... some details or working methods might change. This feature can also be used for other modifiers, such as noise (Perlin) or the mythical "Oomph" (frequency control) and of course Python. Special thanks to Bassam & Matt for research & design help. Have fun!
2006-10-31 16:51:57 +01:00
2002-10-12 13:37:38 +02:00
typedef struct bActionStrip {
struct bActionStrip *next, *prev;
Three new features: 1) Stride Bone For walkcycles, you could already set an NLA strip to cycle over a path based on a preset distance value. This cycling happens based on a linear interpolation, with constant speed. Not all cycles have a constant speed however, like hopping or jumping. To ensure a perfect slipping-less foot contact, you now can set a Bone in an Armature to define the stride. This "Stride Bone" then becomes a sort-of ruler, a conveyor belt, on which the character walks. When using the NLA "Use Path" option, it then tries to keep the Stride Bone entirely motionless on the path, by cancelling out its motion (for the entire Armature). This means that the animation keys for a Stride Bone have to be exactly negative of the desired path. Only, at choice, the X,Y or Z Ipo curve is used for this stride. Examples: http://www.blender.org/bf/0001_0040.avi The top armature shows the actual Action, the bottom armature has been parented to a Path, using the Stride Bone feature. http://www.blender.org/bf/0001_0080.avi Here the Stride Bone has a number of children, creating a ruler to be used as reference while animating. Test .blend: http://www.blender.org/bf/motionblender1.blend Notes: - Note that action keys for Bones work local, based on the Bone's orientation as set in EditMode. Therefore, an Y translation always goes in the Bone's direction. - To be able to get a "solvable" stride, the animation curve has to be inverse evaluated, using a Newton Raphson root solver. That means you can only create stride curves that keep moving forward, and cannot return halfway. - Set the Stride Bone in the Editing Buttons, Bone Panel. You can set change the name or set the axis in the NLA Window, Strip Properties Panel. - Files in this commit will move to the blender.org release section. 2) Armature Ghosting In EditButtons, Armature Panel, you can set an armature to draw ghosts. The number value denotes the amount of frames that have to be drawn extra (for the active action!) around the current frame. Ghosts only evaluate its own Pose, executing it's Actions, Constraints and IK. No external dependencies are re-evaluated for it. 3) NLA/Action time control If you click in the NLA window on the action (linked to Object), it makes sure the Timing as drawn in the Action editor is not corrected for NLA. If you also set the Object to "Action", this timing will be executed on the Object as well (not NLA time). (It's a bit confusing... will make a good doc & maybe review UI!)
2005-11-01 13:44:30 +01:00
short flag, mode;
/** Axis 0=x, 1=y, 2=z. */
short stride_axis;
/** Current modifier for buttons. */
short curmod;
/** Blending ipo - was used for some old NAN era experiments. Non-functional currently. */
struct Ipo *ipo;
/** The action referenced by this strip. */
struct bAction *act;
/** For groups, the actual object being nla'ed. */
struct Object *object;
/** The range of frames covered by this strip. */
float start, end;
/** The range of frames taken from the action. */
float actstart, actend;
/** Offset within action, for cycles and striding. */
float actoffs;
2023-05-24 03:21:18 +02:00
/** The stride-length (considered when flag & ACT_USESTRIDE). */
float stridelen;
/** The number of times to repeat the action range. */
float repeat;
/** The amount the action range is scaled by. */
float scale;
/** The number of frames on either end of the strip's length to fade in/out. */
float blendin, blendout;
/** Instead of stridelen, it uses an action channel. */
char stridechannel[32];
/** If repeat, use this bone/channel for defining offset. */
char offs_bone[32];
/** Modifier stack. */
ListBase modifiers;
2002-10-12 13:37:38 +02:00
} bActionStrip;
/** #Strip::mode (these defines aren't really used, but are here for reference) */
enum {
ACTSTRIPMODE_BLEND = 0,
ACTSTRIPMODE_ADD = 1,
};
2002-10-12 13:37:38 +02:00
/** #bActionStrip.flag */
typedef enum eActStrip_Flag {
ACTSTRIP_SELECT = (1 << 0),
ACTSTRIP_USESTRIDE = (1 << 1),
/* Not implemented. Is not used anywhere */
2020-02-20 00:21:23 +01:00
/* ACTSTRIP_BLENDTONEXT = (1 << 2), */ /* UNUSED */
ACTSTRIP_HOLDLASTFRAME = (1 << 3),
ACTSTRIP_ACTIVE = (1 << 4),
ACTSTRIP_LOCK_ACTION = (1 << 5),
ACTSTRIP_MUTE = (1 << 6),
/* This has yet to be implemented. To indicate that a strip should be played backwards */
ACTSTRIP_REVERSE = (1 << 7),
ACTSTRIP_AUTO_BLENDS = (1 << 11),
} eActStrip_Flag;