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