Blender V5.3
versioning_260.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <algorithm>
10
11/* allow readfile to use deprecated functionality */
12#define DNA_DEPRECATED_ALLOW
13
14/* Define macros in `DNA_genfile.h`. */
15#define DNA_GENFILE_VERSIONING_MACROS
16
17#include "BKE_idprop.hh"
18#include "BLI_listbase.hh"
19#include "BLI_utildefines.hh"
20
21#include "DNA_anim_types.h"
22#include "DNA_brush_types.h"
23#include "DNA_camera_types.h"
24#include "DNA_cloth_types.h"
27#include "DNA_fluid_types.h"
28#include "DNA_genfile.h"
29#include "DNA_light_types.h"
30#include "DNA_linestyle_types.h"
31#include "DNA_material_types.h"
32#include "DNA_mesh_types.h"
33#include "DNA_meshdata_types.h"
34#include "DNA_node_types.h"
36#include "DNA_object_types.h"
37#include "DNA_screen_types.h"
38#include "DNA_sequence_types.h"
39#include "DNA_space_types.h"
40#include "DNA_text_types.h"
41#include "DNA_view3d_types.h"
42#include "DNA_world_types.h"
43
44#undef DNA_GENFILE_VERSIONING_MACROS
45
46#include "MEM_guardedalloc.h"
47
48#include "BLI_math_matrix_c.hh"
50#include "BLI_math_vector_c.hh"
51#include "BLI_path_utils.hh"
52#include "BLI_string.hh"
53#include "BLI_string_utf8.hh"
54#include "BLI_string_utils.hh"
55
57#include "BKE_customdata.hh"
58#include "BKE_image.hh"
59#include "BKE_image_format.hh"
60#include "BKE_main.hh" /* for Main */
62#include "BKE_modifier.hh"
64#include "BKE_node_runtime.hh"
66#include "BKE_particle.h"
67#include "BKE_scene.hh"
68#include "BKE_screen.hh"
69#include "BKE_text.h" /* for txt_extended_ascii_as_utf8 */
70#include "BKE_texture.h"
71#include "BKE_tracking.hh"
72
73#include "SEQ_iterator.hh"
74#include "SEQ_modifier.hh"
75#include "SEQ_utils.hh"
76
77#include "IMB_imbuf_enums.h"
78
79#include "MOV_enums.hh"
80
81#include "NOD_common.hh"
82#include "NOD_composite.hh"
83
84#include "BLO_readfile.hh"
85
86#include "readfile.hh"
87
88#include "versioning_common.hh"
89
90namespace blender {
91
93#define CLANG_FORMAT_NOP_WORKAROUND ((void)0)
94
95/* Make preferences read-only, use `versioning_userdef.cc`. */
96#define U (*((const UserDef *)&U))
97
99{
100 for (bNode &node : ntree->nodes) {
101 if (ELEM(node.type_legacy, CMP_NODE_IMAGE, CMP_NODE_R_LAYERS)) {
102 /* default Image output value should have 0 alpha */
103 bNodeSocket *sock = node.outputs.first();
104 (static_cast<bNodeSocketValueRGBA *>(sock->default_value))->value[3] = 0.0f;
105 }
106 }
107}
108
110{
111 for (bNode &node : ntree->nodes) {
112 if (node.type_legacy == CMP_NODE_ROTATE) {
113 /* Convert degrees to radians. */
114 bNodeSocket *sock = node.inputs.first()->next;
115 (static_cast<bNodeSocketValueFloat *>(sock->default_value))->value = DEG2RADF(
116 ((bNodeSocketValueFloat *)sock->default_value)->value);
117 }
118 else if (node.type_legacy == CMP_NODE_DBLUR) {
120 /* Convert degrees to radians. */
121 NodeDBlurData *ndbd = static_cast<NodeDBlurData *>(node.storage);
122 ndbd->angle = DEG2RADF(ndbd->angle);
123 ndbd->spin = DEG2RADF(ndbd->spin);
124 }
125 }
126 else if (node.type_legacy == CMP_NODE_DEFOCUS) {
128 /* Convert degrees to radians. */
129 NodeDefocus *nqd = static_cast<NodeDefocus *>(node.storage);
130 /* XXX DNA char to float conversion seems to map the char value
131 * into the [0.0f, 1.0f] range. */
132 nqd->rotation = DEG2RADF(nqd->rotation * 255.0f);
133 }
134 }
135 else if (node.type_legacy == CMP_NODE_CHROMA_MATTE) {
137 /* Convert degrees to radians. */
138 NodeChroma *ndc = static_cast<NodeChroma *>(node.storage);
139 ndc->t1 = DEG2RADF(ndc->t1);
140 ndc->t2 = DEG2RADF(ndc->t2);
141 }
142 }
143 else if (node.type_legacy == CMP_NODE_GLARE) {
145 /* Convert degrees to radians. */
146 NodeGlare *ndg = static_cast<NodeGlare *>(node.storage);
147 /* XXX DNA char to float conversion seems to map the char value
148 * into the [0.0f, 1.0f] range. */
149 ndg->angle_ofs = DEG2RADF(ndg->angle_ofs * 255.0f);
150 }
151 }
152 /* XXX TexMapping struct is used by other nodes too (at least node_composite_mapValue),
153 * but not the rot part...
154 */
155 else if (node.type_legacy == SH_NODE_MAPPING) {
157 /* Convert degrees to radians. */
158 TexMapping *tmap = static_cast<TexMapping *>(node.storage);
159 tmap->rot[0] = DEG2RADF(tmap->rot[0]);
160 tmap->rot[1] = DEG2RADF(tmap->rot[1]);
161 tmap->rot[2] = DEG2RADF(tmap->rot[2]);
162 }
163 }
164 }
165}
166
168{
169 /* RenderData.subimtype flag options for imtype */
170 enum {
171 R_OPENEXR_HALF = (1 << 0),
172 R_OPENEXR_ZBUF = (1 << 1),
173 R_PREVIEW_JPG = (1 << 2),
174 R_CINEON_LOG = (1 << 3),
175 R_TIFF_16BIT = (1 << 4),
176
177 R_JPEG2K_12BIT = (1 << 5),
178 /* Jpeg2000 */
179 R_JPEG2K_16BIT = (1 << 6),
180 R_JPEG2K_YCC = (1 << 7),
181 /* when disabled use RGB */
182 R_JPEG2K_CINE_PRESET = (1 << 8),
183 R_JPEG2K_CINE_48FPS = (1 << 9),
184 };
185
186 /* NOTE: rd->subimtype is moved into individual settings now and no longer
187 * exists */
188 RenderData *rd = &sce->r;
189 ImageFormatData *imf = &sce->r.im_format;
190
191 /* we know no data loss happens here, the old values were in char range */
192 imf->imtype = char(rd->imtype);
194 imf->compress = char(rd->quality);
195 imf->quality = char(rd->quality);
196
197 /* default, was stored in multiple places, may override later */
199
200 /* openexr */
201 imf->exr_codec = rd->quality & 7; /* 0-4 were valid values back then */
202
203 switch (imf->imtype) {
205 imf->depth = (rd->subimtype & R_OPENEXR_HALF) ? R_IMF_CHAN_DEPTH_16 : R_IMF_CHAN_DEPTH_32;
206 if (rd->subimtype & R_PREVIEW_JPG) {
208 }
209 break;
211 if (rd->subimtype & R_TIFF_16BIT) {
213 }
214 break;
215 case R_IMF_IMTYPE_JP2:
216 if (rd->subimtype & R_JPEG2K_16BIT) {
218 }
219 else if (rd->subimtype & R_JPEG2K_12BIT) {
221 }
222
223 if (rd->subimtype & R_JPEG2K_YCC) {
225 }
226 if (rd->subimtype & R_JPEG2K_CINE_PRESET) {
228 }
229 if (rd->subimtype & R_JPEG2K_CINE_48FPS) {
231 }
232 break;
234 case R_IMF_IMTYPE_DPX:
235 if (rd->subimtype & R_CINEON_LOG) {
237 }
238 break;
239 }
240}
241
242/* socket use flags were only temporary before */
244{
245 for (bNode &node : ntree->nodes) {
246 for (bNodeSocket &sock : node.inputs) {
247 sock.flag &= ~SOCK_IS_LINKED;
248 }
249 for (bNodeSocket &sock : node.outputs) {
250 sock.flag &= ~SOCK_IS_LINKED;
251 }
252 }
253 for (bNodeSocket &sock : ntree->inputs_legacy) {
254 sock.flag &= ~SOCK_IS_LINKED;
255 }
256 for (bNodeSocket &sock : ntree->outputs_legacy) {
257 sock.flag &= ~SOCK_IS_LINKED;
258 }
259
260 for (bNodeLink &link : ntree->links) {
262 link.tosock->flag |= SOCK_IS_LINKED;
263 }
264}
265
266/* find unique path */
267static bool unique_path_unique_check(ListBaseT<bNodeSocket> *lb,
268 bNodeSocket *sock,
269 const StringRef name)
270{
271 for (bNodeSocket &sock_iter : *lb) {
272 if (&sock_iter != sock) {
273 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(
274 sock_iter.storage);
275 if (sockdata->path == name) {
276 return true;
277 }
278 }
279 }
280 return false;
281}
282
283static void ntreeCompositOutputFileUniquePath(ListBaseT<bNodeSocket> *list,
284 bNodeSocket *sock,
285 const char defname[],
286 char delim)
287{
288 /* See if we are given an empty string */
289 if (ELEM(nullptr, sock, defname)) {
290 return;
291 }
292 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(sock->storage);
294 [&](const StringRef check_name) { return unique_path_unique_check(list, sock, check_name); },
295 defname,
296 delim,
297 sockdata->path,
298 sizeof(sockdata->path));
299}
300
301/* find unique EXR layer */
302static bool unique_layer_unique_check(ListBaseT<bNodeSocket> *lb,
303 bNodeSocket *sock,
304 const StringRef name)
305{
306 for (bNodeSocket &sock_iter : *lb) {
307 if (&sock_iter != sock) {
308 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(
309 sock_iter.storage);
310 if (sockdata->layer == name) {
311 return true;
312 }
313 }
314 }
315 return false;
316}
317
318static void ntreeCompositOutputFileUniqueLayer(ListBaseT<bNodeSocket> *list,
319 bNodeSocket *sock,
320 const char defname[],
321 char delim)
322{
323 /* See if we are given an empty string */
324 if (ELEM(nullptr, sock, defname)) {
325 return;
326 }
327 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(sock->storage);
329 [&](const StringRef check_name) {
330 return unique_layer_unique_check(list, sock, check_name);
331 },
332 defname,
333 delim,
334 sockdata->layer,
335 sizeof(sockdata->layer));
336}
337
339 bNode *node,
340 const char *name,
341 const ImageFormatData *im_format)
342{
344 return nullptr;
345 }
346 NodeCompositorFileOutput *nimf = static_cast<NodeCompositorFileOutput *>(node->storage);
348 *ntree, *node, SOCK_IN, SOCK_RGBA, PROP_NONE, "", name);
349
350 /* create format data for the input socket */
351 NodeImageMultiFileSocket *sockdata = MEM_new<NodeImageMultiFileSocket>(__func__);
352 sock->storage = sockdata;
353
354 STRNCPY_UTF8(sockdata->path, name);
355 ntreeCompositOutputFileUniquePath(&node->inputs, sock, name, '_');
356 STRNCPY_UTF8(sockdata->layer, name);
357 ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, name, '_');
358
359 if (im_format) {
360 BKE_image_format_copy(&sockdata->format, im_format);
362 if (BKE_imtype_is_movie(sockdata->format.imtype)) {
364 }
365 }
366 else {
367 BKE_image_format_init(&sockdata->format);
368 }
370
371 /* use node data format by default */
372 sockdata->use_node_format = true;
373 sockdata->save_as_render = true;
374
375 nimf->active_item_index = BLI_findindex(&node->inputs, sock);
376
377 return sock;
378}
379
381{
382 for (bNode &node : ntree->nodes) {
383 if (node.type_legacy == CMP_NODE_OUTPUT_FILE) {
384 /* previous CMP_NODE_OUTPUT_FILE nodes get converted to multi-file outputs */
385 NodeImageFile *old_data = static_cast<NodeImageFile *>(node.storage);
386 NodeCompositorFileOutput *nimf = MEM_new<NodeCompositorFileOutput>("node image multi file");
387 bNodeSocket *old_image = static_cast<bNodeSocket *>(BLI_findlink(&node.inputs, 0));
388 bNodeSocket *old_z = static_cast<bNodeSocket *>(BLI_findlink(&node.inputs, 1));
389
391
392 /* ugly, need to remove the old inputs list to avoid bad pointer
393 * checks when adding new sockets.
394 * sock->storage is expected to contain path info in ntreeCompositOutputFileAddSocket.
395 */
396 node.inputs.clear_no_delete();
397
398 node.storage = nimf;
399
400 /* looks like storage data can be messed up somehow, stupid check here */
401 if (old_data) {
402 char basepath[FILE_MAXDIR];
403
404 /* split off filename from the old path, to be used as socket sub-path */
406 old_data->name, basepath, sizeof(basepath), filename, sizeof(filename));
407
408 STRNCPY(nimf->directory, basepath);
409 nimf->format = old_data->im_format;
410 }
411 else {
412 STRNCPY(filename, old_image->name);
413 }
414
415 /* If Z buffer is saved, change the image type to multi-layer EXR.
416 * XXX: this is slightly messy, Z buffer was ignored before for anything but EXR and IRIS ...
417 * I'm just assuming here that IRIZ means IRIS with z buffer. */
418 if (old_data && ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
419 char sockpath[FILE_MAX];
420
422
423 SNPRINTF_UTF8(sockpath, "%s_Image", filename);
425 ntree, &node, sockpath, &nimf->format);
426 if (!sock) {
427 continue;
428 }
429 /* XXX later do_versions copies path from socket name, need to set this explicitly */
430 STRNCPY_UTF8(sock->name, sockpath);
431 if (old_image->link) {
432 old_image->link->tosock = sock;
433 sock->link = old_image->link;
434 }
435
436 SNPRINTF_UTF8(sockpath, "%s_Z", filename);
437 sock = ntreeCompositOutputFileAddSocket(ntree, &node, sockpath, &nimf->format);
438 if (!sock) {
439 continue;
440 }
441 /* XXX later do_versions copies path from socket name, need to set this explicitly */
442 STRNCPY_UTF8(sock->name, sockpath);
443 if (old_z->link) {
444 old_z->link->tosock = sock;
445 sock->link = old_z->link;
446 }
447 }
448 else {
450 ntree, &node, filename, &nimf->format);
451 if (!sock) {
452 continue;
453 }
454 /* XXX later do_versions copies path from socket name, need to set this explicitly */
455 STRNCPY_UTF8(sock->name, filename);
456 if (old_image->link) {
457 old_image->link->tosock = sock;
458 sock->link = old_image->link;
459 }
460 }
461
462 bke::node_remove_socket(*ntree, node, *old_image);
463 bke::node_remove_socket(*ntree, node, *old_z);
464 if (old_data) {
465 MEM_delete(old_data);
466 }
467 }
468 else if (node.type_legacy == CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
470 NodeCompositorFileOutput *nimf = static_cast<NodeCompositorFileOutput *>(node.storage);
471
472 /* #CMP_NODE_OUTPUT_MULTI_FILE has been re-declared as #CMP_NODE_OUTPUT_FILE. */
473 node.type_legacy = CMP_NODE_OUTPUT_FILE;
474
475 /* initialize the node-wide image format from render data, if available */
476 if (sce) {
477 nimf->format = sce->r.im_format;
478 }
479
480 /* transfer render format toggle to node format toggle */
481 for (bNodeSocket &sock : node.inputs) {
482 NodeImageMultiFileSocket *simf = static_cast<NodeImageMultiFileSocket *>(sock.storage);
484 }
485
486 /* we do have preview now */
487 node.flag |= NODE_PREVIEW;
488 }
489 }
490 }
491}
492
493/* blue and red are swapped pre 2.62.1, be sane (red == red) now! */
495{
496 for (int a = 0; a < mesh->corner_data.totlayer; a++) {
497 CustomDataLayer *layer = &mesh->corner_data.layers[a];
498
499 if (layer->type == CD_PROP_BYTE_COLOR) {
500 MLoopCol *mloopcol = static_cast<MLoopCol *>(layer->data);
501 for (int i = 0; i < mesh->corners_num; i++, mloopcol++) {
502 std::swap(mloopcol->r, mloopcol->b);
503 }
504 }
505 }
506}
507
509{
510 for (bNode &node : ntree->nodes) {
511 if (node.type_legacy == CMP_NODE_OUTPUT_FILE) {
512 for (bNodeSocket &sock : node.inputs) {
513 NodeImageMultiFileSocket *input = static_cast<NodeImageMultiFileSocket *>(sock.storage);
514 /* input file path is stored in dedicated struct now instead socket name */
515 STRNCPY_UTF8(input->path, sock.name);
516 }
517 }
518 }
519}
520
522{
523 for (bNode &node : ntree->nodes) {
524 if (node.type_legacy == CMP_NODE_OUTPUT_FILE) {
525 for (bNodeSocket &sock : node.inputs) {
526 NodeImageMultiFileSocket *input = static_cast<NodeImageMultiFileSocket *>(sock.storage);
527
528 /* Multi-layer names are stored as separate strings now,
529 * used the path string before, so copy it over. */
530 STRNCPY_UTF8(input->layer, input->path);
531
532 /* paths/layer names also have to be unique now, initial check */
533 ntreeCompositOutputFileUniquePath(&node.inputs, &sock, input->path, '_');
534 ntreeCompositOutputFileUniqueLayer(&node.inputs, &sock, input->layer, '_');
535 }
536 }
537 }
538}
539
541{
542 for (bNode &node : ntree->nodes) {
543 if (node.type_legacy == CMP_NODE_IMAGE) {
544 for (bNodeSocket &sock : node.outputs) {
545 NodeImageLayer *output = MEM_new<NodeImageLayer>("node image layer");
546
547 /* Take pass index both from current storage pointer (actually an int). */
548 output->pass_index = POINTER_AS_INT(sock.storage);
549
550 /* replace socket data pointer */
551 sock.storage = output;
552 }
553 }
554 }
555}
556
558{
559 for (bNode &node : ntree->nodes) {
560 if (node.type_legacy == NODE_FRAME) {
561 /* initialize frame node storage data */
562 if (node.storage == nullptr) {
563 NodeFrame *data = MEM_new<NodeFrame>("frame node storage");
564 node.storage = data;
565
566 /* copy current flags */
567 data->flag = node.custom1;
568
569 data->label_size = 20;
570 }
571 }
572
573 /* initialize custom node color */
574 node.color[0] = node.color[1] = node.color[2] = 0.608f; /* default theme color */
575 }
576}
577
579{
580 for (int i = 0; i < track->markersnr; i++) {
581 MovieTrackingMarker *marker = &track->markers[i];
582
583 if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
584 is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3]))
585 {
586 marker->pattern_corners[0][0] = track->pat_min_legacy[0];
587 marker->pattern_corners[0][1] = track->pat_min_legacy[1];
588
589 marker->pattern_corners[1][0] = track->pat_max_legacy[0];
590 marker->pattern_corners[1][1] = track->pat_min_legacy[1];
591
592 marker->pattern_corners[2][0] = track->pat_max_legacy[0];
593 marker->pattern_corners[2][1] = track->pat_max_legacy[1];
594
595 marker->pattern_corners[3][0] = track->pat_min_legacy[0];
596 marker->pattern_corners[3][1] = track->pat_max_legacy[1];
597 }
598
599 if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) {
600 copy_v2_v2(marker->search_min, track->search_min_legacy);
601 copy_v2_v2(marker->search_max, track->search_max_legacy);
602 }
603 }
604}
605
606static const char *node_get_static_idname(int type, int treetype)
607{
608 /* XXX hack, group types share a single static integer identifier,
609 * but are registered as separate types */
610 if (type == NODE_GROUP) {
611 switch (treetype) {
612 case NTREE_COMPOSIT:
613 return "CompositorNodeGroup";
614 case NTREE_SHADER:
615 return "ShaderNodeGroup";
616 case NTREE_TEXTURE:
617 return "TextureNodeGroup";
618 }
619 }
620 else {
621 switch (type) {
622 case NODE_FRAME:
623 return "NodeFrame";
624 case NODE_GROUP:
625 return "NodeGroup";
626 case NODE_GROUP_INPUT:
627 return "NodeGroupInput";
629 return "NodeGroupOutput";
630 case NODE_REROUTE:
631 return "NodeReroute";
632 case /*SH_NODE_OUTPUT*/ 1:
633 return "ShaderNodeOutput";
634 case /*SH_NODE_MATERIAL*/ 100:
635 return "ShaderNodeMaterial";
636 case SH_NODE_RGB:
637 return "ShaderNodeRGB";
638 case SH_NODE_VALUE:
639 return "ShaderNodeValue";
641 return "ShaderNodeMixRGB";
642 case SH_NODE_VALTORGB:
643 return "ShaderNodeValToRGB";
644 case SH_NODE_RGBTOBW:
645 return "ShaderNodeRGBToBW";
646 case /*SH_NODE_TEXTURE*/ 106:
647 return "ShaderNodeTexture";
648 case SH_NODE_NORMAL:
649 return "ShaderNodeNormal";
650 case SH_NODE_GAMMA:
651 return "ShaderNodeGamma";
653 return "ShaderNodeBrightContrast";
654 case /*SH_NODE_GEOMETRY*/ 108:
655 return "ShaderNodeGeometry";
656 case SH_NODE_MAPPING:
657 return "ShaderNodeMapping";
659 return "ShaderNodeVectorCurve";
661 return "ShaderNodeRGBCurve";
662 case SH_NODE_CAMERA:
663 return "ShaderNodeCameraData";
664 case SH_NODE_MATH:
665 return "ShaderNodeMath";
667 return "ShaderNodeVectorMath";
668 case SH_NODE_SQUEEZE:
669 return "ShaderNodeSqueeze";
670 case /*SH_NODE_MATERIAL_EXT*/ 118:
671 return "ShaderNodeExtendedMaterial";
672 case SH_NODE_INVERT:
673 return "ShaderNodeInvert";
675 return "ShaderNodeSeparateRGB";
677 return "ShaderNodeCombineRGB";
678 case SH_NODE_HUE_SAT:
679 return "ShaderNodeHueSaturation";
681 return "ShaderNodeOutputMaterial";
683 return "ShaderNodeOutputLamp";
685 return "ShaderNodeOutputWorld";
686 case SH_NODE_FRESNEL:
687 return "ShaderNodeFresnel";
689 return "ShaderNodeLayerWeight";
691 return "ShaderNodeMixShader";
693 return "ShaderNodeAddShader";
695 return "ShaderNodeAttribute";
697 return "ShaderNodeAmbientOcclusion";
699 return "ShaderNodeBackground";
700 case SH_NODE_HOLDOUT:
701 return "ShaderNodeHoldout";
702 case /*SH_NODE_BSDF_ANISOTROPIC*/ 131:
703 return "ShaderNodeBsdfAnisotropic";
705 return "ShaderNodeBsdfDiffuse";
706 case /*SH_NODE_BSDF_GLOSSY*/ 133:
707 return "ShaderNodeBsdfGlossy";
709 return "ShaderNodeBsdfGlass";
711 return "ShaderNodeBsdfRefraction";
713 return "ShaderNodeBsdfTranslucent";
715 return "ShaderNodeBsdfTransparent";
717 return "ShaderNodeBsdfRayPortal";
718 case /*SH_NODE_BSDF_VELVET*/ 139:
719 return "ShaderNodeBsdfVelvet";
720 case /*SH_NODE_VOLUME_TRANSPARENT*/ 161:
721 return "ShaderNodeVolumeTransparent";
722 case /*SH_NODE_VOLUME_ISOTROPIC*/ 162:
723 return "ShaderNodeVolumeIsotropic";
724 case SH_NODE_EMISSION:
725 return "ShaderNodeEmission";
727 return "ShaderNodeNewGeometry";
729 return "ShaderNodeLightPath";
731 return "ShaderNodeLightFalloff";
733 return "ShaderNodeObjectInfo";
735 return "ShaderNodeParticleInfo";
737 return "ShaderNodeHairInfo";
738 case SH_NODE_BUMP:
739 return "ShaderNodeBump";
741 return "ShaderNodeNormalMap";
742 case SH_NODE_TANGENT:
743 return "ShaderNodeTangent";
744 case SH_NODE_SCRIPT:
745 return "ShaderNodeScript";
747 return "ShaderNodeTexImage";
749 return "ShaderNodeTexEnvironment";
750 case SH_NODE_TEX_SKY:
751 return "ShaderNodeTexSky";
753 return "ShaderNodeTexGradient";
755 return "ShaderNodeTexNoise";
757 return "ShaderNodeTexMagic";
758 case SH_NODE_TEX_WAVE:
759 return "ShaderNodeTexWave";
761 return "ShaderNodeTexMusgrave";
763 return "ShaderNodeTexVoronoi";
765 return "ShaderNodeTexChecker";
767 return "ShaderNodeTexBrick";
769 return "ShaderNodeTexCoord";
770 case CMP_NODE_VIEWER:
771 return "CompositorNodeViewer";
772 case CMP_NODE_RGB:
773 return "CompositorNodeRGB";
775 return "CompositorNodeValue";
777 return "CompositorNodeMixRGB";
779 return "CompositorNodeValToRGB";
780 case CMP_NODE_RGBTOBW:
781 return "CompositorNodeRGBToBW";
782 case CMP_NODE_NORMAL:
783 return "CompositorNodeNormal";
785 return "CompositorNodeCurveVec";
787 return "CompositorNodeCurveRGB";
789 return "CompositorNodeAlphaOver";
790 case CMP_NODE_BLUR:
791 return "CompositorNodeBlur";
792 case CMP_NODE_FILTER:
793 return "CompositorNodeFilter";
795 return "CompositorNodeMapValue";
797 return "CompositorNodeMapRange";
798 case CMP_NODE_TIME:
799 return "CompositorNodeTime";
800 case CMP_NODE_VECBLUR:
801 return "CompositorNodeVecBlur";
803 return "CompositorNodeSepRGBA";
805 return "CompositorNodeSepHSVA";
807 return "CompositorNodeSetAlpha";
808 case CMP_NODE_HUE_SAT:
809 return "CompositorNodeHueSat";
810 case CMP_NODE_IMAGE:
811 return "CompositorNodeImage";
813 return "CompositorNodeRLayers";
815 return "CompositorNodeComposite";
817 return "CompositorNodeOutputFile";
819 return "CompositorNodeTexture";
821 return "CompositorNodeTranslate";
823 return "CompositorNodeZcombine";
825 return "CompositorNodeCombRGBA";
827 return "CompositorNodeDilateErode";
828 case CMP_NODE_INPAINT:
829 return "CompositorNodeInpaint";
831 return "CompositorNodeDespeckle";
832 case CMP_NODE_ROTATE:
833 return "CompositorNodeRotate";
834 case CMP_NODE_SCALE:
835 return "CompositorNodeScale";
837 return "CompositorNodeSepYCCA";
839 return "CompositorNodeCombYCCA";
841 return "CompositorNodeSepYUVA";
843 return "CompositorNodeCombYUVA";
845 return "CompositorNodeDiffMatte";
847 return "CompositorNodeColorSpill";
849 return "CompositorNodeChromaMatte";
851 return "CompositorNodeChannelMatte";
852 case CMP_NODE_FLIP:
853 return "CompositorNodeFlip";
855 return "CompositorNodeSplitViewer";
856 case CMP_NODE_MAP_UV:
857 return "CompositorNodeMapUV";
858 case CMP_NODE_ID_MASK:
859 return "CompositorNodeIDMask";
861 return "CompositorNodeDoubleEdgeMask";
862 case CMP_NODE_DEFOCUS:
863 return "CompositorNodeDefocus";
865 return "CompositorNodeDisplace";
867 return "CompositorNodeCombHSVA";
869 return "CompositorNodeMath";
871 return "CompositorNodeLumaMatte";
873 return "CompositorNodeBrightContrast";
875 return "CompositorNodeGamma";
876 case CMP_NODE_INVERT:
877 return "CompositorNodeInvert";
879 return "CompositorNodeNormalize";
880 case CMP_NODE_CROP:
881 return "CompositorNodeCrop";
882 case CMP_NODE_DBLUR:
883 return "CompositorNodeDBlur";
885 return "CompositorNodeBilateralblur";
887 return "CompositorNodePremulKey";
888 case CMP_NODE_GLARE:
889 return "CompositorNodeGlare";
890 case CMP_NODE_TONEMAP:
891 return "CompositorNodeTonemap";
893 return "CompositorNodeLensdist";
895 return "CompositorNodeLevels";
897 return "CompositorNodeColorMatte";
899 return "CompositorNodeDistanceMatte";
901 return "CompositorNodeColorBalance";
903 return "CompositorNodeHueCorrect";
905 return "CompositorNodeMovieClip";
907 return "CompositorNodeTransform";
909 return "CompositorNodeStabilize";
911 return "CompositorNodeMovieDistortion";
913 return "CompositorNodeBoxMask";
915 return "CompositorNodeEllipseMask";
917 return "CompositorNodeBokehImage";
919 return "CompositorNodeBokehBlur";
920 case CMP_NODE_SWITCH:
921 return "CompositorNodeSwitch";
923 return "CompositorNodeColorCorrection";
924 case CMP_NODE_MASK:
925 return "CompositorNodeMask";
927 return "CompositorNodeKeyingScreen";
928 case CMP_NODE_KEYING:
929 return "CompositorNodeKeying";
931 return "CompositorNodeTrackPos";
933 return "CompositorNodePixelate";
934 case TEX_NODE_OUTPUT:
935 return "TextureNodeOutput";
936 case TEX_NODE_CHECKER:
937 return "TextureNodeChecker";
938 case TEX_NODE_TEXTURE:
939 return "TextureNodeTexture";
940 case TEX_NODE_BRICKS:
941 return "TextureNodeBricks";
942 case TEX_NODE_MATH:
943 return "TextureNodeMath";
944 case TEX_NODE_MIX_RGB:
945 return "TextureNodeMixRGB";
946 case TEX_NODE_RGBTOBW:
947 return "TextureNodeRGBToBW";
949 return "TextureNodeValToRGB";
950 case TEX_NODE_IMAGE:
951 return "TextureNodeImage";
953 return "TextureNodeCurveRGB";
954 case TEX_NODE_INVERT:
955 return "TextureNodeInvert";
956 case TEX_NODE_HUE_SAT:
957 return "TextureNodeHueSaturation";
959 return "TextureNodeCurveTime";
960 case TEX_NODE_ROTATE:
961 return "TextureNodeRotate";
962 case TEX_NODE_VIEWER:
963 return "TextureNodeViewer";
965 return "TextureNodeTranslate";
966 case TEX_NODE_COORD:
967 return "TextureNodeCoordinates";
969 return "TextureNodeDistance";
971 return "TextureNodeCompose";
973 return "TextureNodeDecompose";
975 return "TextureNodeValToNor";
976 case TEX_NODE_SCALE:
977 return "TextureNodeScale";
978 case TEX_NODE_AT:
979 return "TextureNodeAt";
981 return "TextureNodeTexVoronoi";
983 return "TextureNodeTexBlend";
985 return "TextureNodeTexMagic";
987 return "TextureNodeTexMarble";
989 return "TextureNodeTexClouds";
990 case TEX_NODE_PROC + TEX_WOOD:
991 return "TextureNodeTexWood";
993 return "TextureNodeTexMusgrave";
995 return "TextureNodeTexNoise";
997 return "TextureNodeTexStucci";
999 return "TextureNodeTexDistNoise";
1000 }
1001 }
1002 return "";
1003}
1004
1006{
1007 switch (sock->type) {
1008 case SOCK_FLOAT: {
1009 bNodeSocketValueFloat *dval = sock->default_value_typed<bNodeSocketValueFloat>();
1011 }
1012 case SOCK_INT: {
1013 bNodeSocketValueInt *dval = sock->default_value_typed<bNodeSocketValueInt>();
1015 }
1016 case SOCK_BOOLEAN: {
1018 }
1019 case SOCK_VECTOR: {
1020 bNodeSocketValueVector *dval = sock->default_value_typed<bNodeSocketValueVector>();
1022 }
1023 case SOCK_RGBA: {
1025 }
1026 case SOCK_STRING: {
1027 bNodeSocketValueString *dval = sock->default_value_typed<bNodeSocketValueString>();
1029 }
1030 case SOCK_SHADER: {
1032 }
1033 default: {
1034 return "";
1035 }
1036 }
1037 return "";
1038}
1039
1040static void do_versions_nodetree_customnodes(bNodeTree *ntree, int /*is_group*/)
1041{
1042 /* initialize node tree type idname */
1043 {
1044 ntree->typeinfo = nullptr;
1045
1046 /* tree type idname */
1047 switch (ntree->type) {
1048 case NTREE_COMPOSIT:
1049 STRNCPY(ntree->idname, "CompositorNodeTree");
1050 break;
1051 case NTREE_SHADER:
1052 STRNCPY(ntree->idname, "ShaderNodeTree");
1053 break;
1054 case NTREE_TEXTURE:
1055 STRNCPY(ntree->idname, "TextureNodeTree");
1056 break;
1057 default:
1058 break;
1059 }
1060
1061 /* node type idname */
1062 for (bNode &node : ntree->nodes) {
1063 STRNCPY_UTF8(node.idname, node_get_static_idname(node.type_legacy, ntree->type));
1064
1065 /* existing old nodes have been initialized already */
1066 node.flag |= NODE_INIT;
1067
1068 /* sockets idname */
1069 for (bNodeSocket &sock : node.inputs) {
1071 }
1072 for (bNodeSocket &sock : node.outputs) {
1074 }
1075 }
1076 /* tree sockets idname */
1077 for (bNodeSocket &sock : ntree->inputs_legacy) {
1079 }
1080 for (bNodeSocket &sock : ntree->outputs_legacy) {
1082 }
1083 }
1084
1085 {
1087 /* initialize socket in_out values */
1088 for (bNode &node : ntree->nodes) {
1089 for (bNodeSocket &sock : node.inputs) {
1090 sock.in_out = SOCK_IN;
1091 }
1092 for (bNodeSocket &sock : node.outputs) {
1093 sock.in_out = SOCK_OUT;
1094 }
1095 }
1096 for (bNodeSocket &sock : ntree->inputs_legacy) {
1097 sock.in_out = SOCK_IN;
1098 }
1099 for (bNodeSocket &sock : ntree->outputs_legacy) {
1100 sock.in_out = SOCK_OUT;
1101 }
1102 }
1103
1104 /* initialize socket identifier strings */
1105 {
1106 for (bNode &node : ntree->nodes) {
1107 for (bNodeSocket &sock : node.inputs) {
1109 BLI_uniquename(&node.inputs,
1110 &sock,
1111 "socket",
1112 '.',
1113 offsetof(bNodeSocket, identifier),
1114 sizeof(sock.identifier));
1116 }
1117 for (bNodeSocket &sock : node.outputs) {
1119 BLI_uniquename(&node.outputs,
1120 &sock,
1121 "socket",
1122 '.',
1123 offsetof(bNodeSocket, identifier),
1124 sizeof(sock.identifier));
1126 }
1127 }
1128 for (bNodeSocket &sock : ntree->inputs_legacy) {
1129 STRNCPY_UTF8(sock.identifier, sock.name);
1131 &sock,
1132 "socket",
1133 '.',
1134 offsetof(bNodeSocket, identifier),
1135 sizeof(sock.identifier));
1136 }
1137 for (bNodeSocket &sock : ntree->outputs_legacy) {
1138 STRNCPY_UTF8(sock.identifier, sock.name);
1140 &sock,
1141 "socket",
1142 '.',
1143 offsetof(bNodeSocket, identifier),
1144 sizeof(sock.identifier));
1145 }
1146 }
1147}
1148
1149/* Sync functions update formula parameters for other modes, such that the result is comparable.
1150 * Note that the results are not exactly the same due to differences in color handling
1151 * (sRGB conversion happens for LGG),
1152 * but this keeps settings comparable. */
1154{
1156 NodeColorBalance *n = static_cast<NodeColorBalance *>(node->storage);
1157
1158 for (int c = 0; c < 3; c++) {
1159 n->slope[c] = (2.0f - n->lift[c]) * n->gain[c];
1160 n->offset[c] = (n->lift[c] - 1.0f) * n->gain[c];
1161 n->power[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
1162 }
1163 }
1164}
1165
1167{
1169 NodeColorBalance *n = static_cast<NodeColorBalance *>(node->storage);
1170
1171 for (int c = 0; c < 3; c++) {
1172 float d = n->slope[c] + n->offset[c];
1173 n->lift[c] = (d != 0.0f ? n->slope[c] + 2.0f * n->offset[c] / d : 0.0f);
1174 n->gain[c] = d;
1175 n->gamma[c] = (n->power[c] != 0.0f) ? 1.0f / n->power[c] : 1000000.0f;
1176 }
1177 }
1178}
1179
1180static bool strip_colorbalance_update_cb(Strip *strip, void * /*user_data*/)
1181{
1182 StripData *data = strip->data;
1183
1184 if (data && data->color_balance_legacy) {
1186 ColorBalanceModifierData *cbmd = reinterpret_cast<ColorBalanceModifierData *>(smd);
1187
1188 cbmd->color_balance = *data->color_balance_legacy;
1189
1190 /* multiplication with color balance used is handled differently,
1191 * so we need to move multiplication to modifier so files would be
1192 * compatible
1193 */
1194 cbmd->color_multiply = strip->mul;
1195 strip->mul = 1.0f;
1196
1197 MEM_delete(data->color_balance_legacy);
1198 data->color_balance_legacy = nullptr;
1199 }
1200 return true;
1201}
1202
1203static bool strip_set_alpha_mode_cb(Strip *strip, void * /*user_data*/)
1204{
1205 constexpr eStripFlag SEQ_MAKE_PREMUL = eStripFlag(1 << 6);
1206 if (strip->flag & SEQ_MAKE_PREMUL) {
1207 strip->alpha_mode = SEQ_ALPHA_STRAIGHT;
1208 }
1209 else {
1211 }
1212 return true;
1213}
1214
1215static bool strip_set_wipe_angle_cb(Strip *strip, void * /*user_data*/)
1216{
1217 if (strip->type == STRIP_TYPE_WIPE) {
1218 WipeVars *wv = static_cast<WipeVars *>(strip->effectdata);
1219 wv->angle = DEG2RADF(wv->angle);
1220 }
1221 return true;
1222}
1223
1224/* Create a socket stub without typeinfo. */
1225static bNodeSocket *version_make_socket_stub(const char *idname,
1227 eNodeSocketInOut in_out,
1228 const char *identifier,
1229 const char *name,
1230 const void *default_value,
1231 const IDProperty *prop)
1232{
1233 bNodeSocket *socket = MEM_new<bNodeSocket>(__func__);
1234 socket->runtime = MEM_new<bke::bNodeSocketRuntime>(__func__);
1235 STRNCPY_UTF8(socket->idname, idname);
1236 socket->type = type;
1237 socket->in_out = in_out;
1238
1239 socket->limit = (in_out == SOCK_IN ? 1 : 0xFFF);
1240
1241 version_node_socket_identifier_set(*socket, identifier);
1242 STRNCPY_UTF8(socket->name, name);
1243 socket->storage = nullptr;
1244 socket->flag |= SOCK_COLLAPSED;
1245
1246 /* NOTE: technically socket values can store ref-counted ID pointers, but at this stage the
1247 * refcount can be ignored. It gets recomputed after lib-linking for all ID pointers. Socket
1248 * values don't have allocated data, so a simple duplication works here. */
1249 socket->default_value = default_value ? MEM_dupalloc_void(default_value) : nullptr;
1250 socket->prop = prop ? IDP_CopyProperty(prop) : nullptr;
1251
1252 return socket;
1253}
1254
1255/* Same as node_add_static_node but does not rely on node typeinfo. */
1256static bNode *version_add_group_in_out_node(bNodeTree *ntree, const int type)
1257{
1258 ListBaseT<bNodeSocket> *ntree_socket_list = nullptr;
1259 ListBaseT<bNodeSocket> *node_socket_list = nullptr;
1260 eNodeSocketInOut socket_in_out = SOCK_IN;
1261
1262 bNode *node = MEM_new<bNode>("new node");
1263 switch (type) {
1264 case NODE_GROUP_INPUT:
1265 STRNCPY_UTF8(node->idname, "NodeGroupInput");
1266 ntree_socket_list = &ntree->inputs_legacy;
1267 /* Group input has only outputs. */
1268 node_socket_list = &node->outputs;
1269 socket_in_out = SOCK_OUT;
1270 break;
1271 case NODE_GROUP_OUTPUT:
1272 STRNCPY_UTF8(node->idname, "NodeGroupOutput");
1273 ntree_socket_list = &ntree->outputs_legacy;
1274 /* Group output has only inputs. */
1275 node_socket_list = &node->inputs;
1276 socket_in_out = SOCK_IN;
1277 break;
1278 default:
1280 return nullptr;
1281 }
1282
1283 node->runtime = MEM_new<bke::bNodeRuntime>(__func__);
1284 BLI_addtail(&ntree->nodes, node);
1285 bke::node_unique_id(*ntree, *node);
1286
1287 /* Manual initialization of the node,
1288 * node->typeinfo is only set after versioning. */
1289 node->type_legacy = type;
1290 {
1291 /* Add sockets without relying on declarations or typeinfo.
1292 * These are stubs for links, full typeinfo is defined later. */
1293 for (bNodeSocket &tree_socket : *ntree_socket_list) {
1294 bNodeSocket *node_socket = version_make_socket_stub(tree_socket.idname,
1295 tree_socket.type,
1296 socket_in_out,
1297 tree_socket.identifier,
1298 tree_socket.name,
1299 tree_socket.default_value,
1300 tree_socket.prop);
1301
1302 BLI_addtail(node_socket_list, node_socket);
1303 BKE_ntree_update_tag_socket_type(ntree, node_socket);
1304 BKE_ntree_update_tag_socket_new(ntree, node_socket);
1305 }
1306 }
1308 return node;
1309}
1310
1311/* NOLINTNEXTLINE: readability-function-size */
1312void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
1313{
1314 if (bmain->versionfile < 260) {
1315 {
1316 /* set default alpha value of Image outputs in image and render layer nodes to 0 */
1318 for (Scene &sce : bmain->scenes) {
1319 /* there are files with invalid audio_channels value, the real cause
1320 * is unknown, but we fix it here anyway to avoid crashes */
1321 if (sce.r.ffcodecdata.audio_channels == 0) {
1323 }
1324
1325 if (sce.nodetree) {
1327 }
1328 }
1329
1330 for (bNodeTree &ntree : bmain->nodetrees) {
1332 }
1333 }
1334
1335 {
1336 /* Support old particle dupli-object rotation settings. */
1337 for (ParticleSettings &part : bmain->particles) {
1338 if (ELEM(part.ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
1339 part.draw |= PART_DRAW_ROTATE_OB;
1340
1341 if (part.rotmode == 0) {
1342 part.rotmode = PART_ROT_VEL;
1343 }
1344 }
1345 }
1346 }
1347 }
1348
1349 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 260, 1)) {
1350 for (Object &ob : bmain->objects) {
1352 }
1353
1354 {
1355 for (Camera &cam : bmain->cameras) {
1356 if (cam.sensor_x < 0.01f) {
1357 cam.sensor_x = DEFAULT_SENSOR_WIDTH;
1358 }
1359
1360 if (cam.sensor_y < 0.01f) {
1361 cam.sensor_y = DEFAULT_SENSOR_HEIGHT;
1362 }
1363 }
1364 }
1365 }
1366
1367 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 260, 2)) {
1368 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1369 if (ntree->type == NTREE_SHADER) {
1370 for (bNode &node : ntree->nodes) {
1371 if (node.type_legacy == SH_NODE_MAPPING) {
1373 TexMapping *tex_mapping = static_cast<TexMapping *>(node.storage);
1374 tex_mapping->projx = PROJ_X;
1375 tex_mapping->projy = PROJ_Y;
1376 tex_mapping->projz = PROJ_Z;
1377 }
1378 }
1379 }
1380 }
1381 }
1383 }
1384
1385 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 260, 4)) {
1386 {
1387 /* Convert node angles to radians! */
1389 for (Scene &sce : bmain->scenes) {
1390 if (sce.nodetree) {
1392 }
1393 }
1394
1395 for (Material &mat : bmain->materials) {
1396 if (mat.nodetree) {
1398 }
1399 }
1400
1401 for (bNodeTree &ntree : bmain->nodetrees) {
1403 }
1404 }
1405
1406 {
1407 /* Tomato compatibility code. */
1409 for (bScreen &screen : bmain->screens) {
1410 for (ScrArea &area : screen.areabase) {
1411 for (SpaceLink &sl : area.spacedata) {
1412 if (sl.spacetype == SPACE_VIEW3D) {
1413 View3D *v3d = reinterpret_cast<View3D *>(&sl);
1414 if (v3d->bundle_size == 0.0f) {
1415 v3d->bundle_size = 0.2f;
1417 }
1418
1419 if (v3d->bundle_drawtype == 0) {
1421 }
1422 }
1423 else if (sl.spacetype == SPACE_CLIP) {
1424 SpaceClip *sclip = reinterpret_cast<SpaceClip *>(&sl);
1425 if (sclip->scopes.track_preview_height == 0) {
1426 sclip->scopes.track_preview_height = 120;
1427 }
1428 }
1429 }
1430 }
1431 }
1432
1433 for (MovieClip &clip : bmain->movieclips) {
1434 if (clip.aspx < 1.0f) {
1435 clip.aspx = 1.0f;
1436 clip.aspy = 1.0f;
1437 }
1438
1439 if (clip.proxy.build_size_flag == 0) {
1441 }
1442
1443 if (clip.proxy.quality == 0) {
1444 clip.proxy.quality = 90;
1445 }
1446
1447 if (clip.tracking.camera.pixel_aspect < 0.01f) {
1448 clip.tracking.camera.pixel_aspect = 1.0f;
1449 }
1450
1451 MovieTrackingTrack *track = static_cast<MovieTrackingTrack *>(
1452 clip.tracking.tracks_legacy.first());
1453 while (track) {
1454 if (track->minimum_correlation == 0.0f) {
1455 track->minimum_correlation = 0.75f;
1456 }
1457
1458 track = static_cast<MovieTrackingTrack *>(track->next);
1459 }
1460 }
1461 }
1462 }
1463
1464 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 260, 6)) {
1465 for (Scene &sce : bmain->scenes) {
1467 }
1468
1469 for (MovieClip &clip : bmain->movieclips) {
1470 MovieTrackingSettings *settings = &clip.tracking.settings;
1471
1472 if (settings->default_pattern_size == 0.0f) {
1474 settings->default_minimum_correlation = 0.75;
1475 settings->default_pattern_size = 11;
1476 settings->default_search_size = 51;
1477 }
1478 }
1479
1480 {
1481 for (Object &ob : bmain->objects) {
1482 /* convert delta addition into delta scale */
1483 int i;
1484 for (i = 0; i < 3; i++) {
1485 if ((ob.dsize[i] == 0.0f) || /* simple case, user never touched dsize */
1486 (ob.scale[i] == 0.0f)) /* can't scale the dsize to give a non zero result,
1487 * so fallback to 1.0f */
1488 {
1489 ob.dscale[i] = 1.0f;
1490 }
1491 else {
1492 ob.dscale[i] = (ob.scale[i] + ob.dsize[i]) / ob.scale[i];
1493 }
1494 }
1495 }
1496 }
1497 }
1498 /* sigh, this dscale vs dsize version patching was not done right, fix for fix,
1499 * this intentionally checks an exact subversion, also note this was never in a release,
1500 * at some point this could be removed. */
1501 else if (bmain->versionfile == 260 && bmain->subversionfile == 6) {
1502 for (Object &ob : bmain->objects) {
1503 if (is_zero_v3(ob.dscale)) {
1504 std::fill_n(ob.dscale, 3, 1.0f);
1505 }
1506 }
1507 }
1508
1509 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 260, 8)) {
1510 for (Brush &brush : bmain->brushes) {
1511 if (brush.sculpt_brush_type == SCULPT_BRUSH_TYPE_ROTATE) {
1512 brush.alpha = 1.0f;
1513 }
1514 }
1515 }
1516
1517 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 261, 1)) {
1518 {
1519 /* update use flags for node sockets (was only temporary before) */
1521 for (Scene &sce : bmain->scenes) {
1522 if (sce.nodetree) {
1524 }
1525 }
1526
1527 for (Material &mat : bmain->materials) {
1528 if (mat.nodetree) {
1530 }
1531 }
1532
1533 for (Tex &tex : bmain->textures) {
1534 if (tex.nodetree) {
1536 }
1537 }
1538
1539 for (Light &la : bmain->lights) {
1540 if (la.nodetree) {
1542 }
1543 }
1544
1545 for (World &world : bmain->worlds) {
1546 if (world.nodetree) {
1548 }
1549 }
1550
1551 for (bNodeTree &ntree : bmain->nodetrees) {
1553 }
1554 }
1555 {
1556 for (MovieClip &clip : bmain->movieclips) {
1557 MovieTracking *tracking = &clip.tracking;
1558 MovieTrackingObject *tracking_object = static_cast<MovieTrackingObject *>(
1559 tracking->objects.first());
1560
1561 if (!tracking->settings.object_distance) {
1562 tracking->settings.object_distance = 1.0f;
1563 }
1564
1565 if (tracking->objects.is_empty()) {
1566 BKE_tracking_object_add(tracking, "Camera");
1567 }
1568
1569 while (tracking_object) {
1570 if (!tracking_object->scale) {
1571 tracking_object->scale = 1.0f;
1572 }
1573
1574 tracking_object = static_cast<MovieTrackingObject *>(tracking_object->next);
1575 }
1576 }
1577
1578 for (Object &ob : bmain->objects) {
1579 for (bConstraint &con : ob.constraints) {
1582
1583 if (data->invmat[3][3] == 0.0f) {
1584 unit_m4(data->invmat);
1585 }
1586 }
1587 }
1588 }
1589 }
1590 }
1591
1592 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 261, 2)) {
1593 {
1594 /* convert deprecated sculpt_paint_unified_* fields to
1595 * UnifiedPaintSettings */
1596 for (Scene &scene : bmain->scenes) {
1597 ToolSettings *ts = scene.toolsettings;
1603 }
1604 }
1605 }
1606
1607 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 261, 3)) {
1608 {
1609 /* Convert extended ASCII to UTF8 for text editor. */
1611 for (Text &text : bmain->texts) {
1612 if (!(text.flags & TXT_ISEXT)) {
1613 for (TextLine &tl : text.lines) {
1614 int added = txt_extended_ascii_as_utf8(&tl.line);
1615 tl.len += added;
1616
1617 /* reset cursor position if line was changed */
1618 if (added && &tl == text.curl) {
1619 text.curc = 0;
1620 }
1621 }
1622 }
1623 }
1624 }
1625 {
1626 /* set new dynamic paint values */
1627 for (Object &ob : bmain->objects) {
1628 for (ModifierData &md : ob.modifiers) {
1629 if (md.type == eModifierType_DynamicPaint) {
1630 DynamicPaintModifierData *pmd = reinterpret_cast<DynamicPaintModifierData *>(&md);
1631 if (pmd->canvas) {
1632 DynamicPaintSurface *surface = static_cast<DynamicPaintSurface *>(
1633 pmd->canvas->surfaces.first());
1634 for (; surface; surface = static_cast<DynamicPaintSurface *>(surface->next)) {
1635 surface->color_dry_threshold = 1.0f;
1636 surface->influence_scale = 1.0f;
1637 surface->radius_scale = 1.0f;
1638 surface->flags |= MOD_DPAINT_USE_DRYING;
1639 }
1640 }
1641 }
1642 }
1643 }
1644 }
1645 }
1646
1647 if (bmain->versionfile < 262) {
1648 for (Object &ob : bmain->objects) {
1649 for (ModifierData &md : ob.modifiers) {
1650 if (md.type == eModifierType_Cloth) {
1651 ClothModifierData *clmd = reinterpret_cast<ClothModifierData *>(&md);
1652 if (clmd->sim_parms) {
1653 clmd->sim_parms->vel_damping = 1.0f;
1654 }
1655 }
1656 }
1657 }
1658 }
1659
1660 if (bmain->versionfile < 263) {
1661 /* set fluidsim rate. the version patch for this in 2.62 was wrong, so
1662 * try to correct it, if rate is 0.0 that's likely not intentional */
1663 for (Object &ob : bmain->objects) {
1664 for (ModifierData &md : ob.modifiers) {
1665 if (md.type == eModifierType_Fluidsim) {
1666 FluidsimModifierData *fmd = reinterpret_cast<FluidsimModifierData *>(&md);
1667 if (fmd->fss->animRate == 0.0f) {
1668 fmd->fss->animRate = 1.0f;
1669 }
1670 }
1671 }
1672 }
1673 }
1674
1675 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 262, 1)) {
1676 /* update use flags for node sockets (was only temporary before) */
1677 for (Scene &sce : bmain->scenes) {
1678 if (sce.nodetree) {
1680 }
1681 }
1682
1683 /* XXX can't associate with scene for group nodes, image format will stay uninitialized */
1684 for (bNodeTree &ntree : bmain->nodetrees) {
1686 }
1687 }
1688
1689 /* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
1690 if (bmain->versionfile == 262 && bmain->subversionfile == 1) {
1691 {
1692 for (Mesh &me : bmain->meshes) {
1694 }
1695 }
1696 }
1697
1698 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 262, 2)) {
1699 /* Set new idname of keyingsets from their now "label-only" name. */
1700 for (Scene &scene : bmain->scenes) {
1701 for (KeyingSet &ks : scene.keyingsets) {
1702 if (!ks.idname[0]) {
1703 STRNCPY_UTF8(ks.idname, ks.name);
1704 }
1705 }
1706 }
1707 }
1708
1709 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 262, 3)) {
1710 for (Object &ob : bmain->objects) {
1711 for (ModifierData &md : ob.modifiers) {
1712 if (md.type == eModifierType_Lattice) {
1713 LatticeModifierData *lmd = reinterpret_cast<LatticeModifierData *>(&md);
1714 lmd->strength = 1.0f;
1715 }
1716 }
1717 }
1718 }
1719
1720 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 262, 4)) {
1721 /* Read Viscosity presets from older files */
1722 for (Object &ob : bmain->objects) {
1723 for (ModifierData &md : ob.modifiers) {
1724 if (md.type == eModifierType_Fluidsim) {
1725 FluidsimModifierData *fmd = reinterpret_cast<FluidsimModifierData *>(&md);
1726 if (fmd->fss->viscosityMode == 3) {
1727 fmd->fss->viscosityValue = 5.0;
1728 fmd->fss->viscosityExponent = 5;
1729 }
1730 else if (fmd->fss->viscosityMode == 4) {
1731 fmd->fss->viscosityValue = 2.0;
1732 fmd->fss->viscosityExponent = 3;
1733 }
1734 }
1735 }
1736 }
1737 }
1738
1739 if (bmain->versionfile < 263) {
1740 /* Default for old files is to save particle rotations to pointcache */
1741 for (ParticleSettings &part : bmain->particles) {
1742 part.flag |= PART_ROTATIONS;
1743 }
1744 }
1745
1746 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 1)) {
1747 /* file output node paths are now stored in the file info struct instead socket name */
1748 for (Scene &sce : bmain->scenes) {
1749 if (sce.nodetree) {
1751 }
1752 }
1753 for (bNodeTree &ntree : bmain->nodetrees) {
1755 }
1756 }
1757
1758 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 3)) {
1759 /* For weight paint, each brush now gets its own weight;
1760 * unified paint settings also have weight. Update unified
1761 * paint settings and brushes with a default weight value. */
1762 for (Scene &scene : bmain->scenes) {
1763 ToolSettings *ts = scene.toolsettings;
1764 if (ts) {
1767 }
1768 }
1769
1770 for (Brush &brush : bmain->brushes) {
1771 brush.weight = 0.5;
1772 }
1773 }
1774
1775 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 2)) {
1776 for (bScreen &screen : bmain->screens) {
1777 for (ScrArea &area : screen.areabase) {
1778 for (SpaceLink &sl : area.spacedata) {
1779 if (sl.spacetype == SPACE_CLIP) {
1780 SpaceClip *sclip = reinterpret_cast<SpaceClip *>(&sl);
1781 bool hide = false;
1782
1783 for (ARegion &region : area.regionbase) {
1784 if (region.regiontype == RGN_TYPE_PREVIEW) {
1785 if (region.alignment != RGN_ALIGN_NONE) {
1786 region.flag |= RGN_FLAG_HIDDEN;
1787 region.v2d.flag &= ~V2D_IS_INIT;
1788 region.alignment = RGN_ALIGN_NONE;
1789
1790 hide = true;
1791 }
1792 }
1793 }
1794
1795 if (hide) {
1796 sclip->view = SC_VIEW_CLIP;
1797 }
1798 }
1799 }
1800 }
1801 }
1802 }
1803
1804 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 4)) {
1805 for (Camera &cam : bmain->cameras) {
1806 if (cam.flag & CAM_PANORAMA) {
1807 cam.type = CAM_PANO;
1808 cam.flag &= ~CAM_PANORAMA;
1809 }
1810 }
1811
1812 for (Curve &cu : bmain->curves) {
1813 if (cu.bevfac2 == 0.0f) {
1814 cu.bevfac1 = 0.0f;
1815 cu.bevfac2 = 1.0f;
1816 }
1817 }
1818 }
1819
1820 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 5)) {
1821 {
1822 /* file output node paths are now stored in the file info struct instead socket name */
1823 for (Scene &sce : bmain->scenes) {
1824 if (sce.nodetree) {
1827 }
1828 }
1829 for (bNodeTree &ntree : bmain->nodetrees) {
1832 }
1833 }
1834 }
1835
1836 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 6)) {
1837 /* update use flags for node sockets (was only temporary before) */
1838 for (Scene &sce : bmain->scenes) {
1839 if (sce.nodetree) {
1841 }
1842 }
1843
1844 for (Material &mat : bmain->materials) {
1845 if (mat.nodetree) {
1847 }
1848 }
1849
1850 for (Tex &tex : bmain->textures) {
1851 if (tex.nodetree) {
1853 }
1854 }
1855
1856 for (Light &la : bmain->lights) {
1857 if (la.nodetree) {
1859 }
1860 }
1861
1862 for (World &world : bmain->worlds) {
1863 if (world.nodetree) {
1864 do_versions_nodetree_frame_2_64_6(world.nodetree);
1865 }
1866 }
1867
1868 for (bNodeTree &ntree : bmain->nodetrees) {
1870 }
1871 }
1872
1873 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 7)) {
1874 for (Object &ob : bmain->objects) {
1875 for (ModifierData &md : ob.modifiers) {
1876 if (md.type == eModifierType_Fluid) {
1877 FluidModifierData *fmd = reinterpret_cast<FluidModifierData *>(&md);
1878 if ((fmd->type & MOD_FLUID_TYPE_DOMAIN) && fmd->domain) {
1879 int maxres = std::max({fmd->domain->res[0], fmd->domain->res[1], fmd->domain->res[2]});
1880 fmd->domain->scale = fmd->domain->dx * maxres;
1881 fmd->domain->dx = 1.0f / fmd->domain->scale;
1882 }
1883 }
1884 }
1885 }
1886 }
1887
1888 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 9)) {
1889 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1890 if (ntree->type == NTREE_SHADER) {
1891 for (bNode &node : ntree->nodes) {
1894 NodeTexImage *tex = static_cast<NodeTexImage *>(node.storage);
1895
1896 tex->iuser.frames = 1;
1897 tex->iuser.sfra = 1;
1898 }
1899 }
1900 }
1901 }
1902 }
1904 }
1905
1906 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 10)) {
1907 {
1908 /* composite redesign */
1909 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1910 if (ntree->type == NTREE_COMPOSIT) {
1911 for (bNode &node : ntree->nodes) {
1912 if (node.type_legacy == CMP_NODE_DEFOCUS) {
1914 NodeDefocus *data = static_cast<NodeDefocus *>(node.storage);
1915 if (data->maxblur == 0.0f) {
1916 data->maxblur = 16.0f;
1917 }
1918 }
1919 }
1920 }
1921 }
1922 }
1924 }
1925
1926 {
1928 for (bScreen &screen : bmain->screens) {
1929 for (ScrArea &area : screen.areabase) {
1930 for (SpaceLink &sl : area.spacedata) {
1931 if (sl.spacetype == SPACE_CLIP) {
1932 SpaceClip *sclip = reinterpret_cast<SpaceClip *>(&sl);
1933
1934 if (sclip->around == 0) {
1936 }
1937 }
1938 }
1939 }
1940 }
1941 }
1942
1943 {
1944 for (MovieClip &clip : bmain->movieclips) {
1945 clip.start_frame = 1;
1946 }
1947 }
1948 }
1949
1950 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 11)) {
1951 for (MovieClip &clip : bmain->movieclips) {
1952 MovieTrackingTrack *track = static_cast<MovieTrackingTrack *>(
1953 clip.tracking.tracks_legacy.first());
1954 while (track) {
1956
1957 track = static_cast<MovieTrackingTrack *>(track->next);
1958 }
1959 }
1960 }
1961
1962 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 13)) {
1963 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1964 if (ntree->type == NTREE_COMPOSIT) {
1965 for (bNode &node : ntree->nodes) {
1966 if (node.type_legacy == CMP_NODE_DILATEERODE) {
1967 if (node.storage == nullptr) {
1968 NodeDilateErode *data = MEM_new<NodeDilateErode>(__func__);
1969 data->falloff = PROP_SMOOTH;
1970 node.storage = data;
1971 }
1972 }
1973 }
1974 }
1975 }
1977 }
1978
1979 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 14)) {
1980 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1981 if (ntree->type == NTREE_COMPOSIT) {
1982 for (bNode &node : ntree->nodes) {
1983 if (node.type_legacy == CMP_NODE_KEYING) {
1985 NodeKeyingData *data = static_cast<NodeKeyingData *>(node.storage);
1986
1987 if (data->despill_balance == 0.0f) {
1988 data->despill_balance = 0.5f;
1989 }
1990 }
1991 }
1992 }
1993 }
1994 }
1996
1997 /* Keep compatibility for dupli-object particle size. */
1998 for (ParticleSettings &part : bmain->particles) {
1999 if (ELEM(part.ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
2000 if ((part.draw & PART_DRAW_ROTATE_OB) == 0) {
2002 }
2003 }
2004 }
2005 }
2006
2007 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 17)) {
2008 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2009 if (ntree->type == NTREE_COMPOSIT) {
2010 for (bNode &node : ntree->nodes) {
2011 if (node.type_legacy == CMP_NODE_MASK) {
2012 if (node.storage == nullptr) {
2013 NodeMask *data = MEM_new<NodeMask>(__func__);
2014 /* move settings into own struct */
2015 data->size_x = int(node.custom3);
2016 data->size_y = int(node.custom4);
2017 node.custom3 = 0.5f; /* default shutter */
2018 node.storage = data;
2019 }
2020 }
2021 }
2022 }
2023 }
2025 }
2026
2027 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 18)) {
2028 for (Scene &scene : bmain->scenes) {
2029 if (scene.ed) {
2031 }
2032 }
2033 }
2034
2035 /* color management pipeline changes compatibility code */
2036 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 19)) {
2037 bool colormanagement_disabled = false;
2038
2039 /* make scenes which are not using color management have got None as display device,
2040 * so they wouldn't perform linear-to-sRGB conversion on display
2041 */
2042 for (Scene &scene : bmain->scenes) {
2043 if ((scene.r.color_mgt_flag & R_COLOR_MANAGEMENT) == 0) {
2044 ColorManagedDisplaySettings *display_settings = &scene.display_settings;
2045
2046 if (display_settings->display_device[0] == 0) {
2048 }
2049
2050 colormanagement_disabled = true;
2051 }
2052 }
2053
2054 for (Image &ima : bmain->images) {
2055 if (ima.source == IMA_SRC_VIEWER) {
2056 ima.flag |= IMA_VIEW_AS_RENDER;
2057 }
2058 else if (colormanagement_disabled) {
2059 /* if color-management not used, set image's color space to raw, so no sRGB->linear
2060 * conversion would happen on display and render there's no clear way to check whether
2061 * color management is enabled or not in render engine so set all images to raw if there's
2062 * at least one scene with color management disabled this would still behave incorrect in
2063 * cases when color management was used for only some of scenes, but such a setup is
2064 * crazy anyway and think it's fair enough to break compatibility in that cases.
2065 */
2066
2067 STRNCPY_UTF8(ima.colorspace_settings.name, "Raw");
2068 }
2069 }
2070 }
2071
2072 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 20)) {
2073 for (Key &key : bmain->shapekeys) {
2075 }
2076 }
2077
2078 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 21)) {
2079 {
2080 for (Mesh &me : bmain->meshes) {
2082 CustomData_free_layers(&me.vert_data, CD_MSTICKY);
2083 }
2084 }
2085 }
2086
2087 /* correction for files saved in blender version when BKE_pose_copy_data
2088 * didn't copy animation visualization, which lead to deadlocks on motion
2089 * path calculation for proxied armatures, see #32742.
2090 */
2091 if (bmain->versionfile < 264) {
2092 for (Object &ob : bmain->objects) {
2093 if (ob.pose) {
2094 if (ob.pose->avs.path_step == 0) {
2096 }
2097 }
2098 }
2099 }
2100
2101 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 264, 1)) {
2102 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2103 if (ntree->type == NTREE_SHADER) {
2104 for (bNode &node : ntree->nodes) {
2105 if (node.type_legacy == SH_NODE_TEX_COORD) {
2106 node.flag |= NODE_OPTIONS;
2107 }
2108 }
2109 }
2110 }
2112 }
2113
2114 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 264, 2)) {
2115 for (MovieClip &clip : bmain->movieclips) {
2116 MovieTracking *tracking = &clip.tracking;
2117 for (MovieTrackingObject &tracking_object : tracking->objects) {
2118 if (tracking_object.keyframe1 == 0 && tracking_object.keyframe2 == 0) {
2119 tracking_object.keyframe1 = tracking->settings.keyframe1_legacy;
2120 tracking_object.keyframe2 = tracking->settings.keyframe2_legacy;
2121 }
2122 }
2123 }
2124 }
2125
2126 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 264, 3)) {
2127 /* smoke branch */
2128 {
2130 for (Object &ob : bmain->objects) {
2131 for (ModifierData &md : ob.modifiers) {
2132 if (md.type == eModifierType_Fluid) {
2133 FluidModifierData *fmd = reinterpret_cast<FluidModifierData *>(&md);
2134 if ((fmd->type & MOD_FLUID_TYPE_DOMAIN) && fmd->domain) {
2135 /* keep branch saves if possible */
2136 if (!fmd->domain->flame_max_temp) {
2137 fmd->domain->burning_rate = 0.75f;
2138 fmd->domain->flame_smoke = 1.0f;
2139 fmd->domain->flame_vorticity = 0.5f;
2140 fmd->domain->flame_ignition = 1.25f;
2141 fmd->domain->flame_max_temp = 1.75f;
2142 fmd->domain->adapt_threshold = 0.002f;
2143 fmd->domain->adapt_margin = 4;
2144 fmd->domain->flame_smoke_color[0] = 0.7f;
2145 fmd->domain->flame_smoke_color[1] = 0.7f;
2146 fmd->domain->flame_smoke_color[2] = 0.7f;
2147 }
2148 }
2149 else if ((fmd->type & MOD_FLUID_TYPE_FLOW) && fmd->flow) {
2150 if (!fmd->flow->texture_size) {
2151 fmd->flow->fuel_amount = 1.0;
2152 fmd->flow->surface_distance = 1.5;
2153 fmd->flow->color[0] = 0.7f;
2154 fmd->flow->color[1] = 0.7f;
2155 fmd->flow->color[2] = 0.7f;
2156 fmd->flow->texture_size = 1.0f;
2157 }
2158 }
2159 }
2160 }
2161 }
2162 }
2163
2164 /* render border for viewport */
2165 {
2166 for (bScreen &screen : bmain->screens) {
2167 for (ScrArea &area : screen.areabase) {
2168 for (SpaceLink &sl : area.spacedata) {
2169 if (sl.spacetype == SPACE_VIEW3D) {
2170 View3D *v3d = reinterpret_cast<View3D *>(&sl);
2171 if (v3d->render_border.xmin == 0.0f && v3d->render_border.ymin == 0.0f &&
2172 v3d->render_border.xmax == 0.0f && v3d->render_border.ymax == 0.0f)
2173 {
2174 v3d->render_border.xmax = 1.0f;
2175 v3d->render_border.ymax = 1.0f;
2176 }
2177 }
2178 }
2179 }
2180 }
2181 }
2182 }
2183
2184 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 264, 5)) {
2185 /* set a unwrapping margin and ABF by default */
2186 for (Scene &scene : bmain->scenes) {
2187 if (scene.toolsettings->uvcalc_margin == 0.0f) {
2188 scene.toolsettings->uvcalc_margin = 0.001f;
2190 }
2191 }
2192 }
2193
2194 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 264, 7)) {
2195 /* convert tiles size from resolution and number of tiles */
2196 {
2198 for (Scene &scene : bmain->scenes) {
2199 if (scene.r.tilex == 0 || scene.r.tiley == 1) {
2200 scene.r.tilex = scene.r.tiley = 64;
2201 }
2202 }
2203 }
2204
2205 /* collision masks */
2206 {
2207 for (Object &ob : bmain->objects) {
2208 if (ob.col_group == 0) {
2209 ob.col_group = 0x01;
2210 ob.col_mask = 0xff;
2211 }
2212 }
2213 }
2214 }
2215
2216 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 264, 7)) {
2217 for (MovieClip &clip : bmain->movieclips) {
2218 for (MovieTrackingTrack &track : clip.tracking.tracks_legacy) {
2220 }
2221
2222 for (MovieTrackingObject &tracking_object : clip.tracking.objects) {
2223 for (MovieTrackingTrack &track : tracking_object.tracks) {
2225 }
2226 }
2227 }
2228 }
2229
2230 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 265, 3)) {
2231 for (bScreen &screen : bmain->screens) {
2232 for (ScrArea &area : screen.areabase) {
2233 for (SpaceLink &sl : area.spacedata) {
2234 switch (sl.spacetype) {
2235 case SPACE_VIEW3D: {
2236 View3D *v3d = reinterpret_cast<View3D *>(&sl);
2237 v3d->flag2 |= V3D_SHOW_ANNOTATION;
2238 break;
2239 }
2240 case SPACE_SEQ: {
2241 SpaceSeq *sseq = reinterpret_cast<SpaceSeq *>(&sl);
2243 break;
2244 }
2245 case SPACE_IMAGE: {
2246 SpaceImage *sima = reinterpret_cast<SpaceImage *>(&sl);
2247 sima->flag |= SI_SHOW_GPENCIL;
2248 break;
2249 }
2250 case SPACE_NODE: {
2251 SpaceNode *snode = reinterpret_cast<SpaceNode *>(&sl);
2252 snode->flag |= SNODE_SHOW_GPENCIL;
2253 break;
2254 }
2255 case SPACE_CLIP: {
2256 SpaceClip *sclip = reinterpret_cast<SpaceClip *>(&sl);
2257 sclip->flag |= SC_SHOW_ANNOTATION;
2258 break;
2259 }
2260 }
2261 }
2262 }
2263 }
2264 }
2265
2266 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 265, 5)) {
2267 for (Scene &scene : bmain->scenes) {
2268 if (scene.ed) {
2270 }
2271 }
2272
2273 for (Image &image : bmain->images) {
2274 if (image.flag & IMA_DO_PREMUL) {
2275 image.alpha_mode = IMA_ALPHA_STRAIGHT;
2276 }
2277 else {
2279 }
2280 }
2281
2282 for (Tex &tex : bmain->textures) {
2283 if (tex.type == TEX_IMAGE && (tex.imaflag & TEX_USEALPHA) == 0) {
2284 Image *image = static_cast<Image *>(
2285 blo_do_versions_newlibadr(fd, &tex.id, ID_IS_LINKED(&tex), tex.ima));
2286
2287 if (image && (image->flag & IMA_DO_PREMUL) == 0) {
2288 constexpr eImage_Flag IMA_IGNORE_ALPHA = eImage_Flag(1 << 12);
2289 image->flag |= IMA_IGNORE_ALPHA;
2290 }
2291 }
2292 }
2293 }
2294 else if (!MAIN_VERSION_FILE_ATLEAST(bmain, 266, 1)) {
2295 /* texture use alpha was removed for 2.66 but added back again for 2.66a,
2296 * for compatibility all textures assumed it to be enabled */
2297 for (Tex &tex : bmain->textures) {
2298 if (tex.type == TEX_IMAGE) {
2299 tex.imaflag |= TEX_USEALPHA;
2300 }
2301 }
2302 }
2303
2304 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 265, 7)) {
2305 for (Curve &cu : bmain->curves) {
2306 if (cu.flag & (CU_FRONT | CU_BACK)) {
2307 if (cu.extrude != 0.0f || cu.bevel_radius != 0.0f) {
2308 for (Nurb &nu : cu.nurb) {
2309 int a;
2310
2311 if (nu.bezt) {
2312 BezTriple *bezt = nu.bezt;
2313 a = nu.pntsu;
2314
2315 while (a--) {
2316 bezt->radius = 1.0f;
2317 bezt++;
2318 }
2319 }
2320 else if (nu.bp) {
2321 BPoint *bp = nu.bp;
2322 a = nu.pntsu * nu.pntsv;
2323
2324 while (a--) {
2325 bp->radius = 1.0f;
2326 bp++;
2327 }
2328 }
2329 }
2330 }
2331 }
2332 }
2333 }
2334
2335 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 265, 9)) {
2336 for (Mesh &me : bmain->meshes) {
2338 }
2339 }
2340
2341 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 265, 10)) {
2342 for (Brush &br : bmain->brushes) {
2343 if (br.ob_mode & OB_MODE_TEXTURE_PAINT) {
2345 }
2346 }
2347 }
2348
2349 /* add storage for compositor translate nodes when not existing */
2350 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 265, 11)) {
2351 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2352 if (ntree->type == NTREE_COMPOSIT) {
2353 for (bNode &node : ntree->nodes) {
2354 if (node.type_legacy == CMP_NODE_TRANSLATE && node.storage == nullptr) {
2355 node.storage = MEM_new<NodeTranslateData>("node translate data");
2356 }
2357 }
2358 }
2359 }
2361 }
2362
2363 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 266, 2)) {
2364 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2365 do_versions_nodetree_customnodes(ntree, (id_cast<ID *>(ntree) == id));
2366 }
2368 }
2369
2370 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 266, 2)) {
2371 for (bScreen &screen : bmain->screens) {
2372 for (ScrArea &area : screen.areabase) {
2373 for (SpaceLink &sl : area.spacedata) {
2374 if (sl.spacetype == SPACE_NODE) {
2375 SpaceNode *snode = reinterpret_cast<SpaceNode *>(&sl);
2376
2377 /* reset pointers to force tree path update from context */
2378 snode->nodetree = nullptr;
2379 snode->edittree = nullptr;
2380 snode->id = nullptr;
2381 snode->from = nullptr;
2382
2383 /* convert deprecated treetype setting to tree_idname */
2384 switch (snode->treetype) {
2385 case NTREE_COMPOSIT:
2386 STRNCPY_UTF8(snode->tree_idname, "CompositorNodeTree");
2387 break;
2388 case NTREE_SHADER:
2389 STRNCPY_UTF8(snode->tree_idname, "ShaderNodeTree");
2390 break;
2391 case NTREE_TEXTURE:
2392 STRNCPY_UTF8(snode->tree_idname, "TextureNodeTree");
2393 break;
2394 }
2395 }
2396 }
2397 }
2398 }
2399 }
2400
2401 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 266, 3)) {
2402 {
2403 /* Fix for a very old issue:
2404 * Node names were nominally made unique in r24478 (2.50.8), but the do_versions check
2405 * to update existing node names only applied to `bmain->nodetree` (i.e. group nodes).
2406 * Uniqueness is now required for proper preview mapping,
2407 * so do this now to ensure old files don't break.
2408 */
2409 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2410 if (id == &ntree->id) {
2411 continue; /* already fixed for node groups */
2412 }
2413
2414 for (bNode &node : ntree->nodes) {
2415 bke::node_unique_name(*ntree, node);
2416 }
2417 }
2419 }
2420
2421 /* Convert the previously used ntree->inputs/ntree->outputs lists to interface nodes.
2422 * Pre 2.56.2 node trees automatically have all unlinked sockets exposed already,
2423 * see do_versions_after_linking_250.
2424 *
2425 * This assumes valid typeinfo pointers, as set in lib_link_ntree.
2426 *
2427 * NOTE: theoretically only needed in node groups (main->nodetree),
2428 * but due to a temporary bug such links could have been added in all trees,
2429 * so have to clean up all of them ...
2430 *
2431 * NOTE: this always runs, without it links with nullptr fromnode and tonode remain
2432 * which causes problems.
2433 */
2434 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2435 bNode *input_node = nullptr, *output_node = nullptr;
2436 int num_inputs = 0, num_outputs = 0;
2437 bNodeLink *link, *next_link;
2438 /* Only create new interface nodes for actual older files.
2439 * New file versions already have input/output nodes with duplicate links,
2440 * in that case just remove the invalid links.
2441 */
2442 const bool create_io_nodes = MAIN_VERSION_FILE_OLDER(bmain, 266, 2);
2443
2444 float input_locx = 1000000.0f, input_locy = 0.0f;
2445 float output_locx = -1000000.0f, output_locy = 0.0f;
2446 /* Rough guess, not nice but we don't have access to UI constants here. */
2447 const float offsetx = 42 + 3 * 20 + 20;
2448 // const float offsety = 0.0f;
2449
2450 if (create_io_nodes) {
2451 if (ntree->inputs_legacy.first()) {
2453 }
2454
2455 if (ntree->outputs_legacy.first()) {
2457 }
2458 }
2459
2460 /* Redirect links from/to the node tree interface to input/output node.
2461 * If the fromnode/tonode pointers are nullptr, this means a link from/to
2462 * the ntree interface sockets, which need to be redirected to new interface nodes.
2463 */
2464 for (link = ntree->links.first(); link != nullptr; link = next_link) {
2465 bool free_link = false;
2466 next_link = link->next;
2467
2468 if (link->fromnode == nullptr) {
2469 if (input_node) {
2470 link->fromnode = input_node;
2471 link->fromsock = node_group_input_find_socket(input_node, link->fromsock->identifier);
2472 BLI_assert(link->fromsock != nullptr);
2473 num_inputs++;
2474
2475 if (link->tonode) {
2476 input_locx = std::min(input_locx, link->tonode->locx_legacy - offsetx);
2477 input_locy += link->tonode->locy_legacy;
2478 }
2479 }
2480 else {
2481 free_link = true;
2482 }
2483 }
2484
2485 if (link->tonode == nullptr) {
2486 if (output_node) {
2487 link->tonode = output_node;
2488 link->tosock = node_group_output_find_socket(output_node, link->tosock->identifier);
2489 BLI_assert(link->tosock != nullptr);
2490 num_outputs++;
2491
2492 if (link->fromnode) {
2493 output_locx = std::max(output_locx, link->fromnode->locx_legacy + offsetx);
2494 output_locy += link->fromnode->locy_legacy;
2495 }
2496 }
2497 else {
2498 free_link = true;
2499 }
2500 }
2501
2502 if (free_link) {
2503 bke::node_remove_link(ntree, *link);
2504 }
2505 }
2506
2507 if (num_inputs > 0) {
2508 input_locy /= num_inputs;
2509 input_node->locx_legacy = input_locx;
2510 input_node->locy_legacy = input_locy;
2511 }
2512 if (num_outputs > 0) {
2513 output_locy /= num_outputs;
2514 output_node->locx_legacy = output_locx;
2515 output_node->locy_legacy = output_locy;
2516 }
2517 }
2519 }
2520
2521 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 60)) {
2522 /* From this point we no longer write incomplete links for forward
2523 * compatibility with 2.66, we have to clean them up for all previous
2524 * versions. */
2525 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2526 bNodeLink *link, *next_link;
2527
2528 for (link = ntree->links.first(); link != nullptr; link = next_link) {
2529 next_link = link->next;
2530 if (link->fromnode == nullptr || link->tonode == nullptr) {
2531 bke::node_remove_link(ntree, *link);
2532 }
2533 }
2534 }
2536 }
2537
2538 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 266, 4)) {
2539 for (Brush &brush : bmain->brushes) {
2540 BKE_texture_mtex_default(&brush.mask_mtex);
2541
2542 if (brush.ob_mode & OB_MODE_TEXTURE_PAINT) {
2543 brush.spacing /= 2;
2544 }
2545 }
2546 }
2547
2548 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 266, 6)) {
2549#define BRUSH_TEXTURE_OVERLAY (1 << 21)
2550
2551 for (Brush &brush : bmain->brushes) {
2552 brush.overlay_flags = eOverlayFlags{};
2553 if (brush.flag & BRUSH_TEXTURE_OVERLAY) {
2555 }
2556 }
2557#undef BRUSH_TEXTURE_OVERLAY
2558 }
2559
2560 if (bmain->versionfile < 267) {
2561 // if (!DNA_struct_member_exists(fd->filesdna, "Brush", "int", "stencil_pos")) {
2562 for (Brush &brush : bmain->brushes) {
2563 if (brush.stencil_dimension[0] == 0) {
2564 brush.stencil_dimension[0] = 256;
2565 brush.stencil_dimension[1] = 256;
2566 brush.stencil_pos[0] = 256;
2567 brush.stencil_pos[1] = 256;
2568 }
2569 if (brush.mask_stencil_dimension[0] == 0) {
2570 brush.mask_stencil_dimension[0] = 256;
2571 brush.mask_stencil_dimension[1] = 256;
2572 brush.mask_stencil_pos[0] = 256;
2573 brush.mask_stencil_pos[1] = 256;
2574 }
2575 }
2576
2587 }
2588
2589 /* default values in Freestyle settings */
2590 if (bmain->versionfile < 267) {
2591 for (Scene &sce : bmain->scenes) {
2592 if (sce.r.line_thickness_mode == 0) {
2594 sce.r.unit_line_thickness = 1.0f;
2595 }
2596 for (SceneRenderLayer &srl : sce.r.layers) {
2597 if (srl.freestyleConfig.mode == 0) {
2598 srl.freestyleConfig.mode = FREESTYLE_CONTROL_EDITOR_MODE;
2599 }
2600 if (ELEM(srl.freestyleConfig.raycasting_algorithm,
2603 {
2604 srl.freestyleConfig.raycasting_algorithm = 0; /* deprecated */
2605 srl.freestyleConfig.flags |= FREESTYLE_CULLING;
2606 }
2607 }
2608
2609 /* not freestyle */
2610 {
2611 MeshStatVis *statvis = &sce.toolsettings->statvis;
2612 if (statvis->thickness_samples == 0) {
2613 statvis->overhang_axis = OB_NEGZ;
2614 statvis->overhang_min = 0;
2615 statvis->overhang_max = DEG2RADF(45.0f);
2616
2617 statvis->thickness_max = 0.1f;
2618 statvis->thickness_samples = 1;
2619
2620 statvis->distort_min = DEG2RADF(5.0f);
2621 statvis->distort_max = DEG2RADF(45.0f);
2622
2623 statvis->sharp_min = DEG2RADF(90.0f);
2624 statvis->sharp_max = DEG2RADF(180.0f);
2625 }
2626 }
2627 }
2628 for (FreestyleLineStyle &linestyle : bmain->linestyles) {
2629#if 1
2630 /* disable the Misc panel for now */
2631 if (linestyle.panel == LS_PANEL_MISC) {
2632 linestyle.panel = LS_PANEL_STROKES;
2633 }
2634#endif
2635 if (linestyle.thickness_position == 0) {
2637 linestyle.thickness_ratio = 0.5f;
2638 }
2639 if (linestyle.chaining == 0) {
2640 linestyle.chaining = LS_CHAINING_PLAIN;
2641 }
2642 if (linestyle.rounds == 0) {
2643 linestyle.rounds = 3;
2644 }
2645 }
2646 }
2647
2648 if (bmain->versionfile < 267) {
2649 /* Initialize the active_viewer_key for compositing */
2650 bNodeInstanceKey active_viewer_key = {0};
2651 /* simply pick the first node space and use that for the active viewer key */
2652 for (bScreen &screen : bmain->screens) {
2653 for (ScrArea &area : screen.areabase) {
2654 for (SpaceLink &sl : area.spacedata) {
2655 if (sl.spacetype == SPACE_NODE) {
2656 SpaceNode *snode = reinterpret_cast<SpaceNode *>(&sl);
2657 bNodeTreePath *path = snode->treepath.last();
2658 if (!path) {
2659 continue;
2660 }
2661
2662 active_viewer_key = path->parent_key;
2663 break;
2664 }
2665 }
2666 if (active_viewer_key.value != 0) {
2667 break;
2668 }
2669 }
2670 if (active_viewer_key.value != 0) {
2671 break;
2672 }
2673 }
2674
2675 for (Scene &scene : bmain->scenes) {
2676 /* NOTE: `scene->nodetree` is a local ID block, has been direct_link'ed. */
2677 if (scene.nodetree) {
2678 scene.nodetree->active_viewer_key = active_viewer_key;
2679 }
2680 }
2681 }
2682
2683 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 267, 1)) {
2684 for (Object &ob : bmain->objects) {
2685 for (ModifierData &md : ob.modifiers) {
2686 if (md.type == eModifierType_Fluid) {
2687 FluidModifierData *fmd = reinterpret_cast<FluidModifierData *>(&md);
2688 if ((fmd->type & MOD_FLUID_TYPE_DOMAIN) && fmd->domain) {
2689 if (fmd->domain->flags & FLUID_DOMAIN_USE_HIGH_SMOOTH) {
2691 }
2692 else {
2694 }
2695 }
2696 }
2697 }
2698 }
2699 }
2700
2701 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 268, 1)) {
2702 for (Brush &brush : bmain->brushes) {
2703 brush.spacing = std::max(1, brush.spacing);
2704 }
2705 }
2706
2707 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 268, 2)) {
2708 constexpr eBrushFlags BRUSH_FIXED = eBrushFlags(1 << 6);
2709 for (Brush &brush : bmain->brushes) {
2710 brush.flag &= ~BRUSH_FIXED;
2711
2712 if (brush.cursor_overlay_alpha < 2) {
2713 brush.cursor_overlay_alpha = 33;
2714 }
2715 if (brush.texture_overlay_alpha < 2) {
2716 brush.texture_overlay_alpha = 33;
2717 }
2718 if (brush.mask_overlay_alpha < 2) {
2719 brush.mask_overlay_alpha = 33;
2720 }
2721 }
2722#undef BRUSH_FIXED
2723 }
2724
2725 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 268, 4)) {
2726 for (Object &ob : bmain->objects) {
2727 for (bConstraint &con : ob.constraints) {
2728 if (con.type == CONSTRAINT_TYPE_SHRINKWRAP) {
2730 if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) {
2731 data->projAxis = OB_POSX;
2732 }
2733 else if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) {
2734 data->projAxis = OB_POSY;
2735 }
2736 else {
2737 data->projAxis = OB_POSZ;
2738 }
2739 data->projAxisSpace = CONSTRAINT_SPACE_LOCAL;
2740 }
2741 }
2742 }
2743
2744 for (Object &ob : bmain->objects) {
2745 for (ModifierData &md : ob.modifiers) {
2746 if (md.type == eModifierType_Fluid) {
2747 FluidModifierData *fmd = reinterpret_cast<FluidModifierData *>(&md);
2748 if ((fmd->type & MOD_FLUID_TYPE_FLOW) && fmd->flow) {
2749 if (!fmd->flow->particle_size) {
2750 fmd->flow->particle_size = 1.0f;
2751 }
2752 }
2753 }
2754 }
2755 }
2756
2757 /*
2758 * FIX some files have a zoom level of 0, and was checked during the drawing of the node space
2759 *
2760 * We moved this check to the do versions to be sure the value makes any sense.
2761 */
2762 for (bScreen &screen : bmain->screens) {
2763 for (ScrArea &area : screen.areabase) {
2764 for (SpaceLink &sl : area.spacedata) {
2765 if (sl.spacetype == SPACE_NODE) {
2766 SpaceNode *snode = reinterpret_cast<SpaceNode *>(&sl);
2767 if (snode->zoom < 0.02f) {
2768 snode->zoom = 1.0;
2769 }
2770 }
2771 }
2772 }
2773 }
2774 }
2775
2776 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 268, 5)) {
2777 /* add missing (+) expander in node editor */
2778 for (bScreen &screen : bmain->screens) {
2779 for (ScrArea &area : screen.areabase) {
2780 if (area.spacetype == SPACE_NODE) {
2782
2783 if (region) {
2784 continue;
2785 }
2786
2787 /* add subdiv level; after header */
2789
2790 /* is error! */
2791 if (region == nullptr) {
2792 continue;
2793 }
2794
2795 ARegion *arnew = BKE_area_region_new();
2796
2797 BLI_insertlinkafter(&area.regionbase, region, arnew);
2798 arnew->regiontype = RGN_TYPE_TOOLS;
2799 arnew->alignment = RGN_ALIGN_LEFT;
2800
2801 arnew->flag = RGN_FLAG_HIDDEN;
2802 }
2803 }
2804 }
2805 }
2806
2807 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 269, 1)) {
2808 /* Removal of Cycles SSS Compatible falloff */
2809 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2810 if (ntree->type == NTREE_SHADER) {
2811 for (bNode &node : ntree->nodes) {
2812 if (node.type_legacy == SH_NODE_SUBSURFACE_SCATTERING) {
2813 if (node.custom1 == SHD_SUBSURFACE_COMPATIBLE) {
2814 node.custom1 = SHD_SUBSURFACE_CUBIC;
2815 }
2816 }
2817 }
2818 }
2819 }
2821 }
2822
2823 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 269, 2)) {
2824 /* Initialize CDL settings for Color Balance nodes */
2825 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2826 if (ntree->type == NTREE_COMPOSIT) {
2827 for (bNode &node : ntree->nodes) {
2828 if (node.type_legacy == CMP_NODE_COLORBALANCE) {
2830 NodeColorBalance *n = static_cast<NodeColorBalance *>(node.storage);
2831 if (node.custom1 == 0) {
2832 /* LGG mode stays the same, just init CDL settings */
2834 }
2835 else if (node.custom1 == 1) {
2836 /* CDL previously used same variables as LGG, copy them over
2837 * and then sync LGG for comparable results in both modes.
2838 */
2839 copy_v3_v3(n->offset, n->lift);
2840 copy_v3_v3(n->power, n->gamma);
2841 copy_v3_v3(n->slope, n->gain);
2843 }
2844 }
2845 }
2846 }
2847 }
2848 }
2850 }
2851
2852 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 269, 3)) {
2853 /* Update files using invalid (outdated) outlinevis Outliner values. */
2854 for (bScreen &screen : bmain->screens) {
2855 for (ScrArea &area : screen.areabase) {
2856 for (SpaceLink &sl : area.spacedata) {
2857 if (sl.spacetype == SPACE_OUTLINER) {
2858 SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(&sl);
2859
2860 if (!ELEM(
2862 {
2863 space_outliner->outlinevis = SO_SCENES;
2864 }
2865 }
2866 }
2867 }
2868 }
2869
2870 if (!DNA_struct_member_exists(fd->filesdna, "MovieTrackingTrack", "float", "weight")) {
2871 for (MovieClip &clip : bmain->movieclips) {
2872 const MovieTracking *tracking = &clip.tracking;
2873 for (MovieTrackingObject &tracking_object : tracking->objects) {
2874 const ListBaseT<MovieTrackingTrack> *tracksbase = (tracking_object.flag &
2876 &tracking->tracks_legacy :
2877 &tracking_object.tracks;
2878 for (MovieTrackingTrack &track : *tracksbase) {
2879 track.weight = 1.0f;
2880 }
2881 }
2882 }
2883 }
2884
2885 if (!DNA_struct_member_exists(fd->filesdna, "TriangulateModifierData", "int", "quad_method")) {
2886 for (Object &ob : bmain->objects) {
2887 for (ModifierData &md : ob.modifiers) {
2888 if (md.type == eModifierType_Triangulate) {
2889 TriangulateModifierData *tmd = reinterpret_cast<TriangulateModifierData *>(&md);
2890 if (tmd->flag & MOD_TRIANGULATE_BEAUTY) {
2893 }
2894 else {
2897 }
2898 }
2899 }
2900 }
2901 }
2902
2903 for (Scene &scene : bmain->scenes) {
2904 /* this can now be turned off */
2905 ToolSettings *ts = scene.toolsettings;
2906 if (ts->sculpt) {
2908 }
2909
2910 /* 'Increment' mode disabled for nodes, use true grid snapping instead */
2911 if (scene.toolsettings->snap_node_mode == 0) { /* SCE_SNAP_TO_INCREMENT */
2912 scene.toolsettings->snap_node_mode = 8; /* SCE_SNAP_TO_GRID */
2913 }
2914
2915 /* Update for removed "sound-only" option in FFMPEG export settings. */
2916 if (scene.r.ffcodecdata.type >= FFMPEG_INVALID) {
2917 scene.r.ffcodecdata.type = FFMPEG_AVI;
2918 }
2919 }
2920 }
2921
2922 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 269, 4)) {
2923 /* Internal degrees to radians conversions... */
2924 {
2925 for (Light &la : bmain->lights) {
2926 la.spotsize = DEG2RADF(la.spotsize);
2927 }
2928
2929 for (Object &ob : bmain->objects) {
2930 for (ModifierData &md : ob.modifiers) {
2931 if (md.type == eModifierType_EdgeSplit) {
2932 EdgeSplitModifierData *emd = reinterpret_cast<EdgeSplitModifierData *>(&md);
2933 emd->split_angle = DEG2RADF(emd->split_angle);
2934 }
2935 else if (md.type == eModifierType_Bevel) {
2936 BevelModifierData *bmd = reinterpret_cast<BevelModifierData *>(&md);
2937 bmd->bevel_angle = DEG2RADF(bmd->bevel_angle);
2938 }
2939 }
2940 }
2941
2942 for (Scene &scene : bmain->scenes) {
2943 if (scene.ed) {
2945 }
2946 }
2947
2948 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2949 if (ntree->type == NTREE_COMPOSIT) {
2950 for (bNode &node : ntree->nodes) {
2951 if (node.type_legacy == CMP_NODE_BOKEHIMAGE) {
2953 NodeBokehImage *n = static_cast<NodeBokehImage *>(node.storage);
2954 n->angle = DEG2RADF(n->angle);
2955 }
2956 }
2957 if (node.type_legacy == CMP_NODE_MASK_BOX) {
2959 NodeBoxMask *n = static_cast<NodeBoxMask *>(node.storage);
2960 n->rotation = DEG2RADF(n->rotation);
2961 }
2962 }
2963 if (node.type_legacy == CMP_NODE_MASK_ELLIPSE) {
2965 NodeEllipseMask *n = static_cast<NodeEllipseMask *>(node.storage);
2966 n->rotation = DEG2RADF(n->rotation);
2967 }
2968 }
2969 }
2970 }
2971 }
2973 }
2974
2975 if (!DNA_struct_member_exists(
2976 fd->filesdna, "MovieTrackingPlaneTrack", "float", "image_opacity"))
2977 {
2978 for (MovieClip &clip : bmain->movieclips) {
2979 for (MovieTrackingPlaneTrack &plane_track : clip.tracking.plane_tracks_legacy) {
2980 plane_track.image_opacity = 1.0f;
2981 }
2982 }
2983 }
2984 }
2985
2986 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 269, 7)) {
2987 for (Scene &scene : bmain->scenes) {
2988 Sculpt *sd = scene.toolsettings->sculpt;
2989
2990 if (sd) {
2991 enum {
2992 SCULPT_SYMM_X = (1 << 0),
2993 SCULPT_SYMM_Y = (1 << 1),
2994 SCULPT_SYMM_Z = (1 << 2),
2995 SCULPT_SYMMETRY_FEATHER = (1 << 6),
2996 };
2997 int symmetry_flags = sd->flags & 7;
2998
2999 if (symmetry_flags & SCULPT_SYMM_X) {
3001 }
3002 if (symmetry_flags & SCULPT_SYMM_Y) {
3004 }
3005 if (symmetry_flags & SCULPT_SYMM_Z) {
3007 }
3008 if (symmetry_flags & SCULPT_SYMMETRY_FEATHER) {
3010 }
3011 }
3012 }
3013 }
3014
3015 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 269, 8)) {
3016 for (Curve &cu : bmain->curves) {
3017 if (cu.str) {
3019 }
3020 }
3021 }
3022
3023 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 269, 9)) {
3024 for (Object &ob : bmain->objects) {
3025 for (ModifierData &md : ob.modifiers) {
3026 if (md.type == eModifierType_Build) {
3027 BuildModifierData *bmd = reinterpret_cast<BuildModifierData *>(&md);
3028 if (bmd->randomize) {
3030 }
3031 }
3032 }
3033 }
3034 }
3035
3036 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 269, 11)) {
3037 for (bScreen &screen : bmain->screens) {
3038 for (ScrArea &area : screen.areabase) {
3039 for (SpaceLink &space_link : area.spacedata) {
3040 if (space_link.spacetype == SPACE_IMAGE) {
3041 ListBaseT<ARegion> *lb;
3042
3043 if (&space_link == area.spacedata.first_) {
3044 lb = &area.regionbase;
3045 }
3046 else {
3047 lb = &space_link.regionbase;
3048 }
3049
3050 for (ARegion &region : *lb) {
3051 if (region.regiontype == RGN_TYPE_PREVIEW) {
3052 region.regiontype = RGN_TYPE_TOOLS;
3053 region.alignment = RGN_ALIGN_LEFT;
3054 }
3055 else if (region.regiontype == RGN_TYPE_UI) {
3056 region.alignment = RGN_ALIGN_RIGHT;
3057 }
3058 }
3059 }
3060 }
3061 }
3062 }
3063 }
3064}
3065
3067
3068} // namespace blender
CustomData interface, see also DNA_customdata_types.h.
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
Definition BKE_main.hh:949
#define MAIN_VERSION_FILE_OLDER(main, ver, subver)
Definition BKE_main.hh:953
#define NODE_REROUTE
Definition BKE_node.hh:867
#define NODE_GROUP_OUTPUT
Definition BKE_node.hh:869
#define FOREACH_NODETREE_END
Definition BKE_node.hh:936
#define NODE_GROUP
Definition BKE_node.hh:865
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition BKE_node.hh:926
#define NODE_FRAME
Definition BKE_node.hh:866
#define NODE_GROUP_INPUT
Definition BKE_node.hh:868
#define SH_NODE_TEX_NOISE
#define SH_NODE_MIX_SHADER
#define CMP_NODE_PREMULKEY
#define CMP_NODE_MASK
#define CMP_NODE_SCALE
#define SH_NODE_HOLDOUT
#define SH_NODE_MIX_RGB_LEGACY
#define TEX_NODE_COORD
#define SH_NODE_TEX_GRADIENT
#define SH_NODE_COMBRGB_LEGACY
#define TEX_NODE_DISTANCE
#define SH_NODE_SQUEEZE
#define CMP_NODE_MATH_DEPRECATED
#define CMP_NODE_VECBLUR
#define CMP_NODE_SEPHSVA_LEGACY
#define CMP_NODE_VALUE_DEPRECATED
#define CMP_NODE_TIME
#define SH_NODE_HUE_SAT
#define SH_NODE_INVERT
#define CMP_NODE_COLOR_SPILL
#define SH_NODE_TEX_MAGIC
#define SH_NODE_OUTPUT_WORLD
#define SH_NODE_NORMAL
#define SH_NODE_BRIGHTCONTRAST
#define CMP_NODE_DESPECKLE
#define CMP_NODE_VIEWER
#define CMP_NODE_LUMA_MATTE
#define SH_NODE_TEX_WAVE
#define CMP_NODE_KEYINGSCREEN
#define CMP_NODE_MASK_ELLIPSE
#define CMP_NODE_DISPLACE
#define SH_NODE_TEX_IMAGE
#define CMP_NODE_COMBYCCA_LEGACY
#define CMP_NODE_RGBTOBW
#define SH_NODE_EMISSION
#define CMP_NODE_SEPRGBA_LEGACY
#define CMP_NODE_BILATERALBLUR
#define CMP_NODE_TRANSLATE
#define TEX_NODE_ROTATE
#define CMP_NODE_MOVIEDISTORTION
#define CMP_NODE_TONEMAP
#define SH_NODE_ADD_SHADER
#define CMP_NODE_MAP_RANGE_DEPRECATED
#define SH_NODE_LAYER_WEIGHT
#define SH_NODE_SUBSURFACE_SCATTERING
#define CMP_NODE_INPAINT
#define CMP_NODE_COLORBALANCE
#define TEX_NODE_DECOMPOSE_LEGACY
#define CMP_NODE_HUE_SAT
#define SH_NODE_FRESNEL
#define CMP_NODE_BOKEHIMAGE
#define SH_NODE_TEX_BRICK
#define SH_NODE_SEPRGB_LEGACY
#define CMP_NODE_COMBYUVA_LEGACY
#define SH_NODE_TEX_COORD
#define CMP_NODE_ROTATE
#define SH_NODE_BUMP
#define TEX_NODE_BRICKS
#define CMP_NODE_FILTER
#define CMP_NODE_DIFF_MATTE
#define SH_NODE_VECTOR_MATH
#define SH_NODE_TEX_ENVIRONMENT
#define SH_NODE_NORMAL_MAP
#define SH_NODE_VALUE
#define SH_NODE_CURVE_VEC
#define CMP_NODE_ALPHAOVER
#define CMP_NODE_MAP_VALUE_DEPRECATED
#define TEX_NODE_SCALE
#define TEX_NODE_TRANSLATE
#define CMP_NODE_HUECORRECT
#define TEX_NODE_AT
#define CMP_NODE_SEPYUVA_LEGACY
#define TEX_NODE_VALTONOR
#define SH_NODE_MATH
#define CMP_NODE_COMBHSVA_LEGACY
#define CMP_NODE_CROP
#define TEX_NODE_TEXTURE
#define SH_NODE_TANGENT
#define CMP_NODE_CHROMA_MATTE
#define CMP_NODE_GLARE
#define SH_NODE_BSDF_TRANSPARENT
#define CMP_NODE_MOVIECLIP
#define TEX_NODE_INVERT
#define CMP_NODE_TRANSFORM
#define CMP_NODE_DILATEERODE
#define SH_NODE_BSDF_DIFFUSE
#define SH_NODE_GAMMA
#define SH_NODE_HAIR_INFO
#define SH_NODE_AMBIENT_OCCLUSION
#define CMP_NODE_ID_MASK
#define TEX_NODE_CHECKER
#define CMP_NODE_BOKEHBLUR
#define TEX_NODE_COMPOSE_LEGACY
#define CMP_NODE_LENSDIST
#define TEX_NODE_RGBTOBW
#define CMP_NODE_NORMALIZE
#define CMP_NODE_ZCOMBINE
#define CMP_NODE_MAP_UV
#define SH_NODE_TEX_SKY
#define CMP_NODE_TRACKPOS
#define SH_NODE_OUTPUT_MATERIAL
#define TEX_NODE_IMAGE
#define CMP_NODE_MIX_RGB_DEPRECATED
#define CMP_NODE_OUTPUT_FILE
#define CMP_NODE_COLORCORRECTION
#define SH_NODE_BSDF_TRANSLUCENT
#define CMP_NODE_SETALPHA
#define SH_NODE_BACKGROUND
#define SH_NODE_BSDF_RAY_PORTAL
#define CMP_NODE_CURVE_RGB
#define CMP_NODE_DOUBLEEDGEMASK
#define CMP_NODE_GAMMA_DEPRECATED
#define SH_NODE_TEX_CHECKER
#define SH_NODE_TEX_VORONOI
#define CMP_NODE_VALTORGB_DEPRECATED
#define SH_NODE_CAMERA
#define CMP_NODE_STABILIZE2D
#define SH_NODE_OBJECT_INFO
#define SH_NODE_TEX_MUSGRAVE_DEPRECATED
#define CMP_NODE_PIXELATE
#define SH_NODE_RGB
#define SH_NODE_MAPPING
#define SH_NODE_VALTORGB
#define CMP_NODE_SWITCH
#define SH_NODE_CURVE_RGB
#define CMP_NODE_COMBRGBA_LEGACY
#define CMP_NODE_COMPOSITE_DEPRECATED
#define CMP_NODE_RGB
#define CMP_NODE_MASK_BOX
#define CMP_NODE_SPLITVIEWER__DEPRECATED
#define TEX_NODE_OUTPUT
#define CMP_NODE_DEFOCUS
#define CMP_NODE_TEXTURE_DEPRECATED
#define TEX_NODE_CURVE_TIME
#define CMP_NODE_KEYING
#define TEX_NODE_VIEWER
#define SH_NODE_LIGHT_FALLOFF
#define SH_NODE_BSDF_GLASS
#define CMP_NODE_R_LAYERS
#define SH_NODE_NEW_GEOMETRY
#define CMP_NODE_SEPYCCA_LEGACY
#define CMP_NODE_INVERT
#define SH_NODE_PARTICLE_INFO
#define TEX_NODE_MATH
#define CMP_NODE_COLOR_MATTE
#define CMP_NODE_DIST_MATTE
#define CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED
#define SH_NODE_BSDF_REFRACTION
#define CMP_NODE_IMAGE
#define TEX_NODE_PROC
#define CMP_NODE_NORMAL
#define CMP_NODE_DBLUR
#define CMP_NODE_VIEW_LEVELS
#define CMP_NODE_CURVE_VEC_DEPRECATED
#define SH_NODE_OUTPUT_LIGHT
#define TEX_NODE_HUE_SAT
#define CMP_NODE_BLUR
#define TEX_NODE_MIX_RGB
#define SH_NODE_RGBTOBW
#define TEX_NODE_VALTORGB
#define SH_NODE_SCRIPT
#define CMP_NODE_BRIGHTCONTRAST
#define CMP_NODE_FLIP
#define TEX_NODE_CURVE_RGB
#define CMP_NODE_CHANNEL_MATTE
#define SH_NODE_ATTRIBUTE
#define SH_NODE_LIGHT_PATH
#define DEG2RADF(_deg)
#define FILE_MAXFILE
#define FILE_MAX
#define FILE_MAXDIR
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
external readfile function prototypes.
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:697
#define DEFAULT_SENSOR_HEIGHT
#define DEFAULT_SENSOR_WIDTH
blenloader genfile private function prototypes
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define POINTER_AS_INT(i)
#define ELEM(...)
#define output
UString()=default
const T & data(const Action &owning_action) const
#define offsetof(t, d)
#define layer
ccl_device_inline int4 srl(const int4 a, const int i)
Definition math_int4.h:205
void settings_init(struct bAnimVizSettings *avs)
void node_remove_socket(bNodeTree &ntree, bNode &node, bNodeSocket &sock)
Definition node.cc:4015
void node_unique_id(bNodeTree &ntree, bNode &node)
Definition node.cc:4244
void node_remove_link(bNodeTree *ntree, bNodeLink &link)
Definition node.cc:4676
bNodeSocket * node_add_static_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, int type, int subtype, StringRefNull identifier, StringRefNull name)
Definition node.cc:3980
std::optional< StringRefNull > node_static_socket_type(int type, int subtype, std::optional< int > dimensions=std::nullopt)
Definition node.cc:3492
void node_unique_name(bNodeTree &ntree, bNode &node)
Definition node.cc:4238
std::string filename(const std::string_view &str, size_t pos)
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
Definition iterator.cc:60
StripModifierData * modifier_new(Strip *strip, const char *name, eStripModifierType type)
void alpha_mode_from_file_extension(Strip *strip)
BMesh Iterators.
bool version_node_ensure_storage_or_invalidate(bNode &node)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE bool is_zero_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
static bool unique_path_unique_check(ListBaseT< bNodeSocket > *lb, bNodeSocket *sock, const StringRef name)
char * STRNCPY(char(&dst)[N], const char *src)
static void do_versions_nodetree_multi_file_output_path_2_63_1(bNodeTree *ntree)
static bool strip_set_wipe_angle_cb(Strip *strip, void *)
static void ntreeCompositOutputFileUniqueLayer(ListBaseT< bNodeSocket > *list, bNodeSocket *sock, const char defname[], char delim)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BKE_ntree_update_tag_socket_new(bNodeTree *ntree, bNodeSocket *socket)
bool CustomData_free_layers(CustomData *data, eCustomDataType type)
MovieTrackingObject * BKE_tracking_object_add(MovieTracking *tracking, const char *name)
Definition tracking.cc:1902
int txt_extended_ascii_as_utf8(char **str)
Definition text.cc:297
static bool strip_colorbalance_update_cb(Strip *strip, void *)
void * blo_do_versions_newlibadr(FileData *fd, ID *self_id, const bool is_linked_only, const void *adr)
Definition readfile.cc:1534
void blo_do_versions_key_uidgen(Key *key)
Definition readfile.cc:2493
MINLINE void copy_v2_v2(float r[2], const float a[2])
bNodeSocket * node_group_output_find_socket(bNode *node, const StringRef identifier)
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:986
void BKE_scene_disable_color_management(Scene *scene)
Definition scene.cc:3117
@ eModifierType_Triangulate
@ eModifierType_DynamicPaint
static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNodeTree *ntree)
@ V3D_AROUND_CENTER_MEDIAN
void BKE_mesh_do_versions_cd_flag_init(Mesh *mesh)
static const char * node_get_static_idname(int type, int treetype)
@ R_IMF_COLOR_MANAGEMENT_FOLLOW_SCENE
void do_versions_after_linking_260(Main *bmain)
static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *mesh)
@ V3D_SHOW_RECONSTRUCTION
@ SCULPT_BRUSH_TYPE_ROTATE
@ R_IMF_FLAG_PREVIEW_JPG
size_t void BLI_uniquename_cb(FunctionRef< bool(StringRefNull)> unique_check, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(2
void version_node_socket_identifier_set(bNodeSocket &socket, const StringRefNull identifier)
@ R_IMF_IMTYPE_MULTILAYER
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:541
void BLI_uniquename(const ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:593
@ UVCALC_UNWRAP_METHOD_ANGLE
void * MEM_dupalloc_void(const void *vmemh) ATTR_WARN_UNUSED_RESULT
@ OB_MODE_TEXTURE_PAINT
BMesh const char void * data
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:339
@ R_IMF_JP2_FLAG_CINE_PRESET
@ R_IMF_JP2_FLAG_CINE_48
@ SEQ_PREVIEW_SHOW_GPENCIL
@ FFMPEG_INVALID
Definition MOV_enums.hh:25
@ FFMPEG_AVI
Definition MOV_enums.hh:17
static bNodeSocket * ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, const char *name, const ImageFormatData *im_format)
void BKE_texture_mtex_default(struct MTex *mtex)
Definition texture.cc:381
void BKE_ntree_update_tag_socket_type(bNodeTree *ntree, bNodeSocket *socket)
@ SCULPT_DYNTOPO_SUBDIVIDE
void unit_m4(float m[4][4])
static void color_balance_node_lgg_from_cdl(bNode *node)
static void color_balance_node_cdl_from_lgg(bNode *node)
ARegion * BKE_area_region_new()
Definition screen.cc:522
void BKE_image_format_init(ImageFormatData *imf)
@ MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS
@ MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS
static bNode * version_add_group_in_out_node(bNodeTree *ntree, const int type)
@ R_LINE_THICKNESS_ABSOLUTE
bool BKE_imtype_is_movie(char imtype)
static void do_versions_image_settings_2_60(Scene *sce)
ARegion * BKE_area_find_region_type(const ScrArea *area, int region_type)
Definition screen.cc:1024
static void do_versions_nodetree_file_output_layers_2_64_5(bNodeTree *ntree)
static void ntreeCompositOutputFileUniquePath(ListBaseT< bNodeSocket > *list, bNodeSocket *sock, const char defname[], char delim)
static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
@ R_IMF_CINEON_FLAG_LOG
static StringRefNull node_socket_get_static_idname(bNodeSocket *sock)
void CustomData_update_typemap(CustomData *data)
static void do_versions_nodetree_customnodes(bNodeTree *ntree, int)
void blo_do_versions_260(FileData *fd, Library *lib, Main *bmain)
void BLI_path_split_dir_file(const char *filepath, char *dir, size_t dir_maxncpy, char *file, size_t file_maxncpy) ATTR_NONNULL(1
void BKE_image_alpha_mode_from_extension(Image *image)
@ TRACK_MOTION_MODEL_TRANSLATION
@ FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE
@ FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL
static void do_versions_nodetree_convert_angle(bNodeTree *ntree)
eUnifiedPaintSettingsFlags
@ UNIFIED_PAINT_WEIGHT_DEPRECATED
static void do_versions_nodetree_frame_2_64_6(bNodeTree *ntree)
size_t BLI_strlen_utf8(const char *strc) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
@ BRUSH_OVERLAY_PRIMARY
void BKE_image_format_update_color_space_for_type(ImageFormatData *format)
bNodeSocket * node_group_input_find_socket(bNode *node, const StringRef identifier)
static bool unique_layer_unique_check(ListBaseT< bNodeSocket > *lb, bNodeSocket *sock, const StringRef name)
static void do_versions_nodetree_image_default_alpha_output(bNodeTree *ntree)
@ eSeqModifierType_ColorBalance
@ PAINT_SYMMETRY_FEATHER
static bNodeSocket * version_make_socket_stub(const char *idname, eNodeSocketDatatype type, eNodeSocketInOut in_out, const char *identifier, const char *name, const void *default_value, const IDProperty *prop)
static bool strip_set_alpha_mode_cb(Strip *strip, void *)
void BKE_image_format_copy(ImageFormatData *imf_dst, const ImageFormatData *imf_src)
static void do_versions_affine_tracker_track(MovieTrackingTrack *track)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
static void do_versions_nodetree_image_layer_2_64_5(bNodeTree *ntree)
void BKE_ntree_update_tag_node_new(bNodeTree *ntree, bNode *node)
@ FREESTYLE_CONTROL_EDITOR_MODE
eRegion_Alignment alignment
eRegion_Type regiontype
struct ClothSimSettings * sim_parms
DNA_DEPRECATED float vel_damping
ListBaseT< Nurb > nurb
ListBaseT< DynamicPaintSurface > surfaces
struct DynamicPaintCanvasSettings * canvas
eDynamicPaint_SurfaceFlags flags
struct DynamicPaintSurface * next
ListBaseT< Strip > seqbase
eFFMpegAudioChannels audio_channels
std::unique_ptr< SDNA > filesdna
Definition readfile.hh:111
eFluidDomain_HighresSampling highres_sampling
struct FluidFlowSettings * flow
struct FluidDomainSettings * domain
struct FluidsimSettings * fss
eLineStyle_ThicknessPosition thickness_position
eMTex_BrushMapMode brush_map_mode
ListBaseT< Key > shapekeys
Definition BKE_main.hh:398
ListBaseT< bNodeTree > nodetrees
Definition BKE_main.hh:409
ListBaseT< Camera > cameras
Definition BKE_main.hh:397
ListBaseT< FreestyleLineStyle > linestyles
Definition BKE_main.hh:421
ListBaseT< Text > texts
Definition BKE_main.hh:402
ListBaseT< Light > lights
Definition BKE_main.hh:396
ListBaseT< World > worlds
Definition BKE_main.hh:399
short versionfile
Definition BKE_main.hh:269
ListBaseT< MovieClip > movieclips
Definition BKE_main.hh:419
ListBaseT< Brush > brushes
Definition BKE_main.hh:410
ListBaseT< Material > materials
Definition BKE_main.hh:392
ListBaseT< Object > objects
Definition BKE_main.hh:388
short subversionfile
Definition BKE_main.hh:270
ListBaseT< Curve > curves
Definition BKE_main.hh:390
ListBaseT< Mesh > meshes
Definition BKE_main.hh:389
ListBaseT< ParticleSettings > particles
Definition BKE_main.hh:411
ListBaseT< Image > images
Definition BKE_main.hh:394
ListBaseT< Scene > scenes
Definition BKE_main.hh:386
ListBaseT< Tex > textures
Definition BKE_main.hh:393
ListBaseT< bScreen > screens
Definition BKE_main.hh:400
CustomData vert_data
eMovieClipProxy_Size build_size_flag
struct MovieTracking tracking
struct MovieTrackingObject * next
ListBaseT< MovieTrackingTrack > tracks
TrackingMotionModel default_motion_model
struct MovieTrackingTrack * next
MovieTrackingMarker * markers
ListBaseT< MovieTrackingPlaneTrack > plane_tracks_legacy
MovieTrackingCamera camera
ListBaseT< MovieTrackingTrack > tracks_legacy
MovieTrackingSettings settings
ListBaseT< MovieTrackingObject > objects
DNA_DEPRECATED float angle
DNA_DEPRECATED float rotation
DNA_DEPRECATED float t2
DNA_DEPRECATED float t1
DNA_DEPRECATED float slope[3]
DNA_DEPRECATED float offset[3]
DNA_DEPRECATED float power[3]
DNA_DEPRECATED float gain[3]
DNA_DEPRECATED float gamma[3]
DNA_DEPRECATED float lift[3]
DNA_DEPRECATED float spin
DNA_DEPRECATED float angle
DNA_DEPRECATED float rotation
DNA_DEPRECATED float angle_ofs
ImageFormatData im_format
DNA_DEPRECATED char path[1024]
DNA_DEPRECATED short use_render_format
DNA_DEPRECATED ImageFormatData format
BezTriple * bezt
ListBaseT< ModifierData > modifiers
unsigned short col_group
unsigned short col_mask
ListBaseT< bConstraint > constraints
eObject_BoundType collision_boundtype
DNA_DEPRECATED float dsize[3]
struct bPose * pose
eObject_BoundType boundtype
ePaintSymmetryFlags symmetry_flags
eParticleRotationMode rotmode
DNA_DEPRECATED int tiley
ListBaseT< SceneRenderLayer > layers
DNA_DEPRECATED short quality
DNA_DEPRECATED short subimtype
DNA_DEPRECATED int tilex
ImageFormatData im_format
struct FFMpegCodecData ffcodecdata
DNA_DEPRECATED short color_mode
DNA_DEPRECATED short imtype
struct Editing * ed
ListBaseT< struct KeyingSet > keyingsets
ColorManagedDisplaySettings display_settings
DNA_DEPRECATED struct bNodeTree * nodetree
struct RenderData r
struct ToolSettings * toolsettings
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
eSpaceSeq_SequencerPreviewOverlay_Flag flag
eSpaceClip_Flag flag
eSpaceClip_View view
struct MovieClipScopes scopes
eView3D_Around around
eSpaceImage_Flag flag
DNA_DEPRECATED int treetype
struct bNodeTree * edittree
struct bNodeTree * nodetree
ListBaseT< bNodeTreePath > treepath
eSpaceNode_Flag flag
eSpaceOutliner_Mode outlinevis
struct SequencerPreviewOverlay preview_overlay
struct Image * ima
eTex_ImaFlag imaflag
struct bNodeTree * nodetree
DNA_DEPRECATED struct UnifiedPaintSettings unified_paint_settings
DNA_DEPRECATED short sculpt_paint_settings
struct MeshStatVis statvis
DNA_DEPRECATED float sculpt_paint_unified_alpha
eTool_Unwrapper unwrapper
DNA_DEPRECATED float sculpt_paint_unified_unprojected_radius
DNA_DEPRECATED int sculpt_paint_unified_size
TriangulateModifierQuadMethod quad_method
TriangulateModifierNgonMethod ngon_method
eUnifiedPaintSettingsFlags flag
eView3D_Flag2 flag2
eNodeSocketDatatype type
struct bNodeLink * link
bke::bNodeSocketRuntime * runtime
eNodeSocketInOut in_out
bNodeInstanceKey parent_key
ListBaseT< bNodeLink > links
DNA_DEPRECATED ListBaseT< bNodeSocket > outputs_legacy
bke::bNodeTreeType * typeinfo
DNA_DEPRECATED ListBaseT< bNodeSocket > inputs_legacy
eNodeTree_Type type
bNodeInstanceKey active_viewer_key
ListBaseT< bNode > nodes
bAnimVizSettings avs
ListBaseT< struct ScrArea > areabase
#define CLANG_FORMAT_NOP_WORKAROUND
#define BRUSH_TEXTURE_OVERLAY