Blender V2.61 - r43446

ED_keyframes_draw.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) (C) 2009 Blender Foundation, Joshua Leung
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): Joshua Leung (full recode)
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef ED_KEYFRAMES_DRAW_H
00033 #define ED_KEYFRAMES_DRAW_H
00034 
00035 struct bAnimContext;
00036 struct AnimData;
00037 struct BezTriple;
00038 struct FCurve;
00039 struct bDopeSheet;
00040 struct bAction;
00041 struct bActionGroup;
00042 struct Object;
00043 struct ListBase;
00044 struct bGPDlayer;
00045 struct Scene;
00046 struct View2D;
00047 struct DLRBT_Tree;
00048 
00049 /* ****************************** Base Structs ****************************** */
00050 
00051 /* Keyframe Column Struct */
00052 typedef struct ActKeyColumn {
00053         /* ListBase linkage */
00054     struct ActKeyColumn *next, *prev;
00055     
00056         /* sorting-tree linkage */
00057     struct ActKeyColumn *left, *right;  /* 'children' of this node, less than and greater than it (respectively) */
00058     struct ActKeyColumn *parent;        /* parent of this node in the tree */
00059     char tree_col;                      /* DLRB_BLACK or DLRB_RED */
00060     
00061         /* keyframe info */
00062     char key_type;                      /* eBezTripe_KeyframeType */
00063     short sel;
00064     float cfra;
00065     
00066     /* only while drawing - used to determine if long-keyframe needs to be drawn */
00067     short modified;
00068     short totcurve;
00069 } ActKeyColumn;
00070 
00071 /* 'Long Keyframe' Struct */
00072 typedef struct ActKeyBlock {
00073         /* ListBase linkage */
00074     struct ActKeyBlock *next, *prev;
00075     
00076         /* sorting-tree linkage */
00077     struct ActKeyBlock *left, *right;   /* 'children' of this node, less than and greater than it (respectively) */
00078     struct ActKeyBlock *parent;         /* parent of this node in the tree */
00079     char tree_col;                      /* DLRB_BLACK or DLRB_RED */
00080     
00081         /* key-block info */
00082     char sel;
00083     short handle_type;
00084     float val;
00085     float start, end;
00086     
00087     /* only while drawing - used to determine if block needs to be drawn */
00088     short modified;
00089     short totcurve; 
00090 } ActKeyBlock;
00091 
00092 /* *********************** Keyframe Drawing ****************************** */
00093 
00094 /* options for keyframe shape drawing */
00095 typedef enum eKeyframeShapeDrawOpts {
00096         /* only the border */
00097     KEYFRAME_SHAPE_FRAME    = 0,
00098         /* only the inside filling */
00099     KEYFRAME_SHAPE_INSIDE,
00100         /* the whole thing */
00101     KEYFRAME_SHAPE_BOTH
00102 } eKeyframeShapeDrawOpts;
00103 
00104 /* draw simple diamond-shape keyframe (with OpenGL) */
00105 void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha);
00106 
00107 /* ******************************* Methods ****************************** */
00108 
00109 /* Channel Drawing ------------------ */
00110 /* F-Curve */
00111 void draw_fcurve_channel(struct View2D *v2d, struct AnimData *adt, struct FCurve *fcu, float ypos);
00112 /* Action Group Summary */
00113 void draw_agroup_channel(struct View2D *v2d, struct AnimData *adt, struct bActionGroup *agrp, float ypos);
00114 /* Action Summary */
00115 void draw_action_channel(struct View2D *v2d, struct AnimData *adt, struct bAction *act, float ypos);
00116 /* Object Summary */
00117 void draw_object_channel(struct View2D *v2d, struct bDopeSheet *ads, struct Object *ob, float ypos);
00118 /* Scene Summary */
00119 void draw_scene_channel(struct View2D *v2d, struct bDopeSheet *ads, struct Scene *sce, float ypos);
00120 /* DopeSheet Summary */
00121 void draw_summary_channel(struct View2D *v2d, struct bAnimContext *ac, float ypos);
00122 /* Grease Pencil Layer */ 
00123 // XXX not restored 
00124 void draw_gpl_channel(struct View2D *v2d, struct bDopeSheet *ads, struct bGPDlayer *gpl, float ypos);
00125 
00126 /* Keydata Generation --------------- */
00127 /* F-Curve */
00128 void fcurve_to_keylist(struct AnimData *adt, struct FCurve *fcu, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
00129 /* Action Group */
00130 void agroup_to_keylist(struct AnimData *adt, struct bActionGroup *agrp, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
00131 /* Action */
00132 void action_to_keylist(struct AnimData *adt, struct bAction *act, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
00133 /* Object */
00134 void ob_to_keylist(struct bDopeSheet *ads, struct Object *ob, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
00135 /* Scene */
00136 void scene_to_keylist(struct bDopeSheet *ads, struct Scene *sce, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
00137 /* DopeSheet Summary */
00138 void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
00139 /* Grease Pencil Layer */
00140 // XXX not restored
00141 void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys);
00142 
00143 /* ActKeyColumn API ---------------- */
00144 /* Comparator callback used for ActKeyColumns and cframe float-value pointer */
00145 short compare_ak_cfraPtr(void *node, void *data);
00146 
00147 /* Comparator callback used for ActKeyBlocks and cframe float-value pointer */
00148 short compare_ab_cfraPtr(void *node, void *data);
00149 
00150 /* Checks if ActKeyBlock can be used (i.e. drawn/used to detect "holds") */
00151 short actkeyblock_is_valid(ActKeyBlock *ab, struct DLRBT_Tree *keys);
00152 
00153 #endif  /*  ED_KEYFRAMES_DRAW_H */
00154