Blender  V3.3
versioning_270.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "BLI_compiler_attrs.h"
8 #include "BLI_utildefines.h"
9 
10 /* for MinGW32 definition of NULL, could use BLI_blenlib.h instead too */
11 #include <stddef.h>
12 
13 /* allow readfile to use deprecated functionality */
14 #define DNA_DEPRECATED_ALLOW
15 
16 #include "DNA_anim_types.h"
17 #include "DNA_armature_types.h"
18 #include "DNA_brush_types.h"
19 #include "DNA_camera_types.h"
20 #include "DNA_cloth_types.h"
21 #include "DNA_constraint_types.h"
22 #include "DNA_fluid_types.h"
23 #include "DNA_gpencil_types.h"
24 #include "DNA_light_types.h"
25 #include "DNA_linestyle_types.h"
26 #include "DNA_mask_types.h"
27 #include "DNA_mesh_types.h"
28 #include "DNA_modifier_types.h"
29 #include "DNA_object_force_types.h"
30 #include "DNA_object_types.h"
31 #include "DNA_particle_types.h"
32 #include "DNA_pointcache_types.h"
33 #include "DNA_rigidbody_types.h"
34 #include "DNA_screen_types.h"
35 #include "DNA_sdna_types.h"
36 #include "DNA_sequence_types.h"
37 #include "DNA_space_types.h"
38 #include "DNA_view3d_types.h"
39 
40 #include "DNA_genfile.h"
41 
42 #include "BKE_anim_data.h"
43 #include "BKE_animsys.h"
44 #include "BKE_colortools.h"
45 #include "BKE_fcurve_driver.h"
46 #include "BKE_main.h"
47 #include "BKE_mask.h"
48 #include "BKE_modifier.h"
49 #include "BKE_node.h"
50 #include "BKE_scene.h"
51 #include "BKE_screen.h"
52 #include "BKE_tracking.h"
53 #include "DNA_material_types.h"
54 
55 #include "SEQ_effects.h"
56 #include "SEQ_iterator.h"
57 
58 #include "BLI_listbase.h"
59 #include "BLI_math.h"
60 #include "BLI_string.h"
61 #include "BLI_string_utils.h"
62 
63 #include "BLT_translation.h"
64 
65 #include "BLO_readfile.h"
66 
67 #include "NOD_common.h"
68 #include "NOD_composite.h"
69 #include "NOD_socket.h"
70 
71 #include "readfile.h"
72 
73 #include "MEM_guardedalloc.h"
74 
75 /* Make preferences read-only, use versioning_userdef.c. */
76 #define U (*((const UserDef *)&U))
77 
78 /* ************************************************** */
79 /* GP Palettes API (Deprecated) */
80 
81 /* add a new gp-palette */
82 static bGPDpalette *BKE_gpencil_palette_addnew(bGPdata *gpd, const char *name)
83 {
84  bGPDpalette *palette;
85 
86  /* check that list is ok */
87  if (gpd == NULL) {
88  return NULL;
89  }
90 
91  /* allocate memory and add to end of list */
92  palette = MEM_callocN(sizeof(bGPDpalette), "bGPDpalette");
93 
94  /* add to datablock */
95  BLI_addtail(&gpd->palettes, palette);
96 
97  /* set basic settings */
98  /* auto-name */
99  BLI_strncpy(palette->info, name, sizeof(palette->info));
100  BLI_uniquename(&gpd->palettes,
101  palette,
102  DATA_("GP_Palette"),
103  '.',
104  offsetof(bGPDpalette, info),
105  sizeof(palette->info));
106 
107  /* return palette */
108  return palette;
109 }
110 
111 /* add a new gp-palettecolor */
113 {
114  bGPDpalettecolor *palcolor;
115 
116  /* check that list is ok */
117  if (palette == NULL) {
118  return NULL;
119  }
120 
121  /* allocate memory and add to end of list */
122  palcolor = MEM_callocN(sizeof(bGPDpalettecolor), "bGPDpalettecolor");
123 
124  /* add to datablock */
125  BLI_addtail(&palette->colors, palcolor);
126 
127  /* set basic settings */
128  copy_v4_v4(palcolor->color, U.gpencil_new_layer_col);
129  ARRAY_SET_ITEMS(palcolor->fill, 1.0f, 1.0f, 1.0f);
130 
131  /* auto-name */
132  BLI_strncpy(palcolor->info, name, sizeof(palcolor->info));
133  BLI_uniquename(&palette->colors,
134  palcolor,
135  DATA_("Color"),
136  '.',
137  offsetof(bGPDpalettecolor, info),
138  sizeof(palcolor->info));
139 
140  /* return palette color */
141  return palcolor;
142 }
143 
151 {
152  if (stab->rot_track) {
153  if (!(stab->rot_track->flag & TRACK_USE_2D_STAB_ROT)) {
154  stab->tot_rot_track++;
155  stab->rot_track->flag |= TRACK_USE_2D_STAB_ROT;
156  }
157  }
158  stab->rot_track = NULL; /* this field is now ignored */
159 }
160 
162 {
163  bConstraint *con;
164 
165  for (con = lb->first; con; con = con->next) {
166  if (con->type == CONSTRAINT_TYPE_TRANSFORM) {
168  const float deg_to_rad_f = DEG2RADF(1.0f);
169 
170  if (data->from == TRANS_ROTATION) {
171  mul_v3_fl(data->from_min, deg_to_rad_f);
172  mul_v3_fl(data->from_max, deg_to_rad_f);
173  }
174 
175  if (data->to == TRANS_ROTATION) {
176  mul_v3_fl(data->to_min, deg_to_rad_f);
177  mul_v3_fl(data->to_max, deg_to_rad_f);
178  }
179  }
180  }
181 }
182 
184 {
185  bConstraint *con;
186 
187  for (con = lb->first; con; con = con->next) {
188  if (con->type == CONSTRAINT_TYPE_TRANSFORM) {
190 
191  if (data->from == TRANS_ROTATION) {
192  copy_v3_v3(data->from_min_rot, data->from_min);
193  copy_v3_v3(data->from_max_rot, data->from_max);
194  }
195  else if (data->from == TRANS_SCALE) {
196  copy_v3_v3(data->from_min_scale, data->from_min);
197  copy_v3_v3(data->from_max_scale, data->from_max);
198  }
199 
200  if (data->to == TRANS_ROTATION) {
201  copy_v3_v3(data->to_min_rot, data->to_min);
202  copy_v3_v3(data->to_max_rot, data->to_max);
203  }
204  else if (data->to == TRANS_SCALE) {
205  copy_v3_v3(data->to_min_scale, data->to_min);
206  copy_v3_v3(data->to_max_scale, data->to_max);
207  }
208  }
209  }
210 }
211 
213 {
214  bConstraint *con;
215 
216  for (con = lb->first; con; con = con->next) {
217  if (con->type == CONSTRAINT_TYPE_STRETCHTO) {
219  data->bulge_min = 1.0f;
220  data->bulge_max = 1.0f;
221  }
222  }
223 }
224 
226 {
227  ARegion *region;
228 
229  for (region = regionbase->first; region; region = region->next) {
230  if (region->regiontype == RGN_TYPE_UI) {
231  /* already exists */
232  return;
233  }
234  if (region->regiontype == RGN_TYPE_WINDOW) {
235  /* add new region here */
236  ARegion *region_new = MEM_callocN(sizeof(ARegion), "buttons for action");
237 
238  BLI_insertlinkbefore(regionbase, region, region_new);
239 
240  region_new->regiontype = RGN_TYPE_UI;
241  region_new->alignment = RGN_ALIGN_RIGHT;
242  region_new->flag = RGN_FLAG_HIDDEN;
243 
244  return;
245  }
246  }
247 }
248 
250 {
251  LISTBASE_FOREACH (Bone *, bone, lb) {
252  bone->scale_in_x = bone->scale_in_z = 1.0f;
253  bone->scale_out_x = bone->scale_out_z = 1.0f;
254 
255  do_version_bones_super_bbone(&bone->childbase);
256  }
257 }
258 
259 /* TODO(sergey): Consider making it somewhat more generic function in BLI_anim.h. */
260 static void anim_change_prop_name(FCurve *fcu,
261  const char *prefix,
262  const char *old_prop_name,
263  const char *new_prop_name)
264 {
265  const char *old_path = BLI_sprintfN("%s.%s", prefix, old_prop_name);
266  if (STREQ(fcu->rna_path, old_path)) {
267  MEM_freeN(fcu->rna_path);
268  fcu->rna_path = BLI_sprintfN("%s.%s", prefix, new_prop_name);
269  }
270  MEM_freeN((char *)old_path);
271 }
272 
274 {
275  if (node->storage == NULL) {
276  return;
277  }
278 
279  /* Make sure new sockets are properly created. */
280  node_verify_sockets(ntree, node, false);
281  /* Convert value from old storage to new sockets. */
282  NodeHueSat *nhs = node->storage;
284  *saturation = nodeFindSocket(node, SOCK_IN, "Saturation"),
285  *value = nodeFindSocket(node, SOCK_IN, "Value");
286  ((bNodeSocketValueFloat *)hue->default_value)->value = nhs->hue;
287  ((bNodeSocketValueFloat *)saturation->default_value)->value = nhs->sat;
288  ((bNodeSocketValueFloat *)value->default_value)->value = nhs->val;
289  /* Take care of possible animation. */
291  if (adt != NULL && adt->action != NULL) {
292  char node_name_esc[sizeof(node->name) * 2];
293  BLI_str_escape(node_name_esc, node->name, sizeof(node_name_esc));
294  const char *prefix = BLI_sprintfN("nodes[\"%s\"]", node_name_esc);
295  for (FCurve *fcu = adt->action->curves.first; fcu != NULL; fcu = fcu->next) {
296  if (STRPREFIX(fcu->rna_path, prefix)) {
297  anim_change_prop_name(fcu, prefix, "color_hue", "inputs[1].default_value");
298  anim_change_prop_name(fcu, prefix, "color_saturation", "inputs[2].default_value");
299  anim_change_prop_name(fcu, prefix, "color_value", "inputs[3].default_value");
300  }
301  }
302  MEM_freeN((char *)prefix);
303  }
304  /* Free storage, it is no longer used. */
305  MEM_freeN(node->storage);
306  node->storage = NULL;
307 }
308 
310 {
311  int pass_index = 0;
312  const char *sockname;
313  for (bNodeSocket *sock = node->outputs.first; sock && pass_index < 31;
314  sock = sock->next, pass_index++) {
315  if (sock->storage == NULL) {
316  NodeImageLayer *sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
317  sock->storage = sockdata;
318  BLI_strncpy(sockdata->pass_name,
319  node_cmp_rlayers_sock_to_pass(pass_index),
320  sizeof(sockdata->pass_name));
321 
322  if (pass_index == 0) {
323  sockname = "Image";
324  }
325  else if (pass_index == 1) {
326  sockname = "Alpha";
327  }
328  else {
329  sockname = node_cmp_rlayers_sock_to_pass(pass_index);
330  }
331  BLI_strncpy(sock->name, sockname, sizeof(sock->name));
332  }
333  }
334 }
335 
337 {
339  if (node->type == CMP_NODE_R_LAYERS) {
340  /* First we make sure existing sockets have proper names.
341  * This is important because otherwise verification will
342  * drop links from sockets which were renamed.
343  */
345  /* Make sure new sockets are properly created. */
346  node_verify_sockets(ntree, node, false);
347  /* Make sure all possibly created sockets have proper storage. */
349  }
350  }
351 }
352 
353 static char *replace_bbone_easing_rnapath(char *old_path)
354 {
355  char *new_path = NULL;
356 
357  /* NOTE: This will break paths for any bones/custom-properties
358  * which happen be named after the bbone property id's
359  */
360  if (strstr(old_path, "bbone_in")) {
361  new_path = BLI_str_replaceN(old_path, "bbone_in", "bbone_easein");
362  }
363  else if (strstr(old_path, "bbone_out")) {
364  new_path = BLI_str_replaceN(old_path, "bbone_out", "bbone_easeout");
365  }
366 
367  if (new_path) {
368  MEM_freeN(old_path);
369  return new_path;
370  }
371 
372  return old_path;
373 }
374 
376  FCurve *fcu,
377  void *UNUSED(user_data))
378 {
379  /* F-Curve's path (for bbone_in/out) */
380  if (fcu->rna_path) {
382  }
383 
384  /* Driver -> Driver Vars (for bbone_in/out) */
385  if (fcu->driver) {
386  LISTBASE_FOREACH (DriverVar *, dvar, &fcu->driver->variables) {
388  if (dtar->rna_path) {
389  dtar->rna_path = replace_bbone_easing_rnapath(dtar->rna_path);
390  }
391  }
393  }
394  }
395 
396  /* FModifiers -> Stepped (for frame_start/end) */
397  if (fcu->modifiers.first) {
398  LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) {
399  if (fcm->type == FMODIFIER_TYPE_STEPPED) {
400  FMod_Stepped *data = fcm->data;
401 
402  /* Modifier doesn't work if the modifier's copy of start/end frame are both 0
403  * as those were only getting written to the fcm->data copy (T52009)
404  */
405  if ((fcm->sfra == fcm->efra) && (fcm->sfra == 0)) {
406  fcm->sfra = data->start_frame;
407  fcm->efra = data->end_frame;
408  }
409  }
410  }
411  }
412 }
413 
414 static bool seq_update_proxy_cb(Sequence *seq, void *UNUSED(user_data))
415 {
416  seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
417 
418 #define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
419 #define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
420  if (seq->strip && seq->strip->proxy && !seq->strip->proxy->storage) {
421  if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
423  }
424  if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
426  }
427  }
428 #undef SEQ_USE_PROXY_CUSTOM_DIR
429 #undef SEQ_USE_PROXY_CUSTOM_FILE
430  return true;
431 }
432 
434 {
435 
436  if (seq->type != SEQ_TYPE_TEXT) {
437  return true;
438  }
439 
440  if (seq->effectdata == NULL) {
441  struct SeqEffectHandle effect_handle = SEQ_effect_handle_get(seq);
442  effect_handle.init(seq);
443  }
444 
445  TextVars *data = seq->effectdata;
446  if (data->color[3] == 0.0f) {
447  copy_v4_fl(data->color, 1.0f);
448  data->shadow_color[3] = 1.0f;
449  }
450  return true;
451 }
452 
453 /* NOLINTNEXTLINE: readability-function-size */
455 {
456  if (!MAIN_VERSION_ATLEAST(bmain, 270, 0)) {
457 
458  if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) {
459  Object *ob;
460 
461  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
462  ModifierData *md;
463  for (md = ob->modifiers.first; md; md = md->next) {
464  if (md->type == eModifierType_Bevel) {
466  bmd->profile = 0.5f;
468  }
469  }
470  }
471  }
472 
473  /* nodes don't use fixed node->id any more, clean up */
474  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
475  if (ntree->type == NTREE_COMPOSIT) {
476  bNode *node;
477  for (node = ntree->nodes.first; node; node = node->next) {
479  node->id = NULL;
480  }
481  }
482  }
483  }
485 
486  {
487  bScreen *screen;
488 
489  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
490  ScrArea *area;
491  for (area = screen->areabase.first; area; area = area->next) {
492  SpaceLink *space_link;
493  for (space_link = area->spacedata.first; space_link; space_link = space_link->next) {
494  if (space_link->spacetype == SPACE_CLIP) {
495  SpaceClip *space_clip = (SpaceClip *)space_link;
496  if (space_clip->mode != SC_MODE_MASKEDIT) {
497  space_clip->mode = SC_MODE_TRACKING;
498  }
499  }
500  }
501  }
502  }
503  }
504 
505  if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingSettings", "float", "default_weight")) {
506  MovieClip *clip;
507  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
508  clip->tracking.settings.default_weight = 1.0f;
509  }
510  }
511  }
512 
513  if (!MAIN_VERSION_ATLEAST(bmain, 270, 1)) {
514  Object *ob;
515 
516  /* Update Transform constraint (another deg -> rad stuff). */
517  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
519 
520  if (ob->pose) {
521  /* Bones constraints! */
522  bPoseChannel *pchan;
523  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
525  }
526  }
527  }
528  }
529 
530  if (!MAIN_VERSION_ATLEAST(bmain, 270, 2)) {
531  Mesh *me;
532 
533  /* Mesh smoothresh deg->rad. */
534  for (me = bmain->meshes.first; me; me = me->id.next) {
535  me->smoothresh = DEG2RADF(me->smoothresh);
536  }
537  }
538 
539  if (!MAIN_VERSION_ATLEAST(bmain, 270, 3)) {
541 
546  }
547  }
548 
549  if (!MAIN_VERSION_ATLEAST(bmain, 270, 4)) {
550  /* ui_previews were not handled correctly when copying areas,
551  * leading to corrupted files (see T39847).
552  * This will always reset situation to a valid state.
553  */
554  bScreen *screen;
555 
556  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
557  ScrArea *area;
558  for (area = screen->areabase.first; area; area = area->next) {
559  SpaceLink *sl;
560 
561  for (sl = area->spacedata.first; sl; sl = sl->next) {
562  ARegion *region;
563  ListBase *lb = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
564 
565  for (region = lb->first; region; region = region->next) {
567  }
568  }
569  }
570  }
571  }
572 
573  if (!MAIN_VERSION_ATLEAST(bmain, 270, 5)) {
574  Object *ob;
575 
576  /* Update Transform constraint (again :|). */
577  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
579 
580  if (ob->pose) {
581  /* Bones constraints! */
582  bPoseChannel *pchan;
583  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
585  }
586  }
587  }
588  }
589 
590  if (!MAIN_VERSION_ATLEAST(bmain, 271, 0)) {
591  if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "BakeData", "bake")) {
592  Scene *sce;
593 
594  for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
595  sce->r.bake.flag = R_BAKE_CLEAR;
596  sce->r.bake.width = 512;
597  sce->r.bake.height = 512;
598  sce->r.bake.margin = 16;
600  sce->r.bake.normal_swizzle[0] = R_BAKE_POSX;
601  sce->r.bake.normal_swizzle[1] = R_BAKE_POSY;
602  sce->r.bake.normal_swizzle[2] = R_BAKE_POSZ;
603  BLI_strncpy(sce->r.bake.filepath, U.renderdir, sizeof(sce->r.bake.filepath));
604 
608  sce->r.bake.im_format.quality = 90;
609  sce->r.bake.im_format.compress = 15;
610  }
611  }
612 
613  if (!DNA_struct_elem_find(fd->filesdna, "FreestyleLineStyle", "float", "texstep")) {
615 
618  linestyle->texstep = 1.0;
619  }
620  }
621 
622  {
623  Scene *scene;
624  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
625  int num_layers = BLI_listbase_count(&scene->r.layers);
626  scene->r.actlay = min_ff(scene->r.actlay, num_layers - 1);
627  }
628  }
629  }
630 
631  if (!MAIN_VERSION_ATLEAST(bmain, 271, 1)) {
632  if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "line_col[4]")) {
633  Material *mat;
634 
635  for (mat = bmain->materials.first; mat; mat = mat->id.next) {
636  mat->line_col[0] = mat->line_col[1] = mat->line_col[2] = 0.0f;
637  mat->line_col[3] = mat->alpha;
638  }
639  }
640  }
641 
642  if (!MAIN_VERSION_ATLEAST(bmain, 271, 3)) {
643  Brush *br;
644 
645  for (br = bmain->brushes.first; br; br = br->id.next) {
646  br->fill_threshold = 0.2f;
647  }
648 
649  if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "int", "mat")) {
650  Object *ob;
651  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
652  ModifierData *md;
653 
654  for (md = ob->modifiers.first; md; md = md->next) {
655  if (md->type == eModifierType_Bevel) {
657  bmd->mat = -1;
658  }
659  }
660  }
661  }
662  }
663 
664  if (!MAIN_VERSION_ATLEAST(bmain, 271, 6)) {
665  Object *ob;
666  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
667  ModifierData *md;
668 
669  for (md = ob->modifiers.first; md; md = md->next) {
670  if (md->type == eModifierType_ParticleSystem) {
672  if (pmd->psys && pmd->psys->clmd) {
673  pmd->psys->clmd->sim_parms->vel_damping = 1.0f;
674  }
675  }
676  }
677  }
678  }
679 
680  if (!MAIN_VERSION_ATLEAST(bmain, 272, 1)) {
681  Brush *br;
682  for (br = bmain->brushes.first; br; br = br->id.next) {
683  if ((br->ob_mode & OB_MODE_SCULPT) &&
685  br->alpha = 1.0f;
686  }
687  }
688  }
689 
690  if (!MAIN_VERSION_ATLEAST(bmain, 272, 2)) {
691  if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) {
692  Image *image;
693  for (image = bmain->images.first; image != NULL; image = image->id.next) {
694  image->gen_color[3] = 1.0f;
695  }
696  }
697 
698  if (!DNA_struct_elem_find(fd->filesdna, "bStretchToConstraint", "float", "bulge_min")) {
699  Object *ob;
700 
701  /* Update Transform constraint (again :|). */
702  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
704 
705  if (ob->pose) {
706  /* Bones constraints! */
707  bPoseChannel *pchan;
708  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
710  }
711  }
712  }
713  }
714  }
715 
716  if (!MAIN_VERSION_ATLEAST(bmain, 273, 1)) {
717 #define BRUSH_RAKE (1 << 7)
718 #define BRUSH_RANDOM_ROTATION (1 << 25)
719 
720  Brush *br;
721 
722  for (br = bmain->brushes.first; br; br = br->id.next) {
723  if (br->flag & BRUSH_RAKE) {
726  }
727  else if (br->flag & BRUSH_RANDOM_ROTATION) {
730  }
731  br->mtex.random_angle = 2.0 * M_PI;
732  br->mask_mtex.random_angle = 2.0 * M_PI;
733  }
734  }
735 
736 #undef BRUSH_RAKE
737 #undef BRUSH_RANDOM_ROTATION
738 
739  /* Customizable Safe Areas */
740  if (!MAIN_VERSION_ATLEAST(bmain, 273, 2)) {
741  if (!DNA_struct_elem_find(fd->filesdna, "Scene", "DisplaySafeAreas", "safe_areas")) {
742  Scene *scene;
743 
744  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
745  copy_v2_fl2(scene->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
746  copy_v2_fl2(scene->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
747  copy_v2_fl2(scene->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
748  copy_v2_fl2(scene->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
749  }
750  }
751  }
752 
753  if (!MAIN_VERSION_ATLEAST(bmain, 273, 3)) {
754  ParticleSettings *part;
755  for (part = bmain->particles.first; part; part = part->id.next) {
756  if (part->clumpcurve) {
758  }
759  if (part->roughcurve) {
761  }
762  }
763  }
764 
765  if (!MAIN_VERSION_ATLEAST(bmain, 273, 6)) {
766  if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
767  Object *ob;
768  ModifierData *md;
769  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
770  for (md = ob->modifiers.first; md; md = md->next) {
771  if (md->type == eModifierType_Cloth) {
772  ClothModifierData *clmd = (ClothModifierData *)md;
773  clmd->sim_parms->bending_damping = 0.5f;
774  }
775  else if (md->type == eModifierType_ParticleSystem) {
777  if (pmd->psys->clmd) {
778  pmd->psys->clmd->sim_parms->bending_damping = 0.5f;
779  }
780  }
781  }
782  }
783  }
784 
785  if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "float", "clump_noise_size")) {
786  ParticleSettings *part;
787  for (part = bmain->particles.first; part; part = part->id.next) {
788  part->clump_noise_size = 1.0f;
789  }
790  }
791 
792  if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "int", "kink_extra_steps")) {
793  ParticleSettings *part;
794  for (part = bmain->particles.first; part; part = part->id.next) {
795  part->kink_extra_steps = 4;
796  }
797  }
798 
799  if (!DNA_struct_elem_find(fd->filesdna, "MTex", "float", "kinkampfac")) {
800  ParticleSettings *part;
801  for (part = bmain->particles.first; part; part = part->id.next) {
802  int a;
803  for (a = 0; a < MAX_MTEX; a++) {
804  MTex *mtex = part->mtex[a];
805  if (mtex) {
806  mtex->kinkampfac = 1.0f;
807  }
808  }
809  }
810  }
811 
812  if (!DNA_struct_elem_find(fd->filesdna, "HookModifierData", "char", "flag")) {
813  Object *ob;
814 
815  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
816  ModifierData *md;
817  for (md = ob->modifiers.first; md; md = md->next) {
818  if (md->type == eModifierType_Hook) {
819  HookModifierData *hmd = (HookModifierData *)md;
821  }
822  }
823  }
824  }
825 
826  if (!DNA_struct_elem_find(fd->filesdna, "NodePlaneTrackDeformData", "char", "flag")) {
827  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
828  if (ntree->type == NTREE_COMPOSIT) {
829  bNode *node;
830  for (node = ntree->nodes.first; node; node = node->next) {
831  if (ELEM(node->type, CMP_NODE_PLANETRACKDEFORM)) {
832  NodePlaneTrackDeformData *data = node->storage;
833  data->flag = 0;
834  data->motion_blur_samples = 16;
835  data->motion_blur_shutter = 0.5f;
836  }
837  }
838  }
839  }
841  }
842 
843  if (!DNA_struct_elem_find(fd->filesdna, "Camera", "GPUDOFSettings", "gpu_dof")) {
844  Camera *ca;
845  for (ca = bmain->cameras.first; ca; ca = ca->id.next) {
846  ca->gpu_dof.fstop = 128.0f;
847  ca->gpu_dof.focal_length = 1.0f;
848  ca->gpu_dof.focus_distance = 1.0f;
849  ca->gpu_dof.sensor = 1.0f;
850  }
851  }
852  }
853 
854  if (!MAIN_VERSION_ATLEAST(bmain, 273, 8)) {
855  Object *ob;
856  for (ob = bmain->objects.first; ob != NULL; ob = ob->id.next) {
857  ModifierData *md;
858  for (md = ob->modifiers.last; md != NULL; md = md->prev) {
859  if (BKE_modifier_unique_name(&ob->modifiers, md)) {
860  printf(
861  "Warning: Object '%s' had several modifiers with the "
862  "same name, renamed one of them to '%s'.\n",
863  ob->id.name + 2,
864  md->name);
865  }
866  }
867  }
868  }
869 
870  if (!MAIN_VERSION_ATLEAST(bmain, 273, 9)) {
871  bScreen *screen;
872  ScrArea *area;
873  SpaceLink *sl;
874  ARegion *region;
875 
876  /* Make sure sequencer preview area limits zoom */
877  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
878  for (area = screen->areabase.first; area; area = area->next) {
879  for (sl = area->spacedata.first; sl; sl = sl->next) {
880  if (sl->spacetype == SPACE_SEQ) {
881  for (region = sl->regionbase.first; region; region = region->next) {
882  if (region->regiontype == RGN_TYPE_PREVIEW) {
883  region->v2d.keepzoom |= V2D_LIMITZOOM;
884  region->v2d.minzoom = 0.001f;
885  region->v2d.maxzoom = 1000.0f;
886  break;
887  }
888  }
889  }
890  }
891  }
892  }
893  }
894 
895  if (!MAIN_VERSION_ATLEAST(bmain, 274, 1)) {
896  /* particle systems need to be forced to redistribute for jitter mode fix */
897  {
898  Object *ob;
899  ParticleSystem *psys;
900  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
901  for (psys = ob->particlesystem.first; psys; psys = psys->next) {
902  if ((psys->pointcache->flag & PTCACHE_BAKED) == 0) {
903  psys->recalc |= ID_RECALC_PSYS_RESET;
904  }
905  }
906  }
907  }
908  }
909 
910  if (!MAIN_VERSION_ATLEAST(bmain, 274, 4)) {
911  SceneRenderView *srv;
912  wmWindowManager *wm;
913  bScreen *screen;
914  wmWindow *win;
915  Scene *scene;
916  Camera *cam;
917  Image *ima;
918 
919  for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
921  srv = scene->r.views.first;
922  BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
923 
925  srv = scene->r.views.last;
926  BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
927 
928  if (scene->ed) {
930  }
931  }
932 
933  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
934  ScrArea *area;
935  for (area = screen->areabase.first; area; area = area->next) {
936  SpaceLink *sl;
937 
938  for (sl = area->spacedata.first; sl; sl = sl->next) {
939  switch (sl->spacetype) {
940  case SPACE_VIEW3D: {
941  View3D *v3d = (View3D *)sl;
944  v3d->stereo3d_convergence_alpha = 0.15f;
945  v3d->stereo3d_volume_alpha = 0.05f;
946  break;
947  }
948  case SPACE_IMAGE: {
949  SpaceImage *sima = (SpaceImage *)sl;
950  sima->iuser.flag |= IMA_SHOW_STEREO;
951  break;
952  }
953  }
954  }
955  }
956  }
957 
958  for (cam = bmain->cameras.first; cam; cam = cam->id.next) {
959  cam->stereo.interocular_distance = 0.065f;
960  cam->stereo.convergence_distance = 30.0f * 0.065f;
961  }
962 
963  for (ima = bmain->images.first; ima; ima = ima->id.next) {
964  ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo 3d Format");
965 
966  if (ima->packedfile) {
967  ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image Packed File");
968  BLI_addtail(&ima->packedfiles, imapf);
969 
970  imapf->packedfile = ima->packedfile;
971  BLI_strncpy(imapf->filepath, ima->filepath, FILE_MAX);
972  ima->packedfile = NULL;
973  }
974  }
975 
976  for (wm = bmain->wm.first; wm; wm = wm->id.next) {
977  for (win = wm->windows.first; win; win = win->next) {
978  win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
979  }
980  }
981  }
982 
983  if (!MAIN_VERSION_ATLEAST(bmain, 274, 6)) {
984  bScreen *screen;
985 
986  if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", "int", "thumbnail_size")) {
987  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
988  ScrArea *area;
989 
990  for (area = screen->areabase.first; area; area = area->next) {
991  SpaceLink *sl;
992 
993  for (sl = area->spacedata.first; sl; sl = sl->next) {
994  if (sl->spacetype == SPACE_FILE) {
995  SpaceFile *sfile = (SpaceFile *)sl;
996 
997  if (sfile->params) {
998  sfile->params->thumbnail_size = 128;
999  }
1000  }
1001  }
1002  }
1003  }
1004  }
1005 
1006  if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "short", "simplify_subsurf_render")) {
1007  Scene *scene;
1008  for (scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
1011  }
1012  }
1013 
1014  if (!DNA_struct_elem_find(fd->filesdna, "DecimateModifierData", "float", "defgrp_factor")) {
1015  Object *ob;
1016 
1017  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1018  ModifierData *md;
1019  for (md = ob->modifiers.first; md; md = md->next) {
1020  if (md->type == eModifierType_Decimate) {
1022  dmd->defgrp_factor = 1.0f;
1023  }
1024  }
1025  }
1026  }
1027  }
1028 
1029  if (!MAIN_VERSION_ATLEAST(bmain, 275, 3)) {
1030  Brush *br;
1031 #define BRUSH_TORUS (1 << 1)
1032  for (br = bmain->brushes.first; br; br = br->id.next) {
1033  br->flag &= ~BRUSH_TORUS;
1034  }
1035 #undef BRUSH_TORUS
1036  }
1037 
1038  if (!MAIN_VERSION_ATLEAST(bmain, 276, 2)) {
1039  if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "custom_scale")) {
1040  Object *ob;
1041 
1042  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1043  if (ob->pose) {
1044  bPoseChannel *pchan;
1045  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
1046  pchan->custom_scale = 1.0f;
1047  }
1048  }
1049  }
1050  }
1051 
1052  {
1053  bScreen *screen;
1054 #define RV3D_VIEW_PERSPORTHO 7
1055  for (screen = bmain->screens.first; screen; screen = screen->id.next) {
1056  ScrArea *area;
1057  for (area = screen->areabase.first; area; area = area->next) {
1058  SpaceLink *sl;
1059  for (sl = area->spacedata.first; sl; sl = sl->next) {
1060  if (sl->spacetype == SPACE_VIEW3D) {
1061  ARegion *region;
1062  ListBase *lb = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
1063  for (region = lb->first; region; region = region->next) {
1064  if (region->regiontype == RGN_TYPE_WINDOW) {
1065  if (region->regiondata) {
1066  RegionView3D *rv3d = region->regiondata;
1067  if (rv3d->view == RV3D_VIEW_PERSPORTHO) {
1068  rv3d->view = RV3D_VIEW_USER;
1069  }
1070  }
1071  }
1072  }
1073  break;
1074  }
1075  }
1076  }
1077  }
1078 #undef RV3D_VIEW_PERSPORTHO
1079  }
1080 
1081  {
1082 #define LA_YF_PHOTON 5
1083  for (Light *la = bmain->lights.first; la; la = la->id.next) {
1084  if (la->type == LA_YF_PHOTON) {
1085  la->type = LA_LOCAL;
1086  }
1087  }
1088 #undef LA_YF_PHOTON
1089  }
1090  }
1091 
1092  if (!MAIN_VERSION_ATLEAST(bmain, 276, 3)) {
1093  if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "CurveMapping", "mblur_shutter_curve")) {
1094  Scene *scene;
1095  for (scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
1096  CurveMapping *curve_mapping = &scene->r.mblur_shutter_curve;
1097  BKE_curvemapping_set_defaults(curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f);
1098  BKE_curvemapping_init(curve_mapping);
1100  curve_mapping->cm, &curve_mapping->clipr, CURVE_PRESET_MAX, CURVEMAP_SLOPE_POS_NEG);
1101  }
1102  }
1103  }
1104 
1105  if (!MAIN_VERSION_ATLEAST(bmain, 276, 4)) {
1106  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1108  if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "gpencil_v3d_align")) {
1111  }
1112  }
1113 
1114  for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
1115  bool enabled = false;
1116 
1117  /* Ensure that the datablock's onion-skinning toggle flag
1118  * stays in sync with the status of the actual layers
1119  */
1120  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
1121  if (gpl->flag & GP_LAYER_ONIONSKIN) {
1122  enabled = true;
1123  }
1124  }
1125 
1126  if (enabled) {
1127  gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
1128  }
1129  else {
1130  gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
1131  }
1132  }
1133  }
1134  if (!MAIN_VERSION_ATLEAST(bmain, 276, 5)) {
1135  ListBase *lbarray[INDEX_ID_MAX];
1136  int a;
1137 
1138  /* Important to clear all non-persistent flags from older versions here,
1139  * otherwise they could collide with any new persistent flag we may add in the future. */
1140  a = set_listbasepointers(bmain, lbarray);
1141  while (a--) {
1142  LISTBASE_FOREACH (ID *, id, lbarray[a]) {
1143  id->flag &= LIB_FAKEUSER;
1144 
1145  /* NOTE: This is added in 4.1 code.
1146  *
1147  * Original commit (3fcf535d2e) forgot to handle embedded IDs. Fortunately, back then, the
1148  * only embedded IDs that existed were the NodeTree ones, and the current API to access
1149  * them should still be valid on code from 9 years ago. */
1151  if (node_tree) {
1152  node_tree->id.flag &= LIB_FAKEUSER;
1153  }
1154  }
1155  }
1156  }
1157 
1158  if (!MAIN_VERSION_ATLEAST(bmain, 276, 7)) {
1159  Scene *scene;
1160  for (scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
1162  }
1163  }
1164 
1165  if (!MAIN_VERSION_ATLEAST(bmain, 277, 1)) {
1166  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1168  for (int a = 0; a < ARRAY_SIZE(pset->brush); a++) {
1169  if (pset->brush[a].strength > 1.0f) {
1170  pset->brush[a].strength *= 0.01f;
1171  }
1172  }
1173  }
1174 
1175  for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
1176  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1177  LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1178  ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
1179  &sl->regionbase;
1180  /* Bug: Was possible to add preview region to sequencer view by using AZones. */
1181  if (sl->spacetype == SPACE_SEQ) {
1182  SpaceSeq *sseq = (SpaceSeq *)sl;
1183  if (sseq->view == SEQ_VIEW_SEQUENCE) {
1184  LISTBASE_FOREACH (ARegion *, region, regionbase) {
1185  /* remove preview region for sequencer-only view! */
1186  if (region->regiontype == RGN_TYPE_PREVIEW) {
1187  region->flag |= RGN_FLAG_HIDDEN;
1188  region->alignment = RGN_ALIGN_NONE;
1189  break;
1190  }
1191  }
1192  }
1193  }
1194  /* Remove old deprecated region from file-browsers. */
1195  else if (sl->spacetype == SPACE_FILE) {
1196  LISTBASE_FOREACH (ARegion *, region, regionbase) {
1197  if (region->regiontype == RGN_TYPE_CHANNELS) {
1198  /* Free old deprecated 'channel' region... */
1199  BKE_area_region_free(NULL, region);
1200  BLI_freelinkN(regionbase, region);
1201  break;
1202  }
1203  }
1204  }
1205  }
1206  }
1207  }
1208 
1209  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1211  if (cps->error_threshold == 0) {
1212  cps->curve_type = CU_BEZIER;
1214  cps->error_threshold = 8;
1215  cps->radius_max = 1.0f;
1216  cps->corner_angle = DEG2RADF(70.0f);
1217  }
1218  }
1219 
1220  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1221  if (scene->ed) {
1223  }
1224  }
1225 
1226  /* Adding "Properties" region to DopeSheet */
1227  for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
1228  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1229  /* handle pushed-back space data first */
1230  LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1231  if (sl->spacetype == SPACE_ACTION) {
1232  SpaceAction *saction = (SpaceAction *)sl;
1234  }
1235  }
1236 
1237  /* active spacedata info must be handled too... */
1238  if (area->spacetype == SPACE_ACTION) {
1240  }
1241  }
1242  }
1243  }
1244 
1245  if (!MAIN_VERSION_ATLEAST(bmain, 277, 2)) {
1246  if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "scaleIn")) {
1247  for (bArmature *arm = bmain->armatures.first; arm; arm = arm->id.next) {
1248  do_version_bones_super_bbone(&arm->bonebase);
1249  }
1250  }
1251  if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "scaleIn")) {
1252  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
1253  if (ob->pose) {
1254  LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
1255  /* see do_version_bones_super_bbone()... */
1256  pchan->scale_in_x = pchan->scale_in_z = 1.0f;
1257  pchan->scale_out_x = pchan->scale_out_z = 1.0f;
1258 
1259  /* also make sure some legacy (unused for over a decade) flags are unset,
1260  * so that we can reuse them for stuff that matters now...
1261  * (i.e. POSE_IK_MAT, (unknown/unused x 4), POSE_HAS_IK)
1262  *
1263  * These seem to have been runtime flags used by the IK solver, but that stuff
1264  * should be able to be recalculated automatically anyway, so it should be fine.
1265  */
1266  pchan->flag &= ~((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8));
1267  }
1268  }
1269  }
1270  }
1271 
1272  for (Camera *camera = bmain->cameras.first; camera != NULL; camera = camera->id.next) {
1273  if (camera->stereo.pole_merge_angle_from == 0.0f &&
1274  camera->stereo.pole_merge_angle_to == 0.0f) {
1275  camera->stereo.pole_merge_angle_from = DEG2RADF(60.0f);
1276  camera->stereo.pole_merge_angle_to = DEG2RADF(75.0f);
1277  }
1278  }
1279 
1280  if (!DNA_struct_elem_find(fd->filesdna, "NormalEditModifierData", "float", "mix_limit")) {
1281  Object *ob;
1282 
1283  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1284  ModifierData *md;
1285  for (md = ob->modifiers.first; md; md = md->next) {
1286  if (md->type == eModifierType_NormalEdit) {
1288  nemd->mix_limit = DEG2RADF(180.0f);
1289  }
1290  }
1291  }
1292  }
1293 
1294  if (!DNA_struct_elem_find(fd->filesdna, "BooleanModifierData", "float", "double_threshold")) {
1295  Object *ob;
1296  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1297  ModifierData *md;
1298  for (md = ob->modifiers.first; md; md = md->next) {
1299  if (md->type == eModifierType_Boolean) {
1301  bmd->double_threshold = 1e-6f;
1302  }
1303  }
1304  }
1305  }
1306 
1307  for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
1308  if (br->sculpt_tool == SCULPT_TOOL_FLATTEN) {
1309  br->flag |= BRUSH_ACCUMULATE;
1310  }
1311  }
1312 
1313  if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "time_scale")) {
1314  Object *ob;
1315  ModifierData *md;
1316  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1317  for (md = ob->modifiers.first; md; md = md->next) {
1318  if (md->type == eModifierType_Cloth) {
1319  ClothModifierData *clmd = (ClothModifierData *)md;
1320  clmd->sim_parms->time_scale = 1.0f;
1321  }
1322  else if (md->type == eModifierType_ParticleSystem) {
1324  if (pmd->psys->clmd) {
1325  pmd->psys->clmd->sim_parms->time_scale = 1.0f;
1326  }
1327  }
1328  }
1329  }
1330  }
1331  }
1332 
1333  if (!MAIN_VERSION_ATLEAST(bmain, 277, 3)) {
1334  /* ------- init of grease pencil initialization --------------- */
1335  if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "bGPDpalettecolor", "*palcolor")) {
1336  /* Convert Grease Pencil to new palettes/brushes
1337  * Loop all strokes and create the palette and all colors
1338  */
1339  for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
1340  if (BLI_listbase_is_empty(&gpd->palettes)) {
1341  /* create palette */
1342  bGPDpalette *palette = BKE_gpencil_palette_addnew(gpd, "GP_Palette");
1343  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
1344  /* create color using layer name */
1345  bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_addnew(palette, gpl->info);
1346  if (palcolor != NULL) {
1347  /* set color attributes */
1348  copy_v4_v4(palcolor->color, gpl->color);
1349  copy_v4_v4(palcolor->fill, gpl->fill);
1350 
1351  if (gpl->flag & GP_LAYER_HIDE) {
1352  palcolor->flag |= PC_COLOR_HIDE;
1353  }
1354  if (gpl->flag & GP_LAYER_LOCKED) {
1355  palcolor->flag |= PC_COLOR_LOCKED;
1356  }
1357  if (gpl->flag & GP_LAYER_ONIONSKIN) {
1358  palcolor->flag |= PC_COLOR_ONIONSKIN;
1359  }
1360  if (gpl->flag & GP_LAYER_VOLUMETRIC) {
1361  palcolor->flag |= PC_COLOR_VOLUMETRIC;
1362  }
1363 
1364  /* set layer opacity to 1 */
1365  gpl->opacity = 1.0f;
1366 
1367  /* set tint color */
1368  ARRAY_SET_ITEMS(gpl->tintcolor, 0.0f, 0.0f, 0.0f, 0.0f);
1369 
1370  /* flush relevant layer-settings to strokes */
1371  LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
1372  LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
1373  /* set stroke to palette and force recalculation */
1374  BLI_strncpy(gps->colorname, gpl->info, sizeof(gps->colorname));
1375  gps->thickness = gpl->thickness;
1376 
1377  /* set alpha strength to 1 */
1378  for (int i = 0; i < gps->totpoints; i++) {
1379  gps->points[i].strength = 1.0f;
1380  }
1381  }
1382  }
1383  }
1384  }
1385  }
1386  }
1387  }
1388  /* ------- end of grease pencil initialization --------------- */
1389  }
1390 
1391  if (!MAIN_VERSION_ATLEAST(bmain, 278, 0)) {
1392  if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingTrack", "float", "weight_stab")) {
1393  MovieClip *clip;
1394  for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
1395  MovieTracking *tracking = &clip->tracking;
1396  MovieTrackingObject *tracking_object;
1397  for (tracking_object = tracking->objects.first; tracking_object != NULL;
1398  tracking_object = tracking_object->next) {
1399  ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
1400  MovieTrackingTrack *track;
1401  for (track = tracksbase->first; track != NULL; track = track->next) {
1402  track->weight_stab = track->weight;
1403  }
1404  }
1405  }
1406  }
1407 
1408  if (!DNA_struct_elem_find(
1409  fd->filesdna, "MovieTrackingStabilization", "int", "tot_rot_track")) {
1410  MovieClip *clip;
1411  for (clip = bmain->movieclips.first; clip != NULL; clip = clip->id.next) {
1412  if (clip->tracking.stabilization.rot_track) {
1414  }
1415  if (clip->tracking.stabilization.scale == 0.0f) {
1416  /* ensure init.
1417  * Was previously used for auto-scale only,
1418  * now used always (as "target scale") */
1419  clip->tracking.stabilization.scale = 1.0f;
1420  }
1421  /* blender prefers 1-based frame counting;
1422  * thus using frame 1 as reference typically works best */
1424  /* by default show the track lists expanded, to improve "discoverability" */
1426  /* deprecated, not used anymore */
1427  clip->tracking.stabilization.ok = false;
1428  }
1429  }
1430  }
1431  if (!MAIN_VERSION_ATLEAST(bmain, 278, 2)) {
1432  if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "ffmpeg_preset")) {
1433  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1434  /* "medium" is the preset FFmpeg uses when no presets are given. */
1435  scene->r.ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM;
1436  }
1437  }
1438  if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "constant_rate_factor")) {
1439  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1440  /* fall back to behavior from before we introduced CRF for old files */
1442  }
1443  }
1444 
1445  if (!DNA_struct_elem_find(fd->filesdna, "FluidModifierData", "float", "slice_per_voxel")) {
1446  Object *ob;
1447  ModifierData *md;
1448 
1449  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1450  for (md = ob->modifiers.first; md; md = md->next) {
1451  if (md->type == eModifierType_Fluid) {
1452  FluidModifierData *fmd = (FluidModifierData *)md;
1453  if (fmd->domain) {
1454  fmd->domain->slice_per_voxel = 5.0f;
1455  fmd->domain->slice_depth = 0.5f;
1456  fmd->domain->display_thickness = 1.0f;
1457  }
1458  }
1459  }
1460  }
1461  }
1462  }
1463 
1464  if (!MAIN_VERSION_ATLEAST(bmain, 278, 3)) {
1465  for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
1466  if (scene->toolsettings != NULL) {
1468  ParticleEditSettings *pset = &ts->particle;
1469  for (int a = 0; a < ARRAY_SIZE(pset->brush); a++) {
1470  if (pset->brush[a].count == 0) {
1471  pset->brush[a].count = 10;
1472  }
1473  }
1474  }
1475  }
1476 
1477  if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyCon", "float", "spring_stiffness_ang_x")) {
1478  Object *ob;
1479  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1481  if (rbc) {
1482  rbc->spring_stiffness_ang_x = 10.0;
1483  rbc->spring_stiffness_ang_y = 10.0;
1484  rbc->spring_stiffness_ang_z = 10.0;
1485  rbc->spring_damping_ang_x = 0.5;
1486  rbc->spring_damping_ang_y = 0.5;
1487  rbc->spring_damping_ang_z = 0.5;
1488  }
1489  }
1490  }
1491 
1492  /* constant detail for sculpting is now a resolution value instead of
1493  * a percentage, we reuse old DNA struct member but convert it */
1494  for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
1495  if (scene->toolsettings != NULL) {
1497  if (ts->sculpt && ts->sculpt->constant_detail != 0.0f) {
1498  ts->sculpt->constant_detail = 100.0f / ts->sculpt->constant_detail;
1499  }
1500  }
1501  }
1502  }
1503 
1504  if (!MAIN_VERSION_ATLEAST(bmain, 278, 4)) {
1505  const float sqrt_3 = (float)M_SQRT3;
1506  for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
1507  br->fill_threshold /= sqrt_3;
1508  }
1509 
1510  /* Custom motion paths */
1511  if (!DNA_struct_elem_find(fd->filesdna, "bMotionPath", "int", "line_thickness")) {
1512  Object *ob;
1513  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1514  bMotionPath *mpath;
1515  bPoseChannel *pchan;
1516  mpath = ob->mpath;
1517  if (mpath) {
1518  mpath->color[0] = 1.0f;
1519  mpath->color[1] = 0.0f;
1520  mpath->color[2] = 0.0f;
1521  mpath->line_thickness = 1;
1522  mpath->flag |= MOTIONPATH_FLAG_LINES;
1523  }
1524  /* bones motion path */
1525  if (ob->pose) {
1526  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
1527  mpath = pchan->mpath;
1528  if (mpath) {
1529  mpath->color[0] = 1.0f;
1530  mpath->color[1] = 0.0f;
1531  mpath->color[2] = 0.0f;
1532  mpath->line_thickness = 1;
1533  mpath->flag |= MOTIONPATH_FLAG_LINES;
1534  }
1535  }
1536  }
1537  }
1538  }
1539  }
1540 
1541  if (!MAIN_VERSION_ATLEAST(bmain, 278, 5)) {
1542  /* Mask primitive adding code was not initializing correctly id_type of its points' parent. */
1543  for (Mask *mask = bmain->masks.first; mask; mask = mask->id.next) {
1544  LISTBASE_FOREACH (MaskLayer *, mlayer, &mask->masklayers) {
1545  LISTBASE_FOREACH (MaskSpline *, mspline, &mlayer->splines) {
1546  int i = 0;
1547  for (MaskSplinePoint *mspoint = mspline->points; i < mspline->tot_point;
1548  mspoint++, i++) {
1549  if (mspoint->parent.id_type == 0) {
1550  BKE_mask_parent_init(&mspoint->parent);
1551  }
1552  }
1553  }
1554  }
1555  }
1556 
1557  /* Fix for T50736, Glare comp node using same var for two different things. */
1558  if (!DNA_struct_elem_find(fd->filesdna, "NodeGlare", "char", "star_45")) {
1559  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1560  if (ntree->type == NTREE_COMPOSIT) {
1563  if (node->type == CMP_NODE_GLARE) {
1564  NodeGlare *ndg = node->storage;
1565  switch (ndg->type) {
1566  case 2: /* Grrrr! magic numbers :( */
1567  ndg->streaks = ndg->angle;
1568  break;
1569  case 0:
1570  ndg->star_45 = ndg->angle != 0;
1571  break;
1572  default:
1573  break;
1574  }
1575  }
1576  }
1577  }
1578  }
1580  }
1581 
1582  if (!DNA_struct_elem_find(fd->filesdna, "SurfaceDeformModifierData", "float", "mat[4][4]")) {
1583  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
1584  LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1585  if (md->type == eModifierType_SurfaceDeform) {
1587  unit_m4(smd->mat);
1588  }
1589  }
1590  }
1591  }
1592 
1593  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1594  if (ntree->type == NTREE_COMPOSIT) {
1596  }
1597  }
1599  }
1600 
1601  if (!MAIN_VERSION_ATLEAST(bmain, 279, 0)) {
1602  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1605  }
1606  }
1607 
1608  /* Fix related to VGroup modifiers creating named defgroup CD layers! See T51520. */
1609  for (Mesh *me = bmain->meshes.first; me; me = me->id.next) {
1610  CustomData_set_layer_name(&me->vdata, CD_MDEFORMVERT, 0, "");
1611  }
1612  }
1613 
1614  if (!MAIN_VERSION_ATLEAST(bmain, 279, 3)) {
1615  if (!DNA_struct_elem_find(fd->filesdna, "FluidDomainSettings", "float", "clipping")) {
1616  Object *ob;
1617  ModifierData *md;
1618 
1619  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
1620  for (md = ob->modifiers.first; md; md = md->next) {
1621  if (md->type == eModifierType_Fluid) {
1622  FluidModifierData *fmd = (FluidModifierData *)md;
1623  if (fmd->domain) {
1624  fmd->domain->clipping = 1e-3f;
1625  }
1626  }
1627  }
1628  }
1629  }
1630  }
1631 
1632  if (!MAIN_VERSION_ATLEAST(bmain, 279, 4)) {
1633  /* Fix for invalid state of screen due to bug in older versions. */
1634  for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
1635  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1636  if (area->full && screen->state == SCREENNORMAL) {
1637  area->full = NULL;
1638  }
1639  }
1640  }
1641 
1642  if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "falloff_angle")) {
1643  for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
1644  br->falloff_angle = DEG2RADF(80);
1645  /* These flags are used for new features. They are not related to `falloff_angle`. */
1648  }
1649 
1650  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1652  for (int i = 0; i < 2; i++) {
1653  VPaint *vp = i ? ts->vpaint : ts->wpaint;
1654  if (vp != NULL) {
1655  /* remove all other flags */
1656  vp->flag &= (VP_FLAG_VGROUP_RESTRICT);
1657  }
1658  }
1659  }
1660  }
1661 
1662  /* Simple deform modifier no longer assumes Z axis (X for bend type).
1663  * Must set previous defaults. */
1664  if (!DNA_struct_elem_find(fd->filesdna, "SimpleDeformModifierData", "char", "deform_axis")) {
1665  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
1666  LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1667  if (md->type == eModifierType_SimpleDeform) {
1669  smd->deform_axis = 2;
1670  }
1671  }
1672  }
1673  }
1674 
1675  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
1676  int preset = scene->r.ffcodecdata.ffmpeg_preset;
1677  if (preset == FFM_PRESET_NONE || preset >= FFM_PRESET_GOOD) {
1678  continue;
1679  }
1680  if (preset <= FFM_PRESET_FAST) {
1681  preset = FFM_PRESET_REALTIME;
1682  }
1683  else if (preset >= FFM_PRESET_SLOW) {
1684  preset = FFM_PRESET_BEST;
1685  }
1686  else {
1687  preset = FFM_PRESET_GOOD;
1688  }
1689  scene->r.ffcodecdata.ffmpeg_preset = preset;
1690  }
1691 
1692  if (!DNA_struct_elem_find(
1693  fd->filesdna, "ParticleInstanceModifierData", "float", "particle_amount")) {
1694  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
1695  LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1696  if (md->type == eModifierType_ParticleInstance) {
1699  pimd->particle_amount = 1.0f;
1700  }
1701  }
1702  }
1703  }
1704  }
1705 }
1706 
1708 {
1709  /* To be added to next subversion bump! */
1710  if (!MAIN_VERSION_ATLEAST(bmain, 279, 0)) {
1711  FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1712  if (ntree->type == NTREE_COMPOSIT) {
1715  if (node->type == CMP_NODE_HUE_SAT) {
1717  }
1718  }
1719  }
1720  }
1722  }
1723 
1724  if (!MAIN_VERSION_ATLEAST(bmain, 279, 2)) {
1725  /* B-Bones (bbone_in/out -> bbone_easein/out) + Stepped FMod Frame Start/End fix */
1726  /* if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "bbone_easein")) */
1728  }
1729 }
typedef float(TangentPoint)[2]
struct AnimData * BKE_animdata_from_id(const struct ID *id)
void BKE_fcurves_main_cb(struct Main *bmain, ID_FCurve_Edit_Callback func, void *user_data)
Definition: anim_data.c:1166
void BKE_curvemapping_init(struct CurveMapping *cumap)
Definition: colortools.c:1235
void BKE_curvemapping_set_defaults(struct CurveMapping *cumap, int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:37
void BKE_curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope)
@ CURVEMAP_SLOPE_POS_NEG
bool CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name)
#define DRIVER_TARGETS_LOOPER_BEGIN(dvar)
#define DRIVER_TARGETS_LOOPER_END
int set_listbasepointers(struct Main *main, struct ListBase *lb[])
Definition: main.c:654
#define MAIN_VERSION_ATLEAST(main, ver, subver)
Definition: BKE_main.h:427
void BKE_mask_parent_init(struct MaskParent *parent)
Definition: mask.c:1577
bool BKE_modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md)
#define CMP_NODE_COMPOSITE
Definition: BKE_node.h:1217
struct bNodeTree * ntreeFromID(struct ID *id)
Definition: node.cc:3231
#define CMP_NODE_HUE_SAT
Definition: BKE_node.h:1214
#define CMP_NODE_GLARE
Definition: BKE_node.h:1272
#define CMP_NODE_PLANETRACKDEFORM
Definition: BKE_node.h:1286
#define CMP_NODE_OUTPUT_FILE
Definition: BKE_node.h:1218
#define FOREACH_NODETREE_END
Definition: BKE_node.h:1058
struct bNodeSocket * nodeFindSocket(const struct bNode *node, eNodeSocketInOut in_out, const char *identifier)
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition: BKE_node.h:1048
#define CMP_NODE_R_LAYERS
Definition: BKE_node.h:1216
void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree)
Definition: node.cc:1253
struct SceneRenderView * BKE_scene_add_render_view(struct Scene *sce, const char *name)
Definition: scene.cc:2740
void BKE_area_region_free(struct SpaceType *st, struct ARegion *region)
Definition: screen.c:626
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
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:239
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:273
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:340
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define M_SQRT3
Definition: BLI_math_base.h:35
MINLINE float min_ff(float a, float b)
#define M_PI
Definition: BLI_math_base.h:20
void unit_m4(float m[4][4])
Definition: rct.c:1090
#define DEG2RADF(_deg)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v2_fl2(float v[2], float x, float y)
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v4_fl(float r[4], float f)
#define FILE_MAX
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_str_replaceN(const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:448
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL()
Definition: string.c:250
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
#define STRPREFIX(a, b)
#define ARRAY_SIZE(arr)
#define ARRAY_SET_ITEMS(...)
#define UNUSED(x)
#define ELEM(...)
#define STREQ(a, b)
external readfile function prototypes.
#define DATA_(msgid)
@ ID_RECALC_PSYS_RESET
Definition: DNA_ID.h:800
@ INDEX_ID_MAX
Definition: DNA_ID.h:1058
@ LIB_FAKEUSER
Definition: DNA_ID.h:630
@ MOTIONPATH_FLAG_LINES
@ FMODIFIER_TYPE_STEPPED
@ BRUSH_GRAB_ACTIVE_VERTEX
@ BRUSH_ORIGINAL_PLANE
@ BRUSH_ACCUMULATE
@ BRUSH_FRONTFACE_FALLOFF
@ BRUSH_SCENE_SPACING
@ BRUSH_INVERT_TO_SCRAPE_FILL
@ SCULPT_TOOL_GRAB
@ SCULPT_TOOL_FLATTEN
@ SCULPT_TOOL_SNAKE_HOOK
@ CURVE_PRESET_MAX
@ CONSTRAINT_TYPE_TRANSFORM
@ CONSTRAINT_TYPE_STRETCHTO
@ TRANS_SCALE
@ TRANS_ROTATION
@ CU_BEZIER
@ CD_MDEFORMVERT
blenloader genfile private function prototypes
bool DNA_struct_elem_find(const struct SDNA *sdna, const char *stype, const char *vartype, const char *name)
@ PC_COLOR_LOCKED
@ PC_COLOR_ONIONSKIN
@ PC_COLOR_VOLUMETRIC
@ PC_COLOR_HIDE
@ GP_LAYER_LOCKED
@ GP_LAYER_HIDE
@ GP_LAYER_VOLUMETRIC
@ GP_LAYER_ONIONSKIN
@ GP_DATA_SHOW_ONIONSKINS
#define IMA_SHOW_STEREO
#define LA_LOCAL
#define LS_INTEGRATION_MEAN
#define LS_NO_SORTING
#define LS_SORT_KEY_DISTANCE_FROM_CAMERA
#define LS_TEXTURE
@ MOD_BEVEL_AMT_OFFSET
@ eModifierType_ParticleSystem
@ eModifierType_Boolean
@ eModifierType_SimpleDeform
@ eModifierType_NormalEdit
@ eModifierType_Cloth
@ eModifierType_Fluid
@ eModifierType_Hook
@ eModifierType_SurfaceDeform
@ eModifierType_ParticleInstance
@ eModifierType_Bevel
@ eModifierType_Decimate
@ eHook_Falloff_InvSquare
@ eParticleInstanceSpace_World
#define NTREE_COMPOSIT
@ SOCK_IN
@ OB_MODE_SCULPT
Object is a sort of wrapper for general info.
@ PART_CHILD_USE_CLUMP_CURVE
@ PART_CHILD_USE_ROUGH_CURVE
@ PTCACHE_BAKED
Types and defines for representing Rigid Body entities.
#define STEREO_LEFT_NAME
#define R_BAKE_CLEAR
@ FFM_PRESET_GOOD
@ FFM_PRESET_REALTIME
@ FFM_PRESET_NONE
@ FFM_PRESET_BEST
@ R_BAKE_POSY
@ R_BAKE_POSZ
@ R_BAKE_POSX
#define R_IMF_IMTYPE_PNG
#define R_IMF_EXR_CODEC_DWAA
@ VP_FLAG_VGROUP_RESTRICT
@ FFM_CRF_NONE
@ R_IMF_CHAN_DEPTH_8
#define R_BAKE_SPACE_TANGENT
#define R_IMF_PLANES_RGBA
@ CURVE_PAINT_FLAG_CORNERS_DETECT
@ GP_PROJECT_VIEWSPACE
#define STEREO_LEFT_SUFFIX
#define STEREO_RIGHT_NAME
#define STEREO_RIGHT_SUFFIX
#define R_IMF_EXR_CODEC_DWAB
#define R_BAKE_PASS_FILTER_ALL
@ STEREO_3D_ID
@ RGN_FLAG_HIDDEN
@ SCREENNORMAL
@ RGN_TYPE_CHANNELS
@ RGN_TYPE_UI
@ RGN_TYPE_WINDOW
@ RGN_TYPE_PREVIEW
@ RGN_ALIGN_RIGHT
@ RGN_ALIGN_NONE
@ SEQ_TYPE_TEXT
@ SEQ_STORAGE_PROXY_CUSTOM_FILE
@ SEQ_STORAGE_PROXY_CUSTOM_DIR
@ SPACE_CLIP
@ SPACE_ACTION
@ SPACE_FILE
@ SPACE_SEQ
@ SPACE_IMAGE
@ SPACE_VIEW3D
@ SEQ_VIEW_SEQUENCE
@ SC_MODE_TRACKING
@ SC_MODE_MASKEDIT
#define MTEX_ANGLE_RAKE
#define MTEX_ANGLE_RANDOM
@ TRACKING_SHOW_STAB_TRACKS
@ TRACK_USE_2D_STAB_ROT
@ V2D_LIMITZOOM
#define RV3D_VIEW_USER
#define V3D_S3D_DISPPLANE
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 Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its hue
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 Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
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 Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its saturation
#define MAX_MTEX
Definition: Stroke.h:31
unsigned int U
Definition: btGjkEpa3.h:78
struct ListBase packedfiles
char filepath[1024]
struct Stereo3dFormat * stereo3d_format
OperationNode * node
Scene scene
FreestyleLineStyle linestyle
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 SeqEffectHandle SEQ_effect_handle_get(Sequence *seq)
Definition: effects.c:3704
bool enabled
void SEQ_for_each_callback(ListBase *seqbase, SeqForEachFunc callback, void *user_data)
Definition: iterator.c:76
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static unsigned a[3]
Definition: RandGen.cpp:78
static void area(int d1, int d2, int e1, int e2, float weights[2])
const char * node_cmp_rlayers_sock_to_pass(int sock_index)
void node_verify_sockets(bNodeTree *ntree, bNode *node, bool do_id_user)
Definition: node_socket.cc:257
void * regiondata
ListBase ui_previews
struct ARegion * next
short alignment
short regiontype
bAction * action
char normal_space
char normal_swizzle[3]
char filepath[1024]
struct ImageFormatData im_format
float alpha
struct MTex mtex
short ob_mode
float fill_threshold
char sculpt_tool
struct MTex mask_mtex
struct CameraStereoSettings stereo
ListBase variables
struct ClothSimSettings * sim_parms
CurveMap cm[4]
ListBase seqbase
char * rna_path
ChannelDriver * driver
ListBase modifiers
struct SDNA * filesdna
Definition: readfile.h:63
unsigned short thumbnail_size
struct FluidDomainSettings * domain
Definition: DNA_ID.h:368
void * next
Definition: DNA_ID.h:369
char name[66]
Definition: DNA_ID.h:378
struct PackedFile * packedfile
char filepath[1024]
void * last
Definition: DNA_listBase.h:31
void * first
Definition: DNA_listBase.h:31
char brush_angle_mode
float kinkampfac
float random_angle
Definition: BKE_main.h:121
ListBase brushes
Definition: BKE_main.h:193
ListBase masks
Definition: BKE_main.h:200
ListBase scenes
Definition: BKE_main.h:168
ListBase wm
Definition: BKE_main.h:197
ListBase meshes
Definition: BKE_main.h:171
ListBase movieclips
Definition: BKE_main.h:199
ListBase lights
Definition: BKE_main.h:178
ListBase particles
Definition: BKE_main.h:194
ListBase materials
Definition: BKE_main.h:174
ListBase linestyles
Definition: BKE_main.h:201
ListBase cameras
Definition: BKE_main.h:179
ListBase armatures
Definition: BKE_main.h:190
ListBase screens
Definition: BKE_main.h:183
ListBase images
Definition: BKE_main.h:176
ListBase gpencils
Definition: BKE_main.h:198
ListBase objects
Definition: BKE_main.h:170
float line_col[4]
float smoothresh
struct ModifierData * next
struct ModifierData * prev
struct MovieTracking tracking
struct MovieTrackingObject * next
struct MovieTrackingTrack * next
MovieTrackingStabilization stabilization
MovieTrackingSettings settings
char angle streaks
char angle star_45
char pass_name[64]
ListBase particlesystem
ListBase constraints
struct bPose * pose
ListBase modifiers
bMotionPath * mpath
struct RigidBodyCon * rigidbody_constraint
ParticleBrushData brush[7]
struct CurveMapping * clumpcurve
struct CurveMapping * roughcurve
struct MTex * mtex[18]
struct ParticleSystem * psys
struct ParticleSystem * next
struct PointCache * pointcache
struct ClothModifierData * clmd
short simplify_subsurf
struct CurveMapping mblur_shutter_curve
float simplify_particles
struct BakeData bake
float simplify_particles_render
struct ImageFormatData im_format
ListBase views
short simplify_subsurf_render
struct FFMpegCodecData ffcodecdata
struct ToolSettings * toolsettings
struct Editing * ed
struct RenderData r
struct DisplaySafeAreas safe_areas
float constant_detail
void(* init)(struct Sequence *seq)
Definition: SEQ_effects.h:35
struct Stereo3dFormat * stereo3d_format
ListBase regionbase
FileSelectParams * params
struct ImageUser iuser
StripProxy * proxy
struct CurvePaintSettings curve_paint_settings
struct ParticleEditSettings particle
float minzoom
short keepzoom
float maxzoom
char stereo3d_camera
float stereo3d_volume_alpha
short stereo3d_flag
float stereo3d_convergence_alpha
ListBase curves
struct bConstraint * next
float color[3]
ListBase nodes
ListBase constraints
bMotionPath * mpath
struct bPoseChannel * next
ListBase chanbase
ListBase areabase
struct wmWindow * next
struct Stereo3dFormat * stereo3d_format
static bGPDpalette * BKE_gpencil_palette_addnew(bGPdata *gpd, const char *name)
static void do_version_hue_sat_node(bNodeTree *ntree, bNode *node)
static void do_version_bones_super_bbone(ListBase *lb)
static bool seq_update_effectdata_cb(Sequence *seq, void *UNUSED(user_data))
#define LA_YF_PHOTON
#define BRUSH_RAKE
#define SEQ_USE_PROXY_CUSTOM_DIR
static bGPDpalettecolor * BKE_gpencil_palettecolor_addnew(bGPDpalette *palette, const char *name)
static void do_version_action_editor_properties_region(ListBase *regionbase)
static void do_version_bbone_easing_fcurve_fix(ID *UNUSED(id), FCurve *fcu, void *UNUSED(user_data))
#define BRUSH_TORUS
#define SEQ_USE_PROXY_CUSTOM_FILE
#define RV3D_VIEW_PERSPORTHO
void do_versions_after_linking_270(Main *bmain)
static void do_versions_compositor_render_passes_storage(bNode *node)
#define BRUSH_RANDOM_ROTATION
static void do_version_constraints_radians_degrees_270_1(ListBase *lb)
static void do_version_constraints_stretch_to_limits(ListBase *lb)
static char * replace_bbone_easing_rnapath(char *old_path)
static void do_version_constraints_radians_degrees_270_5(ListBase *lb)
static void anim_change_prop_name(FCurve *fcu, const char *prefix, const char *old_prop_name, const char *new_prop_name)
static bool seq_update_proxy_cb(Sequence *seq, void *UNUSED(user_data))
static void migrate_single_rot_stabilization_track_settings(MovieTrackingStabilization *stab)
static void do_versions_compositor_render_passes(bNodeTree *ntree)
void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)