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