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:
authorJoshua Leung <aligorith@gmail.com>2009-01-17 06:12:50 +0300
committerJoshua Leung <aligorith@gmail.com>2009-01-17 06:12:50 +0300
commit44e5b7788bcbe55400bf0d91eed0752ed865b644 (patch)
tree7b69e89ff7f93127d5691f528c5dc9bb85835ee1 /source/blender/makesdna
parent9bcdb4b758d96d1fe5345858f6c61a90f7c57eac (diff)
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future. Highlights of the new system: * Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. - F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. - The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc. * F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated. * Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place) * F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place) * NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details: http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html So, what currently works: * I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code. * Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock. * Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc. Notes: * Drivers haven't been hooked up yet * Only objects and data directly linked to objects can be animated. * Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change). * Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor) * I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review. In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_anim_types.h587
-rw-r--r--source/blender/makesdna/DNA_camera_types.h7
-rw-r--r--source/blender/makesdna/DNA_ipo_types.h11
-rw-r--r--source/blender/makesdna/DNA_key_types.h4
-rw-r--r--source/blender/makesdna/DNA_lamp_types.h6
-rw-r--r--source/blender/makesdna/DNA_material_types.h6
-rw-r--r--source/blender/makesdna/DNA_object_types.h20
-rw-r--r--source/blender/makesdna/DNA_scene_types.h3
-rw-r--r--source/blender/makesdna/DNA_texture_types.h4
-rw-r--r--source/blender/makesdna/DNA_world_types.h4
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
11 files changed, 637 insertions, 17 deletions
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
new file mode 100644
index 00000000000..71c71f905a2
--- /dev/null
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -0,0 +1,587 @@
+/* Testing code for new animation system in 2.5
+ * Copyright 2009, Joshua Leung
+ */
+
+#ifndef DNA_ANIM_TYPES_H
+#define DNA_ANIM_TYPES_H
+
+#include "DNA_ID.h"
+#include "DNA_listBase.h"
+#include "DNA_curve_types.h"
+
+/* ************************************************ */
+/* F-Curve DataTypes */
+
+/* Modifiers -------------------------------------- */
+
+/* F-Curve Modifiers (fcm)
+ *
+ * These alter the way F-Curves behave, by altering the value that is returned
+ * when evaluating the curve's data at some time (t).
+ */
+typedef struct FModifier {
+ struct FModifier *next, *prev;
+
+ void *data; /* pointer to modifier data */
+
+ char name[64]; /* user-defined description for the modifier */
+ short type; /* type of f-curve modifier */
+ short flag; /* settings for the modifier */
+
+ float influence; /* the amount that the modifier should influence the value */
+} FModifier;
+
+/* Types of F-Curve modifier
+ * WARNING: order here is important!
+ */
+enum {
+ FMODIFIER_TYPE_NULL = 0,
+ FMODIFIER_TYPE_GENERATOR,
+ FMODIFIER_TYPE_ENVELOPE,
+ FMODIFIER_TYPE_CYCLES,
+ FMODIFIER_TYPE_NOISE, /* unimplemented - generate variations using some basic noise generator... */
+ FMODIFIER_TYPE_FILTER, /* unimplemented - for applying: fft, high/low pass filters, etc. */
+ FMODIFIER_TYPE_PYTHON,
+
+ /* NOTE: all new modifiers must be added above this line */
+ FMODIFIER_NUM_TYPES
+} eFModifier_Types;
+
+/* F-Curve Modifier Settings */
+enum {
+ /* 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) */
+ FMODIFIER_FLAG_EXPANDED = (1<<1),
+ /* modifier is active one (in UI) for editing purposes */
+ FMODIFIER_FLAG_ACTIVE = (1<<2),
+} eFModifier_Flags;
+
+/* --- */
+
+/* generator modifier data */
+typedef struct FMod_Generator {
+ /* generator based on PyExpression */
+ char expression[256]; /* python expression to use as generator */
+
+ /* simple polynomial generator (y = C[0]*(x^(n)) + C[1]*(x^(n-1)) + ... C[n]) */
+ float *poly_coefficients; /* array of the coefficients for the polynomial (poly_order + 1 items long) */
+ unsigned int poly_order; /* order of the polynomial (i.e. 1 for linear, 2 for quadratic) */
+
+ /* settings */
+ short flag; /* settings */
+ short mode; /* which 'generator' to use */
+} FMod_Generator;
+
+/* generator modes */
+enum {
+ FCM_GENERATOR_POLYNOMIAL = 0,
+ FCM_GENERATOR_EXPRESSION,
+} eFMod_Generator_Modes;
+
+
+/* envelope modifier - envelope data */
+typedef struct FCM_EnvelopeData {
+ float min, max; /* min/max values for envelope at this point (absolute values) */
+ float time; /* time for that this sample-point occurs */
+
+ short f1; /* settings for 'min' control point */
+ short f2; /* settings for 'max' control point */
+} FCM_EnvelopeData;
+
+/* envelope-like adjustment to values (for fade in/out) */
+typedef struct FMod_Envelope {
+ FCM_EnvelopeData *data; /* data-points defining envelope to apply (array) */
+ int totvert; /* number of envelope points */
+
+ float midval; /* value that envelope's influence is centered around / based on */
+ float min, max; /* distances from 'middle-value' for 1:1 envelope influence */
+} FMod_Envelope;
+
+
+/* cycling/repetition modifier data */
+// TODO: we can only do complete cycles...
+typedef struct FMod_Cycles {
+ short before_mode; /* extrapolation mode to use before first keyframe */
+ short after_mode; /* extrapolation mode to use after last keyframe */
+ short before_cycles; /* number of 'cycles' before first keyframe to do */
+ short after_cycles; /* number of 'cycles' after last keyframe to do */
+} FMod_Cycles;
+
+/* cycling modes */
+enum {
+ 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 */
+} eFMod_Cycling_Modes;
+
+
+/* Python-script modifier data */
+typedef struct FMod_Python {
+ struct Text *script; /* text buffer containing script to execute */
+ IDProperty *prop; /* ID-properties to provide 'custom' settings */
+} FMod_Python;
+
+/* Drivers -------------------------------------- */
+
+/* Channel Driver (i.e. Drivers / Expressions) (driver)
+ *
+ * Channel Drivers are part of the dependency system, and are executed in addition to
+ * normal user-defined animation. They take the animation result of some channel(s), and
+ * use that (optionally combined with its own F-Curve for modification of results) to define
+ * the value of some setting semi-procedurally.
+ *
+ * Drivers are stored as part of F-Curve data, so that the F-Curve's RNA-path settings (for storing
+ * what setting the driver will affect). The order in which they are stored defines the order that they're
+ * evaluated in. This order is set by the Depsgraph's sorting stuff.
+ */
+typedef struct ChannelDriver {
+ /* primary target */
+ ID *id; /* ID-block which owns the target */
+ char *rna_path; /* target channel to use as driver value */
+ int array_index; /* if applicable, the index of the RNA-array item to use as driver */
+
+ /* value cache (placed here for alignment reasons) */
+ float curval; /* result of previous evaluation, for subtraction from result under certain circumstances */
+
+ /* secondary target (for rotational difference) */
+ ID *id2; /* ID-block which owns the second target */
+ char *rna_path2; /* second target channel to use as driver value */
+ int array_index2; /* if applicable, the index of the RNA-array item to use as driver */
+
+ /* general settings (placed here for alignment reasons) */
+ int type; /* type of driver */
+ int flag; /* settings of driver */
+
+ float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting
+
+ /* settings for Python Drivers (PyDrivers) */
+ char expression[256]; /* python expression to execute (may call functions defined in an accessory file) */
+} ChannelDriver;
+
+/* driver type */
+enum {
+ /* channel drives channel */
+ DRIVER_TYPE_CHANNEL = 0,
+ /* py-expression used as driver */
+ DRIVER_TYPE_PYTHON,
+ /* rotational difference (must use rotation channels only) */
+ DRIVER_TYPE_ROTDIFF,
+} eDriver_Types;
+
+/* driver flags */
+enum {
+ /* driver has invalid settings (internal flag) */
+ DRIVER_FLAG_INVALID = (1<<0),
+ /* driver was disabled temporarily, so shouldn't be evaluated (set by user) */
+ DRIVER_FLAG_DISABLED = (1<<1),
+ /* driver needs recalculation (set by depsgraph) */
+ DRIVER_FLAG_RECALC = (1<<2),
+ /* driver does replace value, but overrides (for layering of animation over driver) */
+ // TODO: is this necessary?
+ DRIVER_FLAG_LAYERING = (1<<3),
+} eDriver_Flags;
+
+/* F-Curves -------------------------------------- */
+
+/* FPoint (fpt)
+ *
+ * This is the bare-minimum data required storing motion samples. Should be more efficient
+ * than using BPoints, which contain a lot of other unnecessary data...
+ */
+typedef struct FPoint {
+ float vec[2]; /* time + value */
+ int flag; /* selection info */
+ int pad;
+} FPoint;
+
+/* 'Function-Curve' - defines values over time for a given setting (fcu) */
+typedef struct FCurve {
+ struct FCurve *next, *prev;
+
+ /* driver settings */
+ ChannelDriver *driver; /* only valid for drivers (i.e. stored in AnimData not Actions) */
+ /* evaluation settings */
+ ListBase modifiers; /* FCurve Modifiers */
+
+ /* motion data */
+ BezTriple *bezt; /* user-editable keyframes (array) */
+ FPoint *fpt; /* 'baked/imported' motion samples (array) */
+ int totvert; /* total number of points which define the curve (i.e. size of arrays in FPoints) */
+
+ /* value cache + settings */
+ float curval; /* value stored from last time curve was evaluated */
+ short flag; /* user-editable settings for this curve */
+ short extend; /* value-extending mode for this curve (does not cover */
+
+ /* RNA - data link */
+ int array_index; /* if applicable, the index of the RNA-array item to get */
+ char *rna_path; /* RNA-path to resolve data-access */
+} FCurve;
+
+
+/* user-editable flags/settings */
+enum {
+ /* curve/keyframes are visible in editor */
+ FCURVE_VISIBLE = (1<<0),
+ /* curve is selected for editing */
+ FCURVE_SELECTED = (1<<1),
+ /* curve is active one */
+ FCURVE_ACTIVE = (1<<2),
+ /* keyframes (beztriples) cannot be edited */
+ FCURVE_PROTECTED = (1<<3),
+ /* fcurve will not be evaluated for the next round */
+ FCURVE_MUTED = (1<<4),
+ /* fcurve uses 'auto-handles', which stay horizontal... */
+ FCURVE_AUTO_HANDLES = (1<<5),
+
+ /* skip evaluation, as RNA-path cannot be resolved (similar to muting, but cannot be set by user) */
+ FCURVE_DISABLED = (1<<10),
+ /* curve can only have whole-number values (int or boolean types) */
+ FCURVE_INT_VALUES = (1<<11),
+} eFCurve_Flags;
+
+/* extrapolation modes (only simple value 'extending') */
+enum {
+ FCURVE_EXTRAPOLATE_CONSTANT = 0, /* just extend min/max keyframe value */
+ FCURVE_EXTRAPOLATE_LINEAR, /* just extend gradient of segment between first segment keyframes */
+} eFCurve_Extend;
+
+/* interpolation modes (used only for BezTriple->ipo) */
+// TODO: move this to curve-types file?
+enum {
+ BEZT_IPO_CONST = 0, /* constant interpolation */
+ BEZT_IPO_LIN, /* linear interpolation */
+ BEZT_IPO_BEZ, /* bezier interpolation */
+} eBezTriple_Interpolation;
+
+/* ************************************************ */
+/* 'Action' Datatypes */
+
+/* Groups -------------------------------------- */
+
+#if 0
+
+/* Action-Channel Group (agrp)
+
+ * These are stored as a list per-Action, and are only used to
+ * group that Action's channels in an Animation Editor.
+ *
+ * Even though all FCurves live in a big list per Action, each group they are in also
+ * holds references to the achans within that list which belong to it. Care must be taken to
+ * ensure that action-groups never end up being the sole 'owner' of a channel.
+ *
+ * This is also exploited for bone-groups. Bone-Groups are stored per bPose, and are used
+ * primarily to colour bones in the 3d-view. There are other benefits too, but those are mostly related
+ * to Action-Groups.
+ */
+typedef struct bActionGroup {
+ struct ActionGroup *next, *prev;
+
+ ListBase channels; /* Note: this must not be touched by standard listbase functions which would clear links to other channels */
+
+ int flag; /* settings for this action-group */
+ int customCol; /* index of custom color set to use when used for bones (0=default - used for all old files, -1=custom set) */
+ char name[64]; /* name of the group */
+
+ ThemeWireColor cs; /* color set to use when customCol == -1 */
+} bActionGroup;
+
+/* Action Group flags */
+enum {
+ AGRP_SELECTED = (1<<0),
+ AGRP_ACTIVE = (1<<1),
+ AGRP_PROTECTED = (1<<2),
+ AGRP_EXPANDED = (1<<3),
+
+ AGRP_TEMP = (1<<30),
+ AGRP_MOVED = (1<<31)
+} eActionGroup_Flag;
+
+#endif
+
+/* Actions -------------------------------------- */
+
+/* Action - reusable F-Curve 'bag' (act)
+ *
+ * This contains F-Curves that may affect settings from more than one ID blocktype and/or
+ * datablock (i.e. sub-data linked/used directly to the ID block that the animation data is linked to),
+ * but with the restriction that the other unrelated data (i.e. data that is not directly used or linked to
+ * by the source ID block).
+ *
+ * It serves as a 'unit' of reusable animation information (i.e. keyframes/motion data), that
+ * affects a group of related settings (as defined by the user).
+ */
+// XXX use this as drop-in replacement at some point...
+typedef struct nAction {
+ ID id; /* ID-serialisation for relinking */
+
+ ListBase curves; /* function-curves (FCurve) */
+ ListBase chanbase; /* legacy data - Action Channels (bActionChannel) in pre-2.5 animation system */
+ ListBase groups; /* groups of function-curves (bActionGroup) */
+ ListBase markers; /* markers local to the Action (used to provide Pose-Libraries) */
+
+ int flag; /* settings for this action */
+ int active_marker; /* index of the active marker */
+} nAction;
+
+
+/* Flags for the action */
+enum {
+ /* flags for displaying in UI */
+ ACT_EXPANDED = (1<<0),
+ ACT_SELECTED = (1<<1),
+
+ /* flags for evaluation/editing */
+ ACT_MUTED = (1<<9),
+ ACT_PROTECTED = (1<<10),
+} eAction_Flags;
+
+/* ************************************************ */
+/* Animation Reuse - i.e. users of Actions */
+
+/* Retargetting ----------------------------------- */
+
+/* Retargetting Pair
+ *
+ * Defines what parts of the paths should be remapped from 'abc' to 'xyz'.
+ * TODO:
+ * - Regrex (possibly provided through PY, though having our own module might be faster)
+ * would be important to have at some point. Current replacements are just simple
+ * string matches...
+ */
+typedef struct AnimMapPair {
+ char from[128]; /* part of path to bed replaced */
+ char to[128]; /* part of path to replace with */
+} AnimMapPair;
+
+/* Retargetting Information for Actions
+ *
+ * This should only be used if it is strictly necessary (i.e. user will need to explictly
+ * add this when they find that some channels do not match, or motion is not going to right
+ * places). When executing an action, this will be checked to see if it provides any useful
+ * remaps for the given paths.
+ *
+ * NOTE: we currently don't store this in the Action itself, as that causes too many problems.
+ */
+// FIXME: will this be too clumsy or slow? If we're using RNA paths anyway, we'll have to accept
+// such consequences...
+typedef struct AnimMapper {
+ struct AnimMapper *next, *prev;
+
+ nAction *target; /* target action */
+ ListBase mappings; /* remapping table (bAnimMapPair) */
+} 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)
+ */
+typedef struct NlaStrip {
+ struct NlaStrip *next, *prev;
+
+ nAction *act; /* Action that is referenced by this strip */
+ 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 */
+ float influence; /* Influence of strip */
+ float act_time; /* Current 'time' within action being used */
+
+ 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 blendin, blendout; /* strip blending length (only used when there are no F-Curves) */
+ int blendmode; /* strip blending mode */
+
+ int flag; /* settings */
+
+ // umm... old unused cruft?
+ int stride_axis; /* axis for stridebone stuff - 0=x, 1=y, 2=z */
+ int pad;
+
+ 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 */
+} NlaStrip;
+
+/* NLA Strip Blending Mode */
+enum {
+ NLASTRIPMODE_BLEND = 0,
+ NLASTRIPMODE_ADD,
+ NLASTRIPMODE_SUBTRACT,
+} eActStrip_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;
+
+/* NLA Tracks ------------------------------------- */
+
+/* NLA Track (nlt)
+ *
+ * A track groups a bunch of 'strips', which should form a continous set of
+ * motion, on top of which other such groups can be layered. This should allow
+ * for animators to work in a non-destructive manner, layering tweaks, etc. over
+ * 'rough' blocks of their work.
+ */
+typedef struct NlaTrack {
+ struct NlaTrack *next, *prev;
+
+ ListBase strips; /* bActionStrips in this track */
+
+ 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 */
+} NlaTrack;
+
+/* settings for track */
+enum {
+ /* track is the one that settings can be modified on (doesn't indicate
+ * that it's for 'tweaking' though)
+ */
+ NLATRACK_ACTIVE = (1<<0),
+ /* track is selected in UI for relevant editing operations */
+ NLATRACK_SELECTED = (1<<1),
+ /* track is not evaluated */
+ NLATRACK_MUTED = (1<<2),
+ /* track is the only one evaluated (must be used in conjunction with adt->flag) */
+ 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),
+} eNlaTrack_Flag;
+
+/* ************************************************ */
+/* Animation Data */
+
+/* AnimOverride ------------------------------------- */
+
+/* Animation Override (aor)
+ *
+ * This is used to as temporary storage of values which have been changed by the user, but not
+ * yet keyframed (thus, would get overwritten by the animation system before the user had a chance
+ * to see the changes that were made).
+ *
+ * It is probably not needed for overriding keyframed values in most cases, as those will only get evaluated
+ * on frame-change now. That situation may change in future.
+ */
+typedef struct AnimOverride {
+ struct AnimOverride *next, *prev;
+
+ char *rna_path; /* RNA-path to use to resolve data-access */
+ int array_index; /* if applicable, the index of the RNA-array item to get */
+
+ float value; /* value to override setting with */
+} AnimOverride;
+
+/* AnimData ------------------------------------- */
+
+/* Animation data for some ID block (adt)
+ *
+ * This block of data is used to provide all of the necessary animation data for a datablock.
+ * Currently, this data will not be reusable, as there shouldn't be any need to do so.
+ *
+ * This information should be made available for most if not all ID-blocks, which should
+ * enable all of its settings to be animatable locally. Animation from 'higher-up' ID-AnimData
+ * 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.
+ */
+typedef struct AnimData {
+ /* active action - acts as the 'tweaking track' for the NLA */
+ nAction *action;
+ /* remapping-info for active action - should only be used if needed
+ * (for 'foreign' actions that aren't working correctly)
+ */
+ AnimMapper *remap;
+
+ /* nla-tracks */
+ ListBase nla_tracks;
+
+ /* 'drivers' for this ID-block's settings - FCurves, but are completely
+ * separate from those for animation data
+ */
+ ListBase drivers; /* standard user-created Drivers/Expressions (used as part of a rig) */
+ 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 */
+} AnimData;
+
+/* Animation Data settings (mostly for NLA) */
+enum {
+ /* 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),
+} eAnimData_Flag;
+
+/* Animation Data recalculation settings (to be set by depsgraph) */
+enum {
+ ADT_RECALC_DRIVERS = (1<<0),
+ ADT_RECALC_ANIM = (1<<1),
+ ADT_RECALC_ALL = (ADT_RECALC_DRIVERS|ADT_RECALC_ANIM),
+} eAnimData_Recalc;
+
+/* Base Struct for Anim ------------------------------------- */
+
+/* Used for BKE_animdata_from_id()
+ * All ID-datablocks which have their own 'local' AnimData
+ * should have the same arrangement in their structs.
+ */
+typedef struct IdAdtTemplate {
+ ID id;
+ AnimData adt;
+} IdAdtTemplate;
+
+/* ************************************************ */
+
+#endif /* DNA_ANIM_TYPES_H */
diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h
index cfca4523dd8..2e79d9c5a42 100644
--- a/source/blender/makesdna/DNA_camera_types.h
+++ b/source/blender/makesdna/DNA_camera_types.h
@@ -32,17 +32,20 @@
#define DNA_CAMERA_TYPES_H
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
#include "DNA_scriptlink_types.h"
#ifdef __cplusplus
extern "C" {
#endif
-struct Ipo;
struct Object;
+struct AnimData;
+struct Ipo;
typedef struct Camera {
ID id;
+ struct AnimData adt; /* animation data (must be immediately after id for utilities to use it) */
short type, flag;
float passepartalpha, angle;
@@ -57,7 +60,7 @@ typedef struct Camera {
short YF_bkhtype, YF_bkhbias;
float YF_bkhrot;
- struct Ipo *ipo;
+ struct Ipo *ipo; // XXX depreceated... old animation system
ScriptLink scriptlink;
struct Object *dof_ob;
diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h
index 6d928646b3d..58c26f06e4c 100644
--- a/source/blender/makesdna/DNA_ipo_types.h
+++ b/source/blender/makesdna/DNA_ipo_types.h
@@ -28,6 +28,17 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+/* ==============================================
+ * ATTENTION:
+ *
+ * The contents of this file are now officially depreceated. They were used for the 'old' animation system,
+ * which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith). All defines,
+ * etc. are only still maintained to provide backwards compatability for old files...
+ *
+ * =============================================
+ */
+
#ifndef DNA_IPO_TYPES_H
#define DNA_IPO_TYPES_H
diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h
index 13379c44a89..4487c0c3247 100644
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@ -33,6 +33,7 @@
#include "DNA_listBase.h"
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
struct Ipo;
@@ -56,6 +57,7 @@ typedef struct KeyBlock {
typedef struct Key {
ID id;
+ struct AnimData adt; /* animation data (must be immediately after id for utilities to use it) */
KeyBlock *refkey;
char elemstr[32];
@@ -63,7 +65,7 @@ typedef struct Key {
float curval;
ListBase block;
- struct Ipo *ipo;
+ struct Ipo *ipo; // XXX depreceated... old animation system
ID *from;
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index c544be7e388..cfedb9cc0ac 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -32,6 +32,7 @@
#define DNA_LAMP_TYPES_H
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
#include "DNA_scriptlink_types.h"
#ifndef MAX_MTEX
@@ -39,11 +40,12 @@
#endif
struct MTex;
-struct Ipo;
struct CurveMapping;
+struct Ipo;
typedef struct Lamp {
ID id;
+ struct AnimData adt; /* animation data (must be immediately after id for utilities to use it) */
short type, flag;
int mode;
@@ -103,7 +105,7 @@ typedef struct Lamp {
short YF_glowtype, YF_pad2;
struct MTex *mtex[18]; /* MAX_MTEX */
- struct Ipo *ipo;
+ struct Ipo *ipo; // XXX depreceated... old animation system
/* preview */
struct PreviewImage *preview;
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index d3c294a3d36..655d10a5310 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -32,6 +32,7 @@
#define DNA_MATERIAL_TYPES_H
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
#include "DNA_scriptlink_types.h"
#include "DNA_listBase.h"
@@ -40,15 +41,16 @@
#endif
struct MTex;
-struct Ipo;
struct ColorBand;
struct Group;
struct bNodeTree;
+struct Ipo;
/* WATCH IT: change type? also make changes in ipo.h */
typedef struct Material {
ID id;
+ struct AnimData adt; /* animation data (must be immediately after id for utilities to use it) */
short colormodel, flag;
/* note, keep this below synced with render_types.h */
@@ -113,7 +115,7 @@ typedef struct Material {
struct MTex *mtex[18]; /* MAX_MTEX */
struct bNodeTree *nodetree;
- struct Ipo *ipo;
+ struct Ipo *ipo; // XXX depreceated... old animation system
struct Group *group; /* light group */
struct PreviewImage * preview;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 7deea1899d1..69291c1e025 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -35,6 +35,7 @@
#include "DNA_listBase.h"
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
#include "DNA_scriptlink_types.h"
#ifdef __cplusplus
@@ -90,7 +91,8 @@ typedef struct BoundBox {
typedef struct Object {
ID id;
-
+ AnimData adt; /* animation data (must be immediately after id for utilities to use it) */
+
short type, partype;
int par1, par2, par3; /* can be vertexnrs */
char parsubstr[32]; /* String describing subobject info */
@@ -98,15 +100,15 @@ typedef struct Object {
/* if ob->proxy (or proxy_group), this object is proxy for object ob->proxy */
/* proxy_from is set in target back to the proxy. */
struct Object *proxy, *proxy_group, *proxy_from;
- struct Ipo *ipo;
+ struct Ipo *ipo; // XXX depreceated... old animation system
struct Path *path;
struct BoundBox *bb;
- struct bAction *action;
+ struct bAction *action; // XXX depreceated... old animation system
struct bAction *poselib;
struct bPose *pose;
void *data;
- ListBase constraintChannels;
+ ListBase constraintChannels; // XXX depreceated... old animation system
ListBase effect;
ListBase disp;
ListBase defbase;
@@ -129,15 +131,15 @@ typedef struct Object {
short flag; /* copy of Base */
short colbits; /* when zero, from obdata */
- short transflag, ipoflag; /* transformation and ipo settings */
+ short transflag, protectflag; /* transformation settings and transform locks */
short trackflag, upflag;
- short nlaflag, protectflag; /* nlaflag defines NLA override, protectflag is bits to lock transform */
+ short nlaflag, ipoflag; // xxx depreceated... old animation system
short ipowin, scaflag; /* ipowin: blocktype last ipowindow */
short scavisflag, boundtype;
int dupon, dupoff, dupsta, dupend;
- float sf, ctime; /* sf is time-offset, ctime is the objects current time */
+ float sf, ctime; /* sf is time-offset, ctime is the objects current time (XXX timing needs to be revised) */
/* during realtime */
@@ -200,7 +202,7 @@ typedef struct Object {
float anisotropicFriction[3];
ListBase constraints;
- ListBase nlastrips;
+ ListBase nlastrips; // XXX depreceated... old animation system
ListBase hooks;
ListBase particlesystem; /* particle systems */
@@ -302,6 +304,7 @@ extern Object workob;
#define OB_RENDER_DUPLI 4096
/* (short) ipoflag */
+ // XXX depreceated - old animation system crap
#define OB_DRAWKEY 1
#define OB_DRAWKEYSEL 2
#define OB_OFFS_OB 4
@@ -472,6 +475,7 @@ extern Object workob;
#define OB_SHAPE_TEMPLOCK 2
/* ob->nlaflag */
+ // XXX depreceated - old animation system
#define OB_NLA_OVERRIDE (1<<0)
#define OB_NLA_COLLAPSED (1<<1)
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 759a0f7a452..f9359ac61fa 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -38,6 +38,7 @@ extern "C" {
#include "DNA_listBase.h"
#include "DNA_scriptlink_types.h"
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
struct Radio;
struct Object;
@@ -523,6 +524,8 @@ typedef struct bStats {
typedef struct Scene {
ID id;
+ struct AnimData adt; /* animation data (must be immediately after id for utilities to use it) */
+
struct Object *camera;
struct World *world;
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 6e07336a4b1..c8cfc31cc3e 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -32,6 +32,7 @@
#define DNA_TEXTURE_TYPES_H
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
#include "DNA_image_types.h"
struct Ipo;
@@ -129,6 +130,7 @@ typedef struct EnvMap {
typedef struct Tex {
ID id;
+ struct AnimData adt; /* animation data (must be immediately after id for utilities to use it) */
float noisesize, turbul;
float bright, contrast, rfac, gfac, bfac;
@@ -167,7 +169,7 @@ typedef struct Tex {
struct ImageUser iuser;
struct bNodeTree *nodetree;
- struct Ipo *ipo;
+ struct Ipo *ipo; // XXX depreceated... old animation system
struct Image *ima;
struct PluginTex *plugin;
struct ColorBand *coba;
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index ab7e25190ad..14947ec3b2d 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -32,6 +32,7 @@
#define DNA_WORLD_TYPES_H
#include "DNA_ID.h"
+#include "DNA_anim_types.h"
#include "DNA_scriptlink_types.h"
struct Ipo;
@@ -48,6 +49,7 @@ struct MTex;
* data and modeling data. */
typedef struct World {
ID id;
+ struct AnimData adt; /* animation data (must be immediately after id for utilities to use it) */
short colormodel, totex;
short texact, mistype;
@@ -107,7 +109,7 @@ typedef struct World {
float *aosphere, *aotables;
- struct Ipo *ipo;
+ struct Ipo *ipo; // XXX depreceated... old animation system
struct MTex *mtex[18]; /* MAX_MTEX */
/* previews */
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index dd5aa518e24..17547c4eb1d 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -132,6 +132,7 @@ char *includefiles[] = {
// if you add files here, please add them at the end
// of makesdna.c (this file) as well
"DNA_windowmanager_types.h",
+ "DNA_anim_types.h",
// empty string to indicate end of includefiles
""
@@ -1153,4 +1154,5 @@ int main(int argc, char ** argv)
#include "DNA_cloth_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_windowmanager_types.h"
+#include "DNA_anim_types.h"
/* end of list */