Blender  V2.59
ED_anim_api.h
Go to the documentation of this file.
00001 /*
00002  * $Id: ED_anim_api.h 36312 2011-04-24 10:51:45Z 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) 2008 Blender Foundation.
00021  * All rights reserved.
00022  *
00023  * 
00024  * Contributor(s): Joshua Leung
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00033 #ifndef ED_ANIM_API_H
00034 #define ED_ANIM_API_H
00035 
00036 struct ID;
00037 struct ListBase;
00038 struct AnimData;
00039 
00040 struct bContext;
00041 struct wmKeyConfig;
00042 struct ReportList;
00043 struct ScrArea;
00044 struct ARegion;
00045 struct View2D;
00046 
00047 struct Scene;
00048 struct Object;
00049 
00050 struct bDopeSheet;
00051 
00052 struct bActionGroup;
00053 struct FCurve;
00054 struct FModifier;
00055 
00056 struct uiBlock;
00057 struct uiLayout;
00058 
00059 /* ************************************************ */
00060 /* ANIMATION CHANNEL FILTERING */
00061 /* anim_filter.c */
00062 
00063 /* --------------- Context --------------------- */
00064 
00065 /* This struct defines a structure used for animation-specific 
00066  * 'context' information
00067  */
00068 typedef struct bAnimContext {
00069         void *data;                             /* data to be filtered for use in animation editor */
00070         short datatype;                 /* type of data eAnimCont_Types */
00071         
00072         short mode;                             /* editor->mode */
00073         short spacetype;                /* sa->spacetype */
00074         short regiontype;               /* active region -> type (channels or main) */
00075         struct ScrArea *sa;             /* editor */ 
00076         struct ARegion *ar;             /* region within editor */
00077         
00078         struct Scene *scene;    /* active scene */
00079         struct Object *obact;   /* active object */
00080         ListBase *markers;              /* active set of markers */
00081         
00082         struct ReportList *reports;     /* pointer to current reports list */
00083 } bAnimContext;
00084 
00085 /* Main Data container types */
00086 // XXX was ACTCONT_*
00087 typedef enum eAnimCont_Types {
00088         ANIMCONT_NONE = 0,              /* invalid or no data */
00089         ANIMCONT_ACTION,                /* action (bAction) */
00090         ANIMCONT_SHAPEKEY,              /* shapekey (Key) */
00091         ANIMCONT_GPENCIL,               /* grease pencil (screen) */
00092         ANIMCONT_DOPESHEET,             /* dopesheet (bDopesheet) */
00093         ANIMCONT_FCURVES,               /* animation F-Curves (bDopesheet) */
00094         ANIMCONT_DRIVERS,               /* drivers (bDopesheet) */
00095         ANIMCONT_NLA                    /* nla (bDopesheet) */
00096 } eAnimCont_Types;
00097 
00098 /* --------------- Channels -------------------- */
00099 
00100 /* This struct defines a structure used for quick and uniform access for 
00101  * channels of animation data
00102  */
00103 typedef struct bAnimListElem {
00104         struct bAnimListElem *next, *prev;
00105         
00106         void    *data;                  /* source data this elem represents */
00107         int     type;                   /* one of the ANIMTYPE_* values */
00108         int             flag;                   /* copy of elem's flags for quick access */
00109         int     index;                  /* for un-named data, the index of the data in it's collection */
00110         
00111         short   elemFlag;               /* flags for the list elem instance (not the data it represents) */
00112         
00113         short   datatype;               /* type of motion data to expect */
00114         void    *key_data;              /* motion data - mostly F-Curves, but can be other types too */
00115         
00116         
00117         struct ID *id;                  /* ID block that channel is attached to */
00118         struct AnimData *adt;   /* source of the animation data attached to ID block (for convenience) */
00119         
00120         void    *owner;                 /* group or channel which acts as this channel's owner */
00121         short   ownertype;              /* type of owner */
00122 } bAnimListElem;
00123 
00124 
00125 /* Some types for easier type-testing 
00126  * NOTE: need to keep the order of these synchronised with the channels define code
00127  *              which is used for drawing and handling channel lists for 
00128  */
00129 // XXX was ACTTYPE_*
00130 typedef enum eAnim_ChannelType {
00131         ANIMTYPE_NONE= 0,
00132         ANIMTYPE_ANIMDATA,
00133         ANIMTYPE_SPECIALDATA,
00134         
00135         ANIMTYPE_SUMMARY,
00136         
00137         ANIMTYPE_SCENE,
00138         ANIMTYPE_OBJECT,
00139         ANIMTYPE_GROUP,
00140         ANIMTYPE_FCURVE,
00141         
00142         ANIMTYPE_FILLACTD,
00143         ANIMTYPE_FILLDRIVERS,
00144         ANIMTYPE_FILLMATD,
00145         ANIMTYPE_FILLPARTD,
00146         ANIMTYPE_FILLTEXD,
00147         
00148         ANIMTYPE_DSMAT,
00149         ANIMTYPE_DSLAM,
00150         ANIMTYPE_DSCAM,
00151         ANIMTYPE_DSCUR,
00152         ANIMTYPE_DSSKEY,
00153         ANIMTYPE_DSWOR,
00154         ANIMTYPE_DSNTREE,
00155         ANIMTYPE_DSPART,
00156         ANIMTYPE_DSMBALL,
00157         ANIMTYPE_DSARM,
00158         ANIMTYPE_DSMESH,
00159         ANIMTYPE_DSTEX,
00160         ANIMTYPE_DSLAT,
00161         
00162         ANIMTYPE_SHAPEKEY,
00163         
00164         ANIMTYPE_GPDATABLOCK,
00165         ANIMTYPE_GPLAYER,
00166         
00167         ANIMTYPE_NLATRACK,
00168         ANIMTYPE_NLAACTION,
00169         
00170                 /* always as last item, the total number of channel types... */
00171         ANIMTYPE_NUM_TYPES
00172 } eAnim_ChannelType;
00173 
00174 /* types of keyframe data in bAnimListElem */
00175 typedef enum eAnim_KeyType {
00176         ALE_NONE = 0,           /* no keyframe data */
00177         ALE_FCURVE,                     /* F-Curve */
00178         ALE_GPFRAME,            /* Grease Pencil Frames */
00179         ALE_NLASTRIP,           /* NLA Strips */
00180         
00181         ALE_ALL,                        /* All channels summary */
00182         ALE_SCE,                        /* Scene summary */
00183         ALE_OB,                         /* Object summary */
00184         ALE_ACT,                        /* Action summary */
00185         ALE_GROUP                       /* Action Group summary */
00186 } eAnim_KeyType;
00187 
00188 /* ----------------- Filtering -------------------- */
00189 
00190 /* filtering flags  - under what circumstances should a channel be added */
00191 // XXX was ACTFILTER_*
00192 typedef enum eAnimFilter_Flags {
00193         ANIMFILTER_VISIBLE              = (1<<0),       /* should channels be visible (in terms of hierarchy only) */
00194         ANIMFILTER_SEL                  = (1<<1),       /* should channels be selected */
00195         ANIMFILTER_UNSEL                = (1<<2),       /* should channels be NOT selected */
00196         ANIMFILTER_FOREDIT              = (1<<3),       /* does editable status matter */
00197         ANIMFILTER_CURVESONLY   = (1<<4),       /* don't include summary-channels, etc. */
00198         ANIMFILTER_CHANNELS             = (1<<5),       /* make list for interface drawing */
00199         ANIMFILTER_ACTGROUPED   = (1<<6),       /* belongs to the active actiongroup */
00200         ANIMFILTER_CURVEVISIBLE = (1<<7),       /* F-Curve is visible for editing/viewing in Graph Editor */
00201         ANIMFILTER_ACTIVE               = (1<<8),       /* channel should be 'active' */
00202         ANIMFILTER_ANIMDATA             = (1<<9),       /* only return the underlying AnimData blocks (not the tracks, etc.) data comes from */
00203         ANIMFILTER_NLATRACKS    = (1<<10),      /* only include NLA-tracks */
00204         ANIMFILTER_SELEDIT              = (1<<11),      /* link editability with selected status */
00205         ANIMFILTER_NODUPLIS             = (1<<12),      /* duplicate entries for animation data attached to multi-user blocks must not occur */
00206         
00207         /* all filters - the power inside the bracket must be the last power for left-shifts + 1 */
00208         ANIMFILTER_ALLFILTERS   = ((1<<12) - 1)
00209 } eAnimFilter_Flags;
00210 
00211 
00212 /* ---------- Flag Checking Macros ------------ */
00213 // xxx check on all of these flags again...
00214 
00215 /* Dopesheet only */
00216         /* 'Scene' channels */
00217 #define SEL_SCEC(sce) ((sce->flag & SCE_DS_SELECTED))
00218 #define EXPANDED_SCEC(sce) ((sce->flag & SCE_DS_COLLAPSED)==0)
00219         /* 'Sub-Scene' channels (flags stored in Data block) */
00220 #define FILTER_WOR_SCED(wo) ((wo->flag & WO_DS_EXPAND))
00221 #define FILTER_NTREE_SCED(ntree) ((ntree->flag & NTREE_DS_EXPAND))
00222         /* 'Object' channels */
00223 #define SEL_OBJC(base) ((base->flag & SELECT))
00224 #define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED)==0)
00225         /* 'Sub-object' channels (flags stored in Object block) */
00226 #define FILTER_MAT_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWMATS))
00227 #define FILTER_PART_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWPARTS))
00228         /* 'Sub-object' channels (flags stored in Data block) */
00229 #define FILTER_SKE_OBJD(key) ((key->flag & KEY_DS_EXPAND))
00230 #define FILTER_MAT_OBJD(ma) ((ma->flag & MA_DS_EXPAND))
00231 #define FILTER_LAM_OBJD(la) ((la->flag & LA_DS_EXPAND))
00232 #define FILTER_CAM_OBJD(ca) ((ca->flag & CAM_DS_EXPAND))
00233 #define FILTER_CUR_OBJD(cu) ((cu->flag & CU_DS_EXPAND))
00234 #define FILTER_PART_OBJD(part) ((part->flag & PART_DS_EXPAND))
00235 #define FILTER_MBALL_OBJD(mb) ((mb->flag2 & MB_DS_EXPAND))
00236 #define FILTER_ARM_OBJD(arm) ((arm->flag & ARM_DS_EXPAND))
00237 #define FILTER_MESH_OBJD(me) ((me->flag & ME_DS_EXPAND))
00238 #define FILTER_LATTICE_OBJD(lt) ((lt->flag & LT_DS_EXPAND))
00239 
00240         /* 'Sub-object/Action' channels (flags stored in Action) */
00241 #define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED))
00242 #define EXPANDED_ACTC(actc) ((actc->flag & ACT_COLLAPSED)==0)
00243         /* 'Sub-AnimData' channels */
00244 #define EXPANDED_DRVD(adt) ((adt->flag & ADT_DRIVERS_COLLAPSED)==0)
00245         /* Texture expanders */
00246 #define FILTER_TEX_MATC(ma) ((ma->flag & MA_DS_SHOW_TEXS))
00247 #define FILTER_TEX_LAMC(la) ((la->flag & LA_DS_SHOW_TEXS))
00248 #define FILTER_TEX_WORC(wa) ((wo->flag & WO_DS_SHOW_TEXS))
00249 #define FILTER_TEX_DATA(tex) ((tex->flag & TEX_DS_EXPAND))
00250 
00251 /* Actions (also used for Dopesheet) */
00252         /* Action Channel Group */
00253 #define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0)
00254 #define EXPANDED_AGRP(ac, agrp) \
00255         ( ( ((ac)->spacetype == SPACE_IPO) && (agrp->flag & AGRP_EXPANDED_G) ) || \
00256           ( ((ac)->spacetype != SPACE_IPO) && (agrp->flag & AGRP_EXPANDED)   ) )
00257 #define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
00258         /* F-Curve Channels */
00259 #define EDITABLE_FCU(fcu) ((fcu->flag & FCURVE_PROTECTED)==0)
00260 #define SEL_FCU(fcu) (fcu->flag & (FCURVE_ACTIVE|FCURVE_SELECTED))
00261 
00262 /* ShapeKey mode only */
00263 #define EDITABLE_SHAPEKEY(kb) ((kb->flag & KEYBLOCK_LOCKED)==0)
00264 #define SEL_SHAPEKEY(kb) (kb->flag & KEYBLOCK_SEL)
00265 
00266 /* Grease Pencil only */
00267         /* Grease Pencil datablock settings */
00268 #define EXPANDED_GPD(gpd) (gpd->flag & GP_DATA_EXPAND) 
00269         /* Grease Pencil Layer settings */
00270 #define EDITABLE_GPL(gpl) ((gpl->flag & GP_LAYER_LOCKED)==0)
00271 #define SEL_GPL(gpl) ((gpl->flag & GP_LAYER_ACTIVE) || (gpl->flag & GP_LAYER_SELECT))
00272 
00273 /* NLA only */
00274 #define SEL_NLT(nlt) (nlt->flag & NLATRACK_SELECTED)
00275 #define EDITABLE_NLT(nlt) ((nlt->flag & NLATRACK_PROTECTED)==0)
00276 
00277 /* -------------- Channel Defines -------------- */
00278 
00279 /* channel heights */
00280 #define ACHANNEL_FIRST                  -16
00281 #define ACHANNEL_HEIGHT                 16
00282 #define ACHANNEL_HEIGHT_HALF    8
00283 #define ACHANNEL_SKIP                   2
00284 #define ACHANNEL_STEP                   (ACHANNEL_HEIGHT + ACHANNEL_SKIP)
00285 
00286 /* channel widths */
00287 #define ACHANNEL_NAMEWIDTH              200
00288 
00289 /* channel toggle-buttons */
00290 #define ACHANNEL_BUTTON_WIDTH   16
00291 
00292 
00293 /* -------------- NLA Channel Defines -------------- */
00294 
00295 /* NLA channel heights */
00296 #define NLACHANNEL_FIRST                        -16
00297 #define NLACHANNEL_HEIGHT                       24
00298 #define NLACHANNEL_HEIGHT_HALF  12
00299 #define NLACHANNEL_SKIP                 2
00300 #define NLACHANNEL_STEP                 (NLACHANNEL_HEIGHT + NLACHANNEL_SKIP)
00301 
00302 /* channel widths */
00303 #define NLACHANNEL_NAMEWIDTH            200
00304 
00305 /* channel toggle-buttons */
00306 #define NLACHANNEL_BUTTON_WIDTH 16
00307 
00308 /* ---------------- API  -------------------- */
00309 
00310 /* Obtain list of filtered Animation channels to operate on.
00311  * Returns the number of channels in the list
00312  */
00313 int ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype);
00314 
00315 /* Obtain current anim-data context from Blender Context info.
00316  * Returns whether the operation was successful. 
00317  */
00318 short ANIM_animdata_get_context(const struct bContext *C, bAnimContext *ac);
00319 
00320 /* Obtain current anim-data context (from Animation Editor) given 
00321  * that Blender Context info has already been set. 
00322  * Returns whether the operation was successful.
00323  */
00324 short ANIM_animdata_context_getdata(bAnimContext *ac);
00325 
00326 /* ************************************************ */
00327 /* ANIMATION CHANNELS LIST */
00328 /* anim_channels_*.c */
00329 
00330 /* ------------------------ Drawing TypeInfo -------------------------- */
00331 
00332 /* flag-setting behaviour */
00333 typedef enum eAnimChannels_SetFlag {
00334         ACHANNEL_SETFLAG_CLEAR = 0,             /* turn off */
00335         ACHANNEL_SETFLAG_ADD,                   /* turn on */
00336         ACHANNEL_SETFLAG_INVERT,                /* on->off, off->on */
00337         ACHANNEL_SETFLAG_TOGGLE                 /* some on -> all off // all on */
00338 } eAnimChannels_SetFlag;
00339 
00340 /* types of settings for AnimChannels */
00341 typedef enum eAnimChannel_Settings {
00342         ACHANNEL_SETTING_SELECT = 0,
00343         ACHANNEL_SETTING_PROTECT,                       // warning: for drawing UI's, need to check if this is off (maybe inverse this later)
00344         ACHANNEL_SETTING_MUTE,
00345         ACHANNEL_SETTING_EXPAND,
00346         ACHANNEL_SETTING_VISIBLE,                       /* only for Graph Editor */
00347         ACHANNEL_SETTING_SOLO                           /* only for NLA Tracks */
00348 } eAnimChannel_Settings;
00349 
00350 
00351 /* Drawing, mouse handling, and flag setting behaviour... */
00352 typedef struct bAnimChannelType {
00353         /* type data */
00354                 /* name of the channel type, for debugging */
00355         const char *channel_type_name;
00356         
00357         /* drawing */
00358                 /* get RGB color that is used to draw the majority of the backdrop */
00359         void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float *color);
00360                 /* draw backdrop strip for channel */
00361         void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
00362                 /* get depth of indention (relative to the depth channel is nested at) */
00363         short (*get_indent_level)(bAnimContext *ac, bAnimListElem *ale);
00364                 /* get offset in pixels for the start of the channel (in addition to the indent depth) */
00365         short (*get_offset)(bAnimContext *ac, bAnimListElem *ale);
00366         
00367         /* get name (for channel lists) */
00368         void (*name)(bAnimListElem *ale, char *name);
00369         /* get icon (for channel lists) */
00370         int (*icon)(bAnimListElem *ale);
00371         
00372         /* settings */
00373                 /* check if the given setting is valid in the current context */
00374         short (*has_setting)(bAnimContext *ac, bAnimListElem *ale, int setting);
00375                 /* get the flag used for this setting */
00376         int (*setting_flag)(bAnimContext *ac, int setting, short *neg);
00377                 /* get the pointer to int/short where data is stored, 
00378                  * with type being  sizeof(ptr_data) which should be fine for runtime use...
00379                  *      - assume that setting has been checked to be valid for current context
00380                  */
00381         void *(*setting_ptr)(bAnimListElem *ale, int setting, short *type);
00382 } bAnimChannelType;
00383 
00384 /* ------------------------ Drawing API -------------------------- */
00385 
00386 /* Get typeinfo for the given channel */
00387 bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale);
00388 
00389 /* Print debugging info about a given channel */
00390 void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level);
00391 
00392 /* Draw the given channel */
00393 void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
00394 /* Draw the widgets for the given channel */
00395 void ANIM_channel_draw_widgets(bAnimContext *ac, bAnimListElem *ale, struct uiBlock *block, float yminc, float ymaxc);
00396 
00397 
00398 /* ------------------------ Editing API -------------------------- */
00399 
00400 /* Check if some setting for a channel is enabled 
00401  * Returns: 1 = On, 0 = Off, -1 = Invalid
00402  *
00403  *      - setting: eAnimChannel_Settings
00404  */
00405 short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting);
00406 
00407 /* Change value of some setting for a channel 
00408  *      - setting: eAnimChannel_Settings
00409  *      - mode: eAnimChannels_SetFlag
00410  */
00411 void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, short mode);
00412 
00413 
00414 /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting 
00415  *      - anim_data: list of the all the anim channels that can be chosen
00416  *              -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too,
00417  *                then the channels under closed expanders get ignored...
00418  *      - ale_setting: the anim channel (not in the anim_data list directly, though occuring there)
00419  *              with the new state of the setting that we want flushed up/down the hierarchy 
00420  *      - setting: type of setting to set
00421  *      - on: whether the visibility setting has been enabled or disabled 
00422  */
00423 void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on);
00424 
00425 
00426 /* Deselect all animation channels */
00427 void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, short test, short sel);
00428 
00429 /* Set the 'active' channel of type channel_type, in the given action */
00430 void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type);
00431 
00432 
00433 /* Delete the F-Curve from the given AnimData block (if possible), as appropriate according to animation context */
00434 void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, struct FCurve *fcu);
00435 
00436 /* ************************************************ */
00437 /* DRAWING API */
00438 /* anim_draw.c */
00439 
00440 /* Get string representing the given frame number as an appropriately represented frame or timecode */
00441 void ANIM_timecode_string_from_frame(char *str, struct Scene *scene, int power, short timecodes, float cfra);
00442 
00443 /* ---------- Current Frame Drawing ---------------- */
00444 
00445 /* flags for Current Frame Drawing */
00446 enum {
00447                 /* plain time indicator with no special indicators */
00448         DRAWCFRA_PLAIN                  = 0,
00449                 /* draw box indicating current frame number */
00450         DRAWCFRA_SHOW_NUMBOX    = (1<<0),
00451                 /* time indication in seconds or frames */
00452         DRAWCFRA_UNIT_SECONDS   = (1<<1),
00453                 /* show time-offset line */
00454         DRAWCFRA_SHOW_TIMEOFS   = (1<<2)
00455 } eAnimEditDraw_CurrentFrame; 
00456 
00457 /* main call to draw current-frame indicator in an Animation Editor */
00458 void ANIM_draw_cfra(const struct bContext *C, struct View2D *v2d, short flag);
00459 
00460 /* ------------- Preview Range Drawing -------------- */
00461 
00462 /* main call to draw preview range curtains */
00463 void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d);
00464 
00465 /* ************************************************* */
00466 /* F-MODIFIER TOOLS */
00467 
00468 /* ------------- UI Panel Drawing -------------- */
00469 
00470 /* draw a given F-Modifier for some layout/UI-Block */
00471 void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
00472 
00473 /* ------------- Copy/Paste Buffer -------------- */
00474 
00475 
00476 /* free the copy/paste buffer */
00477 void free_fmodifiers_copybuf(void);
00478 
00479 /* copy the given F-Modifiers to the buffer, returning whether anything was copied or not
00480  * assuming that the buffer has been cleared already with free_fmodifiers_copybuf()
00481  *      - active: only copy the active modifier
00482  */
00483 short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active);
00484 
00485 /* 'Paste' the F-Modifier(s) from the buffer to the specified list 
00486  *      - replace: free all the existing modifiers to leave only the pasted ones 
00487  */
00488 short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace);
00489 
00490 /* ************************************************* */
00491 /* ASSORTED TOOLS */
00492 
00493 /* ------------ Animation F-Curves <-> Icons/Names Mapping ------------ */
00494 /* anim_ipo_utils.c */
00495 
00496 /* Get icon + name for channel-list displays for F-Curve */
00497 int getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu);
00498 
00499 /* Automatically determine a color for the nth F-Curve */
00500 void getcolor_fcurve_rainbow(int cur, int tot, float *out);
00501 
00502 /* ----------------- NLA-Mapping ----------------------- */
00503 /* anim_draw.c */
00504 
00505 /* Obtain the AnimData block providing NLA-scaling for the given channel if applicable */
00506 struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale);
00507 
00508 /* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */
00509 void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, short restore, short only_keys);
00510 
00511 /* ..... */
00512 
00513 /* Perform auto-blending/extend refreshes after some operations */
00514 // NOTE: defined in space_nla/nla_edit.c, not in animation/
00515 void ED_nla_postop_refresh(bAnimContext *ac);
00516 
00517 /* ------------- Unit Conversion Mappings ------------- */
00518 /* anim_draw.c */
00519 
00520 /* flags for conversion mapping */
00521 typedef enum eAnimUnitConv_Flags {
00522                 /* restore to original internal values */
00523         ANIM_UNITCONV_RESTORE   = (1<<0),
00524                 /* ignore handles (i.e. only touch main keyframes) */
00525         ANIM_UNITCONV_ONLYKEYS  = (1<<1),
00526                 /* only touch selected BezTriples */
00527         ANIM_UNITCONV_ONLYSEL   = (1<<2),
00528                 /* only touch selected vertices */
00529         ANIM_UNITCONV_SELVERTS  = (1<<3)
00530 } eAnimUnitConv_Flags;
00531 
00532 /* Get unit conversion factor for given ID + F-Curve */
00533 float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FCurve *fcu, short restore);
00534 
00535 /* Apply/Unapply units conversions to keyframes */
00536 void ANIM_unit_mapping_apply_fcurve(struct Scene *scene, struct ID *id, struct FCurve *fcu, short flag);
00537 
00538 /* ------------- Utility macros ----------------------- */
00539 
00540 /* provide access to Keyframe Type info in BezTriple
00541  * NOTE: this is so that we can change it from being stored in 'hide'
00542  */
00543 #define BEZKEYTYPE(bezt) ((bezt)->hide)
00544 
00545 /* set/clear/toggle macro 
00546  *      - channel - channel with a 'flag' member that we're setting
00547  *      - smode - 0=clear, 1=set, 2=invert
00548  *      - sflag - bitflag to set
00549  */
00550 #define ACHANNEL_SET_FLAG(channel, smode, sflag) \
00551         { \
00552                 if (smode == ACHANNEL_SETFLAG_INVERT)   (channel)->flag ^= (sflag); \
00553                 else if (smode == ACHANNEL_SETFLAG_ADD) (channel)->flag |= (sflag); \
00554                 else                                                                    (channel)->flag &= ~(sflag); \
00555         }
00556         
00557 /* set/clear/toggle macro, where the flag is negative 
00558  *      - channel - channel with a 'flag' member that we're setting
00559  *      - smode - 0=clear, 1=set, 2=invert
00560  *      - sflag - bitflag to set
00561  */
00562 #define ACHANNEL_SET_FLAG_NEG(channel, smode, sflag) \
00563         { \
00564                 if (smode == ACHANNEL_SETFLAG_INVERT)   (channel)->flag ^= (sflag); \
00565                 else if (smode == ACHANNEL_SETFLAG_ADD) (channel)->flag &= ~(sflag); \
00566                 else                                                                    (channel)->flag |= (sflag); \
00567         }
00568 
00569 
00570 /* --------- anim_deps.c, animation updates -------- */
00571 
00572 void ANIM_id_update(struct Scene *scene, struct ID *id);
00573 void ANIM_list_elem_update(struct Scene *scene, bAnimListElem *ale);
00574 
00575 /* data -> channels syncing */
00576 void ANIM_sync_animchannels_to_data(const struct bContext *C);
00577 
00578 /* ************************************************* */
00579 /* OPERATORS */
00580         
00581         /* generic animation channels */
00582 void ED_operatortypes_animchannels(void);
00583 void ED_keymap_animchannels(struct wmKeyConfig *keyconf);
00584 
00585         /* generic time editing */
00586 void ED_operatortypes_anim(void);
00587 void ED_keymap_anim(struct wmKeyConfig *keyconf);
00588         
00589         /* space_graph */
00590 void ED_operatormacros_graph(void);
00591         /* space_action */
00592 void ED_operatormacros_action(void);
00593 
00594 /* ************************************************ */
00595 
00596 #endif /* ED_ANIM_API_H */
00597