Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/lib_remap.c
| Show First 20 Lines • Show All 416 Lines • ▼ Show 20 Lines | FOREACH_MAIN_ID_BEGIN (bmain, id_curr) { | ||||
| foreach_libblock_remap_callback, | foreach_libblock_remap_callback, | ||||
| (void *)r_id_remap_data, | (void *)r_id_remap_data, | ||||
| foreach_id_flags); | foreach_id_flags); | ||||
| } | } | ||||
| } | } | ||||
| FOREACH_MAIN_ID_END; | FOREACH_MAIN_ID_END; | ||||
| } | } | ||||
| if ((remap_flags & ID_REMAP_SKIP_USER_CLEAR) == 0) { | |||||
| /* XXX We may not want to always 'transfer' fake-user from old to new id... | /* XXX We may not want to always 'transfer' fake-user from old to new id... | ||||
| * Think for now it's desired behavior though, | * Think for now it's desired behavior though, | ||||
| * we can always add an option (flag) to control this later if needed. */ | * we can always add an option (flag) to control this later if needed. */ | ||||
| if (old_id && (old_id->flag & LIB_FAKEUSER)) { | if (old_id && (old_id->flag & LIB_FAKEUSER)) { | ||||
| id_fake_user_clear(old_id); | id_fake_user_clear(old_id); | ||||
| id_fake_user_set(new_id); | id_fake_user_set(new_id); | ||||
| } | } | ||||
| id_us_clear_real(old_id); | id_us_clear_real(old_id); | ||||
| } | |||||
| if (new_id && (new_id->tag & LIB_TAG_INDIRECT) && | if (new_id && (new_id->tag & LIB_TAG_INDIRECT) && | ||||
| (r_id_remap_data->status & ID_REMAP_IS_LINKED_DIRECT)) { | (r_id_remap_data->status & ID_REMAP_IS_LINKED_DIRECT)) { | ||||
| new_id->tag &= ~LIB_TAG_INDIRECT; | new_id->tag &= ~LIB_TAG_INDIRECT; | ||||
| new_id->flag &= ~LIB_INDIRECT_WEAK_LINK; | new_id->flag &= ~LIB_INDIRECT_WEAK_LINK; | ||||
| new_id->tag |= LIB_TAG_EXTERN; | new_id->tag |= LIB_TAG_EXTERN; | ||||
| } | } | ||||
| Show All 32 Lines | void BKE_libblock_remap_locked(Main *bmain, void *old_idv, void *new_idv, const short remap_flags) | ||||
| * editors' code is to handle refcount (id->us) itself then. */ | * editors' code is to handle refcount (id->us) itself then. */ | ||||
| if (remap_editor_id_reference_cb) { | if (remap_editor_id_reference_cb) { | ||||
| remap_editor_id_reference_cb(old_id, new_id); | remap_editor_id_reference_cb(old_id, new_id); | ||||
| } | } | ||||
| skipped_direct = id_remap_data.skipped_direct; | skipped_direct = id_remap_data.skipped_direct; | ||||
| skipped_refcounted = id_remap_data.skipped_refcounted; | skipped_refcounted = id_remap_data.skipped_refcounted; | ||||
| if ((remap_flags & ID_REMAP_SKIP_USER_CLEAR) == 0) { | |||||
| /* If old_id was used by some ugly 'user_one' stuff (like Image or Clip editors...), and user | /* If old_id was used by some ugly 'user_one' stuff (like Image or Clip editors...), and user | ||||
| * count has actually been incremented for that, we have to decrease once more its user count... | * count has actually been incremented for that, we have to decrease once more its user | ||||
| * unless we had to skip some 'user_one' cases. */ | * count... unless we had to skip some 'user_one' cases. */ | ||||
| if ((old_id->tag & LIB_TAG_EXTRAUSER_SET) && | if ((old_id->tag & LIB_TAG_EXTRAUSER_SET) && | ||||
| !(id_remap_data.status & ID_REMAP_IS_USER_ONE_SKIPPED)) { | !(id_remap_data.status & ID_REMAP_IS_USER_ONE_SKIPPED)) { | ||||
| id_us_clear_real(old_id); | id_us_clear_real(old_id); | ||||
| } | } | ||||
| } | |||||
| if (old_id->us - skipped_refcounted < 0) { | if (old_id->us - skipped_refcounted < 0) { | ||||
| CLOG_ERROR(&LOG, | CLOG_ERROR(&LOG, | ||||
| "Error in remapping process from '%s' (%p) to '%s' (%p): " | "Error in remapping process from '%s' (%p) to '%s' (%p): " | ||||
| "wrong user count in old ID after process (summing up to %d)", | "wrong user count in old ID after process (summing up to %d)", | ||||
| old_id->name, | old_id->name, | ||||
| old_id, | old_id, | ||||
| new_id ? new_id->name : "<NULL>", | new_id ? new_id->name : "<NULL>", | ||||
| ▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines | |||||