diff --git a/source/blender/blenkernel/intern/action.cc b/source/blender/blenkernel/intern/action.cc index f01f2e3b65e..66cb1efb669 100644 --- a/source/blender/blenkernel/intern/action.cc +++ b/source/blender/blenkernel/intern/action.cc @@ -486,7 +486,11 @@ static AssetTypeInfo AssetType_AC = { IDTypeInfo IDType_ID_AC = { /*id_code*/ ID_AC, /*id_filter*/ FILTER_ID_AC, + + /* This value will be set dynamically in `BKE_idtype_init()` to only include + * animatable ID types (see `animrig::Binding::users()`). */ /*dependencies_id_types*/ FILTER_ID_ALL, + /*main_listbase_index*/ INDEX_ID_AC, /*struct_size*/ sizeof(bAction), /*name*/ "Action", diff --git a/source/blender/blenkernel/intern/idtype.cc b/source/blender/blenkernel/intern/idtype.cc index 19a0ca20b46..d9c07fbc5ba 100644 --- a/source/blender/blenkernel/intern/idtype.cc +++ b/source/blender/blenkernel/intern/idtype.cc @@ -109,6 +109,18 @@ static void id_type_init() BLI_assert_msg(init_types_num == INDEX_ID_MAX, "Some IDTypeInfo initialization is missing"); UNUSED_VARS_NDEBUG(init_types_num); + { /* Inspect which ID types can be animated, so that IDType_ID_AC.dependencies_id_types can be + * set to include those. The runtime ID* cache of animrig::Binding will point to any + * ID that is animated by it, and thus can point to any animatable ID type. */ + IDType_ID_AC.dependencies_id_types = 0; + for (const IDTypeInfo *id_type : id_types) { + const bool is_animatable = (id_type->flags & IDTYPE_FLAGS_NO_ANIMDATA) == 0; + if (is_animatable) { + IDType_ID_AC.dependencies_id_types |= id_type->id_filter; + } + } + } + #undef INIT_TYPE }