diff options
author | Bastien Montagne <bastien@blender.org> | 2022-06-09 10:50:27 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-06-09 10:50:27 +0300 |
commit | a91c8d8efa414ddb775e0c2fb03a7cc034ec1c58 (patch) | |
tree | 2ac4f8ab021f7c4adefdf5501a3fa6af79a3912a /source/blender/editors/animation/anim_channels_edit.c | |
parent | 62dece5c86b7748345cc9573b788d2c07f7590cb (diff) |
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.
Diffstat (limited to 'source/blender/editors/animation/anim_channels_edit.c')
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 30 |
1 files changed, 26 insertions, 4 deletions
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); |