Blender V4.3
wm_files_link.cc File Reference
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <cstddef>
#include <cstdio>
#include <cstring>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_collection_types.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_map.hh"
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
#include "BLO_readfile.hh"
#include "BKE_armature.hh"
#include "BKE_blendfile.hh"
#include "BKE_blendfile_link_append.hh"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_override.hh"
#include "BKE_lib_query.hh"
#include "BKE_lib_remap.hh"
#include "BKE_main.hh"
#include "BKE_material.h"
#include "BKE_object.hh"
#include "BKE_report.hh"
#include "BKE_rigidbody.h"
#include "BKE_scene.hh"
#include "BKE_idtype.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"
#include "IMB_colormanagement.hh"
#include "ED_datafiles.h"
#include "ED_screen.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "wm_files.hh"

Go to the source code of this file.

Functions

Link/Append Operator
static bool wm_link_append_poll (bContext *C)
 
static int wm_link_append_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
static int wm_link_append_flag (wmOperator *op)
 
static bool wm_link_append_item_poll (ReportList *reports, const char *filepath, const char *group, const char *name, const bool do_append)
 
static int wm_link_append_exec (bContext *C, wmOperator *op)
 
static void wm_link_append_properties_common (wmOperatorType *ot, bool is_link)
 
void WM_OT_link (wmOperatorType *ot)
 
void WM_OT_append (wmOperatorType *ot)
 
Link/Append Single Data-Block & Return it
static IDwm_file_link_append_datablock_ex (Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const char *filepath, const short id_code, const char *id_name, const int flag)
 
IDWM_file_link_datablock (Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const char *filepath, const short id_code, const char *id_name, int flag)
 
IDWM_file_append_datablock (Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const char *filepath, const short id_code, const char *id_name, int flag)
 
Library Relocate Operator & Library Reload API
static int wm_lib_relocate_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void WM_lib_reload (Library *lib, bContext *C, ReportList *reports)
 
static int wm_lib_relocate_exec_do (bContext *C, wmOperator *op, bool do_reload)
 
static int wm_lib_relocate_exec (bContext *C, wmOperator *op)
 
void WM_OT_lib_relocate (wmOperatorType *ot)
 
static int wm_lib_reload_exec (bContext *C, wmOperator *op)
 
void WM_OT_lib_reload (wmOperatorType *ot)
 

Variables

static CLG_LogRef LOG = {"wm.files_link"}
 

Detailed Description

Functions for dealing with append/link operators and helpers.

Definition in file wm_files_link.cc.

Function Documentation

◆ WM_file_append_datablock()

ID * WM_file_append_datablock ( Main * bmain,
Scene * scene,
ViewLayer * view_layer,
View3D * v3d,
const char * filepath,
short id_code,
const char * id_name,
int flag )
Note
scene (and related view_layer and v3d) pointers may be NULL, in which case no instantiation of appended objects, collections etc. will be performed.

Definition at line 587 of file wm_files_link.cc.

References BLI_assert, FILE_LINK, flag, id_name(), and wm_file_link_append_datablock_ex().

Referenced by blender::ed::asset::asset_local_id_ensure_imported(), WM_drag_asset_id_import(), and workspace_append_activate_exec().

◆ wm_file_link_append_datablock_ex()

◆ WM_file_link_datablock()

ID * WM_file_link_datablock ( Main * bmain,
Scene * scene,
ViewLayer * view_layer,
View3D * v3d,
const char * filepath,
short id_code,
const char * id_name,
int flag )
Note
scene (and related view_layer and v3d) pointers may be NULL, in which case no instantiation of linked objects, collections etc. will be performed.

Definition at line 573 of file wm_files_link.cc.

References FILE_LINK, flag, id_name(), and wm_file_link_append_datablock_ex().

Referenced by blender::ed::asset::asset_local_id_ensure_imported(), and WM_drag_asset_id_import().

◆ WM_lib_reload()

◆ wm_lib_reload_exec()

static int wm_lib_reload_exec ( bContext * C,
wmOperator * op )
static

