|
Blender V4.3
|
blenloader genfile private function prototypes More...
#include "intern/dna_utils.h"Go to the source code of this file.
Macros | |
| #define | SDNA_TYPE_VOID 9 |
Typedefs | |
| typedef enum eSDNA_Type | eSDNA_Type |
Enumerations | |
| enum | eSDNA_Type { SDNA_TYPE_CHAR = 0 , SDNA_TYPE_UCHAR = 1 , SDNA_TYPE_SHORT = 2 , SDNA_TYPE_USHORT = 3 , SDNA_TYPE_INT = 4 , SDNA_TYPE_FLOAT = 7 , SDNA_TYPE_DOUBLE = 8 , SDNA_TYPE_INT64 = 10 , SDNA_TYPE_UINT64 = 11 , SDNA_TYPE_INT8 = 12 , SDNA_TYPE_RAW_DATA = 13 } |
| enum | eSDNA_StructCompare { SDNA_CMP_REMOVED = 0 , SDNA_CMP_EQUAL = 1 , SDNA_CMP_NOT_EQUAL = 2 , SDNA_CMP_UNKNOWN = 3 } |
Functions | |
| struct SDNA * | DNA_sdna_from_data (const void *data, int data_len, bool do_endian_swap, bool data_alloc, bool do_alias, const char **r_error_message) |
| void | DNA_sdna_free (struct SDNA *sdna) |
| void | DNA_sdna_current_init (void) |
| const struct SDNA * | DNA_sdna_current_get (void) |
| void | DNA_sdna_current_free (void) |
| struct DNA_ReconstructInfo * | DNA_reconstruct_info_create (const struct SDNA *oldsdna, const struct SDNA *newsdna, const char *compare_flags) |
| void | DNA_reconstruct_info_free (struct DNA_ReconstructInfo *reconstruct_info) |
| int | DNA_struct_find_index_with_alias_ex (const struct SDNA *sdna, const char *str, unsigned int *struct_index_last) |
| int | DNA_struct_find_index_without_alias_ex (const struct SDNA *sdna, const char *str, unsigned int *struct_index_last) |
| int | DNA_struct_find_with_alias (const struct SDNA *sdna, const char *str) |
| int | DNA_struct_find_index_without_alias (const struct SDNA *sdna, const char *str) |
| bool | DNA_struct_exists_with_alias (const struct SDNA *sdna, const char *str) |
| bool | DNA_struct_exists_without_alias (const struct SDNA *sdna, const char *stype) |
| bool | DNA_struct_member_exists_with_alias (const struct SDNA *sdna, const char *stype, const char *vartype, const char *name) |
| bool | DNA_struct_member_exists_without_alias (const struct SDNA *sdna, const char *stype, const char *vartype, const char *name) |
| void | DNA_struct_switch_endian (const struct SDNA *sdna, int struct_index, char *data) |
| const char * | DNA_struct_get_compareflags (const struct SDNA *oldsdna, const struct SDNA *newsdna) |
| void * | DNA_struct_reconstruct (const struct DNA_ReconstructInfo *reconstruct_info, int old_struct_index, int blocks, const void *old_blocks, const char *alloc_name) |
| int | DNA_struct_member_offset_by_name_without_alias (const struct SDNA *sdna, const char *stype, const char *vartype, const char *name) |
| int | DNA_struct_member_offset_by_name_with_alias (const struct SDNA *sdna, const char *stype, const char *vartype, const char *name) |
| int | DNA_struct_member_size (const struct SDNA *sdna, short type, short member_index) |
| int | DNA_elem_type_size (eSDNA_Type elem_nr) |
| int | DNA_struct_size (const struct SDNA *sdna, int struct_index) |
| int | DNA_struct_alignment (const struct SDNA *sdna, int struct_index) |
| const char * | DNA_struct_identifier (struct SDNA *sdna, int struct_index) |
| bool | DNA_sdna_patch_struct_by_name (struct SDNA *sdna, const char *old_type_name, const char *new_type_name) |
| bool | DNA_sdna_patch_struct_member_by_name (struct SDNA *sdna, const char *type_name, const char *old_member_name, const char *new_member_name) |
| void | DNA_sdna_alias_data_ensure (struct SDNA *sdna) |
| void | DNA_sdna_alias_data_ensure_structs_map (struct SDNA *sdna) |
Variables | |
| const unsigned char | DNAstr [] |
| const int | DNAlen |
blenloader genfile private function prototypes
Definition in file DNA_genfile.h.
| #define SDNA_TYPE_VOID 9 |
Definition at line 48 of file DNA_genfile.h.
Referenced by init_structDNA().
| typedef enum eSDNA_Type eSDNA_Type |
Primitive (non-struct, non-pointer/function/array) types,
| enum eSDNA_StructCompare |
For use with DNA_struct_reconstruct & DNA_struct_get_compareflags
| Enumerator | |
|---|---|
| SDNA_CMP_REMOVED | |
| SDNA_CMP_EQUAL | |
| SDNA_CMP_NOT_EQUAL | |
| SDNA_CMP_UNKNOWN | |
Definition at line 64 of file DNA_genfile.h.
| enum eSDNA_Type |
Primitive (non-struct, non-pointer/function/array) types,
| Enumerator | |
|---|---|
| SDNA_TYPE_CHAR | |
| SDNA_TYPE_UCHAR | |
| SDNA_TYPE_SHORT | |
| SDNA_TYPE_USHORT | |
| SDNA_TYPE_INT | |
| SDNA_TYPE_FLOAT | |
| SDNA_TYPE_DOUBLE | |
| SDNA_TYPE_INT64 | |
| SDNA_TYPE_UINT64 | |
| SDNA_TYPE_INT8 | |
| SDNA_TYPE_RAW_DATA | Type used for untyped raw bytes buffers (written by BLO_write_raw and read by BLO_read_data_address). Technically, it also covers all 'raw data' types above. |
Definition at line 36 of file DNA_genfile.h.
| int DNA_elem_type_size | ( | eSDNA_Type | elem_nr | ) |
Returns the size in bytes of a primitive type.
Definition at line 1747 of file dna_genfile.cc.
References BLI_assert_msg, SDNA_TYPE_CHAR, SDNA_TYPE_DOUBLE, SDNA_TYPE_FLOAT, SDNA_TYPE_INT, SDNA_TYPE_INT64, SDNA_TYPE_INT8, SDNA_TYPE_RAW_DATA, SDNA_TYPE_SHORT, SDNA_TYPE_UCHAR, SDNA_TYPE_UINT64, and SDNA_TYPE_USHORT.
Referenced by cast_primitive_type().
| struct DNA_ReconstructInfo * DNA_reconstruct_info_create | ( | const struct SDNA * | oldsdna, |
| const struct SDNA * | newsdna, | ||
| const char * | compare_flags ) |
Pre-process information about how structs in newsdna can be reconstructed from structs in oldsdna. This information is then used to speedup DNA_struct_reconstruct.
Referenced by read_file_dna().
| void DNA_reconstruct_info_free | ( | struct DNA_ReconstructInfo * | reconstruct_info | ) |
Definition at line 1670 of file dna_genfile.cc.
References MEM_freeN(), DNA_ReconstructInfo::newsdna, DNA_ReconstructInfo::step_counts, DNA_ReconstructInfo::steps, and SDNA::structs_num.
Referenced by blo_filedata_free().
| void DNA_sdna_alias_data_ensure | ( | struct SDNA * | sdna | ) |
Definition at line 1965 of file dna_genfile.cc.
References SDNA::alias, BLI_ghash_free(), BLI_ghash_lookup_default(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, DNA_alias_maps(), DNA_RENAME_ALIAS_FROM_STATIC, dna_sdna_alias_from_static_elem_full(), DNA_struct_rename_legacy_hack_alias_from_static(), SDNA::mem_arena, MEM_freeN(), MEM_mallocN, SDNA_StructMember::member_index, member_map_alias_from_static, SDNA::members, SDNA_Struct::members, SDNA::members_num, SDNA_Struct::members_num, sdna_expand_names(), SDNA::structs, SDNA::structs_num, SDNA_Struct::type_index, type_map_alias_from_static, SDNA::types, and SDNA::types_num.
Referenced by DNA_sdna_alias_data_ensure_structs_map(), and DNA_struct_identifier().
| void DNA_sdna_alias_data_ensure_structs_map | ( | struct SDNA * | sdna | ) |
Separated from DNA_sdna_alias_data_ensure because it's not needed unless we want to lookup aliased struct names (DNA_struct_find_with_alias and friends).
Definition at line 2031 of file dna_genfile.cc.
References SDNA::alias, BLI_ghash_insert(), BLI_ghash_str_new_ex(), DNA_sdna_alias_data_ensure(), POINTER_FROM_INT, SDNA::structs, SDNA::structs_num, SDNA_Struct::type_index, SDNA::types, SDNA::types_to_structs_map, and UNUSED_VARS.
Referenced by DNA_sdna_from_data(), and read_file_dna().
| void DNA_sdna_current_free | ( | void | ) |
Definition at line 619 of file dna_genfile.cc.
References DNA_sdna_free(), and g_sdna.
Referenced by BlendfileLoadingBaseTest::TearDownTestCase(), and WM_exit_ex().
| const struct SDNA * DNA_sdna_current_get | ( | void | ) |
Definition at line 613 of file dna_genfile.cc.
References BLI_assert, and g_sdna.
Referenced by DNA_sdna_patch_struct(), filedata_new(), and writedata_new().
| void DNA_sdna_current_init | ( | void | ) |
Definition at line 608 of file dna_genfile.cc.
References DNA_sdna_from_data(), DNAlen, DNAstr, and g_sdna.
Referenced by main(), and BlendfileLoadingBaseTest::SetUpTestCase().
| void DNA_sdna_free | ( | struct SDNA * | sdna | ) |
Definition at line 126 of file dna_genfile.cc.
References SDNA::alias, BLI_ghash_free(), BLI_memarena_free(), SDNA::data, SDNA::data_alloc, SDNA::mem_arena, MEM_freeN(), MEM_SAFE_FREE, SDNA::members, SDNA::members_array_num, SDNA::structs, SDNA::types, SDNA::types_alignment, and SDNA::types_to_structs_map.
Referenced by blo_filedata_free(), DNA_sdna_current_free(), DNA_sdna_from_data(), and RNA_define_free().
| struct SDNA * DNA_sdna_from_data | ( | const void * | data, |
| int | data_len, | ||
| bool | do_endian_swap, | ||
| bool | data_alloc, | ||
| bool | do_alias, | ||
| const char ** | r_error_message ) |
Constructs and returns a decoded SDNA structure from the given encoded SDNA data block.
Definition at line 562 of file dna_genfile.cc.
References data, SDNA::data, SDNA::data_alloc, SDNA::data_size, DNA_sdna_alias_data_ensure_structs_map(), DNA_sdna_free(), init_structDNA(), and MEM_mallocN.
Referenced by DNA_sdna_current_init(), read_file_dna(), and RNA_create().
| bool DNA_sdna_patch_struct_by_name | ( | struct SDNA * | sdna, |
| const char * | old_type_name, | ||
| const char * | new_type_name ) |
Find the struct matching the given old_type_name, and rename its type (referenced by its SDNA_Struct.type_index) to the given new_type_name.
WARNING: Deprecated, do not use in new code. Only used to version some renaming done during early 2.80 development.
Definition at line 1803 of file dna_genfile.cc.
References DNA_sdna_patch_struct(), and DNA_struct_find_index_without_alias().
Referenced by blo_do_versions_dna().
| bool DNA_sdna_patch_struct_member_by_name | ( | struct SDNA * | sdna, |
| const char * | type_name, | ||
| const char * | old_member_name, | ||
| const char * | new_member_name ) |
Rename old_member_name with new_member_name for struct matching type_name.
Handles search & replace, maintaining surrounding non-identifier characters such as pointer & array size.
WARNING: Deprecated, do not use in new code. Only used to version some renaming done during early 2.80 development.
Definition at line 1870 of file dna_genfile.cc.
References DNA_sdna_patch_struct_member(), and DNA_struct_find_index_without_alias().
Referenced by blo_do_versions_dna().
Get the alignment that should be used when allocating memory for this type.
Referenced by read_struct().
| bool DNA_struct_exists_with_alias | ( | const struct SDNA * | sdna, |
| const char * | str ) |
A convenience function, the equivalent of: DNA_struct_find_with_alias(..) != -1
| bool DNA_struct_exists_without_alias | ( | const struct SDNA * | sdna, |
| const char * | stype ) |
| int DNA_struct_find_index_with_alias_ex | ( | const struct SDNA * | sdna, |
| const char * | str, | ||
| unsigned int * | struct_index_last ) |
| struct_index_last | Support faster lookups when there is the possibility of the same name being looked up multiple times. Initialize to UINT_MAX. |
Referenced by DNA_struct_find_index_wrapper().
| int DNA_struct_find_index_without_alias_ex | ( | const struct SDNA * | sdna, |
| const char * | str, | ||
| unsigned int * | struct_index_last ) |
Referenced by BLO_blendhandle_get_datablock_info(), BLO_blendhandle_get_preview_for_id(), BLO_get_struct_id_by_name(), and BLO_read_struct_by_name_array().
| const char * DNA_struct_get_compareflags | ( | const struct SDNA * | oldsdna, |
| const struct SDNA * | newsdna ) |
Constructs and returns an array of byte flags with one element for each struct in oldsdna, indicating how it compares to newsdna.
Referenced by read_file_dna().
Return the current (alias) type name of the given struct index.
Definition at line 1779 of file dna_genfile.cc.
References SDNA::alias, DNA_sdna_alias_data_ensure(), SDNA::structs, SDNA_Struct::type_index, and SDNA::types.
Referenced by BLO_read_struct_by_name_array(), and get_alloc_name().
| bool DNA_struct_member_exists_with_alias | ( | const struct SDNA * | sdna, |
| const char * | stype, | ||
| const char * | vartype, | ||
| const char * | name ) |
A convenience function, the equivalent of: DNA_struct_member_find_with_alias(..) != -1
| bool DNA_struct_member_exists_without_alias | ( | const struct SDNA * | sdna, |
| const char * | stype, | ||
| const char * | vartype, | ||
| const char * | name ) |
| int DNA_struct_member_offset_by_name_with_alias | ( | const struct SDNA * | sdna, |
| const char * | stype, | ||
| const char * | vartype, | ||
| const char * | name ) |
Returns the offset of the field with the specified name and type within the specified struct type in SDNA, -1 on failure.
Referenced by read_file_dna().
| int DNA_struct_member_offset_by_name_without_alias | ( | const struct SDNA * | sdna, |
| const char * | stype, | ||
| const char * | vartype, | ||
| const char * | name ) |
A version of DNA_struct_member_offset_by_name_with_alias that uses the non-aliased name. Always prefer aliased names where possible.
Returns the size of struct fields of the specified type and member_index.
| type | Index into sdna->types/types_size |
| member_index | Index into sdna->names, needed to extract possible pointer/array information. |
Referenced by rna_find_sdna_member().
| void * DNA_struct_reconstruct | ( | const struct DNA_ReconstructInfo * | reconstruct_info, |
| int | old_struct_index, | ||
| int | blocks, | ||
| const void * | old_blocks, | ||
| const char * | alloc_name ) |
| reconstruct_info | Information preprocessed by DNA_reconstruct_info_create. |
| old_struct_index | Index of struct info within oldsdna. |
| blocks | The number of array elements. |
| old_blocks | Array of struct data. |
| alloc_name | String to pass to the allocation calls for reconstructed data. |
Referenced by read_struct().
Returns the size of a struct.
| struct_index | Index into the #sdna.structs array (aka BHead.SDNAnr). |
Referenced by BLO_read_struct_by_name_array(), switch_endian_structs(), and writestruct_at_address_nr().
Does endian swapping on the fields of a struct value.
| sdna | SDNA of the struct_nr belongs to |
| struct_nr | Index of struct info within sdna |
| data | Struct data that is to be converted |
Referenced by switch_endian_structs().
|
extern |
Length of DNAstr.
Referenced by DNA_sdna_current_init(), and RNA_create().
|
extern |
DNAstr contains the prebuilt SDNA structure defining the layouts of the types used by this version of Blender. It is defined in a file dna.c, which is generated by the makesdna program during the build process (see makesdna.cc).
Referenced by DNA_sdna_current_init(), and RNA_create().