Blender  V3.3
Classes | Macros | Typedefs | Enumerations | Functions | Variables
BKE_idtype.h File Reference
#include "BLI_sys_types.h"

Go to the source code of this file.

Classes

struct  IDCacheKey
 
struct  IDTypeInfo
 

Macros

#define BKE_idtype_idcode_is_localizable   BKE_idtype_idcode_is_linkable
 

Typedefs

typedef struct IDCacheKey IDCacheKey
 
typedef void(* IDTypeInitDataFunction) (struct ID *id)
 
typedef void(* IDTypeCopyDataFunction) (struct Main *bmain, struct ID *id_dst, const struct ID *id_src, int flag)
 
typedef void(* IDTypeFreeDataFunction) (struct ID *id)
 
typedef void(* IDTypeMakeLocalFunction) (struct Main *bmain, struct ID *id, int flags)
 
typedef void(* IDTypeForeachIDFunction) (struct ID *id, struct LibraryForeachIDData *data)
 
typedef enum eIDTypeInfoCacheCallbackFlags eIDTypeInfoCacheCallbackFlags
 
typedef void(* IDTypeForeachCacheFunctionCallback) (struct ID *id, const struct IDCacheKey *cache_key, void **cache_p, uint flags, void *user_data)
 
typedef void(* IDTypeForeachCacheFunction) (struct ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data)
 
typedef void(* IDTypeForeachPathFunction) (struct ID *id, struct BPathForeachPathData *bpath_data)
 
typedef struct ID *(* IDTypeEmbeddedOwnerGetFunction) (struct Main *bmain, struct ID *id, struct ID *owner_id_hint)
 
typedef void(* IDTypeBlendWriteFunction) (struct BlendWriter *writer, struct ID *id, const void *id_address)
 
typedef void(* IDTypeBlendReadDataFunction) (struct BlendDataReader *reader, struct ID *id)
 
typedef void(* IDTypeBlendReadLibFunction) (struct BlendLibReader *reader, struct ID *id)
 
typedef void(* IDTypeBlendReadExpandFunction) (struct BlendExpander *expander, struct ID *id)
 
typedef void(* IDTypeBlendReadUndoPreserve) (struct BlendLibReader *reader, struct ID *id_new, struct ID *id_old)
 
typedef void(* IDTypeLibOverrideApplyPost) (struct ID *id_dst, struct ID *id_src)
 
typedef struct IDTypeInfo IDTypeInfo
 

Enumerations

enum  {
  IDTYPE_FLAGS_NO_COPY = 1 << 0 , IDTYPE_FLAGS_NO_LIBLINKING = 1 << 1 , IDTYPE_FLAGS_ONLY_APPEND = 1 << 2 , IDTYPE_FLAGS_APPEND_IS_REUSABLE = 1 << 3 ,
  IDTYPE_FLAGS_NO_ANIMDATA = 1 << 4
}
 
enum  eIDTypeInfoCacheCallbackFlags { IDTYPE_CACHE_CB_FLAGS_PERSISTENT = 1 << 0 }
 

Functions

uint BKE_idtype_cache_key_hash (const void *key_v)
 
bool BKE_idtype_cache_key_cmp (const void *key_a_v, const void *key_b_v)
 
void BKE_idtype_init (void)
 
const struct IDTypeInfoBKE_idtype_get_info_from_idcode (short id_code)
 
const struct IDTypeInfoBKE_idtype_get_info_from_id (const struct ID *id)
 
const char * BKE_idtype_idcode_to_name (short idcode)
 
const char * BKE_idtype_idcode_to_name_plural (short idcode)
 
const char * BKE_idtype_idcode_to_translation_context (short idcode)
 
bool BKE_idtype_idcode_is_valid (short idcode)
 
bool BKE_idtype_idcode_is_linkable (short idcode)
 
bool BKE_idtype_idcode_is_only_appendable (short idcode)
 
bool BKE_idtype_idcode_append_is_reusable (short idcode)
 
