[Bf-blender-cvs] [f269067] master: Get rid of 'drivers unlinking' code in `BKE_libblock_free_data()`

Bastien Montagne noreply at git.blender.org
Tue Nov 15 17:08:13 CET 2016


Commit: f2690673ba4966542684d5b6f17d0fa329c33b82
Author: Bastien Montagne
Date:   Tue Nov 15 16:36:47 2016 +0100
Branches: master
https://developer.blender.org/rBf2690673ba4966542684d5b6f17d0fa329c33b82

Get rid of 'drivers unlinking' code in `BKE_libblock_free_data()`

This has nothing to do here (freeing is not unlinking/remapping!), and
was actually redoing something already taken care of by
`BKE_libblock_relink_ex()` call in `BKE_libblock_free_ex()`.

Also, gives some noticeable speedup when removing datablocks with
do_unlink=True, about 5 to 10% quicker e.g. when deleting all objects
from a py console, in a big production file...

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

M	source/blender/blenkernel/BKE_library.h
M	source/blender/blenkernel/intern/library_remap.c

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

diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index afe13b2..855eb10 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -68,7 +68,6 @@ void  BKE_libblock_free(struct Main *bmain, void *idv) ATTR_NONNULL();
 void  BKE_libblock_free_ex(struct Main *bmain, void *idv, const bool do_id_user, const bool do_ui_user) ATTR_NONNULL();
 void  BKE_libblock_free_us(struct Main *bmain, void *idv) ATTR_NONNULL();
 void  BKE_libblock_free_data(struct Main *bmain, struct ID *id) ATTR_NONNULL();
-void  BKE_libblock_free_data_ex(struct Main *bmain, struct ID *id, const bool do_id_user) ATTR_NONNULL();
 void  BKE_libblock_delete(struct Main *bmain, void *idv) ATTR_NONNULL();
 
 void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 4133342..4e5ece1 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -691,20 +691,10 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata
 
 void BKE_libblock_free_data(Main *bmain, ID *id)
 {
-	BKE_libblock_free_data_ex(bmain, id, true);
-}
-
-void BKE_libblock_free_data_ex(Main *bmain, ID *id, const bool do_id_user)
-{
 	if (id->properties) {
 		IDP_FreeProperty(id->properties);
 		MEM_freeN(id->properties);
 	}
-
-	if (do_id_user) {
-		/* this ID may be a driver target! */
-		BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id);
-	}
 }
 
 /**
@@ -852,7 +842,7 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user, const b
 
 	BLI_remlink(lb, id);
 
-	BKE_libblock_free_data_ex(bmain, id, do_id_user);
+	BKE_libblock_free_data(bmain, id);
 	BKE_main_unlock(bmain);
 
 	MEM_freeN(id);




More information about the Bf-blender-cvs mailing list