DNA: support DNA type & name aliases
[blender.git] / source / blender / makesdna / intern / makesdna.c
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19
20 /** \file \ingroup DNA
21  *
22  * \brief Struct muncher for making SDNA.
23  *
24  * \section aboutmakesdnac About makesdna tool
25  * Originally by Ton, some mods by Frank, and some cleaning and
26  * extension by Nzc.
27  *
28  * Makesdna creates a .c file with a long string of numbers that
29  * encode the Blender file format. It is fast, because it is basically
30  * a binary dump. There are some details to mind when reconstructing
31  * the file (endianness and byte-alignment).
32  *
33  * This little program scans all structs that need to be serialized,
34  * and determined the names and types of all members. It calculates
35  * how much memory (on disk or in ram) is needed to store that struct,
36  * and the offsets for reaching a particular one.
37  *
38  * There is a facility to get verbose output from sdna. Search for
39  * \ref debugSDNA. This int can be set to 0 (no output) to some int. Higher
40  * numbers give more output.
41  */
42
43 #include <string.h>
44 #include <stdlib.h>
45 #include <stdio.h>
46 #include <assert.h>
47
48 #include "MEM_guardedalloc.h"
49
50 #include "BLI_utildefines.h"
51 #include "BLI_alloca.h"
52 #include "BLI_ghash.h"
53 #include "BLI_memarena.h"
54 #include "BLI_sys_types.h"  /* for intptr_t support */
55
56 #include "dna_utils.h"
57
58 #define SDNA_MAX_FILENAME_LENGTH 255
59
60 /* Included the path relative from /source/blender/ here, so we can move     */
61 /* headers around with more freedom.                                         */
62 static const char *includefiles[] = {
63
64         /* if you add files here, please add them at the end
65          * of makesdna.c (this file) as well */
66         "DNA_listBase.h",
67         "DNA_vec_types.h",
68         "DNA_ID.h",
69         "DNA_ipo_types.h",
70         "DNA_key_types.h",
71         "DNA_text_types.h",
72         "DNA_packedFile_types.h",
73         "DNA_gpu_types.h",
74         "DNA_camera_types.h",
75         "DNA_image_types.h",
76         "DNA_texture_types.h",
77         "DNA_lamp_types.h",
78         "DNA_material_types.h",
79         "DNA_vfont_types.h",
80         "DNA_meta_types.h",
81         "DNA_curve_types.h",
82         "DNA_mesh_types.h",
83         "DNA_meshdata_types.h",
84         "DNA_modifier_types.h",
85         "DNA_lattice_types.h",
86         "DNA_object_types.h",
87         "DNA_object_force_types.h",
88         "DNA_object_fluidsim_types.h",
89         "DNA_world_types.h",
90         "DNA_scene_types.h",
91         "DNA_view3d_types.h",
92         "DNA_view2d_types.h",
93         "DNA_space_types.h",
94         "DNA_userdef_types.h",
95         "DNA_screen_types.h",
96         "DNA_sdna_types.h",
97         "DNA_fileglobal_types.h",
98         "DNA_sequence_types.h",
99         "DNA_effect_types.h",
100         "DNA_outliner_types.h",
101         "DNA_sound_types.h",
102         "DNA_collection_types.h",
103         "DNA_armature_types.h",
104         "DNA_action_types.h",
105         "DNA_constraint_types.h",
106         "DNA_nla_types.h",
107         "DNA_node_types.h",
108         "DNA_color_types.h",
109         "DNA_brush_types.h",
110         "DNA_customdata_types.h",
111         "DNA_particle_types.h",
112         "DNA_cloth_types.h",
113         "DNA_gpencil_types.h",
114         "DNA_gpencil_modifier_types.h",
115         "DNA_shader_fx_types.h",
116         "DNA_windowmanager_types.h",
117         "DNA_anim_types.h",
118         "DNA_boid_types.h",
119         "DNA_smoke_types.h",
120         "DNA_speaker_types.h",
121         "DNA_movieclip_types.h",
122         "DNA_tracking_types.h",
123         "DNA_dynamicpaint_types.h",
124         "DNA_mask_types.h",
125         "DNA_rigidbody_types.h",
126         "DNA_freestyle_types.h",
127         "DNA_linestyle_types.h",
128         "DNA_cachefile_types.h",
129         "DNA_layer_types.h",
130         "DNA_workspace_types.h",
131         "DNA_lightprobe_types.h",
132
133         /* see comment above before editing! */
134
135         /* empty string to indicate end of includefiles */
136         "",
137 };
138
139 /* -------------------------------------------------------------------- */
140 /** \name Variables
141  * \{ */
142
143 MemArena *mem_arena = NULL;
144
145 static int maxdata = 500000, maxnr = 50000;
146 static int nr_names = 0;
147 static int nr_types = 0;
148 static int nr_structs = 0;
149 /** at address names[a] is string a */
150 static char **names;
151 /** at address types[a] is string a */
152 static char **types;
153 /** at typelens[a] is the length of type 'a' on this systems bitness (32 or 64) */
154 static short *typelens_native;
155 /** contains sizes as they are calculated on 32 bit systems */
156 static short *typelens_32;
157 /** contains sizes as they are calculated on 64 bit systems */
158 static short *typelens_64;
159 /** at sp = structs[a] is the first address of a struct definition
160  * sp[0] is type number
161  * sp[1] is amount of elements
162  * sp[2] sp[3] is typenr,  namenr (etc) */
163 static short **structs, *structdata;
164
165 /** Versioning data */
166 static struct {
167         GHash *struct_map_alias_from_static;
168         GHash *struct_map_static_from_alias;
169         GHash *elem_map_static_from_alias;
170 } g_version_data = {NULL};
171
172 /**
173  * Variable to control debug output of makesdna.
174  * debugSDNA:
175  * - 0 = no output, except errors
176  * - 1 = detail actions
177  * - 2 = full trace, tell which names and types were found
178  * - 4 = full trace, plus all gritty details
179  */
180 static int debugSDNA = 0;
181 static int additional_slen_offset;
182
183 #define DEBUG_PRINTF(debug_level, ...) \
184         { if (debugSDNA > debug_level) { printf(__VA_ARGS__); } } ((void)0)
185
186
187 /* stub for BLI_abort() */
188 #ifndef NDEBUG
189 void BLI_system_backtrace(FILE *fp)
190 {
191        (void)fp;
192 }
193 #endif
194
195 /** \} */
196
197 /* -------------------------------------------------------------------- */
198 /** \name Function Declarations
199  * \{ */
200
201 /**
202  * Ensure type \c str to is in the #types array.
203  * \param str: Struct name without any qualifiers.
204  * \param len: The struct size in bytes.
205  * \return Index in the #types array.
206  */
207 static int add_type(const char *str, int len);
208
209 /**
210  * Ensure \c str is int the #names array.
211  * \param str: Struct member name which may include pointer prefix & array size.
212  * \return Index in the #names array.
213  */
214 static int add_name(const char *str);
215
216 /**
217  * Search whether this structure type was already found, and if not,
218  * add it.
219  */
220 static short *add_struct(int namecode);
221
222 /**
223  * Remove comments from this buffer. Assumes that the buffer refers to
224  * ascii-code text.
225  */
226 static int preprocess_include(char *maindata, int len);
227
228 /**
229  * Scan this file for serializable types.
230  */
231 static int convert_include(const char *filename);
232
233 /**
234  * Determine how many bytes are needed for each struct.
235  */
236 static int calculate_structlens(int);
237
238 /**
239  * Construct the DNA.c file
240  */
241 static void dna_write(FILE *file, const void *pntr, const int size);
242
243 /**
244  * Report all structures found so far, and print their lengths.
245  */
246 void printStructLengths(void);
247
248 /** \} */
249
250 /* -------------------------------------------------------------------- */
251 /** \name Implementation
252  *
253  * Make DNA string (write to file).
254  * \{ */
255
256
257 static const char *version_struct_static_from_alias(const char *str)
258 {
259         const char *str_test = BLI_ghash_lookup(g_version_data.struct_map_static_from_alias, str);
260         if (str_test != NULL) {
261                 return str_test;
262         }
263         return str;
264 }
265
266 static const char *version_struct_alias_from_static(const char *str)
267 {
268         const char *str_test = BLI_ghash_lookup(g_version_data.struct_map_alias_from_static, str);
269         if (str_test != NULL) {
270                 return str_test;
271         }
272         return str;
273 }
274
275 static const char *version_elem_static_from_alias(
276         const int strct, const char *elem_alias_full)
277 {
278         const uint elem_alias_full_len = strlen(elem_alias_full);
279         char *elem_alias = alloca(elem_alias_full_len + 1);
280         const int elem_alias_len = DNA_elem_id_strip_copy(elem_alias, elem_alias_full);
281         const char *str_pair[2] = {types[strct], elem_alias};
282         const char *elem_static = BLI_ghash_lookup(g_version_data.elem_map_static_from_alias, str_pair);
283         if (elem_static != NULL) {
284                 return DNA_elem_id_rename(
285                         mem_arena,
286                         elem_alias, elem_alias_len,
287                         elem_static, strlen(elem_static),
288                         elem_alias_full, elem_alias_full_len,
289                         DNA_elem_id_offset_start(elem_alias_full));
290         }
291         return elem_alias_full;
292 }
293
294 static int add_type(const char *str, int len)
295 {
296         int nr;
297         char *cp;
298
299         /* first do validity check */
300         if (str[0] == 0) {
301                 return -1;
302         }
303         else if (strchr(str, '*')) {
304                 /* note: this is valid C syntax but we can't parse, complain!
305                  * 'struct SomeStruct* somevar;' <-- correct but we cant handle right now. */
306                 return -1;
307         }
308
309         str = version_struct_static_from_alias(str);
310
311         /* search through type array */
312         for (nr = 0; nr < nr_types; nr++) {
313                 if (strcmp(str, types[nr]) == 0) {
314                         if (len) {
315                                 typelens_native[nr] = len;
316                                 typelens_32[nr] = len;
317                                 typelens_64[nr] = len;
318                         }
319                         return nr;
320                 }
321         }
322
323         /* append new type */
324         const int str_size = strlen(str) + 1;
325         cp = BLI_memarena_alloc(mem_arena, str_size);
326         memcpy(cp, str, str_size);
327         types[nr_types] = cp;
328         typelens_native[nr_types] = len;
329         typelens_32[nr_types] = len;
330         typelens_64[nr_types] = len;
331
332         if (nr_types >= maxnr) {
333                 printf("too many types\n");
334                 return nr_types - 1;
335         }
336         nr_types++;
337
338         return nr_types - 1;
339 }
340
341
342 /**
343  *
344  * Because of the weird way of tokenizing, we have to 'cast' function
345  * pointers to ... (*f)(), whatever the original signature. In fact,
346  * we add name and type at the same time... There are two special
347  * cases, unfortunately. These are explicitly checked.
348  *
349  * */
350 static int add_name(const char *str)
351 {
352         int nr, i, j, k;
353         char *cp;
354         char buf[255]; /* stupid limit, change it :) */
355         const char *name;
356
357         additional_slen_offset = 0;
358
359         if (str[0] == 0 /*  || (str[1] == 0) */) return -1;
360
361         if (str[0] == '(' && str[1] == '*') {
362                 /* we handle function pointer and special array cases here, e.g.
363                  * void (*function)(...) and float (*array)[..]. the array case
364                  * name is still converted to (array *)() though because it is that
365                  * way in old dna too, and works correct with elementsize() */
366                 int isfuncptr = (strchr(str + 1, '(')) != NULL;
367
368                 DEBUG_PRINTF(3, "\t\t\t\t*** Function pointer or multidim array pointer found\n");
369                 /* functionpointer: transform the type (sometimes) */
370                 i = 0;
371
372                 while (str[i] != ')') {
373                         buf[i] = str[i];
374                         i++;
375                 }
376
377                 /* Another number we need is the extra slen offset. This extra
378                  * offset is the overshoot after a space. If there is no
379                  * space, no overshoot should be calculated. */
380                 j = i; /* j at first closing brace */
381
382                 DEBUG_PRINTF(3, "first brace after offset %d\n", i);
383
384                 j++; /* j beyond closing brace ? */
385                 while ((str[j] != 0) && (str[j] != ')')) {
386                         DEBUG_PRINTF(3, "seen %c (%d)\n", str[j], str[j]);
387                         j++;
388                 }
389                 DEBUG_PRINTF(3, "seen %c (%d)\n" "special after offset%d\n", str[j], str[j], j);
390
391                 if (!isfuncptr) {
392                         /* multidimensional array pointer case */
393                         if (str[j] == 0) {
394                                 DEBUG_PRINTF(3, "offsetting for multidim array pointer\n");
395                         }
396                         else
397                                 printf("Error during tokening multidim array pointer\n");
398                 }
399                 else if (str[j] == 0) {
400                         DEBUG_PRINTF(3, "offsetting for space\n");
401                         /* get additional offset */
402                         k = 0;
403                         while (str[j] != ')') {
404                                 j++;
405                                 k++;
406                         }
407                         DEBUG_PRINTF(3, "extra offset %d\n", k);
408                         additional_slen_offset = k;
409                 }
410                 else if (str[j] == ')') {
411                         DEBUG_PRINTF(3, "offsetting for brace\n");
412                         ; /* don't get extra offset */
413                 }
414                 else {
415                         printf("Error during tokening function pointer argument list\n");
416                 }
417
418                 /*
419                  * Put )(void) at the end? Maybe )(). Should check this with
420                  * old sdna. Actually, sometimes )(), sometimes )(void...)
421                  * Alas.. such is the nature of braindamage :(
422                  *
423                  * Sorted it out: always do )(), except for headdraw and
424                  * windraw, part of ScrArea. This is important, because some
425                  * linkers will treat different fp's differently when called
426                  * !!! This has to do with interference in byte-alignment and
427                  * the way args are pushed on the stack.
428                  *
429                  * */
430                 buf[i] = 0;
431                 DEBUG_PRINTF(3, "Name before chomping: %s\n", buf);
432                 if ((strncmp(buf, "(*headdraw", 10) == 0) ||
433                     (strncmp(buf, "(*windraw", 9) == 0) )
434                 {
435                         buf[i] = ')';
436                         buf[i + 1] = '(';
437                         buf[i + 2] = 'v';
438                         buf[i + 3] = 'o';
439                         buf[i + 4] = 'i';
440                         buf[i + 5] = 'd';
441                         buf[i + 6] = ')';
442                         buf[i + 7] = 0;
443                 }
444                 else {
445                         buf[i] = ')';
446                         buf[i + 1] = '(';
447                         buf[i + 2] = ')';
448                         buf[i + 3] = 0;
449                 }
450                 /* now precede with buf*/
451                 DEBUG_PRINTF(3, "\t\t\t\t\tProposing fp name %s\n", buf);
452                 name = buf;
453         }
454         else {
455                 /* normal field: old code */
456                 name = str;
457         }
458
459         /* search name array */
460         for (nr = 0; nr < nr_names; nr++) {
461                 if (strcmp(name, names[nr]) == 0) {
462                         return nr;
463                 }
464         }
465
466         /* append new type */
467         const int name_size = strlen(name) + 1;
468         cp = BLI_memarena_alloc(mem_arena, name_size);
469         memcpy(cp, name, name_size);
470         names[nr_names] = cp;
471
472         if (nr_names >= maxnr) {
473                 printf("too many names\n");
474                 return nr_names - 1;
475         }
476         nr_names++;
477
478         return nr_names - 1;
479 }
480
481 static short *add_struct(int namecode)
482 {
483         int len;
484         short *sp;
485
486         if (nr_structs == 0) {
487                 structs[0] = structdata;
488         }
489         else {
490                 sp = structs[nr_structs - 1];
491                 len = sp[1];
492                 structs[nr_structs] = sp + 2 * len + 2;
493         }
494
495         sp = structs[nr_structs];
496         sp[0] = namecode;
497
498         if (nr_structs >= maxnr) {
499                 printf("too many structs\n");
500                 return sp;
501         }
502         nr_structs++;
503
504         return sp;
505 }
506
507 static int preprocess_include(char *maindata, int len)
508 {
509         int a, newlen, comment = 0;
510         char *cp, *temp, *md;
511
512         /* note: len + 1, last character is a dummy to prevent
513          * comparisons using uninitialized memory */
514         temp = MEM_mallocN(len + 1, "preprocess_include");
515         temp[len] = ' ';
516
517         memcpy(temp, maindata, len);
518
519         /* remove all c++ comments */
520         /* replace all enters/tabs/etc with spaces */
521         cp = temp;
522         a = len;
523         comment = 0;
524         while (a--) {
525                 if (cp[0] == '/' && cp[1] == '/') {
526                         comment = 1;
527                 }
528                 else if (*cp == '\n') {
529                         comment = 0;
530                 }
531                 if (comment || *cp < 32 || *cp > 128) *cp = 32;
532                 cp++;
533         }
534
535
536         /* data from temp copy to maindata, remove comments and double spaces */
537         cp = temp;
538         md = maindata;
539         newlen = 0;
540         comment = 0;
541         a = len;
542         while (a--) {
543
544                 if (cp[0] == '/' && cp[1] == '*') {
545                         comment = 1;
546                         cp[0] = cp[1] = 32;
547                 }
548                 if (cp[0] == '*' && cp[1] == '/') {
549                         comment = 0;
550                         cp[0] = cp[1] = 32;
551                 }
552
553                 /* do not copy when: */
554                 if (comment) {
555                         /* pass */
556                 }
557                 else if (cp[0] == ' ' && cp[1] == ' ') {
558                         /* pass */
559                 }
560                 else if (cp[-1] == '*' && cp[0] == ' ') {
561                         /* pointers with a space */
562                 }       /* skip special keywords */
563                 else if (strncmp("DNA_DEPRECATED", cp, 14) == 0) {
564                         /* single values are skipped already, so decrement 1 less */
565                         a -= 13;
566                         cp += 13;
567                 }
568                 else if (strncmp("DNA_PRIVATE_WORKSPACE", cp, 21) == 0) {
569                         /* Check for DNA_PRIVATE_WORKSPACE_READ_WRITE */
570                         if (strncmp("_READ_WRITE", cp + 21, 11) == 0) {
571                                 a -= 31;
572                                 cp += 31;
573                         }
574                         else {
575                                 a -= 20;
576                                 cp += 20;
577                         }
578                 }
579                 else {
580                         md[0] = cp[0];
581                         md++;
582                         newlen++;
583                 }
584                 cp++;
585         }
586
587         MEM_freeN(temp);
588         return newlen;
589 }
590
591 static void *read_file_data(const char *filename, int *r_len)
592 {
593 #ifdef WIN32
594         FILE *fp = fopen(filename, "rb");
595 #else
596         FILE *fp = fopen(filename, "r");
597 #endif
598         void *data;
599
600         if (!fp) {
601                 *r_len = -1;
602                 return NULL;
603         }
604
605         fseek(fp, 0L, SEEK_END);
606         *r_len = ftell(fp);
607         fseek(fp, 0L, SEEK_SET);
608
609         if (*r_len == -1) {
610                 fclose(fp);
611                 return NULL;
612         }
613
614         data = MEM_mallocN(*r_len, "read_file_data");
615         if (!data) {
616                 *r_len = -1;
617                 fclose(fp);
618                 return NULL;
619         }
620
621         if (fread(data, *r_len, 1, fp) != 1) {
622                 *r_len = -1;
623                 MEM_freeN(data);
624                 fclose(fp);
625                 return NULL;
626         }
627
628         fclose(fp);
629         return data;
630 }
631
632 static int convert_include(const char *filename)
633 {
634         /* read include file, skip structs with a '#' before it.
635          * store all data in temporal arrays.
636          */
637         int filelen, count, slen, type, name, strct;
638         short *structpoin, *sp;
639         char *maindata, *mainend, *md, *md1;
640         bool skip_struct;
641
642         md = maindata = read_file_data(filename, &filelen);
643         if (filelen == -1) {
644                 fprintf(stderr, "Can't read file %s\n", filename);
645                 return 1;
646         }
647
648         filelen = preprocess_include(maindata, filelen);
649         mainend = maindata + filelen - 1;
650
651         /* we look for '{' and then back to 'struct' */
652         count = 0;
653         skip_struct = false;
654         while (count < filelen) {
655
656                 /* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */
657                 if (md[0] == '#' && md[1] == ' ' && md[2] == '#') {
658                         skip_struct = true;
659                 }
660
661                 if (md[0] == '{') {
662                         md[0] = 0;
663                         if (skip_struct) {
664                                 skip_struct = false;
665                         }
666                         else {
667                                 if (md[-1] == ' ') md[-1] = 0;
668                                 md1 = md - 2;
669                                 while (*md1 != 32) md1--;       /* to beginning of word */
670                                 md1++;
671
672                                 /* we've got a struct name when... */
673                                 if (strncmp(md1 - 7, "struct", 6) == 0) {
674
675                                         strct = add_type(md1, 0);
676                                         if (strct == -1) {
677                                                 fprintf(stderr, "File '%s' contains struct we cant parse \"%s\"\n", filename, md1);
678                                                 return 1;
679                                         }
680
681                                         structpoin = add_struct(strct);
682                                         sp = structpoin + 2;
683
684                                         DEBUG_PRINTF(1, "\t|\t|-- detected struct %s\n", types[strct]);
685
686                                         /* first lets make it all nice strings */
687                                         md1 = md + 1;
688                                         while (*md1 != '}') {
689                                                 if (md1 > mainend) break;
690
691                                                 if (*md1 == ',' || *md1 == ' ') *md1 = 0;
692                                                 md1++;
693                                         }
694
695                                         /* read types and names until first character that is not '}' */
696                                         md1 = md + 1;
697                                         while (*md1 != '}') {
698                                                 if (md1 > mainend) break;
699
700                                                 /* skip when it says 'struct' or 'unsigned' or 'const' */
701                                                 if (*md1) {
702                                                         if (strncmp(md1, "struct", 6) == 0) md1 += 7;
703                                                         if (strncmp(md1, "unsigned", 8) == 0) md1 += 9;
704                                                         if (strncmp(md1, "const", 5) == 0) md1 += 6;
705
706                                                         /* we've got a type! */
707                                                         type = add_type(md1, 0);
708                                                         if (type == -1) {
709                                                                 fprintf(stderr, "File '%s' contains struct we can't parse \"%s\"\n", filename, md1);
710                                                                 return 1;
711                                                         }
712
713                                                         DEBUG_PRINTF(1, "\t|\t|\tfound type %s (", md1);
714
715                                                         md1 += strlen(md1);
716
717
718                                                         /* read until ';' */
719                                                         while (*md1 != ';') {
720                                                                 if (md1 > mainend) break;
721
722                                                                 if (*md1) {
723                                                                         /* We've got a name. slen needs
724                                                                          * correction for function
725                                                                          * pointers! */
726                                                                         slen = (int) strlen(md1);
727                                                                         if (md1[slen - 1] == ';') {
728                                                                                 md1[slen - 1] = 0;
729
730                                                                                 name = add_name(version_elem_static_from_alias(strct, md1));
731                                                                                 slen += additional_slen_offset;
732                                                                                 sp[0] = type;
733                                                                                 sp[1] = name;
734
735                                                                                 if (names[name] != NULL) {
736                                                                                         DEBUG_PRINTF(1, "%s |", names[name]);
737                                                                                 }
738
739                                                                                 structpoin[1]++;
740                                                                                 sp += 2;
741
742                                                                                 md1 += slen;
743                                                                                 break;
744                                                                         }
745
746                                                                         name = add_name(version_elem_static_from_alias(strct, md1));
747                                                                         slen += additional_slen_offset;
748
749                                                                         sp[0] = type;
750                                                                         sp[1] = name;
751                                                                         if (names[name] != NULL) {
752                                                                                 DEBUG_PRINTF(1, "%s ||", names[name]);
753                                                                         }
754
755                                                                         structpoin[1]++;
756                                                                         sp += 2;
757
758                                                                         md1 += slen;
759                                                                 }
760                                                                 md1++;
761                                                         }
762
763                                                         DEBUG_PRINTF(1, ")\n");
764
765                                                 }
766                                                 md1++;
767                                         }
768                                 }
769                         }
770                 }
771                 count++;
772                 md++;
773         }
774
775         MEM_freeN(maindata);
776
777         return 0;
778 }
779
780 static bool check_field_alignment(int firststruct, int structtype, int type, int len,
781                                   const char *name, const char *detail)
782 {
783         bool result = true;
784         if (type < firststruct && typelens_native[type] > 4 && (len % 8)) {
785                 fprintf(stderr, "Align 8 error (%s) in struct: %s %s (add %d padding bytes)\n",
786                         detail, types[structtype], name, len % 8);
787                 result = false;
788         }
789         if (typelens_native[type] > 3 && (len % 4) ) {
790                 fprintf(stderr, "Align 4 error (%s) in struct: %s %s (add %d padding bytes)\n",
791                         detail, types[structtype], name, len % 4);
792                 result = false;
793         }
794         if (typelens_native[type] == 2 && (len % 2) ) {
795                 fprintf(stderr, "Align 2 error (%s) in struct: %s %s (add %d padding bytes)\n",
796                         detail, types[structtype], name, len % 2);
797                 result = false;
798         }
799         return result;
800 }
801
802 static int calculate_structlens(int firststruct)
803 {
804         int unknown = nr_structs, lastunknown;
805         bool dna_error = false;
806
807         while (unknown) {
808                 lastunknown = unknown;
809                 unknown = 0;
810
811                 /* check all structs... */
812                 for (int a = 0; a < nr_structs; a++) {
813                         const short *structpoin = structs[a];
814                         const int    structtype = structpoin[0];
815
816                         /* when length is not known... */
817                         if (typelens_native[structtype] == 0) {
818
819                                 const short *sp = structpoin + 2;
820                                 int len_native = 0;
821                                 int len_32 = 0;
822                                 int len_64 = 0;
823                                 bool has_pointer = false;
824
825                                 /* check all elements in struct */
826                                 for (int b = 0; b < structpoin[1]; b++, sp += 2) {
827                                         int type = sp[0];
828                                         const char *cp = names[sp[1]];
829
830                                         int namelen = (int)strlen(cp);
831                                         /* is it a pointer or function pointer? */
832                                         if (cp[0] == '*' || cp[1] == '*') {
833                                                 has_pointer = 1;
834                                                 /* has the name an extra length? (array) */
835                                                 int mul = 1;
836                                                 if (cp[namelen - 1] == ']') {
837                                                         mul = DNA_elem_array_size(cp);
838                                                 }
839
840                                                 if (mul == 0) {
841                                                         fprintf(stderr, "Zero array size found or could not parse %s: '%.*s'\n",
842                                                                 types[structtype], namelen + 1, cp);
843                                                         dna_error = 1;
844                                                 }
845
846                                                 /* 4-8 aligned/ */
847                                                 if (sizeof(void *) == 4) {
848                                                         if (len_native % 4) {
849                                                                 fprintf(stderr, "Align pointer error in struct (len_native 4): %s %s\n",
850                                                                         types[structtype], cp);
851                                                                 dna_error = 1;
852                                                         }
853                                                 }
854                                                 else {
855                                                         if (len_native % 8) {
856                                                                 fprintf(stderr, "Align pointer error in struct (len_native 8): %s %s\n",
857                                                                         types[structtype], cp);
858                                                                 dna_error = 1;
859                                                         }
860                                                 }
861
862                                                 if (len_64 % 8) {
863                                                         fprintf(stderr, "Align pointer error in struct (len_64 8): %s %s\n",
864                                                                 types[structtype], cp);
865                                                         dna_error = 1;
866                                                 }
867
868                                                 len_native += sizeof(void *) * mul;
869                                                 len_32 += 4 * mul;
870                                                 len_64 += 8 * mul;
871
872                                         }
873                                         else if (cp[0] == '[') {
874                                                 /* parsing can cause names "var" and "[3]"
875                                                  * to be found for "float var [3]" */
876                                                 fprintf(stderr, "Parse error in struct, invalid member name: %s %s\n",
877                                                         types[structtype], cp);
878                                                 dna_error = 1;
879                                         }
880                                         else if (typelens_native[type]) {
881                                                 /* has the name an extra length? (array) */
882                                                 int mul = 1;
883                                                 if (cp[namelen - 1] == ']') {
884                                                         mul = DNA_elem_array_size(cp);
885                                                 }
886
887                                                 if (mul == 0) {
888                                                         fprintf(stderr, "Zero array size found or could not parse %s: '%.*s'\n",
889                                                                 types[structtype], namelen + 1, cp);
890                                                         dna_error = 1;
891                                                 }
892
893                                                 /* struct alignment */
894                                                 if (type >= firststruct) {
895                                                         if (sizeof(void *) == 8 && (len_native % 8) ) {
896                                                                 fprintf(stderr, "Align struct error: %s %s\n",
897                                                                         types[structtype], cp);
898                                                                 dna_error = 1;
899                                                         }
900                                                 }
901
902                                                 /* Check 2-4-8 aligned. */
903                                                 if (!check_field_alignment(firststruct, structtype, type, len_32, cp, "32 bit")) {
904                                                         dna_error = 1;
905                                                 }
906                                                 if (!check_field_alignment(firststruct, structtype, type, len_64, cp, "64 bit")) {
907                                                         dna_error = 1;
908                                                 }
909
910                                                 len_native += mul * typelens_native[type];
911                                                 len_32 += mul * typelens_32[type];
912                                                 len_64 += mul * typelens_64[type];
913
914                                         }
915                                         else {
916                                                 len_native = 0;
917                                                 len_32 = 0;
918                                                 len_64 = 0;
919                                                 break;
920                                         }
921                                 }
922
923                                 if (len_native == 0) {
924                                         unknown++;
925                                 }
926                                 else {
927                                         typelens_native[structtype] = len_native;
928                                         typelens_32[structtype] = len_32;
929                                         typelens_64[structtype] = len_64;
930                                         /* two ways to detect if a struct contains a pointer:
931                                          * has_pointer is set or len_native  doesn't match any of 32/64bit lengths*/
932                                         if (has_pointer || len_64 != len_native || len_32 != len_native) {
933                                                 if (len_64 % 8) {
934                                                         fprintf(stderr, "Sizeerror 8 in struct: %s (add %d bytes)\n",
935                                                                 types[structtype], len_64 % 8);
936                                                         dna_error = 1;
937                                                 }
938                                         }
939
940                                         if (len_native % 4) {
941                                                 fprintf(stderr, "Sizeerror 4 in struct: %s (add %d bytes)\n",
942                                                        types[structtype], len_native % 4);
943                                                 dna_error = 1;
944                                         }
945
946                                 }
947                         }
948                 }
949
950                 if (unknown == lastunknown) break;
951         }
952
953         if (unknown) {
954                 fprintf(stderr, "ERROR: still %d structs unknown\n", unknown);
955
956                 if (debugSDNA) {
957                         fprintf(stderr, "*** Known structs :\n");
958
959                         for (int a = 0; a < nr_structs; a++) {
960                                 const short *structpoin = structs[a];
961                                 const int    structtype = structpoin[0];
962
963                                 /* length unknown */
964                                 if (typelens_native[structtype] != 0) {
965                                         fprintf(stderr, "  %s\n", types[structtype]);
966                                 }
967                         }
968                 }
969
970
971                 fprintf(stderr, "*** Unknown structs :\n");
972
973                 for (int a = 0; a < nr_structs; a++) {
974                         const short *structpoin = structs[a];
975                         const int    structtype = structpoin[0];
976
977                         /* length unknown yet */
978                         if (typelens_native[structtype] == 0) {
979                                 fprintf(stderr, "  %s\n", types[structtype]);
980                         }
981                 }
982
983                 dna_error = 1;
984         }
985
986         return dna_error;
987 }
988
989 #define MAX_DNA_LINE_LENGTH 20
990
991 static void dna_write(FILE *file, const void *pntr, const int size)
992 {
993         static int linelength = 0;
994         int i;
995         const char *data;
996
997         data = (const char *)pntr;
998
999         for (i = 0; i < size; i++) {
1000                 fprintf(file, "%d, ", data[i]);
1001                 linelength++;
1002                 if (linelength >= MAX_DNA_LINE_LENGTH) {
1003                         fprintf(file, "\n");
1004                         linelength = 0;
1005                 }
1006         }
1007 }
1008
1009 void printStructLengths(void)
1010 {
1011         int a, unknown = nr_structs, structtype;
1012         /*int lastunknown;*/ /*UNUSED*/
1013         const short *structpoin;
1014         printf("\n\n*** All detected structs:\n");
1015
1016         while (unknown) {
1017                 /*lastunknown = unknown;*/ /*UNUSED*/
1018                 unknown = 0;
1019
1020                 /* check all structs... */
1021                 for (a = 0; a < nr_structs; a++) {
1022                         structpoin = structs[a];
1023                         structtype = structpoin[0];
1024                         printf("\t%s\t:%d\n", types[structtype], typelens_native[structtype]);
1025                 }
1026         }
1027
1028         printf("*** End of list\n");
1029
1030 }
1031
1032
1033 static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offsets)
1034 {
1035         int i;
1036         const short *sp;
1037         /* str contains filenames. Since we now include paths, I stretched       */
1038         /* it a bit. Hope this is enough :) -nzc-                                */
1039         char str[SDNA_MAX_FILENAME_LENGTH];
1040         int firststruct;
1041
1042         if (debugSDNA > 0) {
1043                 fflush(stdout);
1044                 printf("Running makesdna at debug level %d\n", debugSDNA);
1045         }
1046
1047         mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
1048
1049         /* the longest known struct is 50k, so we assume 100k is sufficient! */
1050         structdata = MEM_callocN(maxdata, "structdata");
1051
1052         /* a maximum of 5000 variables, must be sufficient? */
1053         names = MEM_callocN(sizeof(char *) * maxnr, "names");
1054         types = MEM_callocN(sizeof(char *) * maxnr, "types");
1055         typelens_native = MEM_callocN(sizeof(short) * maxnr, "typelens_native");
1056         typelens_32 = MEM_callocN(sizeof(short) * maxnr, "typelens_32");
1057         typelens_64 = MEM_callocN(sizeof(short) * maxnr, "typelens_64");
1058         structs = MEM_callocN(sizeof(short *) * maxnr, "structs");
1059
1060         /* Build versioning data */
1061         DNA_alias_maps(
1062                 DNA_RENAME_ALIAS_FROM_STATIC,
1063                 &g_version_data.struct_map_alias_from_static,
1064                 NULL);
1065         DNA_alias_maps(
1066                 DNA_RENAME_STATIC_FROM_ALIAS,
1067                 &g_version_data.struct_map_static_from_alias,
1068                 &g_version_data.elem_map_static_from_alias);
1069
1070         /**
1071          * Insertion of all known types.
1072          *
1073          * \warning Order of function calls here must be aligned with #eSDNA_Type.
1074          * \warning uint is not allowed! use in structs an unsigned int.
1075          * \warning sizes must match #DNA_elem_type_size().
1076          */
1077         add_type("char", 1);     /* SDNA_TYPE_CHAR */
1078         add_type("uchar", 1);    /* SDNA_TYPE_UCHAR */
1079         add_type("short", 2);    /* SDNA_TYPE_SHORT */
1080         add_type("ushort", 2);   /* SDNA_TYPE_USHORT */
1081         add_type("int", 4);      /* SDNA_TYPE_INT */
1082
1083         /* note, long isn't supported,
1084          * these are place-holders to maintain alignment with eSDNA_Type*/
1085         add_type("long", 4);     /* SDNA_TYPE_LONG */
1086         add_type("ulong", 4);    /* SDNA_TYPE_ULONG */
1087
1088         add_type("float", 4);    /* SDNA_TYPE_FLOAT */
1089         add_type("double", 8);   /* SDNA_TYPE_DOUBLE */
1090         add_type("int64_t", 8);  /* SDNA_TYPE_INT64 */
1091         add_type("uint64_t", 8); /* SDNA_TYPE_UINT64 */
1092         add_type("void", 0);     /* SDNA_TYPE_VOID */
1093
1094         /* the defines above shouldn't be output in the padding file... */
1095         firststruct = nr_types;
1096
1097         /* add all include files defined in the global array                     */
1098         /* Since the internal file+path name buffer has limited length, I do a   */
1099         /* little test first...                                                  */
1100         /* Mind the breaking condition here!                                     */
1101         DEBUG_PRINTF(0, "\tStart of header scan:\n");
1102         for (i = 0; *(includefiles[i]) != '\0'; i++) {
1103                 sprintf(str, "%s%s", baseDirectory, includefiles[i]);
1104                 DEBUG_PRINTF(0, "\t|-- Converting %s\n", str);
1105                 if (convert_include(str)) {
1106                         return 1;
1107                 }
1108         }
1109         DEBUG_PRINTF(0, "\tFinished scanning %d headers.\n", i);
1110
1111         if (calculate_structlens(firststruct)) {
1112                 /* error */
1113                 return 1;
1114         }
1115
1116         /* FOR DEBUG */
1117         if (debugSDNA > 1) {
1118                 int a, b;
1119                 /* short *elem; */
1120                 short num_types;
1121
1122                 printf("nr_names %d nr_types %d nr_structs %d\n", nr_names, nr_types, nr_structs);
1123                 for (a = 0; a < nr_names; a++) {
1124                         printf(" %s\n", names[a]);
1125                 }
1126                 printf("\n");
1127
1128                 sp = typelens_native;
1129                 for (a = 0; a < nr_types; a++, sp++) {
1130                         printf(" %s %d\n", types[a], *sp);
1131                 }
1132                 printf("\n");
1133
1134                 for (a = 0; a < nr_structs; a++) {
1135                         sp = structs[a];
1136                         printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], typelens_native[sp[0]]);
1137                         num_types  = sp[1];
1138                         sp += 2;
1139                         /* ? num_types was elem? */
1140                         for (b = 0; b < num_types; b++, sp += 2) {
1141                                 printf("   %s %s\n", types[sp[0]], names[sp[1]]);
1142                         }
1143                 }
1144         }
1145
1146         /* file writing */
1147
1148         DEBUG_PRINTF(0, "Writing file ... ");
1149
1150         if (nr_names == 0 || nr_structs == 0) {
1151                 /* pass */
1152         }
1153         else {
1154                 const char nil_bytes[4] = {0};
1155                 int len, len_align;
1156
1157                 dna_write(file, "SDNA", 4);
1158
1159                 /* write names */
1160                 dna_write(file, "NAME", 4);
1161                 len = nr_names;
1162                 dna_write(file, &len, 4);
1163                 /* write array */
1164                 len = 0;
1165                 for (int nr = 0; nr < nr_names; nr++) {
1166                         int name_size = strlen(names[nr]) + 1;
1167                         dna_write(file, names[nr], name_size);
1168                         len += name_size;
1169                 }
1170                 len_align = (len + 3) & ~3;
1171                 if (len != len_align) {
1172                         dna_write(file, nil_bytes, len_align - len);
1173                 }
1174
1175                 /* write TYPES */
1176                 dna_write(file, "TYPE", 4);
1177                 len = nr_types;
1178                 dna_write(file, &len, 4);
1179                 /* write array */
1180                 len = 0;
1181                 for (int nr = 0; nr < nr_types; nr++) {
1182                         int type_size = strlen(types[nr]) + 1;
1183                         dna_write(file, types[nr], type_size);
1184                         len += type_size;
1185                 }
1186                 len_align = (len + 3) & ~3;
1187                 if (len != len_align) {
1188                         dna_write(file, nil_bytes, len_align - len);
1189                 }
1190
1191                 /* WRITE TYPELENGTHS */
1192                 dna_write(file, "TLEN", 4);
1193
1194                 len = 2 * nr_types;
1195                 if (nr_types & 1) len += 2;
1196                 dna_write(file, typelens_native, len);
1197
1198                 /* WRITE STRUCTS */
1199                 dna_write(file, "STRC", 4);
1200                 len = nr_structs;
1201                 dna_write(file, &len, 4);
1202
1203                 /* calc datablock size */
1204                 sp = structs[nr_structs - 1];
1205                 sp += 2 + 2 * (sp[1]);
1206                 len = (intptr_t) ((char *) sp - (char *) structs[0]);
1207                 len = (len + 3) & ~3;
1208
1209                 dna_write(file, structs[0], len);
1210
1211                 /* a simple dna padding test */
1212                 if (0) {
1213                         FILE *fp;
1214                         int a;
1215
1216                         fp = fopen("padding.c", "w");
1217                         if (fp == NULL) {
1218                                 /* pass */
1219                         }
1220                         else {
1221
1222                                 /* add all include files defined in the global array */
1223                                 for (i = 0; *(includefiles[i]) != '\0'; i++) {
1224                                         fprintf(fp, "#include \"%s%s\"\n", baseDirectory, includefiles[i]);
1225                                 }
1226
1227                                 fprintf(fp, "main() {\n");
1228                                 sp = typelens_native;
1229                                 sp += firststruct;
1230                                 for (a = firststruct; a < nr_types; a++, sp++) {
1231                                         if (*sp) {
1232                                                 fprintf(fp, "\tif (sizeof(struct %s) - %d) printf(\"ALIGN ERROR:", types[a], *sp);
1233                                                 fprintf(fp, "%%d %s %d ", types[a], *sp);
1234                                                 fprintf(fp, "\\n\",  sizeof(struct %s) - %d);\n", types[a], *sp);
1235                                         }
1236                                 }
1237                                 fprintf(fp, "}\n");
1238                                 fclose(fp);
1239                         }
1240                 }
1241                 /*      end end padding test */
1242         }
1243
1244         /* write a simple enum with all structs offsets,
1245          * should only be accessed via SDNA_TYPE_FROM_STRUCT macro */
1246         {
1247                 fprintf(file_offsets, "#define SDNA_TYPE_FROM_STRUCT(id) _SDNA_TYPE_##id\n");
1248                 fprintf(file_offsets, "enum {\n");
1249                 for (i = 0; i < nr_structs; i++) {
1250                         const short *structpoin = structs[i];
1251                         const int    structtype = structpoin[0];
1252                         fprintf(file_offsets, "\t_SDNA_TYPE_%s = %d,\n", version_struct_alias_from_static(types[structtype]), i);
1253                 }
1254                 fprintf(file_offsets, "\tSDNA_TYPE_MAX = %d,\n", nr_structs);
1255                 fprintf(file_offsets, "};\n");
1256         }
1257
1258         /* Check versioning errors which could cause duplicate names,
1259          * do last because names are stripped. */
1260         {
1261                 GSet *names_unique = BLI_gset_str_new_ex(__func__, 512);
1262                 for (int struct_nr = 0; struct_nr < nr_structs; struct_nr++) {
1263                         sp = structs[struct_nr];
1264                         const char *struct_name = types[sp[0]];
1265                         const int len = sp[1];
1266                         sp += 2;
1267                         for (int a = 0; a < len; a++, sp += 2) {
1268                                 char *name = names[sp[1]];
1269                                 DNA_elem_id_strip(name);
1270                                 if (!BLI_gset_add(names_unique, name)) {
1271                                         fprintf(stderr, "Error: duplicate name found '%s.%s', "
1272                                                "likely cause is 'dna_rename_defs.h'\n",
1273                                                struct_name, name);
1274                                         return 1;
1275                                 }
1276                         }
1277                         BLI_gset_clear(names_unique, NULL);
1278                 }
1279                 BLI_gset_free(names_unique, NULL);
1280         }
1281
1282         MEM_freeN(structdata);
1283         MEM_freeN(names);
1284         MEM_freeN(types);
1285         MEM_freeN(typelens_native);
1286         MEM_freeN(typelens_32);
1287         MEM_freeN(typelens_64);
1288         MEM_freeN(structs);
1289
1290         BLI_memarena_free(mem_arena);
1291
1292         BLI_ghash_free(g_version_data.struct_map_alias_from_static, NULL, NULL);
1293         BLI_ghash_free(g_version_data.struct_map_static_from_alias, NULL, NULL);
1294         BLI_ghash_free(g_version_data.elem_map_static_from_alias, MEM_freeN, NULL);
1295
1296         DEBUG_PRINTF(0, "done.\n");
1297
1298         return 0;
1299 }
1300
1301 /** \} */
1302
1303 /* end make DNA. */
1304
1305 /* -------------------------------------------------------------------- */
1306 /** \name Main Function
1307  * \{ */
1308
1309 static void make_bad_file(const char *file, int line)
1310 {
1311         FILE *fp = fopen(file, "w");
1312         fprintf(fp,
1313                "#error \"Error! can't make correct DNA.c file from %s:%d, check alignment.\"\n",
1314                __FILE__, line);
1315         fclose(fp);
1316 }
1317
1318 #ifndef BASE_HEADER
1319 #define BASE_HEADER "../"
1320 #endif
1321
1322 int main(int argc, char **argv)
1323 {
1324         int return_status = 0;
1325
1326         if (argc != 3 && argc != 4) {
1327                 printf("Usage: %s dna.c dna_struct_offsets.h [base directory]\n", argv[0]);
1328                 return_status = 1;
1329         }
1330         else {
1331                 FILE *file_dna         = fopen(argv[1], "w");
1332                 FILE *file_dna_offsets = fopen(argv[2], "w");
1333                 if (!file_dna) {
1334                         printf("Unable to open file: %s\n", argv[1]);
1335                         return_status = 1;
1336                 }
1337                 else if (!file_dna_offsets) {
1338                         printf("Unable to open file: %s\n", argv[2]);
1339                         return_status = 1;
1340                 }
1341                 else {
1342                         const char *baseDirectory;
1343
1344                         if (argc == 4) {
1345                                 baseDirectory = argv[3];
1346                         }
1347                         else {
1348                                 baseDirectory = BASE_HEADER;
1349                         }
1350
1351                         fprintf(file_dna, "const unsigned char DNAstr[] = {\n");
1352                         if (make_structDNA(baseDirectory, file_dna, file_dna_offsets)) {
1353                                 /* error */
1354                                 fclose(file_dna);
1355                                 file_dna = NULL;
1356                                 make_bad_file(argv[1], __LINE__);
1357                                 return_status = 1;
1358                         }
1359                         else {
1360                                 fprintf(file_dna, "};\n");
1361                                 fprintf(file_dna, "const int DNAlen = sizeof(DNAstr);\n");
1362                         }
1363                 }
1364
1365                 if (file_dna) {
1366                         fclose(file_dna);
1367                 }
1368                 if (file_dna_offsets) {
1369                         fclose(file_dna_offsets);
1370                 }
1371         }
1372
1373
1374         return return_status;
1375 }
1376
1377 /* handy but fails on struct bounds which makesdna doesn't care about
1378  * with quite the same strictness as GCC does */
1379 #if 0
1380 /* include files for automatic dependencies */
1381
1382 /* extra safety check that we are aligned,
1383  * warnings here are easier to fix the makesdna's */
1384 #ifdef __GNUC__
1385 #  pragma GCC diagnostic error "-Wpadded"
1386 #endif
1387
1388 #endif /* if 0 */
1389
1390 /* even though DNA supports, 'long' shouldn't be used since it can be either 32 or 64bit,
1391  * use int or int64_t instead.
1392  * Only valid use would be as a runtime variable if an API expected a long,
1393  * but so far we dont have this happening. */
1394 #ifdef __GNUC__
1395 #  pragma GCC poison long
1396 #endif
1397
1398 #include "DNA_listBase.h"
1399 #include "DNA_vec_types.h"
1400 #include "DNA_ID.h"
1401 #include "DNA_ipo_types.h"
1402 #include "DNA_key_types.h"
1403 #include "DNA_text_types.h"
1404 #include "DNA_packedFile_types.h"
1405 #include "DNA_camera_types.h"
1406 #include "DNA_image_types.h"
1407 #include "DNA_texture_types.h"
1408 #include "DNA_lamp_types.h"
1409 #include "DNA_material_types.h"
1410 #include "DNA_vfont_types.h"
1411 #include "DNA_meta_types.h"
1412 #include "DNA_curve_types.h"
1413 #include "DNA_mesh_types.h"
1414 #include "DNA_meshdata_types.h"
1415 #include "DNA_modifier_types.h"
1416 #include "DNA_lattice_types.h"
1417 #include "DNA_object_types.h"
1418 #include "DNA_object_force_types.h"
1419 #include "DNA_object_fluidsim_types.h"
1420 #include "DNA_world_types.h"
1421 #include "DNA_scene_types.h"
1422 #include "DNA_view3d_types.h"
1423 #include "DNA_view2d_types.h"
1424 #include "DNA_space_types.h"
1425 #include "DNA_userdef_types.h"
1426 #include "DNA_screen_types.h"
1427 #include "DNA_sdna_types.h"
1428 #include "DNA_fileglobal_types.h"
1429 #include "DNA_sequence_types.h"
1430 #include "DNA_effect_types.h"
1431 #include "DNA_outliner_types.h"
1432 #include "DNA_sound_types.h"
1433 #include "DNA_collection_types.h"
1434 #include "DNA_armature_types.h"
1435 #include "DNA_action_types.h"
1436 #include "DNA_constraint_types.h"
1437 #include "DNA_nla_types.h"
1438 #include "DNA_node_types.h"
1439 #include "DNA_color_types.h"
1440 #include "DNA_brush_types.h"
1441 #include "DNA_customdata_types.h"
1442 #include "DNA_particle_types.h"
1443 #include "DNA_cloth_types.h"
1444 #include "DNA_gpencil_types.h"
1445 #include "DNA_gpencil_modifier_types.h"
1446 #include "DNA_shader_fx_types.h"
1447 #include "DNA_windowmanager_types.h"
1448 #include "DNA_anim_types.h"
1449 #include "DNA_boid_types.h"
1450 #include "DNA_smoke_types.h"
1451 #include "DNA_speaker_types.h"
1452 #include "DNA_movieclip_types.h"
1453 #include "DNA_tracking_types.h"
1454 #include "DNA_dynamicpaint_types.h"
1455 #include "DNA_mask_types.h"
1456 #include "DNA_rigidbody_types.h"
1457 #include "DNA_freestyle_types.h"
1458 #include "DNA_linestyle_types.h"
1459 #include "DNA_cachefile_types.h"
1460 #include "DNA_layer_types.h"
1461 #include "DNA_workspace_types.h"
1462 #include "DNA_lightprobe_types.h"
1463
1464 /* end of list */
1465
1466 /** \} */