Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-12-04 15:09:13 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-12-04 15:09:13 +0300
commit0868a2b6109f974edcc11a35c9f1bbd0388a8864 (patch)
tree67779f45aa48a28efec618d083b631c6ef9f9764 /source/blender/blenloader/intern/readfile.c
parent5c2752380883d8f2e6655bd5397871f049ee8bbb (diff)
Cleanup: link/append: get rid of booleans in func parameters.
One or two are OK, but more make it rather unreadable, and future work is likely to require more toggle specific behavior here. So switched to bitflags, switching from short to int and using 16 upper bits for 'internal' ones defined in BLO_readfile.h, combined with 'public' ones from user interaction, defined in DNA_space_types.h
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index fb45fdc8136..caf58ba3f86 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10035,12 +10035,14 @@ static ID *create_placeholder(Main *mainvar, const short idcode, const char *idn
/* returns true if the item was found
* but it may already have already been appended/linked */
static ID *link_named_part(
- Main *mainl, FileData *fd, const short idcode, const char *name,
- const bool use_placeholders, const bool force_indirect)
+ Main *mainl, FileData *fd, const short idcode, const char *name, const int flag)
{
BHead *bhead = find_bhead_from_code_name(fd, idcode, name);
ID *id;
+ const bool use_placeholders = (flag & BLO_LIBLINK_USE_PLACEHOLDERS) != 0;
+ const bool force_indirect = (flag & BLO_LIBLINK_FORCE_INDIRECT) != 0;
+
BLI_assert(BKE_idcode_is_linkable(idcode) && BKE_idcode_is_valid(idcode));
if (bhead) {
@@ -10080,7 +10082,7 @@ static ID *link_named_part(
return id;
}
-static void link_object_postprocess(ID *id, Scene *scene, View3D *v3d, const short flag)
+static void link_object_postprocess(ID *id, Scene *scene, View3D *v3d, const int flag)
{
if (scene) {
Base *base;
@@ -10146,10 +10148,10 @@ void BLO_library_link_copypaste(Main *mainl, BlendHandle *bh)
}
static ID *link_named_part_ex(
- Main *mainl, FileData *fd, const short idcode, const char *name, const short flag,
- Scene *scene, View3D *v3d, const bool use_placeholders, const bool force_indirect)
+ Main *mainl, FileData *fd, const short idcode, const char *name, const int flag,
+ Scene *scene, View3D *v3d)
{
- ID *id = link_named_part(mainl, fd, idcode, name, use_placeholders, force_indirect);
+ ID *id = link_named_part(mainl, fd, idcode, name, flag);
if (id && (GS(id->name) == ID_OB)) { /* loose object: give a base */
link_object_postprocess(id, scene, v3d, flag);
@@ -10175,7 +10177,7 @@ static ID *link_named_part_ex(
ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const short idcode, const char *name)
{
FileData *fd = (FileData*)(*bh);
- return link_named_part(mainl, fd, idcode, name, false, false);
+ return link_named_part(mainl, fd, idcode, name, 0);
}
/**
@@ -10189,18 +10191,15 @@ ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const short idcod
* \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_TAG_INDIRECT (used in reload context only).
* \return the linked ID when found.
*/
ID *BLO_library_link_named_part_ex(
Main *mainl, BlendHandle **bh,
- const short idcode, const char *name, const short flag,
- Scene *scene, View3D *v3d,
- const bool use_placeholders, const bool force_indirect)
+ const short idcode, const char *name, const int flag,
+ Scene *scene, View3D *v3d)
{
FileData *fd = (FileData*)(*bh);
- return link_named_part_ex(mainl, fd, idcode, name, flag, scene, v3d, use_placeholders, force_indirect);
+ return link_named_part_ex(mainl, fd, idcode, name, flag, scene, v3d);
}
static void link_id_part(ReportList *reports, FileData *fd, Main *mainvar, ID *id, ID **r_id)