From fbb4a7eb434f57e03fd274b107b466919cdd049a Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 10 Nov 2021 11:24:59 +0100 Subject: 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`. --- source/blender/windowmanager/intern/wm_files_link.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_files_link.c') diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 7cb91bf4c0f..00ac1c2ffe6 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -309,7 +309,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) if (!BLI_ghash_haskey(libraries, libname)) { BLI_ghash_insert(libraries, BLI_strdup(libname), POINTER_FROM_INT(lib_idx)); lib_idx++; - BKE_blendfile_link_append_context_library_add(lapp_context, libname); + BKE_blendfile_link_append_context_library_add(lapp_context, libname, NULL); } } } @@ -341,7 +341,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) else { BlendfileLinkAppendContextItem *item; - BKE_blendfile_link_append_context_library_add(lapp_context, libname); + BKE_blendfile_link_append_context_library_add(lapp_context, libname, NULL); item = BKE_blendfile_link_append_context_item_add( lapp_context, name, BKE_idtype_idcode_from_name(group), NULL); BKE_blendfile_link_append_context_item_library_index_enable(lapp_context, item, 0); @@ -530,7 +530,7 @@ static ID *wm_file_link_append_datablock_ex(Main *bmain, BKE_blendfile_link_append_context_embedded_blendfile_set( lapp_context, datatoc_startup_blend, datatoc_startup_blend_size); - BKE_blendfile_link_append_context_library_add(lapp_context, filepath); + BKE_blendfile_link_append_context_library_add(lapp_context, filepath, NULL); BlendfileLinkAppendContextItem *item = BKE_blendfile_link_append_context_item_add( lapp_context, id_name, id_code, NULL); BKE_blendfile_link_append_context_item_library_index_enable(lapp_context, item, 0); @@ -651,7 +651,7 @@ void WM_lib_reload(Library *lib, bContext *C, ReportList *reports) BlendfileLinkAppendContext *lapp_context = BKE_blendfile_link_append_context_new(&lapp_params); - BKE_blendfile_link_append_context_library_add(lapp_context, lib->filepath_abs); + BKE_blendfile_link_append_context_library_add(lapp_context, lib->filepath_abs, NULL); BKE_blendfile_library_relocate(lapp_context, reports, lib, true); @@ -736,7 +736,7 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload) do_reload = true; lapp_context = BKE_blendfile_link_append_context_new(&lapp_params); - BKE_blendfile_link_append_context_library_add(lapp_context, path); + BKE_blendfile_link_append_context_library_add(lapp_context, path, NULL); } else { int totfiles = 0; @@ -769,13 +769,13 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload) } CLOG_INFO(&LOG, 4, "\tCandidate new lib to reload datablocks from: %s", path); - BKE_blendfile_link_append_context_library_add(lapp_context, path); + BKE_blendfile_link_append_context_library_add(lapp_context, path, NULL); } RNA_END; } else { CLOG_INFO(&LOG, 4, "\tCandidate new lib to reload datablocks from: %s", path); - BKE_blendfile_link_append_context_library_add(lapp_context, path); + BKE_blendfile_link_append_context_library_add(lapp_context, path, NULL); } } -- cgit v1.2.3