Definition at line 856 of file wm_files_link.cc.

References wm_lib_relocate_exec_do().

Referenced by WM_OT_lib_reload().

◆ wm_lib_relocate_exec()

static int wm_lib_relocate_exec ( bContext * C,
wmOperator * op )
static

Definition at line 825 of file wm_files_link.cc.

References wm_lib_relocate_exec_do().

Referenced by WM_OT_lib_relocate().

◆ wm_lib_relocate_exec_do()

◆ wm_lib_relocate_invoke()

◆ wm_link_append_exec()

static int wm_link_append_exec ( bContext * C,
wmOperator * op )
static

Definition at line 204 of file wm_files_link.cc.

References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BKE_blendfile_append(), BKE_blendfile_library_path_explode(), BKE_blendfile_link(), BKE_blendfile_link_append_context_embedded_blendfile_set(), BKE_blendfile_link_append_context_finalize(), BKE_blendfile_link_append_context_free(), BKE_blendfile_link_append_context_init_done(), BKE_blendfile_link_append_context_is_empty(), BKE_blendfile_link_append_context_item_add(), BKE_blendfile_link_append_context_item_library_index_enable(), BKE_blendfile_link_append_context_library_add(), BKE_blendfile_link_append_context_new(), BKE_blendfile_link_append_instantiate_loose(), BKE_idtype_idcode_from_name(), BKE_main_blendfile_path(), BKE_main_id_tag_all(), BKE_main_lib_objects_recalc_all(), BKE_reportf(), BKE_view_layer_base_deselect_all(), BLI_path_cmp, BLI_path_join, BLO_LIBLINK_COLLECTION_INSTANCE, BLO_LIBLINK_OBDATA_INSTANCE, BLO_library_link_params_init_with_context(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_view3d(), datatoc_startup_blend, datatoc_startup_blend_size, DEG_id_tag_update(), DEG_relations_tag_update(), FILE_LINK, FILE_MAX, FILE_MAX_LIBEXTRA, FILE_MAXDIR, flag, G, ID_TAG_PRE_EXISTING, IMB_colormanagement_check_file_config(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), NC_WINDOW, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, wmOperator::reports, RNA_BEGIN, RNA_boolean_get(), RNA_END, RNA_property_collection_length(), RNA_string_get(), RNA_struct_find_property(), RPT_ERROR, RPT_WARNING, STRNCPY, WM_event_add_notifier(), wm_link_append_flag(), and wm_link_append_item_poll().

Referenced by WM_OT_append(), and WM_OT_link().

◆ wm_link_append_flag()

◆ wm_link_append_invoke()

◆ wm_link_append_item_poll()

static bool wm_link_append_item_poll ( ReportList * reports,
const char * filepath,
const char * group,
const char * name,
const bool do_append )
static

Check if an item defined by name and group can be appended/linked.

Parameters
reportsOptionally report an error when an item can't be appended/linked.

Definition at line 164 of file wm_files_link.cc.

References BKE_idtype_idcode_from_name(), BKE_idtype_idcode_is_linkable(), BKE_idtype_idcode_is_only_appendable(), BKE_reportf(), CLOG_WARN, LOG, and RPT_ERROR_INVALID_INPUT.

Referenced by wm_link_append_exec().

◆ wm_link_append_poll()

static bool wm_link_append_poll ( bContext * C)
static

Definition at line 81 of file wm_files_link.cc.

References CTX_data_edit_object(), and WM_operator_winactive().

Referenced by WM_OT_append(), and WM_OT_link().

◆ wm_link_append_properties_common()

static void wm_link_append_properties_common ( wmOperatorType * ot,
bool is_link )
static

◆ WM_OT_append()

◆ WM_OT_lib_reload()

◆ WM_OT_lib_relocate()

◆ WM_OT_link()

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"wm.files_link"}
static

Definition at line 75 of file wm_files_link.cc.

Referenced by wm_lib_relocate_exec_do(), and wm_link_append_item_poll().