Blender V5.0
DNA_genfile.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9
10#pragma once
11
12#include "intern/dna_utils.h"
13
14struct SDNA;
15
21extern const unsigned char DNAstr[];
23extern const int DNAlen;
24
33typedef enum eSDNA_Type {
39 /* SDNA_TYPE_LONG = 5, */ /* deprecated (use as int) */
40 /* SDNA_TYPE_ULONG = 6, */ /* deprecated (use as int) */
43/* ,SDNA_TYPE_VOID = 9 */
44/* define so switch statements don't complain */
45#define SDNA_TYPE_VOID 9
57
62 /* Struct has disappeared
63 * (values of this struct type will not be loaded by the current Blender) */
65 /* Struct is the same (can be loaded with straight memory copy). */
67 /* Struct is different in some way
68 * (needs to be copied/converted field by field) */
70 /* This is only used temporarily by #DNA_struct_get_compareflags. */
72};
73
78 const void *data, int data_len, bool data_alloc, bool do_alias, const char **r_error_message);
79void DNA_sdna_free(struct SDNA *sdna);
80
81/* Access for current Blender versions SDNA. */
82void DNA_sdna_current_init(void);
83/* borrowed reference */
84const struct SDNA *DNA_sdna_current_get(void);
85void DNA_sdna_current_free(void);
86
93 const struct SDNA *newsdna,
94 const char *compare_flags);
95void DNA_reconstruct_info_free(struct DNA_ReconstructInfo *reconstruct_info);
96
104 const char *str,
105 unsigned int *struct_index_last);
108 const char *str,
109 unsigned int *struct_index_last);
113int DNA_struct_find_with_alias(const struct SDNA *sdna, const char *str);
115int DNA_struct_find_index_without_alias(const struct SDNA *sdna, const char *str);
116
120bool DNA_struct_exists_with_alias(const struct SDNA *sdna, const char *str);
122bool DNA_struct_exists_without_alias(const struct SDNA *sdna, const char *stype);
127 const char *stype,
128 const char *vartype,
129 const char *name);
132 const char *stype,
133 const char *vartype,
134 const char *name);
135
140const char *DNA_struct_get_compareflags(const struct SDNA *oldsdna, const struct SDNA *newsdna);
149void *DNA_struct_reconstruct(const struct DNA_ReconstructInfo *reconstruct_info,
150 int old_struct_index,
151 int blocks,
152 const void *old_blocks,
153 const char *alloc_name);
154
160 const char *stype,
161 const char *vartype,
162 const char *name);
168 const char *stype,
169 const char *vartype,
170 const char *name);
171
179int DNA_struct_member_size(const struct SDNA *sdna, short type, short member_index);
180
184int DNA_elem_type_size(eSDNA_Type elem_nr);
185
191int DNA_struct_size(const struct SDNA *sdna, int struct_index);
192
196int DNA_struct_alignment(const struct SDNA *sdna, int struct_index);
197
201const char *DNA_struct_identifier(struct SDNA *sdna, int struct_index);
202
210bool DNA_sdna_patch_struct_by_name(struct SDNA *sdna,
211 const char *old_type_name,
212 const char *new_type_name);
223 const char *type_name,
224 const char *old_member_name,
225 const char *new_member_name);
226
227void DNA_sdna_alias_data_ensure(struct SDNA *sdna);
228
234
235/* For versioning, avoid verbosity selecting between with/without alias versions of functions. */
236#ifdef DNA_GENFILE_VERSIONING_MACROS
237# define DNA_struct_exists(sdna, str) DNA_struct_exists_with_alias(sdna, str)
238# define DNA_struct_member_exists(sdna, stype, vartype, name) \
239 DNA_struct_member_exists_with_alias(sdna, stype, vartype, name)
240#endif
const char * DNA_struct_get_compareflags(const struct SDNA *oldsdna, const struct SDNA *newsdna)
void DNA_sdna_free(struct SDNA *sdna)
eSDNA_Type
Definition DNA_genfile.h:33
@ SDNA_TYPE_CHAR
Definition DNA_genfile.h:34
@ SDNA_TYPE_RAW_DATA
Definition DNA_genfile.h:55
@ SDNA_TYPE_INT
Definition DNA_genfile.h:38
@ SDNA_TYPE_UINT64
Definition DNA_genfile.h:47
@ SDNA_TYPE_DOUBLE
Definition DNA_genfile.h:42
@ SDNA_TYPE_SHORT
Definition DNA_genfile.h:36
@ SDNA_TYPE_UCHAR
Definition DNA_genfile.h:35
@ SDNA_TYPE_INT8
Definition DNA_genfile.h:48
@ SDNA_TYPE_INT64
Definition DNA_genfile.h:46
@ SDNA_TYPE_FLOAT
Definition DNA_genfile.h:41
@ SDNA_TYPE_USHORT
Definition DNA_genfile.h:37
const struct SDNA * DNA_sdna_current_get(void)
int DNA_struct_find_with_alias(const struct SDNA *sdna, const char *str)
const unsigned char DNAstr[]
int DNA_elem_type_size(eSDNA_Type elem_nr)
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_size(const struct SDNA *sdna, int struct_index)
const char * DNA_struct_identifier(struct SDNA *sdna, int struct_index)
void DNA_sdna_current_free(void)
bool DNA_sdna_patch_struct_by_name(struct SDNA *sdna, const char *old_type_name, const char *new_type_name)
void DNA_sdna_current_init(void)
void * DNA_struct_reconstruct(const struct DNA_ReconstructInfo *reconstruct_info, int old_struct_index, int blocks, const void *old_blocks, const char *alloc_name)
bool DNA_struct_exists_without_alias(const struct SDNA *sdna, const char *stype)
struct SDNA * DNA_sdna_from_data(const void *data, int data_len, bool data_alloc, bool do_alias, const char **r_error_message)
struct DNA_ReconstructInfo * DNA_reconstruct_info_create(const struct SDNA *oldsdna, const struct SDNA *newsdna, const char *compare_flags)
void DNA_sdna_alias_data_ensure(struct SDNA *sdna)
bool DNA_struct_member_exists_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_struct_find_index_with_alias_ex(const struct SDNA *sdna, const char *str, unsigned int *struct_index_last)
bool DNA_struct_member_exists_without_alias(const struct SDNA *sdna, const char *stype, const char *vartype, const char *name)
const int DNAlen
int DNA_struct_find_index_without_alias(const struct SDNA *sdna, const char *str)
void DNA_reconstruct_info_free(struct DNA_ReconstructInfo *reconstruct_info)
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)
int DNA_struct_alignment(const struct SDNA *sdna, int struct_index)
int DNA_struct_find_index_without_alias_ex(const struct SDNA *sdna, const char *str, unsigned int *struct_index_last)
eSDNA_StructCompare
Definition DNA_genfile.h:61
@ SDNA_CMP_EQUAL
Definition DNA_genfile.h:66
@ SDNA_CMP_REMOVED
Definition DNA_genfile.h:64
@ SDNA_CMP_UNKNOWN
Definition DNA_genfile.h:71
@ SDNA_CMP_NOT_EQUAL
Definition DNA_genfile.h:69
void DNA_sdna_alias_data_ensure_structs_map(struct SDNA *sdna)
bool DNA_struct_exists_with_alias(const struct SDNA *sdna, const char *str)
int DNA_struct_member_offset_by_name_without_alias(const struct SDNA *sdna, const char *stype, const char *vartype, const char *name)
BMesh const char void * data
#define str(s)
const char * name
const char * compare_flags
bool data_alloc