[Bf-blender-cvs] [a91c8d8efa4] master: Fix T98686: Cant rename local NLA tracks within a local library override data-block.

Bastien Montagne noreply at git.blender.org
Thu Jun 9 09:51:45 CEST 2022


Commit: a91c8d8efa414ddb775e0c2fb03a7cc034ec1c58
Author: Bastien Montagne
Date:   Thu Jun 9 09:50:27 2022 +0200
Branches: master
https://developer.blender.org/rBa91c8d8efa414ddb775e0c2fb03a7cc034ec1c58

Fix T98686: Cant rename local NLA tracks within a local library override data-block.

We need a specific exception to general rule 'no rename of anim channels
in liboverride data' for the locally-inserted NLA tracks.

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

M	source/blender/editors/animation/anim_channels_edit.c

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

diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 9cd4b94783a..b223a1493fd 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -2791,13 +2791,35 @@ static bool rename_anim_channels(bAnimContext *ac, int channel_index)
     return false;
   }
 
-  /* don't allow renaming linked channels */
-  if ((ale->fcurve_owner_id != NULL &&
-       (ID_IS_LINKED(ale->fcurve_owner_id) || ID_IS_OVERRIDE_LIBRARY(ale->fcurve_owner_id))) ||
-      (ale->id != NULL && (ID_IS_LINKED(ale->id) || ID_IS_OVERRIDE_LIBRARY(ale->id)))) {
+  /* Don't allow renaming linked/liboverride channels. */
+  if (ale->fcurve_owner_id != NULL &&
+      (ID_IS_LINKED(ale->fcurve_owner_id) || ID_IS_OVERRIDE_LIBRARY(ale->fcurve_owner_id))) {
     ANIM_animdata_freelist(&anim_data);
     return false;
   }
+  if (ale->id != NULL) {
+    if (ID_IS_LINKED(ale->id)) {
+      ANIM_animdata_freelist(&anim_data);
+      return false;
+    }
+    /* There is one exception to not allowing renaming on liboverride channels: locally-inserted
+     * NLA tracks. */
+    if (ID_IS_OVERRIDE_LIBRARY(ale->id)) {
+      switch (ale->type) {
+        case ANIMTYPE_NLATRACK: {
+          NlaTrack *nlt = (NlaTrack *)ale->data;
+          if ((nlt->flag & NLATRACK_OVERRIDELIBRARY_LOCAL) == 0) {
+            ANIM_animdata_freelist(&anim_data);
+            return false;
+          }
+          break;
+        }
+        default:
+          ANIM_animdata_freelist(&anim_data);
+          return false;
+      }
+    }
+  }
 
   /* check that channel can be renamed */
   acf = ANIM_channel_get_typeinfo(ale);



More information about the Bf-blender-cvs mailing list