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:
Diffstat (limited to 'source/blender/blenkernel/intern/nla.c')
-rw-r--r--source/blender/blenkernel/intern/nla.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 8f54d71108a..10abb8f20df 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -252,12 +252,15 @@ static NlaStrip *find_active_strip_from_listbase(const NlaStrip *active_strip,
const ListBase /* NlaStrip */ *strips_source,
const ListBase /* NlaStrip */ *strips_dest)
{
+ BLI_assert_msg(BLI_listbase_count(strips_source) == BLI_listbase_count(strips_dest),
+ "Expecting the same number of source and destination strips");
+
NlaStrip *strip_dest = strips_dest->first;
LISTBASE_FOREACH (const NlaStrip *, strip_source, strips_source) {
if (strip_dest == NULL) {
- /* The tracks are assumed to have an equal number of strips, but this is not the case when
- * dragging multiple strips. The transform system merges the selected strips into one
- * meta-strip, reducing the number of strips in `track_dest`. */
+ /* The tracks are assumed to have an equal number of strips, but this is
+ * not the case. Not sure when this might happen, but it's better to not
+ * crash. */
break;
}
if (strip_source == active_strip) {
@@ -282,7 +285,9 @@ static NlaStrip *find_active_strip_from_listbase(const NlaStrip *active_strip,
return NULL;
}
-/* Set adt_dest->actstrip to the strip with the same index as adt_source->actstrip. */
+/* Set adt_dest->actstrip to the strip with the same index as
+ * adt_source->actstrip. Note that this always sets `adt_dest->actstrip`; sets
+ * to NULL when `adt_source->actstrip` cannot be found. */
static void update_active_strip(AnimData *adt_dest,
NlaTrack *track_dest,
const AnimData *adt_source,
@@ -298,6 +303,12 @@ static void update_active_strip(AnimData *adt_dest,
/* Set adt_dest->act_track to the track with the same index as adt_source->act_track. */
static void update_active_track(AnimData *adt_dest, const AnimData *adt_source)
{
+ adt_dest->act_track = NULL;
+ adt_dest->actstrip = NULL;
+ if (adt_source->act_track == NULL && adt_source->actstrip == NULL) {
+ return;
+ }
+
BLI_assert(BLI_listbase_count(&adt_source->nla_tracks) ==
BLI_listbase_count(&adt_dest->nla_tracks));
@@ -306,7 +317,11 @@ static void update_active_track(AnimData *adt_dest, const AnimData *adt_source)
if (track_source == adt_source->act_track) {
adt_dest->act_track = track_dest;
}
- update_active_strip(adt_dest, track_dest, adt_source, track_source);
+
+ /* Only search for the active strip if it hasn't been found yet. */
+ if (adt_dest->actstrip == NULL && adt_source->actstrip != NULL) {
+ update_active_strip(adt_dest, track_dest, adt_source, track_source);
+ }
track_dest = track_dest->next;
}