NLA SoC: Fixed bug with NLA-Transform
Strip-sorting code was buggy, as it was trying to access an invalid pointer, so the call to sort strips after transform was temporarily disabled in previous commits.
This commit is contained in:
@@ -546,26 +546,28 @@ short BKE_nlastrips_has_space (ListBase *strips, float start, float end)
|
||||
void BKE_nlastrips_sort_strips (ListBase *strips)
|
||||
{
|
||||
ListBase tmp = {NULL, NULL};
|
||||
NlaStrip *strip, *sstrip;
|
||||
NlaStrip *strip, *sstrip, *stripn;
|
||||
|
||||
/* sanity checks */
|
||||
if ELEM(NULL, strips, strips->first)
|
||||
return;
|
||||
|
||||
|
||||
/* we simply perform insertion sort on this list, since it is assumed that per track,
|
||||
* there are only likely to be at most 5-10 strips
|
||||
*/
|
||||
for (strip= strips->first; strip; strip= strip->next) {
|
||||
for (strip= strips->first; strip; strip= stripn) {
|
||||
short not_added = 1;
|
||||
|
||||
stripn= strip->next;
|
||||
|
||||
/* remove this strip from the list, and add it to the new list, searching from the end of
|
||||
* the list, assuming that the lists are in order
|
||||
*/
|
||||
BLI_remlink(strips, strip);
|
||||
|
||||
for (sstrip= tmp.last; not_added && sstrip; sstrip= sstrip->prev) {
|
||||
for (sstrip= tmp.last; sstrip; sstrip= sstrip->prev) {
|
||||
/* check if add after */
|
||||
if (sstrip->end < strip->start) {
|
||||
if (sstrip->end <= strip->start) {
|
||||
BLI_insertlinkafter(&tmp, sstrip, strip);
|
||||
not_added= 0;
|
||||
break;
|
||||
|
||||
@@ -4836,8 +4836,7 @@ void special_aftertrans_update(TransInfo *t)
|
||||
NlaTrack *nlt= (NlaTrack *)ale->data;
|
||||
|
||||
/* make sure strips are in order again */
|
||||
// FIXME: this is buggy
|
||||
//BKE_nlatrack_sort_strips(nlt);
|
||||
BKE_nlatrack_sort_strips(nlt);
|
||||
|
||||
/* remove the temp metas */
|
||||
BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
|
||||
|
||||
Reference in New Issue
Block a user