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