[Bf-blender-cvs] [d067c13a9d0] master: NLA: Always Show All Strips

Wayde Moss noreply at git.blender.org
Wed Sep 16 14:52:55 CEST 2020


Commit: d067c13a9d07c7b2d21aa75a93d95d42e0609aa0
Author: Wayde Moss
Date:   Wed Sep 16 14:49:55 2020 +0200
Branches: master
https://developer.blender.org/rBd067c13a9d07c7b2d21aa75a93d95d42e0609aa0

NLA: Always Show All Strips

Currently, it's difficult to use the NLA system for users who are only
interested in using it as animation layers.

Entering tweak mode hides strips which are not evaluated. If the user
wanted to edit a different strip, they must exit tweak mode, look for
the strip, select it then re-enter tweak mode.

Solution:
All strips are always shown. The user can now see the next strip they
want to start editing.

Reviewed By: Sybren, Sebastian Parborg

Differential Revision: http://developer.blender.org/D7600

===================================================================

M	source/blender/blenkernel/intern/nla.c
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/space_nla/nla_draw.c

===================================================================

diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index b7d6c7a5a28..828a6c99838 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -2077,10 +2077,10 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
     return false;
   }
 
-  /* go over all the tracks up to the active one, tagging each strip that uses the same
-   * action as the active strip, but leaving everything else alone
+  /* Go over all the tracks, tagging each strip that uses the same
+   * action as the active strip, but leaving everything else alone.
    */
-  for (nlt = activeTrack->prev; nlt; nlt = nlt->prev) {
+  for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
     for (strip = nlt->strips.first; strip; strip = strip->next) {
       if (strip->act == activeStrip->act) {
         strip->flag |= NLASTRIP_FLAG_TWEAKUSER;
@@ -2091,15 +2091,9 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
     }
   }
 
-  /* tag all other strips in active track that uses the same action as the active strip */
-  for (strip = activeTrack->strips.first; strip; strip = strip->next) {
-    if ((strip->act == activeStrip->act) && (strip != activeStrip)) {
-      strip->flag |= NLASTRIP_FLAG_TWEAKUSER;
-    }
-    else {
-      strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER;
-    }
-  }
+  /* Untag tweaked track. This leads to non tweaked actions being drawn differently than the
+   * tweaked action. */
+  activeStrip->flag &= ~NLASTRIP_FLAG_TWEAKUSER;
 
   /* go over all the tracks after AND INCLUDING the active one, tagging them as being disabled
    * - the active track needs to also be tagged, otherwise, it'll overlap with the tweaks going on
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 3416d72c021..a17f1950be0 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1555,17 +1555,6 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac),
       next = nlt->next;
     }
 
-    /* If we're in NLA-tweak-mode, don't show this track if it was disabled
-     * (due to tweaking) for now:
-     * - active track should still get shown though (even though it has disabled flag set)
-     */
-    // FIXME: the channels after should still get drawn, just 'differently',
-    // and after an active-action channel.
-    if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED) &&
-        (adt->act_track != nlt)) {
-      continue;
-    }
-
     /* only work with this channel and its subchannels if it is editable */
     if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) {
       /* only include this track if selected in a way consistent with the filtering requirements */
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index b0d5360e29b..9e43a8ce109 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -408,6 +408,24 @@ static uint nla_draw_use_dashed_outlines(const float color[4], bool muted)
   return shdr_pos;
 }
 
+/** This check only accounts for the track's disabled flag and whether the strip is being tweaked.
+ * It does not account for muting or soloing. */
+static bool is_nlastrip_enabled(AnimData *adt, NlaTrack *nlt, NlaStrip *strip)
+{
+  /** This shouldn't happen. If passed NULL, then just treat strip as enabled. */
+  BLI_assert(adt);
+  if (!adt) {
+    return true;
+  }
+
+  if ((nlt->flag & NLATRACK_DISABLED) == 0) {
+    return true;
+  }
+
+  /** For disabled tracks, only the tweaked strip is enabled. */
+  return adt->actstrip == strip;
+}
+
 /* main call for drawing a single NLA-strip */
 static void nla_draw_strip(SpaceNla *snla,
                            AnimData *adt,
@@ -470,7 +488,7 @@ static void nla_draw_strip(SpaceNla *snla,
   }
 
   /* draw 'inside' of strip itself */
-  if (non_solo == 0) {
+  if (non_solo == 0 && is_nlastrip_enabled(adt, nlt, strip)) {
     immUnbindProgram();
 
     /* strip is in normal track */



More information about the Bf-blender-cvs mailing list