[Bf-blender-cvs] [13faefa] id-remap: Merge branch 'master' into id-remap
Bastien Montagne
noreply at git.blender.org
Mon Oct 12 21:02:18 CEST 2015
Commit: 13faefaf6a7a0b7987dd9d770f65a385eefcb94c
Author: Bastien Montagne
Date: Mon Oct 12 21:00:02 2015 +0200
Branches: id-remap
https://developer.blender.org/rB13faefaf6a7a0b7987dd9d770f65a385eefcb94c
Merge branch 'master' into id-remap
===================================================================
===================================================================
diff --cc source/blender/blenloader/BLO_readfile.h
index c8d9ac2,c203f65..c38a691
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@@ -250,18 -100,7 +100,8 @@@ struct ID *BLO_library_link_named_part(
struct ID *BLO_library_link_named_part_ex(
struct Main *mainl, BlendHandle **bh,
const char *idname, const int idcode, const short flag,
- struct Scene *scene, struct View3D *v3d, const bool use_placeholders, const bool force_indirect);
-
- /**
- * Finalize linking from a given .blend file (library).
- * Optionally instance the indirect 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 (WARNING! may be freed by this function!).
- * \param flag Options for linking, used for instancing.
- * \param scene The scene in which to instanciate objects/groups (if NULL, no instanciation is done).
- * \param v3d The active View3D (only to define active layers for instanced objects & groups, can be NULL).
- */
- struct Scene *scene, struct View3D *v3d);
++ struct Scene *scene, struct View3D *v3d,
++ const bool use_placeholders, const bool force_indirect);
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 1012470,470d45f..3faf9f2
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -9685,28 -9733,36 +9770,43 @@@ static ID *link_named_part_ex
ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const char *idname, const int idcode)
{
FileData *fd = (FileData*)(*bh);
- return link_named_part(mainl, fd, idname, idcode);
+ return link_named_part(mainl, fd, idname, idcode, false, false);
}
+ /**
+ * Link a named datablock from an external blend file.
+ * 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 idname The name of the datablock (without the 2 char ID prefix).
+ * \param idcode The kind of datablock to link.
+ * \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).
++ * \param use_placeholders If true, generate a placeholder (empty ID) if not found in current lib file.
++ * \param force_indirect If true, force loaded ID to be tagged as LIB_INDIRECT (used in reload context only).
+ * \return the appended ID when found.
+ */
ID *BLO_library_link_named_part_ex(
Main *mainl, BlendHandle **bh, const char *idname, const int idcode, const short flag,
- Scene *scene, View3D *v3d)
+ Scene *scene, View3D *v3d, const bool use_placeholders, const bool force_indirect)
{
FileData *fd = (FileData*)(*bh);
- return link_named_part_ex(mainl, fd, idname, idcode, flag, scene, v3d);
+ return link_named_part_ex(mainl, fd, idname, idcode, flag, scene, v3d, use_placeholders, force_indirect);
}
-static void link_id_part(FileData *fd, Main *mainvar, ID *id, ID **r_id)
+static void link_id_part(ReportList *reports, FileData *fd, Main *mainvar, ID *id, ID **r_id)
{
- BHead *bhead = find_bhead_from_idname(fd, id->name);
+ BHead *bhead = NULL;
+
+ if (fd) {
+ bhead = find_bhead_from_idname(fd, id->name);
+ }
+
+ id->flag &= ~LIB_READ;
if (bhead) {
- id->flag &= ~LIB_READ;
id->flag |= LIB_NEED_EXPAND;
// printf("read lib block %s\n", id->name);
read_libblock(fd, mainvar, bhead, id->flag, r_id);
More information about the Bf-blender-cvs
mailing list