|
Blender
V2.93
|
#include "CLG_log.h"#include "BLI_utildefines.h"#include "DNA_collection_types.h"#include "DNA_object_types.h"#include "BKE_armature.h"#include "BKE_collection.h"#include "BKE_curve.h"#include "BKE_layer.h"#include "BKE_lib_id.h"#include "BKE_lib_query.h"#include "BKE_lib_remap.h"#include "BKE_main.h"#include "BKE_material.h"#include "BKE_mball.h"#include "BKE_modifier.h"#include "BKE_multires.h"#include "BKE_node.h"#include "BKE_object.h"#include "DEG_depsgraph.h"#include "DEG_depsgraph_build.h"#include "lib_intern.h"Go to the source code of this file.
Classes | |
| struct | IDRemap |
Typedefs | |
| typedef struct IDRemap | IDRemap |
Enumerations | |
| enum | { ID_REMAP_IS_LINKED_DIRECT = 1 << 0 , ID_REMAP_IS_USER_ONE_SKIPPED = 1 << 1 } |
Variables | |
| static CLG_LogRef | LOG = {.identifier = "bke.lib_remap"} |
| BKE_library_free_notifier_reference_cb | free_notifier_reference_cb = NULL |
| BKE_library_remap_editor_id_reference_cb | remap_editor_id_reference_cb = NULL |
Contains management of ID's for remapping.
Definition in file lib_remap.c.
| anonymous enum |
| Enumerator | |
|---|---|
| ID_REMAP_IS_LINKED_DIRECT | |
| ID_REMAP_IS_USER_ONE_SKIPPED | |
Definition at line 88 of file lib_remap.c.
| void BKE_libblock_relink_ex | ( | Main * | bmain, |
| void * | idv, | ||
| void * | old_idv, | ||
| void * | new_idv, | ||
| const short | remap_flags | ||
| ) |
Similar to libblock_remap, but only affects IDs used by given idv ID.
| old_idv | Unlike BKE_libblock_remap, can be NULL, in which case all ID usages by given idv will be cleared. |
| us_min_never_null | If true and new_id is NULL, 'NEVER_NULL' ID usages keep their old id, but this one still gets its user count decremented (needed when given idv is going to be deleted right after being unlinked). |
Definition at line 605 of file lib_remap.c.
References BLI_assert, DEG_relations_tag_update(), GS, id, ID_GR, ID_OB, ID_SCE, libblock_remap_data(), libblock_remap_data_postprocess_collection_update(), libblock_remap_data_postprocess_obdata_relink(), libblock_remap_data_postprocess_object_update(), ID::name, and NULL.
| void BKE_libblock_relink_to_newid | ( | ID * | id | ) |
Similar to #libblock_relink_ex, but is remapping IDs to their newid value if non-NULL, in given id.
Very specific usage, not sure we'll keep it on the long run, currently only used in Object/Collection duplication code...
Definition at line 702 of file lib_remap.c.
References BKE_library_foreach_ID_link(), ID_IS_LINKED, id_relink_to_newid_looper(), and NULL.
Referenced by BKE_collection_duplicate(), BKE_object_duplicate(), BKE_scene_duplicate(), copy_object_set_idnew(), ED_object_add_duplicate(), id_relink_to_newid_looper(), libblock_relink_collection(), make_object_duplilist_real(), and single_object_users().
| void BKE_libblock_remap | ( | Main * | bmain, |
| void * | old_idv, | ||
| void * | new_idv, | ||
| const short | remap_flags | ||
| ) |
Definition at line 557 of file lib_remap.c.
References BKE_libblock_remap_locked(), BKE_main_lock(), and BKE_main_unlock().
| void BKE_libblock_remap_locked | ( | Main * | bmain, |
| void * | old_idv, | ||
| void * | new_idv, | ||
| const short | remap_flags | ||
| ) |
Replace all references in given Main to old_id by new_id (if new_id is NULL, it unlinks old_id).
Definition at line 461 of file lib_remap.c.
References BKE_main_lock(), BKE_main_unlock(), BLI_assert, CLOG_ERROR, DEG_relations_tag_update(), ListBase::first, free_notifier_reference_cb, GS, ID_CU, ID_GR, ID_HA, ID_MB, ID_ME, ID_OB, ID_PT, ID_REMAP_IS_USER_ONE_SKIPPED, ID_REMAP_SKIP_USER_CLEAR, id_us_clear_real(), ID_VO, ID::lib, LIB_TAG_EXTERN, LIB_TAG_EXTRAUSER_SET, LIB_TAG_INDIRECT, libblock_remap_data(), libblock_remap_data_postprocess_collection_update(), libblock_remap_data_postprocess_nodetree_update(), libblock_remap_data_postprocess_obdata_relink(), libblock_remap_data_postprocess_object_update(), LOG, ID::name, NULL, Main::objects, remap_editor_id_reference_cb, IDRemap::skipped_direct, IDRemap::skipped_refcounted, IDRemap::status, ID::tag, and ID::us.
Referenced by BKE_libblock_remap(), and BKE_libblock_unlink().
| void BKE_libblock_unlink | ( | Main * | bmain, |
| void * | idv, | ||
| const bool | do_flag_never_null, | ||
| const bool | do_skip_indirect | ||
| ) |
Unlink given id from given bmain (does not touch to indirect, i.e. library, usages of the ID).
| do_flag_never_null | If true, all IDs using idv in a 'non-NULL' way are flagged by LIB_TAG_DOIT flag (quite obviously, 'non-NULL' usages can never be unlinked by this function). |
Definition at line 573 of file lib_remap.c.
References BKE_libblock_remap_locked(), BKE_main_lock(), BKE_main_unlock(), ID_REMAP_FLAG_NEVER_NULL_USAGE, ID_REMAP_SKIP_INDIRECT_USAGE, and NULL.
Referenced by BKE_id_free_us().
| void BKE_library_callback_free_notifier_reference_set | ( | BKE_library_free_notifier_reference_cb | func | ) |
Definition at line 54 of file lib_remap.c.
References free_notifier_reference_cb.
Referenced by WM_init().
| void BKE_library_callback_remap_editor_id_reference_set | ( | BKE_library_remap_editor_id_reference_cb | func | ) |
Definition at line 61 of file lib_remap.c.
References remap_editor_id_reference_cb.
Referenced by WM_init().
|
static |
Definition at line 94 of file lib_remap.c.
References BKE_object_is_in_editmode(), BLI_assert, IDRemap::bmain, LibraryIDLinkCallbackData::cb_flag, data, Object::data, DEG_id_tag_update_ex(), IDRemap::flag, ID::flag, GS, id, ID_OB, LibraryIDLinkCallbackData::id_owner, IDRemap::id_owner, LibraryIDLinkCallbackData::id_pointer, ID_RECALC_COPY_ON_WRITE, ID_RECALC_GEOMETRY, ID_RECALC_TRANSFORM, ID_REMAP_FLAG_NEVER_NULL_USAGE, ID_REMAP_FORCE_NEVER_NULL_USAGE, ID_REMAP_IS_LINKED_DIRECT, ID_REMAP_IS_USER_ONE_SKIPPED, ID_REMAP_SKIP_INDIRECT_USAGE, ID_REMAP_SKIP_NEVER_NULL_USAGE, ID_REMAP_SKIP_OVERRIDE_LIBRARY, LibraryIDLinkCallbackData::id_self, id_us_ensure_real(), id_us_min(), IDWALK_CB_EMBEDDED, IDWALK_CB_INDIRECT_USAGE, IDWALK_CB_NEVER_NULL, IDWALK_CB_NEVER_SELF, IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE, IDWALK_CB_USER, IDWALK_CB_USER_ONE, IDWALK_RET_NOP, ID::lib, LIB_EMBEDDED_DATA, LIB_TAG_DOIT, LIB_TAG_NO_MAIN, ID::name, IDRemap::new_id, NULL, IDRemap::old_id, Object::proxy, Object::proxy_from, IDRemap::skipped_direct, IDRemap::skipped_indirect, IDRemap::skipped_refcounted, IDRemap::status, ID::tag, ID::us, and LibraryIDLinkCallbackData::user_data.
Referenced by blender::deg::deg_expand_copy_on_write_datablock(), and libblock_remap_data().
|
static |
Definition at line 671 of file lib_remap.c.
References BKE_libblock_relink_to_newid(), BKE_library_update_ID_link_user(), LibraryIDLinkCallbackData::cb_flag, id, LibraryIDLinkCallbackData::id_pointer, IDWALK_CB_EMBEDDED, IDWALK_RET_NOP, LIB_TAG_NEW, ID::newid, and ID::tag.
Referenced by BKE_libblock_relink_to_newid().
|
static |
Execute the 'data' part of the remapping (that is, all ID pointers from other ID data-blocks).
Behavior differs depending on whether given id is NULL or not:
| bmain | the Main data storage to operate on (must never be NULL). |
| id | the data-block to operate on (can be NULL, in which case we operate over all IDs from given bmain). |
| old_id | the data-block to dereference (may be NULL if id is non-NULL). |
| new_id | the new data-block to replace old_id references with (may be NULL). |
| r_id_remap_data | if non-NULL, the IDRemap struct to use (uselful to retrieve info about remapping process). |
Definition at line 373 of file lib_remap.c.
References BKE_library_foreach_ID_link(), BKE_library_id_can_use_idtype(), IDRemap::bmain, foreach_libblock_remap_callback(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, GS, id, id_fake_user_clear(), id_fake_user_set(), ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS, ID_REMAP_IS_LINKED_DIRECT, ID_REMAP_NO_INDIRECT_PROXY_DATA_USAGE, ID_REMAP_SKIP_USER_CLEAR, id_us_clear_real(), IDWALK_DO_INTERNAL_RUNTIME_POINTERS, IDWALK_NO_INDIRECT_PROXY_DATA_USAGE, IDWALK_NOP, ID::lib, LIB_FAKEUSER, LIB_INDIRECT_WEAK_LINK, LIB_TAG_EXTERN, LIB_TAG_INDIRECT, libblock_remap_data_preprocess(), ID::name, and NULL.
Referenced by BKE_libblock_relink_ex(), and BKE_libblock_remap_locked().
|
static |
Definition at line 305 of file lib_remap.c.
References BKE_collections_child_remove_nulls(), BKE_main_collection_sync_remap(), BKE_main_collections_parent_relations_rebuild(), and NULL.
Referenced by BKE_libblock_relink_ex(), and BKE_libblock_remap_locked().
Definition at line 344 of file lib_remap.c.
References ntreeUpdateAllUsers().
Referenced by BKE_libblock_remap_locked().
|
static |
Definition at line 326 of file lib_remap.c.
References BKE_curve_type_test(), BKE_modifiers_test_object(), BKE_object_materials_test(), Object::data, GS, ID_CU, ID_ME, multires_force_sculpt_rebuild(), and ID::name.
Referenced by BKE_libblock_relink_ex(), and BKE_libblock_remap_locked().
|
static |
Can be called with both old_ob and new_ob being NULL, this means we have to check whole Main database then.
Definition at line 273 of file lib_remap.c.
References BKE_collections_object_remove_nulls(), BKE_main_collection_sync_remap(), BKE_mball_is_basis(), BKE_mball_is_basis_for(), DEG_id_tag_update(), ListBase::first, ID_RECALC_GEOMETRY, NULL, OB_MBALL, and Main::objects.
Referenced by BKE_libblock_relink_ex(), and BKE_libblock_remap_locked().
|
static |
Definition at line 241 of file lib_remap.c.
References BKE_pose_clear_pointers(), BLI_assert, Object::data, bPose::flag, GS, ID_AR, ID_OB, IDRemap::id_owner, if(), ID::name, OB_ARMATURE, IDRemap::old_id, Object::pose, POSE_RECALC, and Object::type.
Referenced by libblock_remap_data().
| BKE_library_free_notifier_reference_cb free_notifier_reference_cb = NULL |
Definition at line 52 of file lib_remap.c.
Referenced by BKE_id_free_ex(), BKE_libblock_remap_locked(), and BKE_library_callback_free_notifier_reference_set().
|
static |
Definition at line 50 of file lib_remap.c.
Referenced by BKE_libblock_remap_locked().
| BKE_library_remap_editor_id_reference_cb remap_editor_id_reference_cb = NULL |
Definition at line 59 of file lib_remap.c.
Referenced by BKE_id_free_ex(), BKE_libblock_remap_locked(), and BKE_library_callback_remap_editor_id_reference_set().