LibLink: Modify WM API to link/append one ID to take flag parameter.

There is no reason to lock behavior into a specific configuration in
those calls, make them properly configurable like the rest of the
link/append code.

This also enable users of those functions to activate 'ID reuse'
behavior.
This commit is contained in:
2021-09-23 13:46:55 +02:00
parent aadb7ef071
commit 4d2ca33a8a
4 changed files with 28 additions and 12 deletions

View File

@@ -43,6 +43,8 @@
#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BLO_readfile.h"
#include "GPU_shader.h"
#include "GPU_state.h"
#include "GPU_viewport.h"
@@ -392,9 +394,10 @@ static ID *wm_drag_asset_id_import(wmDragAsset *asset_drag)
switch ((eFileAssetImportType)asset_drag->import_type) {
case FILE_ASSET_IMPORT_LINK:
return WM_file_link_datablock(G_MAIN, NULL, NULL, NULL, asset_drag->path, idtype, name);
return WM_file_link_datablock(G_MAIN, NULL, NULL, NULL, asset_drag->path, idtype, name, 0);
case FILE_ASSET_IMPORT_APPEND:
return WM_file_append_datablock(G_MAIN, NULL, NULL, NULL, asset_drag->path, idtype, name);
return WM_file_append_datablock(
G_MAIN, NULL, NULL, NULL, asset_drag->path, idtype, name, BLO_LIBLINK_APPEND_RECURSIVE);
}
BLI_assert_unreachable();