Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/library_remap.c
| Show All 25 Lines | |||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <ctype.h> | #include <ctype.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stddef.h> | #include <stddef.h> | ||||
| #include <assert.h> | #include <assert.h> | ||||
| #include "CLG_log.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| /* all types are needed here, in order to do memory operations */ | /* all types are needed here, in order to do memory operations */ | ||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_brush_types.h" | #include "DNA_brush_types.h" | ||||
| #include "DNA_camera_types.h" | #include "DNA_camera_types.h" | ||||
| #include "DNA_cachefile_types.h" | #include "DNA_cachefile_types.h" | ||||
| ▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_build.h" | #include "DEG_depsgraph_build.h" | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| #include "BPY_extern.h" | #include "BPY_extern.h" | ||||
| #endif | #endif | ||||
| static CLG_LogRef LOG = {"bke.library_remap"}; | |||||
| static BKE_library_free_window_manager_cb free_windowmanager_cb = NULL; | static BKE_library_free_window_manager_cb free_windowmanager_cb = NULL; | ||||
| void BKE_library_callback_free_window_manager_set(BKE_library_free_window_manager_cb func) | void BKE_library_callback_free_window_manager_set(BKE_library_free_window_manager_cb func) | ||||
| { | { | ||||
| free_windowmanager_cb = func; | free_windowmanager_cb = func; | ||||
| } | } | ||||
| static BKE_library_free_notifier_reference_cb free_notifier_reference_cb = NULL; | static BKE_library_free_notifier_reference_cb free_notifier_reference_cb = NULL; | ||||
| ▲ Show 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | void BKE_libblock_remap_locked( | ||||
| /* If old_id was used by some ugly 'user_one' stuff (like Image or Clip editors...), and user count has actually | /* 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... unless we had to skip | * been incremented for that, we have to decrease once more its user count... unless we had to skip | ||||
| * some 'user_one' cases. */ | * some 'user_one' cases. */ | ||||
| if ((old_id->tag & LIB_TAG_EXTRAUSER_SET) && !(id_remap_data.status & ID_REMAP_IS_USER_ONE_SKIPPED)) { | if ((old_id->tag & LIB_TAG_EXTRAUSER_SET) && !(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) { | ||||
| printf("Error in remapping process from '%s' (%p) to '%s' (%p): " | CLOG_FATAL(&LOG, "Error in remapping process from '%s' (%p) to '%s' (%p): " | ||||
| "wrong user count in old ID after process (summing up to %d)\n", | "wrong user count in old ID after process (summing up to %d)", | ||||
| old_id->name, old_id, new_id ? new_id->name : "<NULL>", new_id, old_id->us - skipped_refcounted); | old_id->name, old_id, new_id ? new_id->name : "<NULL>", new_id, old_id->us - skipped_refcounted); | ||||
| BLI_assert(0); | BLI_assert(0); | ||||
| } | } | ||||
| if (skipped_direct == 0) { | if (skipped_direct == 0) { | ||||
| /* old_id is assumed to not be used directly anymore... */ | /* old_id is assumed to not be used directly anymore... */ | ||||
| if (old_id->lib && (old_id->tag & LIB_TAG_EXTERN)) { | if (old_id->lib && (old_id->tag & LIB_TAG_EXTERN)) { | ||||
| old_id->tag &= ~LIB_TAG_EXTERN; | old_id->tag &= ~LIB_TAG_EXTERN; | ||||
| old_id->tag |= LIB_TAG_INDIRECT; | old_id->tag |= LIB_TAG_INDIRECT; | ||||
| ▲ Show 20 Lines • Show All 585 Lines • Show Last 20 Lines | |||||