[Bf-blender-cvs] [59764d7f] lib-link-rework-temp: Remove some unused changes from master...

Bastien Montagne noreply at git.blender.org
Mon Oct 12 15:26:50 CEST 2015


Commit: 59764d7f611a5a9d0144a13a872d8938a4e31ed0
Author: Bastien Montagne
Date:   Mon Oct 12 15:26:17 2015 +0200
Branches: lib-link-rework-temp
https://developer.blender.org/rB59764d7f611a5a9d0144a13a872d8938a4e31ed0

Remove some unused changes from master...

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

M	source/blender/blenkernel/BKE_library.h
M	source/blender/blenkernel/intern/library.c
M	source/blender/blenloader/intern/readfile.c

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

diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index cf3f481..4fab910 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -49,7 +49,6 @@ struct bContext;
 struct PointerRNA;
 struct PropertyRNA;
 
-void *BKE_libblock_alloc_notest(short type);
 void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 void *BKE_libblock_copy_ex(struct Main *bmain, struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 void *BKE_libblock_copy_nolib(struct ID *id, const bool do_action) ATTR_NONNULL();
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 05617e2..d6b2a3c 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -648,7 +648,7 @@ int set_listbasepointers(Main *main, ListBase **lb)
  * Allocates and returns memory of the right size for the specified block type,
  * initialized to zero.
  */
-void *BKE_libblock_alloc_notest(short type)
+static ID *alloc_libblock_notest(short type)
 {
 	ID *id = NULL;
 	
@@ -770,7 +770,7 @@ void *BKE_libblock_alloc(Main *bmain, short type, const char *name)
 	ID *id = NULL;
 	ListBase *lb = which_libbase(bmain, type);
 	
-	id = BKE_libblock_alloc_notest(type);
+	id = alloc_libblock_notest(type);
 	if (id) {
 		BKE_main_lock(bmain);
 		BLI_addtail(lb, id);
@@ -838,7 +838,7 @@ void *BKE_libblock_copy_nolib(ID *id, const bool do_action)
 	ID *idn;
 	size_t idn_len;
 
-	idn = BKE_libblock_alloc_notest(GS(id->name));
+	idn = alloc_libblock_notest(GS(id->name));
 	assert(idn != NULL);
 
 	BLI_strncpy(idn->name, id->name, sizeof(idn->name));
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 809e6ad..470d45f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -619,21 +619,9 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
 	m = BKE_main_new();
 	BLI_addtail(mainlist, m);
 	
-	/* Adapted from BKE_libblock_alloc(), with no lock of main, it's most likely already locked by caller code. */
-	lib = BKE_libblock_alloc_notest(ID_LI);
-	{
-		/* Add library datablock itself to 'main' Main, since libraries are **never** linked data.
-		 * Fixes bug where you could end with all ID_LI datablocks having the same name... */
-		ListBase *libraries = &((Main *)mainlist->first)->library;
-		ID *id = (ID *)lib;
-
-		BLI_addtail(libraries, id);
-		id->us = 1;
-		id->icon_id = 0;
-		*((short *)id->name) = ID_LI;
-		new_id(libraries, id, "Lib");
-	}
-
+	/* Add library datablock itself to 'main' Main, since libraries are **never** linked data.
+	 * Fixes bug where you could end with all ID_LI datablocks having the same name... */
+	lib = BKE_libblock_alloc(mainlist->first, ID_LI, "Lib");
 	BLI_strncpy(lib->name, filepath, sizeof(lib->name));
 	BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath));
 	
@@ -9750,7 +9738,7 @@ ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const char *idnam
 
 /**
  * Link a named datablock from an external blend file.
- * optionally instantiate the object/group in the scene when the flags are set.
+ * Optionally instantiate the object/group in the scene when the flags are set.
  *
  * \param mainl The main database to link from (not the active one).
  * \param bh The blender file handle.




More information about the Bf-blender-cvs mailing list