From 9580c377fe4ea6d60ac78953c0d7f844d5b14e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 15 Sep 2023 13:54:10 +0200 Subject: [PATCH] Cleanup: Anim, add some more comments to the bone collection system Add some TODOs and clarification in comments. No functional changes. --- source/blender/animrig/intern/bone_collections.cc | 2 ++ source/blender/editors/armature/editarmature_undo.cc | 2 ++ source/blender/makesrna/intern/rna_armature.cc | 2 ++ 3 files changed, 6 insertions(+) diff --git a/source/blender/animrig/intern/bone_collections.cc b/source/blender/animrig/intern/bone_collections.cc index ca520c53ce8..1950a3a81e2 100644 --- a/source/blender/animrig/intern/bone_collections.cc +++ b/source/blender/animrig/intern/bone_collections.cc @@ -371,6 +371,8 @@ bool ANIM_armature_bonecoll_unassign(BoneCollection *bcoll, Bone *bone) void ANIM_armature_bonecoll_unassign_all(Bone *bone) { LISTBASE_FOREACH_MUTABLE (BoneCollectionReference *, ref, &bone->runtime.collections) { + /* TODO: include Armature as parameter, and check that the bone collection to unassign from is + * actually editable. */ ANIM_armature_bonecoll_unassign(ref->bcoll, bone); } } diff --git a/source/blender/editors/armature/editarmature_undo.cc b/source/blender/editors/armature/editarmature_undo.cc index a6ba87f3ac9..16c44281ea6 100644 --- a/source/blender/editors/armature/editarmature_undo.cc +++ b/source/blender/editors/armature/editarmature_undo.cc @@ -100,6 +100,8 @@ static void undoarm_to_editarm(UndoArmature *uarm, bArmature *arm) auto bcoll_map = ANIM_bonecoll_listbase_copy_no_membership( &arm->collections, &uarm->bone_collections, true); + /* Always do a lookup-by-name and assignment. Even when the name of the active collection is + * still the same, the order may have changed and thus the index needs to be updated. */ BoneCollection *active_bcoll = ANIM_armature_bonecoll_get_by_name(arm, uarm->active_collection_name); ANIM_armature_bonecoll_active_set(arm, active_bcoll); diff --git a/source/blender/makesrna/intern/rna_armature.cc b/source/blender/makesrna/intern/rna_armature.cc index c1b80d31a3f..e5bed0ec3c9 100644 --- a/source/blender/makesrna/intern/rna_armature.cc +++ b/source/blender/makesrna/intern/rna_armature.cc @@ -1834,6 +1834,8 @@ static void rna_def_armature_collections(BlenderRNA *brna, PropertyRNA *cprop) prop = RNA_def_property(srna, "active_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, nullptr, "active_collection_name"); + /* TODO: For some reason the overrides system doesn't register a new operation when this property + * changes. Needs further investigation to figure out why & fix it. */ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Active Collection Name",