diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-08-21 11:08:15 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-08-21 11:08:15 +0400 |
commit | be25346da68be9027757bef101562987483afd1c (patch) | |
tree | 4c4c21a7eaf901aa539f5e55d4d373156df7a6e6 /source/blender/editors | |
parent | bcadb6b93986b230fb6e70489e7221b3f9972aec (diff) |
Bugfix [#28308] Crashes when individual channels are moved in Action
Editor
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index ffa0b2d5ff5..e993faa71aa 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1042,11 +1042,6 @@ static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mod static int animchannels_rearrange_exec(bContext *C, wmOperator *op) { bAnimContext ac; - - ListBase anim_data = {NULL, NULL}; - bAnimListElem *ale; - int filter; - short mode; /* get editor data */ @@ -1056,43 +1051,51 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op) /* get mode */ mode= RNA_enum_get(op->ptr, "direction"); - /* get animdata blocks */ - // XXX: hierarchy visibility is provisional atm... might be wrong decision! - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA); - ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); - - for (ale = anim_data.first; ale; ale = ale->next) { - AnimData *adt= ale->data; + /* method to move channels depends on the editor */ + if (ac.datatype == ANIMCONT_GPENCIL) { + /* Grease Pencil channels */ + printf("Grease Pencil not supported for moving yet\n"); + } + else if (ac.datatype == ANIMCONT_ACTION) { + /* Directly rearrange action's channels */ + rearrange_action_channels(&ac, ac.data, mode); + } + else { + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; - switch (ac.datatype) { - case ANIMCONT_NLA: /* NLA-tracks only */ - rearrange_nla_channels(&ac, adt, mode); - break; + /* get animdata blocks */ + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt= ale->data; - case ANIMCONT_DRIVERS: /* Drivers list only */ - rearrange_driver_channels(&ac, adt, mode); - break; - - case ANIMCONT_GPENCIL: /* Grease Pencil channels */ - // FIXME: this case probably needs to get moved out of here or treated specially... - printf("grease pencil not supported for moving yet\n"); - break; + switch (ac.datatype) { + case ANIMCONT_NLA: /* NLA-tracks only */ + rearrange_nla_channels(&ac, adt, mode); + break; - case ANIMCONT_SHAPEKEY: // DOUBLE CHECK ME... + case ANIMCONT_DRIVERS: /* Drivers list only */ + rearrange_driver_channels(&ac, adt, mode); + break; - default: /* some collection of actions */ - // FIXME: actions should only be considered once! - if (adt->action) - rearrange_action_channels(&ac, adt->action, mode); - else if (G.f & G_DEBUG) - printf("animdata has no action\n"); - break; + case ANIMCONT_SHAPEKEY: // DOUBLE CHECK ME... + + default: /* some collection of actions */ + if (adt->action) + rearrange_action_channels(&ac, adt->action, mode); + else if (G.f & G_DEBUG) + printf("Animdata has no action\n"); + break; + } } + + /* free temp data */ + BLI_freelistN(&anim_data); } - /* free temp data */ - BLI_freelistN(&anim_data); - /* send notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); |