Blender V5.3
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
19extern const unsigned char DNAstr[];
21extern const int DNAlen;
22
23namespace blender {
24
25struct SDNA;
26
41 /* SDNA_TYPE_LONG = 5, */ /* deprecated (use as int) */
42 /* SDNA_TYPE_ULONG = 6, */ /* deprecated (use as int) */
56};
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
77std::unique_ptr<SDNA> DNA_sdna_from_data(
78 const void *data, int data_len, bool data_alloc, bool do_alias, const char **r_error_message);
79
80/* Access for current Blender versions SDNA. */
81const SDNA *DNA_sdna_current_get();
82
83struct DNA_ReconstructInfo;
89 const struct SDNA *newsdna,
90 const char *compare_flags);
91void DNA_reconstruct_info_free(struct DNA_ReconstructInfo *reconstruct_info);
92
101 unsigned int *struct_index_last);
105 unsigned int *struct_index_last);
112
118bool DNA_struct_exists_without_alias(const struct SDNA *sdna, StringRef stype);
123 StringRef stype,
124 StringRef vartype,
125 StringRef name);
128 StringRef stype,
129 StringRef vartype,
130 StringRef name);
131
136const char *DNA_struct_get_compareflags(const struct SDNA *oldsdna, const struct SDNA *newsdna);
146void *DNA_struct_reconstruct(const struct DNA_ReconstructInfo *reconstruct_info,
147 int old_struct_index,
148 int blocks,
149 const void *old_blocks,
150 const char *alloc_name,
151 int64_t *r_alloc_size = nullptr);
152
158 StringRef stype,
159 StringRef vartype,
160 StringRef name);
166 StringRef stype,
167 StringRef vartype,
168 StringRef name);
169
177int DNA_struct_member_size(const struct SDNA *sdna, short type, short member_index);
178
182int DNA_elem_type_size(eSDNA_Type elem_nr);
183
189int DNA_struct_size(const struct SDNA *sdna, int struct_index);
190
194int DNA_struct_alignment(const struct SDNA *sdna, int struct_index);
195
199StringRef DNA_struct_identifier(struct SDNA *sdna, int struct_index);
200
208bool DNA_sdna_patch_struct_by_name(struct SDNA *sdna,
209 StringRef old_type_name,
210 StringRef new_type_name);
221 StringRef type_name,
222 StringRef old_member_name,
223 StringRef new_member_name);
224
225void DNA_sdna_alias_data_ensure(struct SDNA *sdna);
226
232
233/* For versioning, avoid verbosity selecting between with/without alias versions of functions. */
234#ifdef DNA_GENFILE_VERSIONING_MACROS
235# define DNA_struct_exists(sdna, str) DNA_struct_exists_with_alias(sdna.get(), str)
236# define DNA_struct_member_exists(sdna, stype, vartype, name) \
237 DNA_struct_member_exists_with_alias(sdna.get(), stype, vartype, name)
238#endif
239
240} // namespace blender
const unsigned char DNAstr[]
const int DNAlen
#define str(s)
BMesh Iterators.
struct DNA_ReconstructInfo * DNA_reconstruct_info_create(const struct SDNA *oldsdna, const struct SDNA *newsdna, const char *compare_flags)
__int64 int64_t
Definition BKE_text.h:90
int DNA_struct_member_offset_by_name_without_alias(const struct SDNA *sdna, StringRef stype, StringRef vartype, StringRef name)
bool DNA_sdna_patch_struct_member_by_name(struct SDNA *sdna, StringRef type_name, StringRef old_member_name, StringRef new_member_name)
bool DNA_sdna_patch_struct_by_name(struct SDNA *sdna, StringRef old_type_name, StringRef new_type_name)
void DNA_reconstruct_info_free(struct DNA_ReconstructInfo *reconstruct_info)
eSDNA_StructCompare
Definition DNA_genfile.h:61
@ SDNA_CMP_EQUAL
Definition DNA_genfile.h:66
@ SDNA_CMP_NOT_EQUAL
Definition DNA_genfile.h:69
@ SDNA_CMP_UNKNOWN
Definition DNA_genfile.h:71
@ SDNA_CMP_REMOVED
Definition DNA_genfile.h:64
void * DNA_struct_reconstruct(const struct DNA_ReconstructInfo *reconstruct_info, int old_struct_index, int blocks, const void *old_blocks, const char *alloc_name, int64_t *r_alloc_size=nullptr)
int DNA_struct_member_size(const struct SDNA *sdna, short type, short member_index)
int DNA_elem_type_size(eSDNA_Type elem_nr)
bool DNA_struct_exists_without_alias(const struct SDNA *sdna, StringRef stype)
StringRef DNA_struct_identifier(struct SDNA *sdna, int struct_index)
int DNA_struct_find_index_without_alias_ex(const struct SDNA *sdna, StringRef str, unsigned int *struct_index_last)
const char * DNA_struct_get_compareflags(const struct SDNA *oldsdna, const struct SDNA *newsdna)
BMesh const char void * data
bool DNA_struct_member_exists_without_alias(const struct SDNA *sdna, StringRef stype, StringRef vartype, StringRef name)
int DNA_struct_size(const struct SDNA *sdna, int struct_index)
void DNA_sdna_alias_data_ensure_structs_map(struct SDNA *sdna)
int DNA_struct_find_with_alias(const struct SDNA *sdna, StringRef str)
int DNA_struct_find_index_without_alias(const struct SDNA *sdna, StringRef str)
bool DNA_struct_member_exists_with_alias(const struct SDNA *sdna, StringRef stype, StringRef vartype, StringRef name)
int DNA_struct_alignment(const struct SDNA *sdna, int struct_index)
@ SDNA_TYPE_INT64
Definition DNA_genfile.h:45
@ SDNA_TYPE_SHORT
Definition DNA_genfile.h:38
@ SDNA_TYPE_UINT64
Definition DNA_genfile.h:46
@ SDNA_TYPE_FLOAT
Definition DNA_genfile.h:43
@ SDNA_TYPE_RAW_DATA
Definition DNA_genfile.h:55
@ SDNA_TYPE_USHORT
Definition DNA_genfile.h:39
@ SDNA_TYPE_UCHAR
Definition DNA_genfile.h:37
@ SDNA_TYPE_INT
Definition DNA_genfile.h:40
@ SDNA_TYPE_CHAR
Definition DNA_genfile.h:36
@ SDNA_TYPE_DOUBLE
Definition DNA_genfile.h:44
@ SDNA_TYPE_VOID
Definition DNA_genfile.h:47
@ SDNA_TYPE_INT8
Definition DNA_genfile.h:48
void DNA_sdna_alias_data_ensure(struct SDNA *sdna)
const SDNA * DNA_sdna_current_get()
int DNA_struct_member_offset_by_name_with_alias(const struct SDNA *sdna, StringRef stype, StringRef vartype, StringRef name)
int DNA_struct_find_index_with_alias_ex(const struct SDNA *sdna, StringRef str, unsigned int *struct_index_last)
bool DNA_struct_exists_with_alias(const struct SDNA *sdna, StringRef str)
std::unique_ptr< SDNA > DNA_sdna_from_data(const void *data, int data_len, bool data_alloc, bool do_alias, const char **r_error_message)