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-11-30 14:10:03 +0300
committerJoshua Leung <aligorith@gmail.com>2009-11-30 14:10:03 +0300
commita2d757dc7d12ee6e58c853738a6a9a934da5b357 (patch)
tree2222ba3581c4a88fd6086b012289ba3112f97b49 /source/blender/editors/animation/anim_channels_defines.c
parente5260470615635600b2cea2ff7f707453a21502e (diff)
Durian Requests for Graph Editor Visibility Toggles (2):
Improved the hotkeys for toggling the visibility of channels in the keys area for the Graph Editor. * VKEY - this is now used for making only the selected channels visible, hiding everything else * Shift-VKEY - the old toggling behaviour In addition to this, I've made these toggling operators flush the visibility flags up/down the hierarchy, just like clicking on the channels manually do. There are still a few minor oddities to iron out, but it should be better than before. Also, fixed a bug with these toggling operators introduced during my earlier commit to make filtering work ok. It's always tricky getting these layers of checks just right, so hopefully nothing breaks now again...
Diffstat (limited to 'source/blender/editors/animation/anim_channels_defines.c')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c92
1 files changed, 3 insertions, 89 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 24a8fb445c7..c3044e03a2f 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -2340,13 +2340,10 @@ static void achannel_setting_widget_cb(bContext *C, void *poin, void *poin2)
static void achannel_setting_visible_widget_cb(bContext *C, void *ale_npoin, void *dummy_poin)
{
bAnimListElem *ale_setting= (bAnimListElem *)ale_npoin;
- int prevLevel=0, matchLevel=0;
- short vizOn = 0;
-
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
- bAnimListElem *ale, *match=NULL;
int filter;
+ short vizOn = 0;
/* send notifiers before doing anything else... */
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
@@ -2374,91 +2371,8 @@ static void achannel_setting_visible_widget_cb(bContext *C, void *ale_npoin, voi
filter= ANIMFILTER_CHANNELS;
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
- /* find the channel that got changed */
- for (ale= anim_data.first; ale; ale= ale->next) {
- /* compare data, and type as main way of identifying the channel */
- if ((ale->data == ale_setting->data) && (ale->type == ale_setting->type)) {
- /* we also have to check the ID, this is assigned to, since a block may have multiple users */
- // TODO: is the owner-data more revealing?
- if (ale->id == ale_setting->id) {
- match= ale;
- break;
- }
- }
- }
- if (match == NULL) {
- printf("ERROR: no channel matching the one changed was found \n");
- BLI_freelistN(&anim_data);
- return;
- }
- else {
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale_setting);
-
- /* get the level of the channel that was affected
- * - we define the level as simply being the offset for the start of the channel
- */
- matchLevel= (acf->get_offset)? acf->get_offset(&ac, ale_setting) : 0;
- }
-
- /* flush up?
- * - only flush up if the current state is now enabled
- * (otherwise, it's too much work to force the parents to be inactive too)
- */
- if (vizOn) {
- /* go backwards in the list, until the highest-ranking element (by indention has been covered) */
- for (ale= match->prev; ale; ale= ale->prev) {
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- int level;
-
- /* get the level of the current channel traversed
- * - we define the level as simply being the offset for the start of the channel
- */
- level= (acf->get_offset)? acf->get_offset(&ac, ale) : 0;
-
- /* if the level is 'less than' (i.e. more important) the previous channel,
- * flush the new status...
- */
- if (level < matchLevel)
- ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, vizOn);
- /* however, if the level is 'greater than' (i.e. less important than the previous channel,
- * stop searching, since we've already reached the bottom of another hierarchy
- */
- else if (level > matchLevel)
- break;
-
- /* store this level as the 'old' level now */
- prevLevel= level;
- }
- }
-
- /* flush down (always) */
- {
- /* go forwards in the list, until the lowest-ranking element (by indention has been covered) */
- for (ale= match->next; ale; ale= ale->next) {
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- int level;
-
- /* get the level of the current channel traversed
- * - we define the level as simply being the offset for the start of the channel
- */
- level= (acf->get_offset)? acf->get_offset(&ac, ale) : 0;
-
- /* if the level is 'greater than' (i.e. less important) the channel that was changed,
- * flush the new status...
- */
- if (level > matchLevel)
- ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, vizOn);
- /* however, if the level is 'less than or equal to' the channel that was changed,
- * (i.e. the current channel is as important if not more important than the changed channel)
- * then we should stop, since we've found the last one of the children we should flush
- */
- else
- break;
-
- /* store this level as the 'old' level now */
- prevLevel= level;
- }
- }
+ /* call API method to flush the setting */
+ ANIM_visibility_flush_anim_channels(&ac, &anim_data, ale_setting, vizOn);
/* free temp data */
BLI_freelistN(&anim_data);