Blender  V2.93
versioning_260.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "BLI_utildefines.h"
22 
23 /* allow readfile to use deprecated functionality */
24 #define DNA_DEPRECATED_ALLOW
25 
26 #include "DNA_anim_types.h"
27 #include "DNA_brush_types.h"
28 #include "DNA_camera_types.h"
29 #include "DNA_cloth_types.h"
30 #include "DNA_constraint_types.h"
31 #include "DNA_dynamicpaint_types.h"
32 #include "DNA_fluid_types.h"
33 #include "DNA_genfile.h"
34 #include "DNA_key_types.h"
35 #include "DNA_light_types.h"
36 #include "DNA_linestyle_types.h"
37 #include "DNA_material_types.h"
38 #include "DNA_mesh_types.h"
39 #include "DNA_meshdata_types.h"
41 #include "DNA_object_types.h"
42 #include "DNA_screen_types.h"
43 #include "DNA_sdna_types.h"
44 #include "DNA_space_types.h"
45 #include "DNA_text_types.h"
46 #include "DNA_view3d_types.h"
47 #include "DNA_world_types.h"
48 
49 #include "MEM_guardedalloc.h"
50 
51 #include "BLI_blenlib.h"
52 #include "BLI_math.h"
53 #include "BLI_string_utils.h"
54 
55 #include "BLT_translation.h"
56 
57 #include "BKE_anim_visualization.h"
58 #include "BKE_image.h"
59 #include "BKE_main.h" /* for Main */
60 #include "BKE_mesh.h" /* for ME_ defines (patching) */
61 #include "BKE_modifier.h"
62 #include "BKE_particle.h"
63 #include "BKE_pointcache.h"
64 #include "BKE_scene.h"
65 #include "BKE_screen.h"
66 #include "BKE_text.h" /* for txt_extended_ascii_as_utf8 */
67 #include "BKE_texture.h"
68 #include "BKE_tracking.h"
69 
70 #include "SEQ_iterator.h"
71 #include "SEQ_modifier.h"
72 #include "SEQ_utils.h"
73 
74 #ifdef WITH_FFMPEG
75 # include "BKE_writeffmpeg.h"
76 #endif
77 
78 #include "IMB_imbuf.h" /* for proxy / time-code versioning stuff. */
79 
80 #include "NOD_common.h"
81 #include "NOD_texture.h"
82 
83 #include "BLO_readfile.h"
84 
85 #include "readfile.h"
86 
87 /* Make preferences read-only, use versioning_userdef.c. */
88 #define U (*((const UserDef *)&U))
89 
91 {
92  bNode *node;
93  bNodeSocket *sock;
94 
95  for (node = ntree->nodes.first; node; node = node->next) {
97  /* default Image output value should have 0 alpha */
98  sock = node->outputs.first;
99  ((bNodeSocketValueRGBA *)(sock->default_value))->value[3] = 0.0f;
100  }
101  }
102 }
103 
105 {
106  bNode *node;
107  for (node = ntree->nodes.first; node; node = node->next) {
108  if (node->type == CMP_NODE_ROTATE) {
109  /* Convert degrees to radians. */
110  bNodeSocket *sock = ((bNodeSocket *)node->inputs.first)->next;
111  ((bNodeSocketValueFloat *)sock->default_value)->value = DEG2RADF(
112  ((bNodeSocketValueFloat *)sock->default_value)->value);
113  }
114  else if (node->type == CMP_NODE_DBLUR) {
115  /* Convert degrees to radians. */
116  NodeDBlurData *ndbd = node->storage;
117  ndbd->angle = DEG2RADF(ndbd->angle);
118  ndbd->spin = DEG2RADF(ndbd->spin);
119  }
120  else if (node->type == CMP_NODE_DEFOCUS) {
121  /* Convert degrees to radians. */
122  NodeDefocus *nqd = 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 == CMP_NODE_CHROMA_MATTE) {
128  /* Convert degrees to radians. */
129  NodeChroma *ndc = node->storage;
130  ndc->t1 = DEG2RADF(ndc->t1);
131  ndc->t2 = DEG2RADF(ndc->t2);
132  }
133  else if (node->type == CMP_NODE_GLARE) {
134  /* Convert degrees to radians. */
135  NodeGlare *ndg = 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 == SH_NODE_MAPPING) {
144  /* Convert degrees to radians. */
145  TexMapping *tmap = 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 */
184  imf->depth = R_IMF_CHAN_DEPTH_8;
185 
186  /* openexr */
187  imf->exr_codec = rd->quality & 7; /* strange but true! 0-4 are valid values, OPENEXR_COMPRESS */
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  if (rd->subimtype & R_OPENEXR_ZBUF) {
196  imf->flag |= R_IMF_FLAG_ZBUF;
197  }
198  break;
199  case R_IMF_IMTYPE_TIFF:
200  if (rd->subimtype & R_TIFF_16BIT) {
201  imf->depth = R_IMF_CHAN_DEPTH_16;
202  }
203  break;
204  case R_IMF_IMTYPE_JP2:
205  if (rd->subimtype & R_JPEG2K_16BIT) {
206  imf->depth = R_IMF_CHAN_DEPTH_16;
207  }
208  else if (rd->subimtype & R_JPEG2K_12BIT) {
209  imf->depth = R_IMF_CHAN_DEPTH_12;
210  }
211 
212  if (rd->subimtype & R_JPEG2K_YCC) {
214  }
215  if (rd->subimtype & R_JPEG2K_CINE_PRESET) {
217  }
218  if (rd->subimtype & R_JPEG2K_CINE_48FPS) {
220  }
221  break;
222  case R_IMF_IMTYPE_CINEON:
223  case R_IMF_IMTYPE_DPX:
224  if (rd->subimtype & R_CINEON_LOG) {
226  }
227  break;
228  }
229 }
230 
231 /* socket use flags were only temporary before */
233 {
234  bNode *node;
235  bNodeSocket *sock;
236  bNodeLink *link;
237 
238  for (node = ntree->nodes.first; node; node = node->next) {
239  for (sock = node->inputs.first; sock; sock = sock->next) {
240  sock->flag &= ~SOCK_IN_USE;
241  }
242  for (sock = node->outputs.first; sock; sock = sock->next) {
243  sock->flag &= ~SOCK_IN_USE;
244  }
245  }
246  for (sock = ntree->inputs.first; sock; sock = sock->next) {
247  sock->flag &= ~SOCK_IN_USE;
248  }
249  for (sock = ntree->outputs.first; sock; sock = sock->next) {
250  sock->flag &= ~SOCK_IN_USE;
251  }
252 
253  for (link = ntree->links.first; link; link = link->next) {
254  link->fromsock->flag |= SOCK_IN_USE;
255  link->tosock->flag |= SOCK_IN_USE;
256  }
257 }
258 
260 {
261  bNode *node;
262 
263  for (node = ntree->nodes.first; node; node = node->next) {
264  if (node->type == CMP_NODE_OUTPUT_FILE) {
265  /* previous CMP_NODE_OUTPUT_FILE nodes get converted to multi-file outputs */
266  NodeImageFile *old_data = node->storage;
267  NodeImageMultiFile *nimf = MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
268  bNodeSocket *old_image = BLI_findlink(&node->inputs, 0);
269  bNodeSocket *old_z = BLI_findlink(&node->inputs, 1);
270  bNodeSocket *sock;
271  char filename[FILE_MAXFILE];
272 
273  /* ugly, need to remove the old inputs list to avoid bad pointer
274  * checks when adding new sockets.
275  * sock->storage is expected to contain path info in ntreeCompositOutputFileAddSocket.
276  */
277  BLI_listbase_clear(&node->inputs);
278 
279  node->storage = nimf;
280 
281  /* looks like storage data can be messed up somehow, stupid check here */
282  if (old_data) {
283  char basepath[FILE_MAXDIR];
284 
285  /* split off filename from the old path, to be used as socket sub-path */
286  BLI_split_dirfile(old_data->name, basepath, filename, sizeof(basepath), sizeof(filename));
287 
288  BLI_strncpy(nimf->base_path, basepath, sizeof(nimf->base_path));
289  nimf->format = old_data->im_format;
290  }
291  else {
292  BLI_strncpy(filename, old_image->name, sizeof(filename));
293  }
294 
295  /* if z buffer is saved, change the image type to multilayer exr.
296  * XXX this is slightly messy, Z buffer was ignored before for anything but EXR and IRIS ...
297  * I'm just assuming here that IRIZ means IRIS with z buffer ...
298  */
299  if (old_data && ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
300  char sockpath[FILE_MAX];
301 
303 
304  BLI_snprintf(sockpath, sizeof(sockpath), "%s_Image", filename);
305  sock = ntreeCompositOutputFileAddSocket(ntree, node, sockpath, &nimf->format);
306  /* XXX later do_versions copies path from socket name, need to set this explicitly */
307  BLI_strncpy(sock->name, sockpath, sizeof(sock->name));
308  if (old_image->link) {
309  old_image->link->tosock = sock;
310  sock->link = old_image->link;
311  }
312 
313  BLI_snprintf(sockpath, sizeof(sockpath), "%s_Z", filename);
314  sock = ntreeCompositOutputFileAddSocket(ntree, node, sockpath, &nimf->format);
315  /* XXX later do_versions copies path from socket name, need to set this explicitly */
316  BLI_strncpy(sock->name, sockpath, sizeof(sock->name));
317  if (old_z->link) {
318  old_z->link->tosock = sock;
319  sock->link = old_z->link;
320  }
321  }
322  else {
323  sock = ntreeCompositOutputFileAddSocket(ntree, node, filename, &nimf->format);
324  /* XXX later do_versions copies path from socket name, need to set this explicitly */
325  BLI_strncpy(sock->name, filename, sizeof(sock->name));
326  if (old_image->link) {
327  old_image->link->tosock = sock;
328  sock->link = old_image->link;
329  }
330  }
331 
332  nodeRemoveSocket(ntree, node, old_image);
333  nodeRemoveSocket(ntree, node, old_z);
334  if (old_data) {
335  MEM_freeN(old_data);
336  }
337  }
338  else if (node->type == CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
339  NodeImageMultiFile *nimf = node->storage;
340  bNodeSocket *sock;
341 
342  /* CMP_NODE_OUTPUT_MULTI_FILE has been re-declared as CMP_NODE_OUTPUT_FILE */
343  node->type = CMP_NODE_OUTPUT_FILE;
344 
345  /* initialize the node-wide image format from render data, if available */
346  if (sce) {
347  nimf->format = sce->r.im_format;
348  }
349 
350  /* transfer render format toggle to node format toggle */
351  for (sock = node->inputs.first; sock; sock = sock->next) {
352  NodeImageMultiFileSocket *simf = sock->storage;
353  simf->use_node_format = simf->use_render_format;
354  }
355 
356  /* we do have preview now */
357  node->flag |= NODE_PREVIEW;
358  }
359  }
360 }
361 
362 /* blue and red are swapped pre 2.62.1, be sane (red == red) now! */
364 {
365  CustomDataLayer *layer;
366  MLoopCol *mloopcol;
367  int a;
368  int i;
369 
370  for (a = 0; a < me->ldata.totlayer; a++) {
371  layer = &me->ldata.layers[a];
372 
373  if (layer->type == CD_MLOOPCOL) {
374  mloopcol = (MLoopCol *)layer->data;
375  for (i = 0; i < me->totloop; i++, mloopcol++) {
376  SWAP(uchar, mloopcol->r, mloopcol->b);
377  }
378  }
379  }
380 }
381 
383 {
384  bNode *node;
385 
386  for (node = ntree->nodes.first; node; node = node->next) {
387  if (node->type == CMP_NODE_OUTPUT_FILE) {
388  bNodeSocket *sock;
389  for (sock = node->inputs.first; sock; sock = sock->next) {
390  NodeImageMultiFileSocket *input = sock->storage;
391  /* input file path is stored in dedicated struct now instead socket name */
392  BLI_strncpy(input->path, sock->name, sizeof(input->path));
393  }
394  }
395  }
396 }
397 
399 {
400  bNode *node;
401 
402  for (node = ntree->nodes.first; node; node = node->next) {
403  if (node->type == CMP_NODE_OUTPUT_FILE) {
404  bNodeSocket *sock;
405  for (sock = node->inputs.first; sock; sock = sock->next) {
406  NodeImageMultiFileSocket *input = sock->storage;
407 
408  /* multilayer names are stored as separate strings now,
409  * used the path string before, so copy it over.
410  */
411  BLI_strncpy(input->layer, input->path, sizeof(input->layer));
412 
413  /* paths/layer names also have to be unique now, initial check */
414  ntreeCompositOutputFileUniquePath(&node->inputs, sock, input->path, '_');
415  ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, input->layer, '_');
416  }
417  }
418  }
419 }
420 
422 {
423  bNode *node;
424 
425  for (node = ntree->nodes.first; node; node = node->next) {
426  if (node->type == CMP_NODE_IMAGE) {
427  bNodeSocket *sock;
428  for (sock = node->outputs.first; sock; sock = sock->next) {
429  NodeImageLayer *output = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
430 
431  /* take pass index both from current storage ptr (actually an int) */
432  output->pass_index = POINTER_AS_INT(sock->storage);
433 
434  /* replace socket data pointer */
435  sock->storage = output;
436  }
437  }
438  }
439 }
440 
442 {
443  bNode *node;
444 
445  for (node = ntree->nodes.first; node; node = node->next) {
446  if (node->type == NODE_FRAME) {
447  /* initialize frame node storage data */
448  if (node->storage == NULL) {
449  NodeFrame *data = (NodeFrame *)MEM_callocN(sizeof(NodeFrame), "frame node storage");
450  node->storage = data;
451 
452  /* copy current flags */
453  data->flag = node->custom1;
454 
455  data->label_size = 20;
456  }
457  }
458 
459  /* initialize custom node color */
460  node->color[0] = node->color[1] = node->color[2] = 0.608f; /* default theme color */
461  }
462 }
463 
465 {
466  int i;
467 
468  for (i = 0; i < track->markersnr; i++) {
469  MovieTrackingMarker *marker = &track->markers[i];
470 
471  if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
472  is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3])) {
473  marker->pattern_corners[0][0] = track->pat_min[0];
474  marker->pattern_corners[0][1] = track->pat_min[1];
475 
476  marker->pattern_corners[1][0] = track->pat_max[0];
477  marker->pattern_corners[1][1] = track->pat_min[1];
478 
479  marker->pattern_corners[2][0] = track->pat_max[0];
480  marker->pattern_corners[2][1] = track->pat_max[1];
481 
482  marker->pattern_corners[3][0] = track->pat_min[0];
483  marker->pattern_corners[3][1] = track->pat_max[1];
484  }
485 
486  if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) {
487  copy_v2_v2(marker->search_min, track->search_min);
488  copy_v2_v2(marker->search_max, track->search_max);
489  }
490  }
491 }
492 
493 static const char *node_get_static_idname(int type, int treetype)
494 {
495  /* use static type info header to map static int type to identifier string */
496 #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
497  case ID: \
498  return #Category #StructName;
499 
500  /* XXX hack, group types share a single static integer identifier,
501  * but are registered as separate types */
502  if (type == NODE_GROUP) {
503  switch (treetype) {
504  case NTREE_COMPOSIT:
505  return "CompositorNodeGroup";
506  case NTREE_SHADER:
507  return "ShaderNodeGroup";
508  case NTREE_TEXTURE:
509  return "TextureNodeGroup";
510  }
511  }
512  else {
513  switch (type) {
514 #include "NOD_static_types.h"
515  }
516  }
517  return "";
518 }
519 
521 {
522  switch (sock->type) {
523  case SOCK_FLOAT: {
524  bNodeSocketValueFloat *dval = sock->default_value;
525  return nodeStaticSocketType(SOCK_FLOAT, dval->subtype);
526  }
527  case SOCK_INT: {
528  bNodeSocketValueInt *dval = sock->default_value;
529  return nodeStaticSocketType(SOCK_INT, dval->subtype);
530  }
531  case SOCK_BOOLEAN: {
533  }
534  case SOCK_VECTOR: {
537  }
538  case SOCK_RGBA: {
540  }
541  case SOCK_STRING: {
544  }
545  case SOCK_SHADER: {
547  }
548  }
549  return "";
550 }
551 
553 {
554  /* initialize node tree type idname */
555  {
556  bNode *node;
557  bNodeSocket *sock;
558 
559  ntree->typeinfo = NULL;
560 
561  /* tree type idname */
562  switch (ntree->type) {
563  case NTREE_COMPOSIT:
564  strcpy(ntree->idname, "CompositorNodeTree");
565  break;
566  case NTREE_SHADER:
567  strcpy(ntree->idname, "ShaderNodeTree");
568  break;
569  case NTREE_TEXTURE:
570  strcpy(ntree->idname, "TextureNodeTree");
571  break;
572  }
573 
574  /* node type idname */
575  for (node = ntree->nodes.first; node; node = node->next) {
576  BLI_strncpy(
577  node->idname, node_get_static_idname(node->type, ntree->type), sizeof(node->idname));
578 
579  /* existing old nodes have been initialized already */
580  node->flag |= NODE_INIT;
581 
582  /* sockets idname */
583  for (sock = node->inputs.first; sock; sock = sock->next) {
584  BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
585  }
586  for (sock = node->outputs.first; sock; sock = sock->next) {
587  BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
588  }
589  }
590  /* tree sockets idname */
591  for (sock = ntree->inputs.first; sock; sock = sock->next) {
592  BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
593  }
594  for (sock = ntree->outputs.first; sock; sock = sock->next) {
595  BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
596  }
597  }
598 
599  /* initialize socket in_out values */
600  {
601  bNode *node;
602  bNodeSocket *sock;
603 
604  for (node = ntree->nodes.first; node; node = node->next) {
605  for (sock = node->inputs.first; sock; sock = sock->next) {
606  sock->in_out = SOCK_IN;
607  }
608  for (sock = node->outputs.first; sock; sock = sock->next) {
609  sock->in_out = SOCK_OUT;
610  }
611  }
612  for (sock = ntree->inputs.first; sock; sock = sock->next) {
613  sock->in_out = SOCK_IN;
614  }
615  for (sock = ntree->outputs.first; sock; sock = sock->next) {
616  sock->in_out = SOCK_OUT;
617  }
618  }
619 
620  /* initialize socket identifier strings */
621  {
622  bNode *node;
623  bNodeSocket *sock;
624 
625  for (node = ntree->nodes.first; node; node = node->next) {
626  for (sock = node->inputs.first; sock; sock = sock->next) {
627  BLI_strncpy(sock->identifier, sock->name, sizeof(sock->identifier));
628  BLI_uniquename(&node->inputs,
629  sock,
630  "socket",
631  '.',
632  offsetof(bNodeSocket, identifier),
633  sizeof(sock->identifier));
634  }
635  for (sock = node->outputs.first; sock; sock = sock->next) {
636  BLI_strncpy(sock->identifier, sock->name, sizeof(sock->identifier));
637  BLI_uniquename(&node->outputs,
638  sock,
639  "socket",
640  '.',
641  offsetof(bNodeSocket, identifier),
642  sizeof(sock->identifier));
643  }
644  }
645  for (sock = ntree->inputs.first; sock; sock = sock->next) {
646  BLI_strncpy(sock->identifier, sock->name, sizeof(sock->identifier));
648  sock,
649  "socket",
650  '.',
651  offsetof(bNodeSocket, identifier),
652  sizeof(sock->identifier));
653  }
654  for (sock = ntree->outputs.first; sock; sock = sock->next) {
655  BLI_strncpy(sock->identifier, sock->name, sizeof(sock->identifier));
657  sock,
658  "socket",
659  '.',
660  offsetof(bNodeSocket, identifier),
661  sizeof(sock->identifier));
662  }
663  }
664 }
665 
666 /* NOLINTNEXTLINE: readability-function-size */
668 {
669  if (bmain->versionfile < 260) {
670  {
671  /* set default alpha value of Image outputs in image and render layer nodes to 0 */
672  Scene *sce;
673  bNodeTree *ntree;
674 
675  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
676  /* there are files with invalid audio_channels value, the real cause
677  * is unknown, but we fix it here anyway to avoid crashes */
678  if (sce->r.ffcodecdata.audio_channels == 0) {
679  sce->r.ffcodecdata.audio_channels = 2;
680  }
681 
682  if (sce->nodetree) {
684  }
685  }
686 
687  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
689  }
690  }
691 
692  {
693  /* support old particle dupliobject rotation settings */
694  ParticleSettings *part;
695 
696  for (part = bmain->particles.first; part; part = part->id.next) {
697  if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
698  part->draw |= PART_DRAW_ROTATE_OB;
699 
700  if (part->rotmode == 0) {
701  part->rotmode = PART_ROT_VEL;
702  }
703  }
704  }
705  }
706  }
707 
708  if (!MAIN_VERSION_ATLEAST(bmain, 260, 1)) {
709  Object *ob;
710 
711  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
712  ob->collision_boundtype = ob->boundtype;
713  }
714 
715  {
716  Camera *cam;
717  for (cam = bmain->cameras.first; cam; cam = cam->id.next) {
718  if (cam->sensor_x < 0.01f) {
720  }
721 
722  if (cam->sensor_y < 0.01f) {
724  }
725  }
726  }
727  }
728 
729  if (!MAIN_VERSION_ATLEAST(bmain, 260, 2)) {
730  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
731  if (ntree->type == NTREE_SHADER) {
732  bNode *node;
733  for (node = ntree->nodes.first; node; node = node->next) {
734  if (node->type == SH_NODE_MAPPING) {
735  TexMapping *tex_mapping;
736 
737  tex_mapping = node->storage;
738  tex_mapping->projx = PROJ_X;
739  tex_mapping->projy = PROJ_Y;
740  tex_mapping->projz = PROJ_Z;
741  }
742  }
743  }
744  }
746  }
747 
748  if (!MAIN_VERSION_ATLEAST(bmain, 260, 4)) {
749  {
750  /* Convert node angles to radians! */
751  Scene *sce;
752  Material *mat;
753  bNodeTree *ntree;
754 
755  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
756  if (sce->nodetree) {
758  }
759  }
760 
761  for (mat = bmain->materials.first; mat; mat = mat->id.next) {
762  if (mat->nodetree) {
764  }
765  }
766 
767  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
769  }
770  }
771 
772  {
773  /* Tomato compatibility code. */
774  bScreen *screen;
775  MovieClip *clip;
776 
777  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
778  ScrArea *area;
779  for (area = screen->areabase.first; area; area = area->next) {
780  SpaceLink *sl;
781  for (sl = area->spacedata.first; sl; sl = sl->next) {
782  if (sl->spacetype == SPACE_VIEW3D) {
783  View3D *v3d = (View3D *)sl;
784  if (v3d->bundle_size == 0.0f) {
785  v3d->bundle_size = 0.2f;
787  }
788 
789  if (v3d->bundle_drawtype == 0) {
791  }
792  }
793  else if (sl->spacetype == SPACE_CLIP) {
794  SpaceClip *sclip = (SpaceClip *)sl;
795  if (sclip->scopes.track_preview_height == 0) {
796  sclip->scopes.track_preview_height = 120;
797  }
798  }
799  }
800  }
801  }
802 
803  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
804  MovieTrackingTrack *track;
805 
806  if (clip->aspx < 1.0f) {
807  clip->aspx = 1.0f;
808  clip->aspy = 1.0f;
809  }
810 
813 
814  if (clip->proxy.build_size_flag == 0) {
816  }
817 
818  if (clip->proxy.quality == 0) {
819  clip->proxy.quality = 90;
820  }
821 
822  if (clip->tracking.camera.pixel_aspect < 0.01f) {
823  clip->tracking.camera.pixel_aspect = 1.0f;
824  }
825 
826  track = clip->tracking.tracks.first;
827  while (track) {
828  if (track->minimum_correlation == 0.0f) {
829  track->minimum_correlation = 0.75f;
830  }
831 
832  track = track->next;
833  }
834  }
835  }
836  }
837 
838  if (!MAIN_VERSION_ATLEAST(bmain, 260, 6)) {
839  Scene *sce;
840  MovieClip *clip;
841 
842  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
844  }
845 
846  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
847  MovieTrackingSettings *settings = &clip->tracking.settings;
848 
849  if (settings->default_pattern_size == 0.0f) {
851  settings->default_minimum_correlation = 0.75;
852  settings->default_pattern_size = 11;
853  settings->default_search_size = 51;
854  }
855  }
856 
857  {
858  Object *ob;
859  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
860  /* convert delta addition into delta scale */
861  int i;
862  for (i = 0; i < 3; i++) {
863  if ((ob->dsize[i] == 0.0f) || /* simple case, user never touched dsize */
864  (ob->scale[i] == 0.0f)) /* cant scale the dsize to give a non zero result,
865  * so fallback to 1.0f */
866  {
867  ob->dscale[i] = 1.0f;
868  }
869  else {
870  ob->dscale[i] = (ob->scale[i] + ob->dsize[i]) / ob->scale[i];
871  }
872  }
873  }
874  }
875  }
876  /* sigh, this dscale vs dsize version patching was not done right, fix for fix,
877  * this intentionally checks an exact subversion, also note this was never in a release,
878  * at some point this could be removed. */
879  else if (bmain->versionfile == 260 && bmain->subversionfile == 6) {
880  Object *ob;
881  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
882  if (is_zero_v3(ob->dscale)) {
883  copy_vn_fl(ob->dscale, 3, 1.0f);
884  }
885  }
886  }
887 
888  if (!MAIN_VERSION_ATLEAST(bmain, 260, 8)) {
889  Brush *brush;
890 
891  for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
892  if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) {
893  brush->alpha = 1.0f;
894  }
895  }
896  }
897 
898  if (!MAIN_VERSION_ATLEAST(bmain, 261, 1)) {
899  {
900  /* update use flags for node sockets (was only temporary before) */
901  Scene *sce;
902  Material *mat;
903  Tex *tex;
904  World *world;
905  bNodeTree *ntree;
906 
907  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
908  if (sce->nodetree) {
910  }
911  }
912 
913  for (mat = bmain->materials.first; mat; mat = mat->id.next) {
914  if (mat->nodetree) {
916  }
917  }
918 
919  for (tex = bmain->textures.first; tex; tex = tex->id.next) {
920  if (tex->nodetree) {
922  }
923  }
924 
925  for (Light *la = bmain->lights.first; la; la = la->id.next) {
926  if (la->nodetree) {
928  }
929  }
930 
931  for (world = bmain->worlds.first; world; world = world->id.next) {
932  if (world->nodetree) {
934  }
935  }
936 
937  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
939  }
940  }
941  {
942  MovieClip *clip;
943  Object *ob;
944 
945  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
946  MovieTracking *tracking = &clip->tracking;
947  MovieTrackingObject *tracking_object = tracking->objects.first;
948 
950 
951  if (!tracking->settings.object_distance) {
952  tracking->settings.object_distance = 1.0f;
953  }
954 
955  if (BLI_listbase_is_empty(&tracking->objects)) {
956  BKE_tracking_object_add(tracking, "Camera");
957  }
958 
959  while (tracking_object) {
960  if (!tracking_object->scale) {
961  tracking_object->scale = 1.0f;
962  }
963 
964  tracking_object = tracking_object->next;
965  }
966  }
967 
968  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
969  bConstraint *con;
970  for (con = ob->constraints.first; con; con = con->next) {
971  if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
973 
974  if (data->invmat[3][3] == 0.0f) {
975  unit_m4(data->invmat);
976  }
977  }
978  }
979  }
980  }
981  }
982 
983  if (!MAIN_VERSION_ATLEAST(bmain, 261, 2)) {
984  {
985  /* convert deprecated sculpt_paint_unified_* fields to
986  * UnifiedPaintSettings */
987  Scene *scene;
988  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
991  ups->size = ts->sculpt_paint_unified_size;
992  ups->unprojected_radius = ts->sculpt_paint_unified_unprojected_radius;
993  ups->alpha = ts->sculpt_paint_unified_alpha;
994  ups->flag = ts->sculpt_paint_settings;
995  }
996  }
997  }
998 
999  if (!MAIN_VERSION_ATLEAST(bmain, 261, 3)) {
1000  {
1001  /* convert extended ascii to utf-8 for text editor */
1002  Text *text;
1003  for (text = bmain->texts.first; text; text = text->id.next) {
1004  if (!(text->flags & TXT_ISEXT)) {
1005  TextLine *tl;
1006 
1007  for (tl = text->lines.first; tl; tl = tl->next) {
1008  int added = txt_extended_ascii_as_utf8(&tl->line);
1009  tl->len += added;
1010 
1011  /* reset cursor position if line was changed */
1012  if (added && tl == text->curl) {
1013  text->curc = 0;
1014  }
1015  }
1016  }
1017  }
1018  }
1019  {
1020  /* set new dynamic paint values */
1021  Object *ob;
1022  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1023  ModifierData *md;
1024  for (md = ob->modifiers.first; md; md = md->next) {
1025  if (md->type == eModifierType_DynamicPaint) {
1027  if (pmd->canvas) {
1029  for (; surface; surface = surface->next) {
1030  surface->color_dry_threshold = 1.0f;
1031  surface->influence_scale = 1.0f;
1032  surface->radius_scale = 1.0f;
1033  surface->flags |= MOD_DPAINT_USE_DRYING;
1034  }
1035  }
1036  }
1037  }
1038  }
1039  }
1040  }
1041 
1042  if (bmain->versionfile < 262) {
1043  Object *ob;
1044  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1045  ModifierData *md;
1046 
1047  for (md = ob->modifiers.first; md; md = md->next) {
1048  if (md->type == eModifierType_Cloth) {
1049  ClothModifierData *clmd = (ClothModifierData *)md;
1050  if (clmd->sim_parms) {
1051  clmd->sim_parms->vel_damping = 1.0f;
1052  }
1053  }
1054  }
1055  }
1056  }
1057 
1058  if (bmain->versionfile < 263) {
1059  /* set fluidsim rate. the version patch for this in 2.62 was wrong, so
1060  * try to correct it, if rate is 0.0 that's likely not intentional */
1061  Object *ob;
1062 
1063  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1064  ModifierData *md;
1065  for (md = ob->modifiers.first; md; md = md->next) {
1066  if (md->type == eModifierType_Fluidsim) {
1068  if (fmd->fss->animRate == 0.0f) {
1069  fmd->fss->animRate = 1.0f;
1070  }
1071  }
1072  }
1073  }
1074  }
1075 
1076  if (!MAIN_VERSION_ATLEAST(bmain, 262, 1)) {
1077  /* update use flags for node sockets (was only temporary before) */
1078  Scene *sce;
1079  bNodeTree *ntree;
1080 
1081  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
1082  if (sce->nodetree) {
1084  }
1085  }
1086 
1087  /* XXX can't associate with scene for group nodes, image format will stay uninitialized */
1088  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
1090  }
1091  }
1092 
1093  /* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
1094  if (bmain->versionfile == 262 && bmain->subversionfile == 1) {
1095  {
1096  Mesh *me;
1097  for (me = bmain->meshes.first; me; me = me->id.next) {
1099  }
1100  }
1101  }
1102 
1103  if (!MAIN_VERSION_ATLEAST(bmain, 262, 2)) {
1104  /* Set new idname of keyingsets from their now "label-only" name. */
1105  Scene *scene;
1106  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
1107  KeyingSet *ks;
1108  for (ks = scene->keyingsets.first; ks; ks = ks->next) {
1109  if (!ks->idname[0]) {
1110  BLI_strncpy(ks->idname, ks->name, sizeof(ks->idname));
1111  }
1112  }
1113  }
1114  }
1115 
1116  if (!MAIN_VERSION_ATLEAST(bmain, 262, 3)) {
1117  Object *ob;
1118  ModifierData *md;
1119 
1120  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1121  for (md = ob->modifiers.first; md; md = md->next) {
1122  if (md->type == eModifierType_Lattice) {
1124  lmd->strength = 1.0f;
1125  }
1126  }
1127  }
1128  }
1129 
1130  if (!MAIN_VERSION_ATLEAST(bmain, 262, 4)) {
1131  /* Read Viscosity presets from older files */
1132  Object *ob;
1133 
1134  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1135  ModifierData *md;
1136  for (md = ob->modifiers.first; md; md = md->next) {
1137  if (md->type == eModifierType_Fluidsim) {
1139  if (fmd->fss->viscosityMode == 3) {
1140  fmd->fss->viscosityValue = 5.0;
1141  fmd->fss->viscosityExponent = 5;
1142  }
1143  else if (fmd->fss->viscosityMode == 4) {
1144  fmd->fss->viscosityValue = 2.0;
1145  fmd->fss->viscosityExponent = 3;
1146  }
1147  }
1148  }
1149  }
1150  }
1151 
1152  if (bmain->versionfile < 263) {
1153  /* Default for old files is to save particle rotations to pointcache */
1154  ParticleSettings *part;
1155  for (part = bmain->particles.first; part; part = part->id.next) {
1156  part->flag |= PART_ROTATIONS;
1157  }
1158  }
1159 
1160  if (!MAIN_VERSION_ATLEAST(bmain, 263, 1)) {
1161  /* file output node paths are now stored in the file info struct instead socket name */
1162  Scene *sce;
1163  bNodeTree *ntree;
1164 
1165  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
1166  if (sce->nodetree) {
1168  }
1169  }
1170  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
1172  }
1173  }
1174 
1175  if (!MAIN_VERSION_ATLEAST(bmain, 263, 3)) {
1176  Scene *scene;
1177  Brush *brush;
1178 
1179  /* For weight paint, each brush now gets its own weight;
1180  * unified paint settings also have weight. Update unified
1181  * paint settings and brushes with a default weight value. */
1182 
1183  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
1185  if (ts) {
1188  }
1189  }
1190 
1191  for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
1192  brush->weight = 0.5;
1193  }
1194  }
1195 
1196  if (!MAIN_VERSION_ATLEAST(bmain, 263, 2)) {
1197  bScreen *screen;
1198 
1199  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1200  ScrArea *area;
1201  for (area = screen->areabase.first; area; area = area->next) {
1202  SpaceLink *sl;
1203 
1204  for (sl = area->spacedata.first; sl; sl = sl->next) {
1205  if (sl->spacetype == SPACE_CLIP) {
1206  SpaceClip *sclip = (SpaceClip *)sl;
1207  ARegion *region;
1208  bool hide = false;
1209 
1210  for (region = area->regionbase.first; region; region = region->next) {
1211  if (region->regiontype == RGN_TYPE_PREVIEW) {
1212  if (region->alignment != RGN_ALIGN_NONE) {
1213  region->flag |= RGN_FLAG_HIDDEN;
1214  region->v2d.flag &= ~V2D_IS_INIT;
1215  region->alignment = RGN_ALIGN_NONE;
1216 
1217  hide = true;
1218  }
1219  }
1220  }
1221 
1222  if (hide) {
1223  sclip->view = SC_VIEW_CLIP;
1224  }
1225  }
1226  }
1227  }
1228  }
1229  }
1230 
1231  if (!MAIN_VERSION_ATLEAST(bmain, 263, 4)) {
1232  Camera *cam;
1233  Curve *cu;
1234 
1235  for (cam = bmain->cameras.first; cam; cam = cam->id.next) {
1236  if (cam->flag & CAM_PANORAMA) {
1237  cam->type = CAM_PANO;
1238  cam->flag &= ~CAM_PANORAMA;
1239  }
1240  }
1241 
1242  for (cu = bmain->curves.first; cu; cu = cu->id.next) {
1243  if (cu->bevfac2 == 0.0f) {
1244  cu->bevfac1 = 0.0f;
1245  cu->bevfac2 = 1.0f;
1246  }
1247  }
1248  }
1249 
1250  if (!MAIN_VERSION_ATLEAST(bmain, 263, 5)) {
1251  {
1252  /* file output node paths are now stored in the file info struct instead socket name */
1253  Scene *sce;
1254  bNodeTree *ntree;
1255 
1256  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
1257  if (sce->nodetree) {
1260  }
1261  }
1262  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
1265  }
1266  }
1267  }
1268 
1269  if (!MAIN_VERSION_ATLEAST(bmain, 263, 6)) {
1270  /* update use flags for node sockets (was only temporary before) */
1271  Scene *sce;
1272  Material *mat;
1273  Tex *tex;
1274  World *world;
1275  bNodeTree *ntree;
1276 
1277  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
1278  if (sce->nodetree) {
1280  }
1281  }
1282 
1283  for (mat = bmain->materials.first; mat; mat = mat->id.next) {
1284  if (mat->nodetree) {
1286  }
1287  }
1288 
1289  for (tex = bmain->textures.first; tex; tex = tex->id.next) {
1290  if (tex->nodetree) {
1292  }
1293  }
1294 
1295  for (Light *la = bmain->lights.first; la; la = la->id.next) {
1296  if (la->nodetree) {
1297  do_versions_nodetree_frame_2_64_6(la->nodetree);
1298  }
1299  }
1300 
1301  for (world = bmain->worlds.first; world; world = world->id.next) {
1302  if (world->nodetree) {
1304  }
1305  }
1306 
1307  for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
1309  }
1310  }
1311 
1312  if (!MAIN_VERSION_ATLEAST(bmain, 263, 7)) {
1313  Object *ob;
1314 
1315  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1316  ModifierData *md;
1317  for (md = ob->modifiers.first; md; md = md->next) {
1318  if (md->type == eModifierType_Fluid) {
1319  FluidModifierData *fmd = (FluidModifierData *)md;
1320  if ((fmd->type & MOD_FLUID_TYPE_DOMAIN) && fmd->domain) {
1321  int maxres = max_iii(fmd->domain->res[0], fmd->domain->res[1], fmd->domain->res[2]);
1322  fmd->domain->scale = fmd->domain->dx * maxres;
1323  fmd->domain->dx = 1.0f / fmd->domain->scale;
1324  }
1325  }
1326  }
1327  }
1328  }
1329 
1330  if (!MAIN_VERSION_ATLEAST(bmain, 263, 9)) {
1331  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1332  if (ntree->type == NTREE_SHADER) {
1333  bNode *node;
1334  for (node = ntree->nodes.first; node; node = node->next) {
1336  NodeTexImage *tex = node->storage;
1337 
1338  tex->iuser.frames = 1;
1339  tex->iuser.sfra = 1;
1340  tex->iuser.ok = 1;
1341  }
1342  }
1343  }
1344  }
1346  }
1347 
1348  if (!MAIN_VERSION_ATLEAST(bmain, 263, 10)) {
1349  {
1350  Scene *scene;
1351  /* composite redesign */
1352  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
1353  if (scene->nodetree) {
1354  if (scene->nodetree->chunksize == 0) {
1355  scene->nodetree->chunksize = 256;
1356  }
1357  }
1358  }
1359 
1360  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1361  if (ntree->type == NTREE_COMPOSIT) {
1362  bNode *node;
1363  for (node = ntree->nodes.first; node; node = node->next) {
1364  if (node->type == CMP_NODE_DEFOCUS) {
1365  NodeDefocus *data = node->storage;
1366  if (data->maxblur == 0.0f) {
1367  data->maxblur = 16.0f;
1368  }
1369  }
1370  }
1371  }
1372  }
1374  }
1375 
1376  {
1377  bScreen *screen;
1378 
1379  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1380  ScrArea *area;
1381 
1382  for (area = screen->areabase.first; area; area = area->next) {
1383  SpaceLink *sl;
1384 
1385  for (sl = area->spacedata.first; sl; sl = sl->next) {
1386  if (sl->spacetype == SPACE_CLIP) {
1387  SpaceClip *sclip = (SpaceClip *)sl;
1388 
1389  if (sclip->around == 0) {
1391  }
1392  }
1393  }
1394  }
1395  }
1396  }
1397 
1398  {
1399  MovieClip *clip;
1400 
1401  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
1402  clip->start_frame = 1;
1403  }
1404  }
1405  }
1406 
1407  if (!MAIN_VERSION_ATLEAST(bmain, 263, 11)) {
1408  MovieClip *clip;
1409 
1410  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
1411  MovieTrackingTrack *track;
1412 
1413  track = clip->tracking.tracks.first;
1414  while (track) {
1416 
1417  track = track->next;
1418  }
1419  }
1420  }
1421 
1422  if (!MAIN_VERSION_ATLEAST(bmain, 263, 13)) {
1423  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1424  if (ntree->type == NTREE_COMPOSIT) {
1425  bNode *node;
1426  for (node = ntree->nodes.first; node; node = node->next) {
1427  if (node->type == CMP_NODE_DILATEERODE) {
1428  if (node->storage == NULL) {
1429  NodeDilateErode *data = MEM_callocN(sizeof(NodeDilateErode), __func__);
1430  data->falloff = PROP_SMOOTH;
1431  node->storage = data;
1432  }
1433  }
1434  }
1435  }
1436  }
1438  }
1439 
1440  if (!MAIN_VERSION_ATLEAST(bmain, 263, 14)) {
1441  ParticleSettings *part;
1442 
1443  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1444  if (ntree->type == NTREE_COMPOSIT) {
1445  bNode *node;
1446  for (node = ntree->nodes.first; node; node = node->next) {
1447  if (node->type == CMP_NODE_KEYING) {
1448  NodeKeyingData *data = node->storage;
1449 
1450  if (data->despill_balance == 0.0f) {
1451  data->despill_balance = 0.5f;
1452  }
1453  }
1454  }
1455  }
1456  }
1458 
1459  /* keep compatibility for dupliobject particle size */
1460  for (part = bmain->particles.first; part; part = part->id.next) {
1461  if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
1462  if ((part->draw & PART_DRAW_ROTATE_OB) == 0) {
1463  part->draw |= PART_DRAW_NO_SCALE_OB;
1464  }
1465  }
1466  }
1467  }
1468 
1469  if (!MAIN_VERSION_ATLEAST(bmain, 263, 17)) {
1470  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1471  if (ntree->type == NTREE_COMPOSIT) {
1472  bNode *node;
1473  for (node = ntree->nodes.first; node; node = node->next) {
1474  if (node->type == CMP_NODE_MASK) {
1475  if (node->storage == NULL) {
1476  NodeMask *data = MEM_callocN(sizeof(NodeMask), __func__);
1477  /* move settings into own struct */
1478  data->size_x = (int)node->custom3;
1479  data->size_y = (int)node->custom4;
1480  node->custom3 = 0.5f; /* default shutter */
1481  node->storage = data;
1482  }
1483  }
1484  }
1485  }
1486  }
1488  }
1489 
1490  if (!MAIN_VERSION_ATLEAST(bmain, 263, 18)) {
1491  Scene *scene;
1492 
1493  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
1494  if (scene->ed) {
1495  Sequence *seq;
1496 
1497  SEQ_ALL_BEGIN (scene->ed, seq) {
1498  Strip *strip = seq->strip;
1499 
1500  if (strip && strip->color_balance) {
1501  SequenceModifierData *smd;
1503 
1505  cbmd = (ColorBalanceModifierData *)smd;
1506 
1507  cbmd->color_balance = *strip->color_balance;
1508 
1509  /* multiplication with color balance used is handled differently,
1510  * so we need to move multiplication to modifier so files would be
1511  * compatible
1512  */
1513  cbmd->color_multiply = seq->mul;
1514  seq->mul = 1.0f;
1515 
1516  MEM_freeN(strip->color_balance);
1517  strip->color_balance = NULL;
1518  }
1519  }
1520  SEQ_ALL_END;
1521  }
1522  }
1523  }
1524 
1525  /* color management pipeline changes compatibility code */
1526  if (!MAIN_VERSION_ATLEAST(bmain, 263, 19)) {
1527  Scene *scene;
1528  Image *ima;
1529  bool colormanagement_disabled = false;
1530 
1531  /* make scenes which are not using color management have got None as display device,
1532  * so they wouldn't perform linear-to-sRGB conversion on display
1533  */
1534  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
1535  if ((scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) == 0) {
1536  ColorManagedDisplaySettings *display_settings = &scene->display_settings;
1537 
1538  if (display_settings->display_device[0] == 0) {
1540  }
1541 
1542  colormanagement_disabled = true;
1543  }
1544  }
1545 
1546  for (ima = bmain->images.first; ima; ima = ima->id.next) {
1547  if (ima->source == IMA_SRC_VIEWER) {
1548  ima->flag |= IMA_VIEW_AS_RENDER;
1549  }
1550  else if (colormanagement_disabled) {
1551  /* if color-management not used, set image's color space to raw, so no sRGB->linear
1552  * conversion would happen on display and render there's no clear way to check whether
1553  * color management is enabled or not in render engine so set all images to raw if there's
1554  * at least one scene with color management disabled this would still behave incorrect in
1555  * cases when color management was used for only some of scenes, but such a setup is
1556  * crazy anyway and think it's fair enough to break compatibility in that cases.
1557  */
1558 
1559  BLI_strncpy(ima->colorspace_settings.name, "Raw", sizeof(ima->colorspace_settings.name));
1560  }
1561  }
1562  }
1563 
1564  if (!MAIN_VERSION_ATLEAST(bmain, 263, 20)) {
1565  Key *key;
1566  for (key = bmain->shapekeys.first; key; key = key->id.next) {
1568  }
1569  }
1570 
1571  if (!MAIN_VERSION_ATLEAST(bmain, 263, 21)) {
1572  {
1573  Mesh *me;
1574  for (me = bmain->meshes.first; me; me = me->id.next) {
1575  CustomData_update_typemap(&me->vdata);
1576  CustomData_free_layers(&me->vdata, CD_MSTICKY, me->totvert);
1577  }
1578  }
1579  }
1580 
1581  /* correction for files saved in blender version when BKE_pose_copy_data
1582  * didn't copy animation visualization, which lead to deadlocks on motion
1583  * path calculation for proxied armatures, see T32742.
1584  */
1585  if (bmain->versionfile < 264) {
1586  Object *ob;
1587 
1588  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1589  if (ob->pose) {
1590  if (ob->pose->avs.path_step == 0) {
1592  }
1593  }
1594  }
1595  }
1596 
1597  if (!MAIN_VERSION_ATLEAST(bmain, 264, 1)) {
1598  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1599  if (ntree->type == NTREE_SHADER) {
1600  bNode *node;
1601  for (node = ntree->nodes.first; node; node = node->next) {
1602  if (node->type == SH_NODE_TEX_COORD) {
1603  node->flag |= NODE_OPTIONS;
1604  }
1605  }
1606  }
1607  }
1609  }
1610 
1611  if (!MAIN_VERSION_ATLEAST(bmain, 264, 2)) {
1612  MovieClip *clip;
1613 
1614  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
1615  MovieTracking *tracking = &clip->tracking;
1616  MovieTrackingObject *tracking_object;
1617 
1618  for (tracking_object = tracking->objects.first; tracking_object;
1619  tracking_object = tracking_object->next) {
1620  if (tracking_object->keyframe1 == 0 && tracking_object->keyframe2 == 0) {
1621  tracking_object->keyframe1 = tracking->settings.keyframe1;
1622  tracking_object->keyframe2 = tracking->settings.keyframe2;
1623  }
1624  }
1625  }
1626  }
1627 
1628  if (!MAIN_VERSION_ATLEAST(bmain, 264, 3)) {
1629  /* smoke branch */
1630  {
1631  Object *ob;
1632 
1633  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1634  ModifierData *md;
1635  for (md = ob->modifiers.first; md; md = md->next) {
1636  if (md->type == eModifierType_Fluid) {
1637  FluidModifierData *fmd = (FluidModifierData *)md;
1638  if ((fmd->type & MOD_FLUID_TYPE_DOMAIN) && fmd->domain) {
1639  /* keep branch saves if possible */
1640  if (!fmd->domain->flame_max_temp) {
1641  fmd->domain->burning_rate = 0.75f;
1642  fmd->domain->flame_smoke = 1.0f;
1643  fmd->domain->flame_vorticity = 0.5f;
1644  fmd->domain->flame_ignition = 1.25f;
1645  fmd->domain->flame_max_temp = 1.75f;
1646  fmd->domain->adapt_threshold = 0.02f;
1647  fmd->domain->adapt_margin = 4;
1648  fmd->domain->flame_smoke_color[0] = 0.7f;
1649  fmd->domain->flame_smoke_color[1] = 0.7f;
1650  fmd->domain->flame_smoke_color[2] = 0.7f;
1651  }
1652  }
1653  else if ((fmd->type & MOD_FLUID_TYPE_FLOW) && fmd->flow) {
1654  if (!fmd->flow->texture_size) {
1655  fmd->flow->fuel_amount = 1.0;
1656  fmd->flow->surface_distance = 1.5;
1657  fmd->flow->color[0] = 0.7f;
1658  fmd->flow->color[1] = 0.7f;
1659  fmd->flow->color[2] = 0.7f;
1660  fmd->flow->texture_size = 1.0f;
1661  }
1662  }
1663  }
1664  }
1665  }
1666  }
1667 
1668  /* render border for viewport */
1669  {
1670  bScreen *screen;
1671 
1672  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1673  ScrArea *area;
1674  for (area = screen->areabase.first; area; area = area->next) {
1675  SpaceLink *sl;
1676  for (sl = area->spacedata.first; sl; sl = sl->next) {
1677  if (sl->spacetype == SPACE_VIEW3D) {
1678  View3D *v3d = (View3D *)sl;
1679  if (v3d->render_border.xmin == 0.0f && v3d->render_border.ymin == 0.0f &&
1680  v3d->render_border.xmax == 0.0f && v3d->render_border.ymax == 0.0f) {
1681  v3d->render_border.xmax = 1.0f;
1682  v3d->render_border.ymax = 1.0f;
1683  }
1684  }
1685  }
1686  }
1687  }
1688  }
1689  }
1690 
1691  if (!MAIN_VERSION_ATLEAST(bmain, 264, 5)) {
1692  /* set a unwrapping margin and ABF by default */
1693  Scene *scene;
1694 
1695  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
1696  if (scene->toolsettings->uvcalc_margin == 0.0f) {
1697  scene->toolsettings->uvcalc_margin = 0.001f;
1699  }
1700  }
1701  }
1702 
1703  if (!MAIN_VERSION_ATLEAST(bmain, 264, 6)) {
1704  /* Fix for bug T32982, internal_links list could get corrupted from r51630 onward.
1705  * Simply remove bad internal_links lists to avoid NULL pointers.
1706  */
1707  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1708  bNode *node;
1709  bNodeLink *link, *nextlink;
1710 
1711  for (node = ntree->nodes.first; node; node = node->next) {
1712  for (link = node->internal_links.first; link; link = nextlink) {
1713  nextlink = link->next;
1714  if (!link->fromnode || !link->fromsock || !link->tonode || !link->tosock) {
1715  BLI_remlink(&node->internal_links, link);
1716  }
1717  }
1718  }
1719  }
1721  }
1722 
1723  if (!MAIN_VERSION_ATLEAST(bmain, 264, 7)) {
1724  /* convert tiles size from resolution and number of tiles */
1725  {
1726  Scene *scene;
1727 
1728  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
1729  if (scene->r.tilex == 0 || scene->r.tiley == 1) {
1730  scene->r.tilex = scene->r.tiley = 64;
1731  }
1732  }
1733  }
1734 
1735  /* collision masks */
1736  {
1737  Object *ob;
1738  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1739  if (ob->col_group == 0) {
1740  ob->col_group = 0x01;
1741  ob->col_mask = 0xff;
1742  }
1743  }
1744  }
1745  }
1746 
1747  if (!MAIN_VERSION_ATLEAST(bmain, 264, 7)) {
1748  MovieClip *clip;
1749 
1750  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
1751  MovieTrackingTrack *track;
1752  MovieTrackingObject *object;
1753 
1754  for (track = clip->tracking.tracks.first; track; track = track->next) {
1756  }
1757 
1758  for (object = clip->tracking.objects.first; object; object = object->next) {
1759  for (track = object->tracks.first; track; track = track->next) {
1761  }
1762  }
1763  }
1764  }
1765 
1766  if (!MAIN_VERSION_ATLEAST(bmain, 265, 3)) {
1767  bScreen *screen;
1768  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1769  ScrArea *area;
1770  for (area = screen->areabase.first; area; area = area->next) {
1771  SpaceLink *sl;
1772  for (sl = area->spacedata.first; sl; sl = sl->next) {
1773  switch (sl->spacetype) {
1774  case SPACE_VIEW3D: {
1775  View3D *v3d = (View3D *)sl;
1776  v3d->flag2 |= V3D_SHOW_ANNOTATION;
1777  break;
1778  }
1779  case SPACE_SEQ: {
1780  SpaceSeq *sseq = (SpaceSeq *)sl;
1781  sseq->flag |= SEQ_SHOW_GPENCIL;
1782  break;
1783  }
1784  case SPACE_IMAGE: {
1785  SpaceImage *sima = (SpaceImage *)sl;
1786  sima->flag |= SI_SHOW_GPENCIL;
1787  break;
1788  }
1789  case SPACE_NODE: {
1790  SpaceNode *snode = (SpaceNode *)sl;
1791  snode->flag |= SNODE_SHOW_GPENCIL;
1792  break;
1793  }
1794  case SPACE_CLIP: {
1795  SpaceClip *sclip = (SpaceClip *)sl;
1796  sclip->flag |= SC_SHOW_ANNOTATION;
1797  break;
1798  }
1799  }
1800  }
1801  }
1802  }
1803  }
1804 
1805  if (!MAIN_VERSION_ATLEAST(bmain, 265, 5)) {
1806  Scene *scene;
1807  Tex *tex;
1808 
1809  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
1810  Sequence *seq;
1811 
1812  SEQ_ALL_BEGIN (scene->ed, seq) {
1813  enum { SEQ_MAKE_PREMUL = (1 << 6) };
1814  if (seq->flag & SEQ_MAKE_PREMUL) {
1816  }
1817  else {
1819  }
1820  }
1821  SEQ_ALL_END;
1822 
1823  if (scene->r.bake_samples == 0) {
1824  scene->r.bake_samples = 256;
1825  }
1826  }
1827 
1828  for (Image *image = bmain->images.first; image; image = image->id.next) {
1829  if (image->flag & IMA_DO_PREMUL) {
1830  image->alpha_mode = IMA_ALPHA_STRAIGHT;
1831  }
1832  else {
1834  }
1835  }
1836 
1837  for (tex = bmain->textures.first; tex; tex = tex->id.next) {
1838  if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) {
1839  Image *image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima);
1840 
1841  if (image && (image->flag & IMA_DO_PREMUL) == 0) {
1842  const int IMA_IGNORE_ALPHA = (1 << 12);
1843  image->flag |= IMA_IGNORE_ALPHA;
1844  }
1845  }
1846  }
1847 
1848  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1849  if (ntree->type == NTREE_COMPOSIT) {
1850  bNode *node;
1851  for (node = ntree->nodes.first; node; node = node->next) {
1852  if (node->type == CMP_NODE_IMAGE) {
1853  Image *image = blo_do_versions_newlibadr(fd, ntree->id.lib, node->id);
1854 
1855  if (image) {
1856  if ((image->flag & IMA_DO_PREMUL) == 0 && image->alpha_mode == IMA_ALPHA_STRAIGHT) {
1858  }
1859  }
1860  }
1861  }
1862  }
1863  }
1865  }
1866  else if (!MAIN_VERSION_ATLEAST(bmain, 266, 1)) {
1867  /* texture use alpha was removed for 2.66 but added back again for 2.66a,
1868  * for compatibility all textures assumed it to be enabled */
1869  Tex *tex;
1870 
1871  for (tex = bmain->textures.first; tex; tex = tex->id.next) {
1872  if (tex->type == TEX_IMAGE) {
1873  tex->imaflag |= TEX_USEALPHA;
1874  }
1875  }
1876  }
1877 
1878  if (!MAIN_VERSION_ATLEAST(bmain, 265, 7)) {
1879  Curve *cu;
1880 
1881  for (cu = bmain->curves.first; cu; cu = cu->id.next) {
1882  if (cu->flag & (CU_FRONT | CU_BACK)) {
1883  if (cu->ext1 != 0.0f || cu->ext2 != 0.0f) {
1884  Nurb *nu;
1885 
1886  for (nu = cu->nurb.first; nu; nu = nu->next) {
1887  int a;
1888 
1889  if (nu->bezt) {
1890  BezTriple *bezt = nu->bezt;
1891  a = nu->pntsu;
1892 
1893  while (a--) {
1894  bezt->radius = 1.0f;
1895  bezt++;
1896  }
1897  }
1898  else if (nu->bp) {
1899  BPoint *bp = nu->bp;
1900  a = nu->pntsu * nu->pntsv;
1901 
1902  while (a--) {
1903  bp->radius = 1.0f;
1904  bp++;
1905  }
1906  }
1907  }
1908  }
1909  }
1910  }
1911  }
1912 
1913  if (!MAIN_VERSION_ATLEAST(bmain, 265, 9)) {
1914  Mesh *me;
1915  for (me = bmain->meshes.first; me; me = me->id.next) {
1917  }
1918  }
1919 
1920  if (!MAIN_VERSION_ATLEAST(bmain, 265, 10)) {
1921  Brush *br;
1922  for (br = bmain->brushes.first; br; br = br->id.next) {
1923  if (br->ob_mode & OB_MODE_TEXTURE_PAINT) {
1925  }
1926  }
1927  }
1928 
1929  /* add storage for compositor translate nodes when not existing */
1930  if (!MAIN_VERSION_ATLEAST(bmain, 265, 11)) {
1931  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1932  if (ntree->type == NTREE_COMPOSIT) {
1933  bNode *node;
1934  for (node = ntree->nodes.first; node; node = node->next) {
1935  if (node->type == CMP_NODE_TRANSLATE && node->storage == NULL) {
1936  node->storage = MEM_callocN(sizeof(NodeTranslateData), "node translate data");
1937  }
1938  }
1939  }
1940  }
1942  }
1943 
1944  if (!MAIN_VERSION_ATLEAST(bmain, 266, 2)) {
1945  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1947  }
1949  }
1950 
1951  if (!MAIN_VERSION_ATLEAST(bmain, 266, 2)) {
1952  bScreen *screen;
1953  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1954  ScrArea *area;
1955  for (area = screen->areabase.first; area; area = area->next) {
1956  SpaceLink *sl;
1957  for (sl = area->spacedata.first; sl; sl = sl->next) {
1958  if (sl->spacetype == SPACE_NODE) {
1959  SpaceNode *snode = (SpaceNode *)sl;
1960 
1961  /* reset pointers to force tree path update from context */
1962  snode->nodetree = NULL;
1963  snode->edittree = NULL;
1964  snode->id = NULL;
1965  snode->from = NULL;
1966 
1967  /* convert deprecated treetype setting to tree_idname */
1968  switch (snode->treetype) {
1969  case NTREE_COMPOSIT:
1970  strcpy(snode->tree_idname, "CompositorNodeTree");
1971  break;
1972  case NTREE_SHADER:
1973  strcpy(snode->tree_idname, "ShaderNodeTree");
1974  break;
1975  case NTREE_TEXTURE:
1976  strcpy(snode->tree_idname, "TextureNodeTree");
1977  break;
1978  }
1979  }
1980  }
1981  }
1982  }
1983  }
1984 
1985  if (!MAIN_VERSION_ATLEAST(bmain, 266, 3)) {
1986  {
1987  /* Fix for a very old issue:
1988  * Node names were nominally made unique in r24478 (2.50.8), but the do_versions check
1989  * to update existing node names only applied to bmain->nodetree (i.e. group nodes).
1990  * Uniqueness is now required for proper preview mapping,
1991  * so do this now to ensure old files don't break.
1992  */
1993  bNode *node;
1994  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1995  if (id == &ntree->id) {
1996  continue; /* already fixed for node groups */
1997  }
1998 
1999  for (node = ntree->nodes.first; node; node = node->next) {
2001  }
2002  }
2004  }
2005  }
2006 
2007  if (!MAIN_VERSION_ATLEAST(bmain, 266, 4)) {
2008  Brush *brush;
2009  for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
2011 
2012  if (brush->ob_mode & OB_MODE_TEXTURE_PAINT) {
2013  brush->spacing /= 2;
2014  }
2015  }
2016  }
2017 
2018  if (!MAIN_VERSION_ATLEAST(bmain, 266, 6)) {
2019  Brush *brush;
2020 #define BRUSH_TEXTURE_OVERLAY (1 << 21)
2021 
2022  for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
2023  brush->overlay_flags = 0;
2024  if (brush->flag & BRUSH_TEXTURE_OVERLAY) {
2026  }
2027  }
2028 #undef BRUSH_TEXTURE_OVERLAY
2029  }
2030 
2031  if (bmain->versionfile < 267) {
2032  // if (!DNA_struct_elem_find(fd->filesdna, "Brush", "int", "stencil_pos")) {
2033  Brush *brush;
2034 
2035  for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
2036  if (brush->stencil_dimension[0] == 0) {
2037  brush->stencil_dimension[0] = 256;
2038  brush->stencil_dimension[1] = 256;
2039  brush->stencil_pos[0] = 256;
2040  brush->stencil_pos[1] = 256;
2041  }
2042  if (brush->mask_stencil_dimension[0] == 0) {
2043  brush->mask_stencil_dimension[0] = 256;
2044  brush->mask_stencil_dimension[1] = 256;
2045  brush->mask_stencil_pos[0] = 256;
2046  brush->mask_stencil_pos[1] = 256;
2047  }
2048  }
2049 
2050  /* TIP: to initialize new variables added, use the new function
2051  * DNA_struct_elem_find(fd->filesdna, "structname", "typename", "varname")
2052  * example:
2053  * if (!DNA_struct_elem_find(fd->filesdna, "UserDef", "short", "image_gpubuffer_limit"))
2054  * user->image_gpubuffer_limit = 10;
2055  */
2056  }
2057 
2058  /* default values in Freestyle settings */
2059  if (bmain->versionfile < 267) {
2060  Scene *sce;
2063 
2064  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
2065  if (sce->r.line_thickness_mode == 0) {
2067  sce->r.unit_line_thickness = 1.0f;
2068  }
2069  for (srl = sce->r.layers.first; srl; srl = srl->next) {
2070  if (srl->freestyleConfig.mode == 0) {
2071  srl->freestyleConfig.mode = FREESTYLE_CONTROL_EDITOR_MODE;
2072  }
2073  if (ELEM(srl->freestyleConfig.raycasting_algorithm,
2076  srl->freestyleConfig.raycasting_algorithm = 0; /* deprecated */
2077  srl->freestyleConfig.flags |= FREESTYLE_CULLING;
2078  }
2079  }
2080 
2081  /* not freestyle */
2082  {
2083  MeshStatVis *statvis = &sce->toolsettings->statvis;
2084  if (statvis->thickness_samples == 0) {
2085  statvis->overhang_axis = OB_NEGZ;
2086  statvis->overhang_min = 0;
2087  statvis->overhang_max = DEG2RADF(45.0f);
2088 
2089  statvis->thickness_max = 0.1f;
2090  statvis->thickness_samples = 1;
2091 
2092  statvis->distort_min = DEG2RADF(5.0f);
2093  statvis->distort_max = DEG2RADF(45.0f);
2094 
2095  statvis->sharp_min = DEG2RADF(90.0f);
2096  statvis->sharp_max = DEG2RADF(180.0f);
2097  }
2098  }
2099  }
2101 #if 1
2102  /* disable the Misc panel for now */
2103  if (linestyle->panel == LS_PANEL_MISC) {
2105  }
2106 #endif
2107  if (linestyle->thickness_position == 0) {
2109  linestyle->thickness_ratio = 0.5f;
2110  }
2111  if (linestyle->chaining == 0) {
2113  }
2114  if (linestyle->rounds == 0) {
2115  linestyle->rounds = 3;
2116  }
2117  }
2118  }
2119 
2120  if (bmain->versionfile < 267) {
2121  /* Initialize the active_viewer_key for compositing */
2122  bScreen *screen;
2123  Scene *scene;
2124  bNodeInstanceKey active_viewer_key = {0};
2125  /* simply pick the first node space and use that for the active viewer key */
2126  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
2127  ScrArea *area;
2128  for (area = screen->areabase.first; area; area = area->next) {
2129  SpaceLink *sl;
2130  for (sl = area->spacedata.first; sl; sl = sl->next) {
2131  if (sl->spacetype == SPACE_NODE) {
2132  SpaceNode *snode = (SpaceNode *)sl;
2133  bNodeTreePath *path = snode->treepath.last;
2134  if (!path) {
2135  continue;
2136  }
2137 
2138  active_viewer_key = path->parent_key;
2139  break;
2140  }
2141  }
2142  if (active_viewer_key.value != 0) {
2143  break;
2144  }
2145  }
2146  if (active_viewer_key.value != 0) {
2147  break;
2148  }
2149  }
2150 
2151  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
2152  /* NB: scene->nodetree is a local ID block, has been direct_link'ed */
2153  if (scene->nodetree) {
2154  scene->nodetree->active_viewer_key = active_viewer_key;
2155  }
2156  }
2157  }
2158 
2159  if (!MAIN_VERSION_ATLEAST(bmain, 267, 1)) {
2160  Object *ob;
2161 
2162  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2163  ModifierData *md;
2164  for (md = ob->modifiers.first; md; md = md->next) {
2165  if (md->type == eModifierType_Fluid) {
2166  FluidModifierData *fmd = (FluidModifierData *)md;
2167  if ((fmd->type & MOD_FLUID_TYPE_DOMAIN) && fmd->domain) {
2168  if (fmd->domain->flags & FLUID_DOMAIN_USE_HIGH_SMOOTH) {
2170  }
2171  else {
2173  }
2174  }
2175  }
2176  }
2177  }
2178  }
2179 
2180  if (!MAIN_VERSION_ATLEAST(bmain, 268, 1)) {
2181  Brush *brush;
2182  for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
2183  brush->spacing = MAX2(1, brush->spacing);
2184  }
2185  }
2186 
2187  if (!MAIN_VERSION_ATLEAST(bmain, 268, 2)) {
2188  Brush *brush;
2189 #define BRUSH_FIXED (1 << 6)
2190  for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
2191  brush->flag &= ~BRUSH_FIXED;
2192 
2193  if (brush->cursor_overlay_alpha < 2) {
2194  brush->cursor_overlay_alpha = 33;
2195  }
2196  if (brush->texture_overlay_alpha < 2) {
2197  brush->texture_overlay_alpha = 33;
2198  }
2199  if (brush->mask_overlay_alpha < 2) {
2200  brush->mask_overlay_alpha = 33;
2201  }
2202  }
2203 #undef BRUSH_FIXED
2204  }
2205 
2206  if (!MAIN_VERSION_ATLEAST(bmain, 268, 4)) {
2207  bScreen *screen;
2208  Object *ob;
2209 
2210  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2211  bConstraint *con;
2212  for (con = ob->constraints.first; con; con = con->next) {
2213  if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) {
2216  data->projAxis = OB_POSX;
2217  }
2218  else if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) {
2219  data->projAxis = OB_POSY;
2220  }
2221  else {
2222  data->projAxis = OB_POSZ;
2223  }
2224  data->projAxisSpace = CONSTRAINT_SPACE_LOCAL;
2225  }
2226  }
2227  }
2228 
2229  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2230  ModifierData *md;
2231  for (md = ob->modifiers.first; md; md = md->next) {
2232  if (md->type == eModifierType_Fluid) {
2233  FluidModifierData *fmd = (FluidModifierData *)md;
2234  if ((fmd->type & MOD_FLUID_TYPE_FLOW) && fmd->flow) {
2235  if (!fmd->flow->particle_size) {
2236  fmd->flow->particle_size = 1.0f;
2237  }
2238  }
2239  }
2240  }
2241  }
2242 
2243  /*
2244  * FIX some files have a zoom level of 0, and was checked during the drawing of the node space
2245  *
2246  * We moved this check to the do versions to be sure the value makes any sense.
2247  */
2248  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
2249  ScrArea *area;
2250  for (area = screen->areabase.first; area; area = area->next) {
2251  SpaceLink *sl;
2252  for (sl = area->spacedata.first; sl; sl = sl->next) {
2253  if (sl->spacetype == SPACE_NODE) {
2254  SpaceNode *snode = (SpaceNode *)sl;
2255  if (snode->zoom < 0.02f) {
2256  snode->zoom = 1.0;
2257  }
2258  }
2259  }
2260  }
2261  }
2262  }
2263 
2264  if (!MAIN_VERSION_ATLEAST(bmain, 268, 5)) {
2265  bScreen *screen;
2266  ScrArea *area;
2267 
2268  /* add missing (+) expander in node editor */
2269  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
2270  for (area = screen->areabase.first; area; area = area->next) {
2271  ARegion *region, *arnew;
2272 
2273  if (area->spacetype == SPACE_NODE) {
2275 
2276  if (region) {
2277  continue;
2278  }
2279 
2280  /* add subdiv level; after header */
2282 
2283  /* is error! */
2284  if (region == NULL) {
2285  continue;
2286  }
2287 
2288  arnew = MEM_callocN(sizeof(ARegion), "node tools");
2289 
2290  BLI_insertlinkafter(&area->regionbase, region, arnew);
2291  arnew->regiontype = RGN_TYPE_TOOLS;
2292  arnew->alignment = RGN_ALIGN_LEFT;
2293 
2294  arnew->flag = RGN_FLAG_HIDDEN;
2295  }
2296  }
2297  }
2298  }
2299 
2300  if (!MAIN_VERSION_ATLEAST(bmain, 269, 1)) {
2301  /* Removal of Cycles SSS Compatible falloff */
2302  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2303  if (ntree->type == NTREE_SHADER) {
2304  bNode *node;
2305  for (node = ntree->nodes.first; node; node = node->next) {
2306  if (node->type == SH_NODE_SUBSURFACE_SCATTERING) {
2307  if (node->custom1 == SHD_SUBSURFACE_COMPATIBLE) {
2308  node->custom1 = SHD_SUBSURFACE_CUBIC;
2309  }
2310  }
2311  }
2312  }
2313  }
2315  }
2316 
2317  if (!MAIN_VERSION_ATLEAST(bmain, 269, 2)) {
2318  /* Initialize CDL settings for Color Balance nodes */
2319  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2320  if (ntree->type == NTREE_COMPOSIT) {
2321  bNode *node;
2322  for (node = ntree->nodes.first; node; node = node->next) {
2323  if (node->type == CMP_NODE_COLORBALANCE) {
2324  NodeColorBalance *n = node->storage;
2325  if (node->custom1 == 0) {
2326  /* LGG mode stays the same, just init CDL settings */
2328  }
2329  else if (node->custom1 == 1) {
2330  /* CDL previously used same variables as LGG, copy them over
2331  * and then sync LGG for comparable results in both modes.
2332  */
2333  copy_v3_v3(n->offset, n->lift);
2334  copy_v3_v3(n->power, n->gamma);
2335  copy_v3_v3(n->slope, n->gain);
2337  }
2338  }
2339  }
2340  }
2341  }
2343  }
2344 
2345  if (!MAIN_VERSION_ATLEAST(bmain, 269, 3)) {
2346  bScreen *screen;
2347  ScrArea *area;
2348  SpaceLink *sl;
2349  Scene *scene;
2350 
2351  /* Update files using invalid (outdated) outlinevis Outliner values. */
2352  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
2353  for (area = screen->areabase.first; area; area = area->next) {
2354  for (sl = area->spacedata.first; sl; sl = sl->next) {
2355  if (sl->spacetype == SPACE_OUTLINER) {
2356  SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
2357 
2358  if (!ELEM(space_outliner->outlinevis,
2359  SO_SCENES,
2360  SO_LIBRARIES,
2361  SO_SEQUENCE,
2362  SO_DATA_API)) {
2363  space_outliner->outlinevis = SO_SCENES;
2364  }
2365  }
2366  }
2367  }
2368  }
2369 
2370  if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingTrack", "float", "weight")) {
2371  MovieClip *clip;
2372  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
2373  MovieTracking *tracking = &clip->tracking;
2374  MovieTrackingObject *tracking_object;
2375  for (tracking_object = tracking->objects.first; tracking_object;
2376  tracking_object = tracking_object->next) {
2377  ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
2378  MovieTrackingTrack *track;
2379  for (track = tracksbase->first; track; track = track->next) {
2380  track->weight = 1.0f;
2381  }
2382  }
2383  }
2384  }
2385 
2386  if (!DNA_struct_elem_find(fd->filesdna, "TriangulateModifierData", "int", "quad_method")) {
2387  Object *ob;
2388  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2389  ModifierData *md;
2390  for (md = ob->modifiers.first; md; md = md->next) {
2391  if (md->type == eModifierType_Triangulate) {
2393  if ((tmd->flag & MOD_TRIANGULATE_BEAUTY)) {
2396  }
2397  else {
2400  }
2401  }
2402  }
2403  }
2404  }
2405 
2406  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
2407  /* this can now be turned off */
2409  if (ts->sculpt) {
2411  }
2412 
2413  /* 'Increment' mode disabled for nodes, use true grid snapping instead */
2416  }
2417 
2418 #ifdef WITH_FFMPEG
2419  /* Update for removed "sound-only" option in FFMPEG export settings. */
2420  if (scene->r.ffcodecdata.type >= FFMPEG_INVALID) {
2421  scene->r.ffcodecdata.type = FFMPEG_AVI;
2422  }
2423 #endif
2424  }
2425  }
2426 
2427  if (!MAIN_VERSION_ATLEAST(bmain, 269, 4)) {
2428  /* Internal degrees to radians conversions... */
2429  {
2430  Scene *scene;
2431  Object *ob;
2432 
2433  for (Light *la = bmain->lights.first; la; la = la->id.next) {
2434  la->spotsize = DEG2RADF(la->spotsize);
2435  }
2436 
2437  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2438  ModifierData *md;
2439 
2440  for (md = ob->modifiers.first; md; md = md->next) {
2441  if (md->type == eModifierType_EdgeSplit) {
2443  emd->split_angle = DEG2RADF(emd->split_angle);
2444  }
2445  else if (md->type == eModifierType_Bevel) {
2446  BevelModifierData *bmd = (BevelModifierData *)md;
2447  bmd->bevel_angle = DEG2RADF(bmd->bevel_angle);
2448  }
2449  }
2450  }
2451 
2452  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
2453  Sequence *seq;
2454  SEQ_ALL_BEGIN (scene->ed, seq) {
2455  if (seq->type == SEQ_TYPE_WIPE) {
2456  WipeVars *wv = seq->effectdata;
2457  wv->angle = DEG2RADF(wv->angle);
2458  }
2459  }
2460  SEQ_ALL_END;
2461  }
2462 
2463  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2464  if (ntree->type == NTREE_COMPOSIT) {
2465  bNode *node;
2466  for (node = ntree->nodes.first; node; node = node->next) {
2467  if (node->type == CMP_NODE_BOKEHIMAGE) {
2468  NodeBokehImage *n = node->storage;
2469  n->angle = DEG2RADF(n->angle);
2470  }
2471  if (node->type == CMP_NODE_MASK_BOX) {
2472  NodeBoxMask *n = node->storage;
2473  n->rotation = DEG2RADF(n->rotation);
2474  }
2475  if (node->type == CMP_NODE_MASK_ELLIPSE) {
2476  NodeEllipseMask *n = node->storage;
2477  n->rotation = DEG2RADF(n->rotation);
2478  }
2479  }
2480  }
2481  }
2483  }
2484 
2485  if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingPlaneTrack", "float", "image_opacity")) {
2486  MovieClip *clip;
2487  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
2488  MovieTrackingPlaneTrack *plane_track;
2489  for (plane_track = clip->tracking.plane_tracks.first; plane_track;
2490  plane_track = plane_track->next) {
2491  plane_track->image_opacity = 1.0f;
2492  }
2493  }
2494  }
2495  }
2496 
2497  if (!MAIN_VERSION_ATLEAST(bmain, 269, 7)) {
2498  Scene *scene;
2499  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
2500  Sculpt *sd = scene->toolsettings->sculpt;
2501 
2502  if (sd) {
2503  enum {
2504  SCULPT_SYMM_X = (1 << 0),
2505  SCULPT_SYMM_Y = (1 << 1),
2506  SCULPT_SYMM_Z = (1 << 2),
2507  SCULPT_SYMMETRY_FEATHER = (1 << 6),
2508  };
2509  int symmetry_flags = sd->flags & 7;
2510 
2511  if (symmetry_flags & SCULPT_SYMM_X) {
2513  }
2514  if (symmetry_flags & SCULPT_SYMM_Y) {
2516  }
2517  if (symmetry_flags & SCULPT_SYMM_Z) {
2519  }
2520  if (symmetry_flags & SCULPT_SYMMETRY_FEATHER) {
2522  }
2523  }
2524  }
2525  }
2526 
2527  if (!MAIN_VERSION_ATLEAST(bmain, 269, 8)) {
2528  Curve *cu;
2529 
2530  for (cu = bmain->curves.first; cu; cu = cu->id.next) {
2531  if (cu->str) {
2532  cu->len_char32 = BLI_strlen_utf8(cu->str);
2533  }
2534  }
2535  }
2536 
2537  if (!MAIN_VERSION_ATLEAST(bmain, 269, 9)) {
2538  Object *ob;
2539 
2540  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
2541  ModifierData *md;
2542  for (md = ob->modifiers.first; md; md = md->next) {
2543  if (md->type == eModifierType_Build) {
2544  BuildModifierData *bmd = (BuildModifierData *)md;
2545  if (bmd->randomize) {
2547  }
2548  }
2549  }
2550  }
2551  }
2552 
2553  if (!MAIN_VERSION_ATLEAST(bmain, 269, 11)) {
2554  bScreen *screen;
2555 
2556  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
2557  ScrArea *area;
2558  for (area = screen->areabase.first; area; area = area->next) {
2559  SpaceLink *space_link;
2560 
2561  for (space_link = area->spacedata.first; space_link; space_link = space_link->next) {
2562  if (space_link->spacetype == SPACE_IMAGE) {
2563  ARegion *region;
2564  ListBase *lb;
2565 
2566  if (space_link == area->spacedata.first) {
2567  lb = &area->regionbase;
2568  }
2569  else {
2570  lb = &space_link->regionbase;
2571  }
2572 
2573  for (region = lb->first; region; region = region->next) {
2574  if (region->regiontype == RGN_TYPE_PREVIEW) {
2575  region->regiontype = RGN_TYPE_TOOLS;
2576  region->alignment = RGN_ALIGN_LEFT;
2577  }
2578  else if (region->regiontype == RGN_TYPE_UI) {
2579  region->alignment = RGN_ALIGN_RIGHT;
2580  }
2581  }
2582  }
2583  }
2584  }
2585  }
2586  }
2587 }
2588 
2590 {
2591  /* Convert the previously used ntree->inputs/ntree->outputs lists to interface nodes.
2592  * Pre 2.56.2 node trees automatically have all unlinked sockets exposed already,
2593  * see do_versions_after_linking_250.
2594  *
2595  * This assumes valid typeinfo pointers, as set in lib_link_ntree.
2596  *
2597  * Note: theoretically only needed in node groups (main->nodetree),
2598  * but due to a temporary bug such links could have been added in all trees,
2599  * so have to clean up all of them ...
2600  *
2601  * Note: this always runs, without it links with NULL fromnode and tonode remain
2602  * which causes problems.
2603  */
2604  if (!MAIN_VERSION_ATLEAST(bmain, 266, 3)) {
2605  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2606  bNode *input_node = NULL, *output_node = NULL;
2607  int num_inputs = 0, num_outputs = 0;
2608  bNodeLink *link, *next_link;
2609  /* Only create new interface nodes for actual older files.
2610  * New file versions already have input/output nodes with duplicate links,
2611  * in that case just remove the invalid links.
2612  */
2613  const bool create_io_nodes = MAIN_VERSION_OLDER(bmain, 266, 2);
2614 
2615  float input_locx = 1000000.0f, input_locy = 0.0f;
2616  float output_locx = -1000000.0f, output_locy = 0.0f;
2617  /* rough guess, not nice but we don't have access to UI constants here ... */
2618  static const float offsetx = 42 + 3 * 20 + 20;
2619  /*static const float offsety = 0.0f;*/
2620 
2621  if (create_io_nodes) {
2622  if (ntree->inputs.first) {
2623  input_node = nodeAddStaticNode(NULL, ntree, NODE_GROUP_INPUT);
2624  }
2625 
2626  if (ntree->outputs.first) {
2627  output_node = nodeAddStaticNode(NULL, ntree, NODE_GROUP_OUTPUT);
2628  }
2629  }
2630 
2631  /* Redirect links from/to the node tree interface to input/output node.
2632  * If the fromnode/tonode pointers are NULL, this means a link from/to
2633  * the ntree interface sockets, which need to be redirected to new interface nodes.
2634  */
2635  for (link = ntree->links.first; link; link = next_link) {
2636  bool free_link = false;
2637  next_link = link->next;
2638 
2639  if (link->fromnode == NULL) {
2640  if (input_node) {
2641  link->fromnode = input_node;
2642  link->fromsock = node_group_input_find_socket(input_node, link->fromsock->identifier);
2643  num_inputs++;
2644 
2645  if (link->tonode) {
2646  if (input_locx > link->tonode->locx - offsetx) {
2647  input_locx = link->tonode->locx - offsetx;
2648  }
2649  input_locy += link->tonode->locy;
2650  }
2651  }
2652  else {
2653  free_link = true;
2654  }
2655  }
2656 
2657  if (link->tonode == NULL) {
2658  if (output_node) {
2659  link->tonode = output_node;
2660  link->tosock = node_group_output_find_socket(output_node, link->tosock->identifier);
2661  num_outputs++;
2662 
2663  if (link->fromnode) {
2664  if (output_locx < link->fromnode->locx + offsetx) {
2665  output_locx = link->fromnode->locx + offsetx;
2666  }
2667  output_locy += link->fromnode->locy;
2668  }
2669  }
2670  else {
2671  free_link = true;
2672  }
2673  }
2674 
2675  if (free_link) {
2676  nodeRemLink(ntree, link);
2677  }
2678  }
2679 
2680  if (num_inputs > 0) {
2681  input_locy /= num_inputs;
2682  input_node->locx = input_locx;
2683  input_node->locy = input_locy;
2684  }
2685  if (num_outputs > 0) {
2686  output_locy /= num_outputs;
2687  output_node->locx = output_locx;
2688  output_node->locy = output_locy;
2689  }
2690  }
2692  }
2693 
2694  if (!MAIN_VERSION_ATLEAST(bmain, 280, 60)) {
2695  /* From this point we no longer write incomplete links for forward
2696  * compatibility with 2.66, we have to clean them up for all previous
2697  * versions. */
2698  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2699  bNodeLink *link, *next_link;
2700 
2701  for (link = ntree->links.first; link; link = next_link) {
2702  next_link = link->next;
2703  if (link->fromnode == NULL || link->tonode == NULL) {
2704  nodeRemLink(ntree, link);
2705  }
2706  }
2707  }
2709  }
2710 }
void animviz_settings_init(struct bAnimVizSettings *avs)
void CustomData_free_layers(struct CustomData *data, int type, int totelem)
Definition: customdata.c:2716
void CustomData_update_typemap(struct CustomData *data)
Definition: customdata.c:2071
void BKE_image_alpha_mode_from_extension(struct Image *image)
Definition: image.c:806
#define MAIN_VERSION_ATLEAST(main, ver, subver)
Definition: BKE_main.h:269
#define MAIN_VERSION_OLDER(main, ver, subver)
Definition: BKE_main.h:273
void BKE_mesh_do_versions_cd_flag_init(struct Mesh *mesh)
Definition: mesh.c:1572
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:1985
void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node)
#define CMP_NODE_TRANSLATE
Definition: BKE_node.h:1156
#define SH_NODE_SUBSURFACE_SCATTERING
Definition: BKE_node.h:1042
#define CMP_NODE_COLORBALANCE
Definition: BKE_node.h:1191
void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node)
#define CMP_NODE_BOKEHIMAGE
Definition: BKE_node.h:1216
#define CMP_NODE_ROTATE
Definition: BKE_node.h:1160
#define SH_NODE_TEX_ENVIRONMENT
Definition: BKE_node.h:1022
void ntreeCompositOutputFileUniqueLayer(struct ListBase *list, struct bNodeSocket *sock, const char defname[], char delim)
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link)
Definition: node.cc:2231
void ntreeCompositOutputFileUniquePath(struct ListBase *list, struct bNodeSocket *sock, const char defname[], char delim)
#define CMP_NODE_CHROMA_MATTE
Definition: BKE_node.h:1168
#define CMP_NODE_GLARE
Definition: BKE_node.h:1208
struct bNodeSocket * ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, struct bNode *node, const char *name, struct ImageFormatData *im_format)
const char * nodeStaticSocketType(int type, int subtype)
Definition: node.cc:1574
#define CMP_NODE_OUTPUT_FILE
Definition: BKE_node.h:1154
#define FOREACH_NODETREE_END
Definition: BKE_node.h:945
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock)
Definition: node.cc:1775
#define SH_NODE_MAPPING
Definition: BKE_node.h:981
#define CMP_NODE_MASK_BOX
Definition: BKE_node.h:1214
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition: BKE_node.h:935
#define NODE_FRAME
Definition: BKE_node.h:872
struct bNode * nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type)
Definition: node.cc:2004
#define CMP_NODE_R_LAYERS
Definition: BKE_node.h:1152
#define NODE_GROUP_INPUT
Definition: BKE_node.h:874
#define CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED
Definition: BKE_node.h:1198
void BKE_scene_disable_color_management(struct Scene *scene)
Definition: scene.c:2972
struct ARegion * BKE_area_find_region_type(const struct ScrArea *area, int type)
int txt_extended_ascii_as_utf8(char **str)
Definition: text.c:307
void BKE_texture_mtex_default(struct MTex *mtex)
Definition: texture.c:398
struct MovieTrackingObject * BKE_tracking_object_add(struct MovieTracking *tracking, const char *name)
Definition: tracking.c:2104
struct ListBase * BKE_tracking_object_get_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:2218
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:124
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:128
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:352
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int max_iii(int a, int b, int c)
void unit_m4(float m[4][4])
Definition: rct.c:1140
#define DEG2RADF(_deg)
void copy_vn_fl(float *array_tar, const int size, const float val)
Definition: math_vector.c:1410
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE bool is_zero_v2(const float a[3]) ATTR_WARN_UNUSED_RESULT
#define FILE_MAXFILE
#define FILE_MAX
void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen)
Definition: path_util.c:1654
#define FILE_MAXDIR
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
size_t BLI_strlen_utf8(const char *strc) ATTR_NONNULL()
Definition: string_utf8.c:357
bool BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t len)
Definition: string_utils.c:381
unsigned char uchar
Definition: BLI_sys_types.h:86
#define SWAP(type, a, b)
#define UNUSED(x)
#define POINTER_AS_INT(i)
#define MAX2(a, b)
#define ELEM(...)
external readfile function prototypes.
@ SCULPT_TOOL_ROTATE
@ BRUSH_OVERLAY_CURSOR
@ BRUSH_OVERLAY_PRIMARY
#define DEFAULT_SENSOR_HEIGHT
@ CAM_PANO
#define DEFAULT_SENSOR_WIDTH
@ CONSTRAINT_TYPE_OBJECTSOLVER
@ CONSTRAINT_TYPE_SHRINKWRAP
@ CONSTRAINT_SPACE_LOCAL
@ CU_FRONT
@ CU_BACK
@ CD_MLOOPCOL
@ MOD_DPAINT_USE_DRYING
@ SM_HRES_NEAREST
@ SM_HRES_LINEAR
@ FREESTYLE_CONTROL_EDITOR_MODE
@ FREESTYLE_CULLING
@ FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE
@ FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL
blenloader genfile private function prototypes
bool DNA_struct_elem_find(const struct SDNA *sdna, const char *stype, const char *vartype, const char *name)
@ IMA_VIEW_AS_RENDER
@ IMA_ALPHA_STRAIGHT
@ IMA_SRC_VIEWER
#define LS_PANEL_MISC
#define LS_PANEL_STROKES
#define LS_CHAINING_PLAIN
#define LS_THICKNESS_CENTER
@ MOD_TRIANGULATE_QUAD_FIXED
@ MOD_TRIANGULATE_QUAD_BEAUTY
@ MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS
@ MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS
@ eModifierType_Fluidsim
@ eModifierType_Lattice
@ eModifierType_Cloth
@ eModifierType_Fluid
@ eModifierType_EdgeSplit
@ eModifierType_Bevel
@ eModifierType_DynamicPaint
@ eModifierType_Build
@ eModifierType_Triangulate
@ MOD_TRIANGULATE_NGON_BEAUTY
@ MOD_TRIANGULATE_NGON_EARCLIP
@ MOD_FLUID_TYPE_DOMAIN
@ MOD_FLUID_TYPE_FLOW
@ MOD_BUILD_FLAG_RANDOMIZE
#define NODE_OPTIONS
#define NTREE_TEXTURE
#define NTREE_COMPOSIT
#define CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT
@ SOCK_OUT
@ SOCK_IN
@ SHD_SUBSURFACE_CUBIC
#define NODE_PREVIEW
@ SOCK_IN_USE
@ SOCK_INT
@ SOCK_VECTOR
@ SOCK_BOOLEAN
@ SOCK_SHADER
@ SOCK_FLOAT
@ SOCK_STRING
@ SOCK_RGBA
#define NTREE_SHADER
#define NODE_INIT
@ OB_MODE_TEXTURE_PAINT
Object is a sort of wrapper for general info.
@ OB_PLAINAXES
@ OB_POSX
@ OB_NEGZ
@ OB_POSY
@ OB_POSZ
#define PART_DRAW_OB
@ PART_DRAW_NO_SCALE_OB
@ PART_DRAW_ROTATE_OB
#define PART_DRAW_GR
#define PART_ROTATIONS
#define PART_ROT_VEL
@ SCULPT_DYNTOPO_SUBDIVIDE
#define R_LINE_THICKNESS_ABSOLUTE
@ UNIFIED_PAINT_WEIGHT
#define R_IMF_IMTYPE_CINEON
#define R_IMF_IMTYPE_TIFF
#define R_IMF_IMTYPE_JP2
#define R_IMF_IMTYPE_IRIZ
@ R_COLOR_MANAGEMENT
#define R_IMF_IMTYPE_MULTILAYER
#define PROP_SMOOTH
#define R_IMF_JP2_FLAG_CINE_PRESET
@ R_IMF_CHAN_DEPTH_8
@ R_IMF_CHAN_DEPTH_16
@ R_IMF_CHAN_DEPTH_12
@ R_IMF_CHAN_DEPTH_32
@ PAINT_SYMM_Y
@ PAINT_SYMMETRY_FEATHER
@ PAINT_SYMM_X
@ PAINT_SYMM_Z
#define R_IMF_CINEON_FLAG_LOG
#define R_IMF_IMTYPE_DPX
#define R_IMF_FLAG_PREVIEW_JPG
#define R_IMF_JP2_FLAG_YCC
#define R_IMF_JP2_FLAG_CINE_48
#define SCE_SNAP_MODE_GRID
#define R_IMF_FLAG_ZBUF
#define R_IMF_IMTYPE_OPENEXR
#define SCE_SNAP_MODE_INCREMENT
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_RIGHT
@ RGN_ALIGN_NONE
@ RGN_FLAG_HIDDEN
@ RGN_TYPE_UI
@ RGN_TYPE_PREVIEW
@ RGN_TYPE_HEADER
@ RGN_TYPE_TOOLS
@ seqModifierType_ColorBalance
@ SEQ_ALPHA_STRAIGHT
@ SEQ_TYPE_WIPE
@ SI_SHOW_GPENCIL
@ SNODE_SHOW_GPENCIL
@ SPACE_CLIP
@ SPACE_OUTLINER
@ SPACE_NODE
@ SPACE_SEQ
@ SPACE_IMAGE
@ SPACE_VIEW3D
@ SC_VIEW_CLIP
@ SC_SHOW_ANNOTATION
@ SEQ_SHOW_GPENCIL
@ SO_SEQUENCE
@ SO_DATA_API
@ SO_LIBRARIES
@ SO_SCENES
@ TXT_ISEXT
#define PROJ_Z
#define TEX_USEALPHA
#define PROJ_X
#define MTEX_MAP_MODE_TILED
#define PROJ_Y
@ TRACK_MOTION_MODEL_TRANSLATION
@ V2D_IS_INIT
#define V3D_SHOW_ANNOTATION
@ V3D_AROUND_CENTER_MEDIAN
#define V3D_SHOW_RECONSTRUCTION
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
@ IMB_PROXY_25
Definition: IMB_imbuf.h:319
@ IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN
Definition: IMB_imbuf.h:312
@ IMB_TC_RECORD_RUN_NO_GAPS
Definition: IMB_imbuf.h:313
@ IMB_TC_FREE_RUN
Definition: IMB_imbuf.h:307
@ IMB_TC_RECORD_RUN
Definition: IMB_imbuf.h:304
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick SH_NODE_TEX_COORD
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume TEX_IMAGE
NODE_GROUP_OUTPUT
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance Directional Alpha Distance Hue Movie Ellipse Bokeh View CMP_NODE_KEYING
NODE_GROUP
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID CMP_NODE_DEFOCUS
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance Directional Alpha Distance Hue Movie Ellipse Bokeh View CMP_NODE_MASK
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance CMP_NODE_DBLUR
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z CMP_NODE_DILATEERODE
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance Directional Alpha Distance Hue Movie CMP_NODE_MASK_ELLIPSE
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume SH_NODE_TEX_IMAGE
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set CMP_NODE_IMAGE
@ PROP_NONE
Definition: RNA_types.h:113
#define SEQ_ALL_END
Definition: SEQ_iterator.h:48
#define SEQ_ALL_BEGIN(ed, _seq)
Definition: SEQ_iterator.h:41
#define output
ColorManagedColorspaceSettings colorspace_settings
short source
char alpha_mode
OperationNode * node
Scene scene
FreestyleLineStyle linestyle
World world
bNodeTree * ntree
DRWShaderLibrary * lib
struct @203::@204 surface
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static unsigned a[3]
Definition: RandGen.cpp:92
static void area(int d1, int d2, int e1, int e2, float weights[2])
bNodeSocket * node_group_output_find_socket(bNode *node, const char *identifier)
Definition: node_common.c:530
bNodeSocket * node_group_input_find_socket(bNode *node, const char *identifier)
Definition: node_common.c:433
void * blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr)
Definition: readfile.c:1840
void blo_do_versions_key_uidgen(Key *key)
Definition: readfile.c:2529
SequenceModifierData * SEQ_modifier_new(Sequence *seq, const char *name, int type)
struct ARegion * next
short alignment
short regiontype
float radius
float alpha
int mask_overlay_alpha
struct MTex mtex
float stencil_pos[2]
int texture_overlay_alpha
short ob_mode
float stencil_dimension[2]
int cursor_overlay_alpha
float mask_stencil_pos[2]
char sculpt_tool
struct MTex mask_mtex
float mask_stencil_dimension[2]
float weight
int overlay_flags
float sensor_y
float sensor_x
struct ClothSimSettings * sim_parms
StripColorBalance color_balance
float bevfac2
int len_char32
float ext1
float bevfac1
char * str
ListBase nurb
float ext2
CustomDataLayer * layers
struct DynamicPaintCanvasSettings * canvas
struct SDNA * filesdna
Definition: readfile.h:105
struct FluidDomainSettings * domain
struct FluidFlowSettings * flow
struct FluidsimSettings * fss
Definition: DNA_ID.h:273
struct Library * lib
Definition: DNA_ID.h:277
void * next
Definition: DNA_ID.h:274
ID id
Definition: DNA_key_types.h:79
char name[64]
char idname[64]
struct KeyingSet * next
void * last
Definition: DNA_listBase.h:47
void * first
Definition: DNA_listBase.h:47
unsigned char b
unsigned char r
char brush_map_mode
Definition: BKE_main.h:116
ListBase brushes
Definition: BKE_main.h:171
ListBase scenes
Definition: BKE_main.h:146
short subversionfile
Definition: BKE_main.h:119
ListBase textures
Definition: BKE_main.h:153
ListBase texts
Definition: BKE_main.h:163
ListBase meshes
Definition: BKE_main.h:149
ListBase movieclips
Definition: BKE_main.h:177
ListBase lights
Definition: BKE_main.h:156
ListBase nodetrees
Definition: BKE_main.h:170
ListBase particles
Definition: BKE_main.h:172
ListBase materials
Definition: BKE_main.h:152
ListBase linestyles
Definition: BKE_main.h:179
ListBase shapekeys
Definition: BKE_main.h:159
ListBase cameras
Definition: BKE_main.h:157
ListBase curves
Definition: BKE_main.h:150
ListBase worlds
Definition: BKE_main.h:160
ListBase screens
Definition: BKE_main.h:161
short versionfile
Definition: BKE_main.h:119
ListBase images
Definition: BKE_main.h:154
ListBase objects
Definition: BKE_main.h:148
struct bNodeTree * nodetree
struct CustomData pdata ldata
int totvert
int totloop
struct ModifierData * next
struct MovieClipProxy proxy
struct MovieTracking tracking
struct MovieTrackingObject * next
struct MovieTrackingPlaneTrack * next
MovieTrackingMarker * markers
struct MovieTrackingTrack * next
MovieTrackingCamera camera
MovieTrackingSettings settings
float angle_ofs
char name[1024]
struct ImageFormatData im_format
ImageFormatData format
struct Nurb * next
BezTriple * bezt
BPoint * bp
unsigned short col_group
ListBase constraints
char collision_boundtype
struct bPose * pose
ListBase modifiers
char boundtype
float scale[3]
unsigned short col_mask
float dscale[3]
int symmetry_flags
short bake_samples
struct ImageFormatData im_format
struct FFMpegCodecData ffcodecdata
int line_thickness_mode
float unit_line_thickness
struct bNodeTree * nodetree
ListBase keyingsets
struct ToolSettings * toolsettings
struct Editing * ed
struct RenderData r
ColorManagedDisplaySettings display_settings
Paint paint
struct MovieClipScopes scopes
char tree_idname[64]
struct ID * from
ListBase treepath
struct bNodeTree * edittree
struct ID * id
struct bNodeTree * nodetree
short imaflag
struct ImageUser iuser
short type
struct bNodeTree * nodetree
struct Image * ima
char * line
struct TextLine * next
int flags
ListBase lines
TextLine * curl
int curc
struct UnifiedPaintSettings unified_paint_settings
struct MeshStatVis statvis
short flag
float bundle_size
rctf render_border
char bundle_drawtype
struct bNodeTree * nodetree
struct bConstraint * next
unsigned int value
char name[64]
void * storage
struct bNodeLink * link
struct bNodeSocket * next
void * default_value
char identifier[64]
char idname[64]
bNodeInstanceKey parent_key
char idname[64]
struct bNodeTreeType * typeinfo
ListBase nodes
ListBase inputs
ListBase links
bNodeInstanceKey active_viewer_key
ListBase outputs
float locy
float locx
bAnimVizSettings avs
ListBase areabase
float xmax
Definition: DNA_vec_types.h:85
float xmin
Definition: DNA_vec_types.h:85
float ymax
Definition: DNA_vec_types.h:86
float ymin
Definition: DNA_vec_types.h:86
__forceinline const avxi srl(const avxi &a, const int32_t b)
Definition: util_avxi.h:348
void SEQ_alpha_mode_from_file_extension(Sequence *seq)
Definition: utils.c:516
static const char * node_socket_get_static_idname(bNodeSocket *sock)
#define BRUSH_FIXED
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)
void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
static void do_versions_affine_tracker_track(MovieTrackingTrack *track)
static void do_versions_image_settings_2_60(Scene *sce)
static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
static void do_versions_nodetree_image_layer_2_64_5(bNodeTree *ntree)
static void do_versions_nodetree_customnodes(bNodeTree *ntree, int UNUSED(is_group))
static void do_versions_nodetree_image_default_alpha_output(bNodeTree *ntree)
static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me)
void do_versions_after_linking_260(Main *bmain)
static const char * node_get_static_idname(int type, int treetype)
static void do_versions_nodetree_frame_2_64_6(bNodeTree *ntree)
static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNodeTree *ntree)
#define BRUSH_TEXTURE_OVERLAY