Blender
V3.3
|
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#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_ghash.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
#include "BLO_readfile.h"
#include "BKE_armature.h"
#include "BKE_blendfile_link_append.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_lib_override.h"
#include "BKE_lib_query.h"
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_rigidbody.h"
#include "BKE_scene.h"
#include "BKE_idtype.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "IMB_colormanagement.h"
#include "ED_datafiles.h"
#include "ED_screen.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "wm_files.h"
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 *UNUSED(event)) |
static int | wm_link_append_flag (wmOperator *op) |
static bool | wm_link_append_item_poll (ReportList *reports, const char *path, 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 ID * | wm_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) |
ID * | WM_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) |
ID * | WM_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 *UNUSED(event)) |
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"} |
Functions for dealing with append/link operators and helpers.
Definition in file wm_files_link.c.
ID* WM_file_append_datablock | ( | struct Main * | bmain, |
struct Scene * | scene, | ||
struct ViewLayer * | view_layer, | ||
struct View3D * | v3d, | ||
const char * | filepath, | ||
short | id_code, | ||
const char * | id_name, | ||
int | flag | ||
) |
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 554 of file wm_files_link.c.
References BLI_assert, FILE_LINK, id, id_name(), scene, and wm_file_link_append_datablock_ex().
Referenced by WM_drag_asset_id_import(), and workspace_append_activate_exec().
|
static |
Definition at line 497 of file wm_files_link.c.
References BKE_blendfile_append(), BKE_blendfile_link(), BKE_blendfile_link_append_context_embedded_blendfile_set(), BKE_blendfile_link_append_context_free(), BKE_blendfile_link_append_context_item_add(), BKE_blendfile_link_append_context_item_library_index_enable(), BKE_blendfile_link_append_context_item_newid_get(), BKE_blendfile_link_append_context_library_add(), BKE_blendfile_link_append_context_new(), BKE_main_id_tag_all(), BLO_library_link_params_init_with_context(), datatoc_startup_blend, datatoc_startup_blend_size, FILE_LINK, id, id_name(), LIB_TAG_PRE_EXISTING, NULL, and scene.
Referenced by WM_file_append_datablock(), and WM_file_link_datablock().
ID* WM_file_link_datablock | ( | struct Main * | bmain, |
struct Scene * | scene, | ||
struct ViewLayer * | view_layer, | ||
struct View3D * | v3d, | ||
const char * | filepath, | ||
short | id_code, | ||
const char * | id_name, | ||
int | flag | ||
) |
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 540 of file wm_files_link.c.
References FILE_LINK, id_name(), scene, and wm_file_link_append_datablock_ex().
Referenced by WM_drag_asset_id_import().
void WM_lib_reload | ( | Library * | lib, |
bContext * | C, | ||
ReportList * | reports | ||
) |
Definition at line 602 of file wm_files_link.c.
References BKE_blendfile_library_relocate(), BKE_blendfile_link_append_context_free(), BKE_blendfile_link_append_context_library_add(), BKE_blendfile_link_append_context_new(), BKE_main_id_tag_all(), BKE_main_lib_objects_recalc_all(), BKE_reportf(), BLI_exists(), BLO_has_bfile_extension(), BLO_LIBLINK_FORCE_INDIRECT, BLO_LIBLINK_USE_PLACEHOLDERS, BLO_library_link_params_init_with_context(), C, CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), DEG_relations_tag_update(), IMB_colormanagement_check_file_config(), lib, LIB_TAG_PRE_EXISTING, NC_WINDOW, NULL, RPT_ERROR, and WM_event_add_notifier().
|
static |
Definition at line 821 of file wm_files_link.c.
References C, and wm_lib_relocate_exec_do().
Referenced by WM_OT_lib_reload().
|
static |
Definition at line 790 of file wm_files_link.c.
References C, and wm_lib_relocate_exec_do().
Referenced by WM_OT_lib_relocate().
|
static |
Definition at line 650 of file wm_files_link.c.
References BKE_blendfile_library_relocate(), BKE_blendfile_link_append_context_flag_set(), BKE_blendfile_link_append_context_free(), BKE_blendfile_link_append_context_library_add(), BKE_blendfile_link_append_context_new(), BKE_libblock_find_name(), BKE_main_blendfile_path(), BKE_main_id_tag_all(), BKE_main_lib_objects_recalc_all(), BKE_report(), BKE_reportf(), BLI_exists(), BLI_join_dirfile(), BLI_path_cmp, BLI_strncpy(), BLO_has_bfile_extension(), BLO_LIBLINK_FORCE_INDIRECT, BLO_LIBLINK_USE_PLACEHOLDERS, BLO_library_link_params_init_with_context(), C, CLOG_INFO, CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), DEG_relations_tag_update(), FILE_MAX, FILE_MAXDIR, FILE_RELPATH, G, ID_LI, IMB_colormanagement_check_file_config(), lib, LIB_TAG_PRE_EXISTING, LOG, MAX_NAME, NC_WINDOW, NULL, 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_ERROR_INVALID_INPUT, and WM_event_add_notifier().
Referenced by wm_lib_reload_exec(), and wm_lib_relocate_exec().
|
static |
Definition at line 576 of file wm_files_link.c.
References BKE_libblock_find_name(), BKE_reportf(), C, CTX_data_main(), ID_LI, lib, MAX_NAME, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, wmOperator::ptr, wmOperator::reports, RNA_string_get(), RNA_string_set(), RPT_ERROR_INVALID_INPUT, and WM_event_add_fileselect().
Referenced by WM_OT_lib_relocate().
|
static |
Definition at line 199 of file wm_files_link.c.
References BKE_blendfile_append(), BKE_blendfile_link(), BKE_blendfile_link_append_context_embedded_blendfile_set(), BKE_blendfile_link_append_context_free(), 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_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_ghash_free(), BLI_ghash_haskey(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_new(), BLI_ghashutil_strcmp(), BLI_ghashutil_strhash_p(), BLI_join_dirfile(), BLI_path_cmp, BLI_strdup(), BLI_strncpy(), BLO_LIBLINK_COLLECTION_INSTANCE, BLO_LIBLINK_OBDATA_INSTANCE, BLO_library_link_params_init_with_context(), BLO_library_path_explode(), C, 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, G, Scene::id, IMB_colormanagement_check_file_config(), ID::lib, LIB_TAG_PRE_EXISTING, MEM_freeN, ID::name, NC_WINDOW, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, POINTER_AS_INT, POINTER_FROM_INT, 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, scene, WM_event_add_notifier(), wm_link_append_flag(), and wm_link_append_item_poll().
Referenced by WM_OT_append(), and WM_OT_link().
|
static |
Definition at line 116 of file wm_files_link.c.
References BLO_LIBLINK_APPEND_LOCAL_ID_REUSE, BLO_LIBLINK_APPEND_RECURSIVE, BLO_LIBLINK_APPEND_SET_FAKEUSER, BLO_LIBLINK_COLLECTION_INSTANCE, BLO_LIBLINK_OBDATA_INSTANCE, FILE_ACTIVE_COLLECTION, FILE_AUTOSELECT, FILE_LINK, FILE_RELPATH, wmOperator::ptr, RNA_boolean_get(), RNA_property_boolean_get(), and RNA_struct_find_property().
Referenced by wm_link_append_exec().
|
static |
Definition at line 97 of file wm_files_link.c.
References BKE_main_blendfile_path_from_global(), BLI_path_parent_dir(), C, FILE_MAX, G, OPERATOR_RUNNING_MODAL, wmOperator::ptr, RNA_string_set(), RNA_struct_property_is_set(), STRNCPY, and WM_event_add_fileselect().
Referenced by WM_OT_append(), and WM_OT_link().
|
static |
Check if an item defined by name and group can be appended/linked.
reports | Optionally report an error when an item can't be appended/linked. |
Definition at line 160 of file wm_files_link.c.
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().
Definition at line 80 of file wm_files_link.c.
References C, CTX_data_edit_object(), and WM_operator_winactive().
Referenced by WM_OT_append(), and WM_OT_link().
|
static |
Definition at line 386 of file wm_files_link.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by WM_OT_append(), and WM_OT_link().
void WM_OT_append | ( | wmOperatorType * | ot | ) |
Definition at line 455 of file wm_files_link.c.
References wmOperatorType::description, wmOperatorType::exec, FILE_DEFAULTDISPLAY, FILE_LOADLIB, FILE_OPENFILE, FILE_SORT_DEFAULT, FILE_TYPE_BLENDER, FILE_TYPE_BLENDERLIB, FILE_TYPE_FOLDER, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), wmOperatorType::srna, WM_FILESEL_DIRECTORY, WM_FILESEL_FILENAME, WM_FILESEL_FILEPATH, WM_FILESEL_FILES, WM_FILESEL_SHOW_PROPS, wm_link_append_exec(), wm_link_append_invoke(), wm_link_append_poll(), wm_link_append_properties_common(), and WM_operator_properties_filesel().
Referenced by wm_operatortypes_register().
void WM_OT_lib_reload | ( | wmOperatorType * | ot | ) |
Definition at line 826 of file wm_files_link.c.
References wmOperatorType::description, wmOperatorType::exec, FILE_BLENDER, FILE_DEFAULTDISPLAY, FILE_OPENFILE, FILE_SORT_DEFAULT, FILE_TYPE_BLENDER, FILE_TYPE_FOLDER, wmOperatorType::flag, wmOperatorType::idname, MAX_NAME, wmOperatorType::name, NULL, OPTYPE_UNDO, ot, PROP_HIDDEN, RNA_def_property_flag(), RNA_def_string(), wmOperatorType::srna, WM_FILESEL_DIRECTORY, WM_FILESEL_FILENAME, WM_FILESEL_FILEPATH, WM_FILESEL_RELPATH, wm_lib_reload_exec(), and WM_operator_properties_filesel().
Referenced by wm_operatortypes_register().
void WM_OT_lib_relocate | ( | wmOperatorType * | ot | ) |
Definition at line 795 of file wm_files_link.c.
References wmOperatorType::description, wmOperatorType::exec, FILE_BLENDER, FILE_DEFAULTDISPLAY, FILE_OPENFILE, FILE_SORT_DEFAULT, FILE_TYPE_BLENDER, FILE_TYPE_FOLDER, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, MAX_NAME, wmOperatorType::name, NULL, OPTYPE_UNDO, ot, PROP_HIDDEN, RNA_def_property_flag(), RNA_def_string(), wmOperatorType::srna, WM_FILESEL_DIRECTORY, WM_FILESEL_FILENAME, WM_FILESEL_FILEPATH, WM_FILESEL_FILES, WM_FILESEL_RELPATH, wm_lib_relocate_exec(), wm_lib_relocate_invoke(), and WM_operator_properties_filesel().
Referenced by wm_operatortypes_register().
void WM_OT_link | ( | wmOperatorType * | ot | ) |
Definition at line 431 of file wm_files_link.c.
References wmOperatorType::description, wmOperatorType::exec, FILE_DEFAULTDISPLAY, FILE_LOADLIB, FILE_OPENFILE, FILE_SORT_DEFAULT, FILE_TYPE_BLENDER, FILE_TYPE_BLENDERLIB, FILE_TYPE_FOLDER, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, OPTYPE_UNDO, ot, wmOperatorType::poll, WM_FILESEL_DIRECTORY, WM_FILESEL_FILENAME, WM_FILESEL_FILEPATH, WM_FILESEL_FILES, WM_FILESEL_RELPATH, WM_FILESEL_SHOW_PROPS, wm_link_append_exec(), wm_link_append_invoke(), wm_link_append_poll(), wm_link_append_properties_common(), and WM_operator_properties_filesel().
Referenced by wm_operatortypes_register().
|
static |
Definition at line 74 of file wm_files_link.c.
Referenced by wm_lib_relocate_exec_do(), and wm_link_append_item_poll().