Blender V5.0
versioning_290.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8/* allow readfile to use deprecated functionality */
9#define DNA_DEPRECATED_ALLOW
10
11#include <algorithm>
12
13#include "BLI_listbase.h"
14#include "BLI_math_matrix.h"
15#include "BLI_math_rotation.h"
16#include "BLI_math_vector.h"
17#include "BLI_string.h"
18#include "BLI_string_utf8.h"
19#include "BLI_utildefines.h"
20
21/* Define macros in `DNA_genfile.h`. */
22#define DNA_GENFILE_VERSIONING_MACROS
23
24#include "DNA_anim_types.h"
25#include "DNA_armature_types.h"
26#include "DNA_brush_types.h"
27#include "DNA_cachefile_types.h"
30#include "DNA_fluid_types.h"
31#include "DNA_genfile.h"
34#include "DNA_light_types.h"
35#include "DNA_mesh_types.h"
36#include "DNA_meshdata_types.h"
37#include "DNA_modifier_types.h"
38#include "DNA_object_types.h"
39#include "DNA_particle_types.h"
41#include "DNA_rigidbody_types.h"
42#include "DNA_screen_types.h"
43#include "DNA_sequence_types.h"
44#include "DNA_shader_fx_types.h"
45#include "DNA_space_types.h"
46#include "DNA_text_types.h"
47#include "DNA_tracking_types.h"
48#include "DNA_userdef_types.h"
50#include "DNA_workspace_types.h"
51
52#undef DNA_GENFILE_VERSIONING_MACROS
53
54#include "BKE_armature.hh"
55#include "BKE_collection.hh"
56#include "BKE_colortools.hh"
57#include "BKE_cryptomatte.h"
58#include "BKE_curve.hh"
59#include "BKE_customdata.hh"
60#include "BKE_fcurve.hh"
61#include "BKE_gpencil_legacy.h"
62#include "BKE_lib_id.hh"
63#include "BKE_main.hh"
64#include "BKE_mesh.hh"
66#include "BKE_multires.hh"
67#include "BKE_node.hh"
69
70#include "IMB_imbuf_enums.h"
71#include "MEM_guardedalloc.h"
72
73#include "SEQ_proxy.hh"
74#include "SEQ_sequencer.hh"
75#include "SEQ_time.hh"
76
77#include "BLO_readfile.hh"
78#include "readfile.hh"
79#include "versioning_common.hh"
80
81/* Make preferences read-only, use `versioning_userdef.cc`. */
82#define U (*((const UserDef *)&U))
83
85{
87
88 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
89 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
90 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
91 switch (sl->spacetype) {
92 case SPACE_SEQ: {
93 SpaceSeq *sseq = (SpaceSeq *)sl;
94 if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
95 render_size = eSpaceSeq_Proxy_RenderSize(sseq->render_size);
96 break;
97 }
98 }
99 }
100 }
101 }
102 }
103
104 return render_size;
105}
106
107static bool can_use_proxy(const Strip *strip, IMB_Proxy_Size psize)
108{
109 if (strip->data->proxy == nullptr) {
110 return false;
111 }
112 short size_flags = strip->data->proxy->build_size_flags;
113 return (strip->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE &&
114 (size_flags & psize) != 0;
115}
116
117/* image_size is width or height depending what RNA property is converted - X or Y. */
119 const Scene *scene,
120 const char *path,
121 const int image_size,
122 const int scene_size)
123{
124 if (scene->adt == nullptr || scene->adt->action == nullptr) {
125 return;
126 }
127
128 /* Hardcoded legacy bit-flags which has been removed. */
129 const uint32_t use_transform_flag = (1 << 16);
130 const uint32_t use_crop_flag = (1 << 17);
131
132 /* Convert offset animation, but only if crop is not used. */
133 if ((strip->flag & use_transform_flag) != 0 && (strip->flag & use_crop_flag) == 0) {
134 FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0);
135 if (fcu != nullptr && !BKE_fcurve_is_empty(fcu)) {
136 BezTriple *bezt = fcu->bezt;
137 for (int i = 0; i < fcu->totvert; i++, bezt++) {
138 /* Same math as with old_image_center_*, but simplified. */
139 bezt->vec[0][1] = (image_size - scene_size) / 2 + bezt->vec[0][1];
140 bezt->vec[1][1] = (image_size - scene_size) / 2 + bezt->vec[1][1];
141 bezt->vec[2][1] = (image_size - scene_size) / 2 + bezt->vec[2][1];
142 }
143 }
144 }
145 else { /* Else, remove offset animation. */
146 FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0);
147 BLI_remlink(&scene->adt->action->curves, fcu);
148 BKE_fcurve_free(fcu);
149 }
150}
151
152static void strip_convert_transform_crop(const Scene *scene,
153 Strip *strip,
154 const eSpaceSeq_Proxy_RenderSize render_size)
155{
156 if (strip->data->transform == nullptr) {
157 strip->data->transform = MEM_callocN<StripTransform>(__func__);
158 }
159 if (strip->data->crop == nullptr) {
160 strip->data->crop = MEM_callocN<StripCrop>(__func__);
161 }
162
163 StripCrop *c = strip->data->crop;
164 StripTransform *t = strip->data->transform;
165 int old_image_center_x = scene->r.xsch / 2;
166 int old_image_center_y = scene->r.ysch / 2;
167 int image_size_x = scene->r.xsch;
168 int image_size_y = scene->r.ysch;
169
170 /* Hard-coded legacy bit-flags which has been removed. */
171 const uint32_t use_transform_flag = (1 << 16);
172 const uint32_t use_crop_flag = (1 << 17);
173
174 const StripElem *s_elem = strip->data->stripdata;
175 if (s_elem != nullptr) {
176 image_size_x = s_elem->orig_width;
177 image_size_y = s_elem->orig_height;
178
179 if (can_use_proxy(strip, blender::seq::rendersize_to_proxysize(render_size))) {
180 image_size_x /= blender::seq::rendersize_to_scale_factor(render_size);
181 image_size_y /= blender::seq::rendersize_to_scale_factor(render_size);
182 }
183 }
184
185 /* Default scale. */
186 if (t->scale_x == 0.0f && t->scale_y == 0.0f) {
187 t->scale_x = 1.0f;
188 t->scale_y = 1.0f;
189 }
190
191 /* Clear crop if it was unused. This must happen before converting values. */
192 if ((strip->flag & use_crop_flag) == 0) {
193 c->bottom = c->top = c->left = c->right = 0;
194 }
195
196 if ((strip->flag & use_transform_flag) == 0) {
197 t->xofs = t->yofs = 0;
198
199 /* Reverse scale to fit for strips not using offset. */
200 float project_aspect = float(scene->r.xsch) / float(scene->r.ysch);
201 float image_aspect = float(image_size_x) / float(image_size_y);
202 if (project_aspect > image_aspect) {
203 t->scale_x = project_aspect / image_aspect;
204 }
205 else {
206 t->scale_y = image_aspect / project_aspect;
207 }
208 }
209
210 if ((strip->flag & use_crop_flag) != 0 && (strip->flag & use_transform_flag) == 0) {
211 /* Calculate image offset. */
212 float s_x = scene->r.xsch / image_size_x;
213 float s_y = scene->r.ysch / image_size_y;
214 old_image_center_x += c->right * s_x - c->left * s_x;
215 old_image_center_y += c->top * s_y - c->bottom * s_y;
216
217 /* Convert crop to scale. */
218 int cropped_image_size_x = image_size_x - c->right - c->left;
219 int cropped_image_size_y = image_size_y - c->top - c->bottom;
220 c->bottom = c->top = c->left = c->right = 0;
221 t->scale_x *= float(image_size_x) / float(cropped_image_size_x);
222 t->scale_y *= float(image_size_y) / float(cropped_image_size_y);
223 }
224
225 if ((strip->flag & use_transform_flag) != 0) {
226 /* Convert image offset. */
227 old_image_center_x = image_size_x / 2 - c->left + t->xofs;
228 old_image_center_y = image_size_y / 2 - c->bottom + t->yofs;
229
230 /* Preserve original image size. */
231 t->scale_x = t->scale_y = std::max(float(image_size_x) / float(scene->r.xsch),
232 float(image_size_y) / float(scene->r.ysch));
233
234 /* Convert crop. */
235 if ((strip->flag & use_crop_flag) != 0) {
236 c->top /= t->scale_x;
237 c->bottom /= t->scale_x;
238 c->left /= t->scale_x;
239 c->right /= t->scale_x;
240 }
241 }
242
243 t->xofs = old_image_center_x - scene->r.xsch / 2;
244 t->yofs = old_image_center_y - scene->r.ysch / 2;
245
246 char name_esc[(sizeof(strip->name) - 2) * 2], *path;
247 BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc));
248
249 path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.offset_x", name_esc);
250 strip_convert_transform_animation(strip, scene, path, image_size_x, scene->r.xsch);
251 MEM_freeN(path);
252 path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.offset_y", name_esc);
253 strip_convert_transform_animation(strip, scene, path, image_size_y, scene->r.ysch);
254 MEM_freeN(path);
255
256 strip->flag &= ~use_transform_flag;
257 strip->flag &= ~use_crop_flag;
258}
259
260static void strip_convert_transform_crop_lb(const Scene *scene,
261 const ListBase *lb,
262 const eSpaceSeq_Proxy_RenderSize render_size)
263{
264
265 LISTBASE_FOREACH (Strip *, strip, lb) {
266 if (!ELEM(strip->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SOUND_HD)) {
267 strip_convert_transform_crop(scene, strip, render_size);
268 }
269 if (strip->type == STRIP_TYPE_META) {
270 strip_convert_transform_crop_lb(scene, &strip->seqbase, render_size);
271 }
272 }
273}
274
276 const char *path,
277 const float scale_to_fit_factor)
278{
279 if (scene->adt == nullptr || scene->adt->action == nullptr) {
280 return;
281 }
282
283 FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0);
284 if (fcu != nullptr && !BKE_fcurve_is_empty(fcu)) {
285 BezTriple *bezt = fcu->bezt;
286 for (int i = 0; i < fcu->totvert; i++, bezt++) {
287 /* Same math as with old_image_center_*, but simplified. */
288 bezt->vec[0][1] *= scale_to_fit_factor;
289 bezt->vec[1][1] *= scale_to_fit_factor;
290 bezt->vec[2][1] *= scale_to_fit_factor;
291 }
292 }
293}
294
295static void strip_convert_transform_crop_2(const Scene *scene,
296 Strip *strip,
297 const eSpaceSeq_Proxy_RenderSize render_size)
298{
299 const StripElem *s_elem = strip->data->stripdata;
300 if (s_elem == nullptr) {
301 return;
302 }
303
304 StripCrop *c = strip->data->crop;
305 StripTransform *t = strip->data->transform;
306 int image_size_x = s_elem->orig_width;
307 int image_size_y = s_elem->orig_height;
308
309 if (can_use_proxy(strip, blender::seq::rendersize_to_proxysize(render_size))) {
310 image_size_x /= blender::seq::rendersize_to_scale_factor(render_size);
311 image_size_y /= blender::seq::rendersize_to_scale_factor(render_size);
312 }
313
314 /* Calculate scale factor, so image fits in preview area with original aspect ratio. */
315 const float scale_to_fit_factor = std::min(float(scene->r.xsch) / float(image_size_x),
316 float(scene->r.ysch) / float(image_size_y));
317 t->scale_x *= scale_to_fit_factor;
318 t->scale_y *= scale_to_fit_factor;
319 c->top /= scale_to_fit_factor;
320 c->bottom /= scale_to_fit_factor;
321 c->left /= scale_to_fit_factor;
322 c->right /= scale_to_fit_factor;
323
324 char name_esc[(sizeof(strip->name) - 2) * 2], *path;
325 BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc));
326 path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.scale_x", name_esc);
327 strip_convert_transform_animation_2(scene, path, scale_to_fit_factor);
328 MEM_freeN(path);
329 path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.scale_y", name_esc);
330 strip_convert_transform_animation_2(scene, path, scale_to_fit_factor);
331 MEM_freeN(path);
332 path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop.min_x", name_esc);
333 strip_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor);
334 MEM_freeN(path);
335 path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop.max_x", name_esc);
336 strip_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor);
337 MEM_freeN(path);
338 path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop.min_y", name_esc);
339 strip_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor);
340 MEM_freeN(path);
341 path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop.max_x", name_esc);
342 strip_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor);
343 MEM_freeN(path);
344}
345
347 const ListBase *lb,
348 const eSpaceSeq_Proxy_RenderSize render_size)
349{
350
351 LISTBASE_FOREACH (Strip *, strip, lb) {
352 if (!ELEM(strip->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SOUND_HD)) {
353 strip_convert_transform_crop_2(scene, strip, render_size);
354 }
355 if (strip->type == STRIP_TYPE_META) {
356 strip_convert_transform_crop_lb_2(scene, &strip->seqbase, render_size);
357 }
358 }
359}
360
362{
364
365 if (ed == nullptr) {
366 return;
367 }
368
370 /* Update ms->disp_range from meta. */
371 if (ms->disp_range[0] == ms->disp_range[1]) {
372 ms->disp_range[0] = blender::seq::time_left_handle_frame_get(scene, ms->parent_strip);
373 ms->disp_range[1] = blender::seq::time_right_handle_frame_get(scene, ms->parent_strip);
374 }
375
376 /* Update meta strip endpoints. */
377 blender::seq::time_left_handle_frame_set(scene, ms->parent_strip, ms->disp_range[0]);
378 blender::seq::time_right_handle_frame_set(scene, ms->parent_strip, ms->disp_range[1]);
379
380 /* Recalculate effects using meta strip. */
381 ListBase *old_seqbasep = ms->old_strip ? &ms->old_strip->seqbase : &ed->seqbase;
382 LISTBASE_FOREACH (Strip *, strip, old_seqbasep) {
383 if (strip->input2) {
384 strip->start = strip->startdisp = max_ii(strip->input1->startdisp,
385 strip->input2->startdisp);
386 strip->enddisp = min_ii(strip->input1->enddisp, strip->input2->enddisp);
387 }
388 }
389
391 active_ms->old_strip = ms->parent_strip;
392 }
393}
394
396 const int node_type,
397 const char *old_name,
398 const char *new_name)
399{
400 /* Duplicate a link going into the original socket. */
401 LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
402 if (link->tonode->type_legacy == node_type) {
403 bNode *node = link->tonode;
404 bNodeSocket *dest_socket = blender::bke::node_find_socket(*node, SOCK_IN, new_name);
405 BLI_assert(dest_socket);
406 if (STREQ(link->tosock->name, old_name)) {
407 blender::bke::node_add_link(*ntree, *link->fromnode, *link->fromsock, *node, *dest_socket);
408 }
409 }
410 }
411
412 /* Duplicate the default value from the old socket and assign it to the new socket. */
413 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
414 if (node->type_legacy == node_type) {
415 bNodeSocket *source_socket = blender::bke::node_find_socket(*node, SOCK_IN, old_name);
416 bNodeSocket *dest_socket = blender::bke::node_find_socket(*node, SOCK_IN, new_name);
417 BLI_assert(source_socket && dest_socket);
418 if (dest_socket->default_value) {
419 MEM_freeN(dest_socket->default_value);
420 }
421 dest_socket->default_value = MEM_dupallocN(source_socket->default_value);
422 }
423 }
424}
425
427{
428 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 290, 1)) {
429 /* Patch old grease pencil modifiers material filter. */
430 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
431 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
432 switch (md->type) {
435 if (gpmd->materialname[0] != '\0') {
436 gpmd->material = static_cast<Material *>(
437 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
438 gpmd->materialname[0] = '\0';
439 }
440 break;
441 }
444 if (gpmd->materialname[0] != '\0') {
445 gpmd->material = static_cast<Material *>(
446 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
447 gpmd->materialname[0] = '\0';
448 }
449 break;
450 }
453 if (gpmd->materialname[0] != '\0') {
454 gpmd->material = static_cast<Material *>(
455 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
456 gpmd->materialname[0] = '\0';
457 }
458 break;
459 }
462 if (gpmd->materialname[0] != '\0') {
463 gpmd->material = static_cast<Material *>(
464 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
465 gpmd->materialname[0] = '\0';
466 }
467 break;
468 }
471 if (gpmd->materialname[0] != '\0') {
472 gpmd->material = static_cast<Material *>(
473 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
474 gpmd->materialname[0] = '\0';
475 }
476 break;
477 }
480 if (gpmd->materialname[0] != '\0') {
481 gpmd->material = static_cast<Material *>(
482 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
483 gpmd->materialname[0] = '\0';
484 }
485 break;
486 }
489 if (gpmd->materialname[0] != '\0') {
490 gpmd->material = static_cast<Material *>(
491 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
492 gpmd->materialname[0] = '\0';
493 }
494 break;
495 }
498 if (gpmd->materialname[0] != '\0') {
499 gpmd->material = static_cast<Material *>(
500 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
501 gpmd->materialname[0] = '\0';
502 }
503 break;
504 }
507 if (gpmd->materialname[0] != '\0') {
508 gpmd->material = static_cast<Material *>(
509 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
510 gpmd->materialname[0] = '\0';
511 }
512 break;
513 }
516 if (gpmd->materialname[0] != '\0') {
517 gpmd->material = static_cast<Material *>(
518 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
519 gpmd->materialname[0] = '\0';
520 }
521 break;
522 }
525 if (gpmd->materialname[0] != '\0') {
526 gpmd->material = static_cast<Material *>(
527 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
528 gpmd->materialname[0] = '\0';
529 }
530 break;
531 }
534 if (gpmd->materialname[0] != '\0') {
535 gpmd->material = static_cast<Material *>(
536 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
537 gpmd->materialname[0] = '\0';
538 }
539 break;
540 }
543 if (gpmd->materialname[0] != '\0') {
544 gpmd->material = static_cast<Material *>(
545 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
546 gpmd->materialname[0] = '\0';
547 }
548 break;
549 }
552 if (gpmd->materialname[0] != '\0') {
553 gpmd->material = static_cast<Material *>(
554 BLI_findstring(&bmain->materials, gpmd->materialname, offsetof(ID, name) + 2));
555 gpmd->materialname[0] = '\0';
556 }
557 break;
558 }
559 default:
560 break;
561 }
562 }
563 }
564
565 /* Patch first frame for old files. */
566 Scene *scene = static_cast<Scene *>(bmain->scenes.first);
567 if (scene != nullptr) {
568 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
569 if (ob->type != OB_GPENCIL_LEGACY) {
570 continue;
571 }
572 bGPdata *gpd = static_cast<bGPdata *>(ob->data);
573 LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
574 bGPDframe *gpf = static_cast<bGPDframe *>(gpl->frames.first);
575 if (gpf && gpf->framenum > scene->r.sfra) {
576 bGPDframe *gpf_dup = BKE_gpencil_frame_duplicate(gpf, true);
577 gpf_dup->framenum = scene->r.sfra;
578 BLI_addhead(&gpl->frames, gpf_dup);
579 }
580 }
581 }
582 }
583 }
584
585 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 1)) {
586 LISTBASE_FOREACH (Collection *, collection, &bmain->collections) {
587 if (BKE_collection_cycles_fix(bmain, collection)) {
588 printf(
589 "WARNING: Cycle detected in collection '%s', fixed as best as possible.\n"
590 "You may have to reconstruct your View Layers...\n",
591 collection->id.name);
592 }
593 }
594 }
595
596 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 8)) {
601
610 }
611
612 /* Convert all Multires displacement to Catmull-Clark subdivision limit surface. */
613 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 1)) {
614 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
615 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
616 if (md->type == eModifierType_Multires) {
618 if (mmd->simple) {
620 }
621 }
622 }
623 }
624 }
625
626 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 2)) {
627
629
630 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
631 if (scene->ed != nullptr) {
632 strip_convert_transform_crop_lb(scene, &scene->ed->seqbase, render_size);
633 }
634 }
635 }
636
637 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 8)) {
638 /* Systematically rebuild pose-bones to ensure consistent ordering matching the one of bones in
639 * Armature obdata. */
640 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
641 if (ob->type == OB_ARMATURE) {
642 BKE_pose_rebuild(bmain, ob, static_cast<bArmature *>(ob->data), true);
643 }
644 }
645
646 /* Wet Paint Radius Factor */
647 LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
648 if (br->ob_mode & OB_MODE_SCULPT && br->wet_paint_radius_factor == 0.0f) {
649 br->wet_paint_radius_factor = 1.0f;
650 }
651 }
652
654 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
655 if (scene->ed != nullptr) {
656 strip_convert_transform_crop_lb_2(scene, &scene->ed->seqbase, render_size);
657 }
658 }
659 }
660
661 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 16)) {
662 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
664 }
665
666 /* Add a separate socket for Grid node X and Y size. */
667 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
668 if (ntree->type == NTREE_GEOMETRY) {
670 }
672 }
673 }
674
675 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 20)) {
676 /* Set zero user text objects to have a fake user. */
677 LISTBASE_FOREACH (Text *, text, &bmain->texts) {
678 if (text->id.us == 0) {
679 id_fake_user_set(&text->id);
680 }
681 }
682 }
683
690}
691
693{
694 const bool was_closed_x = panel->flag & PNL_UNUSED_1;
695 const bool was_closed_y = panel->flag & PNL_CLOSED; /* That value was the Y closed flag. */
696
697 SET_FLAG_FROM_TEST(panel->flag, was_closed_x || was_closed_y, PNL_CLOSED);
698
699 /* Clear the old PNL_CLOSEDX flag. */
700 panel->flag &= ~PNL_UNUSED_1;
701
702 LISTBASE_FOREACH (Panel *, child_panel, &panel->children) {
704 }
705}
706
708{
709 /* Change to generic named float/float3 attributes. */
710 enum {
711 CD_LOCATION = 43,
712 CD_RADIUS = 44,
713 };
714
715 for (int i = 0; i < pdata->totlayer; i++) {
716 CustomDataLayer *layer = &pdata->layers[i];
717 if (layer->type == CD_LOCATION) {
718 STRNCPY_UTF8(layer->name, "Position");
719 layer->type = CD_PROP_FLOAT3;
720 }
721 else if (layer->type == CD_RADIUS) {
722 STRNCPY_UTF8(layer->name, "Radius");
723 layer->type = CD_PROP_FLOAT;
724 }
725 }
726}
727
729{
730 /* Change from capital initial letter to lower case (#82693). */
731 for (int i = 0; i < pdata->totlayer; i++) {
732 CustomDataLayer *layer = &pdata->layers[i];
733 if (layer->type == CD_PROP_FLOAT3 && STREQ(layer->name, "Position")) {
734 STRNCPY_UTF8(layer->name, "position");
735 }
736 else if (layer->type == CD_PROP_FLOAT && STREQ(layer->name, "Radius")) {
737 STRNCPY_UTF8(layer->name, "radius");
738 }
739 }
740}
741
742/* Move FCurve handles towards the control point in such a way that the curve itself doesn't
743 * change. Since 2.91 FCurves are computed slightly differently, which requires this update to keep
744 * the same animation result. Previous versions scaled down overlapping handles during evaluation.
745 * This function applies the old correction to the actual animation data instead. */
747{
748 uint i = 1;
749 for (BezTriple *bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
750 /* Only adjust bezier key-frames. */
751 if (bezt->ipo != BEZT_IPO_BEZ) {
752 continue;
753 }
754
755 BezTriple *nextbezt = bezt + 1;
756 const float v1[2] = {bezt->vec[1][0], bezt->vec[1][1]};
757 const float v2[2] = {bezt->vec[2][0], bezt->vec[2][1]};
758 const float v3[2] = {nextbezt->vec[0][0], nextbezt->vec[0][1]};
759 const float v4[2] = {nextbezt->vec[1][0], nextbezt->vec[1][1]};
760
761 /* If the handles have no length, no need to do any corrections. */
762 if (v1[0] == v2[0] && v3[0] == v4[0]) {
763 continue;
764 }
765
766 /* Calculate handle deltas. */
767 float delta1[2], delta2[2];
768 sub_v2_v2v2(delta1, v1, v2);
769 sub_v2_v2v2(delta2, v4, v3);
770
771 const float len1 = fabsf(delta1[0]); /* Length of handle of first key. */
772 const float len2 = fabsf(delta2[0]); /* Length of handle of second key. */
773
774 /* Overlapping handles used to be internally scaled down in previous versions.
775 * We bake the handles onto these previously virtual values. */
776 const float time_delta = v4[0] - v1[0];
777 const float total_len = len1 + len2;
778 if (total_len <= time_delta) {
779 continue;
780 }
781
782 const float factor = time_delta / total_len;
783 /* Current key-frame's right handle: */
784 madd_v2_v2v2fl(bezt->vec[2], v1, delta1, -factor); /* vec[2] = v1 - factor * delta1 */
785 /* Next key-frame's left handle: */
786 madd_v2_v2v2fl(nextbezt->vec[0], v4, delta2, -factor); /* vec[0] = v4 - factor * delta2 */
787 }
788}
789
791{
792 LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
793 if (link->tonode->type_legacy == GEO_NODE_JOIN_GEOMETRY &&
794 !(link->tosock->flag & SOCK_MULTI_INPUT))
795 {
796 link->tosock = static_cast<bNodeSocket *>(link->tonode->inputs.first);
797 }
798 }
799 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
800 if (node->type_legacy == GEO_NODE_JOIN_GEOMETRY) {
801 bNodeSocket *socket = static_cast<bNodeSocket *>(node->inputs.first);
802 socket->flag |= SOCK_MULTI_INPUT;
803 socket->limit = 4095;
804 blender::bke::node_remove_socket(*ntree, *node, *socket->next);
805 }
806 }
807}
808
809/* NOLINTNEXTLINE: readability-function-size */
810void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
811{
812 UNUSED_VARS(fd);
813
814 if (MAIN_VERSION_FILE_ATLEAST(bmain, 290, 2) && MAIN_VERSION_FILE_OLDER(bmain, 291, 1)) {
815 /* In this range, the extrude manifold could generate meshes with degenerated face. */
816 LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
817 const MPoly *polys = static_cast<const MPoly *>(
818 CustomData_get_layer(&me->face_data, CD_MPOLY));
819 for (const int i : blender::IndexRange(me->faces_num)) {
820 if (polys[i].totloop == 2) {
821 bool changed;
825 me,
826 reinterpret_cast<float (*)[3]>(me->vert_positions_for_write().data()),
827 me->verts_num,
828 me->edges_for_write().data(),
829 me->edges_num,
831 &me->fdata_legacy, CD_MFACE, me->totface_legacy),
832 me->totface_legacy,
833 me->corner_verts().data(),
834 me->corner_edges_for_write().data(),
835 me->corners_num,
836 me->face_offsets().data(),
837 me->faces_num,
838 me->deform_verts_for_write().data(),
839 false,
840 true,
841 &changed);
842 break;
843 }
844 }
845 }
846 }
847
849 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 290, 2)) {
850 {
851 short id_codes[] = {ID_BR, ID_PAL};
852 for (int i = 0; i < ARRAY_SIZE(id_codes); i++) {
853 ListBase *lb = which_libbase(bmain, id_codes[i]);
855 }
856 }
857
858 if (!DNA_struct_member_exists(fd->filesdna, "SpaceImage", "float", "uv_opacity")) {
859 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
860 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
861 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
862 if (sl->spacetype == SPACE_IMAGE) {
863 SpaceImage *sima = (SpaceImage *)sl;
864 sima->uv_opacity = 1.0f;
865 }
866 }
867 }
868 }
869 }
870
871 /* Init Grease Pencil new random curves. */
872 if (!DNA_struct_member_exists(fd->filesdna, "BrushGpencilSettings", "float", "random_hue")) {
873 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
874 if ((brush->gpencil_settings) && (brush->gpencil_settings->curve_rand_pressure == nullptr))
875 {
876 brush->gpencil_settings->curve_rand_pressure = BKE_curvemapping_add(
877 1, 0.0f, 0.0f, 1.0f, 1.0f);
878 brush->gpencil_settings->curve_rand_strength = BKE_curvemapping_add(
879 1, 0.0f, 0.0f, 1.0f, 1.0f);
880 brush->gpencil_settings->curve_rand_uv = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
881 brush->gpencil_settings->curve_rand_hue = BKE_curvemapping_add(
882 1, 0.0f, 0.0f, 1.0f, 1.0f);
883 brush->gpencil_settings->curve_rand_saturation = BKE_curvemapping_add(
884 1, 0.0f, 0.0f, 1.0f, 1.0f);
885 brush->gpencil_settings->curve_rand_value = BKE_curvemapping_add(
886 1, 0.0f, 0.0f, 1.0f, 1.0f);
887 }
888 }
889 }
890 }
891
892 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 290, 4)) {
893 /* Clear old deprecated bit-flag from edit weights modifiers, we now use it for something else.
894 */
895 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
896 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
897 if (md->type == eModifierType_WeightVGEdit) {
899 }
900 }
901 }
902
903 /* Initialize parameters of the new Nishita sky model. */
904 if (!DNA_struct_member_exists(fd->filesdna, "NodeTexSky", "float", "sun_size")) {
905 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
906 if (ntree->type == NTREE_SHADER) {
907 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
908 if (node->type_legacy == SH_NODE_TEX_SKY && node->storage) {
909 NodeTexSky *tex = (NodeTexSky *)node->storage;
910 tex->sun_disc = true;
911 tex->sun_size = DEG2RADF(0.545);
912 tex->sun_elevation = M_PI_2;
913 tex->sun_rotation = 0.0f;
914 tex->altitude = 0.0f;
915 tex->air_density = 1.0f;
916 tex->aerosol_density = 1.0f;
917 tex->ozone_density = 1.0f;
918 }
919 }
920 }
921 }
923 }
924 }
925
926 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 290, 5)) {
927 /* New denoiser settings. */
928 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
929 IDProperty *cscene = version_cycles_properties_from_ID(&scene->id);
930
931 /* Check if any view layers had (optix) denoising enabled.
932 * Both view and render layers because conversion only happens after linking. */
933 bool use_optix = false;
934 bool use_denoising = false;
935 LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
936 IDProperty *cview_layer = version_cycles_properties_from_view_layer(view_layer);
937 if (cview_layer) {
938 use_denoising = use_denoising ||
939 version_cycles_property_boolean(cview_layer, "use_denoising", false);
940 use_optix = use_optix ||
941 version_cycles_property_boolean(cview_layer, "use_optix_denoising", false);
942 }
943 }
944 LISTBASE_FOREACH (SceneRenderLayer *, render_layer, &scene->r.layers) {
945 IDProperty *crender_layer = version_cycles_properties_from_render_layer(render_layer);
946 if (crender_layer) {
947 use_denoising = use_denoising ||
948 version_cycles_property_boolean(crender_layer, "use_denoising", false);
949 use_optix = use_optix ||
950 version_cycles_property_boolean(crender_layer, "use_optix_denoising", false);
951 }
952 }
953
954 if (cscene) {
955 enum {
956 DENOISER_AUTO = 0,
957 DENOISER_NLM = 1,
958 DENOISER_OPTIX = 2,
959 };
960
961 /* Enable denoiser if it was enabled for one view layer before. */
963 cscene, "denoiser", (use_optix) ? DENOISER_OPTIX : DENOISER_NLM);
964 version_cycles_property_boolean_set(cscene, "use_denoising", use_denoising);
965
966 /* Migrate Optix denoiser to new settings. */
967 if (version_cycles_property_int(cscene, "preview_denoising", 0)) {
968 version_cycles_property_boolean_set(cscene, "use_preview_denoising", true);
969 version_cycles_property_int_set(cscene, "preview_denoiser", DENOISER_AUTO);
970 }
971 }
972
973 /* Enable denoising in all view layer if there was no denoising before,
974 * so that enabling the scene settings auto enables it for all view layers. */
975 if (!use_denoising) {
976 LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
977 IDProperty *cview_layer = version_cycles_properties_from_view_layer(view_layer);
978 if (cview_layer) {
979 version_cycles_property_boolean_set(cview_layer, "use_denoising", true);
980 }
981 }
982 LISTBASE_FOREACH (SceneRenderLayer *, render_layer, &scene->r.layers) {
983 IDProperty *crender_layer = version_cycles_properties_from_render_layer(render_layer);
984 if (crender_layer) {
985 version_cycles_property_boolean_set(crender_layer, "use_denoising", true);
986 }
987 }
988 }
989 }
990 }
991
992 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 290, 6)) {
993 /* Transition to saving expansion for all of a modifier's sub-panels. */
994 if (!DNA_struct_member_exists(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) {
995 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
996 LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
997 if (md->mode & eModifierMode_Expanded_DEPRECATED) {
998 md->ui_expand_flag = UI_PANEL_DATA_EXPAND_ROOT;
999 }
1000 else {
1001 md->ui_expand_flag = 0;
1002 }
1003 }
1004 }
1005 }
1006
1007 /* EEVEE Motion blur new parameters. */
1008 if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "motion_blur_depth_scale"))
1009 {
1010 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1011 scene->eevee.motion_blur_depth_scale = 100.0f;
1012 scene->eevee.motion_blur_max = 32;
1013 }
1014 }
1015
1016 if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "int", "motion_blur_steps")) {
1017 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1018 scene->eevee.motion_blur_steps = 1;
1019 }
1020 }
1021
1022 /* Transition to saving expansion for all of a constraint's sub-panels. */
1023 if (!DNA_struct_member_exists(fd->filesdna, "bConstraint", "short", "ui_expand_flag")) {
1024 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1025 LISTBASE_FOREACH (bConstraint *, con, &object->constraints) {
1026 if (con->flag & CONSTRAINT_EXPAND_DEPRECATED) {
1027 con->ui_expand_flag = UI_PANEL_DATA_EXPAND_ROOT;
1028 }
1029 else {
1030 con->ui_expand_flag = 0;
1031 }
1032 }
1033 }
1034 }
1035
1036 /* Transition to saving expansion for all of grease pencil modifier's sub-panels. */
1037 if (!DNA_struct_member_exists(fd->filesdna, "GpencilModifierData", "short", "ui_expand_flag"))
1038 {
1039 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1040 LISTBASE_FOREACH (GpencilModifierData *, md, &object->greasepencil_modifiers) {
1041 if (md->mode & eGpencilModifierMode_Expanded_DEPRECATED) {
1042 md->ui_expand_flag = UI_PANEL_DATA_EXPAND_ROOT;
1043 }
1044 else {
1045 md->ui_expand_flag = 0;
1046 }
1047 }
1048 }
1049 }
1050
1051 /* Transition to saving expansion for all of an effect's sub-panels. */
1052 if (!DNA_struct_member_exists(fd->filesdna, "ShaderFxData", "short", "ui_expand_flag")) {
1053 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1054 LISTBASE_FOREACH (ShaderFxData *, fx, &object->shader_fx) {
1055 if (fx->mode & eShaderFxMode_Expanded_DEPRECATED) {
1056 fx->ui_expand_flag = UI_PANEL_DATA_EXPAND_ROOT;
1057 }
1058 else {
1059 fx->ui_expand_flag = 0;
1060 }
1061 }
1062 }
1063 }
1064
1065 /* Refactor bevel profile type to use an enum. */
1066 if (!DNA_struct_member_exists(fd->filesdna, "BevelModifierData", "short", "profile_type")) {
1067 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1068 LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
1069 if (md->type == eModifierType_Bevel) {
1071 bool use_custom_profile = bmd->flags & MOD_BEVEL_CUSTOM_PROFILE_DEPRECATED;
1072 bmd->profile_type = use_custom_profile ? MOD_BEVEL_PROFILE_CUSTOM :
1074 }
1075 }
1076 }
1077 }
1078
1079 /* Change ocean modifier values from [0, 10] to [0, 1] ranges. */
1080 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1081 LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
1082 if (md->type == eModifierType_Ocean) {
1084 omd->wave_alignment *= 0.1f;
1085 omd->sharpen_peak_jonswap *= 0.1f;
1086 }
1087 }
1088 }
1089 }
1090
1091 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 1)) {
1092
1093 /* Initialize additional parameter of the Nishita sky model and change altitude unit. */
1094 if (!DNA_struct_member_exists(fd->filesdna, "NodeTexSky", "float", "sun_intensity")) {
1095 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1096 if (ntree->type == NTREE_SHADER) {
1097 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1098 if (node->type_legacy == SH_NODE_TEX_SKY && node->storage) {
1099 NodeTexSky *tex = (NodeTexSky *)node->storage;
1100 tex->sun_intensity = 1.0f;
1101 tex->altitude *= 0.001f;
1102 }
1103 }
1104 }
1105 }
1107 }
1108
1109 /* Refactor bevel affect type to use an enum. */
1110 if (!DNA_struct_member_exists(fd->filesdna, "BevelModifierData", "char", "affect_type")) {
1111 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1112 LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
1113 if (md->type == eModifierType_Bevel) {
1115 const bool use_vertex_bevel = bmd->flags & MOD_BEVEL_VERT_DEPRECATED;
1116 bmd->affect_type = use_vertex_bevel ? MOD_BEVEL_AFFECT_VERTICES :
1118 }
1119 }
1120 }
1121 }
1122
1123 /* Initialize additional velocity parameter for #CacheFile's. */
1124 if (!DNA_struct_member_exists(
1125 fd->filesdna, "MeshSeqCacheModifierData", "float", "velocity_scale"))
1126 {
1127 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1128 LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
1129 if (md->type == eModifierType_MeshSequenceCache) {
1131 mcmd->velocity_scale = 1.0f;
1132 }
1133 }
1134 }
1135 }
1136
1137 if (!DNA_struct_member_exists(fd->filesdna, "CacheFile", "char", "velocity_unit")) {
1138 LISTBASE_FOREACH (CacheFile *, cache_file, &bmain->cachefiles) {
1139 STRNCPY_UTF8(cache_file->velocity_name, ".velocities");
1140 cache_file->velocity_unit = CACHEFILE_VELOCITY_UNIT_SECOND;
1141 }
1142 }
1143
1144 if (!DNA_struct_member_exists(fd->filesdna, "OceanModifierData", "int", "viewport_resolution"))
1145 {
1146 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1147 LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
1148 if (md->type == eModifierType_Ocean) {
1150 omd->viewport_resolution = omd->resolution;
1151 }
1152 }
1153 }
1154 }
1155
1156 /* Remove panel X axis collapsing, a remnant of horizontal panel alignment. */
1157 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1158 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1159 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
1160 LISTBASE_FOREACH (Panel *, panel, &region->panels) {
1162 }
1163 }
1164 }
1165 }
1166 }
1167
1168 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 2)) {
1169 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1170 RigidBodyWorld *rbw = scene->rigidbody_world;
1171
1172 if (rbw == nullptr) {
1173 continue;
1174 }
1175
1176 /* The sub-step method changed from "per second" to "per frame".
1177 * To get the new value simply divide the old bullet sim FPS with the scene FPS. */
1178 rbw->substeps_per_frame /= scene->frames_per_second();
1179
1180 if (rbw->substeps_per_frame <= 0) {
1181 rbw->substeps_per_frame = 1;
1182 }
1183 }
1184
1185 /* PointCloud attributes. */
1186 LISTBASE_FOREACH (PointCloud *, pointcloud, &bmain->pointclouds) {
1187 do_versions_point_attributes(&pointcloud->pdata_legacy);
1188 }
1189
1190 /* Show outliner mode column by default. */
1191 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1192 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1193 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
1194 if (space->spacetype == SPACE_OUTLINER) {
1195 SpaceOutliner *space_outliner = (SpaceOutliner *)space;
1196
1197 space_outliner->flag |= SO_MODE_COLUMN;
1198 }
1199 }
1200 }
1201 }
1202
1203 /* Solver and Collections for Boolean. */
1204 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1205 LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
1206 if (md->type == eModifierType_Boolean) {
1210 }
1211 }
1212 }
1213 }
1214
1215 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 4) && MAIN_VERSION_FILE_ATLEAST(bmain, 291, 1)) {
1216 /* Due to a48d78ce07f4f, CustomData.totlayer and CustomData.maxlayer has been written
1217 * incorrectly. Fortunately, the size of the layers array has been written to the .blend file
1218 * as well, so we can reconstruct totlayer and maxlayer from that. */
1219 LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
1220 mesh->vert_data.totlayer = mesh->vert_data.maxlayer = MEM_allocN_len(
1221 mesh->vert_data.layers) /
1222 sizeof(CustomDataLayer);
1223 mesh->edge_data.totlayer = mesh->edge_data.maxlayer = MEM_allocN_len(
1224 mesh->edge_data.layers) /
1225 sizeof(CustomDataLayer);
1226 /* We can be sure that mesh->fdata is empty for files written by 2.90. */
1227 mesh->corner_data.totlayer = mesh->corner_data.maxlayer = MEM_allocN_len(
1228 mesh->corner_data.layers) /
1229 sizeof(CustomDataLayer);
1230 mesh->face_data.totlayer = mesh->face_data.maxlayer = MEM_allocN_len(
1231 mesh->face_data.layers) /
1232 sizeof(CustomDataLayer);
1233 }
1234 }
1235
1236 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 5)) {
1237 /* Fix fcurves to allow for new bezier handles behavior (#75881 and D8752). */
1238 LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
1239 LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
1240 /* Only need to fix Bezier curves with at least 2 key-frames. */
1241 if (fcu->totvert < 2 || fcu->bezt == nullptr) {
1242 continue;
1243 }
1245 }
1246 }
1247
1248 LISTBASE_FOREACH (Collection *, collection, &bmain->collections) {
1249 collection->color_tag = COLLECTION_COLOR_NONE;
1250 }
1251 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1252 /* Old files do not have a master collection, but it will be created by
1253 * `BKE_collection_master_add()`. */
1254 if (scene->master_collection) {
1255 scene->master_collection->color_tag = COLLECTION_COLOR_NONE;
1256 }
1257 }
1258
1259 /* Add custom profile and bevel mode to curve bevels. */
1260 if (!DNA_struct_member_exists(fd->filesdna, "Curve", "char", "bevel_mode")) {
1261 LISTBASE_FOREACH (Curve *, curve, &bmain->curves) {
1262 if (curve->bevobj != nullptr) {
1263 curve->bevel_mode = CU_BEV_MODE_OBJECT;
1264 }
1265 else {
1266 curve->bevel_mode = CU_BEV_MODE_ROUND;
1267 }
1268 }
1269 }
1270
1271 /* Ensure that new viewport display fields are initialized correctly. */
1272 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
1273 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1274 if (md->type == eModifierType_Fluid) {
1276 if (fmd->domain != nullptr) {
1277 if (!fmd->domain->coba_field && fmd->domain->type == FLUID_DOMAIN_TYPE_LIQUID) {
1279 }
1280 fmd->domain->grid_scale = 1.0;
1281 fmd->domain->gridlines_upper_bound = 1.0;
1283 const float grid_lines[4] = {1.0, 0.0, 0.0, 1.0};
1284 copy_v4_v4(fmd->domain->gridlines_range_color, grid_lines);
1285 }
1286 }
1287 }
1288 }
1289 }
1290
1291 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 6)) {
1292 /* Darken Inactive Overlay. */
1293 if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "fade_alpha")) {
1294 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1295 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1296 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1297 if (sl->spacetype == SPACE_VIEW3D) {
1298 View3D *v3d = (View3D *)sl;
1299 v3d->overlay.fade_alpha = 0.40f;
1301 }
1302 }
1303 }
1304 }
1305 }
1306
1307 /* Unify symmetry as a mesh property. */
1308 if (!DNA_struct_member_exists(fd->filesdna, "Mesh", "char", "symmetry")) {
1309 LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
1310 /* The previous flags used to store mesh symmetry in edit-mode match the new ones that are
1311 * used in #Mesh.symmetry. */
1312 mesh->symmetry = mesh->editflag & (ME_SYMMETRY_X | ME_SYMMETRY_Y | ME_SYMMETRY_Z);
1313 }
1314 }
1315
1316 /* Alembic importer: allow vertex interpolation by default. */
1317 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1318 LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
1319 if (md->type != eModifierType_MeshSequenceCache) {
1320 continue;
1321 }
1322
1325 }
1326 }
1327 }
1328
1329 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 7)) {
1330 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1331 scene->r.simplify_volumes = 1.0f;
1332 }
1333 }
1334
1335 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 8)) {
1336 if (!DNA_struct_member_exists(fd->filesdna, "WorkSpaceDataRelation", "int", "parentid")) {
1337 LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
1339 WorkSpaceDataRelation *, relation, &workspace->hook_layout_relations)
1340 {
1341 relation->parent = blo_read_get_new_globaldata_address(fd, relation->parent);
1342 BLI_assert(relation->parentid == 0);
1343 if (relation->parent != nullptr) {
1344 LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
1345 wmWindow *win = static_cast<wmWindow *>(
1346 BLI_findptr(&wm->windows, relation->parent, offsetof(wmWindow, workspace_hook)));
1347 if (win != nullptr) {
1348 relation->parentid = win->winid;
1349 break;
1350 }
1351 }
1352 if (relation->parentid == 0) {
1354 false,
1355 "Found a valid parent for workspace data relation, but no valid parent id.");
1356 }
1357 }
1358 if (relation->parentid == 0) {
1359 BLI_freelinkN(&workspace->hook_layout_relations, relation);
1360 }
1361 }
1362 }
1363 }
1364
1365 /* UV/Image show overlay option. */
1366 if (!DNA_struct_exists(fd->filesdna, "SpaceImageOverlay")) {
1367 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1368 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1369 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
1370 if (space->spacetype == SPACE_IMAGE) {
1371 SpaceImage *sima = (SpaceImage *)space;
1373 }
1374 }
1375 }
1376 }
1377 }
1378
1379 /* Ensure that particle systems generated by fluid modifier have correct phystype. */
1380 LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
1382 {
1383 part->phystype = PART_PHYS_NO;
1384 }
1385 }
1386 }
1387
1388 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 9)) {
1389 /* Remove options of legacy UV/Image editor */
1390 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1391 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1392 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1393 switch (sl->spacetype) {
1394 case SPACE_IMAGE: {
1395 SpaceImage *sima = (SpaceImage *)sl;
1396 sima->flag &= ~SI_FLAG_UNUSED_20;
1397 break;
1398 }
1399 }
1400 }
1401 }
1402 }
1403
1404 if (!DNA_struct_member_exists(
1405 fd->filesdna, "FluidModifierData", "float", "fractions_distance"))
1406 {
1407 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
1408 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1409 if (md->type == eModifierType_Fluid) {
1411 if (fmd->domain) {
1412 fmd->domain->fractions_distance = 0.5;
1413 }
1414 }
1415 }
1416 }
1417 }
1418 }
1419
1420 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 1)) {
1421 {
1422 const int LEGACY_REFINE_RADIAL_DISTORTION_K1 = (1 << 2);
1423
1424 LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
1425 MovieTracking *tracking = &clip->tracking;
1426 MovieTrackingSettings *settings = &tracking->settings;
1427 int new_refine_camera_intrinsics = 0;
1428
1430 new_refine_camera_intrinsics |= REFINE_FOCAL_LENGTH;
1431 }
1432
1434 new_refine_camera_intrinsics |= REFINE_PRINCIPAL_POINT;
1435 }
1436
1437 /* The end goal is to enable radial distortion refinement if either K1 or K2 were set for
1438 * refinement. It is enough to only check for L1 it was not possible to refine K2 without
1439 * K1. */
1440 if (settings->refine_camera_intrinsics & LEGACY_REFINE_RADIAL_DISTORTION_K1) {
1441 new_refine_camera_intrinsics |= REFINE_RADIAL_DISTORTION;
1442 }
1443
1444 settings->refine_camera_intrinsics = new_refine_camera_intrinsics;
1445 }
1446 }
1447 }
1448
1449 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 5)) {
1450 /* Initialize the opacity of the overlay wireframe */
1451 if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "wireframe_opacity")) {
1452 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1453 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1454 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1455 if (sl->spacetype == SPACE_VIEW3D) {
1456 View3D *v3d = (View3D *)sl;
1457 v3d->overlay.wireframe_opacity = 1.0f;
1458 }
1459 }
1460 }
1461 }
1462 }
1463
1464 /* Replace object hidden filter with inverted object visible filter. */
1465 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1466 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1467 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
1468 if (space->spacetype == SPACE_OUTLINER) {
1469 SpaceOutliner *space_outliner = (SpaceOutliner *)space;
1470 if (space_outliner->filter_state == SO_FILTER_OB_HIDDEN) {
1471 space_outliner->filter_state = SO_FILTER_OB_VISIBLE;
1472 space_outliner->filter |= SO_FILTER_OB_STATE_INVERSE;
1473 }
1474 }
1475 }
1476 }
1477 }
1478
1479 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
1480 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1481 if (md->type == eModifierType_WeightVGProximity) {
1483 if (wmd->cmap_curve == nullptr) {
1484 wmd->cmap_curve = BKE_curvemapping_add(1, 0.0, 0.0, 1.0, 1.0);
1486 }
1487 }
1488 }
1489 }
1490
1491 /* PointCloud attributes names. */
1492 LISTBASE_FOREACH (PointCloud *, pointcloud, &bmain->pointclouds) {
1493 do_versions_point_attribute_names(&pointcloud->pdata_legacy);
1494 }
1495
1496 /* Cryptomatte render pass */
1497 if (!DNA_struct_member_exists(fd->filesdna, "ViewLayer", "short", "cryptomatte_levels")) {
1498 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1499 LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
1500 view_layer->cryptomatte_levels = 6;
1501 view_layer->cryptomatte_flag = VIEW_LAYER_CRYPTOMATTE_ACCURATE;
1502 }
1503 }
1504 }
1505 }
1506
1507 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 7)) {
1508 /* Make all IDProperties used as interface of geometry node trees overridable. */
1509 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
1510 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1511 if (md->type == eModifierType_Nodes) {
1513 IDProperty *nmd_properties = nmd->settings.properties;
1514
1515 BLI_assert(nmd_properties->type == IDP_GROUP);
1516 LISTBASE_FOREACH (IDProperty *, nmd_socket_idprop, &nmd_properties->data.group) {
1517 nmd_socket_idprop->flag |= IDP_FLAG_OVERRIDABLE_LIBRARY;
1518 }
1519 }
1520 }
1521 }
1522
1523 /* EEVEE/Cycles Volumes consistency */
1524 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1525 /* Remove Volume Transmittance render pass from each view layer. */
1526 LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
1527 view_layer->eevee.render_passes &= ~EEVEE_RENDER_PASS_UNUSED_8;
1528 }
1529
1530 /* Rename Render-layer Socket `VolumeScatterCol` to `VolumeDir`. */
1531 if (scene->nodetree) {
1532 LISTBASE_FOREACH (bNode *, node, &scene->nodetree->nodes) {
1533 if (node->type_legacy == CMP_NODE_R_LAYERS) {
1534 LISTBASE_FOREACH (bNodeSocket *, output_socket, &node->outputs) {
1535 const char *volume_scatter = "VolumeScatterCol";
1536 if (STREQLEN(output_socket->name, volume_scatter, MAX_NAME)) {
1537 STRNCPY_UTF8(output_socket->name, RE_PASSNAME_VOLUME_LIGHT);
1538 }
1539 }
1540 }
1541 }
1542 }
1543 }
1544
1545 /* Convert `NodeCryptomatte->storage->matte_id` to `NodeCryptomatte->storage->entries` */
1546 if (!DNA_struct_exists(fd->filesdna, "CryptomatteEntry")) {
1547 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1548 if (scene->nodetree) {
1549 LISTBASE_FOREACH (bNode *, node, &scene->nodetree->nodes) {
1550 if (node->type_legacy == CMP_NODE_CRYPTOMATTE_LEGACY) {
1551 NodeCryptomatte *storage = (NodeCryptomatte *)node->storage;
1552 char *matte_id = storage->matte_id;
1553 if ((matte_id == nullptr) || (storage->matte_id[0] == '\0')) {
1554 continue;
1555 }
1557 }
1558 }
1559 }
1560 }
1561 }
1562
1563 /* Overlay elements in the sequencer. */
1564 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1565 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1566 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1567 if (sl->spacetype == SPACE_SEQ) {
1568 SpaceSeq *sseq = (SpaceSeq *)sl;
1571 }
1572 }
1573 }
1574 }
1575 }
1576
1577 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 8)) {
1578 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1579 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1580 if (STREQ(node->idname, "GeometryNodeRandomAttribute")) {
1581 STRNCPY_UTF8(node->idname, "GeometryLegacyNodeAttributeRandomize");
1582 }
1583 }
1584 }
1585
1586 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1587 if (scene->toolsettings->sequencer_tool_settings == nullptr) {
1588 scene->toolsettings->sequencer_tool_settings = blender::seq::tool_settings_init();
1589 }
1590 }
1591 }
1592
1593 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 9)) {
1594 /* Default properties editors to auto outliner sync. */
1595 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1596 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1597 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
1598 if (space->spacetype == SPACE_PROPERTIES) {
1599 SpaceProperties *space_properties = (SpaceProperties *)space;
1600 space_properties->outliner_sync = PROPERTIES_SYNC_AUTO;
1601 }
1602 }
1603 }
1604 }
1605
1606 /* Ensure that new viscosity strength field is initialized correctly. */
1607 if (!DNA_struct_member_exists(fd->filesdna, "FluidModifierData", "float", "viscosity_value")) {
1608 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
1609 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1610 if (md->type == eModifierType_Fluid) {
1612 if (fmd->domain != nullptr) {
1613 fmd->domain->viscosity_value = 0.05;
1614 }
1615 }
1616 }
1617 }
1618 }
1619 }
1620
1621 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 10)) {
1622 if (!DNA_struct_exists(fd->filesdna, "NodeSetAlpha")) {
1623 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1624 if (ntree->type != NTREE_COMPOSIT) {
1625 continue;
1626 }
1627 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1628 if (node->type_legacy != CMP_NODE_SETALPHA) {
1629 continue;
1630 }
1631 NodeSetAlpha *storage = MEM_callocN<NodeSetAlpha>("NodeSetAlpha");
1633 node->storage = storage;
1634 }
1635 }
1637 }
1638
1639 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1641 if (ed == nullptr) {
1642 continue;
1643 }
1645 }
1646 }
1647
1648 /* Enable "Save as Render" option for file output node by default (apply view transform to image
1649 * on save) */
1650 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 11)) {
1651 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1652 if (ntree->type == NTREE_COMPOSIT) {
1653 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1654 if (node->type_legacy == CMP_NODE_OUTPUT_FILE) {
1655 LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
1657 sock->storage);
1658 simf->save_as_render = true;
1659 }
1660 }
1661 }
1662 }
1663 }
1665 }
1666
1667 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 1)) {
1668 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1669 if (ntree->type == NTREE_GEOMETRY) {
1670 version_node_socket_name(ntree, GEO_NODE_MESH_BOOLEAN, "Geometry A", "Geometry 1");
1671 version_node_socket_name(ntree, GEO_NODE_MESH_BOOLEAN, "Geometry B", "Geometry 2");
1672 }
1673 }
1675
1676 /* Init grease pencil default curve resolution. */
1677 if (!DNA_struct_member_exists(fd->filesdna, "bGPdata", "int", "curve_edit_resolution")) {
1678 LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
1679 gpd->curve_edit_resolution = GP_DEFAULT_CURVE_RESOLUTION;
1681 }
1682 }
1683 /* Init grease pencil curve editing error threshold. */
1684 if (!DNA_struct_member_exists(fd->filesdna, "bGPdata", "float", "curve_edit_threshold")) {
1685 LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
1686 gpd->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
1687 gpd->curve_edit_corner_angle = GP_DEFAULT_CURVE_EDIT_CORNER_ANGLE;
1688 }
1689 }
1690 }
1691
1692 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 14) ||
1693 ((bmain->versionfile == 293) && !MAIN_VERSION_FILE_ATLEAST(bmain, 293, 1)))
1694 {
1695 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1696 if (ntree->type != NTREE_GEOMETRY) {
1697 continue;
1698 }
1699 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1700 if (node->type_legacy == GEO_NODE_OBJECT_INFO && node->storage == nullptr) {
1702 data->transform_space = GEO_NODE_TRANSFORM_SPACE_RELATIVE;
1703 node->storage = data;
1704 }
1705 }
1706 }
1708 }
1709
1710 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 1)) {
1711 /* Grease pencil layer transform matrix. */
1712 if (!DNA_struct_member_exists(fd->filesdna, "bGPDlayer", "float", "location[0]")) {
1713 LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
1714 LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
1715 zero_v3(gpl->location);
1716 zero_v3(gpl->rotation);
1717 copy_v3_fl(gpl->scale, 1.0f);
1718 loc_eul_size_to_mat4(gpl->layer_mat, gpl->location, gpl->rotation, gpl->scale);
1719 invert_m4_m4(gpl->layer_invmat, gpl->layer_mat);
1720 }
1721 }
1722 }
1723 /* Fix Fill factor for grease pencil fill brushes. */
1724 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
1725 if ((brush->gpencil_settings) && (brush->gpencil_settings->fill_factor == 0.0f)) {
1726 brush->gpencil_settings->fill_factor = 1.0f;
1727 }
1728 }
1729 }
1730
1731 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 5)) {
1732 /* Change Nishita sky model Altitude unit. */
1733 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1734 if (ntree->type == NTREE_SHADER) {
1735 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1736 if (node->type_legacy == SH_NODE_TEX_SKY && node->storage) {
1737 NodeTexSky *tex = (NodeTexSky *)node->storage;
1738 tex->altitude *= 1000.0f;
1739 }
1740 }
1741 }
1742 }
1744 }
1745
1746 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 6)) {
1747 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1748 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1749 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
1750 /* Enable Outliner render visibility column. */
1751 if (space->spacetype == SPACE_OUTLINER) {
1752 SpaceOutliner *space_outliner = (SpaceOutliner *)space;
1753 space_outliner->show_restrict_flags |= SO_RESTRICT_RENDER;
1754 }
1755 }
1756 }
1757 }
1758 }
1759
1760 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 7)) {
1761 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1762 if (ntree->type == NTREE_GEOMETRY) {
1764 }
1765 }
1767 }
1768
1769 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 9)) {
1770 if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "bokeh_overblur")) {
1771 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1772 scene->eevee.bokeh_neighbor_max = 10.0f;
1773 scene->eevee.bokeh_overblur = 5.0f;
1774 }
1775 }
1776
1777 /* Add sub-panels for FModifiers, which requires a field to store expansion. */
1778 if (!DNA_struct_member_exists(fd->filesdna, "FModifier", "short", "ui_expand_flag")) {
1779 LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
1780 LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
1781 LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) {
1782 SET_FLAG_FROM_TEST(fcm->ui_expand_flag,
1783 fcm->flag & FMODIFIER_FLAG_EXPANDED,
1785 }
1786 }
1787 }
1788 }
1789 }
1790
1791 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 10)) {
1792 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1793 /* Fix old scene with too many samples that were not being used.
1794 * Now they are properly used and might produce a huge slowdown.
1795 * So we clamp to what the old max actual was. */
1796 scene->eevee.volumetric_shadow_samples = std::min(scene->eevee.volumetric_shadow_samples,
1797 32);
1798 }
1799 }
1800
1801 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 11)) {
1802 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1803 if (ntree->type == NTREE_GEOMETRY) {
1804 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1805 if (STREQ(node->idname, "GeometryNodeSubdivisionSurfaceSimple")) {
1806 STRNCPY_UTF8(node->idname, "GeometryNodeSubdivide");
1807 }
1808 if (STREQ(node->idname, "GeometryNodeSubdivisionSurface")) {
1809 STRNCPY_UTF8(node->idname, "GeometryNodeSubdivideSmooth");
1810 }
1811 }
1812 }
1813 }
1814 }
1815
1816 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 12)) {
1817 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1818 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1819 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1820 switch (sl->spacetype) {
1821 case SPACE_SEQ: {
1822 SpaceSeq *sseq = (SpaceSeq *)sl;
1823 if (ELEM(sseq->render_size,
1828 {
1829 sseq->flag |= SEQ_USE_PROXIES;
1830 }
1833 }
1834 }
1835 }
1836 }
1837 }
1838 }
1839
1840 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1841 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1842 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1843 if (sl->spacetype == SPACE_SPREADSHEET) {
1844 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
1845 &sl->regionbase;
1847 regionbase, RGN_TYPE_FOOTER, "footer for spreadsheet", RGN_TYPE_HEADER);
1848 if (new_footer != nullptr) {
1849 new_footer->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP :
1851 }
1852 }
1853 }
1854 }
1855 }
1856 }
1857
1858 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 13)) {
1859 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1860 if (ntree->type == NTREE_GEOMETRY) {
1861 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1862 if (STREQ(node->idname, "GeometryNodeSubdivideSmooth")) {
1863 STRNCPY_UTF8(node->idname, "GeometryNodeSubdivisionSurface");
1864 }
1865 }
1866 }
1867 }
1868 }
1869
1870 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 14)) {
1871 if (!DNA_struct_member_exists(fd->filesdna, "Light", "float", "diff_fac")) {
1872 LISTBASE_FOREACH (Light *, light, &bmain->lights) {
1873 light->diff_fac = 1.0f;
1874 light->volume_fac = 1.0f;
1875 }
1876 }
1877 }
1878
1879 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 15)) {
1880 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1881 if (ntree->type == NTREE_GEOMETRY) {
1882 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1883 if (STREQ(node->idname, "GeometryNodeMeshPlane")) {
1884 STRNCPY(node->idname, "GeometryNodeMeshGrid");
1885 }
1886 }
1887 }
1888 }
1889 }
1890
1891 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 16)) {
1892 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1893 if (ntree->type == NTREE_GEOMETRY) {
1895 }
1897 }
1898
1899 /* The CU_2D flag has been removed. */
1900 LISTBASE_FOREACH (Curve *, cu, &bmain->curves) {
1901#define CU_2D (1 << 3)
1902 ListBase *nurbs = BKE_curve_nurbs_get(cu);
1903 bool is_2d = true;
1904
1905 LISTBASE_FOREACH (Nurb *, nu, nurbs) {
1906 if (nu->flag & CU_2D) {
1907 nu->flag &= ~CU_2D;
1908 }
1909 else {
1910 is_2d = false;
1911 }
1912 }
1913#undef CU_2D
1914 if (!is_2d && CU_IS_2D(cu)) {
1915 cu->flag |= CU_3D;
1916 }
1917 }
1918 }
1919
1920 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 18)) {
1921 if (!DNA_struct_member_exists(fd->filesdna, "bArmature", "float", "axes_position")) {
1922 /* Convert the axes draw position to its old default (tip of bone). */
1923 LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
1924 arm->axes_position = 1.0;
1925 }
1926 }
1927
1928 /* Initialize the spread parameter for area lights. */
1929 if (!DNA_struct_member_exists(fd->filesdna, "Light", "float", "area_spread")) {
1930 LISTBASE_FOREACH (Light *, la, &bmain->lights) {
1931 la->area_spread = DEG2RADF(180.0f);
1932 }
1933 }
1934
1935 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1936 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1937 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1938 if (sl->spacetype == SPACE_NODE) {
1939 SpaceNode *snode = (SpaceNode *)sl;
1940 LISTBASE_FOREACH (bNodeTreePath *, path, &snode->treepath) {
1941 STRNCPY_UTF8(path->display_name, path->node_name);
1942 }
1943 }
1944 }
1945 }
1946 }
1947 }
1948
1949 /* Set default value for the new bisect_threshold parameter in the mirror modifier. */
1950 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 19)) {
1951 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
1952 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
1953 if (md->type == eModifierType_Mirror) {
1955 /* This was the previous hard-coded value. */
1956 mmd->bisect_threshold = 0.001f;
1957 }
1958 }
1959 }
1960
1961 LISTBASE_FOREACH (Curve *, cu, &bmain->curves) {
1962 /* Turn on clamping as this was implicit before. */
1963 cu->flag |= CU_PATH_CLAMP;
1964 }
1965 }
1966
1973}
void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
bool BKE_collection_cycles_fix(Main *bmain, Collection *collection)
void BKE_curvemapping_init(CurveMapping *cumap)
CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition colortools.cc:89
void BKE_cryptomatte_matte_id_to_entries(struct NodeCryptomatte *node_storage, const char *matte_id)
#define CU_IS_2D(cu)
Definition BKE_curve.hh:89
ListBase * BKE_curve_nurbs_get(Curve *cu)
Definition curve.cc:4958
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
void * CustomData_get_layer_for_write(CustomData *data, eCustomDataType type, int totelem)
FCurve * BKE_fcurve_find(ListBase *list, const char rna_path[], int array_index)
bool BKE_fcurve_is_empty(const FCurve *fcu)
void BKE_fcurve_free(FCurve *fcu)
struct bGPDframe * BKE_gpencil_frame_duplicate(const struct bGPDframe *gpf_src, bool dup_strokes)
void BKE_main_id_repair_duplicate_names_listbase(Main *bmain, ListBase *lb)
Definition lib_id.cc:1258
void id_fake_user_set(ID *id)
Definition lib_id.cc:396
ListBase * which_libbase(Main *bmain, short type)
Definition main.cc:902
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
Definition BKE_main.hh:658
#define MAIN_VERSION_FILE_OLDER(main, ver, subver)
Definition BKE_main.hh:662
bool BKE_mesh_validate_arrays(Mesh *mesh, float(*vert_positions)[3], unsigned int verts_num, blender::int2 *edges, unsigned int edges_num, MFace *legacy_faces, unsigned int legacy_faces_num, const int *corner_verts, int *corner_edges, unsigned int corners_num, const int *face_offsets, unsigned int faces_num, MDeformVert *dverts, bool do_verbose, bool do_fixes, bool *r_change)
void BKE_mesh_legacy_convert_loops_to_corners(Mesh *mesh)
void BKE_mesh_legacy_convert_polys_to_offsets(Mesh *mesh)
void multires_do_versions_simple_to_catmull_clark(Object *object, MultiresModifierData *mmd)
#define FOREACH_NODETREE_END
Definition BKE_node.hh:881
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition BKE_node.hh:871
#define GEO_NODE_OBJECT_INFO
#define SH_NODE_BSDF_PRINCIPLED
#define GEO_NODE_MESH_BOOLEAN
#define SH_NODE_TEX_SKY
#define CMP_NODE_CRYPTOMATTE_LEGACY
#define GEO_NODE_MESH_PRIMITIVE_GRID
#define CMP_NODE_OUTPUT_FILE
#define CMP_NODE_SETALPHA
#define CMP_NODE_R_LAYERS
#define GEO_NODE_JOIN_GEOMETRY
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:608
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:270
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:91
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
#define DEG2RADF(_deg)
#define M_PI_2
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void loc_eul_size_to_mat4(float R[4][4], const float loc[3], const float eul[3], const float size[3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
unsigned int uint
#define ARRAY_SIZE(arr)
#define UNUSED_VARS(...)
#define STREQLEN(a, b, n)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
#define STREQ(a, b)
external readfile function prototypes.
@ ID_PAL
@ ID_BR
@ IDP_GROUP
@ IDP_FLAG_OVERRIDABLE_LIBRARY
@ CACHEFILE_VELOCITY_UNIT_SECOND
Object groups, one object can be in many groups at once.
@ COLLECTION_COLOR_NONE
@ CU_BEV_MODE_OBJECT
@ CU_BEV_MODE_ROUND
@ CU_3D
@ CU_PATH_CLAMP
@ BEZT_IPO_BEZ
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
#define MAX_NAME
Definition DNA_defs.h:50
@ FLUID_DOMAIN_FIELD_PHI
@ FLUID_DOMAIN_TYPE_LIQUID
blenloader genfile private function prototypes
#define GP_DEFAULT_CURVE_EDIT_CORNER_ANGLE
#define GP_DEFAULT_CURVE_RESOLUTION
#define GP_DEFAULT_CURVE_ERROR
@ GP_DATA_CURVE_ADAPTIVE_RESOLUTION
@ eGpencilModifierType_Array
@ eGpencilModifierType_Noise
@ eGpencilModifierType_Mirror
@ eGpencilModifierType_Color
@ eGpencilModifierType_Multiply
@ eGpencilModifierType_Texture
@ eGpencilModifierType_Subdiv
@ eGpencilModifierType_Lattice
@ eGpencilModifierType_Opacity
@ eGpencilModifierType_Hook
@ eGpencilModifierType_Simplify
@ eGpencilModifierType_Smooth
@ eGpencilModifierType_Thick
@ eGpencilModifierType_Offset
@ VIEW_LAYER_CRYPTOMATTE_ACCURATE
@ EEVEE_RENDER_PASS_UNUSED_8
@ ME_SYMMETRY_X
@ ME_SYMMETRY_Y
@ ME_SYMMETRY_Z
@ eBooleanModifierSolver_Float
@ MOD_BEVEL_PROFILE_CUSTOM
@ MOD_BEVEL_PROFILE_SUPERELLIPSE
@ MOD_WVG_EDIT_WEIGHTS_NORMALIZE
@ eBooleanModifierFlag_Object
@ eModifierType_Mirror
@ eModifierType_WeightVGProximity
@ eModifierType_Boolean
@ eModifierType_Fluid
@ eModifierType_MeshSequenceCache
@ eModifierType_Ocean
@ eModifierType_Nodes
@ eModifierType_Bevel
@ eModifierType_WeightVGEdit
@ eModifierType_Multires
@ MOD_MESHSEQ_INTERPOLATE_VERTICES
@ MOD_BEVEL_AFFECT_EDGES
@ MOD_BEVEL_AFFECT_VERTICES
@ NTREE_SHADER
@ NTREE_GEOMETRY
@ NTREE_COMPOSIT
@ SOCK_IN
@ CMP_NODE_SETALPHA_MODE_REPLACE_ALPHA
@ SOCK_MULTI_INPUT
@ GEO_NODE_TRANSFORM_SPACE_RELATIVE
@ OB_MODE_SCULPT
Object is a sort of wrapper for general info.
@ OB_ARMATURE
@ OB_GPENCIL_LEGACY
@ PART_FLUID_FLIP
@ PART_FLUID_BUBBLE
@ PART_FLUID_FOAM
@ PART_FLUID_SPRAY
@ PART_PHYS_NO
Types and defines for representing Rigid Body entities.
#define RE_PASSNAME_VOLUME_LIGHT
@ PNL_UNUSED_1
@ PNL_CLOSED
@ UI_PANEL_DATA_EXPAND_ROOT
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_TOP
@ RGN_TYPE_FOOTER
@ RGN_TYPE_HEADER
@ SEQ_CACHE_STORE_RAW
@ SEQ_CACHE_STORE_FINAL_OUT
@ STRIP_TYPE_SOUND_HD
@ STRIP_TYPE_SOUND_RAM
@ STRIP_TYPE_META
@ SEQ_USE_PROXY
@ SI_FLAG_UNUSED_20
@ SI_OVERLAY_SHOW_OVERLAYS
eSpaceSeq_Proxy_RenderSize
@ SEQ_RENDER_SIZE_PROXY_25
@ SEQ_RENDER_SIZE_PROXY_75
@ SEQ_RENDER_SIZE_PROXY_50
@ SEQ_RENDER_SIZE_PROXY_100
@ SEQ_RENDER_SIZE_FULL_DEPRECATED
@ SPACE_OUTLINER
@ SPACE_NODE
@ SPACE_SPREADSHEET
@ SPACE_PROPERTIES
@ SPACE_SEQ
@ SPACE_IMAGE
@ SPACE_VIEW3D
@ SEQ_TIMELINE_SHOW_STRIP_DURATION
@ SEQ_TIMELINE_SHOW_STRIP_SOURCE
@ SEQ_TIMELINE_SHOW_STRIP_NAME
@ SO_RESTRICT_RENDER
@ SO_FILTER_OB_STATE_INVERSE
@ SO_MODE_COLUMN
@ SO_FILTER_OB_VISIBLE
@ SO_FILTER_OB_HIDDEN
@ SEQ_DRAW_IMG_IMBUF
@ SEQ_USE_PROXIES
@ SEQ_SHOW_OVERLAY
@ PROPERTIES_SYNC_AUTO
@ REFINE_PRINCIPAL_POINT
@ REFINE_RADIAL_DISTORTION
@ REFINE_FOCAL_LENGTH
@ USER_HEADER_BOTTOM
@ V3D_OVERLAY_FADE_INACTIVE
IMB_Proxy_Size
@ IMB_PROXY_NONE
Read Guarded memory(de)allocation.
#define U
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v2
nullptr float
@ DENOISER_OPTIX
Definition denoise.h:12
#define offsetof(t, d)
#define printf(...)
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_dupallocN(const void *vmemh)
Definition mallocn.cc:143
size_t(* MEM_allocN_len)(const void *vmemh)
Definition mallocn.cc:36
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
Definition node.cc:2532
void node_remove_socket(bNodeTree &ntree, bNode &node, bNodeSocket &sock)
Definition node.cc:3243
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
Definition node.cc:3810
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
SequencerToolSettings * tool_settings_init()
Definition sequencer.cc:359
IMB_Proxy_Size rendersize_to_proxysize(eSpaceSeq_Proxy_RenderSize render_size)
Definition proxy.cc:72
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:286
int time_left_handle_frame_get(const Scene *, const Strip *strip)
MetaStack * meta_stack_active_get(const Editing *ed)
Definition sequencer.cc:454
void time_left_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame)
float rendersize_to_scale_factor(eSpaceSeq_Proxy_RenderSize render_size)
Definition proxy.cc:88
void time_right_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame)
const char * name
#define fabsf
void * blo_read_get_new_globaldata_address(FileData *fd, const void *adr)
Definition readfile.cc:1512
bAction * action
float vec[3][3]
CustomDataLayer * layers
ListBase seqbase
ListBase metastack
BezTriple * bezt
unsigned int totvert
SDNA * filesdna
Definition readfile.hh:105
struct FluidDomainSettings * domain
ListBase group
Definition DNA_ID.h:143
IDPropertyData data
Definition DNA_ID.h:169
char type
Definition DNA_ID.h:156
Definition DNA_ID.h:414
void * first
ListBase brushes
Definition BKE_main.hh:302
ListBase scenes
Definition BKE_main.hh:278
ListBase wm
Definition BKE_main.hh:307
ListBase actions
Definition BKE_main.hh:300
ListBase texts
Definition BKE_main.hh:294
ListBase meshes
Definition BKE_main.hh:281
ListBase movieclips
Definition BKE_main.hh:311
ListBase lights
Definition BKE_main.hh:288
ListBase nodetrees
Definition BKE_main.hh:301
ListBase particles
Definition BKE_main.hh:303
ListBase materials
Definition BKE_main.hh:284
ListBase pointclouds
Definition BKE_main.hh:321
ListBase armatures
Definition BKE_main.hh:299
ListBase curves
Definition BKE_main.hh:282
ListBase screens
Definition BKE_main.hh:292
short versionfile
Definition BKE_main.hh:181
ListBase workspaces
Definition BKE_main.hh:315
ListBase collections
Definition BKE_main.hh:298
ListBase gpencils
Definition BKE_main.hh:309
ListBase objects
Definition BKE_main.hh:280
ListBase cachefiles
Definition BKE_main.hh:314
MovieTrackingSettings settings
float aerosol_density
struct NodesModifierSettings settings
struct IDProperty * properties
ListBase children
struct RenderData r
struct AnimData * adt
SpaceImageOverlay overlay
ListBase treepath
short render_size
StripProxy * proxy
StripCrop * crop
StripTransform * transform
StripElem * stripdata
StripData * data
char name[64]
View3DOverlay overlay
ListBase curves
struct bNodeSocket * next
void * default_value
ListBase nodes
ListBase links
i
Definition text_draw.cc:230
static void strip_convert_transform_crop_lb(const Scene *scene, const ListBase *lb, const eSpaceSeq_Proxy_RenderSize render_size)
static void strip_convert_transform_animation_2(const Scene *scene, const char *path, const float scale_to_fit_factor)
static void strip_convert_transform_animation(const Strip *strip, const Scene *scene, const char *path, const int image_size, const int scene_size)
static void version_node_socket_duplicate(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
static void strip_convert_transform_crop(const Scene *scene, Strip *strip, const eSpaceSeq_Proxy_RenderSize render_size)
static void version_node_join_geometry_for_multi_input_socket(bNodeTree *ntree)
static void strip_convert_transform_crop_2(const Scene *scene, Strip *strip, const eSpaceSeq_Proxy_RenderSize render_size)
static bool can_use_proxy(const Strip *strip, IMB_Proxy_Size psize)
static void do_versions_291_fcurve_handles_limit(FCurve *fcu)
void do_versions_after_linking_290(FileData *, Main *bmain)
static void panels_remove_x_closed_flag_recursive(Panel *panel)
#define CU_2D
static void strip_convert_transform_crop_lb_2(const Scene *scene, const ListBase *lb, const eSpaceSeq_Proxy_RenderSize render_size)
void blo_do_versions_290(FileData *fd, Library *, Main *bmain)
static void do_versions_point_attributes(CustomData *pdata)
static eSpaceSeq_Proxy_RenderSize get_sequencer_render_size(Main *bmain)
static void seq_update_meta_disp_range(Scene *scene)
static void do_versions_point_attribute_names(CustomData *pdata)
void version_cycles_property_int_set(IDProperty *idprop, const char *name, int value)
IDProperty * version_cycles_properties_from_ID(ID *id)
int version_cycles_property_int(IDProperty *idprop, const char *name, int default_value)
IDProperty * version_cycles_properties_from_render_layer(SceneRenderLayer *render_layer)
void version_node_socket_index_animdata(Main *bmain, const int node_tree_type, const int node_type, const int socket_index_orig, const int socket_index_offset, const int total_number_of_sockets)
void version_node_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
bool version_cycles_property_boolean(IDProperty *idprop, const char *name, bool default_value)
IDProperty * version_cycles_properties_from_view_layer(ViewLayer *view_layer)
void version_cycles_property_boolean_set(IDProperty *idprop, const char *name, bool value)
ARegion * do_versions_add_region_if_not_found(ListBase *regionbase, int region_type, const char *, int link_after_region_type)