diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-09-08 08:32:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-09-08 09:14:33 +0300 |
commit | e467c54d58c88316d959f2481dc7484037a4c0be (patch) | |
tree | 4cdf31ed7bac3efeef7f75075920cb23adfaee16 /source/blender/python | |
parent | 48690d967a7731367cda01ab8dca64e7f4c3f6b5 (diff) |
Refactor: move library linking arguments into a parameter struct
Move arguments to BLO_library_link_{begin/named_part/end} into
a single parameter struct, to ensure arguments always match.
This allows is to skip tagging ID's LIB_TAG_DOIT when it's not needed,
previously it was always cleared just in case it was needed.
This also makes it possible to remove BLO_library_link_named_part_ex
which was only used when tagging was needed.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_library_load.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c index bdad4d03ae7..a3750d348f5 100644 --- a/source/blender/python/intern/bpy_library_load.c +++ b/source/blender/python/intern/bpy_library_load.c @@ -327,7 +327,10 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true); /* here appending/linking starts */ - mainl = BLO_library_link_begin(bmain, &(self->blo_handle), self->relpath); + struct LibraryLink_Params liblink_params; + BLO_library_link_params_init(&liblink_params, bmain, self->flag); + + mainl = BLO_library_link_begin(&(self->blo_handle), self->relpath, &liblink_params); { int idcode_step = 0, idcode; @@ -350,7 +353,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) if (item_idname) { ID *id = BLO_library_link_named_part( - mainl, &(self->blo_handle), idcode, item_idname); + mainl, &(self->blo_handle), idcode, item_idname, &liblink_params); if (id) { #ifdef USE_RNA_DATABLOCKS /* swap name for pointer to the id */ @@ -394,7 +397,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) } Library *lib = mainl->curlib; /* newly added lib, assign before append end */ - BLO_library_link_end(mainl, &(self->blo_handle), self->flag, NULL, NULL, NULL, NULL); + BLO_library_link_end(mainl, &(self->blo_handle), &liblink_params); BLO_blendhandle_close(self->blo_handle); self->blo_handle = NULL; |