Blender V5.3
versioning_503.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#define DNA_DEPRECATED_ALLOW
10
11#include "DNA_ID.h"
12#include "DNA_brush_types.h"
13#include "DNA_camera_types.h"
15#include "DNA_curves_types.h"
17#include "DNA_mesh_types.h"
18#include "DNA_modifier_types.h"
20#include "DNA_object_types.h"
22#include "DNA_scene_types.h"
23#include "DNA_screen_types.h"
24#include "DNA_sequence_types.h"
25#include "DNA_view3d_types.h"
27
29#include "BLI_math_vector_c.hh"
30#include "BLI_string_ref.hh"
31#include "BLI_sys_types.hh"
32
33#include "BKE_attribute.h"
34#include "BKE_attribute.hh"
35#include "BKE_camera.h"
36#include "BKE_colorband.hh"
37#include "BKE_compositor.hh"
38#include "BKE_idprop.hh"
39#include "BKE_main.hh"
41#include "BKE_node.hh"
42#include "BKE_node_runtime.hh"
43#include "BKE_paint.hh"
44#include "BKE_paint_types.hh"
45#include "BKE_screen.hh"
46
48
49#include "SEQ_iterator.hh"
50#include "SEQ_sequencer.hh"
51
52#include "readfile.hh"
53
54#include "versioning_common.hh"
55
56// #include "CLG_log.h"
57
58namespace blender {
59
60// static CLG_LogRef LOG = {"blend.doversion"};
61
63{
64 if (blender::bke::node_find_socket(node, SOCK_IN, "Mode"_ustr)) {
65 return;
66 }
67 bNodeSocket &socket = version_node_add_socket(ntree, node, SOCK_IN, "NodeSocketMenu", "Mode");
68 socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
69}
70
72{
73 if (blender::bke::node_find_socket(node, SOCK_IN, "Depth Order"_ustr)) {
74 return;
75 }
77 ntree, node, SOCK_IN, "NodeSocketMenu", "Depth Order");
78 socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
79}
80
82{
84 return;
85 }
86
87 auto &storage = *reinterpret_cast<NodeGeometryMergeLayers *>(node.storage);
88
89 if (blender::bke::node_find_socket(node, SOCK_IN, "Mode"_ustr)) {
90 return;
91 }
92 bNodeSocket &socket = version_node_add_socket(ntree, node, SOCK_IN, "NodeSocketMenu", "Mode");
93 socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.mode;
94}
95
96static float version_503_camera_view_viewfac(const int sensor_fit,
97 const int winx,
98 const int winy,
99 const float frame_aspect)
100{
101 const float2 frame_size = BKE_camera_frame_size(winx, winy, frame_aspect);
102
103 return (BKE_camera_sensor_fit(sensor_fit, 1.0f, frame_aspect) == CAMERA_SENSOR_FIT_HOR) ?
104 frame_size.x :
105 frame_size.y;
106}
107
109 const int sensor_fit,
110 const int winx,
111 const int winy,
112 const float render_aspect)
113{
114 /* The camera frame is now automatically fitted to the viewport, taking into count
115 * the render aspect ratio. Here we version existing camera views to match. */
116 if ((rv3d->persp != RV3D_CAMOB) && (rv3d->camzoom == 0.0f) && (rv3d->camdx == 0.0f) &&
117 (rv3d->camdy == 0.0f))
118 {
119 return;
120 }
121
122 const float viewfac_old = version_503_camera_view_viewfac(
123 sensor_fit, winx, winy, float(winy) / float(winx));
124 const float viewfac_new = version_503_camera_view_viewfac(sensor_fit, winx, winy, render_aspect);
125
126 /* Adjust zoom factor. */
127 const float zoomfac_old = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
128 rv3d->camzoom = math::clamp(
129 BKE_screen_view3d_zoom_from_fac(zoomfac_old * viewfac_old / viewfac_new),
130 float(RV3D_CAMZOOM_MIN),
131 float(RV3D_CAMZOOM_MAX));
132
133 /* Adjust panning. */
134 const float zoomfac_new = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
135 rv3d->camdx = math::clamp(rv3d->camdx * zoomfac_old / zoomfac_new, -1.0f, 1.0f);
136 rv3d->camdy = math::clamp(rv3d->camdy * zoomfac_old / zoomfac_new, -1.0f, 1.0f);
137}
138
140{
141 for (bScreen &screen : bmain->screens) {
142 Scene *scene = bmain->scenes.first_as<Scene>();
143 for (wmWindowManager &wm : bmain->wm) {
144 for (wmWindow &win : wm.windows) {
145 if (win.winid == screen.winid) {
146 scene = win.scene;
147 }
148 }
149 }
150 if (scene == nullptr) {
151 continue;
152 }
153 const float render_aspect = (float(scene->r.ysch) * scene->r.yasp) /
154 (float(scene->r.xsch) * scene->r.xasp);
155
156 for (ScrArea &area : screen.areabase) {
157 for (SpaceLink &space : area.spacedata) {
158 if (space.spacetype != SPACE_VIEW3D) {
159 continue;
160 }
161 View3D *v3d = reinterpret_cast<View3D *>(&space);
162
163 const Object *camera = (v3d->camera != nullptr) ? v3d->camera : scene->camera;
164 const int sensor_fit = (camera != nullptr && camera->type == OB_CAMERA &&
165 camera->data != nullptr) ?
166 id_cast<const Camera *>(camera->data)->sensor_fit :
168
169 ListBaseT<ARegion> *regions = (area.spacedata.first() == &space) ? &area.regionbase :
170 &space.regionbase;
171 for (ARegion &region : *regions) {
172 if (region.regiontype != RGN_TYPE_WINDOW) {
173 continue;
174 }
175 RegionView3D *rv3d = static_cast<RegionView3D *>(region.regiondata);
176 if (rv3d == nullptr) {
177 continue;
178 }
179 if ((region.winx <= 1) || (region.winy <= 1)) {
180 continue;
181 }
182
183 version_503_camera_view_fit(rv3d, sensor_fit, region.winx, region.winy, render_aspect);
184 if (rv3d->localvd != nullptr) {
186 rv3d->localvd, sensor_fit, region.winx, region.winy, render_aspect);
187 }
188 }
189 }
190 }
191 }
192}
193
195{
196 if (brush.gpencil_settings) {
197 brush.gpencil_settings->flag &= ~GP_BRUSH_UNUSED_1;
198 brush.gpencil_settings->flag2 &= ~(GP_BRUSH_UNUSED_2 | GP_BRUSH_UNUSED_3 | GP_BRUSH_UNUSED_4 |
200 }
201 brush.paint_flags &= ~BRUSH_PAINT_UNUSED_2;
203}
204
210{
211 if (!nmd.node_group || !nmd.modifier.system_properties) {
212 return;
213 }
215 nmd.modifier.system_properties, "inputs", IDP_GROUP);
216 if (!inputs) {
217 return;
218 }
219 const bNodeTree &ntree = *nmd.node_group;
220 ntree.ensure_interface_cache();
221 for (const bNodeTreeInterfaceSocket *input : ntree.interface_inputs()) {
222 if (!(input->flag & NODE_INTERFACE_SOCKET_LAYER_SELECTION) ||
223 !STREQ(input->socket_type, "NodeSocketBool"))
224 {
225 continue;
226 }
227 IDProperty *group = IDP_GetPropertyTypeFromGroup(inputs, input->identifier, IDP_GROUP);
228 if (!group) {
229 continue;
230 }
231 IDProperty *type = IDP_GetPropertyTypeFromGroup(group, "type", IDP_INT);
232 if (type && IDP_int_get(type) == int(nodes::GeometryNodesInputType::Value)) {
234 }
235 }
236}
237
239{
240 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 15)) {
241 for (Scene &scene : bmain->scenes) {
242 if (scene.compositing_node_group) {
244 scene.compositing_node_group = nullptr;
245 }
246 }
247 }
248 else {
249 /* The now deprecated compositing_node_group is always written on file writes for forward
250 * compatibility, so it has to be reset to nullptr if no versioning was needed.
251 *
252 * Todo(#140111): Forward compatibility support will be removed in 6.0, and this loop can then
253 * be placed behind a `MAIN_VERSION_FILE_OLDER(bmain, 600, xxx)` check . */
254 for (Scene &scene : bmain->scenes) {
255 scene.compositing_node_group = nullptr;
256 }
257 }
258
259 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 16)) {
260 /* Shift animation data to accommodate the new dispersion inputs. */
261 version_node_socket_index_animdata(bmain, NTREE_SHADER, "ShaderNodeBsdfPrincipled", 20, 2, 33);
262 }
263
264 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 19)) {
265 /* Runs here instead of `blo_do_versions_503`, since screen datablocks are not fully linked
266 * (e.g. `#View3D.camera`) until after linking. */
268 }
269
270 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 20)) {
271 /* Shift animation data to accommodate the new anisotropic inputs. */
272 version_node_socket_index_animdata(bmain, NTREE_SHADER, "ShaderNodeBsdfGlass", 5, 3, 7);
273 version_node_socket_index_animdata(bmain, NTREE_SHADER, "ShaderNodeBsdfGlass", 2, 2, 4);
274 }
275
276 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 23)) {
277 bool has_skip_alphabet_sort_method = false;
278 for (bScreen &screen : bmain->screens) {
279 for (ScrArea &area : screen.areabase) {
280 for (SpaceLink &space : area.spacedata) {
281 if (space.spacetype == SPACE_OUTLINER) {
282 SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(&space);
283 if (space_outliner->flag & SO_FLAG_UNUSED_4) {
284 has_skip_alphabet_sort_method = true;
285 }
286 }
287 }
288 }
289 }
290 auto version_collection_fn = [&](Collection &collection) {
291 Map<Object *, int> parent_child_indices;
292 int index = 0;
293 for (CollectionChild &child : collection.children) {
294 child.sort_index = index++;
295 }
296 for (CollectionObject &cob : collection.gobject) {
297 cob.sort_index = (has_skip_alphabet_sort_method) ? index++ : -1;
298 if (has_skip_alphabet_sort_method && cob.ob != nullptr && cob.ob->parent != nullptr) {
299 int &child_index = parent_child_indices.lookup_or_add(cob.ob->parent, 0);
300 cob.parented_sort_index = child_index++;
301 }
302 else {
303 cob.parented_sort_index = -1;
304 }
305 }
306 };
307 for (Collection &collection : bmain->collections) {
308 version_collection_fn(collection);
309 }
310 for (Scene &scene : bmain->scenes) {
311 if (scene.master_collection != nullptr) {
312 version_collection_fn(*scene.master_collection);
313 }
314 }
315 for (bScreen &screen : bmain->screens) {
316 for (ScrArea &area : screen.areabase) {
317 for (SpaceLink &space : area.spacedata) {
318 if (space.spacetype == SPACE_OUTLINER) {
319 SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(&space);
320 if (has_skip_alphabet_sort_method && !(space_outliner->flag & SO_FLAG_UNUSED_4)) {
321 space_outliner->sort_method = SO_SORT_ALPHA;
322 }
323 else {
324 space_outliner->sort_method = SO_SORT_CUSTOM;
325 }
326 space_outliner->flag &= ~SO_FLAG_UNUSED_4;
327 }
328 }
329 }
330 }
331 }
332
333 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 30)) {
334 for (Object &object : bmain->objects) {
335 for (ModifierData &md : object.modifiers) {
336 if (md.type == eModifierType_Nodes) {
338 }
339 }
340 }
341 }
342
349}
350
351void blo_do_versions_503(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
352{
353 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 1)) {
354 for (Scene &scene : bmain->scenes) {
355 VPaint *wpaint = scene.toolsettings->wpaint;
356 if (wpaint && wpaint->paint.brush_asset_reference) {
357 const StringRefNull old_asset_id =
359 if (wpaint->paint.brush == nullptr && old_asset_id.endswith("Paint")) {
360 /* The "Paint" brush asset was renamed to "Add Weight", find it via the default instead
361 * of hard-coding the new name. */
362 if (std::optional<AssetWeakReference> paint_brush_asset_reference =
365 {
366 BKE_paint_brush_set(bmain, &wpaint->paint, *paint_brush_asset_reference);
367 }
368 }
369 }
370 }
371 }
372
373 /* The compositor previously did not support default inputs for group nodes, but some built-in
374 * nodes had the position field default type for some inputs, so node groups would gain it as a
375 * default type through some operators. Later, the default inputs were supported for group nodes,
376 * though position field were not supported in the compositor, so it would assert. To fix this,
377 * we reset any position field default input to the default value. */
378 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 3)) {
379 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
380 if (node_tree->type == NTREE_COMPOSIT) {
381 node_tree->ensure_interface_cache();
382 for (bNodeTreeInterfaceSocket *input : node_tree->interface_inputs()) {
383 if (input->default_input == NODE_DEFAULT_INPUT_POSITION_FIELD) {
384 input->default_input = NODE_DEFAULT_INPUT_VALUE;
385 }
386 }
387 }
388 }
390 }
391
392 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 4)) {
393 for (bScreen &screen : bmain->screens) {
394 for (ScrArea &area : screen.areabase) {
395 for (SpaceLink &sl : area.spacedata) {
396 if (sl.spacetype == SPACE_ACTION) {
397 SpaceAction *saction = reinterpret_cast<SpaceAction *>(&sl);
399 }
400 }
401 }
402 }
403 }
404
405 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 6)) {
406 for (Brush &brush : bmain->brushes) {
408 if (brush.mesh_automasking_settings == nullptr) {
409 brush.mesh_automasking_settings = MEM_new<MeshAutomaskingSettings>(__func__);
410 brush.mesh_automasking_settings->cavity_curve = BKE_sculpt_default_cavity_curve();
411 }
412 }
413 }
414
415 auto apply_to_paint = [&](Paint *paint) {
416 if (paint == nullptr) {
417 return;
418 }
419
420 if (paint->mesh_automasking_settings == nullptr) {
421 paint->mesh_automasking_settings = MEM_new<MeshAutomaskingSettings>("blo_do_versions_520");
422 paint->mesh_automasking_settings->cavity_curve = BKE_sculpt_default_cavity_curve();
423 paint->mesh_automasking_settings->cavity_curve_op = BKE_sculpt_default_cavity_curve();
424 }
425 };
426
427 for (Scene &scene : bmain->scenes) {
428 apply_to_paint(reinterpret_cast<Paint *>(scene.toolsettings->vpaint));
429 apply_to_paint(reinterpret_cast<Paint *>(scene.toolsettings->wpaint));
430 }
431 }
432
433 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 7)) {
434 for (Scene &scene : bmain->scenes) {
435 for (ViewLayer &view_layer : scene.view_layers) {
436 view_layer.eevee.denoising_pass_flags =
438 }
439 }
440 }
441
442 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 8)) {
443 FOREACH_NODETREE_BEGIN (bmain, node_tree, id_owner) {
444 for (bNode &node : node_tree->nodes) {
445 if (STREQ(node.idname, "GeometryNodeSetGreasePencilColor")) {
447 }
448 if (STREQ(node.idname, "GeometryNodeSetGreasePencilDepth")) {
450 }
451 if (STREQ(node.idname, "GeometryNodeMergeLayers")) {
453 }
454 }
455 }
457 }
458
459 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 9)) {
460 for (Brush &brush : bmain->brushes) {
461 if (brush.curve_hardness == nullptr) {
462 brush.curve_hardness = brush.paint_flags & BRUSH_PAINT_UNUSED_2 ?
465 }
466 if (brush.curve_auto_smooth == nullptr) {
467 brush.curve_auto_smooth = BKE_paint_default_curve_inverted();
468 }
469 if (brush.curve_spacing == nullptr) {
470 brush.curve_spacing = BKE_paint_default_curve();
471 }
472 }
473 }
474
475 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 11)) {
476 /* This code formerly ran whenever entering Sculpt Mode, it is unlikely that there are any
477 * files that have these settings with invalid values, but since these values have never been
478 * set in versioning, perform this
479 */
480 for (Scene &scene : bmain->scenes) {
481 Sculpt *sd = scene.toolsettings->sculpt;
482 if (sd == nullptr) {
483 continue;
484 }
485
486 const Sculpt defaults = {};
487 if (sd->detail_percent == 0.0f) {
488 sd->detail_percent = defaults.detail_percent;
489 }
490 if (sd->constant_detail == 0.0f) {
491 sd->constant_detail = defaults.constant_detail;
492 }
493 if (sd->detail_size == 0.0f) {
494 sd->detail_size = defaults.detail_size;
495 }
496
497 if (!sd->paint.tile_offset[0]) {
498 sd->paint.tile_offset[0] = 1.0f;
499 }
500 if (!sd->paint.tile_offset[1]) {
501 sd->paint.tile_offset[1] = 1.0f;
502 }
503 if (!sd->paint.tile_offset[2]) {
504 sd->paint.tile_offset[2] = 1.0f;
505 }
506 }
507 }
508
509 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 12)) {
510 for (Brush &brush : bmain->brushes) {
511 if (brush.ob_mode & OB_MODE_WEIGHT_PAINT || brush.ob_mode & OB_MODE_VERTEX_PAINT) {
512 if (brush.flag & BRUSH_UNUSED_7 && brush.falloff_angle_legacy != 0.0f) {
513 switch (brush.falloff_shape) {
515 brush.mesh_automasking_settings->flags |= BRUSH_AUTOMASKING_BRUSH_NORMAL;
516 brush.mesh_automasking_settings->start_normal_falloff = 0.5f;
517 brush.mesh_automasking_settings->start_normal_limit = brush.falloff_angle_legacy;
518 break;
520 brush.mesh_automasking_settings->flags |= BRUSH_AUTOMASKING_VIEW_NORMAL;
521 brush.mesh_automasking_settings->view_normal_falloff = 0.5f;
522 brush.mesh_automasking_settings->view_normal_limit = brush.falloff_angle_legacy;
523 break;
524 }
525 }
526 }
527 }
528 }
529
530 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 13)) {
531 auto validate_active_index_fn = [](const AttributeOwner &owner, int &active_index) -> void {
533 if ((active_index < 0) || (active_index >= storage->count()) ||
534 !bke::allow_procedural_attribute_access(storage->at_index(active_index).name()))
535 {
536 active_index = -1;
537 }
538 };
539
540 for (Mesh &mesh : bmain->meshes) {
541 validate_active_index_fn(AttributeOwner::from_id(&mesh.id), mesh.attributes_active_index);
542 }
543 for (Curves &curves : bmain->hair_curves) {
544 validate_active_index_fn(AttributeOwner::from_id(&curves.id),
545 curves.geometry.attributes_active_index);
546 }
548 validate_active_index_fn(AttributeOwner::from_id(&grease_pencil.id),
549 grease_pencil.attributes_active_index);
550 /* Also check the attributes_active_index in the individual drawings */
551 for (GreasePencilDrawingBase *drawing_base : grease_pencil.drawings()) {
552 if (drawing_base->type == GP_DRAWING) {
553 GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base);
554 validate_active_index_fn(
557 }
558 }
559 }
560 for (PointCloud &pointcloud : bmain->pointclouds) {
561 validate_active_index_fn(AttributeOwner::from_id(&pointcloud.id),
562 pointcloud.attributes_active_index);
563 }
564 }
565
566 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 14)) {
567 for (bScreen &screen : bmain->screens) {
568 for (ScrArea &area : screen.areabase) {
569 for (SpaceLink &space : area.spacedata) {
570 if (space.spacetype == SPACE_OUTLINER) {
571 SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(&space);
572 space_outliner->flag |= SO_EXPAND_ON_FOCUS;
573 }
574 }
575 }
576 }
577 }
578
579 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 16)) {
580 for (Brush &brush : bmain->brushes) {
581 if (ELEM(brush.ob_mode,
587 {
589 }
590 if (ELEM(brush.ob_mode,
594 {
595 brush.unified_paint_flags |= BRUSH_USE_UNIFIED_PAINT_SIZE;
596 }
597 }
598 }
599
600 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 17)) {
601 for (Scene &scene : bmain->scenes) {
602 if (Editing *ed = seq::editing_get(&scene)) {
603 seq::foreach_strip(&ed->seqbase, [&](Strip *strip) {
604 switch (strip->type) {
605 case STRIP_TYPE_IMAGE:
606 /* Every image in the sequence has its own #StripElem. Content trimming
607 * (#anim_startofs, #anim_endofs) hides elements at both ends without shrinking the
608 * array, so the full array is always this many elements long. */
609 strip->data->stripdata_num = strip->anim_startofs + strip->len + strip->anim_endofs;
610 break;
611 case STRIP_TYPE_MOVIE:
612 case STRIP_TYPE_SOUND:
613 /* Single #StripElem storing the file path. */
614 strip->data->stripdata_num = strip->data->stripdata ? 1 : 0;
615 break;
616 default:
617 strip->data->stripdata_num = 0;
618 break;
619 }
620 return true;
621 });
622 }
623 }
624 }
625
626 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 19)) {
627 for (bScreen &screen : bmain->screens) {
628 for (ScrArea &area : screen.areabase) {
629 for (SpaceLink &space : area.spacedata) {
630 if (space.spacetype == SPACE_SEQ) {
631 SpaceSeq *space_sequencer = reinterpret_cast<SpaceSeq *>(&space);
632 SequencerTimelineOverlay &timeline_overlay = space_sequencer->timeline_overlay;
633 const bool show_thumbnails =
634 (timeline_overlay.flag & SEQ_TIMELINE_MIDDLE_THUMBNAILS) ||
635 (timeline_overlay.flag & SEQ_TIMELINE_STRIP_END_THUMBNAILS) ||
636 (timeline_overlay.flag & SEQ_TIMELINE_CONTINUOUS_THUMBNAILS);
638 timeline_overlay.flag, show_thumbnails, SEQ_TIMELINE_SHOW_THUMBNAILS);
639 }
640 }
641 }
642 }
643 }
644
645 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 22)) {
646 for (Brush &brush : bmain->brushes) {
647 if (brush.paint_flags & BRUSH_PAINT_UNUSED_1) {
648 brush.paint_flags &= ~BRUSH_PAINT_UNUSED_1;
650 }
651 }
652 }
653
654 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 23)) {
655 for (Brush &brush : bmain->brushes) {
657 }
658 }
659
660 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 24)) {
661 for (bScreen &screen : bmain->screens) {
662 for (ScrArea &area : screen.areabase) {
663 for (SpaceLink &space : area.spacedata) {
664 if (space.spacetype == SPACE_OUTLINER) {
665 SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(&space);
666 space_outliner->flag &= ~SO_EXPAND_ON_FOCUS;
667 }
668 }
669 }
670 }
671 }
672
673 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 25)) {
674 for (Material &materials : bmain->materials) {
675 if (materials.gp_style == nullptr) {
676 continue;
677 }
678
679 if (materials.gp_style->fill_style != GP_MATERIAL_FILL_STYLE_GRADIENT) {
680 continue;
681 }
682
683 materials.gp_style->gradient = BKE_colorband_add(true);
684
685 if (materials.gp_style->flag & GP_MATERIAL_FLIP_FILL) {
686 copy_v4_v4(&materials.gp_style->gradient->data[0].r, materials.gp_style->mix_rgba);
687 copy_v4_v4(&materials.gp_style->gradient->data[1].r, materials.gp_style->fill_rgba);
688 }
689 else {
690 copy_v4_v4(&materials.gp_style->gradient->data[0].r, materials.gp_style->fill_rgba);
691 copy_v4_v4(&materials.gp_style->gradient->data[1].r, materials.gp_style->mix_rgba);
692 }
693
694 /* This flag is now deprecated. */
695 materials.gp_style->flag &= ~GP_MATERIAL_FLIP_FILL;
696 }
697 }
698
699 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 26)) {
700 for (Scene &scene : bmain->scenes) {
701 SequencerToolSettings *sequencer_tool_settings = seq::tool_settings_ensure(&scene);
702 sequencer_tool_settings->ripple_flag = SEQ_RIPPLE_ALL_CHANNELS | SEQ_RIPPLE_MARKERS |
704 }
705 }
706
707 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 28)) {
708 /* Some old files have node editors without a sidebar region. */
709 for (bScreen &screen : bmain->screens) {
710 for (ScrArea &area : screen.areabase) {
711 for (SpaceLink &space : area.spacedata) {
712 if (space.spacetype != SPACE_NODE) {
713 continue;
714 }
715 ListBaseT<ARegion> *regionbase = (&space == area.spacedata.first_) ? &area.regionbase :
716 &space.regionbase;
718 regionbase, RGN_TYPE_UI, "node editor sidebar", RGN_TYPE_HEADER))
719 {
720 new_sidebar->alignment = RGN_ALIGN_RIGHT;
721 new_sidebar->flag |= RGN_FLAG_HIDDEN;
722 }
723 }
724 }
725 }
726 }
727
734
735 /* Keep this versioning always enabled at the bottom of the function; it can only be moved
736 * behind a subversion bump when the file format is changed (#mesh_skin_to_legacy is removed from
737 * #mesh_blend_write). Since that function keeps writing the old-format #CD_MVERT_SKIN layer for
738 * forward compatibility, files saved by *this* version also need
739 * this conversion to run unconditionally on read, not just for files older than this subversion.
740 */
741 for (Mesh &mesh : bmain->meshes) {
743 }
744}
745
746} // namespace blender
Generic geometry attributes built on CustomData.
Camera data-block and utility functions.
#define IDP_int_get(prop)
#define IDP_int_set(prop, value)
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
Definition BKE_main.hh:949
#define FOREACH_NODETREE_END
Definition BKE_node.hh:936
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition BKE_node.hh:926
ID and Library types, which are fundamental for SDNA.
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
#define RV3D_CAMZOOM_MAX
#define RV3D_CAMZOOM_MIN
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
#define STREQ(a, b)
bke::AttributeStorage * get_storage() const
static AttributeOwner from_id(ID *id)
Value & lookup_or_add(const Key &key, const Value &value)
Definition BLI_map.hh:588
constexpr bool endswith(StringRef suffix) const
#define storage(slot, qualifiers)
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
bool allow_procedural_attribute_access(StringRef attribute_name)
void mesh_skin_to_generic(Mesh &mesh)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, UString identifier)
Definition node.cc:3036
T clamp(const T &a, const T &min, const T &max)
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
Definition iterator.cc:60
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:304
SequencerToolSettings * tool_settings_ensure(Scene *scene)
Definition sequencer.cc:393
BMesh Iterators.
bool version_node_ensure_storage_or_invalidate(bNode &node)
@ SEQ_TIMELINE_MIDDLE_THUMBNAILS
@ SEQ_TIMELINE_STRIP_END_THUMBNAILS
@ SEQ_TIMELINE_SHOW_THUMBNAILS
@ SEQ_TIMELINE_CONTINUOUS_THUMBNAILS
static void version_503_camera_view_fit(RegionView3D *rv3d, const int sensor_fit, const int winx, const int winy, const float render_aspect)
IDProperty * IDP_GetPropertyTypeFromGroup(const IDProperty *prop, StringRef name, char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:839
std::optional< AssetWeakReference > BKE_paint_brush_type_default_reference(bke::paint::AssetCategory asset_category, std::optional< int > brush_type)
static void version_layer_selection_modifier_inputs(NodesModifierData &nmd)
@ PAINT_FALLOFF_SHAPE_SPHERE
@ PAINT_FALLOFF_SHAPE_TUBE
static float version_503_camera_view_viewfac(const int sensor_fit, const int winx, const int winy, const float frame_aspect)
@ WPAINT_BRUSH_TYPE_DRAW
ColorBand * BKE_colorband_add(bool rangetype)
Definition colorband.cc:301
@ CAMERA_SENSOR_FIT_AUTO
@ CAMERA_SENSOR_FIT_HOR
float2 BKE_camera_frame_size(float winx, float winy, float frame_aspect)
static void do_version_set_grease_pencil_colors_options_to_inputs(bNodeTree &ntree, bNode &node)
void do_versions_after_linking_503(FileData *fd, Main *bmain)
static void clear_deprecated_brush_flags(Brush &brush)
VecBase< float, 2 > float2
@ OB_MODE_VERTEX_GREASE_PENCIL
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_SCULPT_GREASE_PENCIL
@ OB_MODE_SCULPT_CURVES
@ OB_MODE_WEIGHT_GREASE_PENCIL
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
Definition screen.cc:1288
CurveMapping * BKE_paint_default_curve_inverted()
Definition scene.cc:166
CurveMapping * BKE_sculpt_default_cavity_curve()
Definition scene.cc:142
bool BKE_paint_brush_set(Paint *paint, Brush *brush)
int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey)
@ SEQ_RIPPLE_CLEAR_RANGES
@ SEQ_RIPPLE_ALL_CHANNELS
@ BRUSH_AUTOMASKING_BRUSH_NORMAL
@ BRUSH_AUTOMASKING_VIEW_NORMAL
static void do_versioning_camera_view_zoom(Main *bmain)
@ BRUSH_USE_UNIFIED_PAINT_SIZE
@ BRUSH_USE_UNIFIED_PAINT_COLOR
void version_compositing_node_group_to_effect(Scene &scene, bNodeTree &node_group)
static void do_version_merge_layers_options_to_inputs(bNodeTree &ntree, bNode &node)
CurveMapping * BKE_paint_default_curve()
Definition scene.cc:157
@ BRUSH_HARDNESS_PRESSURE
float BKE_screen_view3d_zoom_to_fac(float camzoom)
Definition screen.cc:1283
MINLINE void copy_v4_v4(float r[4], const float a[4])
@ EEVEE_DENOISING_PASS_USE_ALBEDO_ROUGHNESS_WEIGHTING
ARegion * do_versions_add_region_if_not_found(ListBaseT< ARegion > *regionbase, int region_type, const char *, int link_after_region_type)
static void do_version_set_grease_pencil_depth_options_to_inputs(bNodeTree &ntree, bNode &node)
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 blo_do_versions_503(FileData *fd, Library *lib, Main *bmain)
bNodeSocket & version_node_add_socket(bNodeTree &ntree, bNode &node, const eNodeSocketInOut in_out, const char *idname, const char *identifier)
@ GP_MATERIAL_FILL_STYLE_GRADIENT
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< wmWindowManager > wm
Definition BKE_main.hh:415
ListBaseT< Collection > collections
Definition BKE_main.hh:406
ListBaseT< Curves > hair_curves
Definition BKE_main.hh:428
ListBaseT< PointCloud > pointclouds
Definition BKE_main.hh:429
ListBaseT< Brush > brushes
Definition BKE_main.hh:410
ListBaseT< Object > objects
Definition BKE_main.hh:388
ListBaseT< Mesh > meshes
Definition BKE_main.hh:389
ListBaseT< Scene > scenes
Definition BKE_main.hh:386
ListBaseT< GreasePencil > grease_pencils
Definition BKE_main.hh:418
ListBaseT< bScreen > screens
Definition BKE_main.hh:400
struct IDProperty * system_properties
struct Object * parent
struct Brush * brush
struct AssetWeakReference * brush_asset_reference
struct RegionView3D * localvd
eRegionView3D_Persp persp
ListBaseT< ViewLayer > view_layers
struct Collection * master_collection
struct Object * camera
DNA_DEPRECATED struct bNodeTree * compositing_node_group
struct RenderData r
struct ToolSettings * toolsettings
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
eTimeline_Cache_Flag cache_display
eSpaceOutliner_SortMethod sort_method
eSpaceOutliner_Flag flag
struct Object * camera
struct ViewLayerEEVEE eevee
ListBaseT< struct ScrArea > areabase