Class 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:

    typename
    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.

    • 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
    • Constructor Detail

      • StructDNA

        public StructDNA()
    • 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 class java.lang.Object