|
Blender
V2.59
|
00001 /* 00002 * $Id: DNA_anim_types.h 35772 2011-03-25 07:34:44Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung 00021 * All rights reserved. 00022 * 00023 * Contributor(s): Joshua Leung (full recode) 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00028 #ifndef DNA_ANIM_TYPES_H 00029 #define DNA_ANIM_TYPES_H 00030 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 #include "DNA_ID.h" 00040 #include "DNA_listBase.h" 00041 #include "DNA_action_types.h" 00042 #include "DNA_curve_types.h" 00043 00044 /* ************************************************ */ 00045 /* F-Curve DataTypes */ 00046 00047 /* Modifiers -------------------------------------- */ 00048 00049 /* F-Curve Modifiers (fcm) 00050 * 00051 * These alter the way F-Curves behave, by altering the value that is returned 00052 * when evaluating the curve's data at some time (t). 00053 */ 00054 typedef struct FModifier { 00055 struct FModifier *next, *prev; 00056 00057 void *data; /* pointer to modifier data */ 00058 void *edata; /* pointer to temporary data used during evaluation */ 00059 00060 char name[64]; /* user-defined description for the modifier */ 00061 short type; /* type of f-curve modifier */ 00062 short flag; /* settings for the modifier */ 00063 00064 float influence; /* the amount that the modifier should influence the value */ 00065 } FModifier; 00066 00067 /* Types of F-Curve modifier 00068 * WARNING: order here is important! 00069 */ 00070 typedef enum eFModifier_Types { 00071 FMODIFIER_TYPE_NULL = 0, 00072 FMODIFIER_TYPE_GENERATOR, 00073 FMODIFIER_TYPE_FN_GENERATOR, 00074 FMODIFIER_TYPE_ENVELOPE, 00075 FMODIFIER_TYPE_CYCLES, 00076 FMODIFIER_TYPE_NOISE, 00077 FMODIFIER_TYPE_FILTER, /* unimplemented - for applying: fft, high/low pass filters, etc. */ 00078 FMODIFIER_TYPE_PYTHON, 00079 FMODIFIER_TYPE_LIMITS, 00080 FMODIFIER_TYPE_STEPPED, 00081 00082 /* NOTE: all new modifiers must be added above this line */ 00083 FMODIFIER_NUM_TYPES 00084 } eFModifier_Types; 00085 00086 /* F-Curve Modifier Settings */ 00087 typedef enum eFModifier_Flags { 00088 /* modifier is not able to be evaluated for some reason, and should be skipped (internal) */ 00089 FMODIFIER_FLAG_DISABLED = (1<<0), 00090 /* modifier's data is expanded (in UI) */ 00091 FMODIFIER_FLAG_EXPANDED = (1<<1), 00092 /* modifier is active one (in UI) for editing purposes */ 00093 FMODIFIER_FLAG_ACTIVE = (1<<2), 00094 /* user wants modifier to be skipped */ 00095 FMODIFIER_FLAG_MUTED = (1<<3) 00096 } eFModifier_Flags; 00097 00098 /* --- */ 00099 00100 /* Generator modifier data */ 00101 typedef struct FMod_Generator { 00102 /* general generator information */ 00103 float *coefficients; /* coefficients array */ 00104 unsigned int arraysize; /* size of the coefficients array */ 00105 00106 int poly_order; /* order of polynomial generated (i.e. 1 for linear, 2 for quadratic) */ 00107 int mode; /* which 'generator' to use eFMod_Generator_Modes */ 00108 00109 /* settings */ 00110 int flag; /* settings */ 00111 } FMod_Generator; 00112 00113 /* generator modes */ 00114 typedef enum eFMod_Generator_Modes { 00115 FCM_GENERATOR_POLYNOMIAL = 0, 00116 FCM_GENERATOR_POLYNOMIAL_FACTORISED 00117 } eFMod_Generator_Modes; 00118 00119 00120 /* generator flags 00121 * - shared by Generator and Function Generator 00122 */ 00123 typedef enum eFMod_Generator_Flags { 00124 /* generator works in conjunction with other modifiers (i.e. doesn't replace those before it) */ 00125 FCM_GENERATOR_ADDITIVE = (1<<0) 00126 } eFMod_Generator_Flags; 00127 00128 00129 /* 'Built-In Function' Generator modifier data 00130 * 00131 * This uses the general equation for equations: 00132 * y = amplitude * fn(phase_multiplier*x + phase_offset) + y_offset 00133 * 00134 * where amplitude, phase_multiplier/offset, y_offset are user-defined coefficients, 00135 * x is the evaluation 'time', and 'y' is the resultant value 00136 */ 00137 typedef struct FMod_FunctionGenerator { 00138 /* coefficients for general equation (as above) */ 00139 float amplitude; 00140 float phase_multiplier; 00141 float phase_offset; 00142 float value_offset; 00143 00144 /* flags */ 00145 int type; /* eFMod_Generator_Functions */ 00146 int flag; /* eFMod_Generator_flags */ 00147 } FMod_FunctionGenerator; 00148 00149 /* 'function' generator types */ 00150 typedef enum eFMod_Generator_Functions { 00151 FCM_GENERATOR_FN_SIN = 0, 00152 FCM_GENERATOR_FN_COS, 00153 FCM_GENERATOR_FN_TAN, 00154 FCM_GENERATOR_FN_SQRT, 00155 FCM_GENERATOR_FN_LN, 00156 FCM_GENERATOR_FN_SINC 00157 } eFMod_Generator_Functions; 00158 00159 00160 /* envelope modifier - envelope data */ 00161 typedef struct FCM_EnvelopeData { 00162 float min, max; /* min/max values for envelope at this point (absolute values) */ 00163 float time; /* time for that this sample-point occurs */ 00164 00165 short f1; /* settings for 'min' control point */ 00166 short f2; /* settings for 'max' control point */ 00167 } FCM_EnvelopeData; 00168 00169 /* envelope-like adjustment to values (for fade in/out) */ 00170 typedef struct FMod_Envelope { 00171 FCM_EnvelopeData *data; /* data-points defining envelope to apply (array) */ 00172 int totvert; /* number of envelope points */ 00173 00174 float midval; /* value that envelope's influence is centered around / based on */ 00175 float min, max; /* distances from 'middle-value' for 1:1 envelope influence */ 00176 } FMod_Envelope; 00177 00178 00179 /* cycling/repetition modifier data */ 00180 // TODO: we can only do complete cycles... 00181 typedef struct FMod_Cycles { 00182 short before_mode; /* extrapolation mode to use before first keyframe */ 00183 short after_mode; /* extrapolation mode to use after last keyframe */ 00184 short before_cycles; /* number of 'cycles' before first keyframe to do */ 00185 short after_cycles; /* number of 'cycles' after last keyframe to do */ 00186 } FMod_Cycles; 00187 00188 /* cycling modes */ 00189 typedef enum eFMod_Cycling_Modes { 00190 FCM_EXTRAPOLATE_NONE = 0, /* don't do anything */ 00191 FCM_EXTRAPOLATE_CYCLIC, /* repeat keyframe range as-is */ 00192 FCM_EXTRAPOLATE_CYCLIC_OFFSET, /* repeat keyframe range, but with offset based on gradient between values */ 00193 FCM_EXTRAPOLATE_MIRROR /* alternate between forward and reverse playback of keyframe range */ 00194 } eFMod_Cycling_Modes; 00195 00196 00197 /* Python-script modifier data */ 00198 typedef struct FMod_Python { 00199 struct Text *script; /* text buffer containing script to execute */ 00200 IDProperty *prop; /* ID-properties to provide 'custom' settings */ 00201 } FMod_Python; 00202 00203 00204 /* limits modifier data */ 00205 typedef struct FMod_Limits { 00206 rctf rect; /* rect defining the min/max values */ 00207 int flag; /* settings for limiting */ 00208 int pad; 00209 } FMod_Limits; 00210 00211 /* limiting flags */ 00212 typedef enum eFMod_Limit_Flags { 00213 FCM_LIMIT_XMIN = (1<<0), 00214 FCM_LIMIT_XMAX = (1<<1), 00215 FCM_LIMIT_YMIN = (1<<2), 00216 FCM_LIMIT_YMAX = (1<<3) 00217 } eFMod_Limit_Flags; 00218 00219 00220 /* noise modifier data */ 00221 typedef struct FMod_Noise { 00222 float size; 00223 float strength; 00224 float phase; 00225 float pad; 00226 00227 short depth; 00228 short modification; 00229 } FMod_Noise; 00230 00231 /* modification modes */ 00232 typedef enum eFMod_Noise_Modifications { 00233 FCM_NOISE_MODIF_REPLACE = 0, /* Modify existing curve, matching it's shape */ 00234 FCM_NOISE_MODIF_ADD, /* Add noise to the curve */ 00235 FCM_NOISE_MODIF_SUBTRACT, /* Subtract noise from the curve */ 00236 FCM_NOISE_MODIF_MULTIPLY /* Multiply the curve by noise */ 00237 } eFMod_Noise_Modifications; 00238 00239 00240 /* stepped modifier data */ 00241 typedef struct FMod_Stepped { 00242 float step_size; /* Number of frames each interpolated value should be held */ 00243 float offset; /* Reference frame number that stepping starts from */ 00244 00245 float start_frame; /* start frame of the frame range that modifier works in */ 00246 float end_frame; /* end frame of the frame range that modifier works in */ 00247 00248 int flag; /* various settings */ 00249 } FMod_Stepped; 00250 00251 /* stepped modifier range flags */ 00252 typedef enum eFMod_Stepped_Flags { 00253 FCM_STEPPED_NO_BEFORE = (1<<0), /* don't affect frames before the start frame */ 00254 FCM_STEPPED_NO_AFTER = (1<<1), /* don't affect frames after the end frame */ 00255 } eFMod_Stepped_Flags; 00256 00257 /* Drivers -------------------------------------- */ 00258 00259 /* Driver Target (dtar) 00260 * 00261 * Defines how to access a dependency needed for a driver variable. 00262 */ 00263 typedef struct DriverTarget { 00264 ID *id; /* ID-block which owns the target, no user count */ 00265 00266 char *rna_path; /* RNA path defining the setting to use (for DVAR_TYPE_SINGLE_PROP) */ 00267 00268 char pchan_name[32]; /* name of the posebone to use (for vars where DTAR_FLAG_STRUCT_REF is used) */ 00269 short transChan; /* transform channel index (for DVAR_TYPE_TRANSFORM_CHAN)*/ 00270 00271 short flag; /* flags for the validity of the target (NOTE: these get reset everytime the types change) */ 00272 int idtype; /* type of ID-block that this target can use */ 00273 } DriverTarget; 00274 00275 /* Driver Target flags */ 00276 typedef enum eDriverTarget_Flag { 00277 /* used for targets that use the pchan_name instead of RNA path 00278 * (i.e. rotation difference) 00279 */ 00280 DTAR_FLAG_STRUCT_REF = (1<<0), 00281 /* idtype can only be 'Object' */ 00282 DTAR_FLAG_ID_OB_ONLY = (1<<1), 00283 /* toggles localspace (where transforms are manually obtained) */ 00284 DTAR_FLAG_LOCALSPACE = (1<<2), 00285 } eDriverTarget_Flag; 00286 00287 /* Transform Channels for Driver Targets */ 00288 typedef enum eDriverTarget_TransformChannels { 00289 DTAR_TRANSCHAN_LOCX = 0, 00290 DTAR_TRANSCHAN_LOCY, 00291 DTAR_TRANSCHAN_LOCZ, 00292 DTAR_TRANSCHAN_ROTX, 00293 DTAR_TRANSCHAN_ROTY, 00294 DTAR_TRANSCHAN_ROTZ, 00295 DTAR_TRANSCHAN_SCALEX, 00296 DTAR_TRANSCHAN_SCALEY, 00297 DTAR_TRANSCHAN_SCALEZ, 00298 00299 MAX_DTAR_TRANSCHAN_TYPES 00300 } eDriverTarget_TransformChannels; 00301 00302 /* --- */ 00303 00304 /* maximum number of driver targets per variable */ 00305 #define MAX_DRIVER_TARGETS 8 00306 00307 00308 /* Driver Variable (dvar) 00309 * 00310 * A 'variable' for use as an input for the driver evaluation. 00311 * Defines a way of accessing some channel to use, that can be 00312 * referred to in the expression as a variable, thus simplifying 00313 * expressions and also Depsgraph building. 00314 */ 00315 typedef struct DriverVar { 00316 struct DriverVar *next, *prev; 00317 00318 char name[64]; /* name of the variable to use in py-expression (must be valid python identifier) */ 00319 00320 DriverTarget targets[8]; /* MAX_DRIVER_TARGETS, target slots */ 00321 short num_targets; /* number of targets actually used by this variable */ 00322 00323 short type; /* type of driver target (eDriverTarget_Types) */ 00324 float curval; /* result of previous evaluation */ 00325 } DriverVar; 00326 00327 /* Driver Variable Types */ 00328 typedef enum eDriverVar_Types { 00329 /* single RNA property */ 00330 DVAR_TYPE_SINGLE_PROP = 0, 00331 /* rotation difference (between 2 bones) */ 00332 DVAR_TYPE_ROT_DIFF, 00333 /* distance between objects/bones */ 00334 DVAR_TYPE_LOC_DIFF, 00335 /* 'final' transform for object/bones */ 00336 DVAR_TYPE_TRANSFORM_CHAN, 00337 00338 /* maximum number of variable types 00339 * NOTE: this must always be th last item in this list, 00340 * so add new types above this line 00341 */ 00342 MAX_DVAR_TYPES 00343 } eDriverVar_Types; 00344 00345 /* --- */ 00346 00347 /* Channel Driver (i.e. Drivers / Expressions) (driver) 00348 * 00349 * Channel Drivers are part of the dependency system, and are executed in addition to 00350 * normal user-defined animation. They take the animation result of some channel(s), and 00351 * use that (optionally combined with its own F-Curve for modification of results) to define 00352 * the value of some setting semi-procedurally. 00353 * 00354 * Drivers are stored as part of F-Curve data, so that the F-Curve's RNA-path settings (for storing 00355 * what setting the driver will affect). The order in which they are stored defines the order that they're 00356 * evaluated in. This order is set by the Depsgraph's sorting stuff. 00357 */ 00358 typedef struct ChannelDriver { 00359 ListBase variables; /* targets for this driver (i.e. list of DriverVar) */ 00360 00361 /* python expression to execute (may call functions defined in an accessory file) 00362 * which relates the target 'variables' in some way to yield a single usable value 00363 */ 00364 char expression[256]; /* expression to compile for evaluation */ 00365 void *expr_comp; /* PyObject - compiled expression, dont save this */ 00366 00367 float curval; /* result of previous evaluation */ 00368 float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting 00369 00370 /* general settings */ 00371 int type; /* type of driver */ 00372 int flag; /* settings of driver */ 00373 } ChannelDriver; 00374 00375 /* driver type */ 00376 typedef enum eDriver_Types { 00377 /* target values are averaged together */ 00378 DRIVER_TYPE_AVERAGE = 0, 00379 /* python expression/function relates targets */ 00380 DRIVER_TYPE_PYTHON, 00381 /* sum of all values */ 00382 DRIVER_TYPE_SUM, 00383 /* smallest value */ 00384 DRIVER_TYPE_MIN, 00385 /* largest value */ 00386 DRIVER_TYPE_MAX 00387 } eDriver_Types; 00388 00389 /* driver flags */ 00390 typedef enum eDriver_Flags { 00391 /* driver has invalid settings (internal flag) */ 00392 DRIVER_FLAG_INVALID = (1<<0), 00393 /* driver needs recalculation (set by depsgraph) */ 00394 DRIVER_FLAG_RECALC = (1<<1), 00395 /* driver does replace value, but overrides (for layering of animation over driver) */ 00396 // TODO: this needs to be implemented at some stage or left out... 00397 //DRIVER_FLAG_LAYERING = (1<<2), 00398 /* use when the expression needs to be recompiled */ 00399 DRIVER_FLAG_RECOMPILE = (1<<3), 00400 /* the names are cached so they dont need have python unicode versions created each time */ 00401 DRIVER_FLAG_RENAMEVAR = (1<<4), 00402 /* intermediate values of driver should be shown in the UI for debugging purposes */ 00403 DRIVER_FLAG_SHOWDEBUG = (1<<5) 00404 } eDriver_Flags; 00405 00406 /* F-Curves -------------------------------------- */ 00407 00408 /* FPoint (fpt) 00409 * 00410 * This is the bare-minimum data required storing motion samples. Should be more efficient 00411 * than using BPoints, which contain a lot of other unnecessary data... 00412 */ 00413 typedef struct FPoint { 00414 float vec[2]; /* time + value */ 00415 int flag; /* selection info */ 00416 int pad; 00417 } FPoint; 00418 00419 /* 'Function-Curve' - defines values over time for a given setting (fcu) */ 00420 typedef struct FCurve { 00421 struct FCurve *next, *prev; 00422 00423 /* group */ 00424 bActionGroup *grp; /* group that F-Curve belongs to */ 00425 00426 /* driver settings */ 00427 ChannelDriver *driver; /* only valid for drivers (i.e. stored in AnimData not Actions) */ 00428 /* evaluation settings */ 00429 ListBase modifiers; /* FCurve Modifiers */ 00430 00431 /* motion data */ 00432 BezTriple *bezt; /* user-editable keyframes (array) */ 00433 FPoint *fpt; /* 'baked/imported' motion samples (array) */ 00434 unsigned int totvert; /* total number of points which define the curve (i.e. size of arrays in FPoints) */ 00435 00436 /* value cache + settings */ 00437 float curval; /* value stored from last time curve was evaluated */ 00438 short flag; /* user-editable settings for this curve */ 00439 short extend; /* value-extending mode for this curve (does not cover */ 00440 00441 /* RNA - data link */ 00442 int array_index; /* if applicable, the index of the RNA-array item to get */ 00443 char *rna_path; /* RNA-path to resolve data-access */ 00444 00445 /* curve coloring (for editor) */ 00446 int color_mode; /* coloring method to use (eFCurve_Coloring) */ 00447 float color[3]; /* the last-color this curve took */ 00448 } FCurve; 00449 00450 00451 /* user-editable flags/settings */ 00452 typedef enum eFCurve_Flags { 00453 /* curve/keyframes are visible in editor */ 00454 FCURVE_VISIBLE = (1<<0), 00455 /* curve is selected for editing */ 00456 FCURVE_SELECTED = (1<<1), 00457 /* curve is active one */ 00458 FCURVE_ACTIVE = (1<<2), 00459 /* keyframes (beztriples) cannot be edited */ 00460 FCURVE_PROTECTED = (1<<3), 00461 /* fcurve will not be evaluated for the next round */ 00462 FCURVE_MUTED = (1<<4), 00463 /* fcurve uses 'auto-handles', which stay horizontal... */ 00464 FCURVE_AUTO_HANDLES = (1<<5), 00465 00466 /* skip evaluation, as RNA-path cannot be resolved (similar to muting, but cannot be set by user) */ 00467 FCURVE_DISABLED = (1<<10), 00468 /* curve can only have whole-number values (integer types) */ 00469 FCURVE_INT_VALUES = (1<<11), 00470 /* curve can only have certain discrete-number values (no interpolation at all, for enums/booleans) */ 00471 FCURVE_DISCRETE_VALUES = (1<<12), 00472 00473 /* temporary tag for editing */ 00474 FCURVE_TAGGED = (1<<15) 00475 } eFCurve_Flags; 00476 00477 /* extrapolation modes (only simple value 'extending') */ 00478 typedef enum eFCurve_Extend { 00479 FCURVE_EXTRAPOLATE_CONSTANT = 0, /* just extend min/max keyframe value */ 00480 FCURVE_EXTRAPOLATE_LINEAR /* just extend gradient of segment between first segment keyframes */ 00481 } eFCurve_Extend; 00482 00483 /* curve coloring modes */ 00484 typedef enum eFCurve_Coloring { 00485 FCURVE_COLOR_AUTO_RAINBOW = 0, /* automatically determine color using rainbow (calculated at drawtime) */ 00486 FCURVE_COLOR_AUTO_RGB, /* automatically determine color using XYZ (array index) <-> RGB */ 00487 FCURVE_COLOR_CUSTOM /* custom color */ 00488 } eFCurve_Coloring; 00489 00490 /* ************************************************ */ 00491 /* 'Action' Datatypes */ 00492 00493 /* NOTE: Although these are part of the Animation System, 00494 * they are not stored here... see DNA_action_types.h instead 00495 */ 00496 00497 00498 /* ************************************************ */ 00499 /* Animation Reuse - i.e. users of Actions */ 00500 00501 /* Retargetting ----------------------------------- */ 00502 00503 /* Retargetting Pair 00504 * 00505 * Defines what parts of the paths should be remapped from 'abc' to 'xyz'. 00506 * TODO: 00507 * - Regrex (possibly provided through PY, though having our own module might be faster) 00508 * would be important to have at some point. Current replacements are just simple 00509 * string matches... 00510 */ 00511 typedef struct AnimMapPair { 00512 char from[128]; /* part of path to bed replaced */ 00513 char to[128]; /* part of path to replace with */ 00514 } AnimMapPair; 00515 00516 /* Retargetting Information for Actions 00517 * 00518 * This should only be used if it is strictly necessary (i.e. user will need to explictly 00519 * add this when they find that some channels do not match, or motion is not going to right 00520 * places). When executing an action, this will be checked to see if it provides any useful 00521 * remaps for the given paths. 00522 * 00523 * NOTE: we currently don't store this in the Action itself, as that causes too many problems. 00524 */ 00525 // FIXME: will this be too clumsy or slow? If we're using RNA paths anyway, we'll have to accept 00526 // such consequences... 00527 typedef struct AnimMapper { 00528 struct AnimMapper *next, *prev; 00529 00530 bAction *target; /* target action */ 00531 ListBase mappings; /* remapping table (bAnimMapPair) */ 00532 } AnimMapper; 00533 00534 /* ************************************************ */ 00535 /* NLA - Non-Linear Animation */ 00536 00537 /* NLA Strips ------------------------------------- */ 00538 00539 /* NLA Strip (strip) 00540 * 00541 * A NLA Strip is a container for the reuse of Action data, defining parameters 00542 * to control the remapping of the Action data to some destination. 00543 */ 00544 typedef struct NlaStrip { 00545 struct NlaStrip *next, *prev; 00546 00547 ListBase strips; /* 'Child' strips (used for 'meta' strips) */ 00548 bAction *act; /* Action that is referenced by this strip (strip is 'user' of the action) */ 00549 AnimMapper *remap; /* Remapping info this strip (for tweaking correspondance of action with context) */ 00550 00551 ListBase fcurves; /* F-Curves for controlling this strip's influence and timing */ // TODO: move out? 00552 ListBase modifiers; /* F-Curve modifiers to be applied to the entire strip's referenced F-Curves */ 00553 00554 char name[64]; /* User-Visible Identifier for Strip */ 00555 00556 float influence; /* Influence of strip */ 00557 float strip_time; /* Current 'time' within action being used (automatically evaluated, but can be overridden) */ 00558 00559 float start, end; /* extents of the strip */ 00560 float actstart, actend; /* range of the action to use */ 00561 00562 float repeat; /* The number of times to repeat the action range (only when no F-Curves) */ 00563 float scale; /* The amount the action range is scaled by (only when no F-Curves) */ 00564 00565 float blendin, blendout; /* strip blending length (only used when there are no F-Curves) */ 00566 short blendmode; /* strip blending mode (layer-based mixing) */ 00567 00568 short extendmode; /* strip extrapolation mode (time-based mixing) */ 00569 short pad1; 00570 00571 short type; /* type of NLA strip */ 00572 00573 int flag; /* settings */ 00574 int pad2; 00575 } NlaStrip; 00576 00577 /* NLA Strip Blending Mode */ 00578 typedef enum eNlaStrip_Blend_Mode { 00579 NLASTRIP_MODE_REPLACE = 0, 00580 NLASTRIP_MODE_ADD, 00581 NLASTRIP_MODE_SUBTRACT, 00582 NLASTRIP_MODE_MULTIPLY 00583 } eNlaStrip_Blend_Mode; 00584 00585 /* NLA Strip Extrpolation Mode */ 00586 typedef enum eNlaStrip_Extrapolate_Mode { 00587 /* extend before first frame if no previous strips in track, and always hold+extend last frame */ 00588 NLASTRIP_EXTEND_HOLD = 0, 00589 /* only hold+extend last frame */ 00590 NLASTRIP_EXTEND_HOLD_FORWARD, 00591 /* don't contribute at all */ 00592 NLASTRIP_EXTEND_NOTHING 00593 } eNlaStrip_Extrapolate_Mode; 00594 00595 /* NLA Strip Settings */ 00596 typedef enum eNlaStrip_Flag { 00597 /* UI selection flags */ 00598 /* NLA strip is the active one in the track (also indicates if strip is being tweaked) */ 00599 NLASTRIP_FLAG_ACTIVE = (1<<0), 00600 /* NLA strip is selected for editing */ 00601 NLASTRIP_FLAG_SELECT = (1<<1), 00602 // NLASTRIP_FLAG_SELECT_L = (1<<2), // left handle selected 00603 // NLASTRIP_FLAG_SELECT_R = (1<<3), // right handle selected 00604 /* NLA strip uses the same action that the action being tweaked uses (not set for the twaking one though) */ 00605 NLASTRIP_FLAG_TWEAKUSER = (1<<4), 00606 00607 /* controls driven by local F-Curves */ 00608 /* strip influence is controlled by local F-Curve */ 00609 NLASTRIP_FLAG_USR_INFLUENCE = (1<<5), 00610 NLASTRIP_FLAG_USR_TIME = (1<<6), 00611 NLASTRIP_FLAG_USR_TIME_CYCLIC = (1<<7), 00612 00613 /* NLA strip length is synced to the length of the referenced action */ 00614 NLASTRIP_FLAG_SYNC_LENGTH = (1<<9), 00615 00616 /* playback flags (may be overriden by F-Curves) */ 00617 /* NLA strip blendin/out values are set automatically based on overlaps */ 00618 NLASTRIP_FLAG_AUTO_BLENDS = (1<<10), 00619 /* NLA strip is played back in reverse order */ 00620 NLASTRIP_FLAG_REVERSE = (1<<11), 00621 /* NLA strip is muted (i.e. doesn't contribute in any way) */ 00622 NLASTRIP_FLAG_MUTED = (1<<12), 00623 /* NLA Strip is played back in 'ping-pong' style */ 00624 NLASTRIP_FLAG_MIRROR = (1<<13), 00625 00626 /* temporary editing flags */ 00627 /* NLA-Strip is really just a temporary meta used to facilitate easier transform code */ 00628 NLASTRIP_FLAG_TEMP_META = (1<<30), 00629 NLASTRIP_FLAG_EDIT_TOUCHED = (1<<31) 00630 } eNlaStrip_Flag; 00631 00632 /* NLA Strip Type */ 00633 typedef enum eNlaStrip_Type { 00634 /* 'clip' - references an Action */ 00635 NLASTRIP_TYPE_CLIP = 0, 00636 /* 'transition' - blends between the adjacent strips */ 00637 NLASTRIP_TYPE_TRANSITION, 00638 /* 'meta' - a strip which acts as a container for a few others */ 00639 NLASTRIP_TYPE_META 00640 } eNlaStrip_Type; 00641 00642 /* NLA Tracks ------------------------------------- */ 00643 00644 /* NLA Track (nlt) 00645 * 00646 * A track groups a bunch of 'strips', which should form a continous set of 00647 * motion, on top of which other such groups can be layered. This should allow 00648 * for animators to work in a non-destructive manner, layering tweaks, etc. over 00649 * 'rough' blocks of their work. 00650 */ 00651 typedef struct NlaTrack { 00652 struct NlaTrack *next, *prev; 00653 00654 ListBase strips; /* bActionStrips in this track */ 00655 00656 int flag; /* settings for this track */ 00657 int index; /* index of the track in the stack (NOTE: not really useful, but we need a pad var anyways!) */ 00658 00659 char name[64]; /* short user-description of this track */ 00660 } NlaTrack; 00661 00662 /* settings for track */ 00663 typedef enum eNlaTrack_Flag { 00664 /* track is the one that settings can be modified on, also indicates if track is being 'tweaked' */ 00665 NLATRACK_ACTIVE = (1<<0), 00666 /* track is selected in UI for relevant editing operations */ 00667 NLATRACK_SELECTED = (1<<1), 00668 /* track is not evaluated */ 00669 NLATRACK_MUTED = (1<<2), 00670 /* track is the only one evaluated (must be used in conjunction with adt->flag) */ 00671 NLATRACK_SOLO = (1<<3), 00672 /* track's settings (and strips) cannot be edited (to guard against unwanted changes) */ 00673 NLATRACK_PROTECTED = (1<<4), 00674 00675 /* track is not allowed to execute, usually as result of tweaking being enabled (internal flag) */ 00676 NLATRACK_DISABLED = (1<<10) 00677 } eNlaTrack_Flag; 00678 00679 00680 /* ************************************ */ 00681 /* KeyingSet Datatypes */ 00682 00683 /* Path for use in KeyingSet definitions (ksp) 00684 * 00685 * Paths may be either specific (specifying the exact sub-ID 00686 * dynamic data-block - such as PoseChannels - to act upon, ala 00687 * Maya's 'Character Sets' and XSI's 'Marking Sets'), or they may 00688 * be generic (using various placeholder template tags that will be 00689 * replaced with appropriate information from the context). 00690 */ 00691 typedef struct KS_Path { 00692 struct KS_Path *next, *prev; 00693 00694 ID *id; /* ID block that keyframes are for */ 00695 char group[64]; /* name of the group to add to */ 00696 00697 int idtype; /* ID-type that path can be used on */ 00698 00699 short groupmode; /* group naming (eKSP_Grouping) */ 00700 short pad; 00701 00702 char *rna_path; /* dynamically (or statically in the case of predefined sets) path */ 00703 int array_index; /* index that path affects */ 00704 00705 short flag; /* various settings, etc. */ 00706 short keyingflag; /* settings to supply insertkey() with */ 00707 } KS_Path; 00708 00709 /* KS_Path->flag */ 00710 typedef enum eKSP_Settings { 00711 /* entire array (not just the specified index) gets keyframed */ 00712 KSP_FLAG_WHOLE_ARRAY = (1<<0) 00713 } eKSP_Settings; 00714 00715 /* KS_Path->groupmode */ 00716 typedef enum eKSP_Grouping { 00717 /* path should be grouped using group name stored in path */ 00718 KSP_GROUP_NAMED = 0, 00719 /* path should not be grouped at all */ 00720 KSP_GROUP_NONE, 00721 /* path should be grouped using KeyingSet's name */ 00722 KSP_GROUP_KSNAME, 00723 /* path should be grouped using name of inner-most context item from templates 00724 * - this is most useful for relative KeyingSets only 00725 */ 00726 KSP_GROUP_TEMPLATE_ITEM 00727 } eKSP_Grouping; 00728 00729 /* ---------------- */ 00730 00731 /* KeyingSet definition (ks) 00732 * 00733 * A KeyingSet defines a group of properties that should 00734 * be keyframed together, providing a convenient way for animators 00735 * to insert keyframes without resorting to Auto-Keyframing. 00736 * 00737 * A few 'generic' (non-absolute and dependant on templates) KeyingSets 00738 * are defined 'built-in' to facilitate easy animating for the casual 00739 * animator without the need to add extra steps to the rigging process. 00740 */ 00741 typedef struct KeyingSet { 00742 struct KeyingSet *next, *prev; 00743 00744 ListBase paths; /* (KS_Path) paths to keyframe to */ 00745 00746 char name[64]; /* user-viewable name for KeyingSet (for menus, etc.) */ 00747 char typeinfo[64]; /* name of the typeinfo data used for the relative paths */ 00748 00749 short flag; /* settings for KeyingSet */ 00750 short keyingflag; /* settings to supply insertkey() with */ 00751 00752 int active_path; /* index of the active path */ 00753 } KeyingSet; 00754 00755 /* KeyingSet settings */ 00756 typedef enum eKS_Settings { 00757 /* keyingset cannot be removed (and doesn't need to be freed) */ 00758 KEYINGSET_BUILTIN = (1<<0), 00759 /* keyingset does not depend on context info (i.e. paths are absolute) */ 00760 KEYINGSET_ABSOLUTE = (1<<1) 00761 } eKS_Settings; 00762 00763 /* Flags for use by keyframe creation/deletion calls */ 00764 typedef enum eInsertKeyFlags { 00765 INSERTKEY_NEEDED = (1<<0), /* only insert keyframes where they're needed */ 00766 INSERTKEY_MATRIX = (1<<1), /* insert 'visual' keyframes where possible/needed */ 00767 INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */ 00768 INSERTKEY_FASTR = (1<<3), /* don't realloc mem (or increase count, as array has already been set out) */ 00769 INSERTKEY_REPLACE = (1<<4), /* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */ 00770 INSERTKEY_XYZ2RGB = (1<<5) /* transform F-Curves should have XYZ->RGB color mode */ 00771 } eInsertKeyFlags; 00772 00773 /* ************************************************ */ 00774 /* Animation Data */ 00775 00776 /* AnimOverride ------------------------------------- */ 00777 00778 /* Animation Override (aor) 00779 * 00780 * This is used to as temporary storage of values which have been changed by the user, but not 00781 * yet keyframed (thus, would get overwritten by the animation system before the user had a chance 00782 * to see the changes that were made). 00783 * 00784 * It is probably not needed for overriding keyframed values in most cases, as those will only get evaluated 00785 * on frame-change now. That situation may change in future. 00786 */ 00787 typedef struct AnimOverride { 00788 struct AnimOverride *next, *prev; 00789 00790 char *rna_path; /* RNA-path to use to resolve data-access */ 00791 int array_index; /* if applicable, the index of the RNA-array item to get */ 00792 00793 float value; /* value to override setting with */ 00794 } AnimOverride; 00795 00796 /* AnimData ------------------------------------- */ 00797 00798 /* Animation data for some ID block (adt) 00799 * 00800 * This block of data is used to provide all of the necessary animation data for a datablock. 00801 * Currently, this data will not be reusable, as there shouldn't be any need to do so. 00802 * 00803 * This information should be made available for most if not all ID-blocks, which should 00804 * enable all of its settings to be animatable locally. Animation from 'higher-up' ID-AnimData 00805 * blocks may override local settings. 00806 * 00807 * This datablock should be placed immediately after the ID block where it is used, so that 00808 * the code which retrieves this data can do so in an easier manner. See blenkernel/intern/anim_sys.c for details. 00809 */ 00810 typedef struct AnimData { 00811 /* active action - acts as the 'tweaking track' for the NLA */ 00812 bAction *action; 00813 /* temp-storage for the 'real' active action (i.e. the one used before the tweaking-action 00814 * took over to be edited in the Animation Editors) 00815 */ 00816 bAction *tmpact; 00817 /* remapping-info for active action - should only be used if needed 00818 * (for 'foreign' actions that aren't working correctly) 00819 */ 00820 AnimMapper *remap; 00821 00822 /* nla-tracks */ 00823 ListBase nla_tracks; 00824 /* active NLA-strip (only set/used during tweaking, so no need to worry about dangling pointers) */ 00825 NlaStrip *actstrip; 00826 00827 /* 'drivers' for this ID-block's settings - FCurves, but are completely 00828 * separate from those for animation data 00829 */ 00830 ListBase drivers; /* standard user-created Drivers/Expressions (used as part of a rig) */ 00831 ListBase overrides; /* temp storage (AnimOverride) of values for settings that are animated (but the value hasn't been keyframed) */ 00832 00833 /* settings for animation evaluation */ 00834 int flag; /* user-defined settings */ 00835 int recalc; /* depsgraph recalculation flags */ 00836 00837 /* settings for active action evaluation (based on NLA strip settings) */ 00838 short act_blendmode; /* accumulation mode for active action */ 00839 short act_extendmode; /* extrapolation mode for active action */ 00840 float act_influence; /* influence for active action */ 00841 } AnimData; 00842 00843 /* Animation Data settings (mostly for NLA) */ 00844 typedef enum eAnimData_Flag { 00845 /* only evaluate a single track in the NLA */ 00846 ADT_NLA_SOLO_TRACK = (1<<0), 00847 /* don't use NLA */ 00848 ADT_NLA_EVAL_OFF = (1<<1), 00849 /* NLA is being 'tweaked' (i.e. in EditMode) */ 00850 ADT_NLA_EDIT_ON = (1<<2), 00851 /* active Action for 'tweaking' does not have mapping applied for editing */ 00852 ADT_NLA_EDIT_NOMAP = (1<<3), 00853 /* NLA-Strip F-Curves are expanded in UI */ 00854 ADT_NLA_SKEYS_COLLAPSED = (1<<4), 00855 00856 /* drivers expanded in UI */ 00857 ADT_DRIVERS_COLLAPSED = (1<<10), 00858 /* don't execute drivers */ 00859 ADT_DRIVERS_DISABLED = (1<<11), 00860 00861 /* AnimData block is selected in UI */ 00862 ADT_UI_SELECTED = (1<<14), 00863 /* AnimData block is active in UI */ 00864 ADT_UI_ACTIVE = (1<<15), 00865 00866 /* F-Curves from this AnimData block are not visible in the Graph Editor */ 00867 ADT_CURVES_NOT_VISIBLE = (1<<16) 00868 } eAnimData_Flag; 00869 00870 /* Animation Data recalculation settings (to be set by depsgraph) */ 00871 typedef enum eAnimData_Recalc { 00872 ADT_RECALC_DRIVERS = (1<<0), 00873 ADT_RECALC_ANIM = (1<<1), 00874 ADT_RECALC_ALL = (ADT_RECALC_DRIVERS|ADT_RECALC_ANIM) 00875 } eAnimData_Recalc; 00876 00877 /* Base Struct for Anim ------------------------------------- */ 00878 00879 /* Used for BKE_animdata_from_id() 00880 * All ID-datablocks which have their own 'local' AnimData 00881 * should have the same arrangement in their structs. 00882 */ 00883 typedef struct IdAdtTemplate { 00884 ID id; 00885 AnimData *adt; 00886 } IdAdtTemplate; 00887 00888 /* ************************************************ */ 00889 00890 #ifdef __cplusplus 00891 }; 00892 #endif 00893 00894 #endif /* DNA_ANIM_TYPES_H */