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