Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/lib_id.c
| Show First 20 Lines • Show All 493 Lines • ▼ Show 20 Lines | if ((idtype_info->flags & IDTYPE_FLAGS_NO_MAKELOCAL) == 0) { | ||||
| BKE_lib_id_make_local_generic(bmain, id, flags); | BKE_lib_id_make_local_generic(bmain, id, flags); | ||||
| } | } | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| BLI_assert(!"IDType Missing IDTypeInfo"); | BLI_assert_msg(0, "IDType Missing IDTypeInfo"); | ||||
| return false; | return false; | ||||
| } | } | ||||
| struct IDCopyLibManagementData { | struct IDCopyLibManagementData { | ||||
| const ID *id_src; | const ID *id_src; | ||||
| ID *id_dst; | ID *id_dst; | ||||
| int flag; | int flag; | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | if (idtype_info != NULL) { | ||||
| BKE_libblock_copy_ex(bmain, id, &newid, flag); | BKE_libblock_copy_ex(bmain, id, &newid, flag); | ||||
| if (idtype_info->copy_data != NULL) { | if (idtype_info->copy_data != NULL) { | ||||
| idtype_info->copy_data(bmain, newid, id, flag); | idtype_info->copy_data(bmain, newid, id, flag); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_assert(!"IDType Missing IDTypeInfo"); | BLI_assert_msg(0, "IDType Missing IDTypeInfo"); | ||||
| } | } | ||||
| /* Update ID refcount, remap pointers to self in new ID. */ | /* Update ID refcount, remap pointers to self in new ID. */ | ||||
| struct IDCopyLibManagementData data = { | struct IDCopyLibManagementData data = { | ||||
| .id_src = id, | .id_src = id, | ||||
| .id_dst = newid, | .id_dst = newid, | ||||
| .flag = flag, | .flag = flag, | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 433 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| void *BKE_libblock_alloc_notest(short type) | void *BKE_libblock_alloc_notest(short type) | ||||
| { | { | ||||
| const char *name; | const char *name; | ||||
| size_t size = BKE_libblock_get_alloc_info(type, &name); | size_t size = BKE_libblock_get_alloc_info(type, &name); | ||||
| if (size != 0) { | if (size != 0) { | ||||
| return MEM_callocN(size, name); | return MEM_callocN(size, name); | ||||
| } | } | ||||
| BLI_assert(!"Request to allocate unknown data type"); | BLI_assert_msg(0, "Request to allocate unknown data type"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /** | /** | ||||
| * Allocates and returns a block of the specified type, with the specified name | * Allocates and returns a block of the specified type, with the specified name | ||||
| * (adjusted as necessary to ensure uniqueness), and appended to the specified list. | * (adjusted as necessary to ensure uniqueness), and appended to the specified list. | ||||
| * The user count is set to 1, all other content (apart from name and links) being | * The user count is set to 1, all other content (apart from name and links) being | ||||
| * initialized to zero. | * initialized to zero. | ||||
| ▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | void BKE_libblock_init_empty(ID *id) | ||||
| if (idtype_info != NULL) { | if (idtype_info != NULL) { | ||||
| if (idtype_info->init_data != NULL) { | if (idtype_info->init_data != NULL) { | ||||
| idtype_info->init_data(id); | idtype_info->init_data(id); | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| BLI_assert(!"IDType Missing IDTypeInfo"); | BLI_assert_msg(0, "IDType Missing IDTypeInfo"); | ||||
| } | } | ||||
| /* ********** ID session-wise UUID management. ********** */ | /* ********** ID session-wise UUID management. ********** */ | ||||
| static uint global_session_uuid = 0; | static uint global_session_uuid = 0; | ||||
| /** | /** | ||||
| * Generate a session-wise uuid for the given \a id. | * Generate a session-wise uuid for the given \a id. | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 1,303 Lines • Show Last 20 Lines | |||||