[Bf-blender-cvs] [06b3849] asset-engine: Merge branch 'master' into asset-engine
Bastien Montagne
noreply at git.blender.org
Thu Oct 15 17:13:35 CEST 2015
Commit: 06b38491f1780b7a34b801f28bbe7b08055f5f71
Author: Bastien Montagne
Date: Thu Oct 15 17:13:29 2015 +0200
Branches: asset-engine
https://developer.blender.org/rB06b38491f1780b7a34b801f28bbe7b08055f5f71
Merge branch 'master' into asset-engine
===================================================================
===================================================================
diff --cc source/blender/blenloader/BLO_readfile.h
index d121697,51b016a..dcf4b09
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@@ -98,15 -96,11 +98,15 @@@ bool BLO_has_bfile_extension(const cha
bool BLO_library_path_explode(const char *path, char *r_dir, char **r_group, char **r_name);
struct Main *BLO_library_link_begin(struct Main *mainvar, BlendHandle **bh, const char *filepath);
- struct ID *BLO_library_link_named_part(struct Main *mainl, BlendHandle **bh, const char *idname, const int idcode);
+ struct ID *BLO_library_link_named_part(struct Main *mainl, BlendHandle **bh, const short idcode, const char *name);
struct ID *BLO_library_link_named_part_ex(
struct Main *mainl, BlendHandle **bh,
- const char *idname, const int idcode, const short flag,
+ const short idcode, const char *name, const short flag,
struct Scene *scene, struct View3D *v3d);
+struct ID *BLO_library_link_named_part_asset(
+ struct Main *mainl, BlendHandle **bh, const struct AssetEngineType *aet,
- const char *idname, const int idcode, const struct AssetUUID *uuid, const short flag,
++ const short idcode, const char *name, const struct AssetUUID *uuid, const short flag,
+ struct Scene *scene, struct View3D *v3d);
void BLO_library_link_end(struct Main *mainl, BlendHandle **bh, short flag, struct Scene *scene, struct View3D *v3d);
void BLO_library_link_all(struct Main *mainl, BlendHandle *bh);
diff --cc source/blender/blenloader/intern/readfile.c
index 49796ca,2e79696..a322e99
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -9682,11 -9679,10 +9682,11 @@@ void BLO_library_link_all(Main *mainl,
}
static ID *link_named_part_ex(
- Main *mainl, FileData *fd, const short idcode, const char *name, const short flag,
+ Main *mainl, FileData *fd, const AssetEngineType *aet,
- const char *idname, const int idcode, const AssetUUID *uuid, const int flag,
++ const short idcode, const char *name, const AssetUUID *uuid, const int flag,
Scene *scene, View3D *v3d)
{
- ID *id = link_named_part(mainl, fd, idname, idcode);
+ ID *id = link_named_part(mainl, fd, idcode, name);
if (id && (GS(id->name) == ID_OB)) { /* loose object: give a base */
if (scene) {
@@@ -9758,31 -9755,7 +9759,31 @@@ ID *BLO_library_link_named_part_ex
Scene *scene, View3D *v3d)
{
FileData *fd = (FileData*)(*bh);
- return link_named_part_ex(mainl, fd, NULL, idname, idcode, NULL, flag, scene, v3d);
- return link_named_part_ex(mainl, fd, idcode, name, flag, scene, v3d);
++ return link_named_part_ex(mainl, fd, NULL, idcode, name, NULL, flag, scene, v3d);
+}
+
+/**
+ * Link a named datablock from an external blend file, using given asset engine & asset UUID.
+ * 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.
+ * \param aet The asset engine type (NULL when no asset engine is used).
- * \param idname The name of the datablock (without the 2 char ID prefix).
+ * \param idcode The kind of datablock to link.
++ * \param name The name of the datablock (without the 2 char ID prefix).
+ * \param uuid The asset engine's UUID of this datablock (NULL when no asset engine is used).
+ * \param flag Options for linking, used for instantiating.
+ * \param scene The scene in which to instantiate objects/groups (if NULL, no instantiation is done).
+ * \param v3d The active View3D (only to define active layers for instantiated objects & groups, can be NULL).
+ * \return the linked ID when found.
+ */
+struct ID *BLO_library_link_named_part_asset(
+ Main *mainl, BlendHandle **bh, const AssetEngineType *aet,
- const char *idname, const int idcode, const AssetUUID *uuid, const short flag,
++ const short idcode, const char *name, const AssetUUID *uuid, const short flag,
+ Scene *scene, View3D *v3d)
+{
+ FileData *fd = (FileData*)(*bh);
- return link_named_part_ex(mainl, fd, aet, idname, idcode, uuid, flag, scene, v3d);
++ return link_named_part_ex(mainl, fd, aet, idcode, name, uuid, flag, scene, v3d);
}
static void link_id_part(FileData *fd, Main *mainvar, ID *id, ID **r_id)
diff --cc source/blender/windowmanager/intern/wm_operators.c
index 513bbde,5c2e1f8..ae3f163
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@@ -2648,10 -2627,9 +2648,10 @@@ static short wm_link_append_flag(wmOper
}
typedef struct WMLinkAppendDataItem {
+ AssetUUID uuid;
char *name;
BLI_bitmap *libraries; /* All libs (from WMLinkAppendData.libraries) to try to load this ID from. */
- int idcode;
+ short idcode;
ID *new_id;
void *customdata;
@@@ -2697,7 -2675,7 +2697,7 @@@ static void wm_link_append_data_library
}
static WMLinkAppendDataItem *wm_link_append_data_item_add(
- WMLinkAppendData *lapp_data, const char *idname, const int idcode, const AssetUUID *uuid, void *customdata)
- WMLinkAppendData *lapp_data, const char *idname, const short idcode, void *customdata)
++ WMLinkAppendData *lapp_data, const char *idname, const short idcode, const AssetUUID *uuid, void *customdata)
{
WMLinkAppendDataItem *item = BLI_memarena_alloc(lapp_data->memarena, sizeof(*item));
size_t len = strlen(idname) + 1;
@@@ -2765,9 -2742,7 +2765,9 @@@ static void wm_link_do
continue;
}
- new_id = BLO_library_link_named_part_ex(mainl, &bh, item->idcode, item->name, flag, scene, v3d);
+ new_id = BLO_library_link_named_part_asset(
- mainl, &bh, aet, item->name, item->idcode, &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.
* This avoids trying to link same item with other libraries to come. */
More information about the Bf-blender-cvs
mailing list