Page MenuHome

Fix T38897: Problems moving animation channels up and down in dope sheet/action editor.
ClosedPublic

Authored by Bastien Montagne (mont29) on Mar 1 2014, 12:31 PM.

Diff Detail

Event Timeline

A quick first-look review:

  • I'm not sure it's such a great idea to be grabbing the list of visible channels within the rearrange_islands func. At least in the case of groups, this ends up being called multiple times - each time building up the list for all channels.
  • You need to explicitly free the items in anim_data_visible once you're done with them. Right now there's a memory leak.
Joshua Leung (aligorith) requested changes to this revision.Mar 2 2014, 1:04 AM
Bastien Montagne (mont29) updated this revision to Unknown Object (????).Mar 2 2014, 11:16 AM

Updated accordingly to comments in first review (and sorry about forgetting to free anim_data_visible :/ ).

Hey Joshua, mind reviewing this one? :)

I think that the way you've got things now (with a temporary local list used in some cases, and the passed-in one being used in other cases) is in some ways even more confusing.

Perhaps the following would work better:

/* Helper to get list of visible channels */
static void rearrange_animchannels_filter_visible(ListBase *anim_data_visible, bAnimContext *ac, short type)
{
    int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
    ANIM_animdata_filter(ac, anim_data_visible, filter, ac->data, type);
}

static void rearrange_driver_channels(bAnimContext *ac, AnimData *adt, short mode)
{
    ListBase anim_data_visible = {NULL, NULL}; 
    ...
    rearrange_animchannels_filter_visible(&anim_data_visible, ac, ANIMTYPE_FCURVE); 
    ...
        rearrange_animchannel_islands(&anim_data_visible, ...);
    ...
    BKE_freelistN(&anim_data_visible);
}

static void rearrange_nla_channels(bAnimContext *ac, AnimData *adt, short mode)
{
      ... similar to rearrange_driver_channels() example above ...
}

... etc ...
Bastien Montagne (mont29) updated this revision to Unknown Object (????).Mar 13 2014, 2:43 PM

Thanks for the review, updated following your suggestion. :)

Ok, patch looks good :)