Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-08-11 15:52:23 +0400
committerJoshua Leung <aligorith@gmail.com>2009-08-11 15:52:23 +0400
commitb9584607c57720da9e443a42eff30d758c4075a0 (patch)
treef1eb2e01fb6af22a6c7f908b3e933c897799080e /source/blender/editors/include
parent911078aaaddfab72eeea564f671f7e1a1c392300 (diff)
Animation Editors: Code Cleanup Part 1 - Drawing
Finally started refactoring the drawing code for animation editors so that all the drawing (of the channels/names list) is done using standardised code for all the editors. A little specialised system for this has been made, and is now used for DopeSheet and Graph Editor drawing. This should make it easier to add new channel types with less effort. Protect/mute toggles are now always clamped to the right-hand edge of the channels list. So you can now make the list wider to view longer names fully. However, since the mouse-handling hasn't been fixed yet, this won't always work. TODOs: * make mouse-click handling code use this system too, simplifying things to 1-2 lines of code there. Maybe this could be made to use UI widgets instead at a later date? * NLA still needs to be ported to this system
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r--source/blender/editors/include/ED_anim_api.h92
1 files changed, 80 insertions, 12 deletions
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 0786d0f9be0..d3d42deba21 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -107,7 +107,10 @@ typedef struct bAnimListElem {
} bAnimListElem;
-/* Some types for easier type-testing */
+/* Some types for easier type-testing
+ * NOTE: need to keep the order of these synchronised with the channels define code
+ * which is used for drawing and handling channel lists for
+ */
// XXX was ACTTYPE_*
typedef enum eAnim_ChannelType {
ANIMTYPE_NONE= 0,
@@ -140,6 +143,9 @@ typedef enum eAnim_ChannelType {
ANIMTYPE_NLATRACK,
ANIMTYPE_NLAACTION,
+
+ /* always as last item, the total number of channel types... */
+ ANIMTYPE_NUM_TYPES,
} eAnim_ChannelType;
/* types of keyframe data in bAnimListElem */
@@ -275,25 +281,87 @@ short ANIM_animdata_context_getdata(bAnimContext *ac);
/* ************************************************ */
/* ANIMATION CHANNELS LIST */
-/* anim_channels.c */
-
-/* ------------------------ API -------------------------- */
-
-/* Deselect all animation channels */
-void ANIM_deselect_anim_channels(void *data, short datatype, short test, short sel);
-
-/* Set the 'active' channel of type channel_type, in the given action */
-void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type);
+/* anim_channels_*.c */
-/* --------------- Settings and/or Defines -------------- */
+/* ------------------------ Drawing TypeInfo -------------------------- */
/* flag-setting behaviour */
-enum {
+typedef enum eAnimChannels_SetFlag {
ACHANNEL_SETFLAG_CLEAR = 0,
ACHANNEL_SETFLAG_ADD,
ACHANNEL_SETFLAG_TOGGLE
} eAnimChannels_SetFlag;
+/* types of settings for AnimChanels */
+typedef enum eAnimChannel_Settings {
+ ACHANNEL_SETTING_SELECT = 0,
+ ACHANNEL_SETTING_PROTECT, // warning: for drawing UI's, need to check if this is off (maybe inverse this later)
+ ACHANNEL_SETTING_MUTE,
+ ACHANNEL_SETTING_EXPAND,
+ ACHANNEL_SETTING_VISIBLE, /* only for Graph Editor */
+ ACHANNEL_SETTING_SOLO, /* only for NLA Tracks */
+} eAnimChannel_Settings;
+
+
+/* Drawing, mouse handling, and flag setting behaviour... */
+typedef struct bAnimChannelType {
+ /* drawing */
+ /* draw backdrop strip for channel */
+ void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
+ /* get depth of indention (relative to the depth channel is nested at) */
+ short (*get_indent_level)(bAnimContext *ac, bAnimListElem *ale);
+ /* get offset in pixels for the start of the channel (in addition to the indent depth) */
+ short (*get_offset)(bAnimContext *ac, bAnimListElem *ale);
+
+
+ /* get name (for channel lists) */
+ void (*name)(bAnimListElem *ale, char *name);
+ /* get icon (for channel lists) */
+ int (*icon)(bAnimListElem *ale);
+
+ /* settings */
+ /* check if the given setting is valid in the current context */
+ short (*has_setting)(bAnimContext *ac, bAnimListElem *ale, int setting);
+ /* get the flag used for this setting */
+ int (*setting_flag)(int setting, short *neg);
+ /* get the pointer to int/short where data is stored,
+ * with type being sizeof(ptr_data) which should be fine for runtime use...
+ * - assume that setting has been checked to be valid for current context
+ */
+ void *(*setting_ptr)(bAnimListElem *ale, int setting, short *type);
+} bAnimChannelType;
+
+/* ------------------------ Drawing API -------------------------- */
+
+/* Get typeinfo for the given channel */
+bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale);
+
+/* Draw the given channel */
+void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
+
+
+/* ------------------------ Editing API -------------------------- */
+
+/* Check if some setting for a channel is enabled
+ * Returns: 1 = On, 0 = Off, -1 = Invalid
+ *
+ * - setting: eAnimChannel_Settings
+ */
+short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting);
+
+/* Change value of some setting for a channel
+ * - setting: eAnimChannel_Settings
+ * - mode: eAnimChannels_SetFlag
+ */
+void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, short mode);
+
+
+/* Deselect all animation channels */
+void ANIM_deselect_anim_channels(void *data, short datatype, short test, short sel);
+
+/* Set the 'active' channel of type channel_type, in the given action */
+void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type);
+
/* ************************************************ */
/* DRAWING API */
/* anim_draw.c */