Link/Append: Move most of core link/append code from WM to new `BKE_blendflie_link_append` module.

This will allow to expose all those advanced features of the WM
operators to other parts of the code, like the python library context
manager, copy/paste code, etc.

This is expected to be a strictly no-behavioral-change commit.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.

Maniphest Tasks: T91414

Differential Revision: https://developer.blender.org/D13222
This commit is contained in:
Bastien Montagne 2021-11-02 14:47:21 +01:00
parent 9c2a4d158c
commit fe274d91a1
Notes: blender-bot 2023-02-13 17:41:17 +01:00
Referenced by issue #91414, Unify link/append between WM operators and BPY context manager API, and cleanup usages of `BKE_library_make_local`
4 changed files with 1468 additions and 1160 deletions

View File

@ -0,0 +1,91 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
/** \file
* \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
struct ID;
struct Library;
struct Main;
struct ReportList;
struct Scene;
struct ViewLayer;
struct View3D;
typedef struct BlendfileLinkAppendContext BlendfileLinkAppendContext;
typedef struct BlendfileLinkAppendContextItem BlendfileLinkAppendContextItem;
BlendfileLinkAppendContext *BKE_blendfile_link_append_context_new(const int flag);
void BKE_blendfile_link_append_context_free(struct BlendfileLinkAppendContext *lapp_context);
void BKE_blendfile_link_append_context_flag_set(struct BlendfileLinkAppendContext *lapp_context,
const int flag,
const bool do_set);
void BKE_blendfile_link_append_context_embedded_blendfile_set(
struct BlendfileLinkAppendContext *lapp_context,
const void *blendfile_mem,
int blendfile_memsize);
void BKE_blendfile_link_append_context_embedded_blendfile_clear(
struct BlendfileLinkAppendContext *lapp_context);
void BKE_blendfile_link_append_context_library_add(struct BlendfileLinkAppendContext *lapp_context,
const char *libname);
struct BlendfileLinkAppendContextItem *BKE_blendfile_link_append_context_item_add(
struct BlendfileLinkAppendContext *lapp_context,
const char *idname,
const short idcode,
void *userdata);
void BKE_blendfile_link_append_context_item_library_index_enable(
struct BlendfileLinkAppendContext *lapp_context,
struct BlendfileLinkAppendContextItem *item,
const int library_index);
bool BKE_blendfile_link_append_context_is_empty(struct BlendfileLinkAppendContext *lapp_context);
void *BKE_blendfile_link_append_context_item_userdata_get(
struct BlendfileLinkAppendContext *lapp_context, struct BlendfileLinkAppendContextItem *item);
struct ID *BKE_blendfile_link_append_context_item_newid_get(
struct BlendfileLinkAppendContext *lapp_context, struct BlendfileLinkAppendContextItem *item);
void BKE_blendfile_append(struct BlendfileLinkAppendContext *lapp_context,
struct ReportList *reports,
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer,
const struct View3D *v3d);
void BKE_blendfile_link(struct BlendfileLinkAppendContext *lapp_context,
struct ReportList *reports,
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer,
const struct View3D *v3d);
void BKE_blendfile_library_relocate(struct BlendfileLinkAppendContext *lapp_context,
struct ReportList *reports,
struct Library *library,
const bool do_reload,
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer);
#ifdef __cplusplus
}
#endif

View File

@ -100,6 +100,7 @@ set(SRC
intern/blender_undo.c
intern/blender_user_menu.c
intern/blendfile.c
intern/blendfile_link_append.c
intern/boids.c
intern/bpath.c
intern/brush.c
@ -326,6 +327,7 @@ set(SRC
BKE_blender_user_menu.h
BKE_blender_version.h
BKE_blendfile.h
BKE_blendfile_link_append.h
BKE_boids.h
BKE_bpath.h
BKE_brush.h

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff