Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/lib_id.c
| Show First 20 Lines • Show All 1,320 Lines • ▼ Show 20 Lines | |||||
| /* ***************** ID ************************ */ | /* ***************** ID ************************ */ | ||||
| ID *BKE_libblock_find_name(struct Main *bmain, const short type, const char *name) | ID *BKE_libblock_find_name(struct Main *bmain, const short type, const char *name) | ||||
| { | { | ||||
| ListBase *lb = which_libbase(bmain, type); | ListBase *lb = which_libbase(bmain, type); | ||||
| BLI_assert(lb != NULL); | BLI_assert(lb != NULL); | ||||
| return BLI_findstring(lb, name, offsetof(ID, name) + 2); | return BLI_findstring(lb, name, offsetof(ID, name) + 2); | ||||
| } | } | ||||
| struct ID *BKE_libblock_find_session_uuid(Main *bmain, | |||||
| const short type, | |||||
| const uint32_t session_uuid) | |||||
| { | |||||
| ListBase *lb = which_libbase(bmain, type); | |||||
| BLI_assert(lb != NULL); | |||||
| LISTBASE_FOREACH (ID *, id, lb) { | |||||
| if (id->session_uuid == session_uuid) { | |||||
| return id; | |||||
| } | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| /** | /** | ||||
| * Sort given \a id into given \a lb list, using case-insensitive comparison of the id names. | * Sort given \a id into given \a lb list, using case-insensitive comparison of the id names. | ||||
| * | * | ||||
| * \note All other IDs beside given one are assumed already properly sorted in the list. | * \note All other IDs beside given one are assumed already properly sorted in the list. | ||||
| * | * | ||||
| * \param id_sorting_hint: Ignored if NULL. Otherwise, used to check if we can insert \a id | * \param id_sorting_hint: Ignored if NULL. Otherwise, used to check if we can insert \a id | ||||
| * immediately before or after that pointer. It must always be into given \a lb list. | * immediately before or after that pointer. It must always be into given \a lb list. | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 1,077 Lines • Show Last 20 Lines | |||||