From 74ec37b70cbc8dc228f11d0796dbe68c24526b16 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 10 Jun 2020 16:43:25 +0200 Subject: Enable (deep) copy of overrides. This commit enables basic copy of overrides on generic ID level, as well as from (deep) copy operators for objects and collections. So e.g. if your linked overridden caracter is in a collection, you can now (from the outliner) Duplicate that override collection to get a new overriding copy of the character. We still need operators (new or modifying existing ones) to handle that from 3DView e.g. Note that deep copy code for objects/collections (and incidently animdata) had to be modified to avoid duplicating/making local IDs that remain linked ones being used by overrides ones. --- source/blender/blenkernel/intern/anim_data.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/anim_data.c') diff --git a/source/blender/blenkernel/intern/anim_data.c b/source/blender/blenkernel/intern/anim_data.c index 9ab4e5c028d..cbb34cbee30 100644 --- a/source/blender/blenkernel/intern/anim_data.c +++ b/source/blender/blenkernel/intern/anim_data.c @@ -381,14 +381,15 @@ bool BKE_animdata_copy_id(Main *bmain, ID *id_to, ID *id_from, const int flag) void BKE_animdata_copy_id_action(Main *bmain, ID *id, const bool set_newid) { + const bool is_id_liboverride = ID_IS_OVERRIDE_LIBRARY(id); AnimData *adt = BKE_animdata_from_id(id); if (adt) { - if (adt->action) { + if (adt->action && (!is_id_liboverride || !ID_IS_LINKED(adt->action))) { id_us_min((ID *)adt->action); adt->action = set_newid ? ID_NEW_SET(adt->action, BKE_action_copy(bmain, adt->action)) : BKE_action_copy(bmain, adt->action); } - if (adt->tmpact) { + if (adt->tmpact && (!is_id_liboverride || !ID_IS_LINKED(adt->tmpact))) { id_us_min((ID *)adt->tmpact); adt->tmpact = set_newid ? ID_NEW_SET(adt->tmpact, BKE_action_copy(bmain, adt->tmpact)) : BKE_action_copy(bmain, adt->tmpact); -- cgit v1.2.3