BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, true);
/* here appending/linking starts */
- mainl = BLO_library_append_begin(bmain, &bh, libname);
+ mainl = BLO_library_link_begin(bmain, &bh, libname);
- BLO_library_append_all(mainl, bh);
+ BLO_library_link_all(mainl, bh);
- BLO_library_append_end(C, mainl, &bh, 0, 0);
+ BLO_library_link_end(C, mainl, &bh, 0, 0);
/* mark all library linked objects to be updated */
BKE_main_lib_objects_recalc_all(bmain);
* \param filepath Used for relative linking, copied to the lib->name
* \return the library Main, to be passed to BLO_library_append_named_part as mainl.
*/
-struct Main *BLO_library_append_begin(
+struct Main *BLO_library_link_begin(
struct Main *mainvar, BlendHandle **bh,
const char *filepath);
/**
- * Link/Append a named datablock from an external blend file.
+ * Link a named datablock from an external blend file.
*
* \param mainl The main database to link from (not the active one).
* \param bh The blender file handle.
* \param idcode The kind of datablock to link.
* \return the appended ID when found.
*/
-struct ID *BLO_library_append_named_part(
+struct ID *BLO_library_link_named_part(
struct Main *mainl, BlendHandle **bh,
const char *idname, const int idcode);
/**
- * Link/Append a named datablock from an external blend file.
- * optionally instance the object in the scene when the flags are set.
+ * Link a named datablock from an external blend file.
+ * optionally instantiate the object/group in the scene when the flags are set.
*
* \param C The context, when NULL instancing object in the scene isn't done.
* \param mainl The main database to link from (not the active one).
* \param flag Options for linking, used for instancing.
* \return the appended ID when found.
*/
-struct ID *BLO_library_append_named_part_ex(
+struct ID *BLO_library_link_named_part_ex(
const struct bContext *C, struct Main *mainl, BlendHandle **bh,
const char *idname, const int idcode, const short flag);
-void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag);
+void BLO_library_link_end(const struct bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag);
-void BLO_library_append_all(struct Main *mainl, BlendHandle *bh);
+void BLO_library_link_all(struct Main *mainl, BlendHandle *bh);
void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
{
Scene *sce;
- for (sce= mainvar->scene.first; sce; sce= sce->id.next) {
- if (BKE_scene_base_find(sce, ob))
- return 1;
+ for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
+ if (BKE_scene_base_find(sce, ob)) {
+ return true;
+ }
}
- return 0;
+ return false;
}
static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const short idcode, const bool is_link, const short active_lay)
/* returns true if the item was found
* but it may already have already been appended/linked */
-static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, const short idcode)
+static ID *link_named_part(Main *mainl, FileData *fd, const char *idname, const short idcode)
{
BHead *bhead = find_bhead_from_code_name(fd, idcode, idname);
ID *id;
}
/* simple reader for copy/paste buffers */
-void BLO_library_append_all(Main *mainl, BlendHandle *bh)
+void BLO_library_link_all(Main *mainl, BlendHandle *bh)
{
FileData *fd = (FileData *)(bh);
BHead *bhead;
}
-static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, const char *idname, const int idcode, const int flag)
+static ID *link_named_part_ex(const bContext *C, Main *mainl, FileData *fd, const char *idname, const int idcode, const int flag)
{
- ID *id= append_named_part(mainl, fd, idname, idcode);
+ ID *id = link_named_part(mainl, fd, idname, idcode);
if (id && (GS(id->name) == ID_OB)) { /* loose object: give a base */
Scene *scene = CTX_data_scene(C); /* can be NULL */
return id;
}
-ID *BLO_library_append_named_part(Main *mainl, BlendHandle **bh, const char *idname, const int idcode)
+ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const char *idname, const int idcode)
{
FileData *fd = (FileData*)(*bh);
- return append_named_part(mainl, fd, idname, idcode);
+ return link_named_part(mainl, fd, idname, idcode);
}
-ID *BLO_library_append_named_part_ex(const bContext *C, Main *mainl, BlendHandle **bh, const char *idname, const int idcode, const short flag)
+ID *BLO_library_link_named_part_ex(const bContext *C, Main *mainl, BlendHandle **bh, const char *idname, const int idcode, const short flag)
{
FileData *fd = (FileData*)(*bh);
- return append_named_part_ex(C, mainl, fd, idname, idcode, flag);
+ return link_named_part_ex(C, mainl, fd, idname, idcode, flag);
}
-static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **r_id)
+static void link_id_part(FileData *fd, Main *mainvar, ID *id, ID **r_id)
{
BHead *bhead = find_bhead_from_idname(fd, id->name);
/* common routine to append/link something from a library */
-static Main *library_append_begin(Main *mainvar, FileData **fd, const char *filepath)
+static Main *library_link_begin(Main *mainvar, FileData **fd, const char *filepath)
{
Main *mainl;
(*fd)->mainlist = MEM_callocN(sizeof(ListBase), "FileData.mainlist");
- /* clear for group instancing tag */
+ /* clear for group instantiating tag */
BKE_main_id_tag_listbase(&(mainvar->group), false);
/* make mains */
return mainl;
}
-Main *BLO_library_append_begin(Main *mainvar, BlendHandle **bh, const char *filepath)
+Main *BLO_library_link_begin(Main *mainvar, BlendHandle **bh, const char *filepath)
{
FileData *fd = (FileData*)(*bh);
- return library_append_begin(mainvar, &fd, filepath);
+ return library_link_begin(mainvar, &fd, filepath);
}
/* Context == NULL signifies not to do any scene manipulation */
-static void library_append_end(const bContext *C, Main *mainl, FileData **fd, int idcode, short flag)
+static void library_link_end(const bContext *C, Main *mainl, FileData **fd, int idcode, short flag)
{
Main *mainvar;
Library *curlib;
}
}
- /* clear group instancing tag */
+ /* clear group instantiating tag */
BKE_main_id_tag_listbase(&(mainvar->group), false);
/* has been removed... erm, why? s..ton) */
}
}
-void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag)
+void BLO_library_link_end(const bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag)
{
FileData *fd = (FileData*)(*bh);
- library_append_end(C, mainl, &fd, idcode, flag);
+ library_link_end(C, mainl, &fd, idcode, flag);
*bh = (BlendHandle*)fd;
}
ID *realid = NULL;
BLI_remlink(lbarray[a], id);
- append_id_part(fd, mainptr, id, &realid);
+ link_id_part(fd, mainptr, id, &realid);
if (!realid) {
blo_reportf_wrap(
fd->reports, RPT_WARNING,
BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, true);
/* here appending/linking starts */
- mainl = BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath);
+ mainl = BLO_library_link_begin(bmain, &(self->blo_handle), self->relpath);
{
int idcode_step = 0, idcode;
// printf(" %s\n", item_str);
if (item_str) {
- ID *id = BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, idcode);
+ ID *id = BLO_library_link_named_part(mainl, &(self->blo_handle), item_str, idcode);
if (id) {
#ifdef USE_RNA_DATABLOCKS
/* swap name for pointer to the id */
}
else {
Library *lib = mainl->curlib; /* newly added lib, assign before append end */
- BLO_library_append_end(NULL, mainl, &(self->blo_handle), 0, self->flag);
+ BLO_library_link_end(NULL, mainl, &(self->blo_handle), 0, self->flag);
BLO_blendhandle_close(self->blo_handle);
self->blo_handle = NULL;
}
/* here appending/linking starts */
- mainl = BLO_library_append_begin(bmain, &bh, libname);
+ mainl = BLO_library_link_begin(bmain, &bh, libname);
lib = mainl->curlib;
BLI_assert(lib);
}
if (name) {
- BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
+ BLO_library_link_named_part_ex(C, mainl, &bh, name, idcode, flag);
}
else {
if (is_first_run) {
curr_idcode = BKE_idcode_from_name(group);
if ((idcode == curr_idcode) && (BLI_path_cmp(curr_libname, libname) == 0)) {
- BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
+ BLO_library_link_named_part_ex(C, mainl, &bh, name, idcode, flag);
}
else if (is_first_run) {
BLI_join_dirfile(path, sizeof(path), curr_libname, group);
}
RNA_END;
}
- BLO_library_append_end(C, mainl, &bh, idcode, flag);
+ BLO_library_link_end(C, mainl, &bh, idcode, flag);
BLO_blendhandle_close(bh);
int i = 0;
LinkNode *n = names;
while (n) {
- BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, idcode);
+ BLO_library_link_named_part(main_tmp, &bpy_openlib, (char *)n->link, idcode);
n = (LinkNode *)n->next;
i++;
}
short flag = 0; /* don't need any special options */
/* created only for linking, then freed */
- Main *main_tmp = BLO_library_append_begin(main_newlib, &bpy_openlib, (char *)path);
+ Main *main_tmp = BLO_library_link_begin(main_newlib, &bpy_openlib, (char *)path);
load_datablocks(main_tmp, bpy_openlib, path, idcode);
load_datablocks(main_tmp, bpy_openlib, path, ID_AC);
}
- BLO_library_append_end(NULL, main_tmp, &bpy_openlib, idcode, flag);
+ BLO_library_link_end(NULL, main_tmp, &bpy_openlib, idcode, flag);
BLO_blendhandle_close(bpy_openlib);