diff options
author | Bastien Montagne <bastien@blender.org> | 2021-03-05 11:12:40 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-03-11 16:26:19 +0300 |
commit | 96064c3bb7d135ab69eb4a146c173dc4a36db1cc (patch) | |
tree | 1ba19429bf0d230b7d7cf48ca4037adbba5a6f70 | |
parent | 0a6ed7f0352dc0af7e189f5c59bd999d9e83fa30 (diff) |
LibOverride: Do not delete no-more-used overrides during resync if they are user-edited.
Ultimately those will be listed with a special icon in the upcomming
Outliner overrides view.
Part of T83811 & D10649.
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 40699f41275..95643773088 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -1001,11 +1001,23 @@ bool BKE_lib_override_library_resync(Main *bmain, Scene *scene, ViewLayer *view_ } id->tag &= ~LIB_TAG_DOIT; } - /* Also cleanup old overrides that went missing in new linked data. */ + /* Also deal with old overrides that went missing in new linked data. */ else if (id->tag & LIB_TAG_MISSING && !ID_IS_LINKED(id)) { BLI_assert(ID_IS_OVERRIDE_LIBRARY(id)); - id->tag |= LIB_TAG_DOIT; - id->tag &= ~LIB_TAG_MISSING; + if (!BKE_lib_override_library_is_user_edited(id)) { + /* If user never edited them, we can delete them. */ + id->tag |= LIB_TAG_DOIT; + id->tag &= ~LIB_TAG_MISSING; + printf("%s: Old override %s is being deleted.\n", __func__, id->name); + } + else { + /* Otherwise, keep them, user needs to decide whether what to do with them. */ + BLI_assert((id->tag & LIB_TAG_DOIT) == 0); + id_fake_user_set(id); + printf("%s: Old override %s is being kept around as it was user-edited.\n", + __func__, + id->name); + } } } FOREACH_MAIN_ID_END; |