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