Blender V5.0
versioning_300.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#include <cstring>
13
14#include "CLG_log.h"
15
16#include "MEM_guardedalloc.h"
17
18#include "BLI_listbase.h"
19#include "BLI_math_base_safe.h"
20#include "BLI_math_matrix.h"
21#include "BLI_math_rotation.h"
22#include "BLI_math_vector.h"
24#include "BLI_path_utils.hh"
25#include "BLI_string.h"
26#include "BLI_string_utf8.h"
27#include "BLI_string_utils.hh"
28#include "BLI_utildefines.h"
29
30/* Define macros in `DNA_genfile.h`. */
31#define DNA_GENFILE_VERSIONING_MACROS
32
33#include "DNA_anim_types.h"
34#include "DNA_armature_types.h"
35#include "DNA_brush_types.h"
38#include "DNA_curve_types.h"
39#include "DNA_curves_types.h"
40#include "DNA_genfile.h"
42#include "DNA_light_types.h"
43#include "DNA_lineart_types.h"
44#include "DNA_listBase.h"
45#include "DNA_mask_types.h"
46#include "DNA_material_types.h"
47#include "DNA_mesh_types.h"
48#include "DNA_modifier_types.h"
49#include "DNA_movieclip_types.h"
50#include "DNA_screen_types.h"
51#include "DNA_sequence_types.h"
52#include "DNA_space_types.h"
53#include "DNA_text_types.h"
54#include "DNA_tracking_types.h"
56#include "DNA_workspace_types.h"
57
58#undef DNA_GENFILE_VERSIONING_MACROS
59
60#include "BKE_action.hh"
61#include "BKE_anim_data.hh"
62#include "BKE_animsys.h"
63#include "BKE_armature.hh"
64#include "BKE_asset.hh"
65#include "BKE_attribute.hh"
66#include "BKE_collection.hh"
67#include "BKE_colortools.hh"
68#include "BKE_curve.hh"
69#include "BKE_curves.hh"
70#include "BKE_customdata.hh"
71#include "BKE_data_transfer.h"
72#include "BKE_deform.hh"
73#include "BKE_fcurve.hh"
74#include "BKE_fcurve_driver.h"
75#include "BKE_idprop.hh"
76#include "BKE_image.hh"
77#include "BKE_lib_id.hh"
78#include "BKE_lib_override.hh"
79#include "BKE_main.hh"
80#include "BKE_main_namemap.hh"
81#include "BKE_mesh.hh"
82#include "BKE_modifier.hh"
83#include "BKE_nla.hh"
84#include "BKE_node.hh"
86#include "BKE_screen.hh"
87#include "BKE_workspace.hh"
88
89#include "RNA_access.hh"
90#include "RNA_enum_types.hh"
91#include "RNA_prototypes.hh"
92
93#include "BLO_readfile.hh"
94
95#include "readfile.hh"
96
97#include "SEQ_channels.hh"
98#include "SEQ_effects.hh"
99#include "SEQ_iterator.hh"
100#include "SEQ_retiming.hh"
101#include "SEQ_sequencer.hh"
102#include "SEQ_time.hh"
103
104#include "versioning_common.hh"
105
106static CLG_LogRef LOG = {"blend.doversion"};
107
109{
110 LISTBASE_FOREACH (IDProperty *, prop, &idprop_group->data.group) {
111 if (prop->type == IDP_GROUP && STREQ(prop->name, "_RNA_UI")) {
112 return prop;
113 }
114 }
115 return nullptr;
116}
117
119 const IDProperty *prop_ui_data)
120{
121 IDProperty *min = IDP_GetPropertyFromGroup(prop_ui_data, "min");
122 if (min != nullptr) {
123 ui_data->min = ui_data->soft_min = IDP_coerce_to_int_or_zero(min);
124 }
125 IDProperty *max = IDP_GetPropertyFromGroup(prop_ui_data, "max");
126 if (max != nullptr) {
127 ui_data->max = ui_data->soft_max = IDP_coerce_to_int_or_zero(max);
128 }
129 IDProperty *soft_min = IDP_GetPropertyFromGroup(prop_ui_data, "soft_min");
130 if (soft_min != nullptr) {
131 ui_data->soft_min = IDP_coerce_to_int_or_zero(soft_min);
132 ui_data->soft_min = std::min(ui_data->soft_min, ui_data->min);
133 }
134 IDProperty *soft_max = IDP_GetPropertyFromGroup(prop_ui_data, "soft_max");
135 if (soft_max != nullptr) {
136 ui_data->soft_max = IDP_coerce_to_int_or_zero(soft_max);
137 ui_data->soft_max = std::max(ui_data->soft_max, ui_data->max);
138 }
139 IDProperty *step = IDP_GetPropertyFromGroup(prop_ui_data, "step");
140 if (step != nullptr) {
141 ui_data->step = IDP_coerce_to_int_or_zero(soft_max);
142 }
143 IDProperty *default_value = IDP_GetPropertyFromGroup(prop_ui_data, "default");
144 if (default_value != nullptr) {
145 if (default_value->type == IDP_ARRAY) {
146 if (default_value->subtype == IDP_INT) {
147 ui_data->default_array = MEM_malloc_arrayN<int>(size_t(default_value->len), __func__);
148 memcpy(ui_data->default_array,
149 IDP_array_int_get(default_value),
150 sizeof(int) * default_value->len);
151 ui_data->default_array_len = default_value->len;
152 }
153 }
154 else if (default_value->type == IDP_INT) {
155 ui_data->default_value = IDP_coerce_to_int_or_zero(default_value);
156 }
157 }
158}
159
161 const IDProperty *prop_ui_data)
162{
163 IDProperty *min = IDP_GetPropertyFromGroup(prop_ui_data, "min");
164 if (min != nullptr) {
165 ui_data->min = ui_data->soft_min = IDP_coerce_to_double_or_zero(min);
166 }
167 IDProperty *max = IDP_GetPropertyFromGroup(prop_ui_data, "max");
168 if (max != nullptr) {
169 ui_data->max = ui_data->soft_max = IDP_coerce_to_double_or_zero(max);
170 }
171 IDProperty *soft_min = IDP_GetPropertyFromGroup(prop_ui_data, "soft_min");
172 if (soft_min != nullptr) {
173 ui_data->soft_min = IDP_coerce_to_double_or_zero(soft_min);
174 ui_data->soft_min = std::max(ui_data->soft_min, ui_data->min);
175 }
176 IDProperty *soft_max = IDP_GetPropertyFromGroup(prop_ui_data, "soft_max");
177 if (soft_max != nullptr) {
178 ui_data->soft_max = IDP_coerce_to_double_or_zero(soft_max);
179 ui_data->soft_max = std::min(ui_data->soft_max, ui_data->max);
180 }
181 IDProperty *step = IDP_GetPropertyFromGroup(prop_ui_data, "step");
182 if (step != nullptr) {
184 }
185 IDProperty *precision = IDP_GetPropertyFromGroup(prop_ui_data, "precision");
186 if (precision != nullptr) {
187 ui_data->precision = IDP_coerce_to_int_or_zero(precision);
188 }
189 IDProperty *default_value = IDP_GetPropertyFromGroup(prop_ui_data, "default");
190 if (default_value != nullptr) {
191 if (default_value->type == IDP_ARRAY) {
192 const int array_len = default_value->len;
193 ui_data->default_array_len = array_len;
194 if (default_value->subtype == IDP_FLOAT) {
195 ui_data->default_array = MEM_malloc_arrayN<double>(size_t(array_len), __func__);
196 const float *old_default_array = IDP_array_float_get(default_value);
197 for (int i = 0; i < ui_data->default_array_len; i++) {
198 ui_data->default_array[i] = double(old_default_array[i]);
199 }
200 }
201 else if (default_value->subtype == IDP_DOUBLE) {
202 ui_data->default_array = MEM_malloc_arrayN<double>(size_t(array_len), __func__);
203 memcpy(ui_data->default_array,
204 IDP_array_double_get(default_value),
205 sizeof(double) * array_len);
206 }
207 }
208 else if (ELEM(default_value->type, IDP_DOUBLE, IDP_FLOAT)) {
209 ui_data->default_value = IDP_coerce_to_double_or_zero(default_value);
210 }
211 }
212}
213
215 const IDProperty *prop_ui_data)
216{
217 IDProperty *default_value = IDP_GetPropertyFromGroup(prop_ui_data, "default");
218 if (default_value != nullptr && default_value->type == IDP_STRING) {
219 ui_data->default_value = BLI_strdup(IDP_string_get(default_value));
220 }
221}
222
223static void version_idproperty_ui_data(IDProperty *idprop_group)
224{
225 /* `nullptr` check here to reduce verbosity of calls to this function. */
226 if (idprop_group == nullptr) {
227 return;
228 }
229
230 IDProperty *ui_container = idproperty_find_ui_container(idprop_group);
231 if (ui_container == nullptr) {
232 return;
233 }
234
235 LISTBASE_FOREACH (IDProperty *, prop, &idprop_group->data.group) {
236 IDProperty *prop_ui_data = IDP_GetPropertyFromGroup(ui_container, prop->name);
237 if (prop_ui_data == nullptr) {
238 continue;
239 }
240
241 if (!IDP_ui_data_supported(prop)) {
242 continue;
243 }
244
245 IDPropertyUIData *ui_data = IDP_ui_data_ensure(prop);
246
247 IDProperty *subtype = IDP_GetPropertyFromGroup(prop_ui_data, "subtype");
248 if (subtype != nullptr && subtype->type == IDP_STRING) {
249 const char *subtype_string = IDP_string_get(subtype);
250 int result = PROP_NONE;
252 ui_data->rna_subtype = result;
253 }
254
255 IDProperty *description = IDP_GetPropertyFromGroup(prop_ui_data, "description");
256 if (description != nullptr && description->type == IDP_STRING) {
257 ui_data->description = BLI_strdup(IDP_string_get(description));
258 }
259
260 /* Type specific data. */
261 switch (IDP_ui_data_type(prop)) {
264 break;
266 break;
269 break;
272 break;
276 break;
277 }
278
279 IDP_FreeFromGroup(ui_container, prop_ui_data);
280 }
281
282 IDP_FreeFromGroup(idprop_group, ui_container);
283}
284
286{
288 LISTBASE_FOREACH (Bone *, child_bone, &bone->childbase) {
290 }
291}
292
294{
295 LISTBASE_FOREACH (Strip *, strip, seqbase) {
296 version_idproperty_ui_data(strip->prop);
297 if (strip->type == STRIP_TYPE_META) {
299 }
300 }
301}
302
313{
314 /* ID data. */
315 ID *id;
316 FOREACH_MAIN_ID_BEGIN (bmain, id) {
317 IDProperty *idprop_group = IDP_GetProperties(id);
318 version_idproperty_ui_data(idprop_group);
319 }
321
322 /* Bones. */
323 LISTBASE_FOREACH (bArmature *, armature, &bmain->armatures) {
324 LISTBASE_FOREACH (Bone *, bone, &armature->bonebase) {
326 }
327 }
328
329 /* Nodes and node sockets. */
330 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
331 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
332 version_idproperty_ui_data(node->prop);
333 }
334 LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->inputs_legacy) {
335 version_idproperty_ui_data(socket->prop);
336 }
337 LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->outputs_legacy) {
338 version_idproperty_ui_data(socket->prop);
339 }
340 }
341
342 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
343 /* The UI data from exposed node modifier properties is just copied from the corresponding node
344 * group, but the copying only runs when necessary, so we still need to version data here. */
345 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
346 if (md->type == eModifierType_Nodes) {
349 }
350 }
351
352 /* Object post bones. */
353 if (ob->type == OB_ARMATURE && ob->pose != nullptr) {
354 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
355 version_idproperty_ui_data(pchan->prop);
356 }
357 }
358 }
359
360 /* Sequences. */
361 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
362 if (scene->ed != nullptr) {
363 do_versions_idproperty_seq_recursive(&scene->ed->seqbase);
364 }
365 }
366}
367
368static void sort_linked_ids(Main *bmain)
369{
370 ListBase *lb;
371 FOREACH_MAIN_LISTBASE_BEGIN (bmain, lb) {
372 ListBase temp_list;
373 BLI_listbase_clear(&temp_list);
374 LISTBASE_FOREACH_MUTABLE (ID *, id, lb) {
375 if (ID_IS_LINKED(id)) {
376 BLI_remlink(lb, id);
377 BLI_addtail(&temp_list, id);
378 id_sort_by_name(&temp_list, id, nullptr);
379 }
380 }
381 BLI_movelisttolist(lb, &temp_list);
382 }
384}
385
386static void assert_sorted_ids(Main *bmain)
387{
388#ifndef NDEBUG
389 ListBase *lb;
390 FOREACH_MAIN_LISTBASE_BEGIN (bmain, lb) {
391 ID *id_prev = nullptr;
392 LISTBASE_FOREACH (ID *, id, lb) {
393 if (id_prev == nullptr) {
394 continue;
395 }
396 BLI_assert(id_prev->lib != id->lib || BLI_strcasecmp(id_prev->name, id->name) < 0);
397 }
398 }
400#else
401 UNUSED_VARS_NDEBUG(bmain);
402#endif
403}
404
406{
407 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
408 if (ELEM(object->type, OB_MESH, OB_LATTICE, OB_GPENCIL_LEGACY)) {
409 ListBase *new_defbase = BKE_object_defgroup_list_mutable(object);
410
411 /* Choose the longest vertex group name list among all linked duplicates. */
412 if (BLI_listbase_count(&object->defbase) < BLI_listbase_count(new_defbase)) {
413 BLI_freelistN(&object->defbase);
414 }
415 else {
416 /* Clear the list in case the it was already assigned from another object. */
417 BLI_freelistN(new_defbase);
418 *new_defbase = object->defbase;
419 BKE_object_defgroup_active_index_set(object, object->actdef);
420 }
421 }
422 }
423}
424
426{
427 /* Old SpeedControlVars->flags. */
428#define STRIP_SPEED_INTEGRATE (1 << 0)
429#define STRIP_SPEED_COMPRESS_IPO_Y (1 << 2)
430
431 LISTBASE_FOREACH (Strip *, strip, seqbase) {
432 if (strip->type == STRIP_TYPE_SPEED) {
433 SpeedControlVars *v = (SpeedControlVars *)strip->effectdata;
434 const char *substr = nullptr;
435 float globalSpeed_legacy = v->globalSpeed_legacy;
436 if (strip->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
437 if (globalSpeed_legacy == 1.0f) {
438 v->speed_control_type = SEQ_SPEED_STRETCH;
439 }
440 else {
441 v->speed_control_type = SEQ_SPEED_MULTIPLY;
442 v->speed_fader = globalSpeed_legacy *
443 (float(strip->input1->len) /
445 strip->input1) -
446 strip->input1->start),
447 1.0f));
448 }
449 }
450 else if (v->flags & STRIP_SPEED_INTEGRATE) {
451 v->speed_control_type = SEQ_SPEED_MULTIPLY;
452 v->speed_fader = strip->speed_fader_legacy * globalSpeed_legacy;
453 }
454 else if (v->flags & STRIP_SPEED_COMPRESS_IPO_Y) {
455 globalSpeed_legacy *= 100.0f;
456 v->speed_control_type = SEQ_SPEED_LENGTH;
457 v->speed_fader_length = strip->speed_fader_legacy * globalSpeed_legacy;
458 substr = "speed_length";
459 }
460 else {
461 v->speed_control_type = SEQ_SPEED_FRAME_NUMBER;
462 v->speed_fader_frame_number = int(strip->speed_fader_legacy * globalSpeed_legacy);
463 substr = "speed_frame_number";
464 }
465
467
468 if (substr || globalSpeed_legacy != 1.0f) {
470 &scene->id, strip, &RNA_Strip, "speed_factor", 0, nullptr);
471 if (fcu) {
472 if (globalSpeed_legacy != 1.0f) {
473 for (int i = 0; i < fcu->totvert; i++) {
474 BezTriple *bezt = &fcu->bezt[i];
475 bezt->vec[0][1] *= globalSpeed_legacy;
476 bezt->vec[1][1] *= globalSpeed_legacy;
477 bezt->vec[2][1] *= globalSpeed_legacy;
478 }
479 }
480 if (substr) {
481 char *new_path = BLI_string_replaceN(fcu->rna_path, "speed_factor", substr);
482 MEM_freeN(fcu->rna_path);
483 fcu->rna_path = new_path;
484 }
485 }
486 }
487 }
488 else if (strip->type == STRIP_TYPE_META) {
489 do_versions_sequencer_speed_effect_recursive(scene, &strip->seqbase);
490 }
491 }
492
493#undef STRIP_SPEED_INTEGRATE
494#undef STRIP_SPEED_COMPRESS_IPO_Y
495}
496
497static bool do_versions_sequencer_color_tags(Strip *strip, void * /*user_data*/)
498{
500 return true;
501}
502
503static bool do_versions_sequencer_color_balance_sop(Strip *strip, void * /*user_data*/)
504{
506 if (smd->type == eSeqModifierType_ColorBalance) {
507 StripColorBalance *cb = &((ColorBalanceModifierData *)smd)->color_balance;
509 for (int i = 0; i < 3; i++) {
510 copy_v3_fl(cb->slope, 1.0f);
511 copy_v3_fl(cb->offset, 1.0f);
512 copy_v3_fl(cb->power, 1.0f);
513 }
514 }
515 }
516 return true;
517}
518
525{
526 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
527 if (ELEM(node->type_legacy,
540 {
541 bNodeSocket *geometry_socket = static_cast<bNodeSocket *>(node->inputs.first);
542 add_realize_instances_before_socket(ntree, node, geometry_socket);
543 }
544 /* Also realize instances for the profile input of the curve to mesh node. */
545 if (node->type_legacy == GEO_NODE_CURVE_TO_MESH) {
546 bNodeSocket *profile_socket = (bNodeSocket *)BLI_findlink(&node->inputs, 1);
547 add_realize_instances_before_socket(ntree, node, profile_socket);
548 }
549 }
550}
551
558{
560 bmain, "Realize Instances 2.93 Legacy", "GeometryNodeTree");
561
562 node_tree->tree_interface.add_socket(
563 "Geometry", "", "NodeSocketGeometry", NODE_INTERFACE_SOCKET_OUTPUT, nullptr);
564 node_tree->tree_interface.add_socket(
565 "Geometry", "", "NodeSocketGeometry", NODE_INTERFACE_SOCKET_INPUT, nullptr);
566
567 bNode *group_input = blender::bke::node_add_static_node(nullptr, *node_tree, NODE_GROUP_INPUT);
568 group_input->locx_legacy = -400.0f;
569 bNode *group_output = blender::bke::node_add_static_node(nullptr, *node_tree, NODE_GROUP_OUTPUT);
570 group_output->locx_legacy = 500.0f;
571 group_output->flag |= NODE_DO_OUTPUT;
572
574 join->locx_legacy = group_output->locx_legacy - 175.0f;
575 join->locy_legacy = group_output->locy_legacy;
577 nullptr, *node_tree, GEO_NODE_POINTS_TO_VERTICES);
578 conv->locx_legacy = join->locx_legacy - 175.0f;
579 conv->locy_legacy = join->locy_legacy - 70.0;
581 nullptr, *node_tree, GEO_NODE_SEPARATE_COMPONENTS);
582 separate->locx_legacy = join->locx_legacy - 350.0f;
583 separate->locy_legacy = join->locy_legacy + 50.0f;
585 nullptr, *node_tree, GEO_NODE_REALIZE_INSTANCES);
586 realize->locx_legacy = separate->locx_legacy - 200.0f;
587 realize->locy_legacy = join->locy_legacy;
588
590 *group_input,
591 *static_cast<bNodeSocket *>(group_input->outputs.first),
592 *realize,
593 *static_cast<bNodeSocket *>(realize->inputs.first));
595 *realize,
596 *static_cast<bNodeSocket *>(realize->outputs.first),
597 *separate,
598 *static_cast<bNodeSocket *>(separate->inputs.first));
600 *conv,
601 *static_cast<bNodeSocket *>(conv->outputs.first),
602 *join,
603 *static_cast<bNodeSocket *>(join->inputs.first));
605 *separate,
606 *static_cast<bNodeSocket *>(BLI_findlink(&separate->outputs, 3)),
607 *join,
608 *static_cast<bNodeSocket *>(join->inputs.first));
610 *separate,
611 *static_cast<bNodeSocket *>(BLI_findlink(&separate->outputs, 1)),
612 *conv,
613 *static_cast<bNodeSocket *>(conv->inputs.first));
615 *separate,
616 *static_cast<bNodeSocket *>(BLI_findlink(&separate->outputs, 2)),
617 *join,
618 *static_cast<bNodeSocket *>(join->inputs.first));
620 *separate,
621 *static_cast<bNodeSocket *>(separate->outputs.first),
622 *join,
623 *static_cast<bNodeSocket *>(join->inputs.first));
625 *join,
626 *static_cast<bNodeSocket *>(join->outputs.first),
627 *group_output,
628 *static_cast<bNodeSocket *>(group_output->inputs.first));
629
630 LISTBASE_FOREACH (bNode *, node, &node_tree->nodes) {
632 }
633
635 return node_tree;
636}
637
638static void strip_speed_factor_fix_rna_path(Strip *strip, ListBase *fcurves)
639{
640 char name_esc[(sizeof(strip->name) - 2) * 2];
641 BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc));
642 char *path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].pitch", name_esc);
643 FCurve *fcu = BKE_fcurve_find(fcurves, path, 0);
644 if (fcu != nullptr) {
645 MEM_freeN(fcu->rna_path);
646 fcu->rna_path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].speed_factor", name_esc);
647 }
648 MEM_freeN(path);
649}
650
651static bool version_fix_seq_meta_range(Strip *strip, void *user_data)
652{
653 Scene *scene = (Scene *)user_data;
654 if (strip->type == STRIP_TYPE_META) {
656 }
657 return true;
658}
659
660static bool strip_speed_factor_set(Strip *strip, void *user_data)
661{
662 const Scene *scene = static_cast<const Scene *>(user_data);
663 if (strip->type == STRIP_TYPE_SOUND_RAM) {
664 /* Move `pitch` animation to `speed_factor` */
665 if (scene->adt && scene->adt->action) {
667 }
668 if (scene->adt && !BLI_listbase_is_empty(&scene->adt->drivers)) {
670 }
671
672 /* Pitch value of 0 has been found in some files. This would cause problems. */
673 if (strip->pitch_legacy <= 0.0f) {
674 strip->pitch_legacy = 1.0f;
675 }
676
677 strip->speed_factor = strip->pitch_legacy;
678 }
679 else {
680 strip->speed_factor = 1.0f;
681 }
682 return true;
683}
684
686{
687 using namespace blender;
688 using namespace blender::bke;
689 /* Otherwise `ntree->typeInfo` is null. */
691 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
692 if (node->type_legacy != GEO_NODE_TRANSFER_ATTRIBUTE_DEPRECATED) {
693 continue;
694 }
695 bNodeSocket *old_geometry_socket = blender::bke::node_find_socket(*node, SOCK_IN, "Source");
697 node->storage;
698 switch (storage->mode) {
700 bNode *sample_nearest_surface = blender::bke::node_add_static_node(
701 nullptr, *ntree, GEO_NODE_SAMPLE_NEAREST_SURFACE);
702 sample_nearest_surface->parent = node->parent;
703 sample_nearest_surface->custom1 = storage->data_type;
704 sample_nearest_surface->locx_legacy = node->locx_legacy;
705 sample_nearest_surface->locy_legacy = node->locy_legacy;
706 static auto socket_remap = []() {
708 map.add_new("Attribute", "Value");
709 map.add_new("Attribute_001", "Value");
710 map.add_new("Attribute_002", "Value");
711 map.add_new("Attribute_003", "Value");
712 map.add_new("Attribute_004", "Value");
713 map.add_new("Source", "Mesh");
714 map.add_new("Source Position", "Sample Position");
715 return map;
716 }();
717 node_tree_relink_with_socket_id_map(*ntree, *node, *sample_nearest_surface, socket_remap);
718 break;
719 }
721 /* These domains weren't supported by the index transfer mode, but were selectable. */
722 const AttrDomain domain = ELEM(AttrDomain(storage->domain),
726 AttrDomain(storage->domain);
727
728 /* Use a sample index node to retrieve the data with this node's index output. */
730 nullptr, *ntree, GEO_NODE_SAMPLE_INDEX);
731 NodeGeometrySampleIndex *sample_storage = static_cast<NodeGeometrySampleIndex *>(
732 sample_index->storage);
733 sample_storage->data_type = storage->data_type;
734 sample_storage->domain = int8_t(domain);
735 sample_index->parent = node->parent;
736 sample_index->locx_legacy = node->locx_legacy + 25.0f;
737 sample_index->locy_legacy = node->locy_legacy;
738 if (old_geometry_socket->link) {
740 *ntree,
741 *old_geometry_socket->link->fromnode,
742 *old_geometry_socket->link->fromsock,
743 *sample_index,
744 *blender::bke::node_find_socket(*sample_index, SOCK_IN, "Geometry"));
745 }
746
748 nullptr, *ntree, GEO_NODE_SAMPLE_NEAREST);
749 sample_nearest->parent = node->parent;
750 sample_nearest->custom1 = storage->data_type;
751 sample_nearest->custom2 = int8_t(domain);
752 sample_nearest->locx_legacy = node->locx_legacy - 25.0f;
753 sample_nearest->locy_legacy = node->locy_legacy;
754 if (old_geometry_socket->link) {
756 *ntree,
757 *old_geometry_socket->link->fromnode,
758 *old_geometry_socket->link->fromsock,
759 *sample_nearest,
760 *blender::bke::node_find_socket(*sample_nearest, SOCK_IN, "Geometry"));
761 }
762 static auto sample_nearest_remap = []() {
764 map.add_new("Source Position", "Sample Position");
765 return map;
766 }();
767 node_tree_relink_with_socket_id_map(*ntree, *node, *sample_nearest, sample_nearest_remap);
768
769 static auto sample_index_remap = []() {
771 map.add_new("Attribute", "Value");
772 map.add_new("Attribute_001", "Value");
773 map.add_new("Attribute_002", "Value");
774 map.add_new("Attribute_003", "Value");
775 map.add_new("Attribute_004", "Value");
776 map.add_new("Source Position", "Sample Position");
777 return map;
778 }();
779 node_tree_relink_with_socket_id_map(*ntree, *node, *sample_index, sample_index_remap);
780
782 *ntree,
783 *sample_nearest,
784 *blender::bke::node_find_socket(*sample_nearest, SOCK_OUT, "Index"),
785 *sample_index,
786 *blender::bke::node_find_socket(*sample_index, SOCK_IN, "Index"));
787 break;
788 }
791 nullptr, *ntree, GEO_NODE_SAMPLE_INDEX);
792 NodeGeometrySampleIndex *sample_storage = static_cast<NodeGeometrySampleIndex *>(
793 sample_index->storage);
794 sample_storage->data_type = storage->data_type;
795 sample_storage->domain = storage->domain;
796 sample_storage->clamp = 1;
797 sample_index->parent = node->parent;
798 sample_index->locx_legacy = node->locx_legacy;
799 sample_index->locy_legacy = node->locy_legacy;
800 const bool index_was_linked =
801 blender::bke::node_find_socket(*node, SOCK_IN, "Index")->link != nullptr;
802 static auto socket_remap = []() {
804 map.add_new("Attribute", "Value");
805 map.add_new("Attribute_001", "Value");
806 map.add_new("Attribute_002", "Value");
807 map.add_new("Attribute_003", "Value");
808 map.add_new("Attribute_004", "Value");
809 map.add_new("Source", "Geometry");
810 map.add_new("Index", "Index");
811 return map;
812 }();
813 node_tree_relink_with_socket_id_map(*ntree, *node, *sample_index, socket_remap);
814
815 if (!index_was_linked) {
816 /* Add an index input node, since the new node doesn't use an implicit input. */
818 index->parent = node->parent;
819 index->locx_legacy = node->locx_legacy - 25.0f;
820 index->locy_legacy = node->locy_legacy - 25.0f;
822 *ntree,
823 *index,
824 *blender::bke::node_find_socket(*index, SOCK_OUT, "Index"),
825 *sample_index,
826 *blender::bke::node_find_socket(*sample_index, SOCK_IN, "Index"));
827 }
828 break;
829 }
830 }
831 /* The storage must be freed manually because the node type isn't defined anymore. */
832 MEM_freeN(node->storage);
833 blender::bke::node_remove_node(nullptr, *ntree, *node, false);
834 }
835}
836
843{
844 blender::Vector<bNode *> new_nodes;
845 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree.nodes) {
846 if (!ELEM(node->type_legacy,
853 {
854 continue;
855 }
856 bNodeSocket *primitive_output_socket = nullptr;
857 bNodeSocket *uv_map_output_socket = nullptr;
858 LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
859 if (STREQ(socket->name, "UV Map")) {
860 uv_map_output_socket = socket;
861 }
862 if (socket->type == SOCK_GEOMETRY) {
863 primitive_output_socket = socket;
864 }
865 }
866 if (uv_map_output_socket != nullptr) {
867 continue;
868 }
869 uv_map_output_socket = &version_node_add_socket(
870 ntree, *node, SOCK_OUT, "NodeSocketVector", "UV Map");
871
872 bNode *store_attribute_node = &version_node_add_empty(ntree,
873 "GeometryNodeStoreNamedAttribute");
874 new_nodes.append(store_attribute_node);
875 store_attribute_node->parent = node->parent;
876 store_attribute_node->locx_legacy = node->locx_legacy + 25;
877 store_attribute_node->locy_legacy = node->locy_legacy;
878 auto &storage = *MEM_callocN<NodeGeometryStoreNamedAttribute>(__func__);
879 store_attribute_node->storage = &storage;
880 storage.domain = int8_t(blender::bke::AttrDomain::Corner);
881 /* Intentionally use 3D instead of 2D vectors, because 2D vectors did not exist in older
882 * releases and would make the file crash when trying to open it. */
883 storage.data_type = CD_PROP_FLOAT3;
884
885 bNodeSocket &store_attribute_geometry_input = version_node_add_socket(
886 ntree, *store_attribute_node, SOCK_IN, "NodeSocketGeometry", "Geometry");
887 bNodeSocket &store_attribute_name_input = version_node_add_socket(
888 ntree, *store_attribute_node, SOCK_IN, "NodeSocketString", "Name");
889 bNodeSocket &store_attribute_value_input = version_node_add_socket(
890 ntree, *store_attribute_node, SOCK_IN, "NodeSocketVector", "Value");
891 bNodeSocket &store_attribute_geometry_output = version_node_add_socket(
892 ntree, *store_attribute_node, SOCK_OUT, "NodeSocketGeometry", "Geometry");
893 LISTBASE_FOREACH (bNodeLink *, link, &ntree.links) {
894 if (link->fromsock == primitive_output_socket) {
895 link->fromnode = store_attribute_node;
896 link->fromsock = &store_attribute_geometry_output;
897 }
898 }
899
900 bNodeSocketValueString *name_value = static_cast<bNodeSocketValueString *>(
901 store_attribute_name_input.default_value);
902 const char *uv_map_name = node->type_legacy == GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE ? "UVMap" :
903 "uv_map";
904 STRNCPY_UTF8(name_value->value, uv_map_name);
905
907 *node,
908 *primitive_output_socket,
909 *store_attribute_node,
910 store_attribute_geometry_input);
912 ntree, *node, *uv_map_output_socket, *store_attribute_node, store_attribute_value_input);
913 }
914
915 /* Move nodes to the front so that they are drawn behind existing nodes. */
916 for (bNode *node : new_nodes) {
917 BLI_remlink(&ntree.nodes, node);
918 BLI_addhead(&ntree.nodes, node);
919 }
920 if (!new_nodes.is_empty()) {
922 }
923}
924
931{
932 using namespace blender;
933 Vector<bNode *> new_nodes;
934 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree.nodes) {
935 if (node->idname != StringRef("GeometryNodeExtrudeMesh")) {
936 continue;
937 }
938 if (static_cast<const NodeGeometryExtrudeMesh *>(node->storage)->mode !=
940 {
941 continue;
942 }
943 bNodeSocket *geometry_in_socket = blender::bke::node_find_socket(*node, SOCK_IN, "Mesh");
944 bNodeSocket *geometry_out_socket = blender::bke::node_find_socket(*node, SOCK_OUT, "Mesh");
945
946 Map<bNodeSocket *, bNodeLink *> in_links_per_socket;
948 LISTBASE_FOREACH (bNodeLink *, link, &ntree.links) {
949 in_links_per_socket.add(link->tosock, link);
950 out_links_per_socket.add(link->fromsock, link);
951 }
952
953 bNodeLink *geometry_in_link = in_links_per_socket.lookup_default(geometry_in_socket, nullptr);
954 Span<bNodeLink *> geometry_out_links = out_links_per_socket.lookup(geometry_out_socket);
955 if (!geometry_in_link || geometry_out_links.is_empty()) {
956 continue;
957 }
958
959 const bool versioning_already_done = [&]() {
960 if (geometry_in_link->fromnode->idname != StringRef("GeometryNodeCaptureAttribute")) {
961 return false;
962 }
963 bNode *capture_node = geometry_in_link->fromnode;
964 const NodeGeometryAttributeCapture &capture_storage =
965 *static_cast<const NodeGeometryAttributeCapture *>(capture_node->storage);
966 if (capture_storage.data_type_legacy != CD_PROP_BOOL ||
967 bke::AttrDomain(capture_storage.domain) != bke::AttrDomain::Face)
968 {
969 return false;
970 }
971 bNodeSocket *capture_in_socket = blender::bke::node_find_socket(
972 *capture_node, SOCK_IN, "Value_003");
973 bNodeLink *capture_in_link = in_links_per_socket.lookup_default(capture_in_socket, nullptr);
974 if (!capture_in_link) {
975 return false;
976 }
977 if (capture_in_link->fromnode->idname != StringRef("GeometryNodeInputShadeSmooth")) {
978 return false;
979 }
980 if (geometry_out_links.size() != 1) {
981 return false;
982 }
983 bNodeLink *geometry_out_link = geometry_out_links.first();
984 if (geometry_out_link->tonode->idname != StringRef("GeometryNodeSetShadeSmooth")) {
985 return false;
986 }
987 bNode *set_smooth_node = geometry_out_link->tonode;
989 *set_smooth_node, SOCK_IN, "Shade Smooth");
990 bNodeLink *connecting_link = in_links_per_socket.lookup_default(smooth_in_socket, nullptr);
991 if (!connecting_link) {
992 return false;
993 }
994 if (connecting_link->fromnode != capture_node) {
995 return false;
996 }
997 return true;
998 }();
999 if (versioning_already_done) {
1000 continue;
1001 }
1002
1003 bNode &capture_node = version_node_add_empty(ntree, "GeometryNodeCaptureAttribute");
1004 capture_node.parent = node->parent;
1005 capture_node.locx_legacy = node->locx_legacy - 25;
1006 capture_node.locy_legacy = node->locy_legacy;
1007 new_nodes.append(&capture_node);
1008 auto *capture_node_storage = MEM_callocN<NodeGeometryAttributeCapture>(__func__);
1009 capture_node.storage = capture_node_storage;
1010 capture_node_storage->data_type_legacy = CD_PROP_BOOL;
1011 capture_node_storage->domain = int8_t(bke::AttrDomain::Face);
1012 bNodeSocket &capture_node_geo_in = version_node_add_socket(
1013 ntree, capture_node, SOCK_IN, "NodeSocketGeometry", "Geometry");
1014 bNodeSocket &capture_node_geo_out = version_node_add_socket(
1015 ntree, capture_node, SOCK_OUT, "NodeSocketGeometry", "Geometry");
1016 bNodeSocket &capture_node_value_in = version_node_add_socket(
1017 ntree, capture_node, SOCK_IN, "NodeSocketBool", "Value_003");
1018 bNodeSocket &capture_node_attribute_out = version_node_add_socket(
1019 ntree, capture_node, SOCK_OUT, "NodeSocketBool", "Attribute_003");
1020
1021 bNode &is_smooth_node = version_node_add_empty(ntree, "GeometryNodeInputShadeSmooth");
1022 is_smooth_node.parent = node->parent;
1023 is_smooth_node.locx_legacy = capture_node.locx_legacy - 25;
1024 is_smooth_node.locy_legacy = capture_node.locy_legacy;
1025 bNodeSocket &is_smooth_out = version_node_add_socket(
1026 ntree, is_smooth_node, SOCK_OUT, "NodeSocketBool", "Smooth");
1027 new_nodes.append(&is_smooth_node);
1029 ntree, is_smooth_node, is_smooth_out, capture_node, capture_node_value_in);
1030 version_node_add_link(ntree, capture_node, capture_node_geo_out, *node, *geometry_in_socket);
1031 geometry_in_link->tonode = &capture_node;
1032 geometry_in_link->tosock = &capture_node_geo_in;
1033
1034 bNode &set_smooth_node = version_node_add_empty(ntree, "GeometryNodeSetShadeSmooth");
1035 set_smooth_node.custom1 = int16_t(blender::bke::AttrDomain::Face);
1036 set_smooth_node.parent = node->parent;
1037 set_smooth_node.locx_legacy = node->locx_legacy + 25;
1038 set_smooth_node.locy_legacy = node->locy_legacy;
1039 new_nodes.append(&set_smooth_node);
1040 bNodeSocket &set_smooth_node_geo_in = version_node_add_socket(
1041 ntree, set_smooth_node, SOCK_IN, "NodeSocketGeometry", "Geometry");
1042 bNodeSocket &set_smooth_node_geo_out = version_node_add_socket(
1043 ntree, set_smooth_node, SOCK_OUT, "NodeSocketGeometry", "Geometry");
1044 bNodeSocket &set_smooth_node_smooth_in = version_node_add_socket(
1045 ntree, set_smooth_node, SOCK_IN, "NodeSocketBool", "Shade Smooth");
1046
1048 ntree, *node, *geometry_out_socket, set_smooth_node, set_smooth_node_geo_in);
1049
1050 for (bNodeLink *link : geometry_out_links) {
1051 link->fromnode = &set_smooth_node;
1052 link->fromsock = &set_smooth_node_geo_out;
1053 }
1055 capture_node,
1056 capture_node_attribute_out,
1057 set_smooth_node,
1058 set_smooth_node_smooth_in);
1059 }
1060
1061 /* Move nodes to the front so that they are drawn behind existing nodes. */
1062 for (bNode *node : new_nodes) {
1063 BLI_remlink(&ntree.nodes, node);
1064 BLI_addhead(&ntree.nodes, node);
1065 }
1066 if (!new_nodes.is_empty()) {
1068 }
1069}
1070
1071/* Change the action strip (if a NLA strip is preset) to HOLD instead of HOLD FORWARD to maintain
1072 * backwards compatibility. */
1074{
1075 ID *id;
1076 FOREACH_MAIN_ID_BEGIN (bmain, id) {
1077 AnimData *adt = BKE_animdata_from_id(id);
1078 /* We only want to preserve existing behavior if there's an action and 1 or more NLA strips. */
1079 if (adt == nullptr || adt->action == nullptr ||
1081 {
1082 continue;
1083 }
1084
1087 }
1088 }
1090}
1091
1093{
1094 if (MAIN_VERSION_FILE_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_FILE_ATLEAST(bmain, 300, 1)) {
1095 /* Set zero user text objects to have a fake user. */
1096 LISTBASE_FOREACH (Text *, text, &bmain->texts) {
1097 if (text->id.us == 0) {
1098 id_fake_user_set(&text->id);
1099 }
1100 }
1101 }
1102
1103 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 3)) {
1104 sort_linked_ids(bmain);
1105 assert_sorted_ids(bmain);
1106 }
1107
1108 if (MAIN_VERSION_FILE_ATLEAST(bmain, 300, 3)) {
1109 assert_sorted_ids(bmain);
1110 }
1111
1112 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 11)) {
1114 }
1115
1116 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 13)) {
1117 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1118 if (scene->ed != nullptr) {
1119 do_versions_sequencer_speed_effect_recursive(scene, &scene->ed->seqbase);
1120 }
1121 }
1122 }
1123
1124 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 25)) {
1126 }
1127
1128 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 26)) {
1129 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1130 ToolSettings *tool_settings = scene->toolsettings;
1131 ImagePaintSettings *imapaint = &tool_settings->imapaint;
1132 if (imapaint->canvas != nullptr &&
1134 {
1135 imapaint->canvas = nullptr;
1136 }
1137 if (imapaint->stencil != nullptr &&
1139 {
1140 imapaint->stencil = nullptr;
1141 }
1142 if (imapaint->clone != nullptr &&
1144 {
1145 imapaint->clone = nullptr;
1146 }
1147 }
1148 }
1149
1150 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 28)) {
1151 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1152 if (ntree->type == NTREE_GEOMETRY) {
1154 }
1155 }
1156 }
1157
1158 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 30)) {
1160 }
1161
1162 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 32)) {
1163 /* Update Switch Node Non-Fields switch input to Switch_001. */
1164 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1165 if (ntree->type != NTREE_GEOMETRY) {
1166 continue;
1167 }
1168
1169 LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
1170 if (link->tonode->type_legacy == GEO_NODE_SWITCH) {
1171 if (STREQ(link->tosock->identifier, "Switch")) {
1172 bNode *to_node = link->tonode;
1173
1174 uint8_t mode = ((NodeSwitch *)to_node->storage)->input_type;
1175 if (ELEM(mode,
1181 {
1182 link->tosock = link->tosock->next;
1183 }
1184 }
1185 }
1186 }
1187 }
1188 }
1189
1190 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 33)) {
1191 /* This was missing from #move_vertex_group_names_to_object_data. */
1192 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1194 /* This uses the fact that the active vertex group index starts counting at 1. */
1195 if (BKE_object_defgroup_active_index_get(object) == 0) {
1197 }
1198 }
1199 }
1200 }
1201
1202 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 35)) {
1203 /* Add a new modifier to realize instances from previous modifiers.
1204 * Previously that was done automatically by geometry nodes. */
1205 bNodeTree *realize_instances_node_tree = nullptr;
1206 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
1207 LISTBASE_FOREACH_MUTABLE (ModifierData *, md, &ob->modifiers) {
1208 if (md->type != eModifierType_Nodes) {
1209 continue;
1210 }
1211 if (md->next == nullptr) {
1212 break;
1213 }
1214 if (md->next->type == eModifierType_Nodes) {
1215 continue;
1216 }
1218 if (nmd->node_group == nullptr) {
1219 continue;
1220 }
1221
1223 STRNCPY_UTF8(new_nmd->modifier.name, "Realize Instances 2.93 Legacy");
1224 BKE_modifier_unique_name(&ob->modifiers, &new_nmd->modifier);
1225 BLI_insertlinkafter(&ob->modifiers, md, new_nmd);
1226 if (realize_instances_node_tree == nullptr) {
1227 realize_instances_node_tree = add_realize_node_tree(bmain);
1228 }
1229 new_nmd->node_group = realize_instances_node_tree;
1230 }
1231 }
1232 }
1233
1234 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 37)) {
1235 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1236 if (ntree->type == NTREE_GEOMETRY) {
1237 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
1238 if (node->type_legacy == GEO_NODE_BOUNDING_BOX) {
1239 bNodeSocket *geometry_socket = static_cast<bNodeSocket *>(node->inputs.first);
1240 add_realize_instances_before_socket(ntree, node, geometry_socket);
1241 }
1242 }
1243 }
1244 }
1245 }
1246
1247 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 301, 6)) {
1248 { /* Ensure driver variable names are unique within the driver. */
1249 ID *id;
1250 FOREACH_MAIN_ID_BEGIN (bmain, id) {
1251 AnimData *adt = BKE_animdata_from_id(id);
1252 if (adt == nullptr) {
1253 continue;
1254 }
1255 LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
1256 ChannelDriver *driver = fcu->driver;
1257 /* Ensure the uniqueness front to back. Given a list of identically
1258 * named variables, the last one gets to keep its original name. This
1259 * matches the evaluation order, and thus shouldn't change the evaluated
1260 * value of the driver expression. */
1261 LISTBASE_FOREACH (DriverVar *, dvar, &driver->variables) {
1262 BLI_uniquename(&driver->variables,
1263 dvar,
1264 dvar->name,
1265 '_',
1267 sizeof(dvar->name));
1268 }
1269 }
1270 }
1272 }
1273
1274 /* Ensure tiled image sources contain a UDIM token. */
1275 LISTBASE_FOREACH (Image *, ima, &bmain->images) {
1276 if (ima->source == IMA_SRC_TILED) {
1277 BKE_image_ensure_tile_token(ima->filepath, sizeof(ima->filepath));
1278 }
1279 }
1280 }
1281
1282 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 14)) {
1283 /* Sequencer channels region. */
1284 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1285 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1286 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1287 if (sl->spacetype != SPACE_SEQ) {
1288 continue;
1289 }
1290 SpaceSeq *sseq = (SpaceSeq *)sl;
1291 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
1292 &sl->regionbase;
1293 sseq->flag |= SEQ_CLAMP_VIEW;
1294
1296 continue;
1297 }
1298
1299 ARegion *timeline_region = BKE_region_find_in_listbase_by_type(regionbase,
1301
1302 if (timeline_region == nullptr) {
1303 continue;
1304 }
1305
1306 timeline_region->v2d.cur.ymax = 8.5f;
1307 timeline_region->v2d.align &= ~V2D_ALIGN_NO_NEG_Y;
1308 }
1309 }
1310 }
1311 }
1312
1313 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 5)) {
1314 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1316 if (ed == nullptr) {
1317 continue;
1318 }
1321 }
1322 }
1323
1324 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 6)) {
1325 /* In the Dope Sheet, for every mode other than Timeline, open the Properties panel. */
1326 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1327 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1328 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1329 if (sl->spacetype != SPACE_ACTION) {
1330 continue;
1331 }
1332
1333 /* Skip the timeline, it shouldn't get its Properties panel opened. */
1334 SpaceAction *saction = (SpaceAction *)sl;
1335 if (saction->mode == SACTCONT_TIMELINE) {
1336 continue;
1337 }
1338
1339 const bool is_first_space = sl == area->spacedata.first;
1340 ListBase *regionbase = is_first_space ? &area->regionbase : &sl->regionbase;
1342 if (region == nullptr) {
1343 continue;
1344 }
1345
1346 region->flag &= ~RGN_FLAG_HIDDEN;
1347 }
1348 }
1349 }
1350 }
1351
1352 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 1)) {
1353 /* Split the transfer attribute node into multiple smaller nodes. */
1354 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1355 if (ntree->type == NTREE_GEOMETRY) {
1357 }
1358 }
1360 }
1361
1362 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 13)) {
1364 }
1365
1372}
1373
1375{
1376 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1377 if (ntree->type == NTREE_GEOMETRY) {
1378 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1379 if (node->type_legacy == GEO_NODE_SWITCH) {
1380 LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
1381 /* Skip the "switch" socket. */
1382 if (socket == node->inputs.first) {
1383 continue;
1384 }
1385 STRNCPY_UTF8(socket->name, socket->name[0] == 'A' ? "False" : "True");
1386
1387 /* Replace "A" and "B", but keep the unique number suffix at the end. */
1388 char number_suffix[8];
1389 STRNCPY_UTF8(number_suffix, socket->identifier + 1);
1391 socket->identifier, sizeof(socket->identifier), socket->name, number_suffix);
1392 }
1393 }
1394 }
1395 }
1396 }
1398}
1399
1400static bool replace_bbone_len_scale_rnapath(char **p_old_path, int *p_index)
1401{
1402 char *old_path = *p_old_path;
1403
1404 if (old_path == nullptr) {
1405 return false;
1406 }
1407
1408 int len = strlen(old_path);
1409
1410 if (BLI_str_endswith(old_path, ".bbone_curveiny") ||
1411 BLI_str_endswith(old_path, ".bbone_curveouty"))
1412 {
1413 old_path[len - 1] = 'z';
1414 return true;
1415 }
1416
1417 if (BLI_str_endswith(old_path, ".bbone_scaleinx") ||
1418 BLI_str_endswith(old_path, ".bbone_scaleiny") ||
1419 BLI_str_endswith(old_path, ".bbone_scaleoutx") ||
1420 BLI_str_endswith(old_path, ".bbone_scaleouty"))
1421 {
1422 int index = (old_path[len - 1] == 'y' ? 2 : 0);
1423
1424 old_path[len - 1] = 0;
1425
1426 if (p_index) {
1427 *p_index = index;
1428 }
1429 else {
1430 *p_old_path = BLI_sprintfN("%s[%d]", old_path, index);
1431 MEM_freeN(old_path);
1432 }
1433
1434 return true;
1435 }
1436
1437 return false;
1438}
1439
1441{
1442 /* Update driver variable paths. */
1443 if (fcu->driver) {
1444 LISTBASE_FOREACH (DriverVar *, dvar, &fcu->driver->variables) {
1446 replace_bbone_len_scale_rnapath(&dtar->rna_path, nullptr);
1447 }
1449 }
1450 }
1451
1452 /* Update F-Curve's path. */
1454}
1455
1457{
1458 LISTBASE_FOREACH (Bone *, bone, lb) {
1459 if (bone->flag & BONE_ADD_PARENT_END_ROLL) {
1460 bone->bbone_flag |= BBONE_ADD_PARENT_END_ROLL;
1461 }
1462
1463 copy_v3_fl3(bone->scale_in, bone->scale_in_x, 1.0f, bone->scale_in_z);
1464 copy_v3_fl3(bone->scale_out, bone->scale_out_x, 1.0f, bone->scale_out_z);
1465
1466 do_version_bones_bbone_len_scale(&bone->childbase);
1467 }
1468}
1469
1471{
1472 /* Binding array data could be freed without properly resetting its size data. */
1473 LISTBASE_FOREACH (bConstraint *, con, lb) {
1474 if (con->type == CONSTRAINT_TYPE_SPLINEIK) {
1476 if (data->points == nullptr) {
1477 data->numpoints = 0;
1478 }
1479 }
1480 }
1481}
1482
1484 bNode *node,
1485 bNodeSocket *socket)
1486{
1487 const bNodeSocketValueFloat *socket_value = (const bNodeSocketValueFloat *)socket->default_value;
1488 const float old_value = socket_value->value;
1489 blender::bke::node_remove_socket(*ntree, *node, *socket);
1491 *ntree,
1492 *node,
1493 SOCK_IN,
1495 "Size",
1496 "Size");
1497 bNodeSocketValueVector *value_vector = (bNodeSocketValueVector *)new_socket->default_value;
1498 copy_v3_fl(value_vector->value, old_value);
1499 return new_socket;
1500}
1501
1502static bool strip_transform_origin_set(Strip *strip, void * /*user_data*/)
1503{
1505 if (strip->data->transform != nullptr) {
1506 transform->origin[0] = transform->origin[1] = 0.5f;
1507 }
1508 return true;
1509}
1510
1511static bool strip_transform_filter_set(Strip *strip, void * /*user_data*/)
1512{
1514 if (strip->data->transform != nullptr) {
1516 }
1517 return true;
1518}
1519
1520static bool strip_meta_channels_ensure(Strip *strip, void * /*user_data*/)
1521{
1522 if (strip->type == STRIP_TYPE_META) {
1524 }
1525 return true;
1526}
1527
1541
1543{
1544 using namespace blender;
1545 if (nmd->settings.properties == nullptr) {
1546 return;
1547 }
1548 /* Before versioning the properties, make sure it hasn't been done already. */
1549 LISTBASE_FOREACH (const IDProperty *, property, &nmd->settings.properties->data.group) {
1550 if (strstr(property->name, "_use_attribute") || strstr(property->name, "_attribute_name")) {
1551 return;
1552 }
1553 }
1554
1556 if (!ELEM(property->type, IDP_FLOAT, IDP_INT, IDP_ARRAY)) {
1557 continue;
1558 }
1559
1560 if (strstr(property->name, "_use_attribute") || strstr(property->name, "_attribute_name")) {
1561 continue;
1562 }
1563
1564 char use_attribute_prop_name[MAX_IDPROP_NAME];
1565 SNPRINTF(use_attribute_prop_name, "%s%s", property->name, "_use_attribute");
1566
1567 IDProperty *use_attribute_prop = bke::idprop::create(use_attribute_prop_name, 0).release();
1568 IDP_AddToGroup(nmd->settings.properties, use_attribute_prop);
1569
1570 char attribute_name_prop_name[MAX_IDPROP_NAME];
1571 SNPRINTF(attribute_name_prop_name, "%s%s", property->name, "_attribute_name");
1572
1573 IDProperty *attribute_prop = bke::idprop::create(attribute_name_prop_name, "").release();
1574 IDP_AddToGroup(nmd->settings.properties, attribute_prop);
1575 }
1576}
1577
1578/* Copy of the function before the fixes. */
1579static void legacy_vec_roll_to_mat3_normalized(const float nor[3],
1580 const float roll,
1581 float r_mat[3][3])
1582{
1583 const float SAFE_THRESHOLD = 1.0e-5f; /* theta above this value has good enough precision. */
1584 const float CRITICAL_THRESHOLD = 1.0e-9f; /* above this is safe under certain conditions. */
1585 const float THRESHOLD_SQUARED = CRITICAL_THRESHOLD * CRITICAL_THRESHOLD;
1586
1587 const float x = nor[0];
1588 const float y = nor[1];
1589 const float z = nor[2];
1590
1591 const float theta = 1.0f + y; /* remapping Y from [-1,+1] to [0,2]. */
1592 const float theta_alt = x * x + z * z; /* Helper value for matrix calculations. */
1593 float rMatrix[3][3], bMatrix[3][3];
1594
1596
1597 /* When theta is close to zero (nor is aligned close to negative Y Axis),
1598 * we have to check we do have non-null X/Z components as well.
1599 * Also, due to float precision errors, nor can be (0.0, -0.99999994, 0.0) which results
1600 * in theta being close to zero. This will cause problems when theta is used as divisor.
1601 */
1602 if (theta > SAFE_THRESHOLD || (theta > CRITICAL_THRESHOLD && theta_alt > THRESHOLD_SQUARED)) {
1603 /* nor is *not* aligned to negative Y-axis (0,-1,0). */
1604
1605 bMatrix[0][1] = -x;
1606 bMatrix[1][0] = x;
1607 bMatrix[1][1] = y;
1608 bMatrix[1][2] = z;
1609 bMatrix[2][1] = -z;
1610
1611 if (theta > SAFE_THRESHOLD) {
1612 /* nor differs significantly from negative Y axis (0,-1,0): apply the general case. */
1613 bMatrix[0][0] = 1 - x * x / theta;
1614 bMatrix[2][2] = 1 - z * z / theta;
1615 bMatrix[2][0] = bMatrix[0][2] = -x * z / theta;
1616 }
1617 else {
1618 /* nor is close to negative Y axis (0,-1,0): apply the special case. */
1619 bMatrix[0][0] = (x + z) * (x - z) / -theta_alt;
1620 bMatrix[2][2] = -bMatrix[0][0];
1621 bMatrix[2][0] = bMatrix[0][2] = 2.0f * x * z / theta_alt;
1622 }
1623 }
1624 else {
1625 /* nor is very close to negative Y axis (0,-1,0): use simple symmetry by Z axis. */
1626 unit_m3(bMatrix);
1627 bMatrix[0][0] = bMatrix[1][1] = -1.0;
1628 }
1629
1630 /* Make Roll matrix */
1631 axis_angle_normalized_to_mat3(rMatrix, nor, roll);
1632
1633 /* Combine and output result */
1634 mul_m3_m3m3(r_mat, rMatrix, bMatrix);
1635}
1636
1637static void correct_bone_roll_value(const float head[3],
1638 const float tail[3],
1639 const float check_x_axis[3],
1640 const float check_y_axis[3],
1641 float *r_roll)
1642{
1643 const float SAFE_THRESHOLD = 1.0e-5f;
1644 float vec[3], bone_mat[3][3], vec2[3];
1645
1646 /* Compute the Y axis vector. */
1647 sub_v3_v3v3(vec, tail, head);
1648 normalize_v3(vec);
1649
1650 /* Only correct when in the danger zone. */
1651 if (1.0f + vec[1] < SAFE_THRESHOLD * 2 && (vec[0] || vec[2])) {
1652 /* Use the armature matrix to double-check if adjustment is needed.
1653 * This should minimize issues if the file is bounced back and forth between
1654 * 2.92 and 2.91, provided Edit Mode isn't entered on the armature in 2.91. */
1655 vec_roll_to_mat3(vec, *r_roll, bone_mat);
1656
1657 UNUSED_VARS_NDEBUG(check_y_axis);
1658 BLI_assert(dot_v3v3(bone_mat[1], check_y_axis) > 0.999f);
1659
1660 if (dot_v3v3(bone_mat[0], check_x_axis) < 0.999f) {
1661 /* Recompute roll using legacy code to interpret the old value. */
1662 legacy_vec_roll_to_mat3_normalized(vec, *r_roll, bone_mat);
1663 mat3_to_vec_roll(bone_mat, vec2, r_roll);
1664 BLI_assert(compare_v3v3(vec, vec2, 0.001f));
1665 }
1666 }
1667}
1668
1669/* Update the armature Bone roll fields for bones very close to -Y direction. */
1671{
1672 LISTBASE_FOREACH (Bone *, bone, lb) {
1673 /* Parent-relative orientation (used for posing). */
1675 bone->head, bone->tail, bone->bone_mat[0], bone->bone_mat[1], &bone->roll);
1676
1677 /* Absolute orientation (used for Edit mode). */
1679 bone->arm_head, bone->arm_tail, bone->arm_mat[0], bone->arm_mat[1], &bone->arm_roll);
1680
1681 do_version_bones_roll(&bone->childbase);
1682 }
1683}
1684
1686{
1687 /* Add the new Offset socket. */
1688 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1689 if (node->type_legacy != GEO_NODE_SET_POSITION) {
1690 continue;
1691 }
1692 if (BLI_listbase_count(&node->inputs) < 4) {
1693 /* The offset socket didn't exist in the file yet. */
1694 return;
1695 }
1696 bNodeSocket *old_offset_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 3));
1697 if (old_offset_socket->type == SOCK_VECTOR) {
1698 /* Versioning happened already. */
1699 return;
1700 }
1701 /* Change identifier of old socket, so that there is no name collision. */
1702 STRNCPY_UTF8(old_offset_socket->identifier, "Offset_old");
1704 *ntree, *node, SOCK_IN, SOCK_VECTOR, PROP_TRANSLATION, "Offset", "Offset");
1705 }
1706
1707 /* Relink links that were connected to Position while Offset was enabled. */
1708 LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
1709 if (link->tonode->type_legacy != GEO_NODE_SET_POSITION) {
1710 continue;
1711 }
1712 if (!STREQ(link->tosock->identifier, "Position")) {
1713 continue;
1714 }
1715 bNodeSocket *old_offset_socket = static_cast<bNodeSocket *>(
1716 BLI_findlink(&link->tonode->inputs, 3));
1717 /* This assumes that the offset is not linked to something else. That seems to be a reasonable
1718 * assumption, because the node is probably only ever used in one or the other mode. */
1719 const bool offset_enabled =
1720 ((bNodeSocketValueBoolean *)old_offset_socket->default_value)->value;
1721 if (offset_enabled) {
1722 /* Relink to new offset socket. */
1723 link->tosock = old_offset_socket->next;
1724 }
1725 }
1726
1727 /* Remove old Offset socket. */
1728 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1729 if (node->type_legacy != GEO_NODE_SET_POSITION) {
1730 continue;
1731 }
1732 bNodeSocket *old_offset_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 3));
1733 blender::bke::node_remove_socket(*ntree, *node, *old_offset_socket);
1734 }
1735}
1736
1738{
1739 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1740 LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
1742 }
1743 LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
1745 }
1746 }
1747}
1748
1749static bool version_merge_still_offsets(Strip *strip, void * /*user_data*/)
1750{
1751 strip->startofs -= strip->startstill_legacy;
1752 strip->endofs -= strip->endstill_legacy;
1753 strip->startstill_legacy = 0;
1754 strip->endstill_legacy = 0;
1755 return true;
1756}
1757
1758static bool version_set_seq_single_frame_content(Strip *strip, void * /*user_data*/)
1759{
1760 if ((strip->len == 1) &&
1761 (strip->type == STRIP_TYPE_IMAGE ||
1762 (strip->is_effect() && blender::seq::effect_get_num_inputs(strip->type) == 0)))
1763 {
1765 }
1766 return true;
1767}
1768
1769static bool version_seq_fix_broken_sound_strips(Strip *strip, void * /*user_data*/)
1770{
1771 if (strip->type != STRIP_TYPE_SOUND_RAM || strip->speed_factor != 0.0f) {
1772 return true;
1773 }
1774
1775 strip->speed_factor = 1.0f;
1777
1778 /* Broken files do have negative start offset, which should not be present in sound strips. */
1779 if (strip->startofs < 0) {
1780 strip->startofs = 0.0f;
1781 }
1782
1783 return true;
1784}
1785
1786/* Those `version_liboverride_rnacollections_*` functions mimic the old, pre-3.0 code to find
1787 * anchor and source items in the given list of modifiers, constraints etc., using only the
1788 * `subitem_local` data of the override property operation.
1789 *
1790 * Then they convert it into the new, proper `subitem_reference` data for the anchor, and
1791 * `subitem_local` for the source.
1792 *
1793 * NOTE: Here only the stored override ID is available, unlike in the `override_apply` functions.
1794 */
1795
1798{
1800 if (opop->operation != LIBOVERRIDE_OP_INSERT_AFTER) {
1801 continue;
1802 }
1803 bConstraint *constraint_anchor = static_cast<bConstraint *>(
1805 opop->subitem_local_name,
1807 opop->subitem_local_index));
1808 bConstraint *constraint_src = constraint_anchor != nullptr ?
1809 constraint_anchor->next :
1810 static_cast<bConstraint *>(constraints->first);
1811
1812 if (constraint_src == nullptr) {
1813 /* Invalid case, just remove that override property operation. */
1814 CLOG_ERROR(&LOG, "Could not find source constraint in stored override data");
1816 continue;
1817 }
1818
1819 opop->subitem_reference_name = opop->subitem_local_name;
1820 opop->subitem_local_name = BLI_strdup(constraint_src->name);
1821 opop->subitem_reference_index = opop->subitem_local_index;
1822 opop->subitem_local_index++;
1823 }
1824}
1825
1827{
1828 IDOverrideLibrary *liboverride = object->id.override_library;
1830
1832 if (op != nullptr) {
1834 if (opop->operation != LIBOVERRIDE_OP_INSERT_AFTER) {
1835 continue;
1836 }
1837 ModifierData *mod_anchor = static_cast<ModifierData *>(
1839 opop->subitem_local_name,
1841 opop->subitem_local_index));
1842 ModifierData *mod_src = mod_anchor != nullptr ?
1843 mod_anchor->next :
1844 static_cast<ModifierData *>(object->modifiers.first);
1845
1846 if (mod_src == nullptr) {
1847 /* Invalid case, just remove that override property operation. */
1848 CLOG_ERROR(&LOG, "Could not find source modifier in stored override data");
1850 continue;
1851 }
1852
1853 opop->subitem_reference_name = opop->subitem_local_name;
1854 opop->subitem_local_name = BLI_strdup(mod_src->name);
1855 opop->subitem_reference_index = opop->subitem_local_index;
1856 opop->subitem_local_index++;
1857 }
1858 }
1859
1860 op = BKE_lib_override_library_property_find(liboverride, "grease_pencil_modifiers");
1861 if (op != nullptr) {
1863 if (opop->operation != LIBOVERRIDE_OP_INSERT_AFTER) {
1864 continue;
1865 }
1866 GpencilModifierData *gp_mod_anchor = static_cast<GpencilModifierData *>(
1867 BLI_listbase_string_or_index_find(&object->greasepencil_modifiers,
1868 opop->subitem_local_name,
1870 opop->subitem_local_index));
1871 GpencilModifierData *gp_mod_src = gp_mod_anchor != nullptr ?
1872 gp_mod_anchor->next :
1873 static_cast<GpencilModifierData *>(
1874 object->greasepencil_modifiers.first);
1875
1876 if (gp_mod_src == nullptr) {
1877 /* Invalid case, just remove that override property operation. */
1878 CLOG_ERROR(&LOG, "Could not find source GP modifier in stored override data");
1880 continue;
1881 }
1882
1883 opop->subitem_reference_name = opop->subitem_local_name;
1884 opop->subitem_local_name = BLI_strdup(gp_mod_src->name);
1885 opop->subitem_reference_index = opop->subitem_local_index;
1886 opop->subitem_local_index++;
1887 }
1888 }
1889
1891 if (op != nullptr) {
1893 }
1894
1895 if (object->pose != nullptr) {
1896 LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
1897 char rna_path[26 + (sizeof(pchan->name) * 2) + 1];
1898 char name_esc[sizeof(pchan->name) * 2];
1899 BLI_str_escape(name_esc, pchan->name, sizeof(name_esc));
1900 SNPRINTF_UTF8(rna_path, "pose.bones[\"%s\"].constraints", name_esc);
1902 if (op != nullptr) {
1904 }
1905 }
1906 }
1907}
1908
1910{
1911 AnimData *anim_data = BKE_animdata_from_id(id);
1912 if (anim_data == nullptr) {
1913 return;
1914 }
1915
1916 IDOverrideLibrary *liboverride = id->override_library;
1918
1919 op = BKE_lib_override_library_property_find(liboverride, "animation_data.nla_tracks");
1920 if (op != nullptr) {
1922 if (opop->operation != LIBOVERRIDE_OP_INSERT_AFTER) {
1923 continue;
1924 }
1925 /* NLA tracks are only referenced by index, which limits possibilities, basically they are
1926 * always added at the end of the list, see #rna_NLA_tracks_override_apply.
1927 *
1928 * This makes things simple here. */
1929 opop->subitem_reference_name = opop->subitem_local_name;
1930 opop->subitem_local_name = nullptr;
1931 opop->subitem_reference_index = opop->subitem_local_index;
1932 opop->subitem_local_index++;
1933 }
1934 }
1935}
1936
1938{
1939 version_node_input_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Fac", "Factor_Float");
1940 version_node_input_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Color1", "A_Color");
1941 version_node_input_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Color2", "B_Color");
1942 version_node_output_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Color", "Result_Color");
1943 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1944 if (node->type_legacy == SH_NODE_MIX_RGB_LEGACY) {
1945 STRNCPY_UTF8(node->idname, "ShaderNodeMix");
1946 node->type_legacy = SH_NODE_MIX;
1948 data->blend_type = node->custom1;
1949 data->clamp_result = (node->custom2 & SHD_MIXRGB_CLAMP) ? 1 : 0;
1950 data->clamp_factor = 1;
1951 data->data_type = SOCK_RGBA;
1952 data->factor_mode = NODE_MIX_MODE_UNIFORM;
1953 node->storage = data;
1954 }
1955 }
1956}
1957
1959{
1960 /* Fix bug where curves in image format were not properly copied to file output
1961 * node, incorrectly sharing a pointer with the scene settings. Copy the data
1962 * structure now as it should have been done in the first place. */
1963 if (format->view_settings.curve_mapping) {
1964 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1965 if (format != &scene->r.im_format && ELEM(format->view_settings.curve_mapping,
1966 scene->view_settings.curve_mapping,
1967 scene->r.im_format.view_settings.curve_mapping))
1968 {
1969 format->view_settings.curve_mapping = BKE_curvemapping_copy(
1970 format->view_settings.curve_mapping);
1971 break;
1972 }
1973 }
1974
1975 /* Remove any invalid curves with missing data. */
1976 if (format->view_settings.curve_mapping->cm[0].curve == nullptr) {
1977 BKE_curvemapping_free(format->view_settings.curve_mapping);
1978 format->view_settings.curve_mapping = nullptr;
1979 format->view_settings.flag &= ~COLORMANAGE_VIEW_USE_CURVES;
1980 }
1981 }
1982}
1983
1989{
1990 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
1991
1992 switch (sl->spacetype) {
1993 case SPACE_FILE: {
1995 regionbase, RGN_TYPE_UI, "versioning: UI region for file", RGN_TYPE_TOOLS))
1996 {
1997 ui_region->alignment = RGN_ALIGN_TOP;
1998 ui_region->flag |= RGN_FLAG_DYNAMIC_SIZE;
1999 }
2000
2002 regionbase, RGN_TYPE_EXECUTE, "versioning: execute region for file", RGN_TYPE_UI))
2003 {
2004 exec_region->alignment = RGN_ALIGN_BOTTOM;
2005 exec_region->flag = RGN_FLAG_DYNAMIC_SIZE;
2006 }
2007
2008 if (ARegion *tool_props_region = do_versions_add_region_if_not_found(
2009 regionbase,
2011 "versioning: tool props region for file",
2013 {
2014 tool_props_region->alignment = RGN_ALIGN_RIGHT;
2015 tool_props_region->flag = RGN_FLAG_HIDDEN;
2016 }
2017 break;
2018 }
2019 case SPACE_CLIP: {
2020 ARegion *region;
2021
2023 regionbase, RGN_TYPE_UI, "versioning: properties region for clip", RGN_TYPE_HEADER);
2024 region->alignment = RGN_ALIGN_RIGHT;
2025 region->flag &= ~RGN_FLAG_HIDDEN;
2026
2028 regionbase, RGN_TYPE_CHANNELS, "versioning: channels region for clip", RGN_TYPE_UI);
2029 region->alignment = RGN_ALIGN_LEFT;
2030 region->flag &= ~RGN_FLAG_HIDDEN;
2031 region->v2d.scroll = V2D_SCROLL_BOTTOM;
2033
2035 regionbase, RGN_TYPE_PREVIEW, "versioning: preview region for clip", RGN_TYPE_WINDOW);
2036 region->flag &= ~RGN_FLAG_HIDDEN;
2037
2038 break;
2039 }
2040 case SPACE_SEQ: {
2041 ARegion *region;
2042
2043 do_versions_ensure_region(regionbase,
2045 "versioning: channels region for sequencer",
2047
2048 region = do_versions_ensure_region(regionbase,
2050 "versioning: preview region for sequencer",
2053
2054 break;
2055 }
2056 }
2057}
2058
2064 const char *parent_rna_path,
2065 NlaStrip *strip)
2066{
2067 if (!strip) {
2068 return;
2069 }
2070
2071 /* Escape the strip name for inclusion in the RNA path. */
2072 char name_esc_strip[sizeof(strip->name) * 2];
2073 BLI_str_escape(name_esc_strip, strip->name, sizeof(name_esc_strip));
2074
2075 const std::string rna_path_strip = std::string(parent_rna_path) + ".strips[\"" + name_esc_strip +
2076 "\"]";
2077
2078 { /* Rename .frame_start -> .frame_start_raw: */
2079 const std::string rna_path_prop = rna_path_strip + ".frame_start";
2081 liboverride, rna_path_prop.c_str(), (rna_path_prop + "_raw").c_str());
2082 }
2083
2084 { /* Rename .frame_end -> .frame_end_raw: */
2085 const std::string rna_path_prop = rna_path_strip + ".frame_end";
2087 liboverride, rna_path_prop.c_str(), (rna_path_prop + "_raw").c_str());
2088 }
2089
2090 { /* Remove .frame_start_ui: */
2091 const std::string rna_path_prop = rna_path_strip + ".frame_start_ui";
2093 }
2094
2095 { /* Remove .frame_end_ui: */
2096 const std::string rna_path_prop = rna_path_strip + ".frame_end_ui";
2098 }
2099
2100 /* Handle meta-strip contents. */
2101 LISTBASE_FOREACH (NlaStrip *, substrip, &strip->strips) {
2102 version_liboverride_nla_strip_frame_start_end(liboverride, rna_path_strip.c_str(), substrip);
2103 }
2104}
2105
2108{
2109 IDOverrideLibrary *liboverride = id->override_library;
2110 if (!liboverride) {
2111 return;
2112 }
2113
2114 int track_index;
2115 LISTBASE_FOREACH_INDEX (NlaTrack *, track, &adt->nla_tracks, track_index) {
2116 char *rna_path_track = BLI_sprintfN("animation_data.nla_tracks[%d]", track_index);
2117
2118 LISTBASE_FOREACH (NlaStrip *, strip, &track->strips) {
2120 }
2121
2122 MEM_freeN(rna_path_track);
2123 }
2124}
2125
2126/* NOLINTNEXTLINE: readability-function-size */
2127void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
2128{
2129 /* The #SCE_SNAP_SEQ flag has been removed in favor of the #SCE_SNAP which can be used for each
2130 * snap_flag member individually. */
2131 enum { SCE_SNAP_SEQ = (1 << 7) };
2132
2133 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 1)) {
2134 /* Set default value for the new bisect_threshold parameter in the mirror modifier. */
2135 if (!DNA_struct_member_exists(fd->filesdna, "MirrorModifierData", "float", "bisect_threshold"))
2136 {
2137 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2138 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
2139 if (md->type == eModifierType_Mirror) {
2141 /* This was the previous hard-coded value. */
2142 mmd->bisect_threshold = 0.001f;
2143 }
2144 }
2145 }
2146 }
2147 /* Grease Pencil: Set default value for dilate pixels. */
2148 if (!DNA_struct_member_exists(fd->filesdna, "BrushGpencilSettings", "int", "dilate_pixels")) {
2149 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
2150 if (brush->gpencil_settings) {
2151 brush->gpencil_settings->dilate_pixels = 1;
2152 }
2153 }
2154 }
2155 }
2156
2157 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 2)) {
2159
2160 if (!DNA_struct_member_exists(fd->filesdna, "bPoseChannel", "float", "custom_scale_xyz[3]")) {
2161 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2162 if (ob->pose == nullptr) {
2163 continue;
2164 }
2165 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
2166 copy_v3_fl(pchan->custom_scale_xyz, pchan->custom_scale);
2167 }
2168 }
2169 }
2170 }
2171
2172 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 4)) {
2173 /* Add a properties sidebar to the spreadsheet editor. */
2174 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2175 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2176 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2177 if (sl->spacetype == SPACE_SPREADSHEET) {
2178 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
2179 &sl->regionbase;
2181 regionbase, RGN_TYPE_UI, "sidebar for spreadsheet", RGN_TYPE_FOOTER);
2182 if (new_sidebar != nullptr) {
2183 new_sidebar->alignment = RGN_ALIGN_RIGHT;
2184 new_sidebar->flag |= RGN_FLAG_HIDDEN;
2185 }
2186 }
2187 }
2188 }
2189 }
2190
2191 /* Enable spreadsheet filtering in old files without row filters. */
2192 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2193 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2194 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2195 if (sl->spacetype == SPACE_SPREADSHEET) {
2196 SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl;
2197 sspreadsheet->filter_flag |= SPREADSHEET_FILTER_ENABLE;
2198 }
2199 }
2200 }
2201 }
2202
2203 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2204 if (ntree->type == NTREE_GEOMETRY) {
2205 version_node_socket_name(ntree, GEO_NODE_BOUNDING_BOX, "Mesh", "Bounding Box");
2206 }
2207 }
2209
2210 if (!DNA_struct_member_exists(fd->filesdna, "FileAssetSelectParams", "short", "import_method"))
2211 {
2212 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2213 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2214 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2215 if (sl->spacetype == SPACE_FILE) {
2216 SpaceFile *sfile = (SpaceFile *)sl;
2217 if (sfile->asset_params) {
2219 }
2220 }
2221 }
2222 }
2223 }
2224 }
2225
2226 /* Initialize length-wise scale B-Bone settings. */
2227 if (!DNA_struct_member_exists(fd->filesdna, "Bone", "int", "bbone_flag")) {
2228 /* Update armature data and pose channels. */
2229 LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
2230 do_version_bones_bbone_len_scale(&arm->bonebase);
2231 }
2232
2233 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2234 if (ob->pose) {
2235 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
2236 copy_v3_fl3(pchan->scale_in, pchan->scale_in_x, 1.0f, pchan->scale_in_z);
2237 copy_v3_fl3(pchan->scale_out, pchan->scale_out_x, 1.0f, pchan->scale_out_z);
2238 }
2239 }
2240 }
2241
2242 /* Update action curves and drivers. */
2243 LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
2244 LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, &act->curves) {
2246 }
2247 }
2248
2249 BKE_animdata_main_cb(bmain, [](ID * /*id*/, AnimData *adt) {
2250 LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, &adt->drivers) {
2252 }
2253 });
2254 }
2255 }
2256
2257 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 5)) {
2258 /* Add a dataset sidebar to the spreadsheet editor. */
2259 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2260 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2261 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2262 if (sl->spacetype == SPACE_SPREADSHEET) {
2263 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
2264 &sl->regionbase;
2265 ARegion *spreadsheet_dataset_region = do_versions_add_region_if_not_found(
2266 regionbase, RGN_TYPE_CHANNELS, "spreadsheet dataset region", RGN_TYPE_FOOTER);
2267
2268 if (spreadsheet_dataset_region) {
2269 spreadsheet_dataset_region->alignment = RGN_ALIGN_LEFT;
2270 spreadsheet_dataset_region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
2271 }
2272 }
2273 }
2274 }
2275 }
2276 }
2277
2278 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 6)) {
2279 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2280 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2281 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
2282 /* Disable View Layers filter. */
2283 if (space->spacetype == SPACE_OUTLINER) {
2284 SpaceOutliner *space_outliner = (SpaceOutliner *)space;
2285 space_outliner->filter |= SO_FILTER_NO_VIEW_LAYERS;
2286 }
2287 }
2288 }
2289 }
2290 }
2291
2292 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 7)) {
2293 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2294 ToolSettings *tool_settings = scene->toolsettings;
2295 tool_settings->snap_flag |= SCE_SNAP_SEQ;
2296 short snap_mode = tool_settings->snap_mode;
2297 short snap_node_mode = tool_settings->snap_node_mode;
2298 short snap_uv_mode = tool_settings->snap_uv_mode;
2299 tool_settings->snap_mode &= ~((1 << 4) | (1 << 5) | (1 << 6));
2300 tool_settings->snap_node_mode &= ~((1 << 5) | (1 << 6));
2301 tool_settings->snap_uv_mode &= ~(1 << 4);
2302 if (snap_mode & (1 << 4)) {
2303 tool_settings->snap_mode |= (1 << 6); /* SCE_SNAP_TO_INCREMENT */
2304 }
2305 if (snap_mode & (1 << 5)) {
2306 tool_settings->snap_mode |= (1 << 4); /* SCE_SNAP_TO_EDGE_MIDPOINT */
2307 }
2308 if (snap_mode & (1 << 6)) {
2309 tool_settings->snap_mode |= (1 << 5); /* SCE_SNAP_TO_EDGE_PERPENDICULAR */
2310 }
2311 if (snap_node_mode & (1 << 5)) {
2312 tool_settings->snap_node_mode |= (1 << 0); /* SCE_SNAP_TO_NODE_X */
2313 }
2314 if (snap_node_mode & (1 << 6)) {
2315 tool_settings->snap_node_mode |= (1 << 1); /* SCE_SNAP_TO_NODE_Y */
2316 }
2317 if (snap_uv_mode & (1 << 4)) {
2318 tool_settings->snap_uv_mode |= (1 << 6); /* SCE_SNAP_TO_INCREMENT */
2319 }
2320
2321 SequencerToolSettings *sequencer_tool_settings = blender::seq::tool_settings_ensure(scene);
2322 sequencer_tool_settings->snap_mode = SEQ_SNAP_TO_STRIPS | SEQ_SNAP_TO_CURRENT_FRAME |
2324 sequencer_tool_settings->snap_distance = 15;
2325 }
2326 }
2327
2328 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 8)) {
2329 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2330 if (scene->master_collection != nullptr) {
2331 BLI_strncpy_utf8(scene->master_collection->id.name + 2,
2333 sizeof(scene->master_collection->id.name) - 2);
2334 }
2335 }
2336 }
2337
2338 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 9)) {
2339 /* Fix a bug where reordering FCurves and bActionGroups could cause some corruption. Just
2340 * reconstruct all the action groups & ensure that the FCurves of a group are continuously
2341 * stored (i.e. not mixed with other groups) to be sure. See #89435. */
2342 LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
2344 }
2345
2346 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2347 if (ntree->type == NTREE_GEOMETRY) {
2348 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2349 if (node->type_legacy == GEO_NODE_SUBDIVIDE_MESH) {
2350 STRNCPY_UTF8(node->idname, "GeometryNodeMeshSubdivide");
2351 }
2352 }
2353 }
2354 }
2356 }
2357
2358 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 10)) {
2359 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2360 ToolSettings *tool_settings = scene->toolsettings;
2361 if (tool_settings->snap_uv_mode & (1 << 4)) {
2362 tool_settings->snap_uv_mode |= (1 << 6); /* SCE_SNAP_TO_INCREMENT */
2363 tool_settings->snap_uv_mode &= ~(1 << 4);
2364 }
2365 }
2366 LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
2367 if (!(mat->lineart.flags & LRT_MATERIAL_CUSTOM_OCCLUSION_EFFECTIVENESS)) {
2368 mat->lineart.mat_occlusion = 1;
2369 }
2370 }
2371 }
2372
2373 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 13)) {
2374 /* Convert Surface Deform to sparse-capable bind structure. */
2375 if (!DNA_struct_member_exists(
2376 fd->filesdna, "SurfaceDeformModifierData", "int", "mesh_verts_num"))
2377 {
2378 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2379 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
2380 if (md->type == eModifierType_SurfaceDeform) {
2382 if (smd->bind_verts_num && smd->verts) {
2383 smd->mesh_verts_num = smd->bind_verts_num;
2384
2385 for (uint i = 0; i < smd->bind_verts_num; i++) {
2386 smd->verts[i].vertex_idx = i;
2387 }
2388 }
2389 }
2390 }
2391 if (ob->type == OB_GPENCIL_LEGACY) {
2392 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
2393 if (md->type == eGpencilModifierType_Lineart) {
2396 lmd->chain_smooth_tolerance = 0.2f;
2397 }
2398 }
2399 }
2400 }
2401 }
2402
2403 if (!DNA_struct_member_exists(
2404 fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library"))
2405 {
2406 LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
2407 BKE_asset_library_reference_init_default(&workspace->asset_library_ref);
2408 }
2409 }
2410
2411 if (!DNA_struct_member_exists(
2412 fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library_ref"))
2413 {
2414 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2415 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2416 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
2417 if (space->spacetype == SPACE_FILE) {
2418 SpaceFile *sfile = (SpaceFile *)space;
2419 if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) {
2420 continue;
2421 }
2423 }
2424 }
2425 }
2426 }
2427 }
2428
2429 /* Set default 2D annotation placement. */
2430 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2431 ToolSettings *ts = scene->toolsettings;
2433 }
2434 }
2435
2436 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 14)) {
2437 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2438 ToolSettings *tool_settings = scene->toolsettings;
2439 tool_settings->snap_flag &= ~SCE_SNAP_SEQ;
2440 }
2441 }
2442
2443 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 15)) {
2444 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2445 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2446 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2447 if (sl->spacetype == SPACE_SEQ) {
2448 SpaceSeq *sseq = (SpaceSeq *)sl;
2450 }
2451 }
2452 }
2453 }
2454 }
2455
2456 /* Font names were copied directly into ID names, see: #90417. */
2457 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 16)) {
2458 ListBase *lb = which_libbase(bmain, ID_VF);
2460 }
2461
2462 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 17)) {
2463 if (!DNA_struct_member_exists(
2464 fd->filesdna, "View3DOverlay", "float", "normals_constant_screen_size"))
2465 {
2466 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2467 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2468 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2469 if (sl->spacetype == SPACE_VIEW3D) {
2470 View3D *v3d = (View3D *)sl;
2472 }
2473 }
2474 }
2475 }
2476 }
2477
2478 /* Fix SplineIK constraint's inconsistency between binding points array and its stored size.
2479 */
2480 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2481 /* NOTE: Objects should never have SplineIK constraint, so no need to apply this fix on
2482 * their constraints. */
2483 if (ob->pose) {
2484 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
2486 }
2487 }
2488 }
2489 }
2490
2491 /* Move visibility from Cycles to Blender. */
2492 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 17)) {
2493 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
2495 int flag = 0;
2496
2497 if (cvisibility) {
2498 flag |= version_cycles_property_boolean(cvisibility, "camera", true) ? 0 : OB_HIDE_CAMERA;
2499 flag |= version_cycles_property_boolean(cvisibility, "diffuse", true) ? 0 :
2501 flag |= version_cycles_property_boolean(cvisibility, "glossy", true) ? 0 : OB_HIDE_GLOSSY;
2502 flag |= version_cycles_property_boolean(cvisibility, "transmission", true) ?
2503 0 :
2505 flag |= version_cycles_property_boolean(cvisibility, "scatter", true) ?
2506 0 :
2508 flag |= version_cycles_property_boolean(cvisibility, "shadow", true) ? 0 : OB_HIDE_SHADOW;
2509 }
2510
2512 if (cobject) {
2513 flag |= version_cycles_property_boolean(cobject, "is_holdout", false) ? OB_HOLDOUT : 0;
2514 flag |= version_cycles_property_boolean(cobject, "is_shadow_catcher", false) ?
2516 0;
2517 }
2518
2519 if (object->type == OB_LAMP) {
2521 }
2522
2523 /* Clear unused bits from old version, and add new flags. */
2524 object->visibility_flag &= (OB_HIDE_VIEWPORT | OB_HIDE_SELECT | OB_HIDE_RENDER);
2525 object->visibility_flag |= flag;
2526 }
2527 }
2528
2529 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 18)) {
2530 if (!DNA_struct_member_exists(
2531 fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library_ref"))
2532 {
2533 LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
2534 BKE_asset_library_reference_init_default(&workspace->asset_library_ref);
2535 }
2536 }
2537
2538 if (!DNA_struct_member_exists(
2539 fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library_ref"))
2540 {
2541 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2542 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2543 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
2544 if (space->spacetype != SPACE_FILE) {
2545 continue;
2546 }
2547
2548 SpaceFile *sfile = (SpaceFile *)space;
2549 if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) {
2550 continue;
2551 }
2553 }
2554 }
2555 }
2556 }
2557
2558 /* Previously, only text ending with `.py` would run, apply this logic
2559 * to existing files so text that happens to have the "Register" enabled
2560 * doesn't suddenly start running code on startup that was previously ignored. */
2561 LISTBASE_FOREACH (Text *, text, &bmain->texts) {
2562 if ((text->flags & TXT_ISSCRIPT) && !BLI_path_extension_check(text->id.name + 2, ".py")) {
2563 text->flags &= ~TXT_ISSCRIPT;
2564 }
2565 }
2566 }
2567
2568 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 19)) {
2569 /* Disable Fade Inactive Overlay by default as it is redundant after introducing flash on
2570 * mode transfer. */
2571 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2572 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2573 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2574 if (sl->spacetype == SPACE_VIEW3D) {
2575 View3D *v3d = (View3D *)sl;
2577 }
2578 }
2579 }
2580 }
2581
2582 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2583 SequencerToolSettings *sequencer_tool_settings = blender::seq::tool_settings_ensure(scene);
2584 sequencer_tool_settings->overlap_mode = SEQ_OVERLAP_SHUFFLE;
2585 }
2586 }
2587
2588 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 20)) {
2589 /* Use new vector Size socket in Cube Mesh Primitive node. */
2590 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
2591 if (ntree->type != NTREE_GEOMETRY) {
2592 continue;
2593 }
2594
2595 LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
2596 if (link->tonode->type_legacy == GEO_NODE_MESH_PRIMITIVE_CUBE) {
2597 bNode *node = link->tonode;
2598 if (STREQ(link->tosock->identifier, "Size") && link->tosock->type == SOCK_FLOAT) {
2599 bNode *link_fromnode = link->fromnode;
2600 bNodeSocket *link_fromsock = link->fromsock;
2601 bNodeSocket *socket = link->tosock;
2602 BLI_assert(socket);
2603
2605 ntree, node, socket);
2607 *ntree, *link_fromnode, *link_fromsock, *node, *new_socket);
2608 }
2609 }
2610 }
2611
2612 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2613 if (node->type_legacy != GEO_NODE_MESH_PRIMITIVE_CUBE) {
2614 continue;
2615 }
2616 LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
2617 if (STREQ(socket->identifier, "Size") && (socket->type == SOCK_FLOAT)) {
2618 do_version_replace_float_size_with_vector(ntree, node, socket);
2619 break;
2620 }
2621 }
2622 }
2623 }
2624 }
2625
2626 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 22)) {
2627 if (!DNA_struct_member_exists(
2628 fd->filesdna, "LineartGpencilModifierData", "bool", "use_crease_on_smooth"))
2629 {
2630 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2631 if (ob->type == OB_GPENCIL_LEGACY) {
2632 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
2633 if (md->type == eGpencilModifierType_Lineart) {
2636 }
2637 }
2638 }
2639 }
2640 }
2641 }
2642
2643 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 23)) {
2644 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2645 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2646 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2647 if (sl->spacetype == SPACE_FILE) {
2648 SpaceFile *sfile = (SpaceFile *)sl;
2649 if (sfile->asset_params) {
2651 }
2652 }
2653 }
2654 }
2655 }
2656
2657 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2658 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2659 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2660 if (sl->spacetype == SPACE_SEQ) {
2661 SpaceSeq *sseq = (SpaceSeq *)sl;
2662 int seq_show_safe_margins = (sseq->flag & SEQ_PREVIEW_SHOW_SAFE_MARGINS);
2663 int seq_show_gpencil = (sseq->flag & SEQ_PREVIEW_SHOW_GPENCIL);
2664 int seq_show_fcurves = (sseq->flag & SEQ_TIMELINE_SHOW_FCURVES);
2665 int seq_show_safe_center = (sseq->flag & SEQ_PREVIEW_SHOW_SAFE_CENTER);
2666 int seq_show_metadata = (sseq->flag & SEQ_PREVIEW_SHOW_METADATA);
2667 int seq_show_strip_name = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_NAME);
2668 int seq_show_strip_source = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE);
2669 int seq_show_strip_duration = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_DURATION);
2670 int seq_show_grid = (sseq->flag & SEQ_TIMELINE_SHOW_GRID);
2671 int show_strip_offset = (sseq->draw_flag & SEQ_TIMELINE_SHOW_STRIP_OFFSETS);
2672 sseq->preview_overlay.flag = (seq_show_safe_margins | seq_show_gpencil |
2673 seq_show_safe_center | seq_show_metadata);
2674 sseq->timeline_overlay.flag = (seq_show_fcurves | seq_show_strip_name |
2675 seq_show_strip_source | seq_show_strip_duration |
2676 seq_show_grid | show_strip_offset);
2677 }
2678 }
2679 }
2680 }
2681 }
2682
2683 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 24)) {
2684 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2685 SequencerToolSettings *sequencer_tool_settings = blender::seq::tool_settings_ensure(scene);
2686 sequencer_tool_settings->pivot_point = V3D_AROUND_CENTER_MEDIAN;
2687
2688 if (scene->ed != nullptr) {
2689 blender::seq::foreach_strip(&scene->ed->seqbase, strip_transform_origin_set, nullptr);
2690 }
2691 }
2692 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2693 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2694 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2695 if (sl->spacetype == SPACE_SEQ) {
2696 SpaceSeq *sseq = (SpaceSeq *)sl;
2698 }
2699 }
2700 }
2701 }
2702
2703 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2704 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2705 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2706 if (sl->spacetype == SPACE_SEQ) {
2707 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
2708 &sl->regionbase;
2709 LISTBASE_FOREACH (ARegion *, region, regionbase) {
2710 if (region->regiontype == RGN_TYPE_WINDOW) {
2711 region->v2d.min[1] = 4.0f;
2712 }
2713 }
2714 }
2715 }
2716 }
2717 }
2718 }
2719
2720 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 25)) {
2721 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2722 if (ntree->type == NTREE_SHADER) {
2723 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2725 }
2726 }
2727 }
2729
2730 enum {
2731 R_EXR_TILE_FILE = (1 << 10),
2732 R_FULL_SAMPLE = (1 << 15),
2733 };
2734 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2735 scene->r.scemode &= ~(R_EXR_TILE_FILE | R_FULL_SAMPLE);
2736 }
2737 }
2738
2739 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 25)) {
2740 enum {
2741 DENOISER_NLM = 1,
2743 };
2744
2745 /* Removal of NLM denoiser. */
2746 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2747 IDProperty *cscene = version_cycles_properties_from_ID(&scene->id);
2748
2749 if (cscene) {
2750 if (version_cycles_property_int(cscene, "denoiser", DENOISER_NLM) == DENOISER_NLM) {
2752 }
2753 }
2754 }
2755 }
2756
2757 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 26)) {
2758 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2759 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
2760 if (md->type == eModifierType_Nodes) {
2762 }
2763 }
2764 }
2765
2766 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2767 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2768 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2769 switch (sl->spacetype) {
2770 case SPACE_FILE: {
2771 SpaceFile *sfile = (SpaceFile *)sl;
2772 if (sfile->params) {
2775 }
2776
2777 /* New default import method: Append with reuse. */
2778 if (sfile->asset_params) {
2780 }
2781 break;
2782 }
2783 default:
2784 break;
2785 }
2786 }
2787 }
2788 }
2789 }
2790
2791 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 29)) {
2792 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2793 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2794 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2795 switch (sl->spacetype) {
2796 case SPACE_SEQ: {
2797 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
2798 &sl->regionbase;
2799 LISTBASE_FOREACH (ARegion *, region, regionbase) {
2800 if (region->regiontype == RGN_TYPE_WINDOW) {
2801 region->v2d.max[1] = blender::seq::MAX_CHANNELS;
2802 }
2803 }
2804 break;
2805 }
2806 }
2807 }
2808 }
2809 }
2810 }
2811
2812 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 31)) {
2813 /* Swap header with the tool header so the regular header is always on the edge. */
2814 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2815 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2816 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2817 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
2818 &sl->regionbase;
2819 ARegion *region_tool = nullptr, *region_head = nullptr;
2820 int region_tool_index = -1, region_head_index = -1, i;
2821 LISTBASE_FOREACH_INDEX (ARegion *, region, regionbase, i) {
2822 if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
2823 region_tool = region;
2824 region_tool_index = i;
2825 }
2826 else if (region->regiontype == RGN_TYPE_HEADER) {
2827 region_head = region;
2828 region_head_index = i;
2829 }
2830 }
2831 if ((region_tool && region_head) && (region_head_index > region_tool_index)) {
2832 BLI_listbase_swaplinks(regionbase, region_tool, region_head);
2833 }
2834 }
2835 }
2836 }
2837
2838 /* Set strip color tags to STRIP_COLOR_NONE. */
2839 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2840 if (scene->ed != nullptr) {
2842 &scene->ed->seqbase, do_versions_sequencer_color_tags, nullptr);
2843 }
2844 }
2845
2846 /* Show sequencer color tags by default. */
2847 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2848 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2849 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2850 if (sl->spacetype == SPACE_SEQ) {
2851 SpaceSeq *sseq = (SpaceSeq *)sl;
2853 }
2854 }
2855 }
2856 }
2857
2858 /* Set defaults for new color balance modifier parameters. */
2859 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2860 if (scene->ed != nullptr) {
2862 &scene->ed->seqbase, do_versions_sequencer_color_balance_sop, nullptr);
2863 }
2864 }
2865 }
2866
2867 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 33)) {
2868 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2869 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2870 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2871 switch (sl->spacetype) {
2872 case SPACE_SEQ: {
2873 SpaceSeq *sseq = (SpaceSeq *)sl;
2874 enum { SEQ_DRAW_SEQUENCE = 0 };
2875 if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
2876 sseq->mainb = SEQ_DRAW_IMG_IMBUF;
2877 }
2878 break;
2879 }
2880 case SPACE_TEXT: {
2881 SpaceText *st = (SpaceText *)sl;
2882 st->flags &= ~ST_FLAG_UNUSED_4;
2883 break;
2884 }
2885 }
2886 }
2887 }
2888 }
2889 }
2890
2891 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 36)) {
2892 /* Update the `idnames` for renamed geometry and function nodes. */
2893 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
2894 if (ntree->type != NTREE_GEOMETRY) {
2895 continue;
2896 }
2897 version_node_id(ntree, FN_NODE_COMPARE, "FunctionNodeCompareFloats");
2898 version_node_id(ntree, GEO_NODE_CAPTURE_ATTRIBUTE, "GeometryNodeCaptureAttribute");
2899 version_node_id(ntree, GEO_NODE_MESH_BOOLEAN, "GeometryNodeMeshBoolean");
2900 version_node_id(ntree, GEO_NODE_FILL_CURVE, "GeometryNodeFillCurve");
2901 version_node_id(ntree, GEO_NODE_FILLET_CURVE, "GeometryNodeFilletCurve");
2902 version_node_id(ntree, GEO_NODE_REVERSE_CURVE, "GeometryNodeReverseCurve");
2903 version_node_id(ntree, GEO_NODE_SAMPLE_CURVE, "GeometryNodeSampleCurve");
2904 version_node_id(ntree, GEO_NODE_RESAMPLE_CURVE, "GeometryNodeResampleCurve");
2905 version_node_id(ntree, GEO_NODE_SUBDIVIDE_CURVE, "GeometryNodeSubdivideCurve");
2906 version_node_id(ntree, GEO_NODE_TRIM_CURVE, "GeometryNodeTrimCurve");
2907 version_node_id(ntree, GEO_NODE_REPLACE_MATERIAL, "GeometryNodeReplaceMaterial");
2908 version_node_id(ntree, GEO_NODE_SUBDIVIDE_MESH, "GeometryNodeSubdivideMesh");
2909 version_node_id(ntree, GEO_NODE_SET_MATERIAL, "GeometryNodeSetMaterial");
2910 version_node_id(ntree, GEO_NODE_SPLIT_EDGES, "GeometryNodeSplitEdges");
2911 }
2912
2913 /* Update bone roll after a fix to vec_roll_to_mat3_normalized. */
2914 LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
2915 do_version_bones_roll(&arm->bonebase);
2916 }
2917 }
2918
2919 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 37)) {
2920 /* Node Editor: toggle overlays on. */
2921 if (!DNA_struct_exists(fd->filesdna, "SpaceNodeOverlay")) {
2922 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2923 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2924 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
2925 if (space->spacetype == SPACE_NODE) {
2926 SpaceNode *snode = (SpaceNode *)space;
2929 }
2930 }
2931 }
2932 }
2933 }
2934 }
2935
2936 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 38)) {
2937 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2938 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2939 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
2940 if (space->spacetype == SPACE_FILE) {
2941 SpaceFile *sfile = (SpaceFile *)space;
2942 FileAssetSelectParams *asset_params = sfile->asset_params;
2943 if (asset_params) {
2944 asset_params->base_params.filter_id = FILTER_ID_ALL;
2945 }
2946 }
2947 }
2948 }
2949 }
2950 }
2951
2952 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 39)) {
2953 LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
2954 wm->xr.session_settings.base_scale = 1.0f;
2955 wm->xr.session_settings.draw_flags |= (V3D_OFSDRAW_SHOW_SELECTION |
2958 }
2959 }
2960
2961 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 40)) {
2962 /* Update the `idnames` for renamed geometry and function nodes. */
2963 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
2964 if (ntree->type != NTREE_GEOMETRY) {
2965 continue;
2966 }
2967 version_node_id(ntree, FN_NODE_SLICE_STRING, "FunctionNodeSliceString");
2969 }
2970
2971 /* Add storage to viewer node. */
2972 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
2973 if (ntree->type != NTREE_GEOMETRY) {
2974 continue;
2975 }
2976 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2977 if (node->type_legacy == GEO_NODE_VIEWER) {
2978 if (node->storage == nullptr) {
2980 data->data_type_legacy = CD_PROP_FLOAT;
2981 node->storage = data;
2982 }
2983 }
2984 }
2985 }
2986
2987 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
2988 if (ntree->type == NTREE_GEOMETRY) {
2990 ntree, GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, "Geometry", "Mesh");
2991 version_node_input_socket_name(ntree, GEO_NODE_POINTS_TO_VOLUME, "Geometry", "Points");
2992 version_node_output_socket_name(ntree, GEO_NODE_POINTS_TO_VOLUME, "Geometry", "Volume");
2993 version_node_socket_name(ntree, GEO_NODE_SUBDIVISION_SURFACE, "Geometry", "Mesh");
2994 version_node_socket_name(ntree, GEO_NODE_RESAMPLE_CURVE, "Geometry", "Curve");
2995 version_node_socket_name(ntree, GEO_NODE_SUBDIVIDE_CURVE, "Geometry", "Curve");
2996 version_node_socket_name(ntree, GEO_NODE_SET_CURVE_RADIUS, "Geometry", "Curve");
2997 version_node_socket_name(ntree, GEO_NODE_SET_CURVE_TILT, "Geometry", "Curve");
2998 version_node_socket_name(ntree, GEO_NODE_SET_CURVE_HANDLES, "Geometry", "Curve");
2999 version_node_socket_name(ntree, GEO_NODE_TRANSLATE_INSTANCES, "Geometry", "Instances");
3000 version_node_socket_name(ntree, GEO_NODE_ROTATE_INSTANCES, "Geometry", "Instances");
3001 version_node_socket_name(ntree, GEO_NODE_SCALE_INSTANCES, "Geometry", "Instances");
3002 version_node_output_socket_name(ntree, GEO_NODE_MESH_BOOLEAN, "Geometry", "Mesh");
3003 version_node_input_socket_name(ntree, GEO_NODE_MESH_BOOLEAN, "Geometry 1", "Mesh 1");
3004 version_node_input_socket_name(ntree, GEO_NODE_MESH_BOOLEAN, "Geometry 2", "Mesh 2");
3005 version_node_socket_name(ntree, GEO_NODE_SUBDIVIDE_MESH, "Geometry", "Mesh");
3006 version_node_socket_name(ntree, GEO_NODE_TRIANGULATE, "Geometry", "Mesh");
3010 ntree, GEO_NODE_MESH_PRIMITIVE_CYLINDER, "Geometry", "Mesh");
3013 ntree, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, "Geometry", "Mesh");
3017 ntree, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, "Geometry", "Mesh");
3018 version_node_socket_name(ntree, GEO_NODE_SET_POINT_RADIUS, "Geometry", "Points");
3019 }
3020 }
3021 }
3022
3023 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 42)) {
3024 /* Use consistent socket identifiers for the math node.
3025 * The code to make unique identifiers from the names was inconsistent. */
3026 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3027 if (ntree->type != NTREE_CUSTOM) {
3029 }
3030 }
3032
3033 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3034 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3035 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3036 if (sl->spacetype == SPACE_SEQ) {
3037 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3038 &sl->regionbase;
3039 LISTBASE_FOREACH (ARegion *, region, regionbase) {
3040 if (region->regiontype == RGN_TYPE_WINDOW) {
3041 region->v2d.min[1] = 1.0f;
3042 }
3043 }
3044 }
3045 }
3046 }
3047 }
3048
3049 /* Change minimum zoom to 0.05f in the node editor. */
3050 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3051 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3052 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3053 if (sl->spacetype == SPACE_NODE) {
3054 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3055 &sl->regionbase;
3056 LISTBASE_FOREACH (ARegion *, region, regionbase) {
3057 if (region->regiontype == RGN_TYPE_WINDOW) {
3058 region->v2d.minzoom = std::min(region->v2d.minzoom, 0.05f);
3059 }
3060 }
3061 }
3062 }
3063 }
3064 }
3065 }
3066
3067 /* Special case to handle older in-development 3.1 files, before change from 3.0 branch gets
3068 * merged in master. */
3069 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 42) ||
3070 (bmain->versionfile == 301 && !MAIN_VERSION_FILE_ATLEAST(bmain, 301, 3)))
3071 {
3072 /* Update LibOverride operations regarding insertions in RNA collections (i.e. modifiers,
3073 * constraints and NLA tracks). */
3074 ID *id_iter;
3075 FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
3076 if (ID_IS_OVERRIDE_LIBRARY_REAL(id_iter)) {
3078 if (GS(id_iter->name) == ID_OB) {
3080 }
3081 }
3082 }
3084 }
3085
3086 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 301, 4)) {
3087 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3088 if (ntree->type != NTREE_GEOMETRY) {
3089 continue;
3090 }
3091 version_node_id(ntree, GEO_NODE_CURVE_SPLINE_PARAMETER, "GeometryNodeSplineParameter");
3092 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3093 if (node->type_legacy == GEO_NODE_CURVE_SPLINE_PARAMETER) {
3095 ntree, node, SOCK_OUT, SOCK_INT, PROP_NONE, "Index", "Index");
3096 }
3097
3098 /* Convert float compare into a more general compare node. */
3099 if (node->type_legacy == FN_NODE_COMPARE) {
3100 if (node->storage == nullptr) {
3102 data->data_type = SOCK_FLOAT;
3103 data->operation = node->custom1;
3104 STRNCPY_UTF8(node->idname, "FunctionNodeCompare");
3105 node->storage = data;
3106 }
3107 }
3108 }
3109 }
3110
3111 /* Add a toggle for the breadcrumbs overlay in the node editor. */
3112 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3113 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3114 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
3115 if (space->spacetype == SPACE_NODE) {
3116 SpaceNode *snode = (SpaceNode *)space;
3118 }
3119 }
3120 }
3121 }
3122 }
3123
3124 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 301, 6)) {
3125 /* Add node storage for map range node. */
3126 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3127 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3128 if (node->type_legacy == SH_NODE_MAP_RANGE) {
3129 if (node->storage == nullptr) {
3131 data->clamp = node->custom1;
3132 data->data_type = CD_PROP_FLOAT;
3133 data->interpolation_type = node->custom2;
3134 node->storage = data;
3135 }
3136 }
3137 }
3138 }
3140
3141 /* Update spreadsheet data set region type. */
3142 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3143 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3144 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3145 if (sl->spacetype == SPACE_SPREADSHEET) {
3146 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3147 &sl->regionbase;
3148 LISTBASE_FOREACH (ARegion *, region, regionbase) {
3149 if (region->regiontype == RGN_TYPE_CHANNELS) {
3150 region->regiontype = RGN_TYPE_TOOLS;
3151 }
3152 }
3153 }
3154 }
3155 }
3156 }
3157
3158 LISTBASE_FOREACH (Curve *, curve, &bmain->curves) {
3159 LISTBASE_FOREACH (Nurb *, nurb, &curve->nurb) {
3160 /* Previously other flags were ignored if CU_NURB_CYCLIC is set. */
3161 if (nurb->flagu & CU_NURB_CYCLIC) {
3162 nurb->flagu = CU_NURB_CYCLIC;
3164 }
3165 /* Previously other flags were ignored if CU_NURB_CYCLIC is set. */
3166 if (nurb->flagv & CU_NURB_CYCLIC) {
3167 nurb->flagv = CU_NURB_CYCLIC;
3169 }
3170 }
3171 }
3172
3173 /* Initialize the bone wireframe opacity setting. */
3174 if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "bone_wire_alpha")) {
3175 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3176 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3177 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3178 if (sl->spacetype == SPACE_VIEW3D) {
3179 View3D *v3d = (View3D *)sl;
3180 v3d->overlay.bone_wire_alpha = 1.0f;
3181 }
3182 }
3183 }
3184 }
3185 }
3186
3187 /* Rename sockets on multiple nodes */
3188 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3189 if (ntree->type == NTREE_GEOMETRY) {
3191 ntree, GEO_NODE_STRING_TO_CURVES, "Curves", "Curve Instances");
3193 ntree, GEO_NODE_INPUT_MESH_EDGE_ANGLE, "Angle", "Unsigned Angle");
3195 ntree, GEO_NODE_INPUT_MESH_ISLAND, "Index", "Island Index");
3197 ntree, GEO_NODE_TRANSFER_ATTRIBUTE_DEPRECATED, "Target", "Source");
3198 }
3199 }
3200 }
3201
3202 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 301, 7) ||
3203 (bmain->versionfile == 302 && !MAIN_VERSION_FILE_ATLEAST(bmain, 302, 4)))
3204 {
3205 /* Duplicate value for two flags that mistakenly had the same numeric value. */
3206 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3207 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
3208 if (md->type == eModifierType_WeightVGProximity) {
3212 }
3213 }
3214 }
3215 }
3216 }
3217
3218 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 2)) {
3219 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3220 if (scene->ed != nullptr) {
3221 blender::seq::foreach_strip(&scene->ed->seqbase, strip_transform_filter_set, nullptr);
3222 }
3223 }
3224 }
3225
3226 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 6)) {
3227 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3228 ToolSettings *tool_settings = scene->toolsettings;
3229 tool_settings->snap_flag_seq = tool_settings->snap_flag &
3230 ~(short(SCE_SNAP) | short(SCE_SNAP_SEQ));
3231 if (tool_settings->snap_flag & SCE_SNAP_SEQ) {
3232 tool_settings->snap_flag_seq |= SCE_SNAP;
3233 tool_settings->snap_flag &= ~SCE_SNAP_SEQ;
3234 }
3235
3236 tool_settings->snap_flag_node = tool_settings->snap_flag;
3237 tool_settings->snap_uv_flag |= tool_settings->snap_flag & SCE_SNAP;
3238 }
3239
3240 /* Alter NURBS knot mode flags to fit new modes. */
3241 LISTBASE_FOREACH (Curve *, curve, &bmain->curves) {
3242 LISTBASE_FOREACH (Nurb *, nurb, &curve->nurb) {
3243 /* CU_NURB_BEZIER and CU_NURB_ENDPOINT were ignored if combined. */
3244 if (nurb->flagu & CU_NURB_BEZIER && nurb->flagu & CU_NURB_ENDPOINT) {
3245 nurb->flagu &= ~(CU_NURB_BEZIER | CU_NURB_ENDPOINT);
3247 }
3248 else if (nurb->flagu & CU_NURB_CYCLIC) {
3249 /* In 45d038181ae2 cyclic bezier support is added, but CU_NURB_ENDPOINT still ignored. */
3250 nurb->flagu = CU_NURB_CYCLIC | (nurb->flagu & CU_NURB_BEZIER);
3252 }
3253 /* Bezier NURBS of order 3 were clamped to first control point. */
3254 if (nurb->orderu == 3 && (nurb->flagu & CU_NURB_BEZIER)) {
3255 nurb->flagu |= CU_NURB_ENDPOINT;
3257 }
3258 /* CU_NURB_BEZIER and CU_NURB_ENDPOINT were ignored if combined. */
3259 if (nurb->flagv & CU_NURB_BEZIER && nurb->flagv & CU_NURB_ENDPOINT) {
3260 nurb->flagv &= ~(CU_NURB_BEZIER | CU_NURB_ENDPOINT);
3262 }
3263 else if (nurb->flagv & CU_NURB_CYCLIC) {
3264 /* In 45d038181ae2 cyclic bezier support is added, but CU_NURB_ENDPOINT still ignored. */
3265 nurb->flagv = CU_NURB_CYCLIC | (nurb->flagv & CU_NURB_BEZIER);
3267 }
3268 /* Bezier NURBS of order 3 were clamped to first control point. */
3269 if (nurb->orderv == 3 && (nurb->flagv & CU_NURB_BEZIER)) {
3270 nurb->flagv |= CU_NURB_ENDPOINT;
3272 }
3273 }
3274 }
3275
3276 /* Change grease pencil smooth iterations to match old results with new algorithm. */
3277 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3278 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
3279 if (md->type == eGpencilModifierType_Smooth) {
3281 if (gpmd->step == 1 && gpmd->factor <= 0.5f) {
3282 gpmd->factor *= 2.0f;
3283 }
3284 else {
3285 gpmd->step = 1 + int(gpmd->factor * max_ff(0.0f,
3286 min_ff(5.1f * sqrtf(gpmd->step) - 3.0f,
3287 gpmd->step + 2.0f)));
3288 gpmd->factor = 1.0f;
3289 }
3290 }
3291 }
3292 }
3293 }
3294
3295 /* Rebuild active/render color attribute references. */
3296 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 6)) {
3297 LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
3298 /* Buggy code in wm_toolsystem broke smear in old files,
3299 * reset to defaults. */
3300 if (br->sculpt_brush_type == SCULPT_BRUSH_TYPE_SMEAR) {
3301 br->alpha = 1.0f;
3302 br->spacing = 5;
3303 br->flag &= ~BRUSH_ALPHA_PRESSURE;
3304 br->flag &= ~BRUSH_SPACE_ATTEN;
3305 br->curve_distance_falloff_preset = BRUSH_CURVE_SPHERE;
3306 }
3307 }
3308
3309 LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
3310 for (int step = 0; step < 2; step++) {
3311 CustomDataLayer *actlayer = nullptr;
3312
3313 int vact1, vact2;
3314
3315 if (step) {
3316 vact1 = CustomData_get_render_layer_index(&me->vert_data, CD_PROP_COLOR);
3317 vact2 = CustomData_get_render_layer_index(&me->corner_data, CD_PROP_BYTE_COLOR);
3318 }
3319 else {
3320 vact1 = CustomData_get_active_layer_index(&me->vert_data, CD_PROP_COLOR);
3321 vact2 = CustomData_get_active_layer_index(&me->corner_data, CD_PROP_BYTE_COLOR);
3322 }
3323
3324 if (vact1 != -1) {
3325 actlayer = me->vert_data.layers + vact1;
3326 }
3327 else if (vact2 != -1) {
3328 actlayer = me->corner_data.layers + vact2;
3329 }
3330
3331 if (actlayer) {
3332 if (step) {
3333 BKE_id_attributes_default_color_set(&me->id, actlayer->name);
3334 }
3335 else {
3336 BKE_id_attributes_active_color_set(&me->id, actlayer->name);
3337 }
3338 }
3339 }
3340 }
3341 }
3342
3343 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 7)) {
3344 /* Generate 'system' liboverrides IDs.
3345 * NOTE: This is a fairly rough process, based on very basic heuristics. Should be enough for a
3346 * do_version code though, this is a new optional feature, not a critical conversion. */
3347 ID *id;
3348 FOREACH_MAIN_ID_BEGIN (bmain, id) {
3349 if (!ID_IS_OVERRIDE_LIBRARY_REAL(id) || ID_IS_LINKED(id)) {
3350 /* Ignore non-real liboverrides, and linked ones. */
3351 continue;
3352 }
3353 if (GS(id->name) == ID_OB) {
3354 /* Never 'lock' an object into a system override for now. */
3355 continue;
3356 }
3358 /* Do not 'lock' an ID already edited by the user. */
3359 continue;
3360 }
3361 id->override_library->flag |= LIBOVERRIDE_FLAG_SYSTEM_DEFINED;
3362 }
3364
3365 /* Initialize brush curves sculpt settings. */
3366 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3367 if (brush->ob_mode != OB_MODE_SCULPT_CURVES) {
3368 continue;
3369 }
3370 if (brush->curves_sculpt_settings != nullptr) {
3371 continue;
3372 }
3373 brush->curves_sculpt_settings = MEM_callocN<BrushCurvesSculptSettings>(__func__);
3374 brush->curves_sculpt_settings->add_amount = 1;
3375 }
3376
3377 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3378 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3379 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3380 if (sl->spacetype == SPACE_OUTLINER) {
3381 SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
3382 space_outliner->filter &= ~SO_FILTER_CLEARED_1;
3383 }
3384 }
3385 }
3386 }
3387 }
3388
3389 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 9)) {
3390 /* Sequencer channels region. */
3391 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3392 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3393 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3394 if (sl->spacetype != SPACE_SEQ) {
3395 continue;
3396 }
3398 continue;
3399 }
3400
3401 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3402 &sl->regionbase;
3404 if (!region) {
3405 /* Find sequencer tools region. */
3406 ARegion *tools_region = BKE_region_find_in_listbase_by_type(regionbase,
3408 region = do_versions_add_region(RGN_TYPE_CHANNELS, "channels region");
3409 BLI_insertlinkafter(regionbase, tools_region, region);
3410 region->alignment = RGN_ALIGN_LEFT;
3412 }
3413
3414 ARegion *timeline_region = BKE_region_find_in_listbase_by_type(regionbase,
3416 if (timeline_region != nullptr) {
3417 timeline_region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
3418 }
3419 }
3420 }
3421 }
3422
3423 /* Initialize channels. */
3424 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3426 if (ed == nullptr) {
3427 continue;
3428 }
3430 blender::seq::foreach_strip(&scene->ed->seqbase, strip_meta_channels_ensure, nullptr);
3431 }
3432 }
3433
3434 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 10)) {
3435 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3436 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3437 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3438 if (sl->spacetype != SPACE_FILE) {
3439 continue;
3440 }
3441 SpaceFile *sfile = (SpaceFile *)sl;
3442 if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) {
3443 continue;
3444 }
3446 }
3447 }
3448 }
3449
3450 /* While vertex-colors were experimental the smear tool became corrupt due
3451 * to bugs in the wm_toolsystem API (auto-creation of sculpt brushes
3452 * was broken). Go through and reset all smear brushes. */
3453 LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
3454 if (br->sculpt_brush_type == SCULPT_BRUSH_TYPE_SMEAR) {
3455 br->alpha = 1.0f;
3456 br->spacing = 5;
3457 br->flag &= ~BRUSH_ALPHA_PRESSURE;
3458 br->flag &= ~BRUSH_SPACE_ATTEN;
3459 br->curve_distance_falloff_preset = BRUSH_CURVE_SPHERE;
3460 }
3461 }
3462
3463 /* Rebuild active/render color attribute references. */
3464 LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
3465 for (int step = 0; step < 2; step++) {
3466 CustomDataLayer *actlayer = nullptr;
3467
3468 int vact1, vact2;
3469
3470 if (step) {
3471 vact1 = CustomData_get_render_layer_index(&me->vert_data, CD_PROP_COLOR);
3472 vact2 = CustomData_get_render_layer_index(&me->corner_data, CD_PROP_BYTE_COLOR);
3473 }
3474 else {
3475 vact1 = CustomData_get_active_layer_index(&me->vert_data, CD_PROP_COLOR);
3476 vact2 = CustomData_get_active_layer_index(&me->corner_data, CD_PROP_BYTE_COLOR);
3477 }
3478
3479 if (vact1 != -1) {
3480 actlayer = me->vert_data.layers + vact1;
3481 }
3482 else if (vact2 != -1) {
3483 actlayer = me->corner_data.layers + vact2;
3484 }
3485
3486 if (actlayer) {
3487 if (step) {
3488 BKE_id_attributes_default_color_set(&me->id, actlayer->name);
3489 }
3490 else {
3491 BKE_id_attributes_active_color_set(&me->id, actlayer->name);
3492 }
3493 }
3494 }
3495 }
3496
3497 /* Update data transfer modifiers */
3498 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3499 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
3500 if (md->type == eModifierType_DataTransfer) {
3502
3503 for (int i = 0; i < DT_MULTILAYER_INDEX_MAX; i++) {
3504 if (dtmd->layers_select_src[i] == 0) {
3506 }
3507
3508 if (dtmd->layers_select_dst[i] == 0) {
3510 }
3511 }
3512 }
3513 }
3514 }
3515 }
3516
3517 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 12)) {
3518 /* UV/Image show background grid option. */
3519 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3520 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3521 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
3522 if (space->spacetype == SPACE_IMAGE) {
3523 SpaceImage *sima = (SpaceImage *)space;
3525 }
3526 }
3527 }
3528 }
3529
3530 /* Add node storage for the merge by distance node. */
3531 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3532 if (ntree->type == NTREE_GEOMETRY) {
3533 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3534 if (node->type_legacy == GEO_NODE_MERGE_BY_DISTANCE) {
3535 if (node->storage == nullptr) {
3537 __func__);
3539 node->storage = data;
3540 }
3541 }
3542 }
3543 }
3544 }
3546
3547 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3548 if (ntree->type == NTREE_GEOMETRY) {
3550 ntree, GEO_NODE_SUBDIVISION_SURFACE, "Crease", "Edge Crease");
3551 }
3552 }
3553 }
3554
3555 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 13)) {
3556 /* Enable named attributes overlay in node editor. */
3557 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3558 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3559 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
3560 if (space->spacetype == SPACE_NODE) {
3561 SpaceNode *snode = (SpaceNode *)space;
3563 }
3564 }
3565 }
3566 }
3567
3568 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3569 BrushCurvesSculptSettings *settings = brush->curves_sculpt_settings;
3570 if (settings == nullptr) {
3571 continue;
3572 }
3573 if (settings->curve_length == 0.0f) {
3574 settings->curve_length = 0.3f;
3575 }
3576 }
3577 }
3578
3579 if (!DNA_struct_member_exists(fd->filesdna, "Sculpt", "float", "automasking_cavity_factor")) {
3580 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3581 if (scene->toolsettings && scene->toolsettings->sculpt) {
3582 scene->toolsettings->sculpt->automasking_cavity_factor = 0.5f;
3583 }
3584 }
3585 }
3586
3587 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 14)) {
3588 /* Compensate for previously wrong squared distance. */
3589 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3590 scene->r.bake.max_ray_distance = safe_sqrtf(scene->r.bake.max_ray_distance);
3591 }
3592 }
3593
3594 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 1)) {
3595 /* Initialize brush curves sculpt settings. */
3596 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3597 if (brush->ob_mode != OB_MODE_SCULPT_CURVES) {
3598 continue;
3599 }
3600 if (brush->curves_sculpt_settings->points_per_curve == 0) {
3601 brush->curves_sculpt_settings->points_per_curve = 8;
3602 }
3603 }
3604
3605 /* UDIM Packing. */
3606 if (!DNA_struct_member_exists(fd->filesdna, "ImagePackedFile", "int", "tile_number")) {
3607 LISTBASE_FOREACH (Image *, ima, &bmain->images) {
3608 int view;
3609 LISTBASE_FOREACH_INDEX (ImagePackedFile *, imapf, &ima->packedfiles, view) {
3610 imapf->view = view;
3611 imapf->tile_number = 1001;
3612 }
3613 }
3614 }
3615
3616 /* Merge still offsets into start/end offsets. */
3617 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3619 if (ed != nullptr) {
3621 }
3622 }
3623
3624 /* Use the curves type enum for the set spline type node, instead of a special one. */
3625 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3626 if (ntree->type == NTREE_GEOMETRY) {
3627 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3628 if (node->type_legacy == GEO_NODE_CURVE_SPLINE_TYPE) {
3629 NodeGeometryCurveSplineType *storage = (NodeGeometryCurveSplineType *)node->storage;
3630 switch (storage->spline_type) {
3631 case 0: /* GEO_NODE_SPLINE_TYPE_BEZIER */
3632 storage->spline_type = CURVE_TYPE_BEZIER;
3633 break;
3634 case 1: /* GEO_NODE_SPLINE_TYPE_NURBS */
3635 storage->spline_type = CURVE_TYPE_NURBS;
3636 break;
3637 case 2: /* GEO_NODE_SPLINE_TYPE_POLY */
3638 storage->spline_type = CURVE_TYPE_POLY;
3639 break;
3640 }
3641 }
3642 }
3643 }
3644 }
3646
3647 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3648 LISTBASE_FOREACH (GpencilModifierData *, gpd, &ob->greasepencil_modifiers) {
3649 if (gpd->type == eGpencilModifierType_Lineart) {
3651 lmd->shadow_camera_near = 0.1f;
3652 lmd->shadow_camera_far = 200.0f;
3653 lmd->shadow_camera_size = 200.0f;
3654 }
3655 }
3656 }
3657 }
3658
3659 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 2)) {
3660 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3661 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3662 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3663 if (sl->spacetype == SPACE_CLIP) {
3664 ((SpaceClip *)sl)->mask_info.blend_factor = 1.0;
3665 }
3666 }
3667 }
3668 }
3669 }
3670
3671 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 3)) {
3672 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3673 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3674 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3675 if (sl->spacetype == SPACE_CLIP) {
3676 ((SpaceClip *)sl)->mask_info.draw_flag |= MASK_DRAWFLAG_SPLINE;
3677 }
3678 else if (sl->spacetype == SPACE_IMAGE) {
3679 ((SpaceImage *)sl)->mask_info.draw_flag |= MASK_DRAWFLAG_SPLINE;
3680 }
3681 }
3682 }
3683 }
3684
3685 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3686 ToolSettings *tool_settings = scene->toolsettings;
3687 /* Zero isn't a valid value, use for versioning. */
3688 if (tool_settings->snap_face_nearest_steps == 0) {
3689 /* Minimum of snap steps for face nearest is 1. */
3690 tool_settings->snap_face_nearest_steps = 1;
3691 /* Set snap to edited and non-edited as default. */
3693 }
3694 }
3695 }
3696
3697 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 4)) {
3698 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3699 if (ntree->type == NTREE_COMPOSIT) {
3700 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3701 if (node->type_legacy == CMP_NODE_OUTPUT_FILE) {
3702 LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
3703 if (sock->storage) {
3704 NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)sock->storage;
3705 version_fix_image_format_copy(bmain, &sockdata->format);
3706 }
3707 }
3708
3709 if (node->storage) {
3710 NodeCompositorFileOutput *nimf = (NodeCompositorFileOutput *)node->storage;
3712 }
3713 }
3714 }
3715 }
3716 }
3718
3719 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3720 version_fix_image_format_copy(bmain, &scene->r.im_format);
3721 }
3722 }
3723
3724 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 5)) {
3725 /* Fix for #98925 - remove channels region, that was initialized in incorrect editor types. */
3726 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3727 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3728 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3729 if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_CLIP, SPACE_GRAPH, SPACE_NLA, SPACE_SEQ)) {
3730 continue;
3731 }
3732
3733 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3734 &sl->regionbase;
3735 ARegion *channels_region = BKE_region_find_in_listbase_by_type(regionbase,
3737 if (channels_region) {
3738 MEM_delete(channels_region->runtime);
3739 BLI_freelinkN(regionbase, channels_region);
3740 }
3741 }
3742 }
3743 }
3744 }
3745
3746 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 6)) {
3747 /* Initialize brush curves sculpt settings. */
3748 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3749 if (brush->ob_mode != OB_MODE_SCULPT_CURVES) {
3750 continue;
3751 }
3752 brush->curves_sculpt_settings->density_add_attempts = 100;
3753 }
3754
3755 /* Disable 'show_bounds' option of curve objects. Option was set as there was no object mode
3756 * outline implementation. See #95933. */
3757 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3758 if (ob->type == OB_CURVES) {
3759 ob->dtx &= ~OB_DRAWBOUNDOX;
3760 }
3761 }
3762
3764 }
3765
3766 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 1)) {
3767 /* Image generation information transferred to tiles. */
3768 if (!DNA_struct_member_exists(fd->filesdna, "ImageTile", "int", "gen_x")) {
3769 LISTBASE_FOREACH (Image *, ima, &bmain->images) {
3770 LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
3771 tile->gen_x = ima->gen_x;
3772 tile->gen_y = ima->gen_y;
3773 tile->gen_type = ima->gen_type;
3774 tile->gen_flag = ima->gen_flag;
3775 tile->gen_depth = ima->gen_depth;
3776 copy_v4_v4(tile->gen_color, ima->gen_color);
3777 }
3778 }
3779 }
3780
3781 /* Convert mix rgb node to new mix node and add storage. */
3782 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3784 }
3786
3787 /* Face sets no longer store whether the corresponding face is hidden. */
3788 LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
3789 int *face_sets = (int *)CustomData_get_layer(&mesh->face_data, CD_SCULPT_FACE_SETS);
3790 if (face_sets) {
3791 for (int i = 0; i < mesh->faces_num; i++) {
3792 face_sets[i] = abs(face_sets[i]);
3793 }
3794 }
3795 }
3796
3797 /* Custom grids in UV Editor have separate X and Y divisions. */
3798 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3799 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3800 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3801 switch (sl->spacetype) {
3802 case SPACE_IMAGE: {
3803 SpaceImage *sima = (SpaceImage *)sl;
3804 sima->custom_grid_subdiv[0] = 10;
3805 sima->custom_grid_subdiv[1] = 10;
3806 break;
3807 }
3808 }
3809 }
3810 }
3811 }
3812 }
3813
3814 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 2)) {
3815 /* Initialize brush curves sculpt settings. */
3816 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3817 brush->automasking_cavity_factor = 0.5f;
3818 }
3819 }
3820
3821 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 3)) {
3822 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3823 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3824 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3825 if (sl->spacetype == SPACE_VIEW3D) {
3826 View3D *v3d = (View3D *)sl;
3827 v3d->flag2 |= V3D_SHOW_VIEWER;
3830 }
3831 if (sl->spacetype == SPACE_IMAGE) {
3832 SpaceImage *sima = (SpaceImage *)sl;
3833 if (sima->flag & SI_FLAG_UNUSED_18) { /* Was #SI_CUSTOM_GRID. */
3835 sima->flag &= ~SI_FLAG_UNUSED_18;
3836 }
3837 }
3838 }
3839 }
3840 }
3841
3842 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3843 if (ntree->type != NTREE_GEOMETRY) {
3844 continue;
3845 }
3846 version_node_id(ntree, GEO_NODE_OFFSET_POINT_IN_CURVE, "GeometryNodeOffsetPointInCurve");
3847 }
3848 }
3849
3850 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 4)) {
3851 /* Update brush sculpt settings. */
3852 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3853 brush->automasking_cavity_factor = 1.0f;
3854 }
3855 }
3856
3857 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 5)) {
3858 /* Fix for #101622 - update flags of sequence editor regions that were not initialized
3859 * properly. */
3860 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3861 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3862 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3863 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3864 &sl->regionbase;
3865 if (sl->spacetype == SPACE_SEQ) {
3866 LISTBASE_FOREACH (ARegion *, region, regionbase) {
3867 if (region->regiontype == RGN_TYPE_TOOLS) {
3868 region->v2d.flag &= ~V2D_VIEWSYNC_AREA_VERTICAL;
3869 }
3870 if (region->regiontype == RGN_TYPE_CHANNELS) {
3871 region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
3872 }
3873 }
3874 }
3875 }
3876 }
3877 }
3878 }
3879
3880 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 6)) {
3881 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3882 if (ntree->type != NTREE_GEOMETRY) {
3883 continue;
3884 }
3885 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3886 if (node->type_legacy != GEO_NODE_SAMPLE_CURVE) {
3887 continue;
3888 }
3889 static_cast<NodeGeometryCurveSample *>(node->storage)->use_all_curves = true;
3890 static_cast<NodeGeometryCurveSample *>(node->storage)->data_type = CD_PROP_FLOAT;
3891 bNodeSocket *curve_socket = blender::bke::node_find_socket(*node, SOCK_IN, "Curve");
3892 BLI_assert(curve_socket != nullptr);
3893 STRNCPY_UTF8(curve_socket->name, "Curves");
3894 STRNCPY_UTF8(curve_socket->identifier, "Curves");
3895 }
3896 }
3897 }
3898
3899 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 2)) {
3900 LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
3901 MovieTracking *tracking = &clip->tracking;
3902
3903 const float frame_center_x = float(clip->lastsize[0]) / 2;
3904 const float frame_center_y = float(clip->lastsize[1]) / 2;
3905
3906 tracking->camera.principal_point[0] = (tracking->camera.principal_legacy[0] -
3907 frame_center_x) /
3908 frame_center_x;
3909 tracking->camera.principal_point[1] = (tracking->camera.principal_legacy[1] -
3910 frame_center_y) /
3911 frame_center_y;
3912 }
3913 }
3914
3915 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 4)) {
3916 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3917 if (ntree->type == NTREE_GEOMETRY) {
3918 version_node_socket_name(ntree, GEO_NODE_COLLECTION_INFO, "Geometry", "Instances");
3919 }
3920 }
3921
3922 /* UVSeam fixing distance. */
3923 if (!DNA_struct_member_exists(fd->filesdna, "Image", "short", "seam_margin")) {
3924 LISTBASE_FOREACH (Image *, image, &bmain->images) {
3925 image->seam_margin = 8;
3926 }
3927 }
3928
3929 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3930 if (ntree->type == NTREE_GEOMETRY) {
3932 }
3933 }
3934 }
3935
3936 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 6)) {
3937 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3938 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3939 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3940 if (sl->spacetype == SPACE_VIEW3D) {
3941 View3D *v3d = (View3D *)sl;
3944 }
3945 }
3946 }
3947 }
3948 }
3949
3950 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 7)) {
3951 LISTBASE_FOREACH (Light *, light, &bmain->lights) {
3952 light->radius = light->area_size;
3953 }
3954 /* Grease Pencil Build modifier:
3955 * Set default value for new natural draw-speed factor and maximum gap. */
3956 if (!DNA_struct_member_exists(
3957 fd->filesdna, "BuildGpencilModifierData", "float", "speed_fac") ||
3958 !DNA_struct_member_exists(
3959 fd->filesdna, "BuildGpencilModifierData", "float", "speed_maxgap"))
3960 {
3961 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3962 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
3963 if (md->type == eGpencilModifierType_Build) {
3965 mmd->speed_fac = 1.2f;
3966 mmd->speed_maxgap = 0.5f;
3967 }
3968 }
3969 }
3970 }
3971 }
3972
3973 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 8)) {
3974 const int CV_SCULPT_SELECTION_ENABLED = (1 << 1);
3975 LISTBASE_FOREACH (Curves *, curves_id, &bmain->hair_curves) {
3976 curves_id->flag &= ~CV_SCULPT_SELECTION_ENABLED;
3977 }
3978 LISTBASE_FOREACH (Curves *, curves_id, &bmain->hair_curves) {
3979 AttributeOwner owner = AttributeOwner::from_id(&curves_id->id);
3980 BKE_attribute_rename(owner, ".selection_point_float", ".selection", nullptr);
3981 BKE_attribute_rename(owner, ".selection_curve_float", ".selection", nullptr);
3982 }
3983
3984 /* Toggle the Invert Vertex Group flag on Armature modifiers in some cases. */
3985 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3986 bool after_armature = false;
3987 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
3988 if (md->type == eModifierType_Armature) {
3990 if (amd->multi) {
3991 /* Toggle the invert vertex group flag on operational Multi Modifier entries. */
3992 if (after_armature && amd->defgrp_name[0]) {
3994 }
3995 }
3996 else {
3997 /* Disabled multi modifiers don't reset propagation, but non-multi ones do. */
3998 after_armature = false;
3999 }
4000 /* Multi Modifier is only valid and operational after an active Armature modifier. */
4001 if (md->mode & (eModifierMode_Realtime | eModifierMode_Render)) {
4002 after_armature = true;
4003 }
4004 }
4006 /* These modifiers will also allow a following Multi Modifier to work. */
4007 after_armature = (md->mode & (eModifierMode_Realtime | eModifierMode_Render)) != 0;
4008 }
4009 else {
4010 after_armature = false;
4011 }
4012 }
4013 }
4014 }
4015
4016 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 9)) {
4017 /* Enable legacy normal and rotation outputs in Distribute Points on Faces node. */
4018 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
4019 if (ntree->type != NTREE_GEOMETRY) {
4020 continue;
4021 }
4022 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
4023 if (node->type_legacy != GEO_NODE_DISTRIBUTE_POINTS_ON_FACES) {
4024 continue;
4025 }
4026 node->custom2 = true;
4027 }
4028 }
4029 }
4030
4031 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 10)) {
4032 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4033 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4034 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4035 if (sl->spacetype != SPACE_FILE) {
4036 continue;
4037 }
4038 SpaceFile *sfile = reinterpret_cast<SpaceFile *>(sl);
4039 if (!sfile->asset_params) {
4040 continue;
4041 }
4042
4043 /* When an asset browser uses the default import method, make it follow the new
4044 * preference setting. This means no effective default behavior change. */
4047 }
4048 }
4049 }
4050 }
4051
4052 if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "int", "shadow_pool_size")) {
4053 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4054 scene->eevee.flag |= SCE_EEVEE_SHADOW_ENABLED;
4055 scene->eevee.shadow_pool_size = 512;
4056 }
4057 }
4058
4059 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4060 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4061 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4062 if (sl->spacetype == SPACE_VIEW3D) {
4063 View3D *v3d = (View3D *)sl;
4066 }
4067 }
4068 }
4069 }
4070
4071 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
4072 if (brush->ob_mode == OB_MODE_SCULPT_CURVES) {
4073 if (brush->curves_sculpt_settings->curve_parameter_falloff == nullptr) {
4074 brush->curves_sculpt_settings->curve_parameter_falloff = BKE_curvemapping_add(
4075 1, 0.0f, 0.0f, 1.0f, 1.0f);
4076 }
4077 }
4078 }
4079 }
4080
4081 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 3)) {
4082 /* Z bias for retopology overlay. */
4083 if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "retopology_offset")) {
4084 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4085 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4086 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4087 if (sl->spacetype == SPACE_VIEW3D) {
4088 View3D *v3d = (View3D *)sl;
4089 v3d->overlay.retopology_offset = 0.2f;
4090 }
4091 }
4092 }
4093 }
4094 }
4095
4096 /* Use `SEQ_SINGLE_FRAME_CONTENT` flag instead of weird function to check if strip has multiple
4097 * frames. */
4098 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4100 if (ed != nullptr) {
4102 }
4103 }
4104
4105 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
4106 if (ntree->type == NTREE_GEOMETRY) {
4108 }
4109 }
4110 }
4111
4112 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 5)) {
4113 /* Some regions used to be added/removed dynamically. Ensure they are always there, there is a
4114 * `ARegionType.poll()` now. */
4115 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4116 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4117 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4119
4120 /* Ensure expected region state. Previously this was modified to hide/unhide regions. */
4121
4122 const ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
4123 &sl->regionbase;
4124 if (sl->spacetype == SPACE_SEQ) {
4125 ARegion *region_main = BKE_region_find_in_listbase_by_type(regionbase,
4127 region_main->flag &= ~RGN_FLAG_HIDDEN;
4128 region_main->alignment = RGN_ALIGN_NONE;
4129
4130 ARegion *region_preview = BKE_region_find_in_listbase_by_type(regionbase,
4132 region_preview->flag &= ~RGN_FLAG_HIDDEN;
4133 region_preview->alignment = RGN_ALIGN_NONE;
4134
4135 ARegion *region_channels = BKE_region_find_in_listbase_by_type(regionbase,
4137 region_channels->alignment = RGN_ALIGN_LEFT;
4138 }
4139 }
4140 }
4141
4142 /* Replace old hard coded names with brush names, see: #106057. */
4143 const char *tool_replace_table[][2] = {
4144 {"selection_paint", "Paint Selection"},
4145 {"add", "Add"},
4146 {"delete", "Delete"},
4147 {"density", "Density"},
4148 {"comb", "Comb"},
4149 {"snake_hook", "Snake Hook"},
4150 {"grow_shrink", "Grow / Shrink"},
4151 {"pinch", "Pinch"},
4152 {"puff", "Puff"},
4153 {"smooth", "Comb"},
4154 {"slide", "Slide"},
4155 };
4156 LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
4160 "builtin_brush.",
4161 tool_replace_table,
4162 ARRAY_SIZE(tool_replace_table));
4163 }
4164 }
4165
4166 /* Rename Grease Pencil weight draw brush. */
4167 do_versions_rename_id(bmain, ID_BR, "Draw Weight", "Weight Draw");
4168 }
4169
4170 /* `fcm->name` was never used to store modifier name so it has always been an empty string.
4171 * Now this property supports name editing. So assign value to name variable of F-modifier
4172 * otherwise modifier interface would show an empty name field.
4173 * Also ensure uniqueness when opening old files. */
4174 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 7)) {
4175 LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
4176 LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
4177 LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) {
4178 BKE_fmodifier_name_set(fcm, "");
4179 }
4180 }
4181 }
4182 }
4183
4184 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 8)) {
4185 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
4186 ob->flag |= OB_FLAG_USE_SIMULATION_CACHE;
4187 }
4188 }
4189
4190 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 9)) {
4191 /* Fix sound strips with speed factor set to 0. See #107289. */
4192 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4194 if (ed != nullptr) {
4196 }
4197 }
4198
4199 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4200 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4201 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4202 if (sl->spacetype == SPACE_ACTION) {
4203 SpaceAction *saction = reinterpret_cast<SpaceAction *>(sl);
4205 }
4206 }
4207 }
4208 }
4209
4210 /* Enable the iTaSC ITASC_TRANSLATE_ROOT_BONES flag for backward compatibility.
4211 * See #104606. */
4212 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
4213 if (ob->type != OB_ARMATURE || ob->pose == nullptr) {
4214 continue;
4215 }
4216 bPose *pose = ob->pose;
4217 if (pose->iksolver != IKSOLVER_ITASC || pose->ikparam == nullptr) {
4218 continue;
4219 }
4220 bItasc *ikparam = (bItasc *)pose->ikparam;
4221 ikparam->flag |= ITASC_TRANSLATE_ROOT_BONES;
4222 }
4223 }
4224
4225 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 10)) {
4226 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4227 /* Set default values for new members. */
4228 short snap_mode_geom = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 4) | (1 << 5);
4229 scene->toolsettings->snap_mode_tools = snap_mode_geom;
4230 scene->toolsettings->plane_axis = 2;
4231 }
4232 }
4233
4234 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 11)) {
4236
4237 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4238 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4239 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4240 /* #107870: Movie Clip Editor hangs in "Clip" view */
4241 if (sl->spacetype == SPACE_CLIP) {
4242 const ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
4243 &sl->regionbase;
4244 ARegion *region_main = BKE_region_find_in_listbase_by_type(regionbase,
4246 region_main->flag &= ~RGN_FLAG_HIDDEN;
4247 ARegion *region_tools = BKE_region_find_in_listbase_by_type(regionbase,
4249 region_tools->alignment = RGN_ALIGN_LEFT;
4250 if (!(region_tools->flag & RGN_FLAG_HIDDEN_BY_USER)) {
4251 region_tools->flag &= ~RGN_FLAG_HIDDEN;
4252 }
4253 }
4254 }
4255 }
4256 }
4257
4258 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
4259 if (ntree->type == NTREE_COMPOSIT) {
4260 version_node_socket_name(ntree, CMP_NODE_LENSDIST, "Distort", "Distortion");
4261 }
4262 }
4264 }
4265
4266 {
4267 /* Keep this block, even when empty. */
4268 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4269 scene->toolsettings->uvcalc_iterations = 10;
4270 scene->toolsettings->uvcalc_weight_factor = 1.0f;
4271 STRNCPY_UTF8(scene->toolsettings->uvcalc_weight_group, "uv_importance");
4272 }
4273 }
4274
4281}
Blender kernel action and pose functionality.
void BKE_action_groups_reconstruct(bAction *act)
void BKE_animdata_main_cb(struct Main *bmain, blender::FunctionRef< void(ID *, AnimData *)> func)
AnimData * BKE_animdata_from_id(const ID *id)
Definition anim_data.cc:83
void vec_roll_to_mat3(const float vec[3], float roll, float r_mat[3][3])
void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll)
void BKE_asset_library_reference_init_default(AssetLibraryReference *library_ref)
Definition asset.cc:149
void BKE_id_attributes_default_color_set(struct ID *id, std::optional< blender::StringRef > name)
bool BKE_attribute_rename(AttributeOwner &owner, blender::StringRef old_name, blender::StringRef new_name, struct ReportList *reports)
Definition attribute.cc:251
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< blender::StringRef > name)
Definition attribute.cc:985
#define BKE_SCENE_COLLECTION_NAME
CurveMapping * BKE_curvemapping_copy(const CurveMapping *cumap)
CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition colortools.cc:89
void BKE_curvemapping_free(CurveMapping *cumap)
@ CTX_MODE_SCULPT_CURVES
void BKE_nurb_knot_calc_u(Nurb *nu)
Definition curve.cc:1189
void BKE_nurb_knot_calc_v(Nurb *nu)
Definition curve.cc:1194
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
int CustomData_get_active_layer_index(const CustomData *data, eCustomDataType type)
int CustomData_get_render_layer_index(const CustomData *data, eCustomDataType type)
support for deformation groups and hooks.
void BKE_object_defgroup_active_index_set(Object *ob, int new_index)
Definition deform.cc:612
int BKE_object_defgroup_active_index_get(const Object *ob)
Definition deform.cc:607
ListBase * BKE_object_defgroup_list_mutable(Object *ob)
Definition deform.cc:596
void BKE_fmodifier_name_set(FModifier *fcm, const char *name)
FCurve * BKE_fcurve_find(ListBase *list, const char rna_path[], int array_index)
FCurve * id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, bool *r_driven)
#define DRIVER_TARGETS_LOOPER_BEGIN(dvar)
#define DRIVER_TARGETS_LOOPER_END
IDProperty * IDP_GetPropertyFromGroup(const IDProperty *prop, blender::StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:747
void IDP_FreeFromGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:741
float IDP_coerce_to_float_or_zero(const IDProperty *prop)
Definition idprop.cc:829
eIDPropertyUIDataType IDP_ui_data_type(const IDProperty *prop)
Definition idprop.cc:1691
bool IDP_ui_data_supported(const IDProperty *prop)
Definition idprop.cc:1713
#define IDP_array_double_get(prop)
@ IDP_UI_DATA_TYPE_ID
@ IDP_UI_DATA_TYPE_BOOLEAN
@ IDP_UI_DATA_TYPE_UNSUPPORTED
@ IDP_UI_DATA_TYPE_INT
@ IDP_UI_DATA_TYPE_FLOAT
@ IDP_UI_DATA_TYPE_STRING
int IDP_coerce_to_int_or_zero(const IDProperty *prop)
Definition idprop.cc:797
#define IDP_string_get(prop)
#define IDP_array_int_get(prop)
double IDP_coerce_to_double_or_zero(const IDProperty *prop)
Definition idprop.cc:813
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:717
IDProperty * IDP_GetProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition idprop.cc:877
IDPropertyUIData * IDP_ui_data_ensure(IDProperty *prop)
Definition idprop.cc:1761
#define IDP_array_float_get(prop)
void BKE_image_ensure_tile_token(char *filepath, size_t filepath_maxncpy)
void BKE_main_id_repair_duplicate_names_listbase(Main *bmain, ListBase *lb)
Definition lib_id.cc:1258
void id_sort_by_name(ListBase *lb, ID *id, ID *id_sorting_hint)
Definition lib_id.cc:1790
void id_fake_user_set(ID *id)
Definition lib_id.cc:396
bool BKE_lib_override_library_property_rna_path_change(IDOverrideLibrary *liboverride, const char *old_rna_path, const char *new_rna_path)
void BKE_lib_override_library_property_operation_delete(IDOverrideLibraryProperty *liboverride_property, IDOverrideLibraryPropertyOperation *liboverride_property_operation)
IDOverrideLibraryProperty * BKE_lib_override_library_property_find(IDOverrideLibrary *liboverride, const char *rna_path)
bool BKE_lib_override_library_property_search_and_delete(IDOverrideLibrary *liboverride, const char *rna_path)
bool BKE_lib_override_library_is_user_edited(const ID *id)
#define FOREACH_MAIN_ID_END
Definition BKE_main.hh:583
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 FOREACH_MAIN_LISTBASE_END
Definition BKE_main.hh:564
#define FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb)
Definition BKE_main.hh:557
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
Definition BKE_main.hh:577
bool BKE_main_namemap_validate_and_fix(Main &bmain)
void BKE_modifier_unique_name(ListBase *modifiers, ModifierData *md)
ModifierData * BKE_modifier_new(int type)
bool BKE_nlatrack_has_strips(ListBase *tracks)
#define NODE_GROUP_OUTPUT
Definition BKE_node.hh:815
#define FOREACH_NODETREE_END
Definition BKE_node.hh:881
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition BKE_node.hh:871
#define NODE_GROUP_INPUT
Definition BKE_node.hh:814
#define GEO_NODE_SET_POSITION
#define GEO_NODE_MERGE_BY_DISTANCE
#define GEO_NODE_TRIANGULATE
#define GEO_NODE_SET_CURVE_HANDLES
#define GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE
#define GEO_NODE_SUBDIVISION_SURFACE
#define SH_NODE_MIX_RGB_LEGACY
#define GEO_NODE_CURVE_SPLINE_PARAMETER
#define GEO_NODE_MESH_PRIMITIVE_CIRCLE
#define GEO_NODE_SAMPLE_NEAREST_SURFACE
#define GEO_NODE_SEPARATE_COMPONENTS
#define GEO_NODE_POINTS_TO_VERTICES
#define GEO_NODE_BOUNDING_BOX
#define GEO_NODE_SUBDIVIDE_MESH
#define SH_NODE_BSDF_PRINCIPLED
#define GEO_NODE_SET_POINT_RADIUS
#define GEO_NODE_VIEWER
#define GEO_NODE_SET_CURVE_TILT
#define SH_NODE_SUBSURFACE_SCATTERING
#define GEO_NODE_OFFSET_POINT_IN_CURVE
#define SH_NODE_MAP_RANGE
#define GEO_NODE_INPUT_MESH_ISLAND
#define GEO_NODE_MESH_PRIMITIVE_CUBE
#define GEO_NODE_DISTRIBUTE_POINTS_ON_FACES
#define GEO_NODE_MESH_PRIMITIVE_CONE
#define GEO_NODE_REPLACE_MATERIAL
#define GEO_NODE_REVERSE_CURVE
#define GEO_NODE_MESH_BOOLEAN
#define GEO_NODE_TRANSLATE_INSTANCES
#define GEO_NODE_MESH_PRIMITIVE_LINE
#define GEO_NODE_TRIM_CURVE
#define FN_NODE_COMPARE
#define GEO_NODE_SWITCH
#define CMP_NODE_LENSDIST
#define GEO_NODE_FILLET_CURVE
#define GEO_NODE_MESH_PRIMITIVE_CYLINDER
#define GEO_NODE_CURVE_SPLINE_TYPE
#define GEO_NODE_MESH_PRIMITIVE_UV_SPHERE
#define GEO_NODE_SUBDIVIDE_CURVE
#define GEO_NODE_MESH_PRIMITIVE_GRID
#define GEO_NODE_SPLIT_EDGES
#define CMP_NODE_OUTPUT_FILE
#define GEO_NODE_ROTATE_INSTANCES
#define GEO_NODE_INPUT_MESH_EDGE_ANGLE
#define GEO_NODE_REALIZE_INSTANCES
#define GEO_NODE_RESAMPLE_CURVE
#define GEO_NODE_INPUT_INDEX
#define GEO_NODE_SAMPLE_CURVE
#define SH_NODE_MIX
#define GEO_NODE_CAPTURE_ATTRIBUTE
#define GEO_NODE_FILL_CURVE
#define GEO_NODE_CURVE_LENGTH
#define GEO_NODE_CURVE_TO_MESH
#define GEO_NODE_STRING_TO_CURVES
#define GEO_NODE_POINTS_TO_VOLUME
#define GEO_NODE_SAMPLE_INDEX
#define GEO_NODE_COLLECTION_INFO
#define GEO_NODE_TRANSFER_ATTRIBUTE_DEPRECATED
#define GEO_NODE_SET_MATERIAL
#define GEO_NODE_SCALE_INSTANCES
#define GEO_NODE_SET_CURVE_RADIUS
#define GEO_NODE_CONVEX_HULL
#define GEO_NODE_JOIN_GEOMETRY
#define GEO_NODE_SAMPLE_NEAREST
#define FN_NODE_SLICE_STRING
ARegion * BKE_region_find_in_listbase_by_type(const ListBase *regionbase, const int region_type)
Definition screen.cc:835
void void BKE_workspace_tool_id_replace_table(WorkSpace *workspace, const int space_type, const int mode, const char *idname_prefix_skip, const char *replace_table[][2], int replace_table_num) ATTR_NONNULL(1
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:534
void void void BLI_movelisttolist(ListBase *dst, ListBase *src) ATTR_NONNULL(1
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void void * BLI_listbase_string_or_index_find(const ListBase *listbase, const char *string, size_t string_offset, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:754
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:270
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
Definition listbase.cc:497
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:332
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_listbase_swaplinks(ListBase *listbase, void *vlinka, void *vlinkb) ATTR_NONNULL(1
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:524
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
#define BLI_ASSERT_UNIT_V3(v)
MINLINE float safe_sqrtf(float a)
void unit_m3(float m[3][3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE bool compare_v3v3(const float v1[3], const float v2[3], float limit) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE float normalize_v3(float n[3])
bool BLI_path_extension_check(const char *path, const char *ext) ATTR_NONNULL(1
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Definition string.cc:41
#define SNPRINTF(dst, format,...)
Definition BLI_string.h:604
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int bool bool BLI_str_endswith(const char *__restrict str, const char *__restrict end) ATTR_NONNULL(1
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define SNPRINTF_UTF8(dst, format,...)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
void BLI_uniquename(const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
#define BLI_string_join(...)
char * BLI_string_replaceN(const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
unsigned int uint
#define ARRAY_SIZE(arr)
#define UNUSED_VARS_NDEBUG(...)
#define ELEM(...)
#define STREQ(a, b)
external readfile function prototypes.
#define CLOG_ERROR(clg_ref,...)
Definition CLG_log.h:188
#define FILTER_ID_ALL
Definition DNA_ID.h:1239
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
Definition DNA_ID.h:723
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:694
#define FILTER_ID_GR
Definition DNA_ID.h:1203
#define MAX_IDPROP_NAME
Definition DNA_ID.h:186
@ LIBOVERRIDE_OP_INSERT_AFTER
Definition DNA_ID.h:240
@ LIBOVERRIDE_FLAG_SYSTEM_DEFINED
Definition DNA_ID.h:363
@ ID_BR
@ ID_VF
@ ID_OB
@ IDP_DOUBLE
@ IDP_FLOAT
@ IDP_STRING
@ IDP_INT
@ IDP_GROUP
@ IDP_ARRAY
@ IKSOLVER_ITASC
@ ITASC_TRANSLATE_ROOT_BONES
@ TIME_CACHE_SIMULATION_NODES
@ SACTCONT_TIMELINE
@ NLASTRIP_EXTEND_HOLD_FORWARD
@ NLASTRIP_EXTEND_HOLD
@ ARM_DEF_INVERT_VGROUP
@ BBONE_ADD_PARENT_END_ROLL
@ BRUSH_CURVE_SPHERE
@ SCULPT_BRUSH_TYPE_SMEAR
@ BRUSH_ALPHA_PRESSURE
@ BRUSH_SPACE_ATTEN
Object groups, one object can be in many groups at once.
@ COLORMANAGE_VIEW_USE_CURVES
@ CONSTRAINT_TYPE_SPLINEIK
@ CU_NURB_CYCLIC
@ CU_NURB_ENDPOINT
@ CU_NURB_BEZIER
@ CD_PROP_BYTE_COLOR
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
@ CD_PROP_COLOR
blenloader genfile private function prototypes
@ eGpencilModifierType_Lineart
@ eGpencilModifierType_Smooth
@ eGpencilModifierType_Build
@ IMA_SRC_TILED
@ IMA_TYPE_R_RESULT
@ IMA_TYPE_COMPOSITE
@ MOD_LINEART_USE_CREASE_ON_SMOOTH_SURFACES
These structs are the foundation for all linked lists in the library system.
@ MASK_DRAWFLAG_SPLINE
@ LRT_MATERIAL_CUSTOM_OCCLUSION_EFFECTIVENESS
@ DT_LAYERS_ALL_SRC
@ DT_LAYERS_NAME_DST
@ DT_MULTILAYER_INDEX_MAX
@ eModifierMode_Render
@ eModifierMode_Realtime
@ MOD_WVG_PROXIMITY_WEIGHTS_NORMALIZE
@ MOD_WVG_PROXIMITY_INVERT_VGROUP_MASK
@ MOD_LINEART_USE_CACHE
@ eModifierType_MeshDeform
@ eModifierType_Mirror
@ eModifierType_WeightVGProximity
@ eModifierType_Lattice
@ eModifierType_DataTransfer
@ eModifierType_Armature
@ eModifierType_SurfaceDeform
@ eModifierType_Nodes
@ SHD_SUBSURFACE_BURLEY
@ SHD_SUBSURFACE_RANDOM_WALK_SKIN
@ SHD_SUBSURFACE_RANDOM_WALK
@ GEO_NODE_EXTRUDE_MESH_EDGES
@ NODE_DO_OUTPUT
@ NTREE_CUSTOM
@ NTREE_SHADER
@ NTREE_GEOMETRY
@ NTREE_COMPOSIT
@ SOCK_OUT
@ SOCK_IN
@ NODE_MIX_MODE_UNIFORM
@ GEO_NODE_MERGE_BY_DISTANCE_MODE_ALL
@ SOCK_INT
@ SOCK_TEXTURE
@ SOCK_VECTOR
@ SOCK_MATERIAL
@ SOCK_FLOAT
@ SOCK_COLLECTION
@ SOCK_GEOMETRY
@ SOCK_OBJECT
@ SOCK_RGBA
@ SHD_MIXRGB_CLAMP
@ GEO_NODE_ATTRIBUTE_TRANSFER_NEAREST_FACE_INTERPOLATED
@ GEO_NODE_ATTRIBUTE_TRANSFER_INDEX
@ GEO_NODE_ATTRIBUTE_TRANSFER_NEAREST
@ OB_MODE_SCULPT_CURVES
@ OB_HIDE_TRANSMISSION
@ OB_HOLDOUT
@ OB_HIDE_RENDER
@ OB_HIDE_CAMERA
@ OB_HIDE_SELECT
@ OB_HIDE_GLOSSY
@ OB_HIDE_SHADOW
@ OB_SHADOW_CATCHER
@ OB_HIDE_VIEWPORT
@ OB_HIDE_DIFFUSE
@ OB_HIDE_VOLUME_SCATTER
@ OB_DRAWBOUNDOX
@ OB_LATTICE
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_GPENCIL_LEGACY
@ OB_CURVES
@ OB_FLAG_USE_SIMULATION_CACHE
@ SEQ_OVERLAP_SHUFFLE
@ GP_PROJECT_VIEWSPACE
@ GP_PROJECT_CURSOR
@ SCE_SNAP_TO_INCLUDE_EDITED
@ SCE_SNAP
@ SCE_SNAP_TO_INCLUDE_NONEDITED
@ SCE_EEVEE_SHADOW_ENABLED
@ SEQ_SNAP_TO_STRIPS
@ SEQ_SNAP_TO_STRIP_HOLD
@ SEQ_SNAP_TO_CURRENT_FRAME
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ RGN_ALIGN_NONE
@ RGN_TYPE_CHANNELS
@ RGN_TYPE_TOOL_HEADER
@ RGN_TYPE_EXECUTE
@ RGN_TYPE_UI
@ RGN_TYPE_WINDOW
@ RGN_TYPE_PREVIEW
@ RGN_TYPE_FOOTER
@ RGN_TYPE_HEADER
@ RGN_TYPE_TOOLS
@ RGN_TYPE_TOOL_PROPS
@ RGN_FLAG_DYNAMIC_SIZE
@ RGN_FLAG_HIDDEN
@ RGN_FLAG_HIDDEN_BY_USER
@ eSeqModifierType_ColorBalance
@ SEQ_SPEED_STRETCH
@ SEQ_SPEED_MULTIPLY
@ SEQ_SPEED_LENGTH
@ SEQ_SPEED_FRAME_NUMBER
@ STRIP_TYPE_SOUND_RAM
@ STRIP_TYPE_IMAGE
@ STRIP_TYPE_SPEED
@ STRIP_TYPE_META
@ STRIP_COLOR_NONE
@ SEQ_TRANSFORM_FILTER_BILINEAR
@ SEQ_SINGLE_FRAME_CONTENT
@ SEQ_USE_EFFECT_DEFAULT_FADE
@ SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN
@ SN_OVERLAY_SHOW_PATH
@ SN_OVERLAY_SHOW_WIRE_COLORS
@ SN_OVERLAY_SHOW_OVERLAYS
@ SN_OVERLAY_SHOW_NAMED_ATTRIBUTES
@ SI_FLAG_UNUSED_18
@ SI_OVERLAY_SHOW_GRID_BACKGROUND
@ SPACE_TEXT
@ SPACE_CLIP
@ SPACE_ACTION
@ SPACE_OUTLINER
@ SPACE_NODE
@ SPACE_SPREADSHEET
@ SPACE_FILE
@ SPACE_NLA
@ SPACE_SEQ
@ SPACE_IMAGE
@ SPACE_GRAPH
@ SPACE_VIEW3D
@ SEQ_TIMELINE_SHOW_FCURVES
@ SEQ_TIMELINE_SHOW_STRIP_DURATION
@ SEQ_TIMELINE_SHOW_STRIP_OFFSETS
@ SEQ_TIMELINE_SHOW_STRIP_SOURCE
@ SEQ_TIMELINE_SHOW_STRIP_NAME
@ SEQ_TIMELINE_SHOW_GRID
@ SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG
@ SEQ_VIEW_SEQUENCE_PREVIEW
@ SEQ_VIEW_PREVIEW
@ FILE_ASSET_IMPORT_APPEND_REUSE
@ FILE_ASSET_IMPORT_APPEND
@ FILE_ASSET_IMPORT_FOLLOW_PREFS
@ FILE_BROWSE_MODE_ASSETS
@ SO_FILTER_CLEARED_1
@ SO_FILTER_NO_VIEW_LAYERS
@ SPREADSHEET_FILTER_ENABLE
@ SEQ_PREVIEW_SHOW_METADATA
@ SEQ_PREVIEW_SHOW_GPENCIL
@ SEQ_PREVIEW_SHOW_SAFE_MARGINS
@ SEQ_PREVIEW_SHOW_OUTLINE_SELECTED
@ SEQ_PREVIEW_SHOW_SAFE_CENTER
@ ST_FLAG_UNUSED_4
@ FILE_PARAMS_FLAG_UNUSED_3
@ FILE_PARAMS_FLAG_UNUSED_1
@ FILE_PARAMS_FLAG_UNUSED_2
@ FILE_PATH_TOKENS_ALLOW
@ SEQ_DRAW_IMG_IMBUF
@ SEQ_CLAMP_VIEW
@ SI_GRID_SHAPE_FIXED
#define FILE_SELECT_MAX_RECURSIONS
@ TXT_ISSCRIPT
@ V2D_VIEWSYNC_AREA_VERTICAL
@ V2D_SCROLL_RIGHT
@ V2D_SCROLL_BOTTOM
@ V2D_ALIGN_NO_NEG_Y
@ V3D_OFSDRAW_XR_SHOW_CUSTOM_OVERLAYS
@ V3D_OFSDRAW_SHOW_SELECTION
@ V3D_OFSDRAW_XR_SHOW_CONTROLLERS
@ V3D_SHOW_VIEWER
@ V3D_AROUND_CENTER_MEDIAN
@ V3D_OVERLAY_SCULPT_SHOW_FACE_SETS
@ V3D_OVERLAY_VIEWER_ATTRIBUTE
@ V3D_OVERLAY_SCULPT_SHOW_MASK
@ V3D_OVERLAY_FADE_INACTIVE
@ V3D_OVERLAY_SCULPT_CURVES_CAGE
static AppView * view
Read Guarded memory(de)allocation.
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_TRANSLATION
Definition RNA_types.hh:261
AttrDomain
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
btSequentialImpulseConstraintSolverMt int btPersistentManifold int btTypedConstraint ** constraints
static AttributeOwner from_id(ID *id)
Definition attribute.cc:44
bool add(const Key &key, const Value &value)
Definition BLI_map.hh:295
Value lookup_default(const Key &key, const Value &default_value) const
Definition BLI_map.hh:570
void add_new(const Key &key, const Value &value)
Definition BLI_map.hh:265
Span< Value > lookup(const Key &key) const
void add(const Key &key, const Value &value)
constexpr const T & first() const
Definition BLI_span.hh:315
constexpr int64_t size() const
Definition BLI_span.hh:252
constexpr bool is_empty() const
Definition BLI_span.hh:260
void append(const T &value)
bool is_empty() const
void append(const T &value)
bool is_empty() const
nullptr float
@ DENOISER_OPENIMAGEDENOISE
Definition denoise.h:13
#define offsetof(t, d)
#define GS(x)
uint nor
#define abs
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
const ccl_global KernelWorkTile * tile
format
#define LOG(level)
Definition log.h:97
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:133
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
std::unique_ptr< IDProperty, IDPropertyDeleter > create(StringRef prop_name, int32_t value, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_INT, set its name and value.
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
Definition node.cc:2532
void node_remove_node(Main *bmain, bNodeTree &ntree, bNode &node, bool do_id_user, bool remove_animation=true)
Definition node.cc:4386
void node_remove_socket(bNodeTree &ntree, bNode &node, bNodeSocket &sock)
Definition node.cc:3243
void node_tree_set_type(bNodeTree &ntree)
Definition node.cc:2254
bool node_set_selected(bNode &node, bool select)
Definition node.cc:4695
bNodeSocket * node_add_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, StringRefNull idname, StringRefNull identifier, StringRefNull name)
Definition node.cc:2804
void node_rebuild_id_vector(bNodeTree &node_tree)
Definition node.cc:4291
bNode * node_add_static_node(const bContext *C, bNodeTree &ntree, int type)
Definition node.cc:3500
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
Definition node.cc:3810
bNodeTree * node_tree_add_tree(Main *bmain, StringRef name, StringRef idname)
Definition node.cc:4085
bNodeSocket * node_add_static_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, int type, int subtype, StringRefNull identifier, StringRefNull name)
Definition node.cc:3197
std::optional< StringRefNull > node_static_socket_type(int type, int subtype, std::optional< int > dimensions=std::nullopt)
Definition node.cc:2835
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
void foreach_strip(ListBase *seqbase, ForEachFunc callback, void *user_data)
Definition iterator.cc:59
void channels_ensure(ListBase *channels)
Definition channels.cc:33
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:286
void retiming_data_clear(Strip *strip)
constexpr int MAX_CHANNELS
void time_update_meta_strip_range(const Scene *scene, Strip *strip_meta)
SequencerToolSettings * tool_settings_ensure(Scene *scene)
Definition sequencer.cc:375
int effect_get_num_inputs(int strip_type)
Definition effects.cc:327
const char * name
#define sqrtf
bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value)
const EnumPropertyItem rna_enum_property_subtype_items[]
Definition rna_rna.cc:126
#define min(a, b)
Definition sort.cc:36
ARegionRuntimeHandle * runtime
bAction * action
short act_extendmode
ListBase drivers
ListBase nla_tracks
float vec[3][3]
IDProperty * prop
ListBase childbase
char * rna_path
ChannelDriver * driver
BezTriple * bezt
int array_index
unsigned int totvert
AssetLibraryReference asset_library_ref
FileSelectParams base_params
SDNA * filesdna
Definition readfile.hh:105
struct GpencilModifierData * next
ListBase group
Definition DNA_ID.h:143
double * default_array
Definition DNA_ID.h:107
int * default_array
Definition DNA_ID.h:80
char * description
Definition DNA_ID.h:56
int len
Definition DNA_ID.h:175
char name[64]
Definition DNA_ID.h:164
IDPropertyData data
Definition DNA_ID.h:169
char subtype
Definition DNA_ID.h:161
char type
Definition DNA_ID.h:156
Definition DNA_ID.h:414
struct Library * lib
Definition DNA_ID.h:420
char name[258]
Definition DNA_ID.h:432
struct Image * stencil
struct Image * canvas
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 hair_curves
Definition BKE_main.hh:320
ListBase lights
Definition BKE_main.hh:288
ListBase nodetrees
Definition BKE_main.hh:301
ListBase materials
Definition BKE_main.hh:284
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 images
Definition BKE_main.hh:286
ListBase objects
Definition BKE_main.hh:280
struct ModifierData * next
MovieTrackingCamera camera
char name[64]
ListBase strips
struct bNodeTree * node_group
struct NodesModifierSettings settings
struct IDProperty * properties
unsigned int vertex_idx
struct AnimData * adt
ListBase spacedata
ListBase regionbase
FileSelectParams * params
FileAssetSelectParams * asset_params
SpaceImageOverlay overlay
int custom_grid_subdiv[2]
SpaceNodeOverlay overlay
struct SequencerTimelineOverlay timeline_overlay
ListBase regionbase
struct SequencerPreviewOverlay preview_overlay
StripTransform * transform
int8_t color_tag
StripData * data
float speed_factor
char name[64]
ListBase modifiers
ListBase channels
struct ImagePaintSettings imapaint
short snap_face_nearest_steps
float viewer_attribute_opacity
float normals_constant_screen_size
float sculpt_curves_cage_opacity
View3DOverlay overlay
ListBase curves
struct bConstraint * next
struct bNodeLink * link
struct bNodeSocket * next
void * default_value
char identifier[64]
bNodeTreeInterface tree_interface
ListBase nodes
ListBase links
int16_t custom1
ListBase inputs
float locx_legacy
struct bNode * parent
int16_t type_legacy
float locy_legacy
void * storage
char idname[64]
ListBase outputs
int16_t custom2
void * ikparam
float ymax
i
Definition text_draw.cc:230
max
Definition text_draw.cc:251
uint len
void sequencer_init_preview_region(ARegion *region)
#define STRIP_SPEED_INTEGRATE
static bool version_fix_seq_meta_range(Strip *strip, void *user_data)
static void versioning_replace_legacy_mix_rgb_node(bNodeTree *ntree)
static void version_geometry_nodes_primitive_uv_maps(bNodeTree &ntree)
static void version_idproperty_move_data_string(IDPropertyUIDataString *ui_data, const IDProperty *prop_ui_data)
static void move_vertex_group_names_to_object_data(Main *bmain)
static IDProperty * idproperty_find_ui_container(IDProperty *idprop_group)
#define STRIP_SPEED_COMPRESS_IPO_Y
static bool do_versions_sequencer_color_tags(Strip *strip, void *)
static void version_liboverride_nla_frame_start_end(ID *id, AnimData *adt)
static void version_idproperty_move_data_float(IDPropertyUIDataFloat *ui_data, const IDProperty *prop_ui_data)
static void strip_speed_factor_fix_rna_path(Strip *strip, ListBase *fcurves)
static bool version_set_seq_single_frame_content(Strip *strip, void *)
static void sort_linked_ids(Main *bmain)
static bool strip_transform_filter_set(Strip *strip, void *)
static void version_liboverride_rnacollections_insertion_animdata(ID *id)
static bNodeSocket * do_version_replace_float_size_with_vector(bNodeTree *ntree, bNode *node, bNodeSocket *socket)
static void do_versions_idproperty_bones_recursive(Bone *bone)
static void version_geometry_nodes_add_attribute_input_settings(NodesModifierData *nmd)
static void version_idproperty_ui_data(IDProperty *idprop_group)
static void do_version_bbone_len_scale_fcurve_fix(FCurve *fcu)
static bool version_merge_still_offsets(Strip *strip, void *)
static void version_nla_action_strip_hold(Main *bmain)
static void version_switch_node_input_prefix(Main *bmain)
static void version_liboverride_rnacollections_insertion_object(Object *object)
static void version_ensure_missing_regions(ScrArea *area, SpaceLink *sl)
static void legacy_vec_roll_to_mat3_normalized(const float nor[3], const float roll, float r_mat[3][3])
static void version_geometry_nodes_set_position_node_offset(bNodeTree *ntree)
static void version_idproperty_move_data_int(IDPropertyUIDataInt *ui_data, const IDProperty *prop_ui_data)
static void do_versions_sequencer_speed_effect_recursive(Scene *scene, const ListBase *seqbase)
static void do_versions_idproperty_ui_data(Main *bmain)
static void version_node_tree_socket_id_delim(bNodeTree *ntree)
static void do_version_bones_bbone_len_scale(ListBase *lb)
static void version_geometry_nodes_add_realize_instance_nodes(bNodeTree *ntree)
static void do_versions_idproperty_seq_recursive(ListBase *seqbase)
static void do_version_constraints_spline_ik_joint_bindings(ListBase *lb)
static void do_version_subsurface_methods(bNode *node)
static void version_liboverride_nla_strip_frame_start_end(IDOverrideLibrary *liboverride, const char *parent_rna_path, NlaStrip *strip)
static bNodeTree * add_realize_node_tree(Main *bmain)
static bool do_versions_sequencer_color_balance_sop(Strip *strip, void *)
static void version_fix_image_format_copy(Main *bmain, ImageFormatData *format)
static bool replace_bbone_len_scale_rnapath(char **p_old_path, int *p_index)
static void version_liboverride_rnacollections_insertion_object_constraints(ListBase *constraints, IDOverrideLibraryProperty *op)
void blo_do_versions_300(FileData *fd, Library *, Main *bmain)
static bool version_seq_fix_broken_sound_strips(Strip *strip, void *)
static bool strip_speed_factor_set(Strip *strip, void *user_data)
static void version_geometry_nodes_replace_transfer_attribute_node(bNodeTree *ntree)
static void correct_bone_roll_value(const float head[3], const float tail[3], const float check_x_axis[3], const float check_y_axis[3], float *r_roll)
void do_versions_after_linking_300(FileData *, Main *bmain)
static void assert_sorted_ids(Main *bmain)
static bool strip_meta_channels_ensure(Strip *strip, void *)
static void version_geometry_nodes_extrude_smooth_propagation(bNodeTree &ntree)
static void do_version_bones_roll(ListBase *lb)
static bool strip_transform_origin_set(Strip *strip, void *)
void add_realize_instances_before_socket(bNodeTree *ntree, bNode *node, bNodeSocket *geometry_socket)
ID * do_versions_rename_id(Main *bmain, const short id_type, const char *name_src, const char *name_dst)
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)
bNodeSocket & version_node_add_socket(bNodeTree &ntree, bNode &node, const eNodeSocketInOut in_out, const char *idname, const char *identifier)
void version_node_socket_id_delim(bNodeSocket *socket)
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_input_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
bNode & version_node_add_empty(bNodeTree &ntree, const char *idname)
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)
void version_socket_update_is_used(bNodeTree *ntree)
IDProperty * version_cycles_visibility_properties_from_ID(ID *id)
ARegion * do_versions_add_region(int regiontype, const char *)
void node_tree_relink_with_socket_id_map(bNodeTree &ntree, bNode &old_node, bNode &new_node, const Map< std::string, std::string > &map)
bNodeLink & version_node_add_link(bNodeTree &ntree, bNode &node_a, bNodeSocket &socket_a, bNode &node_b, bNodeSocket &socket_b)
ARegion * do_versions_ensure_region(ListBase *regionbase, int region_type, const char *, int link_after_region_type)
bNodeSocket * version_node_add_socket_if_not_exist(bNodeTree *ntree, bNode *node, int in_out, int type, int subtype, const char *identifier, const char *name)
ARegion * do_versions_add_region_if_not_found(ListBase *regionbase, int region_type, const char *, int link_after_region_type)
void version_node_output_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
void version_node_id(bNodeTree *ntree, const int node_type, const char *new_name)
uint8_t flag
Definition wm_window.cc:145