[Bf-blender-cvs] [0fa187e] asset-engine: Fix handling of asset uuid in WMLinkAppendDataItem helper struct.
Bastien Montagne
noreply at git.blender.org
Thu Jan 14 20:31:19 CET 2016
Commit: 0fa187e4b52a818ed9c973fc2e6b1d4e2124a52a
Author: Bastien Montagne
Date: Thu Jan 14 20:29:40 2016 +0100
Branches: asset-engine
https://developer.blender.org/rB0fa187e4b52a818ed9c973fc2e6b1d4e2124a52a
Fix handling of asset uuid in WMLinkAppendDataItem helper struct.
We need a pointer here (reduces mem footprint, and allows to say 'we have no uuid' with a NULL value!).
===================================================================
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 369bd89..14b8123 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2433,7 +2433,7 @@ static short wm_link_append_flag(wmOperator *op)
}
typedef struct WMLinkAppendDataItem {
- AssetUUID uuid;
+ AssetUUID *uuid;
char *name;
BLI_bitmap *libraries; /* All libs (from WMLinkAppendData.libraries) to try to load this ID from. */
short idcode;
@@ -2487,7 +2487,13 @@ static WMLinkAppendDataItem *wm_link_append_data_item_add(
WMLinkAppendDataItem *item = BLI_memarena_alloc(lapp_data->memarena, sizeof(*item));
size_t len = strlen(idname) + 1;
- item->uuid = *uuid;
+ if (uuid) {
+ item->uuid = BLI_memarena_alloc(lapp_data->memarena, sizeof(*item->uuid));
+ *item->uuid = *uuid;
+ }
+ else {
+ item->uuid = NULL;
+ }
item->name = BLI_memarena_alloc(lapp_data->memarena, len);
BLI_strncpy(item->name, idname, len);
item->idcode = idcode;
@@ -2551,7 +2557,7 @@ static void wm_link_do(
}
new_id = BLO_library_link_named_part_asset(
- mainl, &bh, aet, item->idcode, item->name, &item->uuid, flag, scene, v3d);
+ mainl, &bh, aet, item->idcode, item->name, item->uuid, flag, scene, v3d);
if (new_id) {
/* If the link is sucessful, clear item's libs 'todo' flags.
More information about the Bf-blender-cvs
mailing list