BKE link/append: Add optional blendfile handle to libraries.

This enables calling code to deal with the blendfile handle themselves,
BKE_blendfile_link then just borrows, uses this handle and does not
release it.

Needed e.g. for python's libcontext system to use new
BKE_blendfile_link_append code.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
This commit is contained in:
Bastien Montagne 2021-11-10 11:24:59 +01:00
parent 6c8f73b220
commit 0452a04f1a
1 changed files with 3 additions and 0 deletions

View File

@ -277,6 +277,9 @@ void BKE_blendfile_link_append_context_library_add(BlendfileLinkAppendContext *l
BlendfileLinkAppendContextLibrary *lib_context = BLI_memarena_calloc(lapp_context->memarena,
sizeof(*lib_context));
BlendfileLinkAppendContextLibrary *ctx_lib = BLI_memarena_alloc(lapp_context->memarena,
sizeof(*ctx_lib));
size_t len = strlen(libname) + 1;
char *libpath = BLI_memarena_alloc(lapp_context->memarena, len);
BLI_strncpy(libpath, libname, len);