Blender  V2.93
versioning_legacy.c
Go to the documentation of this file.
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 
24 #include <limits.h>
25 
26 #ifndef WIN32
27 # include <unistd.h> /* for read close */
28 #else
29 # include "BLI_winstuff.h"
30 # include "winsock2.h"
31 # include <io.h> /* for open close read */
32 # include <zlib.h> /* odd include order-issue */
33 #endif
34 
35 /* allow readfile to use deprecated functionality */
36 #define DNA_DEPRECATED_ALLOW
37 
38 #include "DNA_armature_types.h"
39 #include "DNA_camera_types.h"
40 #include "DNA_collection_types.h"
41 #include "DNA_constraint_types.h"
42 #include "DNA_effect_types.h"
43 #include "DNA_key_types.h"
44 #include "DNA_lattice_types.h"
45 #include "DNA_light_types.h"
46 #include "DNA_material_types.h"
47 #include "DNA_mesh_types.h"
48 #include "DNA_meshdata_types.h"
49 #include "DNA_nla_types.h"
50 #include "DNA_node_types.h"
52 #include "DNA_object_force_types.h"
53 #include "DNA_object_types.h"
54 #include "DNA_screen_types.h"
55 #include "DNA_sdna_types.h"
56 #include "DNA_sequence_types.h"
57 #include "DNA_sound_types.h"
58 #include "DNA_space_types.h"
59 #include "DNA_vfont_types.h"
60 #include "DNA_view3d_types.h"
61 #include "DNA_world_types.h"
62 
63 #include "MEM_guardedalloc.h"
64 
65 #include "BLI_blenlib.h"
66 #include "BLI_math.h"
67 #include "BLI_utildefines.h"
68 
69 #include "BKE_action.h"
70 #include "BKE_armature.h"
71 #include "BKE_colortools.h"
72 #include "BKE_constraint.h"
73 #include "BKE_deform.h"
74 #include "BKE_fcurve.h"
75 #include "BKE_lattice.h"
76 #include "BKE_main.h" /* for Main */
77 #include "BKE_mesh.h" /* for ME_ defines (patching) */
78 #include "BKE_modifier.h"
79 #include "BKE_object.h"
80 #include "BKE_particle.h"
81 #include "BKE_pointcache.h"
82 
83 #include "SEQ_iterator.h"
84 #include "SEQ_sequencer.h"
85 
86 #include "NOD_socket.h"
87 
88 #include "BLO_readfile.h"
89 
90 #include "readfile.h"
91 
92 #include "PIL_time.h"
93 
94 #include <errno.h>
95 
96 /* Make preferences read-only, use versioning_userdef.c. */
97 #define U (*((const UserDef *)&U))
98 
99 static void vcol_to_fcol(Mesh *me)
100 {
101  MFace *mface;
102  uint *mcol, *mcoln, *mcolmain;
103  int a;
104 
105  if (me->totface == 0 || me->mcol == NULL) {
106  return;
107  }
108 
109  mcoln = mcolmain = MEM_malloc_arrayN(me->totface, sizeof(int[4]), "mcoln");
110  mcol = (uint *)me->mcol;
111  mface = me->mface;
112  for (a = me->totface; a > 0; a--, mface++) {
113  mcoln[0] = mcol[mface->v1];
114  mcoln[1] = mcol[mface->v2];
115  mcoln[2] = mcol[mface->v3];
116  mcoln[3] = mcol[mface->v4];
117  mcoln += 4;
118  }
119 
120  MEM_freeN(me->mcol);
121  me->mcol = (MCol *)mcolmain;
122 }
123 
125 {
126  Bone *child;
127  float vec[3];
128 
129  /* head */
130  copy_v3_v3(bone->arm_head, bone->arm_mat[3]);
131 
132  /* tail is in current local coord system */
133  copy_v3_v3(vec, bone->arm_mat[1]);
134  mul_v3_fl(vec, bone->length);
135  add_v3_v3v3(bone->arm_tail, bone->arm_head, vec);
136 
137  for (child = bone->childbase.first; child; child = child->next) {
139  }
140 }
141 
142 static void bone_version_238(ListBase *lb)
143 {
144  Bone *bone;
145 
146  for (bone = lb->first; bone; bone = bone->next) {
147  if (bone->rad_tail == 0.0f && bone->rad_head == 0.0f) {
148  bone->rad_head = 0.25f * bone->length;
149  bone->rad_tail = 0.1f * bone->length;
150 
151  bone->dist -= bone->rad_head;
152  if (bone->dist <= 0.0f) {
153  bone->dist = 0.0f;
154  }
155  }
156  bone_version_238(&bone->childbase);
157  }
158 }
159 
160 static void bone_version_239(ListBase *lb)
161 {
162  Bone *bone;
163 
164  for (bone = lb->first; bone; bone = bone->next) {
165  if (bone->layer == 0) {
166  bone->layer = 1;
167  }
168  bone_version_239(&bone->childbase);
169  }
170 }
171 
173 {
174  bNode *node;
175 
176  if (ntree->type == NTREE_COMPOSIT) {
177  for (node = ntree->nodes.first; node; node = node->next) {
178  if (node->type == CMP_NODE_BLUR) {
179  if (node->storage == NULL) {
180  NodeBlurData *nbd = MEM_callocN(sizeof(NodeBlurData), "node blur patch");
181  nbd->sizex = node->custom1;
182  nbd->sizey = node->custom2;
183  nbd->filtertype = R_FILTER_QUAD;
184  node->storage = nbd;
185  }
186  }
187  else if (node->type == CMP_NODE_VECBLUR) {
188  if (node->storage == NULL) {
189  NodeBlurData *nbd = MEM_callocN(sizeof(NodeBlurData), "node blur patch");
190  nbd->samples = node->custom1;
191  nbd->maxspeed = node->custom2;
192  nbd->fac = 1.0f;
193  node->storage = nbd;
194  }
195  }
196  }
197  }
198 }
199 
201 {
202  bNode *node;
203 
204  if (ntree->type == NTREE_COMPOSIT) {
205  for (node = ntree->nodes.first; node; node = node->next) {
206  if (node->type == CMP_NODE_HUE_SAT) {
207  if (node->storage) {
208  NodeHueSat *nhs = node->storage;
209  if (nhs->val == 0.0f) {
210  nhs->val = 1.0f;
211  }
212  }
213  }
214  }
215  }
216 }
217 
219 {
220  bNode *node;
221  NodeTwoFloats *ntf;
222  ID *nodeid;
223  Image *image;
224  ImageUser *iuser;
225 
226  if (ntree->type == NTREE_COMPOSIT) {
227  for (node = ntree->nodes.first; node; node = node->next) {
228  if (node->type == CMP_NODE_ALPHAOVER) {
229  if (!node->storage) {
230  ntf = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
231  node->storage = ntf;
232  if (node->custom1) {
233  ntf->x = 1.0f;
234  }
235  }
236  }
237 
238  /* fix for temporary flag changes during 245 cycle */
239  nodeid = blo_do_versions_newlibadr(fd, lib, node->id);
240  if (node->storage && nodeid && GS(nodeid->name) == ID_IM) {
241  image = (Image *)nodeid;
242  iuser = node->storage;
243  if (iuser->flag & IMA_OLD_PREMUL) {
244  iuser->flag &= ~IMA_OLD_PREMUL;
245  }
246  if (iuser->flag & IMA_DO_PREMUL) {
247  image->flag &= ~IMA_OLD_PREMUL;
249  }
250  }
251  }
252  }
253 }
254 
256 {
257  IDProperty *loop;
258  int i;
259 
260  for (loop = prop->data.group.first, i = 0; loop; loop = loop->next, i++) {
261  if (loop->type == IDP_GROUP) {
263  }
264  }
265 
266  if (prop->len != i) {
267  printf("Found and fixed bad id property group length.\n");
268  prop->len = i;
269  }
270 }
271 
273 {
274  ID *id;
275 
276  for (id = idlist.first; id; id = id->next) {
277  if (id->properties) {
279  }
280  }
281 }
282 
283 static void customdata_version_242(Mesh *me)
284 {
285  CustomDataLayer *layer;
286  MTFace *mtf;
287  MCol *mcol;
288  TFace *tf;
289  int a, mtfacen, mcoln;
290 
291  if (!me->vdata.totlayer) {
292  CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, me->mvert, me->totvert);
293 
294  if (me->dvert) {
296  }
297  }
298 
299  if (!me->edata.totlayer) {
300  CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->medge, me->totedge);
301  }
302 
303  if (!me->fdata.totlayer) {
305 
306  if (me->tface) {
307  if (me->mcol) {
308  MEM_freeN(me->mcol);
309  }
310 
313 
314  mtf = me->mtface;
315  mcol = me->mcol;
316  tf = me->tface;
317 
318  for (a = 0; a < me->totface; a++, mtf++, tf++, mcol += 4) {
319  memcpy(mcol, tf->col, sizeof(tf->col));
320  memcpy(mtf->uv, tf->uv, sizeof(tf->uv));
321  }
322 
323  MEM_freeN(me->tface);
324  me->tface = NULL;
325  }
326  else if (me->mcol) {
327  me->mcol = CustomData_add_layer(&me->fdata, CD_MCOL, CD_ASSIGN, me->mcol, me->totface);
328  }
329  }
330 
331  if (me->tface) {
332  MEM_freeN(me->tface);
333  me->tface = NULL;
334  }
335 
336  for (a = 0, mtfacen = 0, mcoln = 0; a < me->fdata.totlayer; a++) {
337  layer = &me->fdata.layers[a];
338 
339  if (layer->type == CD_MTFACE) {
340  if (layer->name[0] == 0) {
341  if (mtfacen == 0) {
342  strcpy(layer->name, "UVMap");
343  }
344  else {
345  BLI_snprintf(layer->name, sizeof(layer->name), "UVMap.%.3d", mtfacen);
346  }
347  }
348  mtfacen++;
349  }
350  else if (layer->type == CD_MCOL) {
351  if (layer->name[0] == 0) {
352  if (mcoln == 0) {
353  strcpy(layer->name, "Col");
354  }
355  else {
356  BLI_snprintf(layer->name, sizeof(layer->name), "Col.%.3d", mcoln);
357  }
358  }
359  mcoln++;
360  }
361  }
362 
364 }
365 
366 /*only copy render texface layer from active*/
367 static void customdata_version_243(Mesh *me)
368 {
369  CustomDataLayer *layer;
370  int a;
371 
372  for (a = 0; a < me->fdata.totlayer; a++) {
373  layer = &me->fdata.layers[a];
374  layer->active_rnd = layer->active;
375  }
376 }
377 
378 /* struct NodeImageAnim moved to ImageUser, and we make it default available */
380 {
381  bNode *node;
382 
383  if (ntree->type == NTREE_COMPOSIT) {
384  for (node = ntree->nodes.first; node; node = node->next) {
386  /* only image had storage */
387  if (node->storage) {
388  NodeImageAnim *nia = node->storage;
389  ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "ima user node");
390 
391  iuser->frames = nia->frames;
392  iuser->sfra = nia->sfra;
393  iuser->offset = nia->nr - 1;
394  iuser->cycl = nia->cyclic;
395  iuser->ok = 1;
396 
397  node->storage = iuser;
398  MEM_freeN(nia);
399  }
400  else {
401  ImageUser *iuser = node->storage = MEM_callocN(sizeof(ImageUser), "node image user");
402  iuser->sfra = 1;
403  iuser->ok = 1;
404  }
405  }
406  }
407  }
408 }
409 
411 {
412  PartEff *paf;
413 
414  if (eff->type == EFF_PARTICLE) {
415  paf = (PartEff *)eff;
416  if (paf->keys) {
417  MEM_freeN(paf->keys);
418  }
419  }
420  MEM_freeN(eff);
421 }
422 
424 {
425  Effect *eff;
426 
427  while ((eff = BLI_pophead(lb))) {
429  }
430 }
431 
433 {
434  bConstraint *con;
435  bConstraintTarget *ct;
436 
437  for (con = lb->first; con; con = con->next) {
438  if (con->type == CONSTRAINT_TYPE_PYTHON) {
440  if (data->tar) {
441  /* version patching needs to be done */
442  ct = MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
443 
444  ct->tar = data->tar;
445  BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
446  ct->space = con->tarspace;
447 
448  BLI_addtail(&data->targets, ct);
449  data->tarnum++;
450 
451  /* clear old targets to avoid problems */
452  data->tar = NULL;
453  data->subtarget[0] = '\0';
454  }
455  }
456  else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
458 
459  /* new headtail functionality makes Bone-Tip function obsolete */
460  if (data->flag & LOCLIKE_TIP) {
461  con->headtail = 1.0f;
462  }
463  }
464  }
465 }
466 
467 /* NOTE: this version patch is intended for versions < 2.52.2,
468  * but was initially introduced in 2.27 already. */
470 {
471  /* create new trackto constraint from the relationship */
472  if (ob->track) {
474  bTrackToConstraint *data = con->data;
475 
476  /* copy tracking settings from the object */
477  data->tar = ob->track;
478  data->reserved1 = ob->trackflag;
479  data->reserved2 = ob->upflag;
480  }
481 
482  /* clear old track setting */
483  ob->track = NULL;
484 }
485 
486 /* NOLINTNEXTLINE: readability-function-size */
488 {
489  /* WATCH IT!!!: pointers from libdata have not been converted */
490 
491  if (bmain->versionfile == 100) {
492  /* tex->extend and tex->imageflag have changed: */
493  Tex *tex = bmain->textures.first;
494  while (tex) {
495  if (tex->id.tag & LIB_TAG_NEED_LINK) {
496 
497  if (tex->extend == 0) {
498  if (tex->xrepeat || tex->yrepeat) {
499  tex->extend = TEX_REPEAT;
500  }
501  else {
502  tex->extend = TEX_EXTEND;
503  tex->xrepeat = tex->yrepeat = 1;
504  }
505  }
506  }
507  tex = tex->id.next;
508  }
509  }
510 
511  if (bmain->versionfile <= 101) {
512  /* frame mapping */
513  Scene *sce = bmain->scenes.first;
514  while (sce) {
515  sce->r.framapto = 100;
516  sce->r.images = 100;
517  sce->r.framelen = 1.0;
518  sce = sce->id.next;
519  }
520  }
521 
522  if (bmain->versionfile <= 103) {
523  /* new variable in object: colbits */
524  Object *ob = bmain->objects.first;
525  int a;
526  while (ob) {
527  ob->colbits = 0;
528  if (ob->totcol) {
529  for (a = 0; a < ob->totcol; a++) {
530  if (ob->mat[a]) {
531  ob->colbits |= (1 << a);
532  }
533  }
534  }
535  ob = ob->id.next;
536  }
537  }
538 
539  if (bmain->versionfile <= 104) {
540  /* timeoffs moved */
541  Object *ob = bmain->objects.first;
542  while (ob) {
543  if (ob->transflag & 1) {
544  ob->transflag -= 1;
545  }
546  ob = ob->id.next;
547  }
548  }
549 
550  if (bmain->versionfile <= 106) {
551  /* mcol changed */
552  Mesh *me = bmain->meshes.first;
553  while (me) {
554  if (me->mcol) {
555  vcol_to_fcol(me);
556  }
557  me = me->id.next;
558  }
559  }
560 
561  if (bmain->versionfile <= 107) {
562  Object *ob;
563  ob = bmain->objects.first;
564  while (ob) {
565  if (ob->dt == 0) {
566  ob->dt = OB_SOLID;
567  }
568  ob = ob->id.next;
569  }
570  }
571 
572  if (bmain->versionfile <= 109) {
573  /* New variable: `gridlines`. */
574  bScreen *screen = bmain->screens.first;
575  while (screen) {
576  ScrArea *area = screen->areabase.first;
577  while (area) {
578  SpaceLink *sl = area->spacedata.first;
579  while (sl) {
580  if (sl->spacetype == SPACE_VIEW3D) {
581  View3D *v3d = (View3D *)sl;
582 
583  if (v3d->gridlines == 0) {
584  v3d->gridlines = 20;
585  }
586  }
587  sl = sl->next;
588  }
589  area = area->next;
590  }
591  screen = screen->id.next;
592  }
593  }
594 
595  if (bmain->versionfile <= 134) {
596  Tex *tex = bmain->textures.first;
597  while (tex) {
598  if ((tex->rfac == 0.0f) && (tex->gfac == 0.0f) && (tex->bfac == 0.0f)) {
599  tex->rfac = 1.0f;
600  tex->gfac = 1.0f;
601  tex->bfac = 1.0f;
602  tex->filtersize = 1.0f;
603  }
604  tex = tex->id.next;
605  }
606  }
607 
608  if (bmain->versionfile <= 140) {
609  /* r-g-b-fac in texture */
610  Tex *tex = bmain->textures.first;
611  while (tex) {
612  if ((tex->rfac == 0.0f) && (tex->gfac == 0.0f) && (tex->bfac == 0.0f)) {
613  tex->rfac = 1.0f;
614  tex->gfac = 1.0f;
615  tex->bfac = 1.0f;
616  tex->filtersize = 1.0f;
617  }
618  tex = tex->id.next;
619  }
620  }
621 
622  if (bmain->versionfile <= 153) {
623  Scene *sce = bmain->scenes.first;
624  while (sce) {
625  if (sce->r.blurfac == 0.0f) {
626  sce->r.blurfac = 1.0f;
627  }
628  sce = sce->id.next;
629  }
630  }
631 
632  if (bmain->versionfile <= 163) {
633  Scene *sce = bmain->scenes.first;
634  while (sce) {
635  if (sce->r.frs_sec == 0) {
636  sce->r.frs_sec = 25;
637  }
638  sce = sce->id.next;
639  }
640  }
641 
642  if (bmain->versionfile <= 164) {
643  Mesh *me = bmain->meshes.first;
644  while (me) {
645  me->smoothresh = 30;
646  me = me->id.next;
647  }
648  }
649 
650  if (bmain->versionfile <= 165) {
651  Mesh *me = bmain->meshes.first;
652  TFace *tface;
653  int nr;
654  char *cp;
655 
656  while (me) {
657  if (me->tface) {
658  nr = me->totface;
659  tface = me->tface;
660  while (nr--) {
661  int j;
662  for (j = 0; j < 4; j++) {
663  int k;
664  cp = ((char *)&tface->col[j]) + 1;
665  for (k = 0; k < 3; k++) {
666  cp[k] = (cp[k] > 126) ? 255 : cp[k] * 2;
667  }
668  }
669 
670  tface++;
671  }
672  }
673  me = me->id.next;
674  }
675  }
676 
677  if (bmain->versionfile <= 169) {
678  Mesh *me = bmain->meshes.first;
679  while (me) {
680  if (me->subdiv == 0) {
681  me->subdiv = 1;
682  }
683  me = me->id.next;
684  }
685  }
686 
687  if (bmain->versionfile <= 169) {
688  bScreen *screen = bmain->screens.first;
689  while (screen) {
690  ScrArea *area = screen->areabase.first;
691  while (area) {
692  SpaceLink *sl = area->spacedata.first;
693  while (sl) {
694  if (sl->spacetype == SPACE_GRAPH) {
695  SpaceGraph *sipo = (SpaceGraph *)sl;
696  sipo->v2d.max[0] = 15000.0;
697  }
698  sl = sl->next;
699  }
700  area = area->next;
701  }
702  screen = screen->id.next;
703  }
704  }
705 
706  if (bmain->versionfile <= 170) {
707  Object *ob = bmain->objects.first;
708  PartEff *paf;
709  while (ob) {
711  if (paf) {
712  if (paf->staticstep == 0) {
713  paf->staticstep = 5;
714  }
715  }
716  ob = ob->id.next;
717  }
718  }
719 
720  if (bmain->versionfile <= 171) {
721  bScreen *screen = bmain->screens.first;
722  while (screen) {
723  ScrArea *area = screen->areabase.first;
724  while (area) {
725  SpaceLink *sl = area->spacedata.first;
726  while (sl) {
727  if (sl->spacetype == SPACE_TEXT) {
728  SpaceText *st = (SpaceText *)sl;
729  st->lheight = 12;
730  }
731  sl = sl->next;
732  }
733  area = area->next;
734  }
735  screen = screen->id.next;
736  }
737  }
738 
739  if (bmain->versionfile <= 173) {
740  int a, b;
741  Mesh *me = bmain->meshes.first;
742  while (me) {
743  if (me->tface) {
744  TFace *tface = me->tface;
745  for (a = 0; a < me->totface; a++, tface++) {
746  for (b = 0; b < 4; b++) {
747  tface->uv[b][0] /= 32767.0f;
748  tface->uv[b][1] /= 32767.0f;
749  }
750  }
751  }
752  me = me->id.next;
753  }
754  }
755 
756  if (bmain->versionfile <= 204) {
757  bSound *sound;
758 
759  sound = bmain->sounds.first;
760  while (sound) {
761  if (sound->volume < 0.01f) {
762  sound->volume = 1.0f;
763  }
764  sound = sound->id.next;
765  }
766  }
767 
768  if (bmain->versionfile <= 212) {
769  bSound *sound;
770  Mesh *me;
771 
772  sound = bmain->sounds.first;
773  while (sound) {
774  sound->max_gain = 1.0;
775  sound->min_gain = 0.0;
776  sound->distance = 1.0;
777 
778  if (sound->attenuation > 0.0f) {
779  sound->flags |= SOUND_FLAGS_3D;
780  }
781  else {
782  sound->flags &= ~SOUND_FLAGS_3D;
783  }
784 
785  sound = sound->id.next;
786  }
787 
788  /* me->subdiv changed to reflect the actual reparametization
789  * better, and smeshes were removed - if it was a smesh make
790  * it a subsurf, and reset the subdiv level because subsurf
791  * takes a lot more work to calculate.
792  */
793  for (me = bmain->meshes.first; me; me = me->id.next) {
794  enum {
795  ME_SMESH = (1 << 6),
796  ME_SUBSURF = (1 << 7),
797  };
798  if (me->flag & ME_SMESH) {
799  me->flag &= ~ME_SMESH;
800  me->flag |= ME_SUBSURF;
801 
802  me->subdiv = 1;
803  }
804  else {
805  if (me->subdiv < 2) {
806  me->subdiv = 1;
807  }
808  else {
809  me->subdiv--;
810  }
811  }
812  }
813  }
814 
815  if (bmain->versionfile <= 220) {
816  Mesh *me;
817 
818  /* Began using alpha component of vertex colors, but
819  * old file vertex colors are undefined, reset them
820  * to be fully opaque. -zr
821  */
822  for (me = bmain->meshes.first; me; me = me->id.next) {
823  if (me->mcol) {
824  int i;
825 
826  for (i = 0; i < me->totface * 4; i++) {
827  MCol *mcol = &me->mcol[i];
828  mcol->a = 255;
829  }
830  }
831  if (me->tface) {
832  int i, j;
833 
834  for (i = 0; i < me->totface; i++) {
835  TFace *tf = &((TFace *)me->tface)[i];
836 
837  for (j = 0; j < 4; j++) {
838  char *col = (char *)&tf->col[j];
839 
840  col[0] = 255;
841  }
842  }
843  }
844  }
845  }
846 
847  if (bmain->versionfile <= 223) {
848  VFont *vf;
849  for (vf = bmain->fonts.first; vf; vf = vf->id.next) {
850  if (STREQ(vf->filepath + strlen(vf->filepath) - 6, ".Bfont")) {
851  strcpy(vf->filepath, FO_BUILTIN_NAME);
852  }
853  }
854  }
855 
856  if (bmain->versionfile <= 224) {
857  bSound *sound;
858  Scene *sce;
859  Mesh *me;
860  bScreen *screen;
861 
862  for (sound = bmain->sounds.first; sound; sound = sound->id.next) {
863  if (sound->packedfile) {
864  if (sound->newpackedfile == NULL) {
865  sound->newpackedfile = sound->packedfile;
866  }
867  sound->packedfile = NULL;
868  }
869  }
870  /* Make sure that old subsurf meshes don't have zero subdivision level for rendering */
871  for (me = bmain->meshes.first; me; me = me->id.next) {
872  enum { ME_SUBSURF = (1 << 7) };
873  if ((me->flag & ME_SUBSURF) && (me->subdivr == 0)) {
874  me->subdivr = me->subdiv;
875  }
876  }
877 
878  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
879  sce->r.stereomode = 1; /* no stereo */
880  }
881 
882  /* some oldfile patch, moved from set_func_space */
883  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
884  ScrArea *area;
885 
886  for (area = screen->areabase.first; area; area = area->next) {
887  SpaceLink *sl;
888 
889  for (sl = area->spacedata.first; sl; sl = sl->next) {
890  if (sl->spacetype == SPACE_GRAPH) {
891  SpaceSeq *sseq = (SpaceSeq *)sl;
892  sseq->v2d.keeptot = 0;
893  }
894  }
895  }
896  }
897  }
898 
899  if (bmain->versionfile <= 227) {
900  Scene *sce;
901  bScreen *screen;
902  Object *ob;
903 
904  /* As of now, this insures that the transition from the old Track system
905  * to the new full constraint Track is painless for everyone. - theeth
906  */
907  ob = bmain->objects.first;
908 
909  while (ob) {
910  ListBase *list;
911  list = &ob->constraints;
912 
913  /* check for already existing TrackTo constraint
914  * set their track and up flag correctly
915  */
916 
917  if (list) {
918  bConstraint *curcon;
919  for (curcon = list->first; curcon; curcon = curcon->next) {
920  if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
921  bTrackToConstraint *data = curcon->data;
922  data->reserved1 = ob->trackflag;
923  data->reserved2 = ob->upflag;
924  }
925  }
926  }
927 
928  if (ob->type == OB_ARMATURE) {
929  if (ob->pose) {
930  bConstraint *curcon;
931  bPoseChannel *pchan;
932  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
933  for (curcon = pchan->constraints.first; curcon; curcon = curcon->next) {
934  if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
935  bTrackToConstraint *data = curcon->data;
936  data->reserved1 = ob->trackflag;
937  data->reserved2 = ob->upflag;
938  }
939  }
940  }
941  }
942  }
943 
944  /* Change Ob->Track in real TrackTo constraint */
946 
947  ob = ob->id.next;
948  }
949 
950  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
951  sce->audio.mixrate = 48000;
952  sce->audio.flag |= AUDIO_SCRUB;
953  }
954 
955  /* patch for old wrong max view2d settings, allows zooming out more */
956  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
957  ScrArea *area;
958 
959  for (area = screen->areabase.first; area; area = area->next) {
960  SpaceLink *sl;
961 
962  for (sl = area->spacedata.first; sl; sl = sl->next) {
963  if (sl->spacetype == SPACE_ACTION) {
964  SpaceAction *sac = (SpaceAction *)sl;
965  sac->v2d.max[0] = 32000;
966  }
967  else if (sl->spacetype == SPACE_NLA) {
968  SpaceNla *sla = (SpaceNla *)sl;
969  sla->v2d.max[0] = 32000;
970  }
971  }
972  }
973  }
974  }
975 
976  if (bmain->versionfile <= 228) {
977  bScreen *screen;
978  Object *ob;
979 
980  /* As of now, this insures that the transition from the old Track system
981  * to the new full constraint Track is painless for everyone.
982  */
983  ob = bmain->objects.first;
984 
985  while (ob) {
986  ListBase *list;
987  list = &ob->constraints;
988 
989  /* check for already existing TrackTo constraint
990  * set their track and up flag correctly */
991 
992  if (list) {
993  bConstraint *curcon;
994  for (curcon = list->first; curcon; curcon = curcon->next) {
995  if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
996  bTrackToConstraint *data = curcon->data;
997  data->reserved1 = ob->trackflag;
998  data->reserved2 = ob->upflag;
999  }
1000  }
1001  }
1002 
1003  if (ob->type == OB_ARMATURE) {
1004  if (ob->pose) {
1005  bConstraint *curcon;
1006  bPoseChannel *pchan;
1007  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
1008  for (curcon = pchan->constraints.first; curcon; curcon = curcon->next) {
1009  if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
1010  bTrackToConstraint *data = curcon->data;
1011  data->reserved1 = ob->trackflag;
1012  data->reserved2 = ob->upflag;
1013  }
1014  }
1015  }
1016  }
1017  }
1018 
1019  ob = ob->id.next;
1020  }
1021 
1022  /* convert old mainb values for new button panels */
1023  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1024  ScrArea *area;
1025 
1026  for (area = screen->areabase.first; area; area = area->next) {
1027  SpaceLink *sl;
1028 
1029  for (sl = area->spacedata.first; sl; sl = sl->next) {
1030  if (sl->spacetype == SPACE_PROPERTIES) {
1031  SpaceProperties *sbuts = (SpaceProperties *)sl;
1032 
1033  sbuts->v2d.maxzoom = 1.2f;
1034 
1035  if (sbuts->mainb == BUTS_LAMP) {
1036  sbuts->mainb = CONTEXT_SHADING;
1037  // sbuts->tab[CONTEXT_SHADING] = TAB_SHADING_LAMP;
1038  }
1039  else if (sbuts->mainb == BUTS_MAT) {
1040  sbuts->mainb = CONTEXT_SHADING;
1041  // sbuts->tab[CONTEXT_SHADING] = TAB_SHADING_MAT;
1042  }
1043  else if (sbuts->mainb == BUTS_TEX) {
1044  sbuts->mainb = CONTEXT_SHADING;
1045  // sbuts->tab[CONTEXT_SHADING] = TAB_SHADING_TEX;
1046  }
1047  else if (sbuts->mainb == BUTS_ANIM) {
1048  sbuts->mainb = CONTEXT_OBJECT;
1049  }
1050  else if (sbuts->mainb == BUTS_WORLD) {
1051  sbuts->mainb = CONTEXT_SCENE;
1052  // sbuts->tab[CONTEXT_SCENE] = TAB_SCENE_WORLD;
1053  }
1054  else if (sbuts->mainb == BUTS_RENDER) {
1055  sbuts->mainb = CONTEXT_SCENE;
1056  // sbuts->tab[CONTEXT_SCENE] = TAB_SCENE_RENDER;
1057  }
1058  else if (sbuts->mainb == BUTS_FPAINT) {
1059  sbuts->mainb = CONTEXT_EDITING;
1060  }
1061  else if (sbuts->mainb == BUTS_RADIO) {
1062  sbuts->mainb = CONTEXT_SHADING;
1063  // sbuts->tab[CONTEXT_SHADING] = TAB_SHADING_RAD;
1064  }
1065  else if (sbuts->mainb == BUTS_CONSTRAINT) {
1066  sbuts->mainb = CONTEXT_OBJECT;
1067  }
1068  else if (sbuts->mainb == BUTS_SCRIPT) {
1069  sbuts->mainb = CONTEXT_OBJECT;
1070  }
1071  else if (sbuts->mainb == BUTS_EDIT) {
1072  sbuts->mainb = CONTEXT_EDITING;
1073  }
1074  else {
1075  sbuts->mainb = CONTEXT_SCENE;
1076  }
1077  }
1078  }
1079  }
1080  }
1081  }
1082 
1083  /* ton: made this 230 instead of 229,
1084  * to be sure (tuho files) and this is a reliable check anyway
1085  * nevertheless, we might need to think over a fitness (initialize)
1086  * check apart from the do_versions()
1087  */
1088 
1089  if (bmain->versionfile <= 230) {
1090  bScreen *screen;
1091 
1092  /* new variable blockscale, for panels in any area */
1093  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1094  ScrArea *area;
1095 
1096  for (area = screen->areabase.first; area; area = area->next) {
1097  SpaceLink *sl;
1098 
1099  for (sl = area->spacedata.first; sl; sl = sl->next) {
1100  /* added: 5x better zoom in for action */
1101  if (sl->spacetype == SPACE_ACTION) {
1102  SpaceAction *sac = (SpaceAction *)sl;
1103  sac->v2d.maxzoom = 50;
1104  }
1105  }
1106  }
1107  }
1108  }
1109 
1110  if (bmain->versionfile <= 231) {
1111  bScreen *screen = bmain->screens.first;
1112 
1113  /* new bit flags for showing/hiding grid floor and axes */
1114 
1115  while (screen) {
1116  ScrArea *area = screen->areabase.first;
1117  while (area) {
1118  SpaceLink *sl = area->spacedata.first;
1119  while (sl) {
1120  if (sl->spacetype == SPACE_VIEW3D) {
1121  View3D *v3d = (View3D *)sl;
1122 
1123  if (v3d->gridflag == 0) {
1124  v3d->gridflag |= V3D_SHOW_X;
1125  v3d->gridflag |= V3D_SHOW_Y;
1126  v3d->gridflag |= V3D_SHOW_FLOOR;
1127  v3d->gridflag &= ~V3D_SHOW_Z;
1128  }
1129  }
1130  sl = sl->next;
1131  }
1132  area = area->next;
1133  }
1134  screen = screen->id.next;
1135  }
1136  }
1137 
1138  if (bmain->versionfile <= 232) {
1139  Tex *tex = bmain->textures.first;
1140  World *wrld = bmain->worlds.first;
1141  bScreen *screen;
1142 
1143  while (tex) {
1144  if ((tex->flag & (TEX_CHECKER_ODD + TEX_CHECKER_EVEN)) == 0) {
1145  tex->flag |= TEX_CHECKER_ODD;
1146  }
1147  /* copied from kernel texture.c */
1148  if (tex->ns_outscale == 0.0f) {
1149  /* musgrave */
1150  tex->mg_H = 1.0f;
1151  tex->mg_lacunarity = 2.0f;
1152  tex->mg_octaves = 2.0f;
1153  tex->mg_offset = 1.0f;
1154  tex->mg_gain = 1.0f;
1155  tex->ns_outscale = 1.0f;
1156  /* distnoise */
1157  tex->dist_amount = 1.0f;
1158  /* voronoi */
1159  tex->vn_w1 = 1.0f;
1160  tex->vn_mexp = 2.5f;
1161  }
1162  tex = tex->id.next;
1163  }
1164 
1165  while (wrld) {
1166  if (wrld->aodist == 0.0f) {
1167  wrld->aodist = 10.0f;
1168  }
1169  if (wrld->aoenergy == 0.0f) {
1170  wrld->aoenergy = 1.0f;
1171  }
1172  wrld = wrld->id.next;
1173  }
1174 
1175  /* new variable blockscale, for panels in any area, do again because new
1176  * areas didn't initialize it to 0.7 yet
1177  */
1178  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1179  ScrArea *area;
1180  for (area = screen->areabase.first; area; area = area->next) {
1181  SpaceLink *sl;
1182  for (sl = area->spacedata.first; sl; sl = sl->next) {
1183  /* added: 5x better zoom in for nla */
1184  if (sl->spacetype == SPACE_NLA) {
1185  SpaceNla *snla = (SpaceNla *)sl;
1186  snla->v2d.maxzoom = 50;
1187  }
1188  }
1189  }
1190  }
1191  }
1192 
1193  if (bmain->versionfile <= 233) {
1194  bScreen *screen;
1195 
1196  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1197  ScrArea *area;
1198  for (area = screen->areabase.first; area; area = area->next) {
1199  SpaceLink *sl;
1200  for (sl = area->spacedata.first; sl; sl = sl->next) {
1201  if (sl->spacetype == SPACE_VIEW3D) {
1202  View3D *v3d = (View3D *)sl;
1203  v3d->flag |= V3D_SELECT_OUTLINE;
1204  }
1205  }
1206  }
1207  }
1208  }
1209 
1210  if (bmain->versionfile <= 234) {
1211  bScreen *screen;
1212 
1213  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1214  ScrArea *area;
1215  for (area = screen->areabase.first; area; area = area->next) {
1216  SpaceLink *sl;
1217  for (sl = area->spacedata.first; sl; sl = sl->next) {
1218  if (sl->spacetype == SPACE_TEXT) {
1219  SpaceText *st = (SpaceText *)sl;
1220  if (st->tabnumber == 0) {
1221  st->tabnumber = 2;
1222  }
1223  }
1224  }
1225  }
1226  }
1227  }
1228 
1229  if (bmain->versionfile <= 235) {
1230  Tex *tex = bmain->textures.first;
1231  Scene *sce = bmain->scenes.first;
1232  Sequence *seq;
1233  Editing *ed;
1234 
1235  while (tex) {
1236  if (tex->nabla == 0.0f) {
1237  tex->nabla = 0.025f;
1238  }
1239  tex = tex->id.next;
1240  }
1241  while (sce) {
1242  ed = sce->ed;
1243  if (ed) {
1244  SEQ_ALL_BEGIN (sce->ed, seq) {
1245  if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE)) {
1247  }
1248  }
1249  SEQ_ALL_END;
1250  }
1251 
1252  sce = sce->id.next;
1253  }
1254  }
1255 
1256  if (bmain->versionfile <= 236) {
1257  Object *ob;
1258  Camera *cam = bmain->cameras.first;
1259 
1260  while (cam) {
1261  if (cam->ortho_scale == 0.0f) {
1262  cam->ortho_scale = 256.0f / cam->lens;
1263  if (cam->type == CAM_ORTHO) {
1264  printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
1265  }
1266  }
1267  cam = cam->id.next;
1268  }
1269  /* force oops draw if depgraph was set*/
1270  /* set time line var */
1271 
1272  /* softbody init new vars */
1273  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1274  if (ob->soft) {
1275  if (ob->soft->defgoal == 0.0f) {
1276  ob->soft->defgoal = 0.7f;
1277  }
1278  if (ob->soft->physics_speed == 0.0f) {
1279  ob->soft->physics_speed = 1.0f;
1280  }
1281 
1282  if (ob->soft->interval == 0) {
1283  ob->soft->interval = 2;
1284  ob->soft->sfra = 1;
1285  ob->soft->efra = 100;
1286  }
1287  }
1288  if (ob->soft && ob->soft->vertgroup == 0) {
1289  bDeformGroup *locGroup = BKE_object_defgroup_find_name(ob, "SOFTGOAL");
1290  if (locGroup) {
1291  /* retrieve index for that group */
1292  ob->soft->vertgroup = 1 + BLI_findindex(&ob->defbase, locGroup);
1293  }
1294  }
1295  }
1296  }
1297 
1298  if (bmain->versionfile <= 237) {
1299  bArmature *arm;
1300  bConstraint *con;
1301  Object *ob;
1302  Bone *bone;
1303 
1304  /* armature recode checks */
1305  for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
1306  BKE_armature_where_is(arm);
1307 
1308  for (bone = arm->bonebase.first; bone; bone = bone->next) {
1310  }
1311  }
1312  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1313  if (ob->parent) {
1314  Object *parent = blo_do_versions_newlibadr(fd, lib, ob->parent);
1315  if (parent && parent->type == OB_LATTICE) {
1316  ob->partype = PARSKEL;
1317  }
1318  }
1319 
1320  /* Note: #BKE_pose_rebuild is further only called on leave edit-mode. */
1321  if (ob->type == OB_ARMATURE) {
1322  if (ob->pose) {
1323  BKE_pose_tag_recalc(bmain, ob->pose);
1324  }
1325 
1326  /* Cannot call stuff now (pointers!), done in #setup_app_data. */
1327  ob->id.recalc |= ID_RECALC_ALL;
1328 
1329  /* new generic xray option */
1330  arm = blo_do_versions_newlibadr(fd, lib, ob->data);
1331  enum { ARM_DRAWXRAY = (1 << 1) };
1332  if (arm->flag & ARM_DRAWXRAY) {
1333  ob->dtx |= OB_DRAW_IN_FRONT;
1334  }
1335  }
1336  else if (ob->type == OB_MESH) {
1337  Mesh *me = blo_do_versions_newlibadr(fd, lib, ob->data);
1338 
1339  enum {
1340  ME_SUBSURF = (1 << 7),
1341  ME_OPT_EDGES = (1 << 8),
1342  };
1343 
1344  if ((me->flag & ME_SUBSURF)) {
1347 
1348  smd->levels = MAX2(1, me->subdiv);
1349  smd->renderLevels = MAX2(1, me->subdivr);
1350  smd->subdivType = me->subsurftype;
1351 
1352  smd->modifier.mode = 0;
1353  if (me->subdiv != 0) {
1354  smd->modifier.mode |= 1;
1355  }
1356  if (me->subdivr != 0) {
1357  smd->modifier.mode |= 2;
1358  }
1359 
1360  if (me->flag & ME_OPT_EDGES) {
1362  }
1363 
1364  BLI_addtail(&ob->modifiers, smd);
1365 
1367  }
1368  }
1369 
1370  /* follow path constraint needs to set the 'path' option in curves... */
1371  for (con = ob->constraints.first; con; con = con->next) {
1372  if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) {
1374  Object *obc = blo_do_versions_newlibadr(fd, lib, data->tar);
1375 
1376  if (obc && obc->type == OB_CURVE) {
1377  Curve *cu = blo_do_versions_newlibadr(fd, lib, obc->data);
1378  if (cu) {
1379  cu->flag |= CU_PATH;
1380  }
1381  }
1382  }
1383  }
1384  }
1385  }
1386 
1387  if (bmain->versionfile <= 238) {
1388  Lattice *lt;
1389  Object *ob;
1390  bArmature *arm;
1391  Mesh *me;
1392  Key *key;
1393  Scene *sce = bmain->scenes.first;
1394 
1395  while (sce) {
1396  if (sce->toolsettings == NULL) {
1397  sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
1398  sce->toolsettings->doublimit = 0.001f;
1399  }
1400  sce = sce->id.next;
1401  }
1402 
1403  for (lt = bmain->lattices.first; lt; lt = lt->id.next) {
1404  if (lt->fu == 0.0f && lt->fv == 0.0f && lt->fw == 0.0f) {
1405  calc_lat_fudu(lt->flag, lt->pntsu, &lt->fu, &lt->du);
1406  calc_lat_fudu(lt->flag, lt->pntsv, &lt->fv, &lt->dv);
1407  calc_lat_fudu(lt->flag, lt->pntsw, &lt->fw, &lt->dw);
1408  }
1409  }
1410 
1411  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1412  ModifierData *md;
1413  PartEff *paf;
1414 
1415  for (md = ob->modifiers.first; md; md = md->next) {
1416  if (md->type == eModifierType_Subsurf) {
1418 
1420  }
1421  }
1422 
1423  if ((ob->softflag & OB_SB_ENABLE) &&
1425  if (ob->softflag & OB_SB_POSTDEF) {
1426  md = ob->modifiers.first;
1427 
1429  md = md->next;
1430  }
1431 
1433  }
1434  else {
1436  }
1437 
1438  ob->softflag &= ~OB_SB_ENABLE;
1439  }
1440 
1441  if (ob->pose) {
1442  bPoseChannel *pchan;
1443  bConstraint *con;
1444  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
1445  /* note, pchan->bone is also lib-link stuff */
1446  if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
1447  pchan->limitmin[0] = pchan->limitmin[1] = pchan->limitmin[2] = -180.0f;
1448  pchan->limitmax[0] = pchan->limitmax[1] = pchan->limitmax[2] = 180.0f;
1449 
1450  for (con = pchan->constraints.first; con; con = con->next) {
1451  if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
1453  data->weight = 1.0f;
1454  data->orientweight = 1.0f;
1455  data->flag &= ~CONSTRAINT_IK_ROT;
1456 
1457  /* enforce conversion from old IK_TOPARENT to rootbone index */
1458  data->rootbone = -1;
1459 
1460  /* update_pose_etc handles rootbone == -1 */
1461  BKE_pose_tag_recalc(bmain, ob->pose);
1462  }
1463  }
1464  }
1465  }
1466  }
1467 
1469  if (paf) {
1470  if (paf->disp == 0) {
1471  paf->disp = 100;
1472  }
1473  if (paf->speedtex == 0) {
1474  paf->speedtex = 8;
1475  }
1476  if (paf->omat == 0) {
1477  paf->omat = 1;
1478  }
1479  }
1480  }
1481 
1482  for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
1483  bone_version_238(&arm->bonebase);
1484  arm->deformflag |= ARM_DEF_VGROUP;
1485  }
1486 
1487  for (me = bmain->meshes.first; me; me = me->id.next) {
1488  if (!me->medge) {
1489  BKE_mesh_calc_edges_legacy(me, true); /* true = use mface->edcode */
1490  }
1491  else {
1493  }
1494  }
1495 
1496  for (key = bmain->shapekeys.first; key; key = key->id.next) {
1497  KeyBlock *kb;
1498  int index = 1;
1499 
1500  for (kb = key->block.first; kb; kb = kb->next) {
1501  if (kb == key->refkey) {
1502  if (kb->name[0] == 0) {
1503  strcpy(kb->name, "Basis");
1504  }
1505  }
1506  else {
1507  if (kb->name[0] == 0) {
1508  BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
1509  }
1510  index++;
1511  }
1512  }
1513  }
1514  }
1515 
1516  if (bmain->versionfile <= 239) {
1517  bArmature *arm;
1518  Object *ob;
1519  Scene *sce = bmain->scenes.first;
1520  Camera *cam = bmain->cameras.first;
1521  int set_passepartout = 0;
1522 
1523  /* deformflag is local in modifier now */
1524  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1525  ModifierData *md;
1526 
1527  for (md = ob->modifiers.first; md; md = md->next) {
1528  if (md->type == eModifierType_Armature) {
1530  if (amd->object && amd->deformflag == 0) {
1531  Object *oba = blo_do_versions_newlibadr(fd, lib, amd->object);
1532  arm = blo_do_versions_newlibadr(fd, lib, oba->data);
1533  amd->deformflag = arm->deformflag;
1534  }
1535  }
1536  }
1537  }
1538 
1539  /* updating stepsize for ghost drawing */
1540  for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
1541  bone_version_239(&arm->bonebase);
1542  if (arm->layer == 0) {
1543  arm->layer = 1;
1544  }
1545  }
1546 
1547  for (; sce; sce = sce->id.next) {
1548  if (sce->r.scemode & R_PASSEPARTOUT) {
1549  set_passepartout = 1;
1550  sce->r.scemode &= ~R_PASSEPARTOUT;
1551  }
1552  }
1553 
1554  for (; cam; cam = cam->id.next) {
1555  if (set_passepartout) {
1556  cam->flag |= CAM_SHOWPASSEPARTOUT;
1557  }
1558 
1559  /* make sure old cameras have title safe on */
1560  if (!(cam->flag & CAM_SHOW_SAFE_MARGINS)) {
1561  cam->flag |= CAM_SHOW_SAFE_MARGINS;
1562  }
1563 
1564  /* set an appropriate camera passepartout alpha */
1565  if (!(cam->passepartalpha)) {
1566  cam->passepartalpha = 0.2f;
1567  }
1568  }
1569  }
1570 
1571  if (bmain->versionfile <= 241) {
1572  Object *ob;
1573  Scene *sce;
1574  Light *la;
1575  bArmature *arm;
1576  bNodeTree *ntree;
1577 
1578  /* updating layers still */
1579  for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
1580  bone_version_239(&arm->bonebase);
1581  if (arm->layer == 0) {
1582  arm->layer = 1;
1583  }
1584  }
1585  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
1586  if (sce->audio.mixrate == 0) {
1587  sce->audio.mixrate = 48000;
1588  }
1589 
1590  /* We don't add default layer since blender2.8 because the layers
1591  * are now in Scene->view_layers and a default layer is created in
1592  * the doversion later on.
1593  */
1595  /* new layer flag for sky, was default for solid */
1596  for (srl = sce->r.layers.first; srl; srl = srl->next) {
1597  if (srl->layflag & SCE_LAY_SOLID) {
1598  srl->layflag |= SCE_LAY_SKY;
1599  }
1601  }
1602 
1603  /* node version changes */
1604  if (sce->nodetree) {
1606  }
1607 
1608  /* uv calculation options moved to toolsettings */
1609  if (sce->toolsettings->unwrapper == 0) {
1611  sce->toolsettings->unwrapper = 1;
1612  }
1613  }
1614 
1615  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
1617  }
1618 
1619  for (la = bmain->lights.first; la; la = la->id.next) {
1620  if (la->buffers == 0) {
1621  la->buffers = 1;
1622  }
1623  }
1624 
1625  /* for empty drawsize and drawtype */
1626  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1627  if (ob->empty_drawsize == 0.0f) {
1628  ob->empty_drawtype = OB_ARROWS;
1629  ob->empty_drawsize = 1.0;
1630  }
1631  }
1632 
1633  /* during 2.41 images with this name were used for viewer node output, lets fix that */
1634  if (bmain->versionfile == 241) {
1635  Image *ima;
1636  for (ima = bmain->images.first; ima; ima = ima->id.next) {
1637  if (STREQ(ima->filepath, "Compositor")) {
1638  strcpy(ima->id.name + 2, "Viewer Node");
1639  strcpy(ima->filepath, "Viewer Node");
1640  }
1641  }
1642  }
1643  }
1644 
1645  if (bmain->versionfile <= 242) {
1646  Scene *sce;
1647  bScreen *screen;
1648  Object *ob;
1649  Curve *cu;
1650  Material *ma;
1651  Mesh *me;
1652  Collection *collection;
1653  Nurb *nu;
1654  BezTriple *bezt;
1655  BPoint *bp;
1656  bNodeTree *ntree;
1657  int a;
1658 
1659  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1660  ScrArea *area;
1661  area = screen->areabase.first;
1662  while (area) {
1663  SpaceLink *sl;
1664 
1665  for (sl = area->spacedata.first; sl; sl = sl->next) {
1666  if (sl->spacetype == SPACE_VIEW3D) {
1667  View3D *v3d = (View3D *)sl;
1668  if (v3d->gridsubdiv == 0) {
1669  v3d->gridsubdiv = 10;
1670  }
1671  }
1672  }
1673  area = area->next;
1674  }
1675  }
1676 
1677  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
1678  enum {
1679  R_THREADS = (1 << 19),
1680  };
1681  if (sce->toolsettings->select_thresh == 0.0f) {
1682  sce->toolsettings->select_thresh = 0.01f;
1683  }
1684  if (sce->r.threads == 0) {
1685  if (sce->r.mode & R_THREADS) {
1686  sce->r.threads = 2;
1687  }
1688  else {
1689  sce->r.threads = 1;
1690  }
1691  }
1692  if (sce->nodetree) {
1694  }
1695  }
1696 
1697  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
1699  }
1700 
1701  /* add default radius values to old curve points */
1702  for (cu = bmain->curves.first; cu; cu = cu->id.next) {
1703  for (nu = cu->nurb.first; nu; nu = nu->next) {
1704  if (nu->bezt) {
1705  for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
1706  if (!bezt->radius) {
1707  bezt->radius = 1.0;
1708  }
1709  }
1710  }
1711  else if (nu->bp) {
1712  for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
1713  if (!bp->radius) {
1714  bp->radius = 1.0;
1715  }
1716  }
1717  }
1718  }
1719  }
1720 
1721  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1722  ModifierData *md;
1723  ListBase *list;
1724  list = &ob->constraints;
1725 
1726  /* check for already existing MinMax (floor) constraint
1727  * and update the sticky flagging */
1728 
1729  if (list) {
1730  bConstraint *curcon;
1731  for (curcon = list->first; curcon; curcon = curcon->next) {
1732  switch (curcon->type) {
1733  case CONSTRAINT_TYPE_ROTLIKE: {
1734  bRotateLikeConstraint *data = curcon->data;
1735 
1736  /* version patch from buttons_object.c */
1737  if (data->flag == 0) {
1738  data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
1739  }
1740 
1741  break;
1742  }
1743  }
1744  }
1745  }
1746 
1747  if (ob->type == OB_ARMATURE) {
1748  if (ob->pose) {
1749  bConstraint *curcon;
1750  bPoseChannel *pchan;
1751  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
1752  for (curcon = pchan->constraints.first; curcon; curcon = curcon->next) {
1753  switch (curcon->type) {
1755  bKinematicConstraint *data = curcon->data;
1756  if (!(data->flag & CONSTRAINT_IK_POS)) {
1757  data->flag |= CONSTRAINT_IK_POS;
1758  data->flag |= CONSTRAINT_IK_STRETCH;
1759  }
1760  break;
1761  }
1762  case CONSTRAINT_TYPE_ROTLIKE: {
1763  bRotateLikeConstraint *data = curcon->data;
1764 
1765  /* version patch from buttons_object.c */
1766  if (data->flag == 0) {
1767  data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
1768  }
1769  break;
1770  }
1771  }
1772  }
1773  }
1774  }
1775  }
1776 
1777  /* copy old object level track settings to curve modifiers */
1778  for (md = ob->modifiers.first; md; md = md->next) {
1779  if (md->type == eModifierType_Curve) {
1780  CurveModifierData *cmd = (CurveModifierData *)md;
1781 
1782  if (cmd->defaxis == 0) {
1783  cmd->defaxis = ob->trackflag + 1;
1784  }
1785  }
1786  }
1787  }
1788 
1789  for (ma = bmain->materials.first; ma; ma = ma->id.next) {
1790  if (ma->nodetree) {
1792  }
1793  }
1794 
1795  for (me = bmain->meshes.first; me; me = me->id.next) {
1797  }
1798 
1799  for (collection = bmain->collections.first; collection; collection = collection->id.next) {
1800  if (collection->layer == 0) {
1801  collection->layer = (1 << 20) - 1;
1802  }
1803  }
1804 
1805  /* now, subversion control! */
1806  if (bmain->subversionfile < 3) {
1807  Image *ima;
1808  Tex *tex;
1809 
1810  /* Image refactor initialize */
1811  for (ima = bmain->images.first; ima; ima = ima->id.next) {
1812  ima->source = IMA_SRC_FILE;
1813  ima->type = IMA_TYPE_IMAGE;
1814 
1815  ima->gen_x = 256;
1816  ima->gen_y = 256;
1817  ima->gen_type = 1;
1818 
1819  if (STREQLEN(ima->id.name + 2, "Viewer Node", sizeof(ima->id.name) - 2)) {
1820  ima->source = IMA_SRC_VIEWER;
1821  ima->type = IMA_TYPE_COMPOSITE;
1822  }
1823  if (STREQLEN(ima->id.name + 2, "Render Result", sizeof(ima->id.name) - 2)) {
1824  ima->source = IMA_SRC_VIEWER;
1825  ima->type = IMA_TYPE_R_RESULT;
1826  }
1827  }
1828  for (tex = bmain->textures.first; tex; tex = tex->id.next) {
1829  enum {
1830  TEX_ANIMCYCLIC = (1 << 6),
1831  TEX_ANIM5 = (1 << 7),
1832  };
1833 
1834  if (tex->type == TEX_IMAGE && tex->ima) {
1835  ima = blo_do_versions_newlibadr(fd, lib, tex->ima);
1836  if (tex->imaflag & TEX_ANIM5) {
1837  ima->source = IMA_SRC_MOVIE;
1838  }
1839  }
1840  tex->iuser.frames = tex->frames;
1841  tex->iuser.offset = tex->offset;
1842  tex->iuser.sfra = tex->sfra;
1843  tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC) != 0;
1844  }
1845  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
1846  if (sce->nodetree) {
1848  }
1849  }
1850  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
1852  }
1853  for (ma = bmain->materials.first; ma; ma = ma->id.next) {
1854  if (ma->nodetree) {
1856  }
1857  }
1858  }
1859 
1860  if (bmain->subversionfile < 4) {
1861  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
1862  sce->r.bake_mode = 1; /* prevent to include render stuff here */
1863  sce->r.bake_filter = 16;
1864  sce->r.bake_flag = R_BAKE_CLEAR;
1865  }
1866  }
1867  }
1868 
1869  if (bmain->versionfile <= 243) {
1870  Object *ob = bmain->objects.first;
1871 
1872  for (; ob; ob = ob->id.next) {
1873  bDeformGroup *curdef;
1874 
1875  for (curdef = ob->defbase.first; curdef; curdef = curdef->next) {
1876  /* replace an empty-string name with unique name */
1877  if (curdef->name[0] == '\0') {
1878  BKE_object_defgroup_unique_name(curdef, ob);
1879  }
1880  }
1881 
1882  if (bmain->versionfile < 243 || bmain->subversionfile < 1) {
1883  ModifierData *md;
1884 
1885  /* translate old mirror modifier axis values to new flags */
1886  for (md = ob->modifiers.first; md; md = md->next) {
1887  if (md->type == eModifierType_Mirror) {
1889 
1890  switch (mmd->axis) {
1891  case 0:
1892  mmd->flag |= MOD_MIR_AXIS_X;
1893  break;
1894  case 1:
1895  mmd->flag |= MOD_MIR_AXIS_Y;
1896  break;
1897  case 2:
1898  mmd->flag |= MOD_MIR_AXIS_Z;
1899  break;
1900  }
1901 
1902  mmd->axis = 0;
1903  }
1904  }
1905  }
1906  }
1907 
1908  /* render layer added, this is not the active layer */
1909  if (bmain->versionfile <= 243 || bmain->subversionfile < 2) {
1910  Mesh *me;
1911  for (me = bmain->meshes.first; me; me = me->id.next) {
1913  }
1914  }
1915  }
1916 
1917  if (bmain->versionfile <= 244) {
1918  bScreen *screen;
1919 
1920  if (bmain->versionfile != 244 || bmain->subversionfile < 2) {
1921  /* correct older action editors - incorrect scrolling */
1922  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1923  ScrArea *area;
1924  area = screen->areabase.first;
1925  while (area) {
1926  SpaceLink *sl;
1927 
1928  for (sl = area->spacedata.first; sl; sl = sl->next) {
1929  if (sl->spacetype == SPACE_ACTION) {
1930  SpaceAction *saction = (SpaceAction *)sl;
1931 
1932  saction->v2d.tot.ymin = -1000.0;
1933  saction->v2d.tot.ymax = 0.0;
1934 
1935  saction->v2d.cur.ymin = -75.0;
1936  saction->v2d.cur.ymax = 5.0;
1937  }
1938  }
1939  area = area->next;
1940  }
1941  }
1942  }
1943  }
1944 
1945  if (bmain->versionfile <= 245) {
1946  Scene *sce;
1947  Object *ob;
1948  Image *ima;
1949  Light *la;
1950  Material *ma;
1951  ParticleSettings *part;
1952  bNodeTree *ntree;
1953  Tex *tex;
1954  ModifierData *md;
1955  ParticleSystem *psys;
1956 
1957  /* unless the file was created 2.44.3 but not 2.45, update the constraints */
1958  if (!(bmain->versionfile == 244 && bmain->subversionfile == 3) &&
1959  ((bmain->versionfile < 245) ||
1960  (bmain->versionfile == 245 && bmain->subversionfile == 0))) {
1961  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1962  ListBase *list;
1963  list = &ob->constraints;
1964 
1965  /* fix up constraints due to constraint recode changes (originally at 2.44.3) */
1966  if (list) {
1967  bConstraint *curcon;
1968  for (curcon = list->first; curcon; curcon = curcon->next) {
1969  /* old CONSTRAINT_LOCAL check -> convert to CONSTRAINT_SPACE_LOCAL */
1970  if (curcon->flag & 0x20) {
1971  curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
1972  curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
1973  }
1974 
1975  switch (curcon->type) {
1976  case CONSTRAINT_TYPE_LOCLIMIT: {
1978 
1979  /* old limit without parent option for objects */
1980  if (data->flag2) {
1981  curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
1982  }
1983  break;
1984  }
1985  }
1986  }
1987  }
1988 
1989  /* correctly initialize constinv matrix */
1990  unit_m4(ob->constinv);
1991 
1992  if (ob->type == OB_ARMATURE) {
1993  if (ob->pose) {
1994  bConstraint *curcon;
1995  bPoseChannel *pchan;
1996 
1997  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
1998  /* make sure constraints are all up to date */
1999  for (curcon = pchan->constraints.first; curcon; curcon = curcon->next) {
2000  /* old CONSTRAINT_LOCAL check -> convert to CONSTRAINT_SPACE_LOCAL */
2001  if (curcon->flag & 0x20) {
2002  curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
2003  curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
2004  }
2005 
2006  switch (curcon->type) {
2007  case CONSTRAINT_TYPE_ACTION: {
2009 
2010  /* 'data->local' used to mean that target was in local-space */
2011  if (data->local) {
2012  curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
2013  }
2014  break;
2015  }
2016  }
2017  }
2018 
2019  /* correctly initialize constinv matrix */
2020  unit_m4(pchan->constinv);
2021  }
2022  }
2023  }
2024  }
2025  }
2026 
2027  /* fix all versions before 2.45 */
2028  if (bmain->versionfile != 245) {
2029 
2030  /* repair preview from 242 - 244*/
2031  for (ima = bmain->images.first; ima; ima = ima->id.next) {
2032  ima->preview = NULL;
2033  }
2034  }
2035 
2036  /* add point caches */
2037  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2038  if (ob->soft && !ob->soft->pointcache) {
2039  ob->soft->pointcache = BKE_ptcache_add(&ob->soft->ptcaches);
2040  }
2041 
2042  for (psys = ob->particlesystem.first; psys; psys = psys->next) {
2043  if (psys->pointcache) {
2044  if (psys->pointcache->flag & PTCACHE_BAKED &&
2045  (psys->pointcache->flag & PTCACHE_DISK_CACHE) == 0) {
2046  printf("Old memory cache isn't supported for particles, so re-bake the simulation!\n");
2047  psys->pointcache->flag &= ~PTCACHE_BAKED;
2048  }
2049  }
2050  else {
2051  psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
2052  }
2053  }
2054 
2055  for (md = ob->modifiers.first; md; md = md->next) {
2056  if (md->type == eModifierType_Cloth) {
2057  ClothModifierData *clmd = (ClothModifierData *)md;
2058  if (!clmd->point_cache) {
2059  clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches);
2060  clmd->point_cache->step = 1;
2061  }
2062  }
2063  }
2064  }
2065 
2066  if (bmain->versionfile != 245 || bmain->subversionfile < 1) {
2067  for (la = bmain->lights.first; la; la = la->id.next) {
2069 
2070  if (la->curfalloff == NULL) {
2071  la->curfalloff = BKE_curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
2073  }
2074  }
2075  }
2076 
2077  for (ma = bmain->materials.first; ma; ma = ma->id.next) {
2078  if (ma->gloss_mir == 0.0f) {
2079  ma->gloss_mir = 1.0f;
2080  }
2081  }
2082 
2083  for (part = bmain->particles.first; part; part = part->id.next) {
2084  if (part->ren_child_nbr == 0) {
2085  part->ren_child_nbr = part->child_nbr;
2086  }
2087  }
2088 
2089  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
2090  if (sce->nodetree) {
2091  ntree_version_245(fd, lib, sce->nodetree);
2092  }
2093 
2094  if (sce->r.simplify_subsurf == 0) {
2095  sce->r.simplify_subsurf = 6;
2096  sce->r.simplify_particles = 1.0f;
2097  }
2098  }
2099 
2100  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
2101  ntree_version_245(fd, lib, ntree);
2102  }
2103 
2104  /* fix for temporary flag changes during 245 cycle */
2105  for (ima = bmain->images.first; ima; ima = ima->id.next) {
2106  if (ima->flag & IMA_OLD_PREMUL) {
2107  ima->flag &= ~IMA_OLD_PREMUL;
2109  }
2110  }
2111 
2112  for (tex = bmain->textures.first; tex; tex = tex->id.next) {
2113  if (tex->iuser.flag & IMA_OLD_PREMUL) {
2115  }
2116 
2117  ima = blo_do_versions_newlibadr(fd, lib, tex->ima);
2118  if (ima && (tex->iuser.flag & IMA_DO_PREMUL)) {
2119  ima->flag &= ~IMA_OLD_PREMUL;
2121  }
2122  }
2123  }
2124 
2125  if (!MAIN_VERSION_ATLEAST(bmain, 245, 2)) {
2126  Image *ima;
2127 
2128  /* initialize 1:1 Aspect */
2129  for (ima = bmain->images.first; ima; ima = ima->id.next) {
2130  ima->aspx = ima->aspy = 1.0f;
2131  }
2132  }
2133 
2134  if (!MAIN_VERSION_ATLEAST(bmain, 245, 4)) {
2135  bArmature *arm;
2136  ModifierData *md;
2137  Object *ob;
2138 
2139  for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
2140  arm->deformflag |= ARM_DEF_B_BONE_REST;
2141  }
2142 
2143  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2144  for (md = ob->modifiers.first; md; md = md->next) {
2145  if (md->type == eModifierType_Armature) {
2146  ((ArmatureModifierData *)md)->deformflag |= ARM_DEF_B_BONE_REST;
2147  }
2148  }
2149  }
2150  }
2151 
2152  if (!MAIN_VERSION_ATLEAST(bmain, 245, 5)) {
2153  /* foreground color needs to be something other than black */
2154  Scene *sce;
2155  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
2156  sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
2157  sce->r.fg_stamp[3] = 1.0f; /* don't use text alpha yet */
2158  sce->r.bg_stamp[3] = 0.25f; /* make sure the background has full alpha */
2159  }
2160  }
2161 
2162  if (!MAIN_VERSION_ATLEAST(bmain, 245, 6)) {
2163  Scene *sce;
2164  /* fix frs_sec_base */
2165  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
2166  if (sce->r.frs_sec_base == 0) {
2167  sce->r.frs_sec_base = 1;
2168  }
2169  }
2170  }
2171 
2172  if (!MAIN_VERSION_ATLEAST(bmain, 245, 7)) {
2173  Object *ob;
2174  bPoseChannel *pchan;
2175 
2176  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2177  if (ob->pose) {
2178  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
2180  }
2181  }
2183 
2184  if (ob->soft && ob->soft->keys) {
2185  SoftBody *sb = ob->soft;
2186  int k;
2187 
2188  for (k = 0; k < sb->totkey; k++) {
2189  if (sb->keys[k]) {
2190  MEM_freeN(sb->keys[k]);
2191  }
2192  }
2193 
2194  MEM_freeN(sb->keys);
2195 
2196  sb->keys = NULL;
2197  sb->totkey = 0;
2198  }
2199  }
2200  }
2201 
2202  if (!MAIN_VERSION_ATLEAST(bmain, 245, 8)) {
2203  Scene *sce;
2204  Object *ob;
2205  PartEff *paf = NULL;
2206 
2207  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2208  if (ob->soft && ob->soft->keys) {
2209  SoftBody *sb = ob->soft;
2210  int k;
2211 
2212  for (k = 0; k < sb->totkey; k++) {
2213  if (sb->keys[k]) {
2214  MEM_freeN(sb->keys[k]);
2215  }
2216  }
2217 
2218  MEM_freeN(sb->keys);
2219 
2220  sb->keys = NULL;
2221  sb->totkey = 0;
2222  }
2223 
2224  /* convert old particles to new system */
2225  if ((paf = BKE_object_do_version_give_parteff_245(ob))) {
2226  ParticleSystem *psys;
2227  ModifierData *md;
2229  ParticleSettings *part;
2230 
2231  /* create new particle system */
2232  psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
2233  psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
2234 
2235  part = psys->part = BKE_particlesettings_add(bmain, "ParticleSettings");
2236 
2237  /* needed for proper libdata lookup */
2238  blo_do_versions_oldnewmap_insert(fd->libmap, psys->part, psys->part, 0);
2239  part->id.lib = ob->id.lib;
2240 
2241  part->id.us--;
2242  part->id.tag |= (ob->id.tag & LIB_TAG_NEED_LINK);
2243 
2244  psys->totpart = 0;
2245  psys->flag = PSYS_CURRENT;
2246 
2247  BLI_addtail(&ob->particlesystem, psys);
2248 
2250  BLI_snprintf(md->name,
2251  sizeof(md->name),
2252  "ParticleSystem %i",
2254  psmd = (ParticleSystemModifierData *)md;
2255  psmd->psys = psys;
2256  BLI_addtail(&ob->modifiers, md);
2257 
2258  /* convert settings from old particle system */
2259  /* general settings */
2260  part->totpart = MIN2(paf->totpart, 100000);
2261  part->sta = paf->sta;
2262  part->end = paf->end;
2263  part->lifetime = paf->lifetime;
2264  part->randlife = paf->randlife;
2265  psys->seed = paf->seed;
2266  part->disp = paf->disp;
2267  part->omat = paf->mat[0];
2268  part->hair_step = paf->totkey;
2269 
2270  part->force_group = paf->group;
2271 
2272  /* old system didn't interpolate between keypoints at render time */
2273  part->draw_step = part->ren_step = 0;
2274 
2275  /* physics */
2276  part->normfac = paf->normfac * 25.0f;
2277  part->obfac = paf->obfac;
2278  part->randfac = paf->randfac * 25.0f;
2279  part->dampfac = paf->damp;
2280  copy_v3_v3(part->acc, paf->force);
2281 
2282  /* flags */
2283  if (paf->stype & PAF_VECT) {
2284  if (paf->flag & PAF_STATIC) {
2285  /* new hair lifetime is always 100.0f */
2286  float fac = paf->lifetime / 100.0f;
2287 
2288  part->draw_as = PART_DRAW_PATH;
2289  part->type = PART_HAIR;
2290  psys->recalc |= ID_RECALC_PSYS_REDO;
2291 
2292  part->normfac *= fac;
2293  part->randfac *= fac;
2294  }
2295  else {
2296  part->draw_as = PART_DRAW_LINE;
2297  part->draw |= PART_DRAW_VEL_LENGTH;
2298  part->draw_line[1] = 0.04f;
2299  }
2300  }
2301 
2302  part->rotmode = PART_ROT_VEL;
2303 
2304  part->flag |= (paf->flag & PAF_BSPLINE) ? PART_HAIR_BSPLINE : 0;
2305  part->flag |= (paf->flag & PAF_TRAND) ? PART_TRAND : 0;
2306  part->flag |= (paf->flag & PAF_EDISTR) ? PART_EDISTR : 0;
2307  part->flag |= (paf->flag & PAF_UNBORN) ? PART_UNBORN : 0;
2308  part->flag |= (paf->flag & PAF_DIED) ? PART_DIED : 0;
2309  part->from |= (paf->flag & PAF_FACE) ? PART_FROM_FACE : 0;
2310  part->draw |= (paf->flag & PAF_SHOWE) ? PART_DRAW_EMITTER : 0;
2311 
2312  psys->vgroup[PSYS_VG_DENSITY] = paf->vertgroup;
2313  psys->vgroup[PSYS_VG_VEL] = paf->vertgroup_v;
2314  psys->vgroup[PSYS_VG_LENGTH] = paf->vertgroup_v;
2315 
2316  /* dupliobjects */
2317  if (ob->transflag & OB_DUPLIVERTS) {
2318  Object *dup = bmain->objects.first;
2319 
2320  for (; dup; dup = dup->id.next) {
2321  if (ob == blo_do_versions_newlibadr(fd, lib, dup->parent)) {
2322  part->instance_object = dup;
2323  ob->transflag |= OB_DUPLIPARTS;
2324  ob->transflag &= ~OB_DUPLIVERTS;
2325 
2326  part->draw_as = PART_DRAW_OB;
2327 
2328  /* needed for proper libdata lookup */
2329  blo_do_versions_oldnewmap_insert(fd->libmap, dup, dup, 0);
2330  }
2331  }
2332  }
2333 
2334  {
2337  if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE) {
2338  part->type = PART_FLUID;
2339  }
2340  }
2341 
2342  do_version_free_effects_245(&ob->effect);
2343 
2344  printf("Old particle system converted to new system.\n");
2345  }
2346  }
2347 
2348  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
2350  int a;
2351 
2352  if (pset->brush[0].size == 0) {
2354  pset->emitterdist = 0.25f;
2355  pset->totrekey = 5;
2356  pset->totaddkey = 5;
2357 
2358  for (a = 0; a < ARRAY_SIZE(pset->brush); a++) {
2359  pset->brush[a].strength = 50;
2360  pset->brush[a].size = 50;
2361  pset->brush[a].step = 10;
2362  }
2363 
2364  pset->brush[PE_BRUSH_CUT].strength = 100;
2365  }
2366  }
2367  }
2368 
2369  if (!MAIN_VERSION_ATLEAST(bmain, 245, 10)) {
2370  Object *ob;
2371 
2372  /* dupliface scale */
2373  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2374  ob->instance_faces_scale = 1.0f;
2375  }
2376  }
2377 
2378  if (!MAIN_VERSION_ATLEAST(bmain, 245, 11)) {
2379  Object *ob;
2380  bActionStrip *strip;
2381 
2382  /* NLA-strips - scale. */
2383  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2384  for (strip = ob->nlastrips.first; strip; strip = strip->next) {
2385  float length, actlength, repeat;
2386 
2387  if (strip->flag & ACTSTRIP_USESTRIDE) {
2388  repeat = 1.0f;
2389  }
2390  else {
2391  repeat = strip->repeat;
2392  }
2393 
2394  length = strip->end - strip->start;
2395  if (length == 0.0f) {
2396  length = 1.0f;
2397  }
2398  actlength = strip->actend - strip->actstart;
2399 
2400  strip->scale = length / (repeat * actlength);
2401  if (strip->scale == 0.0f) {
2402  strip->scale = 1.0f;
2403  }
2404  }
2405  if (ob->soft) {
2406  ob->soft->inpush = ob->soft->inspring;
2407  ob->soft->shearstiff = 1.0f;
2408  }
2409  }
2410  }
2411 
2412  if (!MAIN_VERSION_ATLEAST(bmain, 245, 14)) {
2413  Scene *sce;
2414  Sequence *seq;
2415 
2416  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
2417  SEQ_ALL_BEGIN (sce->ed, seq) {
2418  if (seq->blend_mode == 0) {
2419  seq->blend_opacity = 100.0f;
2420  }
2421  }
2422  SEQ_ALL_END;
2423  }
2424  }
2425 
2426  /* fix broken group lengths in id properties */
2427  if (!MAIN_VERSION_ATLEAST(bmain, 245, 15)) {
2453  }
2454 
2455  /* convert fluids to modifier */
2456  if (!MAIN_VERSION_ATLEAST(bmain, 246, 1)) {
2457  Object *ob;
2458 
2459  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2460  if (ob->fluidsimSettings) {
2463  BLI_addhead(&ob->modifiers, (ModifierData *)fluidmd);
2464 
2465  MEM_freeN(fluidmd->fss);
2466  fluidmd->fss = MEM_dupallocN(ob->fluidsimSettings);
2467  fluidmd->fss->ipo = blo_do_versions_newlibadr(fd, ob->id.lib, ob->fluidsimSettings->ipo);
2468  MEM_freeN(ob->fluidsimSettings);
2469 
2470  fluidmd->fss->lastgoodframe = INT_MAX;
2471  fluidmd->fss->flag = 0;
2472  fluidmd->fss->meshVelocities = NULL;
2473  }
2474  }
2475  }
2476 
2477  if (!MAIN_VERSION_ATLEAST(bmain, 246, 1)) {
2478  Object *ob;
2479  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2480  if (ob->pd && (ob->pd->forcefield == PFIELD_WIND)) {
2481  ob->pd->f_noise = 0.0f;
2482  }
2483  }
2484  }
2485 
2486  /* set the curve radius interpolation to 2.47 default - easy */
2487  if (!MAIN_VERSION_ATLEAST(bmain, 247, 6)) {
2488  Curve *cu;
2489  Nurb *nu;
2490 
2491  for (cu = bmain->curves.first; cu; cu = cu->id.next) {
2492  for (nu = cu->nurb.first; nu; nu = nu->next) {
2493  nu->radius_interp = 3;
2494 
2495  /* resolu and resolv are now used differently for surfaces
2496  * rather than using the resolution to define the entire number of divisions,
2497  * use it for the number of divisions per segment
2498  */
2499  if (nu->pntsv > 1) {
2500  nu->resolu = MAX2(1, (int)(((float)nu->resolu / (float)nu->pntsu) + 0.5f));
2501  nu->resolv = MAX2(1, (int)(((float)nu->resolv / (float)nu->pntsv) + 0.5f));
2502  }
2503  }
2504  }
2505  }
2506 
2507  if (!MAIN_VERSION_ATLEAST(bmain, 248, 2)) {
2508  Scene *sce;
2509 
2510  /* Note, these will need to be added for painting */
2511  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
2512  sce->toolsettings->imapaint.seam_bleed = 2;
2513  sce->toolsettings->imapaint.normal_angle = 80;
2514  }
2515  }
2516 
2517  if (!MAIN_VERSION_ATLEAST(bmain, 248, 3)) {
2518  bScreen *screen;
2519 
2520  /* adjust default settings for Animation Editors */
2521  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
2522  ScrArea *area;
2523 
2524  for (area = screen->areabase.first; area; area = area->next) {
2525  SpaceLink *sl;
2526 
2527  for (sl = area->spacedata.first; sl; sl = sl->next) {
2528  switch (sl->spacetype) {
2529  case SPACE_ACTION: {
2530  SpaceAction *sact = (SpaceAction *)sl;
2531 
2532  sact->mode = SACTCONT_DOPESHEET;
2533  sact->autosnap = SACTSNAP_FRAME;
2534  break;
2535  }
2536  case SPACE_GRAPH: {
2537  SpaceGraph *sipo = (SpaceGraph *)sl;
2538  sipo->autosnap = SACTSNAP_FRAME;
2539  break;
2540  }
2541  case SPACE_NLA: {
2542  SpaceNla *snla = (SpaceNla *)sl;
2543  snla->autosnap = SACTSNAP_FRAME;
2544  break;
2545  }
2546  }
2547  }
2548  }
2549  }
2550  }
2551 
2552  /* correct introduce of seed for wind force */
2553  if (bmain->versionfile < 249 && bmain->subversionfile < 1) {
2554  Object *ob;
2555  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2556  if (ob->pd) {
2557  ob->pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128;
2558  }
2559  }
2560  }
2561 
2562  if (bmain->versionfile < 249 && bmain->subversionfile < 2) {
2563  Scene *sce = bmain->scenes.first;
2564  Editing *ed;
2565 
2566  while (sce) {
2567  ed = sce->ed;
2568  if (ed) {
2570  if (seq->strip && seq->strip->proxy) {
2571  seq->strip->proxy->quality = 90;
2572  }
2573  }
2574  }
2575 
2576  sce = sce->id.next;
2577  }
2578  }
2579 }
Blender kernel action and pose functionality.
void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose)
Definition: action.c:1726
void BKE_armature_where_is(struct bArmature *arm)
Definition: armature.c:2270
void BKE_curvemapping_init(struct CurveMapping *cumap)
Definition: colortools.c:1200
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:88
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, short type)
Definition: constraint.c:5672
@ CD_ASSIGN
@ CD_CALLOC
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
Definition: customdata.c:2620
support for deformation groups and hooks.
void BKE_object_defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob)
Definition: deform.c:620
struct bDeformGroup * BKE_object_defgroup_find_name(const struct Object *ob, const char *name)
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)
Definition: lattice.c:273
#define MAIN_VERSION_ATLEAST(main, ver, subver)
Definition: BKE_main.h:269
void BKE_mesh_strip_loose_faces(struct Mesh *me)
void BKE_mesh_calc_edges_legacy(struct Mesh *me, const bool use_old)
void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd)
Definition: mesh.c:766
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
struct ModifierData * BKE_modifiers_findby_type(const struct Object *ob, ModifierType type)
struct ModifierData * BKE_modifier_new(int type)
@ eModifierTypeType_OnlyDeform
Definition: BKE_modifier.h:58
bool BKE_modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md)
#define CMP_NODE_VECBLUR
Definition: BKE_node.h:1146
#define CMP_NODE_HUE_SAT
Definition: BKE_node.h:1150
#define CMP_NODE_ALPHAOVER
Definition: BKE_node.h:1141
General operations, lookup, etc. for blender objects.
struct PartEff * BKE_object_do_version_give_parteff_245(struct Object *ob)
Definition: object.c:1024
struct ParticleSettings * BKE_particlesettings_add(struct Main *bmain, const char *name)
Definition: particle.c:4086
struct PointCache * BKE_ptcache_add(struct ListBase *ptcaches)
Definition: pointcache.c:3072
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:257
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:87
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:395
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void unit_m4(float m[4][4])
Definition: rct.c:1140
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
unsigned int uint
Definition: BLI_sys_types.h:83
#define ARRAY_SIZE(arr)
#define STREQLEN(a, b, n)
#define MAX2(a, b)
#define ELEM(...)
#define MIN2(a, b)
#define STREQ(a, b)
Compatibility-like things for windows.
external readfile function prototypes.
@ ID_RECALC_PSYS_REDO
Definition: DNA_ID.h:618
@ ID_RECALC_ALL
Definition: DNA_ID.h:697
@ LIB_TAG_NEED_LINK
Definition: DNA_ID.h:533
@ IDP_GROUP
Definition: DNA_ID.h:101
@ ID_IM
Definition: DNA_ID_enums.h:65
@ SACTSNAP_FRAME
@ SACTCONT_DOPESHEET
@ ARM_DEF_VGROUP
@ CAM_SHOWPASSEPARTOUT
@ CAM_SHOW_SAFE_MARGINS
@ CAM_ORTHO
Object groups, one object can be in many groups at once.
@ CONSTRAINT_IK_ROT
@ CONSTRAINT_IK_POS
@ CONSTRAINT_IK_STRETCH
@ CONSTRAINT_TYPE_TRACKTO
@ CONSTRAINT_TYPE_LOCLIKE
@ CONSTRAINT_TYPE_ROTLIKE
@ CONSTRAINT_TYPE_PYTHON
@ CONSTRAINT_TYPE_KINEMATIC
@ CONSTRAINT_TYPE_LOCLIMIT
@ CONSTRAINT_TYPE_ACTION
@ CONSTRAINT_TYPE_FOLLOWPATH
@ CONSTRAINT_SPACE_LOCAL
@ LOCLIKE_TIP
@ CU_PATH
@ CD_MDEFORMVERT
@ CD_MVERT
#define PAF_DIED
#define PAF_STATIC
#define PAF_EDISTR
#define PAF_FACE
#define PAF_VECT
#define EFF_PARTICLE
#define PAF_BSPLINE
#define PAF_UNBORN
#define PAF_SHOWE
#define PAF_TRAND
@ IMA_OLD_PREMUL
@ IMA_TYPE_R_RESULT
@ IMA_TYPE_COMPOSITE
@ IMA_TYPE_IMAGE
@ IMA_ALPHA_STRAIGHT
@ IMA_SRC_FILE
@ IMA_SRC_MOVIE
@ IMA_SRC_VIEWER
#define LA_FALLOFF_INVLINEAR
@ eModifierType_ParticleSystem
@ eModifierType_Fluidsim
@ eModifierType_Subsurf
@ eModifierType_Mirror
@ eModifierType_Curve
@ eModifierType_Cloth
@ eModifierType_Armature
@ eModifierType_Softbody
@ eSubsurfModifierFlag_Incremental
@ eSubsurfModifierFlag_DebugIncr
@ eSubsurfModifierFlag_ControlEdges
@ MOD_MIR_AXIS_Z
@ MOD_MIR_AXIS_X
@ MOD_MIR_AXIS_Y
@ ACTSTRIP_USESTRIDE
#define NTREE_COMPOSIT
@ OB_SOLID
#define OB_FLUIDSIM_PARTICLE
#define OB_SB_POSTDEF
#define OB_SB_ENABLE
Object is a sort of wrapper for general info.
@ OB_DUPLIPARTS
@ OB_DUPLIVERTS
@ OB_DRAW_IN_FRONT
@ OB_ARROWS
@ PARSKEL
@ OB_LATTICE
@ OB_ARMATURE
@ OB_MESH
@ OB_CURVE
#define PART_DRAW_LINE
#define PART_DRAW_PATH
#define PART_FROM_FACE
#define PART_DRAW_OB
#define PART_EDISTR
#define PSYS_VG_LENGTH
@ PART_DRAW_VEL_LENGTH
#define PSYS_VG_VEL
#define PSYS_CURRENT
#define PART_HAIR_BSPLINE
#define PART_UNBORN
#define PSYS_VG_DENSITY
#define PART_TRAND
#define PART_DIED
#define PART_ROT_VEL
@ PART_FLUID
@ PART_HAIR
#define PTCACHE_DISK_CACHE
#define PTCACHE_BAKED
#define R_BAKE_CLEAR
#define AUDIO_SCRUB
#define R_FILTER_QUAD
#define R_PASSEPARTOUT
#define PE_KEEP_LENGTHS
#define PE_DEFLECT_EMITTER
#define PE_BRUSH_CUT
#define SCE_LAY_SOLID
#define PE_LOCK_FIRST
#define SCE_LAY_SKY
#define UVCALC_FILLHOLES
@ SCE_PASS_NORMAL
@ SCE_PASS_COMBINED
@ SCE_PASS_Z
@ SCE_PASS_VECTOR
@ SEQ_ALPHA_STRAIGHT
@ SEQ_TYPE_IMAGE
@ SEQ_TYPE_MOVIE
@ SPACE_TEXT
@ SPACE_ACTION
@ SPACE_PROPERTIES
@ SPACE_NLA
@ SPACE_GRAPH
@ SPACE_VIEW3D
#define TEX_CHECKER_EVEN
#define TEX_EXTEND
#define TEX_REPEAT
#define TEX_CHECKER_ODD
#define FO_BUILTIN_NAME
#define V3D_SELECT_OUTLINE
#define V3D_SHOW_Z
#define V3D_SHOW_Y
#define V3D_SHOW_X
#define V3D_SHOW_FLOOR
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel CMP_NODE_SPLITVIEWER
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume TEX_IMAGE
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB CMP_NODE_BLUR
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White CMP_NODE_VIEWER
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set CMP_NODE_IMAGE
Platform independent time functions.
#define SEQ_ALL_END
Definition: SEQ_iterator.h:48
#define SEQ_ALL_BEGIN(ed, _seq)
Definition: SEQ_iterator.h:41
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
Definition: btQuaternion.h:895
struct PreviewImage * preview
char gen_type
float aspy
char filepath[1024]
short type
short source
float aspx
char alpha_mode
OperationNode * node
bNodeTree * ntree
DRWShaderLibrary * lib
uint col
#define GS(x)
Definition: iris.c:241
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:48
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:42
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static unsigned a[3]
Definition: RandGen.cpp:92
static void area(int d1, int d2, int e1, int e2, float weights[2])
void blo_do_versions_oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, int nr)
Definition: readfile.c:380
void * blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr)
Definition: readfile.c:1840
ListBase * SEQ_active_seqbase_get(const Editing *ed)
Definition: sequencer.c:350
float radius
float arm_head[3]
float arm_tail[3]
float rad_head
float length
float arm_mat[4][4]
float rad_tail
float dist
struct Bone * next
ListBase childbase
float passepartalpha
float ortho_scale
struct ListBase ptcaches
struct PointCache * point_cache
ListBase nurb
CustomDataLayer * layers
short type
struct OldNewMap * libmap
Definition: readfile.h:133
struct FluidsimSettings * fss
struct FluidVertexVelocity * meshVelocities
ListBase group
Definition: DNA_ID.h:64
int len
Definition: DNA_ID.h:84
struct IDProperty * next
Definition: DNA_ID.h:70
IDPropertyData data
Definition: DNA_ID.h:80
char type
Definition: DNA_ID.h:71
Definition: DNA_ID.h:273
int tag
Definition: DNA_ID.h:292
struct Library * lib
Definition: DNA_ID.h:277
int recalc
Definition: DNA_ID.h:295
int us
Definition: DNA_ID.h:293
IDProperty * properties
Definition: DNA_ID.h:314
void * next
Definition: DNA_ID.h:274
char name[66]
Definition: DNA_ID.h:283
char name[64]
Definition: DNA_key_types.h:68
struct KeyBlock * next
Definition: DNA_key_types.h:41
ID id
Definition: DNA_key_types.h:79
ListBase block
KeyBlock * refkey
Definition: DNA_key_types.h:88
short falloff_type
struct CurveMapping * curfalloff
short buffers
void * first
Definition: DNA_listBase.h:47
unsigned char a
unsigned int v2
unsigned int v1
unsigned int v4
unsigned int v3
Definition: BKE_main.h:116
ListBase brushes
Definition: BKE_main.h:171
ListBase scenes
Definition: BKE_main.h:146
short subversionfile
Definition: BKE_main.h:119
ListBase textures
Definition: BKE_main.h:153
ListBase actions
Definition: BKE_main.h:169
ListBase texts
Definition: BKE_main.h:163
ListBase meshes
Definition: BKE_main.h:149
ListBase ipo
Definition: BKE_main.h:158
ListBase lights
Definition: BKE_main.h:156
ListBase fonts
Definition: BKE_main.h:162
ListBase nodetrees
Definition: BKE_main.h:170
ListBase particles
Definition: BKE_main.h:172
ListBase materials
Definition: BKE_main.h:152
ListBase lattices
Definition: BKE_main.h:155
ListBase sounds
Definition: BKE_main.h:166
ListBase shapekeys
Definition: BKE_main.h:159
ListBase libraries
Definition: BKE_main.h:147
ListBase cameras
Definition: BKE_main.h:157
ListBase armatures
Definition: BKE_main.h:168
ListBase curves
Definition: BKE_main.h:150
ListBase worlds
Definition: BKE_main.h:160
ListBase screens
Definition: BKE_main.h:161
short versionfile
Definition: BKE_main.h:119
ListBase metaballs
Definition: BKE_main.h:151
ListBase collections
Definition: BKE_main.h:167
ListBase images
Definition: BKE_main.h:154
ListBase objects
Definition: BKE_main.h:148
struct bNodeTree * nodetree
struct MEdge * medge
float smoothresh
struct MTFace * mtface
struct MVert * mvert
struct MDeformVert * dvert
int totedge
int totvert
short flag
int totface
struct CustomData vdata edata fdata
struct MCol * mcol
struct MFace * mface
struct ModifierData * next
ModifierTypeType type
Definition: BKE_modifier.h:173
struct Nurb * next
BezTriple * bezt
BPoint * bp
short resolu
short resolv
short radius_interp
short partype
ListBase particlesystem
struct Object * track
short transflag
ListBase defbase
ListBase constraints
struct bPose * pose
ListBase modifiers
float constinv[4][4]
struct Material ** mat
struct PartDeflect * pd
struct SoftBody * soft
char empty_drawtype
float empty_drawsize
short softflag
float instance_faces_scale
struct Object * parent
short trackflag
short upflag
void * data
short vertgroup
short mat[4]
Particle * keys
short staticstep
short speedtex
short vertgroup_v
float force[3]
float lifetime
struct Collection * group
float randlife
ParticleBrushData brush[7]
struct Object * instance_object
struct ParticleSystem * psys
struct ListBase ptcaches
ParticleSettings * part
struct ParticleSystem * next
struct PointCache * pointcache
float frs_sec_base
short simplify_subsurf
float simplify_particles
float fg_stamp[4]
float bg_stamp[4]
struct bNodeTree * nodetree
struct ToolSettings * toolsettings
struct Editing * ed
struct RenderData r
struct AudioData audio
SBVertex ** keys
short autosnap
float dist_amount
short xrepeat
float ns_outscale
short imaflag
float mg_lacunarity
float mg_offset
float nabla
float vn_mexp
float mg_gain
float gfac
float mg_octaves
struct ImageUser iuser
short flag
float mg_H
short type
float vn_w1
float bfac
struct Image * ima
float rfac
short extend
short yrepeat
float filtersize
struct ImagePaintSettings imapaint
struct ParticleEditSettings particle
char filepath[1024]
short gridsubdiv
short gridlines
float aodist
float aoenergy
struct bActionStrip * next
Definition: DNA_nla_types.h:56
ListBase bonebase
unsigned int layer
struct bConstraint * next
struct bDeformGroup * next
ListBase nodes
ListBase constraints
struct bPoseChannel * next
float constinv[4][4]
ListBase chanbase
ListBase areabase
struct PackedFile * packedfile
struct PackedFile * newpackedfile
float min_gain
short flags
float max_gain
float distance
float attenuation
float volume
double PIL_check_seconds_timer(void)
Definition: time.c:80
__forceinline const avxi srl(const avxi &a, const int32_t b)
Definition: util_avxi.h:348
ccl_device_inline float3 ceil(const float3 &a)
static void bone_version_239(ListBase *lb)
static void do_version_free_effects_245(ListBase *lb)
static void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
void blo_do_version_old_trackto_to_constraints(Object *ob)
static void ntree_version_242(bNodeTree *ntree)
static void ntree_version_241(bNodeTree *ntree)
static void do_version_constraints_245(ListBase *lb)
static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
static void do_version_bone_head_tail_237(Bone *bone)
static void customdata_version_243(Mesh *me)
static void customdata_version_242(Mesh *me)
static void bone_version_238(ListBase *lb)
static void do_version_free_effect_245(Effect *eff)
static void do_version_ntree_242_2(bNodeTree *ntree)
static void vcol_to_fcol(Mesh *me)
static void idproperties_fix_group_lengths(ListBase idlist)
void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)