[Bf-blender-cvs] [3bd892a74c8] master: LibOverride: Fix (unreported) assert when creating overrides of linked overrides.

Bastien Montagne noreply at git.blender.org
Sat Apr 10 18:38:51 CEST 2021


Commit: 3bd892a74c826597ee3ce21faf385599d6c6cd86
Author: Bastien Montagne
Date:   Sat Apr 10 15:25:58 2021 +0200
Branches: master
https://developer.blender.org/rB3bd892a74c826597ee3ce21faf385599d6c6cd86

LibOverride: Fix (unreported) assert when creating overrides of linked overrides.

We do not want to copy exiting overrides data from linked ID when
creating its local override (be it either a template, or because linked
ID is itself an override of another lib data).

Note that this was not a very serious issue, would just cause some memory
leak since override data is re-created on newly copied local data
anyway.

These use cases have been very little tested so far, but both complex
production pipeline and future restrictive workflow will make them fairly
common...

===================================================================

M	source/blender/blenkernel/intern/lib_override.c

===================================================================

diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index e42fab70af4..eac9e760ae5 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -196,7 +196,10 @@ void BKE_lib_override_library_free(struct IDOverrideLibrary **override, const bo
 
 static ID *lib_override_library_create_from(Main *bmain, ID *reference_id)
 {
-  ID *local_id = BKE_id_copy(bmain, reference_id);
+  /* Note: We do not want to copy possible override data from reference here (whether it is an
+   * override template, or aleady an override of some other ref data). */
+  ID *local_id = BKE_id_copy_ex(
+      bmain, reference_id, NULL, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_NO_LIB_OVERRIDE);
 
   if (local_id == NULL) {
     return NULL;



More information about the Bf-blender-cvs mailing list