Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_main.h
| Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
| /* Blender thumbnail, as written on file (width, height, and data as char RGBA). */ | /* Blender thumbnail, as written on file (width, height, and data as char RGBA). */ | ||||
| /* We pack pixel data after that struct. */ | /* We pack pixel data after that struct. */ | ||||
| typedef struct BlendThumbnail { | typedef struct BlendThumbnail { | ||||
| int width, height; | int width, height; | ||||
| char rect[0]; | char rect[0]; | ||||
| } BlendThumbnail; | } BlendThumbnail; | ||||
| /* Structs caching relations between data-blocks in a given Main. */ | /* Structs caching relations between data-blocks in a given Main. */ | ||||
| typedef struct MainIDRelationsEntryItem { | |||||
| struct MainIDRelationsEntryItem *next; | |||||
| union { | |||||
| /* For `from_ids` list, a user of the hashed ID. */ | |||||
| struct ID *from; | |||||
| /* For `to_ids` list, an ID used by the hashed ID. */ | |||||
| struct ID **to; | |||||
| } id_pointer; | |||||
| /* Session uuid of the `id_pointer`. */ | |||||
| uint session_uuid; | |||||
| int usage_flag; /* Using IDWALK_ enums, defined in BKE_lib_query.h */ | |||||
| } MainIDRelationsEntryItem; | |||||
| typedef struct MainIDRelationsEntry { | typedef struct MainIDRelationsEntry { | ||||
| struct MainIDRelationsEntry *next; | /* Linked list of IDs using that ID. */ | ||||
| /* WARNING! for user_to_used, | struct MainIDRelationsEntryItem *from_ids; | ||||
| * that pointer is really an ID** one, but for used_to_user, it’s only an ID* one! */ | /* Linked list of IDs used by that ID. */ | ||||
| struct ID **id_pointer; | struct MainIDRelationsEntryItem *to_ids; | ||||
| int usage_flag; /* Using IDWALK_ enums, in BKE_lib_query.h */ | |||||
| /* Session uuid of the ID matching that entry. */ | |||||
| uint session_uuid; | |||||
| /* Runtime tags, users should ensure those are reset after usage. */ | |||||
| uint tags; | |||||
| } MainIDRelationsEntry; | } MainIDRelationsEntry; | ||||
| /* MainIDRelationsEntry.tags */ | |||||
| typedef enum MainIDRelationsEntryTags { | |||||
| /* Generic tag marking the entry as to be processed. */ | |||||
| MAINIDRELATIONS_ENTRY_TAGS_DOIT = 1 << 0, | |||||
| /* Generic tag marking the entry as processed. */ | |||||
| MAINIDRELATIONS_ENTRY_TAGS_PROCESSED = 1 << 1, | |||||
| } MainIDRelationsEntryTags; | |||||
| typedef struct MainIDRelations { | typedef struct MainIDRelations { | ||||
| struct GHash *id_user_to_used; | /* Mapping from an ID pointer to all of its parents (IDs using it) and children (IDs it uses). | ||||
| struct GHash *id_used_to_user; | * Values are `MainIDRelationsEntry` pointers. */ | ||||
| struct GHash *relations_from_pointers; | |||||
| /* Note: we could add more mappings when needed (e.g. from session uuid?). */ | |||||
| short flag; | short flag; | ||||
| /* Private... */ | /* Private... */ | ||||
| struct BLI_mempool *entry_pool; | struct BLI_mempool *entry_items_pool; | ||||
| } MainIDRelations; | } MainIDRelations; | ||||
| enum { | enum { | ||||
| /* Those bmain relations include pointers/usages from editors. */ | /* Those bmain relations include pointers/usages from editors. */ | ||||
| MAINIDRELATIONS_INCLUDE_UI = 1 << 0, | MAINIDRELATIONS_INCLUDE_UI = 1 << 0, | ||||
| }; | }; | ||||
| typedef struct Main { | typedef struct Main { | ||||
| ▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
| struct Main *BKE_main_new(void); | struct Main *BKE_main_new(void); | ||||
| void BKE_main_free(struct Main *mainvar); | void BKE_main_free(struct Main *mainvar); | ||||
| void BKE_main_lock(struct Main *bmain); | void BKE_main_lock(struct Main *bmain); | ||||
| void BKE_main_unlock(struct Main *bmain); | void BKE_main_unlock(struct Main *bmain); | ||||
| void BKE_main_relations_create(struct Main *bmain, const short flag); | void BKE_main_relations_create(struct Main *bmain, const short flag); | ||||
| void BKE_main_relations_free(struct Main *bmain); | void BKE_main_relations_free(struct Main *bmain); | ||||
| void BKE_main_relations_ID_remove(struct Main *bmain, struct ID *id); | void BKE_main_relations_tag_set(struct Main *bmain, | ||||
| const MainIDRelationsEntryTags tag, | |||||
| const bool value); | |||||
| struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset); | struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset); | ||||
| /* *** Generic utils to loop over whole Main database. *** */ | /* *** Generic utils to loop over whole Main database. *** */ | ||||
| #define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id) \ | #define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id) \ | ||||
| { \ | { \ | ||||
| ID *_id_next = (_lb)->first; \ | ID *_id_next = (_lb)->first; \ | ||||
| ▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines | |||||