Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesdna/DNA_anim_types.h')
-rw-r--r--source/blender/makesdna/DNA_anim_types.h292
1 files changed, 188 insertions, 104 deletions
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index bf6b9bed5a1..f75ed273164 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -1,5 +1,28 @@
-/* Testing code for new animation system in 2.5
- * Copyright 2009, Joshua Leung
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
+ * All rights reserved.
+ *
+ * Contributor(s): Joshua Leung (full recode)
+ *
+ * ***** END GPL LICENSE BLOCK *****
*/
#ifndef DNA_ANIM_TYPES_H
@@ -40,12 +63,13 @@ typedef struct FModifier {
/* Types of F-Curve modifier
* WARNING: order here is important!
*/
-enum {
+typedef enum eFModifier_Types {
FMODIFIER_TYPE_NULL = 0,
FMODIFIER_TYPE_GENERATOR,
+ FMODIFIER_TYPE_FN_GENERATOR,
FMODIFIER_TYPE_ENVELOPE,
FMODIFIER_TYPE_CYCLES,
- FMODIFIER_TYPE_NOISE, /* unimplemented - generate variations using some basic noise generator... */
+ FMODIFIER_TYPE_NOISE,
FMODIFIER_TYPE_FILTER, /* unimplemented - for applying: fft, high/low pass filters, etc. */
FMODIFIER_TYPE_PYTHON,
FMODIFIER_TYPE_LIMITS,
@@ -55,7 +79,7 @@ enum {
} eFModifier_Types;
/* F-Curve Modifier Settings */
-enum {
+typedef enum eFModifier_Flags {
/* modifier is not able to be evaluated for some reason, and should be skipped (internal) */
FMODIFIER_FLAG_DISABLED = (1<<0),
/* modifier's data is expanded (in UI) */
@@ -68,46 +92,63 @@ enum {
/* --- */
-/* generator modifier data */
+/* Generator modifier data */
typedef struct FMod_Generator {
- /* generator based on PyExpression */
- char expression[256]; /* python expression to use as generator */
-
/* general generator information */
float *coefficients; /* coefficients array */
unsigned int arraysize; /* size of the coefficients array */
- short poly_order; /* order of polynomial generated (i.e. 1 for linear, 2 for quadratic) */
- short func_type; /* builtin math function eFMod_Generator_Functions */
-
- int pad;
+ int poly_order; /* order of polynomial generated (i.e. 1 for linear, 2 for quadratic) */
+ int mode; /* which 'generator' to use eFMod_Generator_Modes */
/* settings */
- short flag; /* settings */
- short mode; /* which 'generator' to use eFMod_Generator_Modes */
+ int flag; /* settings */
} FMod_Generator;
/* generator modes */
-enum {
+typedef enum eFMod_Generator_Modes {
FCM_GENERATOR_POLYNOMIAL = 0,
FCM_GENERATOR_POLYNOMIAL_FACTORISED,
- FCM_GENERATOR_FUNCTION,
- FCM_GENERATOR_EXPRESSION,
} eFMod_Generator_Modes;
-/* generator flags */
-enum {
+
+/* generator flags
+ * - shared by Generator and Function Generator
+ */
+typedef enum eFMod_Generator_Flags {
/* generator works in conjunction with other modifiers (i.e. doesn't replace those before it) */
FCM_GENERATOR_ADDITIVE = (1<<0),
} eFMod_Generator_Flags;
+
+/* 'Built-In Function' Generator modifier data
+ *
+ * This uses the general equation for equations:
+ * y = amplitude * fn(phase_multiplier*x + phase_offset) + y_offset
+ *
+ * where amplitude, phase_multiplier/offset, y_offset are user-defined coefficients,
+ * x is the evaluation 'time', and 'y' is the resultant value
+ */
+typedef struct FMod_FunctionGenerator {
+ /* coefficients for general equation (as above) */
+ float amplitude;
+ float phase_multiplier;
+ float phase_offset;
+ float value_offset;
+
+ /* flags */
+ int type; /* eFMod_Generator_Functions */
+ int flag; /* eFMod_Generator_flags */
+} FMod_FunctionGenerator;
+
/* 'function' generator types */
-enum {
+typedef enum eFMod_Generator_Functions {
FCM_GENERATOR_FN_SIN = 0,
FCM_GENERATOR_FN_COS,
FCM_GENERATOR_FN_TAN,
FCM_GENERATOR_FN_SQRT,
FCM_GENERATOR_FN_LN,
+ FCM_GENERATOR_FN_SINC,
} eFMod_Generator_Functions;
@@ -140,7 +181,7 @@ typedef struct FMod_Cycles {
} FMod_Cycles;
/* cycling modes */
-enum {
+typedef enum eFMod_Cycling_Modes {
FCM_EXTRAPOLATE_NONE = 0, /* don't do anything */
FCM_EXTRAPOLATE_CYCLIC, /* repeat keyframe range as-is */
FCM_EXTRAPOLATE_CYCLIC_OFFSET, /* repeat keyframe range, but with offset based on gradient between values */
@@ -163,7 +204,7 @@ typedef struct FMod_Limits {
} FMod_Limits;
/* limiting flags */
-enum {
+typedef enum eFMod_Limit_Flags {
FCM_LIMIT_XMIN = (1<<0),
FCM_LIMIT_XMAX = (1<<1),
FCM_LIMIT_YMIN = (1<<2),
@@ -176,14 +217,13 @@ typedef struct FMod_Noise {
float strength;
float phase;
float pad;
-
+
short depth;
short modification;
-
} FMod_Noise;
/* modification modes */
-enum {
+typedef enum eFMod_Noise_Modifications {
FCM_NOISE_MODIF_REPLACE = 0, /* Modify existing curve, matching it's shape */
FCM_NOISE_MODIF_ADD, /* Add noise to the curve */
FCM_NOISE_MODIF_SUBTRACT, /* Subtract noise from the curve */
@@ -239,7 +279,7 @@ typedef struct ChannelDriver {
} ChannelDriver;
/* driver type */
-enum {
+typedef enum eDriver_Types {
/* target values are averaged together */
DRIVER_TYPE_AVERAGE = 0,
/* python expression/function relates targets */
@@ -249,7 +289,7 @@ enum {
} eDriver_Types;
/* driver flags */
-enum {
+typedef enum eDriver_Flags {
/* driver has invalid settings (internal flag) */
DRIVER_FLAG_INVALID = (1<<0),
/* driver needs recalculation (set by depsgraph) */
@@ -305,7 +345,7 @@ typedef struct FCurve {
/* user-editable flags/settings */
-enum {
+typedef enum eFCurve_Flags {
/* curve/keyframes are visible in editor */
FCURVE_VISIBLE = (1<<0),
/* curve is selected for editing */
@@ -328,13 +368,13 @@ enum {
} eFCurve_Flags;
/* extrapolation modes (only simple value 'extending') */
-enum {
+typedef enum eFCurve_Extend {
FCURVE_EXTRAPOLATE_CONSTANT = 0, /* just extend min/max keyframe value */
FCURVE_EXTRAPOLATE_LINEAR, /* just extend gradient of segment between first segment keyframes */
} eFCurve_Extend;
/* curve coloring modes */
-enum {
+typedef enum eFCurve_Coloring {
FCURVE_COLOR_AUTO_RAINBOW = 0, /* automatically determine color using rainbow (calculated at drawtime) */
FCURVE_COLOR_AUTO_RGB, /* automatically determine color using XYZ (array index) <-> RGB */
FCURVE_COLOR_CUSTOM, /* custom color */
@@ -386,85 +426,110 @@ typedef struct AnimMapper {
/* ************************************************ */
/* NLA - Non-Linear Animation */
-// TODO: the concepts here still need to be refined to solve any unresolved items
-
-/* NLA Modifiers ---------------------------------- */
-
-/* These differ from F-Curve modifiers, as although F-Curve modifiers also operate on a
- * per-channel basis too (in general), they are part of the animation data itself, which
- * means that their effects are inherited by all of their users. In order to counteract this,
- * the modifiers here should be used to provide variation to pre-created motions only.
- */
/* NLA Strips ------------------------------------- */
/* NLA Strip (strip)
*
* A NLA Strip is a container for the reuse of Action data, defining parameters
- * to control the remapping of the Action data to some destination. Actions being
- * referenced by NLA-Strips SHOULD-NOT be editable, unless they were created in such
- * a way that results in very little mapping distortion (i.e. for layered animation only,
- * opposed to prebuilt 'blocks' which are quickly dumped into the NLA for crappymatic machima-type
- * stuff)
+ * to control the remapping of the Action data to some destination.
*/
typedef struct NlaStrip {
struct NlaStrip *next, *prev;
- bAction *act; /* Action that is referenced by this strip */
+ ListBase strips; /* 'Child' strips (used for 'meta' strips) */
+ bAction *act; /* Action that is referenced by this strip (strip is 'user' of the action) */
AnimMapper *remap; /* Remapping info this strip (for tweaking correspondance of action with context) */
- ListBase modifiers; /* NLA Modifiers */
+ ListBase fcurves; /* F-Curves for controlling this strip's influence and timing */ // TODO: move out?
+ ListBase modifiers; /* F-Curve modifiers to be applied to the entire strip's referenced F-Curves */
+
+ char name[64]; /* User-Visible Identifier for Strip */
- ListBase fcurves; /* F-Curves for controlling this strip's influence and timing */
float influence; /* Influence of strip */
- float act_time; /* Current 'time' within action being used */
+ float strip_time; /* Current 'time' within action being used (automatically evaluated, but can be overridden) */
float start, end; /* extents of the strip */
float actstart, actend; /* range of the action to use */
- float repeat; /* The number of times to repeat the action range (only when no F-Curves) */
- float scale; /* The amount the action range is scaled by (only when no F-Curves) */
+ float repeat; /* The number of times to repeat the action range (only when no F-Curves) */
+ float scale; /* The amount the action range is scaled by (only when no F-Curves) */
float blendin, blendout; /* strip blending length (only used when there are no F-Curves) */
- int blendmode; /* strip blending mode */
+ short blendmode; /* strip blending mode (layer-based mixing) */
- int flag; /* settings */
+ short extendmode; /* strip extrapolation mode (time-based mixing) */
+ short pad1;
- // umm... old unused cruft?
- int stride_axis; /* axis for stridebone stuff - 0=x, 1=y, 2=z */
- int pad;
+ short type; /* type of NLA strip */
- float actoffs; /* Offset within action, for cycles and striding (only set for ACT_USESTRIDE) */
- float stridelen; /* The stridelength (considered when flag & ACT_USESTRIDE) */
-
- char stridechannel[32]; /* Instead of stridelen, it uses an action channel */
- char offs_bone[32]; /* if repeat, use this bone/channel for defining offset */
+ int flag; /* settings */
+ int pad2;
} NlaStrip;
/* NLA Strip Blending Mode */
-enum {
- NLASTRIPMODE_BLEND = 0,
- NLASTRIPMODE_ADD,
- NLASTRIPMODE_SUBTRACT,
-} eActStrip_Mode;
+typedef enum eNlaStrip_Blend_Mode {
+ NLASTRIP_MODE_REPLACE = 0,
+ NLASTRIP_MODE_ADD,
+ NLASTRIP_MODE_SUBTRACT,
+ NLASTRIP_MODE_MULTIPLY,
+} eNlaStrip_Blend_Mode;
+
+/* NLA Strip Extrpolation Mode */
+typedef enum eNlaStrip_Extrapolate_Mode {
+ /* extend before first frame if no previous strips in track, and always hold+extend last frame */
+ NLASTRIP_EXTEND_HOLD = 0,
+ /* only hold+extend last frame */
+ NLASTRIP_EXTEND_HOLD_FORWARD,
+ /* don't contribute at all */
+ NLASTRIP_EXTEND_NOTHING,
+} eNlaStrip_Extrapolate_Mode;
/* NLA Strip Settings */
-// TODO: check on which of these are still useful...
-enum {
- NLASTRIP_SELECT = (1<<0),
- NLASTRIP_USESTRIDE = (1<<1),
- NLASTRIP_BLENDTONEXT = (1<<2), /* Not implemented. Is not used anywhere */
- NLASTRIP_HOLDLASTFRAME = (1<<3),
- NLASTRIP_ACTIVE = (1<<4),
- NLASTRIP_LOCK_ACTION = (1<<5),
- NLASTRIP_MUTE = (1<<6),
- NLASTRIP_REVERSE = (1<<7), /* This has yet to be implemented. To indicate that a strip should be played backwards */
- NLASTRIP_CYCLIC_USEX = (1<<8),
- NLASTRIP_CYCLIC_USEY = (1<<9),
- NLASTRIP_CYCLIC_USEZ = (1<<10),
- NLASTRIP_AUTO_BLENDS = (1<<11),
- NLASTRIP_TWEAK = (1<<12), /* This strip is a tweaking strip (only set if owner track is a tweak track) */
-} eActionStrip_Flag;
+typedef enum eNlaStrip_Flag {
+ /* UI selection flags */
+ /* NLA strip is the active one in the track (also indicates if strip is being tweaked) */
+ NLASTRIP_FLAG_ACTIVE = (1<<0),
+ /* NLA strip is selected for editing */
+ NLASTRIP_FLAG_SELECT = (1<<1),
+// NLASTRIP_FLAG_SELECT_L = (1<<2), // left handle selected
+// NLASTRIP_FLAG_SELECT_R = (1<<3), // right handle selected
+ /* NLA strip uses the same action that the action being tweaked uses (not set for the twaking one though) */
+ NLASTRIP_FLAG_TWEAKUSER = (1<<4),
+
+ /* controls driven by local F-Curves */
+ /* strip influence is controlled by local F-Curve */
+ NLASTRIP_FLAG_USR_INFLUENCE = (1<<5),
+ NLASTRIP_FLAG_USR_TIME = (1<<6),
+
+ /* NLA strip length is synced to the length of the referenced action */
+ NLASTRIP_FLAG_SYNC_LENGTH = (1<<9),
+
+ /* playback flags (may be overriden by F-Curves) */
+ /* NLA strip blendin/out values are set automatically based on overlaps */
+ NLASTRIP_FLAG_AUTO_BLENDS = (1<<10),
+ /* NLA strip is played back in reverse order */
+ NLASTRIP_FLAG_REVERSE = (1<<11),
+ /* NLA strip is muted (i.e. doesn't contribute in any way) */
+ NLASTRIP_FLAG_MUTED = (1<<12),
+ /* NLA Strip is played back in 'ping-pong' style */
+ NLASTRIP_FLAG_MIRROR = (1<<13),
+
+ /* temporary editing flags */
+ /* NLA-Strip is really just a temporary meta used to facilitate easier transform code */
+ NLASTRIP_FLAG_TEMP_META = (1<<30),
+ NLASTRIP_FLAG_EDIT_TOUCHED = (1<<31),
+} eNlaStrip_Flag;
+
+/* NLA Strip Type */
+typedef enum eNlaStrip_Type {
+ /* 'clip' - references an Action */
+ NLASTRIP_TYPE_CLIP = 0,
+ /* 'transition' - blends between the adjacent strips */
+ NLASTRIP_TYPE_TRANSITION,
+ /* 'meta' - a strip which acts as a container for a few others */
+ NLASTRIP_TYPE_META,
+} eNlaStrip_Type;
/* NLA Tracks ------------------------------------- */
@@ -483,14 +548,12 @@ typedef struct NlaTrack {
int flag; /* settings for this track */
int index; /* index of the track in the stack (NOTE: not really useful, but we need a pad var anyways!) */
- char info[64]; /* short user-description of this track */
+ char name[64]; /* short user-description of this track */
} NlaTrack;
/* settings for track */
-enum {
- /* track is the one that settings can be modified on (doesn't indicate
- * that it's for 'tweaking' though)
- */
+typedef enum eNlaTrack_Flag {
+ /* track is the one that settings can be modified on, also indicates if track is being 'tweaked' */
NLATRACK_ACTIVE = (1<<0),
/* track is selected in UI for relevant editing operations */
NLATRACK_SELECTED = (1<<1),
@@ -500,10 +563,9 @@ enum {
NLATRACK_SOLO = (1<<3),
/* track's settings (and strips) cannot be edited (to guard against unwanted changes) */
NLATRACK_PROTECTED = (1<<4),
- /* strip is the 'last' one that should be evaluated, as the active action
- * is being used to tweak the animation of the strips up to here
- */
- NLATRACK_TWEAK = (1<<5),
+
+ /* track is not allowed to execute, usually as result of tweaking being enabled (internal flag) */
+ NLATRACK_DISABLED = (1<<10),
} eNlaTrack_Flag;
@@ -538,13 +600,13 @@ typedef struct KS_Path {
} KS_Path;
/* KS_Path->flag */
-enum {
+typedef enum eKSP_Settings {
/* entire array (not just the specified index) gets keyframed */
KSP_FLAG_WHOLE_ARRAY = (1<<0),
} eKSP_Settings;
/* KS_Path->groupmode */
-enum {
+typedef enum eKSP_Grouping {
/* path should be grouped using group name stored in path */
KSP_GROUP_NAMED = 0,
/* path should not be grouped at all */
@@ -564,11 +626,13 @@ enum {
* enum here defines the flags which define which templates are
* required by a path before it can be used
*/
-enum {
+typedef enum eKSP_TemplateTypes {
KSP_TEMPLATE_OBJECT = (1<<0), /* #obj - selected object */
KSP_TEMPLATE_PCHAN = (1<<1), /* #pch - selected posechannel */
KSP_TEMPLATE_CONSTRAINT = (1<<2), /* #con - active only */
KSP_TEMPLATE_NODE = (1<<3), /* #nod - selected node */
+
+ KSP_TEMPLATE_PCHAN_ROT = (1<<16), /* modify rotation paths based on rotation mode of Pose Channel */
} eKSP_TemplateTypes;
/* ---------------- */
@@ -595,7 +659,7 @@ typedef struct KeyingSet {
} KeyingSet;
/* KeyingSet settings */
-enum {
+typedef enum eKS_Settings {
/* keyingset cannot be removed (and doesn't need to be freed) */
KEYINGSET_BUILTIN = (1<<0),
/* keyingset does not depend on context info (i.e. paths are absolute) */
@@ -603,7 +667,7 @@ enum {
} eKS_Settings;
/* Flags for use by keyframe creation/deletion calls */
-enum {
+typedef enum eInsertKeyFlags {
INSERTKEY_NEEDED = (1<<0), /* only insert keyframes where they're needed */
INSERTKEY_MATRIX = (1<<1), /* insert 'visual' keyframes where possible/needed */
INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */
@@ -646,11 +710,15 @@ typedef struct AnimOverride {
* blocks may override local settings.
*
* This datablock should be placed immediately after the ID block where it is used, so that
- * the code which retrieves this data can do so in an easier manner. See blenkernel/internal/anim_sys.c for details.
+ * the code which retrieves this data can do so in an easier manner. See blenkernel/intern/anim_sys.c for details.
*/
typedef struct AnimData {
/* active action - acts as the 'tweaking track' for the NLA */
- bAction *action;
+ bAction *action;
+ /* temp-storage for the 'real' active action (i.e. the one used before the tweaking-action
+ * took over to be edited in the Animation Editors)
+ */
+ bAction *tmpact;
/* remapping-info for active action - should only be used if needed
* (for 'foreign' actions that aren't working correctly)
*/
@@ -658,6 +726,8 @@ typedef struct AnimData {
/* nla-tracks */
ListBase nla_tracks;
+ /* active NLA-strip (only set/used during tweaking, so no need to worry about dangling pointers) */
+ NlaStrip *actstrip;
/* 'drivers' for this ID-block's settings - FCurves, but are completely
* separate from those for animation data
@@ -666,25 +736,39 @@ typedef struct AnimData {
ListBase overrides; /* temp storage (AnimOverride) of values for settings that are animated (but the value hasn't been keyframed) */
/* settings for animation evaluation */
- int flag; /* user-defined settings */
- int recalc; /* depsgraph recalculation flags */
+ int flag; /* user-defined settings */
+ int recalc; /* depsgraph recalculation flags */
+
+ /* settings for active action evaluation (based on NLA strip settings) */
+ short act_blendmode; /* accumulation mode for active action */
+ short act_extendmode; /* extrapolation mode for active action */
+ float act_influence; /* influence for active action */
} AnimData;
/* Animation Data settings (mostly for NLA) */
-enum {
+typedef enum eAnimData_Flag {
/* only evaluate a single track in the NLA */
ADT_NLA_SOLO_TRACK = (1<<0),
/* don't use NLA */
ADT_NLA_EVAL_OFF = (1<<1),
- /* don't execute drivers */
- ADT_DRIVERS_DISABLED = (1<<2),
+ /* NLA is being 'tweaked' (i.e. in EditMode) */
+ ADT_NLA_EDIT_ON = (1<<2),
+ /* active Action for 'tweaking' does not have mapping applied for editing */
+ ADT_NLA_EDIT_NOMAP = (1<<3),
+ /* NLA-Strip F-Curves are expanded in UI */
+ ADT_NLA_SKEYS_COLLAPSED = (1<<4),
/* drivers expanded in UI */
ADT_DRIVERS_COLLAPSED = (1<<10),
+ /* don't execute drivers */
+ ADT_DRIVERS_DISABLED = (1<<11),
+
+ /* F-Curves from this AnimData block are not visible in the Graph Editor */
+ ADT_CURVES_NOT_VISIBLE = (1<<16),
} eAnimData_Flag;
/* Animation Data recalculation settings (to be set by depsgraph) */
-enum {
+typedef enum eAnimData_Recalc {
ADT_RECALC_DRIVERS = (1<<0),
ADT_RECALC_ANIM = (1<<1),
ADT_RECALC_ALL = (ADT_RECALC_DRIVERS|ADT_RECALC_ANIM),