short BKE_idtype_idcode_from_name (const char *idtype_name)
 
uint64_t BKE_idtype_idcode_to_idfilter (short idcode)
 
short BKE_idtype_idcode_from_idfilter (uint64_t idfilter)
 
int BKE_idtype_idcode_to_index (short idcode)
 
short BKE_idtype_idcode_from_index (int index)
 
short BKE_idtype_idcode_iter_step (int *index)
 
void BKE_idtype_id_foreach_cache (struct ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data)
 

Variables

IDTypeInfo IDType_ID_SCE
 
IDTypeInfo IDType_ID_LI
 
IDTypeInfo IDType_ID_OB
 
IDTypeInfo IDType_ID_ME
 
IDTypeInfo IDType_ID_CU_LEGACY
 
IDTypeInfo IDType_ID_MB
 
IDTypeInfo IDType_ID_MA
 
IDTypeInfo IDType_ID_TE
 
IDTypeInfo IDType_ID_IM
 
IDTypeInfo IDType_ID_LT
 
IDTypeInfo IDType_ID_LA
 
IDTypeInfo IDType_ID_CA
 
IDTypeInfo IDType_ID_IP
 
IDTypeInfo IDType_ID_KE
 
IDTypeInfo IDType_ID_WO
 
IDTypeInfo IDType_ID_SCR
 
IDTypeInfo IDType_ID_VF
 
IDTypeInfo IDType_ID_TXT
 
IDTypeInfo IDType_ID_SPK
 
IDTypeInfo IDType_ID_SO
 
IDTypeInfo IDType_ID_GR
 
IDTypeInfo IDType_ID_AR
 
IDTypeInfo IDType_ID_AC
 
IDTypeInfo IDType_ID_NT
 
IDTypeInfo IDType_ID_BR
 
IDTypeInfo IDType_ID_PA
 
IDTypeInfo IDType_ID_GD
 
IDTypeInfo IDType_ID_WM
 
IDTypeInfo IDType_ID_MC
 
IDTypeInfo IDType_ID_MSK
 
IDTypeInfo IDType_ID_LS
 
IDTypeInfo IDType_ID_PAL
 
IDTypeInfo IDType_ID_PC
 
IDTypeInfo IDType_ID_CF
 
IDTypeInfo IDType_ID_WS
 
IDTypeInfo IDType_ID_LP
 
IDTypeInfo IDType_ID_CV
 
IDTypeInfo IDType_ID_PT
 
IDTypeInfo IDType_ID_VO
 
IDTypeInfo IDType_ID_SIM
 
IDTypeInfo IDType_ID_LINK_PLACEHOLDER
 

Detailed Description

ID type structure, helping to factorize common operations and data for all data-block types.

Definition in file BKE_idtype.h.

Macro Definition Documentation

◆ BKE_idtype_idcode_is_localizable

#define BKE_idtype_idcode_is_localizable   BKE_idtype_idcode_is_linkable

Definition at line 336 of file BKE_idtype.h.

Typedef Documentation

◆ eIDTypeInfoCacheCallbackFlags

◆ IDCacheKey

typedef struct IDCacheKey IDCacheKey

◆ IDTypeBlendReadDataFunction

typedef void(* IDTypeBlendReadDataFunction) (struct BlendDataReader *reader, struct ID *id)

Definition at line 97 of file BKE_idtype.h.

◆ IDTypeBlendReadExpandFunction

typedef void(* IDTypeBlendReadExpandFunction) (struct BlendExpander *expander, struct ID *id)

Definition at line 99 of file BKE_idtype.h.

◆ IDTypeBlendReadLibFunction

typedef void(* IDTypeBlendReadLibFunction) (struct BlendLibReader *reader, struct ID *id)

Definition at line 98 of file BKE_idtype.h.

◆ IDTypeBlendReadUndoPreserve

typedef void(* IDTypeBlendReadUndoPreserve) (struct BlendLibReader *reader, struct ID *id_new, struct ID *id_old)

Definition at line 101 of file BKE_idtype.h.

◆ IDTypeBlendWriteFunction

typedef void(* IDTypeBlendWriteFunction) (struct BlendWriter *writer, struct ID *id, const void *id_address)

Definition at line 94 of file BKE_idtype.h.

◆ IDTypeCopyDataFunction

typedef void(* IDTypeCopyDataFunction) (struct Main *bmain, struct ID *id_dst, const struct ID *id_src, int flag)
Parameters
flagCopying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more).

Definition at line 60 of file BKE_idtype.h.

◆ IDTypeEmbeddedOwnerGetFunction

typedef struct ID*(* IDTypeEmbeddedOwnerGetFunction) (struct Main *bmain, struct ID *id, struct ID *owner_id_hint)
Parameters
owner_id_hintIf non-NULL, a potential owner of the given embedded ID. Can speed up look-up of the owner ID in some cases.

Definition at line 86 of file BKE_idtype.h.

◆ IDTypeForeachCacheFunction

typedef void(* IDTypeForeachCacheFunction) (struct ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data)

Definition at line 82 of file BKE_idtype.h.

◆ IDTypeForeachCacheFunctionCallback

typedef void(* IDTypeForeachCacheFunctionCallback) (struct ID *id, const struct IDCacheKey *cache_key, void **cache_p, uint flags, void *user_data)

Definition at line 77 of file BKE_idtype.h.

◆ IDTypeForeachIDFunction

typedef void(* IDTypeForeachIDFunction) (struct ID *id, struct LibraryForeachIDData *data)

Definition at line 70 of file BKE_idtype.h.

◆ IDTypeForeachPathFunction

typedef void(* IDTypeForeachPathFunction) (struct ID *id, struct BPathForeachPathData *bpath_data)

Definition at line 86 of file BKE_idtype.h.

◆ IDTypeFreeDataFunction

typedef void(* IDTypeFreeDataFunction) (struct ID *id)

Definition at line 65 of file BKE_idtype.h.

◆ IDTypeInfo

typedef struct IDTypeInfo IDTypeInfo

◆ IDTypeInitDataFunction

typedef void(* IDTypeInitDataFunction) (struct ID *id)

Definition at line 57 of file BKE_idtype.h.

◆ IDTypeLibOverrideApplyPost

typedef void(* IDTypeLibOverrideApplyPost) (struct ID *id_dst, struct ID *id_src)

Definition at line 105 of file BKE_idtype.h.

◆ IDTypeMakeLocalFunction

typedef void(* IDTypeMakeLocalFunction) (struct Main *bmain, struct ID *id, int flags)
Parameters
flagsSee BKE_lib_id.h's LIB_ID_MAKELOCAL_... flags.

Definition at line 68 of file BKE_idtype.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

IDTypeInfo.flags.

Enumerator
IDTYPE_FLAGS_NO_COPY 

Indicates that the given IDType does not support copying.

IDTYPE_FLAGS_NO_LIBLINKING 

Indicates that the given IDType does not support linking/appending from a library file.

IDTYPE_FLAGS_ONLY_APPEND 

Indicates that the given IDType should not be directly linked from a library file, but may be appended. NOTE: Mutually exclusive with IDTYPE_FLAGS_NO_LIBLINKING.

IDTYPE_FLAGS_APPEND_IS_REUSABLE 

Allow to re-use an existing local ID with matching weak library reference instead of creating a new copy of it, when appending. See also LibraryWeakReference in DNA_ID.h.

IDTYPE_FLAGS_NO_ANIMDATA 

Indicates that the given IDType does not have animation data.

Definition at line 28 of file BKE_idtype.h.

◆ eIDTypeInfoCacheCallbackFlags

Enumerator
IDTYPE_CACHE_CB_FLAGS_PERSISTENT 

Indicates to the callback that cache may be stored in the .blend file, so its pointer should not be cleared at read-time.

Definition at line 72 of file BKE_idtype.h.

Function Documentation

◆ BKE_idtype_cache_key_cmp()

