[Bf-blender-cvs] [1b75f74] lib-link-rework-temp: We do not require anymore linking datablocks grouped by types, makes code even simpler.
Bastien Montagne
noreply at git.blender.org
Tue Sep 22 09:59:44 CEST 2015
Commit: 1b75f7408656f8f6c9bebffe3bea9be32a719ac8
Author: Bastien Montagne
Date: Tue Sep 22 09:58:59 2015 +0200
Branches: lib-link-rework-temp
https://developer.blender.org/rB1b75f7408656f8f6c9bebffe3bea9be32a719ac8
We do not require anymore linking datablocks grouped by types, makes code even simpler.
===================================================================
M source/blender/windowmanager/intern/wm_operators.c
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 1597c1e..647e7af 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2685,7 +2685,6 @@ static void wm_link_do(
const int flag = lapp_data->flag;
- BLI_bitmap *done_items = BLI_BITMAP_NEW_ALLOCA(lapp_data->num_items);
LinkNode *liblink, *itemlink;
int lib_idx, item_idx;
@@ -2693,7 +2692,6 @@ static void wm_link_do(
for (lib_idx = 0, liblink = lapp_data->libraries.list; liblink; lib_idx++, liblink = liblink->next) {
char *libname = liblink->link;
- int idcode;
bh = BLO_blendhandle_from_file(libname, reports);
@@ -2716,39 +2714,22 @@ static void wm_link_do(
mainl->versionfile, mainl->subversionfile);
}
- /* For each lib file, we loop until we have (tried) to link all items belonging to that lib. */
- BLI_BITMAP_SET_ALL(done_items, false, lapp_data->num_items);
- while (true) {
- for (item_idx = 0, idcode = -1, itemlink = lapp_data->items.list;
- itemlink;
- item_idx++, itemlink = itemlink->next)
- {
- WMLinkAppendDataItem *item = itemlink->link;
- ID *new_id;
-
- if (BLI_BITMAP_TEST(done_items, item_idx) || !BLI_BITMAP_TEST(item->libraries, lib_idx)) {
- continue;
- }
- if (idcode == -1) {
- idcode = item->idcode;
- }
- else if (item->idcode != idcode) {
- continue;
- }
-
- BLI_BITMAP_ENABLE(done_items, item_idx);
-
- if ((new_id = BLO_library_link_named_part_ex(mainl, &bh, item->name, idcode, flag, scene, v3d))) {
- /* If the link is sucessful, clear item's libs 'todo' flags.
- * This avoids trying to link same item with other libraries to come. */
- BLI_BITMAP_SET_ALL(item->libraries, false, lapp_data->num_libraries);
- item->new_id = new_id;
- }
+ /* For each lib file, we try to link all items belonging to that lib,
+ * and tag those successful to not try to load them again with the other libs. */
+ for (item_idx = 0, itemlink = lapp_data->items.list; itemlink; item_idx++, itemlink = itemlink->next) {
+ WMLinkAppendDataItem *item = itemlink->link;
+ ID *new_id;
+ if (!BLI_BITMAP_TEST(item->libraries, lib_idx)) {
+ continue;
}
- if (idcode == -1) {
- /* We have handled all items for this library, so we are done with it. */
- break;
+
+ new_id = BLO_library_link_named_part_ex(mainl, &bh, item->name, item->idcode, flag, scene, v3d);
+ if (new_id) {
+ /* If the link is sucessful, clear item's libs 'todo' flags.
+ * This avoids trying to link same item with other libraries to come. */
+ BLI_BITMAP_SET_ALL(item->libraries, false, lapp_data->num_libraries);
+ item->new_id = new_id;
}
}
More information about the Bf-blender-cvs
mailing list