[Bf-blender-cvs] [68d6b73fde5] master: Readfile: move all calls to 'id_us_ensure_real' to direct_link functions.

Bastien Montagne noreply at git.blender.org
Thu May 28 12:15:24 CEST 2020


Commit: 68d6b73fde5885b266e6c8ce742455a82a14aea2
Author: Bastien Montagne
Date:   Thu May 28 12:13:16 2020 +0200
Branches: master
https://developer.blender.org/rB68d6b73fde5885b266e6c8ce742455a82a14aea2

Readfile: move all calls to 'id_us_ensure_real' to direct_link functions.

That kind of 'own' ID management has really nothing to do in lib_link
code.

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

M	source/blender/blenloader/intern/readfile.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index e532ea17dca..d3c391a1595 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -691,7 +691,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
   /* Important, consistency with main ID reading code from read_libblock(). */
   lib->id.us = ID_FAKE_USERS(lib);
 
-  /* Matches lib_link_library(). */
+  /* Matches direct_link_library(). */
   id_us_ensure_real(&lib->id);
 
   BLI_strncpy(lib->name, filepath, sizeof(lib->name));
@@ -3581,8 +3581,6 @@ static void lib_link_workspaces(FileData *fd, Main *bmain, WorkSpace *workspace)
 {
   ID *id = (ID *)workspace;
 
-  id_us_ensure_real(id);
-
   LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout, &workspace->layouts) {
     layout->screen = newlibadr(fd, id->lib, layout->screen);
 
@@ -3631,6 +3629,8 @@ static void direct_link_workspace(FileData *fd, WorkSpace *workspace, const Main
   }
 
   workspace->status_text = NULL;
+
+  id_us_ensure_real(&workspace->id);
 }
 
 static void lib_link_workspace_instance_hook(FileData *fd, WorkSpaceInstanceHook *hook, ID *id)
@@ -8551,11 +8551,12 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
   newmain->curlib = lib;
 
   lib->parent = NULL;
+
+  id_us_ensure_real(&lib->id);
 }
 
-static void lib_link_library(FileData *UNUSED(fd), Main *UNUSED(bmain), Library *lib)
+static void lib_link_library(FileData *UNUSED(fd), Main *UNUSED(bmain), Library *UNUSED(lib))
 {
-  id_us_ensure_real(&lib->id);
 }
 
 /* Always call this once you have loaded new library data to set the relative paths correctly



More information about the Bf-blender-cvs mailing list