bool BKE_idtype_cache_key_cmp ( const void key_a_v,
const void key_b_v 
)

Definition at line 39 of file idtype.c.

References IDCacheKey::id_session_uuid, and IDCacheKey::offset_in_ID.

Referenced by blo_cache_storage_init().

◆ BKE_idtype_cache_key_hash()

uint BKE_idtype_cache_key_hash ( const void key_v)

◆ BKE_idtype_get_info_from_id()

const struct IDTypeInfo* BKE_idtype_get_info_from_id ( const struct ID id)

◆ BKE_idtype_get_info_from_idcode()

const struct IDTypeInfo* BKE_idtype_get_info_from_idcode ( short  id_code)

◆ BKE_idtype_id_foreach_cache()

void BKE_idtype_id_foreach_cache ( struct ID id,
IDTypeForeachCacheFunctionCallback  function_callback,
void user_data 
)

◆ BKE_idtype_idcode_append_is_reusable()

bool BKE_idtype_idcode_append_is_reusable ( short  idcode)

Check if an ID type can try to reuse and existing matching local one when being appended again.

Parameters
idcodeThe IDType code to check.
Returns
Boolean, false when it cannot be re-used, true otherwise.

Definition at line 194 of file idtype.c.

References BKE_idtype_get_info_from_idcode(), BLI_assert, IDTypeInfo::flags, IDTYPE_FLAGS_APPEND_IS_REUSABLE, IDTYPE_FLAGS_NO_LIBLINKING, and NULL.

Referenced by BKE_blendfile_append(), BKE_main_library_weak_reference_add_item(), and BKE_main_library_weak_reference_create().

◆ BKE_idtype_idcode_from_idfilter()

short BKE_idtype_idcode_from_idfilter ( uint64_t  idfilter)

Convert an idfilter into an idcode (e.g. FILTER_ID_OB -> ID_OB).

Definition at line 266 of file idtype.c.

References BLI_assert_unreachable, BR, CASE_IDFILTER, CASE_IDFILTER_NONE, CV, and LT.

◆ BKE_idtype_idcode_from_index()

short BKE_idtype_idcode_from_index ( int  index)

Get an idcode from an index (e.g. INDEX_ID_OB -> ID_OB).

Definition at line 383 of file idtype.c.

References BR, CASE_IDCODE, CV, ID_LINK_PLACEHOLDER, INDEX_ID_NULL, and LT.

Referenced by BKE_idtype_idcode_iter_step(), and outliner_orphans_purge_invoke().

◆ BKE_idtype_idcode_from_name()

short BKE_idtype_idcode_from_name ( const char *  idtype_name)

Convert an ID-type name into an idcode (ie. ID_SCE)

Parameters
idtype_nameThe ID-type's "user visible name" to convert.
Returns
The idcode for the name, or 0 if invalid.

Definition at line 163 of file idtype.c.

References BLI_assert, IDTypeInfo::id_code, idtype_get_info_from_name(), and NULL.

Referenced by groupname_to_code(), imb_thumb_load_from_blend_id(), wm_link_append_exec(), and wm_link_append_item_poll().

◆ BKE_idtype_idcode_is_linkable()

bool BKE_idtype_idcode_is_linkable ( short  idcode)

◆ BKE_idtype_idcode_is_only_appendable()

bool BKE_idtype_idcode_is_only_appendable ( short  idcode)

Check if an ID type is only appendable.

Parameters
idcodeThe IDType code to check.
Returns
Boolean, false when also linkable, true when only appendable.

Definition at line 182 of file idtype.c.

References BKE_idtype_get_info_from_idcode(), BLI_assert, IDTypeInfo::flags, IDTYPE_FLAGS_NO_LIBLINKING, IDTYPE_FLAGS_ONLY_APPEND, and NULL.

Referenced by wm_link_append_item_poll().

◆ BKE_idtype_idcode_is_valid()

bool BKE_idtype_idcode_is_valid ( short  idcode)

Return if the ID code is a valid ID code.

Parameters
idcodeThe code to check.
Returns
Boolean, 0 when invalid.

