Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/blender_copybuffer.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | bool BKE_copybuffer_read(Main *bmain_dst, const char *libname, ReportList *reports) | ||||
| BlendHandle *bh = BLO_blendhandle_from_file(libname, reports); | BlendHandle *bh = BLO_blendhandle_from_file(libname, reports); | ||||
| if (bh == NULL) { | if (bh == NULL) { | ||||
| /* Error reports will have been made by BLO_blendhandle_from_file(). */ | /* Error reports will have been made by BLO_blendhandle_from_file(). */ | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* Here appending/linking starts. */ | /* Here appending/linking starts. */ | ||||
| Main *mainl = BLO_library_link_begin(bmain_dst, &bh, libname); | Main *mainl = BLO_library_link_begin(bmain_dst, &bh, libname); | ||||
| BLO_library_link_copypaste(mainl, bh); | BLO_library_link_copypaste(mainl, bh); | ||||
| BLO_library_link_end(mainl, &bh, 0, NULL, NULL); | BLO_library_link_end(mainl, &bh, 0, NULL, NULL, NULL); | ||||
| /* Mark all library linked objects to be updated. */ | /* Mark all library linked objects to be updated. */ | ||||
| BKE_main_lib_objects_recalc_all(bmain_dst); | BKE_main_lib_objects_recalc_all(bmain_dst); | ||||
| IMB_colormanagement_check_file_config(bmain_dst); | IMB_colormanagement_check_file_config(bmain_dst); | ||||
| /* Append, rather than linking. */ | /* Append, rather than linking. */ | ||||
| Library *lib = BLI_findstring(&bmain_dst->library, libname, offsetof(Library, filepath)); | Library *lib = BLI_findstring(&bmain_dst->library, libname, offsetof(Library, filepath)); | ||||
| BKE_library_make_local(bmain_dst, lib, NULL, true, false); | BKE_library_make_local(bmain_dst, lib, NULL, true, false); | ||||
| /* Important we unset, otherwise these object wont | /* Important we unset, otherwise these object wont | ||||
| * link into other scenes from this blend file. | * link into other scenes from this blend file. | ||||
| Show All 30 Lines | bool BKE_copybuffer_paste(bContext *C, const char *libname, const short flag, ReportList *reports) | ||||
| * take extra care BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false) is called after! */ | * take extra care BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false) is called after! */ | ||||
| BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true); | BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true); | ||||
| /* here appending/linking starts */ | /* here appending/linking starts */ | ||||
| mainl = BLO_library_link_begin(bmain, &bh, libname); | mainl = BLO_library_link_begin(bmain, &bh, libname); | ||||
| BLO_library_link_copypaste(mainl, bh); | BLO_library_link_copypaste(mainl, bh); | ||||
| BLO_library_link_end(mainl, &bh, flag, scene, view_layer); | BLO_library_link_end(mainl, &bh, flag, bmain, scene, view_layer); | ||||
| /* mark all library linked objects to be updated */ | /* mark all library linked objects to be updated */ | ||||
| BKE_main_lib_objects_recalc_all(bmain); | BKE_main_lib_objects_recalc_all(bmain); | ||||
| IMB_colormanagement_check_file_config(bmain); | IMB_colormanagement_check_file_config(bmain); | ||||
| /* append, rather than linking */ | /* append, rather than linking */ | ||||
| lib = BLI_findstring(&bmain->library, libname, offsetof(Library, filepath)); | lib = BLI_findstring(&bmain->library, libname, offsetof(Library, filepath)); | ||||
| BKE_library_make_local(bmain, lib, NULL, true, false); | BKE_library_make_local(bmain, lib, NULL, true, false); | ||||
| Show All 19 Lines | |||||