diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-06-24 13:59:52 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-06-24 14:01:06 +0400 |
commit | 0bc94f8c7ddf1dcc5f2ff385b42da70e2c7da6db (patch) | |
tree | 65aa082477e267acfc5f40b6115bdb26f4d71e6d /source/blender/editors | |
parent | 95b39acdb17808e95f0649faef2515d6a3a82534 (diff) |
Code Cleanup - Using the enum types in more API signatures instead of relying on coders to do the right thing
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 39 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 10 |
3 files changed, 33 insertions, 20 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 8e09aebff92..3530857266d 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3228,7 +3228,7 @@ void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level) /* Check if some setting for a channel is enabled * Returns: 1 = On, 0 = Off, -1 = Invalid */ -short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting) +short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting) { bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); @@ -3301,7 +3301,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting * - setting: eAnimChannel_Settings * - mode: eAnimChannels_SetFlag */ -void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, short mode) +void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode) { bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index a8ee2f98b5b..0bc4a69aa06 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -74,7 +74,7 @@ /* Set the given animation-channel as the active one for the active context */ // TODO: extend for animdata types... -void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type) +void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -173,6 +173,8 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f case ANIMTYPE_DSLAT: case ANIMTYPE_DSLINESTYLE: case ANIMTYPE_DSSPK: + case ANIMTYPE_DSNTREE: + case ANIMTYPE_DSTEX: { /* need to verify that this data is valid for now */ if (ale && ale->adt) { @@ -180,6 +182,17 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f } break; } + + /* unhandled currently, but may be interesting */ + case ANIMTYPE_GPLAYER: + case ANIMTYPE_MASKLAYER: + case ANIMTYPE_SHAPEKEY: + case ANIMTYPE_NLAACTION: + break; + + /* other types */ + default: + break; } } @@ -193,7 +206,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f * - test: check if deselecting instead of selecting * - sel: eAnimChannels_SetFlag; */ -void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, short test, short sel) +void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types datatype, bool test, eAnimChannels_SetFlag sel) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -387,7 +400,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled */ -void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short mode) +void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode) { bAnimListElem *ale, *match = NULL; int prevLevel = 0, matchLevel = 0; @@ -2213,9 +2226,9 @@ static int animchannels_deselectall_exec(bContext *C, wmOperator *op) /* 'standard' behavior - check if selected, then apply relevant selection */ if (RNA_boolean_get(op->ptr, "invert")) - ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 0, ACHANNEL_SETFLAG_TOGGLE); + ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, false, ACHANNEL_SETFLAG_TOGGLE); else - ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_ADD); + ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, true, ACHANNEL_SETFLAG_ADD); /* send notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL); @@ -2362,7 +2375,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op) extend = RNA_boolean_get(op->ptr, "extend"); if (!extend) - ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_CLEAR); + ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, true, ACHANNEL_SETFLAG_CLEAR); if (gesture_mode == GESTURE_MODAL_SELECT) selectmode = ACHANNEL_SETFLAG_ADD; @@ -2625,7 +2638,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, } else { /* select AnimData block by itself */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR); ale->adt->flag |= ADT_UI_SELECTED; } @@ -2680,7 +2693,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, FCurve *fcu; /* deselect all other channels */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR); if (pchan) ED_pose_deselectall(ob, 0); /* only select channels in group and group itself */ @@ -2690,7 +2703,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, } else { /* select group by itself */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR); if (pchan) ED_pose_deselectall(ob, 0); agrp->flag |= AGRP_SELECTED; @@ -2720,7 +2733,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, } else { /* select F-Curve by itself */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR); fcu->flag |= FCURVE_SELECTED; } @@ -2742,7 +2755,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, } else { /* select ShapeKey by itself */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR); kb->flag |= KEYBLOCK_SEL; } @@ -2772,7 +2785,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, } else { /* select layer by itself */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR); gpl->flag |= GP_LAYER_SELECT; } @@ -2802,7 +2815,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, } else { /* select layer by itself */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR); masklay->flag |= MASK_LAYERFLAG_SELECT; } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 02cc86eb55c..956ec308daa 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -467,13 +467,13 @@ void ANIM_channel_draw_widgets(struct bContext *C, bAnimContext *ac, bAnimListEl * * - setting: eAnimChannel_Settings */ -short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting); +short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings 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); +void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode); /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting @@ -485,14 +485,14 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled */ -void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short mode); +void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode); /* Deselect all animation channels */ -void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, short test, short sel); +void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types datatype, bool test, eAnimChannels_SetFlag 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); +void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type); /* Delete the F-Curve from the given AnimData block (if possible), as appropriate according to animation context */ |