Definition at line 170 of file idtype.c.

References BKE_idtype_get_info_from_idcode(), and NULL.

Referenced by blo_bhead_is_id_valid_type(), BLO_blendhandle_get_linkable_groups(), and link_named_part().

◆ BKE_idtype_idcode_iter_step()

short BKE_idtype_idcode_iter_step ( int *  index)

Return an ID code and steps the index forward 1.

Parameters
indexstart as 0.
Returns
the code, 0 when all codes have been returned.

Definition at line 442 of file idtype.c.

References ARRAY_SIZE, BKE_idtype_idcode_from_index(), and id_types.

Referenced by BKE_blendfile_link_append_context_item_idtypes_from_library_add(), BKE_main_idmap_create(), bpy_lib_enter(), bpy_lib_exit(), and main_namemap_validate_and_fix().

◆ BKE_idtype_idcode_to_idfilter()

uint64_t BKE_idtype_idcode_to_idfilter ( short  idcode)

◆ BKE_idtype_idcode_to_index()

int BKE_idtype_idcode_to_index ( short  idcode)

◆ BKE_idtype_idcode_to_name()

const char* BKE_idtype_idcode_to_name ( short  idcode)

◆ BKE_idtype_idcode_to_name_plural()

const char* BKE_idtype_idcode_to_name_plural ( short  idcode)

Convert an idcode into a name (plural).

Parameters
idcodeThe code to convert.
Returns
A static string representing the name of the code.

Definition at line 149 of file idtype.c.

References BKE_idtype_get_info_from_idcode(), BLI_assert, IDTypeInfo::name_plural, and NULL.

Referenced by bpy_lib_enter(), bpy_lib_exit(), bpy_lib_exit_lapp_context_items_cb(), idp_repr_fn_recursive(), outliner_idcode_to_plural(), outliner_orphans_purge_invoke(), pyrna_prop_repr_ex(), pyrna_struct_repr(), RNA_path_full_ID_py(), and WM_drag_get_item_name().

◆ BKE_idtype_idcode_to_translation_context()

const char* BKE_idtype_idcode_to_translation_context ( short  idcode)

Convert an idcode into its translations' context.

Parameters
idcodeThe code to convert.
Returns
A static string representing the i18n context of the code.

Definition at line 156 of file idtype.c.

References BKE_idtype_get_info_from_idcode(), BLI_assert, BLT_I18NCONTEXT_DEFAULT, NULL, and IDTypeInfo::translation_context.

◆ BKE_idtype_init()

void BKE_idtype_init ( void  )

Variable Documentation

◆ IDType_ID_AC

IDTypeInfo IDType_ID_AC
extern

Definition at line 300 of file action.c.

◆ IDType_ID_AR

IDTypeInfo IDType_ID_AR
extern

Definition at line 298 of file armature.c.

◆ IDType_ID_BR

IDTypeInfo IDType_ID_BR
extern

Definition at line 395 of file brush.cc.

◆ IDType_ID_CA

IDTypeInfo IDType_ID_CA
extern

Definition at line 167 of file camera.c.

◆ IDType_ID_CF

IDTypeInfo IDType_ID_CF
extern

Definition at line 131 of file cachefile.c.

◆ IDType_ID_CU_LEGACY

IDTypeInfo IDType_ID_CU_LEGACY
extern

Definition at line 306 of file curve.cc.

◆ IDType_ID_CV

IDTypeInfo IDType_ID_CV
extern

Definition at line 201 of file curves.cc.

◆ IDType_ID_GD

IDTypeInfo IDType_ID_GD
extern

Definition at line 299 of file gpencil.c.

◆ IDType_ID_GR

IDTypeInfo IDType_ID_GR
extern

Definition at line 360 of file collection.c.

◆ IDType_ID_IM

IDTypeInfo IDType_ID_IM
extern

Definition at line 457 of file source/blender/blenkernel/intern/image.cc.

◆ IDType_ID_IP

IDTypeInfo IDType_ID_IP
extern

