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