[Bf-blender-cvs] [7681326acdd] master: IDManagement: Assign current Main's lib to newly created IDs.

Bastien Montagne noreply at git.blender.org
Thu Oct 21 15:22:40 CEST 2021


Commit: 7681326acdd66ecad9f85f57d1d14858b6223e51
Author: Bastien Montagne
Date:   Thu Oct 21 15:04:39 2021 +0200
Branches: master
https://developer.blender.org/rB7681326acdd66ecad9f85f57d1d14858b6223e51

IDManagement: Assign current Main's lib to newly created IDs.

This is mainly for doversion code, when it needs to create new IDs those
should be considered as part of the same library as the current Main's
one.

No practical changes are expected here, this is more of a general
consistency fix, and a pre-requisite for {T92333}.

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index 9e86ef0e3b7..bc0a8e2b9b8 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -1141,6 +1141,11 @@ void *BKE_libblock_alloc(Main *bmain, short type, const char *name, const int fl
       /* alphabetic insertion: is in new_id */
       BKE_main_unlock(bmain);
 
+      /* This is important in 'readfile doversion after liblink' context mainly, but is a good
+       * consistency change in general: ID created for a Main should get that main's current
+       * library pointer. */
+      id->lib = bmain->curlib;
+
       /* TODO: to be removed from here! */
       if ((flag & LIB_ID_CREATE_NO_DEG_TAG) == 0) {
         DEG_id_type_tag(bmain, type);



More information about the Bf-blender-cvs mailing list