Blender  V3.3
blender_copybuffer.c File Reference
#include <stdlib.h>
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "IMB_imbuf.h"
#include "IMB_moviecache.h"
#include "BKE_blender_copybuffer.h"
#include "BKE_blendfile.h"
#include "BKE_blendfile_link_append.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "BLO_readfile.h"
#include "BLO_writefile.h"
#include "IMB_colormanagement.h"

Go to the source code of this file.

Functions

Copy/Paste <tt>.blend</tt>, partial saves.
void BKE_copybuffer_copy_begin (Main *bmain_src)
 
void BKE_copybuffer_copy_tag_ID (ID *id)
 
bool BKE_copybuffer_copy_end (Main *bmain_src, const char *filename, ReportList *reports)
 
static void copybuffer_append (BlendfileLinkAppendContext *lapp_context, Main *bmain, ReportList *reports)
 
bool BKE_copybuffer_read (Main *bmain_dst, const char *libname, ReportList *reports, const uint64_t id_types_mask)
 
int BKE_copybuffer_paste (bContext *C, const char *libname, const int flag, ReportList *reports, const uint64_t id_types_mask)
 

Detailed Description

Used for copy/paste operator, (using a temporary file).

Definition in file blender_copybuffer.c.

Function Documentation

◆ BKE_copybuffer_copy_begin()

void BKE_copybuffer_copy_begin ( struct Main bmain_src)

Initialize a copy operation.

Definition at line 47 of file blender_copybuffer.c.

References BKE_blendfile_write_partial_begin().

Referenced by outliner_id_copy_exec(), pose_copy_exec(), and view3d_copybuffer_exec().

◆ BKE_copybuffer_copy_end()

bool BKE_copybuffer_copy_end ( struct Main bmain_src,
const char *  filename,
struct ReportList reports 
)

Finalize a copy operation into given .blend file 'buffer'.

Parameters
filenameFull path to the .blend file used as copy/paste buffer.
Returns
true on success, false otherwise.

Definition at line 57 of file blender_copybuffer.c.

References BKE_blendfile_write_partial(), BKE_blendfile_write_partial_end(), and BLO_WRITE_PATH_REMAP_RELATIVE.

Referenced by outliner_id_copy_exec(), pose_copy_exec(), and view3d_copybuffer_exec().

◆ BKE_copybuffer_copy_tag_ID()

void BKE_copybuffer_copy_tag_ID ( struct ID id)

Mark an ID to be copied. Should only be called after a call to BKE_copybuffer_copy_begin.

Definition at line 52 of file blender_copybuffer.c.

References BKE_blendfile_write_partial_tag_ID().

Referenced by outliner_id_copy_tag(), pose_copy_exec(), and view3d_copybuffer_exec().

◆ BKE_copybuffer_paste()

int BKE_copybuffer_paste ( struct bContext C,
const char *  libname,
int  flag,
struct ReportList reports,
uint64_t  id_types_mask 
)

Paste data-blocks from the given .blend file 'buffer' (i.e. append them).

Similar to BKE_copybuffer_read, but also handles instantiation of collections/objects/etc.

Parameters
libnameFull path to the .blend file used as copy/paste buffer.
flagA combination of eBLOLibLinkFlags and #eFileSel_Params_Flag to control link/append behavior.
Note
Ignores FILE_LINK flag, since it always appends IDs.
Parameters
id_types_maskOnly directly link IDs of those types from the given .blend file buffer.
Returns
Number of IDs directly pasted from the buffer (does not includes indirectly linked ones).

Definition at line 123 of file blender_copybuffer.c.

References BKE_blendfile_link_append_context_free(), BKE_blendfile_link_append_context_item_idtypes_from_library_add(), BKE_blendfile_link_append_context_library_add(), BKE_blendfile_link_append_context_new(), BKE_view_layer_base_deselect_all(), BLENDFILE_LINK_APPEND_INVALID, BLI_assert, BLO_LIBLINK_APPEND_RECURSIVE, BLO_library_link_params_init_with_context(), LibraryLink_Params::bmain, C, copybuffer_append(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_view3d(), LibraryLink_Params::flag, LibraryLink_Params::id_tag_extra, NULL, scene, LibraryLink_Params::v3d, and LibraryLink_Params::view_layer.

Referenced by outliner_id_paste_exec(), and view3d_pastebuffer_exec().

◆ BKE_copybuffer_read()

bool BKE_copybuffer_read ( struct Main bmain_dst,
const char *  libname,
struct ReportList reports,
uint64_t  id_types_mask 
)

Paste data-blocks from the given .blend file 'buffer' (i.e. append them).

Unlike BKE_copybuffer_paste, it does not perform any instantiation of collections/objects/etc.

Parameters
libnameFull path to the .blend file used as copy/paste buffer.
id_types_maskOnly directly link IDs of those types from the given .blend file buffer.
Returns
true on success, false otherwise.

Definition at line 94 of file blender_copybuffer.c.

References BKE_blendfile_link_append_context_free(), BKE_blendfile_link_append_context_item_idtypes_from_library_add(), BKE_blendfile_link_append_context_library_add(), BKE_blendfile_link_append_context_new(), BLENDFILE_LINK_APPEND_INVALID, BLO_library_link_params_init(), copybuffer_append(), LibraryLink_Params::flag, LibraryLink_Params::id_tag_extra, and NULL.

Referenced by pose_paste_exec().

◆ copybuffer_append()

static void copybuffer_append ( BlendfileLinkAppendContext lapp_context,
Main bmain,
ReportList reports 
)
static