Blender  V3.3
DNA_genfile.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
9 #pragma once
10 
11 #include "intern/dna_utils.h"
12 
13 struct SDNA;
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
24 extern const unsigned char DNAstr[];
26 extern const int DNAlen;
27 
35 typedef enum eSDNA_Type {
41  /* SDNA_TYPE_LONG = 5, */ /* deprecated (use as int) */
42  /* SDNA_TYPE_ULONG = 6, */ /* deprecated (use as int) */
45 /* ,SDNA_TYPE_VOID = 9 */
46 /* define so switch statements don't complain */
47 #define SDNA_TYPE_VOID 9
52 
57  /* Struct has disappeared
58  * (values of this struct type will not be loaded by the current Blender) */
60  /* Struct is the same
61  * (can be loaded with straight memory copy after any necessary endian conversion) */
63  /* Struct is different in some way
64  * (needs to be copied/converted field by field) */
66  /* This is only used temporarily by #DNA_struct_get_compareflags. */
68 };
69 
73 struct SDNA *DNA_sdna_from_data(const void *data,
74  int data_len,
75  bool do_endian_swap,
76  bool data_alloc,
77  const char **r_error_message);
78 void DNA_sdna_free(struct SDNA *sdna);
79 
80 /* Access for current Blender versions SDNA. */
81 void DNA_sdna_current_init(void);
82 /* borrowed reference */
83 const struct SDNA *DNA_sdna_current_get(void);
84 void DNA_sdna_current_free(void);
85 
86 struct DNA_ReconstructInfo;
92  const struct SDNA *newsdna,
93  const char *compare_flags);
94 void DNA_reconstruct_info_free(struct DNA_ReconstructInfo *reconstruct_info);
95 
99 int DNA_struct_find_nr_ex(const struct SDNA *sdna, const char *str, unsigned int *index_last);
100 int DNA_struct_find_nr(const struct SDNA *sdna, const char *str);
108 void DNA_struct_switch_endian(const struct SDNA *sdna, int struct_nr, char *data);
113 const char *DNA_struct_get_compareflags(const struct SDNA *sdna, const struct SDNA *newsdna);
121 void *DNA_struct_reconstruct(const struct DNA_ReconstructInfo *reconstruct_info,
122  int old_struct_nr,
123  int blocks,
124  const void *old_blocks);
125 
130 int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name);
131 
139 int DNA_elem_size_nr(const struct SDNA *sdna, short type, short name);
140 
141 bool DNA_struct_find(const struct SDNA *sdna, const char *stype);
142 bool DNA_struct_elem_find(const struct SDNA *sdna,
143  const char *stype,
144  const char *vartype,
145  const char *name);
146 
150 int DNA_elem_type_size(eSDNA_Type elem_nr);
151 
155 bool DNA_sdna_patch_struct(struct SDNA *sdna,
156  const char *struct_name_old,
157  const char *struct_name_new);
163 bool DNA_sdna_patch_struct_member(struct SDNA *sdna,
164  const char *struct_name,
165  const char *elem_old,
166  const char *elem_new);
167 
168 void DNA_sdna_alias_data_ensure(struct SDNA *sdna);
169 
170 /* Alias lookups (using runtime struct member names). */
171 
175 int DNA_struct_alias_find_nr_ex(const struct SDNA *sdna,
176  const char *str,
177  unsigned int *index_last);
181 int DNA_struct_alias_find_nr(const struct SDNA *sdna, const char *str);
185 bool DNA_struct_alias_elem_find(const struct SDNA *sdna,
186  const char *stype,
187  const char *vartype,
188  const char *name);
194 
195 #ifdef __cplusplus
196 }
197 #endif
bool DNA_struct_find(const struct SDNA *sdna, const char *stype)
void DNA_sdna_free(struct SDNA *sdna)
Definition: dna_genfile.c:123
eSDNA_Type
Definition: DNA_genfile.h:35
@ SDNA_TYPE_CHAR
Definition: DNA_genfile.h:36
@ SDNA_TYPE_INT
Definition: DNA_genfile.h:40
@ SDNA_TYPE_UINT64
Definition: DNA_genfile.h:49
@ SDNA_TYPE_DOUBLE
Definition: DNA_genfile.h:44
@ SDNA_TYPE_SHORT
Definition: DNA_genfile.h:38
@ SDNA_TYPE_UCHAR
Definition: DNA_genfile.h:37
@ SDNA_TYPE_INT8
Definition: DNA_genfile.h:50
@ SDNA_TYPE_INT64
Definition: DNA_genfile.h:48
@ SDNA_TYPE_FLOAT
Definition: DNA_genfile.h:43
@ SDNA_TYPE_USHORT
Definition: DNA_genfile.h:39
const unsigned char DNAstr[]
int DNA_elem_type_size(eSDNA_Type elem_nr)
Definition: dna_genfile.c:1620
struct SDNA * DNA_sdna_from_data(const void *data, int data_len, bool do_endian_swap, bool data_alloc, const char **r_error_message)
Definition: dna_genfile.c:519
struct DNA_ReconstructInfo * DNA_reconstruct_info_create(const struct SDNA *oldsdna, const struct SDNA *newsdna, const char *compare_flags)
void DNA_struct_switch_endian(const struct SDNA *sdna, int struct_nr, char *data)
int DNA_struct_find_nr_ex(const struct SDNA *sdna, const char *str, unsigned int *index_last)
void DNA_sdna_current_free(void)
Definition: dna_genfile.c:572
int DNA_struct_alias_find_nr(const struct SDNA *sdna, const char *str)
int DNA_elem_size_nr(const struct SDNA *sdna, short type, short name)
void DNA_sdna_current_init(void)
Definition: dna_genfile.c:561
void * DNA_struct_reconstruct(const struct DNA_ReconstructInfo *reconstruct_info, int old_struct_nr, int blocks, const void *old_blocks)
bool DNA_sdna_patch_struct_member(struct SDNA *sdna, const char *struct_name, const char *elem_old, const char *elem_new)
Definition: dna_genfile.c:1719
void DNA_sdna_alias_data_ensure(struct SDNA *sdna)
Definition: dna_genfile.c:1810
bool DNA_struct_alias_elem_find(const struct SDNA *sdna, const char *stype, const char *vartype, const char *name)
int DNA_struct_find_nr(const struct SDNA *sdna, const char *str)
const char * DNA_struct_get_compareflags(const struct SDNA *sdna, const struct SDNA *newsdna)
const int DNAlen
void DNA_reconstruct_info_free(struct DNA_ReconstructInfo *reconstruct_info)
Definition: dna_genfile.c:1559
const struct SDNA * DNA_sdna_current_get(void)
Definition: dna_genfile.c:566
int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name)
Definition: dna_genfile.c:1571
bool DNA_struct_elem_find(const struct SDNA *sdna, const char *stype, const char *vartype, const char *name)
bool DNA_sdna_patch_struct(struct SDNA *sdna, const char *struct_name_old, const char *struct_name_new)
Definition: dna_genfile.c:1662
eSDNA_StructCompare
Definition: DNA_genfile.h:56
@ SDNA_CMP_EQUAL
Definition: DNA_genfile.h:62
@ SDNA_CMP_REMOVED
Definition: DNA_genfile.h:59
@ SDNA_CMP_UNKNOWN
Definition: DNA_genfile.h:67
@ SDNA_CMP_NOT_EQUAL
Definition: DNA_genfile.h:65
void DNA_sdna_alias_data_ensure_structs_map(struct SDNA *sdna)
Definition: dna_genfile.c:1867
int DNA_struct_alias_find_nr_ex(const struct SDNA *sdna, const char *str, unsigned int *index_last)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
#define str(s)
const SDNA * newsdna
Definition: dna_genfile.c:1119
const SDNA * oldsdna
Definition: dna_genfile.c:1118
const char * compare_flags
Definition: dna_genfile.c:1120
int data_len
bool data_alloc