From cf43477839035c19cce3d4bbccdf3e9759447ea7 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 14 Aug 2023 15:27:18 +0200 Subject: [PATCH] Fix #111067: NLA tracks cannot be renamed from Outliner Outliner `do_item_rename` has checks so linked or overridden IDs cannot be renamed. A `TreeStoreElem`s ID can point to other data than "real" IDs though (see how `outliner_add_element` casts to an ID from an arbitrary void pointer and cases marked `/* NO ID */` in code). In those cases, `ID_IS_LINKED` or `ID_IS_OVERRIDE_LIBRARY` _could_ return true and a the renaming operation would fail. Now also check if this is a real ID (`TSE_IS_REAL_ID`), so code can continue. Also add a proper notifier, so track renaming from the Outliner will update the NLA immediately. Pull Request: https://projects.blender.org/blender/blender/pulls/111110 --- source/blender/editors/space_outliner/outliner_draw.cc | 4 ++++ source/blender/editors/space_outliner/outliner_edit.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc index 5fcc87fc85b..714cca60c09 100644 --- a/source/blender/editors/space_outliner/outliner_draw.cc +++ b/source/blender/editors/space_outliner/outliner_draw.cc @@ -757,6 +757,10 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) DEG_id_tag_update(tselem->id, ID_RECALC_COPY_ON_WRITE); break; } + case TSE_NLA_TRACK: { + WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_RENAME, nullptr); + break; + } case TSE_EBONE: { bArmature *arm = (bArmature *)tselem->id; if (arm->edbo) { diff --git a/source/blender/editors/space_outliner/outliner_edit.cc b/source/blender/editors/space_outliner/outliner_edit.cc index 68c9eebe80b..8d085345b3c 100644 --- a/source/blender/editors/space_outliner/outliner_edit.cc +++ b/source/blender/editors/space_outliner/outliner_edit.cc @@ -336,10 +336,10 @@ static void do_item_rename(ARegion *region, else if (ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) { BKE_report(reports, RPT_WARNING, "Cannot edit sequence name"); } - else if (ID_IS_LINKED(tselem->id)) { + else if (TSE_IS_REAL_ID(tselem) && ID_IS_LINKED(tselem->id)) { BKE_report(reports, RPT_WARNING, "Cannot edit external library data"); } - else if (ID_IS_OVERRIDE_LIBRARY(tselem->id)) { + else if (TSE_IS_REAL_ID(tselem) && ID_IS_OVERRIDE_LIBRARY(tselem->id)) { BKE_report(reports, RPT_WARNING, "Cannot edit name of an override data-block"); } else if (outliner_is_collection_tree_element(te)) {