Definition at line 163 of file ipo.c.

◆ IDType_ID_KE

IDTypeInfo IDType_ID_KE
extern

Definition at line 193 of file key.c.

◆ IDType_ID_LA

IDTypeInfo IDType_ID_LA
extern

Definition at line 173 of file light.c.

◆ IDType_ID_LI

IDTypeInfo IDType_ID_LI
extern

Definition at line 82 of file library.c.

◆ IDType_ID_LINK_PLACEHOLDER

IDTypeInfo IDType_ID_LINK_PLACEHOLDER
extern

Empty shell mostly, but needed for read code.

Definition at line 77 of file lib_id.c.

Referenced by id_type_init().

◆ IDType_ID_LP

IDTypeInfo IDType_ID_LP
extern

Definition at line 70 of file lightprobe.c.

◆ IDType_ID_LS

IDTypeInfo IDType_ID_LS
extern

Definition at line 733 of file linestyle.c.

◆ IDType_ID_LT

IDTypeInfo IDType_ID_LT
extern

◆ IDType_ID_MA

IDTypeInfo IDType_ID_MA
extern

Definition at line 240 of file material.c.

◆ IDType_ID_MB

IDTypeInfo IDType_ID_MB
extern

Definition at line 168 of file mball.c.

◆ IDType_ID_MC

IDTypeInfo IDType_ID_MC
extern

Definition at line 328 of file movieclip.c.

◆ IDType_ID_ME

IDTypeInfo IDType_ID_ME
extern

◆ IDType_ID_MSK

IDTypeInfo IDType_ID_MSK
extern

Definition at line 234 of file mask.c.

◆ IDType_ID_NT

IDTypeInfo IDType_ID_NT
extern

Definition at line 1024 of file node.cc.

◆ IDType_ID_OB

IDTypeInfo IDType_ID_OB
extern

◆ IDType_ID_PA

IDTypeInfo IDType_ID_PA
extern

Definition at line 479 of file particle.c.

◆ IDType_ID_PAL

IDTypeInfo IDType_ID_PAL
extern

Definition at line 123 of file paint.c.

◆ IDType_ID_PC

IDTypeInfo IDType_ID_PC
extern

Definition at line 190 of file paint.c.

◆ IDType_ID_PT

IDTypeInfo IDType_ID_PT
extern

Definition at line 160 of file pointcloud.cc.

◆ IDType_ID_SCE

IDTypeInfo IDType_ID_SCE
extern

Definition at line 1693 of file scene.cc.

Referenced by blender::bke::tests::TEST().

◆ IDType_ID_SCR

IDTypeInfo IDType_ID_SCR
extern

Definition at line 278 of file screen.c.

◆ IDType_ID_SIM

IDTypeInfo IDType_ID_SIM
extern

Definition at line 134 of file simulation.cc.

◆ IDType_ID_SO

IDTypeInfo IDType_ID_SO
extern

Definition at line 195 of file blenkernel/intern/sound.c.

◆ IDType_ID_SPK

IDTypeInfo IDType_ID_SPK
extern

Definition at line 79 of file speaker.c.

◆ IDType_ID_TE

IDTypeInfo IDType_ID_TE
extern

Definition at line 191 of file texture.c.

◆ IDType_ID_TXT

IDTypeInfo IDType_ID_TXT
extern

Definition at line 230 of file text.c.

◆ IDType_ID_VF

IDTypeInfo IDType_ID_VF
extern

Definition at line 156 of file vfont.c.

◆ IDType_ID_VO

IDTypeInfo IDType_ID_VO
extern

Definition at line 649 of file volume.cc.

◆ IDType_ID_WM

IDTypeInfo IDType_ID_WM
extern

Definition at line 258 of file wm.c.

◆ IDType_ID_WO

IDTypeInfo IDType_ID_WO
extern

Definition at line 182 of file world.c.

◆ IDType_ID_WS

IDTypeInfo IDType_ID_WS
extern

Definition at line 178 of file workspace.c.