2002-10-12 11:37:38 +00:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-01-07 19:13:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup DNA
|
|
|
|
* \brief blenloader genfile private function prototypes
|
2011-02-17 20:48:12 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __DNA_GENFILE_H__
|
|
|
|
#define __DNA_GENFILE_H__
|
2011-12-30 07:25:49 +00:00
|
|
|
|
2019-02-12 17:03:16 +11:00
|
|
|
#include "intern/dna_utils.h"
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
struct SDNA;
|
|
|
|
|
2019-01-07 22:19:13 +11:00
|
|
|
/**
|
|
|
|
* DNAstr contains the prebuilt SDNA structure defining the layouts of the types
|
2013-02-22 13:35:32 +00:00
|
|
|
* used by this version of Blender. It is defined in a file dna.c, which is
|
2019-01-07 22:19:13 +11:00
|
|
|
* generated by the makesdna program during the build process (see makesdna.c).
|
|
|
|
*/
|
2013-02-22 13:35:32 +00:00
|
|
|
extern const unsigned char DNAstr[];
|
2019-01-07 22:19:13 +11:00
|
|
|
/** Length of DNAstr. */
|
|
|
|
extern const int DNAlen;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2016-01-15 09:16:24 +11:00
|
|
|
/**
|
|
|
|
* Primitive (non-struct, non-pointer/function/array) types,
|
|
|
|
* \warning Don't change these values!
|
|
|
|
* Currently changes here here will work on native endianness,
|
|
|
|
* however #DNA_struct_switch_endian currently checks these
|
|
|
|
* hard-coded values against those from old files.
|
|
|
|
*/
|
2011-12-22 23:18:43 +00:00
|
|
|
typedef enum eSDNA_Type {
|
|
|
|
SDNA_TYPE_CHAR = 0,
|
|
|
|
SDNA_TYPE_UCHAR = 1,
|
|
|
|
SDNA_TYPE_SHORT = 2,
|
|
|
|
SDNA_TYPE_USHORT = 3,
|
|
|
|
SDNA_TYPE_INT = 4,
|
2016-01-15 09:16:24 +11:00
|
|
|
/* SDNA_TYPE_LONG = 5, */ /* deprecated (use as int) */
|
|
|
|
/* SDNA_TYPE_ULONG = 6, */ /* deprecated (use as int) */
|
|
|
|
SDNA_TYPE_FLOAT = 7,
|
|
|
|
SDNA_TYPE_DOUBLE = 8,
|
|
|
|
/* ,SDNA_TYPE_VOID = 9 */
|
2016-01-11 09:18:46 +11:00
|
|
|
/* define so switch statements don't complain */
|
2016-01-15 09:16:24 +11:00
|
|
|
#define SDNA_TYPE_VOID 9
|
|
|
|
SDNA_TYPE_INT64 = 10,
|
2019-01-15 23:57:49 +11:00
|
|
|
SDNA_TYPE_UINT64 = 11,
|
2011-12-22 23:18:43 +00:00
|
|
|
} eSDNA_Type;
|
|
|
|
|
2016-01-16 15:00:22 +11:00
|
|
|
/**
|
|
|
|
* For use with #DNA_struct_reconstruct & #DNA_struct_get_compareflags
|
|
|
|
*/
|
|
|
|
enum eSDNA_StructCompare {
|
2019-01-15 23:14:35 +11:00
|
|
|
/* Struct has disappeared
|
|
|
|
* (values of this struct type will not be loaded by the current Blender) */
|
2016-01-16 15:00:22 +11:00
|
|
|
SDNA_CMP_REMOVED = 0,
|
2019-01-15 23:14:35 +11:00
|
|
|
/* Struct is the same
|
|
|
|
* (can be loaded with straight memory copy after any necessary endian conversion) */
|
2016-01-16 15:00:22 +11:00
|
|
|
SDNA_CMP_EQUAL = 1,
|
2019-01-15 23:14:35 +11:00
|
|
|
/* Struct is different in some way
|
|
|
|
* (needs to be copied/converted field by field) */
|
2016-01-16 15:00:22 +11:00
|
|
|
SDNA_CMP_NOT_EQUAL = 2,
|
|
|
|
};
|
2011-12-23 04:40:07 +00:00
|
|
|
|
2016-07-06 22:23:50 +10:00
|
|
|
struct SDNA *DNA_sdna_from_data(
|
2019-03-03 01:05:58 +11:00
|
|
|
const void *data, const int data_len,
|
2016-07-12 12:23:48 +10:00
|
|
|
bool do_endian_swap, bool data_alloc,
|
|
|
|
const char **r_error_message);
|
2008-10-31 23:50:02 +00:00
|
|
|
void DNA_sdna_free(struct SDNA *sdna);
|
|
|
|
|
2016-07-12 12:53:49 +10:00
|
|
|
/* Access for current Blender versions SDNA*/
|
|
|
|
void DNA_sdna_current_init(void);
|
|
|
|
/* borrowed reference */
|
|
|
|
const struct SDNA *DNA_sdna_current_get(void);
|
|
|
|
void DNA_sdna_current_free(void);
|
|
|
|
|
2016-07-12 11:48:04 +10:00
|
|
|
int DNA_struct_find_nr_ex(const struct SDNA *sdna, const char *str, unsigned int *index_last);
|
|
|
|
int DNA_struct_find_nr(const struct SDNA *sdna, const char *str);
|
|
|
|
void DNA_struct_switch_endian(const struct SDNA *oldsdna, int oldSDNAnr, char *data);
|
2016-07-21 11:49:30 +10:00
|
|
|
const char *DNA_struct_get_compareflags(const struct SDNA *sdna, const struct SDNA *newsdna);
|
2016-07-12 11:48:04 +10:00
|
|
|
void *DNA_struct_reconstruct(
|
|
|
|
const struct SDNA *newsdna, const struct SDNA *oldsdna,
|
2016-07-21 11:49:30 +10:00
|
|
|
const char *compflags, int oldSDNAnr, int blocks, const void *data);
|
2008-10-31 23:50:02 +00:00
|
|
|
|
2010-12-03 17:05:21 +00:00
|
|
|
int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2016-08-13 01:40:19 +02:00
|
|
|
bool DNA_struct_find(const struct SDNA *sdna, const char *stype);
|
2016-07-21 11:49:30 +10:00
|
|
|
bool DNA_struct_elem_find(const struct SDNA *sdna, const char *stype, const char *vartype, const char *name);
|
2013-03-17 14:38:58 +00:00
|
|
|
|
2002-10-30 02:07:20 +00:00
|
|
|
|
2011-12-22 23:18:43 +00:00
|
|
|
int DNA_elem_type_size(const eSDNA_Type elem_nr);
|
2008-10-31 23:50:02 +00:00
|
|
|
|
2019-02-12 09:29:18 +11:00
|
|
|
bool DNA_sdna_patch_struct(
|
|
|
|
struct SDNA *sdna, const char *struct_name_old, const char *struct_name_new);
|
|
|
|
bool DNA_sdna_patch_struct_member(
|
2019-02-15 17:20:11 +11:00
|
|
|
struct SDNA *sdna, const char *struct_name, const char *elem_old, const char *elem_new);
|
2019-02-12 09:29:18 +11:00
|
|
|
|
2019-02-12 11:43:33 +11:00
|
|
|
void DNA_sdna_alias_data_ensure(struct SDNA *sdna);
|
|
|
|
|
2012-04-07 12:37:15 +00:00
|
|
|
#endif /* __DNA_GENFILE_H__ */
|