Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_animation.c
| Show First 20 Lines • Show All 755 Lines • ▼ Show 20 Lines | bool rna_NLA_tracks_override_apply(Main *bmain, | ||||
| /* Remember that insertion operations are defined and stored in correct order, which means that | /* Remember that insertion operations are defined and stored in correct order, which means that | ||||
| * even if we insert several items in a row, we always insert first one, then second one, etc. | * even if we insert several items in a row, we always insert first one, then second one, etc. | ||||
| * So we should always find 'anchor' track in both _src *and* _dst. */ | * So we should always find 'anchor' track in both _src *and* _dst. */ | ||||
| NlaTrack *nla_track_anchor = NULL; | NlaTrack *nla_track_anchor = NULL; | ||||
| # if 0 | # if 0 | ||||
| /* This is not working so well with index-based insertion, especially in case some tracks get | /* This is not working so well with index-based insertion, especially in case some tracks get | ||||
| * added to lib linked data. So we simply add locale tracks at the end of the list always, order | * added to lib linked data. So we simply add locale tracks at the end of the list always, order | ||||
| * of override operations should ensure order of local tracks is preserved properly. */ | * of override operations should ensure order of local tracks is preserved properly. */ | ||||
| if (opop->subitem_local_index >= 0) { | if (opop->subitem_reference_index >= 0) { | ||||
| nla_track_anchor = BLI_findlink(&anim_data_dst->nla_tracks, opop->subitem_local_index); | nla_track_anchor = BLI_findlink(&anim_data_dst->nla_tracks, opop->subitem_reference_index); | ||||
| } | } | ||||
| /* Otherwise we just insert in first position. */ | /* Otherwise we just insert in first position. */ | ||||
| # else | # else | ||||
| nla_track_anchor = anim_data_dst->nla_tracks.last; | nla_track_anchor = anim_data_dst->nla_tracks.last; | ||||
| # endif | # endif | ||||
| NlaTrack *nla_track_src = NULL; | NlaTrack *nla_track_src = NULL; | ||||
| if (opop->subitem_local_index >= 0) { | if (opop->subitem_local_index >= 0) { | ||||
| nla_track_src = BLI_findlink(&anim_data_src->nla_tracks, opop->subitem_local_index); | nla_track_src = BLI_findlink(&anim_data_src->nla_tracks, opop->subitem_local_index); | ||||
| } | } | ||||
| nla_track_src = nla_track_src ? nla_track_src->next : anim_data_src->nla_tracks.first; | |||||
| if (nla_track_src == NULL) { | |||||
| BLI_assert(nla_track_src != NULL); | BLI_assert(nla_track_src != NULL); | ||||
| return false; | |||||
| } | |||||
| NlaTrack *nla_track_dst = BKE_nlatrack_copy(bmain, nla_track_src, true, 0); | NlaTrack *nla_track_dst = BKE_nlatrack_copy(bmain, nla_track_src, true, 0); | ||||
| /* This handles NULL anchor as expected by adding at head of list. */ | /* This handles NULL anchor as expected by adding at head of list. */ | ||||
| BLI_insertlinkafter(&anim_data_dst->nla_tracks, nla_track_anchor, nla_track_dst); | BLI_insertlinkafter(&anim_data_dst->nla_tracks, nla_track_anchor, nla_track_dst); | ||||
| // printf("%s: We inserted a NLA Track...\n", __func__); | // printf("%s: We inserted a NLA Track...\n", __func__); | ||||
| return true; | return true; | ||||
| ▲ Show 20 Lines • Show All 618 Lines • Show Last 20 Lines | |||||