Blender V2.61 - r43446

ED_anim_api.h

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