70 const bool is_indirect,
71 const bool is_reference,
72 const bool violates_never_null,
74 const bool is_obj_editmode)
80 id->runtime.remap.skipped_indirect++;
82 else if (violates_never_null || is_obj_editmode || is_reference) {
83 id->runtime.remap.skipped_direct++;
90 id->runtime.remap.skipped_refcounted++;
102 const struct IDRemapper *mappings,
105 const bool is_indirect,
106 const bool violates_never_null,
107 const bool force_user_refcount)
109 ID *old_id = *id_ptr;
110 if (!violates_never_null) {
115 if (id_self != id_owner) {
123 ID *new_id = violates_never_null ?
NULL : *id_ptr;
145 if (!is_indirect && new_id) {
152 const int cb_flag = cb_data->
cb_flag;
173 struct IDRemapper *id_remapper = id_remap_data->
id_remapper;
191 id_remapper, *id_p, id_remapper_options, id_self);
193 if (
ELEM(expected_mapping_result,
197 "Cleanup should always do unassign.");
210 (expected_mapping_result ==
219 "In %s (lib %p): Remapping %s (%p) remap operation: %s "
220 "(is_indirect: %d, skip_indirect: %d, is_reference: %d, skip_reference: %d)\n",
239 if ((violates_never_null && skip_never_null) ||
240 (is_obj_editmode && (((
Object *)id_owner)->
data == *id_p) &&
242 (skip_indirect && is_indirect) || (is_reference && skip_reference)) {
262 force_user_refcount);
270 const struct IDRemapper *id_remapper)
303 const struct IDRemapper *id_remapper)
305 switch (
GS(id_owner->
name)) {
323 const bool do_sync_collection)
325 if (new_ob ==
NULL) {
337 if (do_sync_collection) {
341 if (old_ob ==
NULL) {
365 if (new_collection ==
NULL) {
384 if (ob->
data == new_id) {
385 switch (
GS(new_id->
name)) {
409 const int remap_flags = id_remap_data->
flag;
435 if (new_id !=
NULL) {
466 struct IDRemapper *id_remapper,
467 const
short remap_flags)
475 id_remap_data.
type = remap_type;
476 id_remap_data.
bmain = bmain;
478 id_remap_data.
flag = remap_flags;
484 printf(
"\tchecking id %s (%p, %p)\n",
id->
name,
id,
id->
lib);
531 const short remap_flags =
data->remap_flags;
552 if (old_id->
us - skipped_refcounted < 0) {
554 "Error in remapping process from '%s' (%p) to '%s' (%p): "
555 "wrong user count in old ID after process (summing up to %d)",
558 new_id ? new_id->
name :
"<NULL>",
560 old_id->
us - skipped_refcounted);
564 if (skipped_direct == 0) {
575 switch (
GS(old_id->
name)) {
615 struct IDRemapper *mappings,
616 const short remap_flags)
645 ID *old_id = old_idv;
646 ID *new_id = new_idv;
672 const bool do_flag_never_null,
673 const bool do_skip_indirect)
708 bool is_object_update_processed =
false;
709 for (
LinkNode *ln_iter = ids; ln_iter !=
NULL; ln_iter = ln_iter->next) {
710 ID *id_iter = ln_iter->link;
716 switch (
GS(id_iter->
name)) {
725 ((
Scene *)id_iter)->master_collection;
726 switch (
GS(old_id->
name)) {
728 if (!is_object_update_processed) {
731 is_object_update_processed =
true;
744 if (new_id !=
NULL) {
757 struct IDRemapper *id_remapper,
758 const short remap_flags)
762 for (
LinkNode *ln_iter = ids; ln_iter !=
NULL; ln_iter = ln_iter->next) {
763 ID *id_iter = ln_iter->link;
767 switch (remap_type) {
777 bool is_object_update_processed =
false;
778 for (
LinkNode *ln_iter = ids; ln_iter !=
NULL; ln_iter = ln_iter->next) {
779 ID *id_iter = ln_iter->link;
781 switch (
GS(id_iter->
name)) {
790 ((
Scene *)id_iter)->master_collection;
792 if (!is_object_update_processed) {
797 is_object_update_processed =
true;
817 Main *bmain,
void *idv,
void *old_idv,
void *new_idv,
const short remap_flags)
823 ID *old_id = old_idv;
824 ID *new_id = new_idv;
833 if (old_id !=
NULL) {
858 const int cb_flag = cb_data->
cb_flag;
865 ID *
id = *id_pointer;
void BKE_pose_clear_pointers(struct bPose *pose)
void BKE_collections_child_remove_nulls(struct Main *bmain, struct Collection *parent_collection, struct Collection *child_collection)
void BKE_collections_object_remove_duplicates(struct Main *bmain)
void BKE_collections_object_remove_nulls(struct Main *bmain)
void BKE_main_collections_parent_relations_rebuild(struct Main *bmain)
void BKE_curve_type_test(struct Object *ob)
void BKE_main_collection_sync_remap(const struct Main *bmain)
void BKE_libblock_runtime_reset_remapping_status(struct ID *id) ATTR_NONNULL(1)
void id_us_min(struct ID *id)
void id_fake_user_set(struct ID *id)
void id_us_ensure_real(struct ID *id)
void id_us_clear_real(struct ID *id)
void id_us_plus_no_lib(struct ID *id)
void id_fake_user_clear(struct ID *id)
void BKE_library_foreach_ID_link(struct Main *bmain, struct ID *id, LibraryIDLinkCallback callback, void *user_data, int flag)
@ IDWALK_DO_INTERNAL_RUNTIME_POINTERS
@ IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE
@ IDWALK_CB_INDIRECT_USAGE
uint64_t BKE_library_id_can_use_filter_id(const struct ID *id_owner)
void(* BKE_library_remap_editor_id_reference_cb)(const struct IDRemapper *mappings)
void(* BKE_library_free_notifier_reference_cb)(const void *)
IDRemapperApplyResult BKE_id_remapper_apply_ex(const struct IDRemapper *id_remapper, struct ID **r_id_ptr, IDRemapperApplyOptions options, struct ID *id_self)
@ ID_REMAP_SKIP_USER_CLEAR
@ ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS
@ ID_REMAP_SKIP_OVERRIDE_LIBRARY
@ ID_REMAP_FORCE_USER_REFCOUNT
@ ID_REMAP_SKIP_NEVER_NULL_USAGE
@ ID_REMAP_FLAG_NEVER_NULL_USAGE
@ ID_REMAP_FORCE_OBDATA_IN_EDITMODE
@ ID_REMAP_SKIP_INDIRECT_USAGE
@ ID_REMAP_FORCE_NEVER_NULL_USAGE
@ ID_REMAP_RESULT_SOURCE_REMAPPED
@ ID_REMAP_RESULT_SOURCE_UNASSIGNED
@ ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE
@ ID_REMAP_RESULT_SOURCE_UNAVAILABLE
bool BKE_id_remapper_has_mapping_for(const struct IDRemapper *id_remapper, uint64_t type_filter)
IDRemapperApplyResult BKE_id_remapper_get_mapping_result(const struct IDRemapper *id_remapper, struct ID *id, IDRemapperApplyOptions options, const struct ID *id_self)
void BKE_id_remapper_add(struct IDRemapper *id_remapper, struct ID *old_id, struct ID *new_id)
void BKE_id_remapper_clear(struct IDRemapper *id_remapper)
@ ID_REMAP_APPLY_UNMAP_WHEN_REMAPPING_TO_SELF
const char * BKE_id_remapper_result_string(const IDRemapperApplyResult result)
bool BKE_id_remapper_is_empty(const struct IDRemapper *id_remapper)
struct IDRemapper * BKE_id_remapper_create(void)
void BKE_id_remapper_iter(const struct IDRemapper *id_remapper, IDRemapperIterFunction func, void *user_data)
void BKE_id_remapper_free(struct IDRemapper *id_remapper)
#define FOREACH_MAIN_ID_END
void BKE_main_unlock(struct Main *bmain)
void BKE_main_lock(struct Main *bmain)
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
General operations, lookup, etc. for materials.
void BKE_object_materials_test(struct Main *bmain, struct Object *ob, struct ID *id)
bool BKE_mball_is_basis_for(const struct Object *ob1, const struct Object *ob2)
bool BKE_mball_is_basis(const struct Object *ob)
void BKE_modifiers_test_object(struct Object *ob)
void multires_force_sculpt_rebuild(struct Object *object)
void ntreeUpdateAllUsers(struct Main *main, struct ID *id)
General operations, lookup, etc. for blender objects.
bool BKE_object_is_in_editmode(const struct Object *ob)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
#define ATTR_NONNULL(...)
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
void void BLI_linklist_prepend(LinkNode **listp, void *ptr) ATTR_NONNULL(1)
#define UNUSED_VARS_NDEBUG(...)
#define CLOG_ERROR(clg_ref,...)
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
#define ID_IS_LINKED(_id)
@ ID_REMAP_IS_LINKED_DIRECT
@ ID_REMAP_IS_USER_ONE_SKIPPED
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
void BKE_libblock_relink_to_newid(Main *bmain, ID *id, const int remap_flag)
static void libblock_remap_data_postprocess_collection_update(Main *bmain, Collection *owner_collection, Collection *UNUSED(old_collection), Collection *new_collection)
BKE_library_remap_editor_id_reference_cb remap_editor_id_reference_cb
static int id_relink_to_newid_looper(LibraryIDLinkCallbackData *cb_data)
void BKE_library_callback_remap_editor_id_reference_set(BKE_library_remap_editor_id_reference_cb func)
void BKE_libblock_remap(Main *bmain, void *old_idv, void *new_idv, const short remap_flags)
void BKE_libblock_relink_multiple(Main *bmain, LinkNode *ids, const eIDRemapType remap_type, struct IDRemapper *id_remapper, const short remap_flags)
void BKE_libblock_relink_ex(Main *bmain, void *idv, void *old_idv, void *new_idv, const short remap_flags)
static void libblock_relink_foreach_idpair_cb(ID *old_id, ID *new_id, void *user_data)
void BKE_libblock_unlink(Main *bmain, void *idv, const bool do_flag_never_null, const bool do_skip_indirect)
static void foreach_libblock_remap_callback_apply(ID *id_owner, ID *id_self, ID **id_ptr, IDRemap *id_remap_data, const struct IDRemapper *mappings, const IDRemapperApplyOptions id_remapper_options, const int cb_flag, const bool is_indirect, const bool violates_never_null, const bool force_user_refcount)
static void libblock_relink_to_newid_prepare_data(Main *bmain, ID *id, RelinkToNewIDData *relink_data)
void BKE_libblock_remap_multiple(Main *bmain, struct IDRemapper *mappings, const short remap_flags)
static void libblock_remap_data_update_tags(ID *old_id, ID *new_id, void *user_data)
static void libblock_remap_foreach_idpair_cb(ID *old_id, ID *new_id, void *user_data)
void BKE_library_callback_free_notifier_reference_set(BKE_library_free_notifier_reference_cb func)
static void libblock_remap_data_preprocess_ob(Object *ob, eIDRemapType remap_type, const struct IDRemapper *id_remapper)
struct LibblockRemapMultipleUserData LibBlockRemapMultipleUserData
struct RelinkToNewIDData RelinkToNewIDData
static void libblock_remap_data(Main *bmain, ID *id, eIDRemapType remap_type, struct IDRemapper *id_remapper, const short remap_flags)
static void libblock_remap_data_postprocess_obdata_relink(Main *bmain, Object *ob, ID *new_id)
void BKE_libblock_remap_multiple_locked(Main *bmain, struct IDRemapper *mappings, const short remap_flags)
void BKE_libblock_remap_locked(Main *bmain, void *old_idv, void *new_idv, const short remap_flags)
struct LibblockRelinkMultipleUserData LibBlockRelinkMultipleUserData
BKE_library_free_notifier_reference_cb free_notifier_reference_cb
static void libblock_remap_data_postprocess_object_update(Main *bmain, Object *old_ob, Object *new_ob, const bool do_sync_collection)
static void libblock_remap_data_preprocess(ID *id_owner, eIDRemapType remap_type, const struct IDRemapper *id_remapper)
static int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data)
static void libblock_remap_data_postprocess_nodetree_update(Main *bmain, ID *new_id)
static void foreach_libblock_remap_callback_skip(const ID *UNUSED(id_owner), ID **id_ptr, const int cb_flag, const bool is_indirect, const bool is_reference, const bool violates_never_null, const bool UNUSED(is_obj), const bool is_obj_editmode)
static void libblock_remap_reset_remapping_status_callback(ID *old_id, ID *new_id, void *UNUSED(user_data))
unsigned __int64 uint64_t
struct IDRemapper * id_remapper
struct ID_Runtime runtime
struct MainIDRelations * relations
struct IDRemapper * id_remapper