Class StructDNA
- java.lang.Object
-
- org.cakelab.blender.io.dna.internal.StructDNA
-
public class StructDNA extends java.lang.Object
Struct DNA is stored in the file-block with code 'DNA1'. Its block's position in the file is arbitrary.
Struct DNA contains the meta-information of all data types (c-structs and scalar types) supported by the Blender version the file was created in, thus it can be very long. All data types considered are declared in one of the header files in directory "source/blender/makesdna" which also contains the code to generate this information in the file. "source/blender/makesdna/DNA_documentation.h" describes the rules for the declaration of structs.
A C struct is described by its type name, a length and its fields (member variables). Each field has a name and a basic type which can be scalar (char, int, double, etc.) or a struct. Furthermore the field can be a pointer, an array or an array of pointers or arrays etc.. This information is encoded in the fields name the way a variable declaration in C would contain it.
Example meta-information on a field:
type name int *verts[128] Thus, the actual name of a field has to be extracted and the type is a combination of both: type and name information.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StructDNA.Struct
-
Field Summary
Fields Modifier and Type Field Description java.lang.String[]
names
list of names.int
names_len
number of names to followStructDNA.Struct[]
structs
structure informationsint
structs_len
length of the struct type listshort[]
type_lengths
list with the length of each type in bytes.java.lang.String[]
types
list of type names as zero terminated strings.int
types_len
length of the type list
-
Constructor Summary
Constructors Constructor Description StructDNA()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
read(CDataReadWriteAccess io)
java.lang.String
toString()
void
write(CDataReadWriteAccess io)
-
-
-
Field Detail
-
names_len
public int names_len
number of names to follow
-
names
public java.lang.String[] names
list of names. Each name is a Zero terminated string. These names can contain pointer and simple array definitions (e.g. '*vertex[3]\0')
-
types_len
public int types_len
length of the type list
-
types
public java.lang.String[] types
list of type names as zero terminated strings.
-
type_lengths
public short[] type_lengths
list with the length of each type in bytes.
-
structs_len
public int structs_len
length of the struct type list
-
structs
public StructDNA.Struct[] structs
structure informations
-
-
Method Detail
-
read
public void read(CDataReadWriteAccess io) throws java.io.IOException
- Throws:
java.io.IOException
-
write
public void write(CDataReadWriteAccess io) throws java.io.IOException
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-