Blender V4.5
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_utils.hh"
27#include "BLI_utildefines.h"
28
29/* Define macros in `DNA_genfile.h`. */
30#define DNA_GENFILE_VERSIONING_MACROS
31
32#include "DNA_anim_types.h"
33#include "DNA_armature_types.h"
34#include "DNA_brush_types.h"
37#include "DNA_curve_types.h"
38#include "DNA_curves_types.h"
39#include "DNA_genfile.h"
41#include "DNA_light_types.h"
42#include "DNA_lineart_types.h"
43#include "DNA_listBase.h"
44#include "DNA_mask_types.h"
45#include "DNA_material_types.h"
46#include "DNA_mesh_types.h"
47#include "DNA_modifier_types.h"
48#include "DNA_movieclip_types.h"
49#include "DNA_screen_types.h"
50#include "DNA_sequence_types.h"
51#include "DNA_space_types.h"
52#include "DNA_text_types.h"
53#include "DNA_tracking_types.h"
55#include "DNA_workspace_types.h"
56
57#undef DNA_GENFILE_VERSIONING_MACROS
58
59#include "BKE_action.hh"
60#include "BKE_anim_data.hh"
61#include "BKE_animsys.h"
62#include "BKE_armature.hh"
63#include "BKE_asset.hh"
64#include "BKE_attribute.hh"
65#include "BKE_collection.hh"
66#include "BKE_colortools.hh"
67#include "BKE_curve.hh"
68#include "BKE_curves.hh"
69#include "BKE_customdata.hh"
70#include "BKE_data_transfer.h"
71#include "BKE_deform.hh"
72#include "BKE_fcurve.hh"
73#include "BKE_fcurve_driver.h"
74#include "BKE_idprop.hh"
75#include "BKE_image.hh"
76#include "BKE_lib_id.hh"
77#include "BKE_lib_override.hh"
78#include "BKE_main.hh"
79#include "BKE_main_namemap.hh"
80#include "BKE_mesh.hh"
81#include "BKE_modifier.hh"
82#include "BKE_nla.hh"
83#include "BKE_node.hh"
85#include "BKE_screen.hh"
86#include "BKE_workspace.hh"
87
88#include "RNA_access.hh"
89#include "RNA_enum_types.hh"
90#include "RNA_prototypes.hh"
91
92#include "BLO_readfile.hh"
93
94#include "readfile.hh"
95
96#include "SEQ_channels.hh"
97#include "SEQ_effects.hh"
98#include "SEQ_iterator.hh"
99#include "SEQ_retiming.hh"
100#include "SEQ_sequencer.hh"
101#include "SEQ_time.hh"
102
103#include "versioning_common.hh"
104
105static CLG_LogRef LOG = {"blo.readfile.doversion"};
106
108{
109 LISTBASE_FOREACH (IDProperty *, prop, &idprop_group->data.group) {
110 if (prop->type == IDP_GROUP && STREQ(prop->name, "_RNA_UI")) {
111 return prop;
112 }
113 }
114 return nullptr;
115}
116
118 const IDProperty *prop_ui_data)
119{
120 IDProperty *min = IDP_GetPropertyFromGroup(prop_ui_data, "min");
121 if (min != nullptr) {
122 ui_data->min = ui_data->soft_min = IDP_coerce_to_int_or_zero(min);
123 }
124 IDProperty *max = IDP_GetPropertyFromGroup(prop_ui_data, "max");
125 if (max != nullptr) {
126 ui_data->max = ui_data->soft_max = IDP_coerce_to_int_or_zero(max);
127 }
128 IDProperty *soft_min = IDP_GetPropertyFromGroup(prop_ui_data, "soft_min");
129 if (soft_min != nullptr) {
130 ui_data->soft_min = IDP_coerce_to_int_or_zero(soft_min);
131 ui_data->soft_min = std::min(ui_data->soft_min, ui_data->min);
132 }
133 IDProperty *soft_max = IDP_GetPropertyFromGroup(prop_ui_data, "soft_max");
134 if (soft_max != nullptr) {
135 ui_data->soft_max = IDP_coerce_to_int_or_zero(soft_max);
136 ui_data->soft_max = std::max(ui_data->soft_max, ui_data->max);
137 }
138 IDProperty *step = IDP_GetPropertyFromGroup(prop_ui_data, "step");
139 if (step != nullptr) {
140 ui_data->step = IDP_coerce_to_int_or_zero(soft_max);
141 }
142 IDProperty *default_value = IDP_GetPropertyFromGroup(prop_ui_data, "default");
143 if (default_value != nullptr) {
144 if (default_value->type == IDP_ARRAY) {
145 if (default_value->subtype == IDP_INT) {
146 ui_data->default_array = MEM_malloc_arrayN<int>(size_t(default_value->len), __func__);
147 memcpy(ui_data->default_array, IDP_Array(default_value), sizeof(int) * default_value->len);
148 ui_data->default_array_len = default_value->len;
149 }
150 }
151 else if (default_value->type == IDP_INT) {
152 ui_data->default_value = IDP_coerce_to_int_or_zero(default_value);
153 }
154 }
155}
156
158 const IDProperty *prop_ui_data)
159{
160 IDProperty *min = IDP_GetPropertyFromGroup(prop_ui_data, "min");
161 if (min != nullptr) {
162 ui_data->min = ui_data->soft_min = IDP_coerce_to_double_or_zero(min);
163 }
164 IDProperty *max = IDP_GetPropertyFromGroup(prop_ui_data, "max");
165 if (max != nullptr) {
166 ui_data->max = ui_data->soft_max = IDP_coerce_to_double_or_zero(max);
167 }
168 IDProperty *soft_min = IDP_GetPropertyFromGroup(prop_ui_data, "soft_min");
169 if (soft_min != nullptr) {
170 ui_data->soft_min = IDP_coerce_to_double_or_zero(soft_min);
171 ui_data->soft_min = std::max(ui_data->soft_min, ui_data->min);
172 }
173 IDProperty *soft_max = IDP_GetPropertyFromGroup(prop_ui_data, "soft_max");
174 if (soft_max != nullptr) {
175 ui_data->soft_max = IDP_coerce_to_double_or_zero(soft_max);
176 ui_data->soft_max = std::min(ui_data->soft_max, ui_data->max);
177 }
178 IDProperty *step = IDP_GetPropertyFromGroup(prop_ui_data, "step");
179 if (step != nullptr) {
181 }
182 IDProperty *precision = IDP_GetPropertyFromGroup(prop_ui_data, "precision");
183 if (precision != nullptr) {
184 ui_data->precision = IDP_coerce_to_int_or_zero(precision);
185 }
186 IDProperty *default_value = IDP_GetPropertyFromGroup(prop_ui_data, "default");
187 if (default_value != nullptr) {
188 if (default_value->type == IDP_ARRAY) {
189 const int array_len = default_value->len;
190 ui_data->default_array_len = array_len;
191 if (default_value->subtype == IDP_FLOAT) {
192 ui_data->default_array = MEM_malloc_arrayN<double>(size_t(array_len), __func__);
193 const float *old_default_array = static_cast<const float *>(IDP_Array(default_value));
194 for (int i = 0; i < ui_data->default_array_len; i++) {
195 ui_data->default_array[i] = double(old_default_array[i]);
196 }
197 }
198 else if (default_value->subtype == IDP_DOUBLE) {
199 ui_data->default_array = MEM_malloc_arrayN<double>(size_t(array_len), __func__);
200 memcpy(ui_data->default_array, IDP_Array(default_value), sizeof(double) * array_len);
201 }
202 }
203 else if (ELEM(default_value->type, IDP_DOUBLE, IDP_FLOAT)) {
204 ui_data->default_value = IDP_coerce_to_double_or_zero(default_value);
205 }
206 }
207}
208
210 const IDProperty *prop_ui_data)
211{
212 IDProperty *default_value = IDP_GetPropertyFromGroup(prop_ui_data, "default");
213 if (default_value != nullptr && default_value->type == IDP_STRING) {
214 ui_data->default_value = BLI_strdup(IDP_String(default_value));
215 }
216}
217
218static void version_idproperty_ui_data(IDProperty *idprop_group)
219{
220 /* `nullptr` check here to reduce verbosity of calls to this function. */
221 if (idprop_group == nullptr) {
222 return;
223 }
224
225 IDProperty *ui_container = idproperty_find_ui_container(idprop_group);
226 if (ui_container == nullptr) {
227 return;
228 }
229
230 LISTBASE_FOREACH (IDProperty *, prop, &idprop_group->data.group) {
231 IDProperty *prop_ui_data = IDP_GetPropertyFromGroup(ui_container, prop->name);
232 if (prop_ui_data == nullptr) {
233 continue;
234 }
235
236 if (!IDP_ui_data_supported(prop)) {
237 continue;
238 }
239
240 IDPropertyUIData *ui_data = IDP_ui_data_ensure(prop);
241
242 IDProperty *subtype = IDP_GetPropertyFromGroup(prop_ui_data, "subtype");
243 if (subtype != nullptr && subtype->type == IDP_STRING) {
244 const char *subtype_string = IDP_String(subtype);
245 int result = PROP_NONE;
247 ui_data->rna_subtype = result;
248 }
249
250 IDProperty *description = IDP_GetPropertyFromGroup(prop_ui_data, "description");
251 if (description != nullptr && description->type == IDP_STRING) {
252 ui_data->description = BLI_strdup(IDP_String(description));
253 }
254
255 /* Type specific data. */
256 switch (IDP_ui_data_type(prop)) {
259 break;
261 break;
264 break;
267 break;
271 break;
272 }
273
274 IDP_FreeFromGroup(ui_container, prop_ui_data);
275 }
276
277 IDP_FreeFromGroup(idprop_group, ui_container);
278}
279
281{
283 LISTBASE_FOREACH (Bone *, child_bone, &bone->childbase) {
285 }
286}
287
289{
290 LISTBASE_FOREACH (Strip *, strip, seqbase) {
291 version_idproperty_ui_data(strip->prop);
292 if (strip->type == STRIP_TYPE_META) {
294 }
295 }
296}
297
308{
309 /* ID data. */
310 ID *id;
311 FOREACH_MAIN_ID_BEGIN (bmain, id) {
312 IDProperty *idprop_group = IDP_GetProperties(id);
313 version_idproperty_ui_data(idprop_group);
314 }
316
317 /* Bones. */
318 LISTBASE_FOREACH (bArmature *, armature, &bmain->armatures) {
319 LISTBASE_FOREACH (Bone *, bone, &armature->bonebase) {
321 }
322 }
323
324 /* Nodes and node sockets. */
325 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
326 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
327 version_idproperty_ui_data(node->prop);
328 }
329 LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->inputs_legacy) {
330 version_idproperty_ui_data(socket->prop);
331 }
332 LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->outputs_legacy) {
333 version_idproperty_ui_data(socket->prop);
334 }
335 }
336
337 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
338 /* The UI data from exposed node modifier properties is just copied from the corresponding node
339 * group, but the copying only runs when necessary, so we still need to version data here. */
340 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
341 if (md->type == eModifierType_Nodes) {
344 }
345 }
346
347 /* Object post bones. */
348 if (ob->type == OB_ARMATURE && ob->pose != nullptr) {
349 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
350 version_idproperty_ui_data(pchan->prop);
351 }
352 }
353 }
354
355 /* Sequences. */
356 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
357 if (scene->ed != nullptr) {
358 do_versions_idproperty_seq_recursive(&scene->ed->seqbase);
359 }
360 }
361}
362
363static void sort_linked_ids(Main *bmain)
364{
365 ListBase *lb;
366 FOREACH_MAIN_LISTBASE_BEGIN (bmain, lb) {
367 ListBase temp_list;
368 BLI_listbase_clear(&temp_list);
369 LISTBASE_FOREACH_MUTABLE (ID *, id, lb) {
370 if (ID_IS_LINKED(id)) {
371 BLI_remlink(lb, id);
372 BLI_addtail(&temp_list, id);
373 id_sort_by_name(&temp_list, id, nullptr);
374 }
375 }
376 BLI_movelisttolist(lb, &temp_list);
377 }
379}
380
381static void assert_sorted_ids(Main *bmain)
382{
383#ifndef NDEBUG
384 ListBase *lb;
385 FOREACH_MAIN_LISTBASE_BEGIN (bmain, lb) {
386 ID *id_prev = nullptr;
387 LISTBASE_FOREACH (ID *, id, lb) {
388 if (id_prev == nullptr) {
389 continue;
390 }
391 BLI_assert(id_prev->lib != id->lib || BLI_strcasecmp(id_prev->name, id->name) < 0);
392 }
393 }
395#else
396 UNUSED_VARS_NDEBUG(bmain);
397#endif
398}
399
401{
402 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
403 if (ELEM(object->type, OB_MESH, OB_LATTICE, OB_GPENCIL_LEGACY)) {
404 ListBase *new_defbase = BKE_object_defgroup_list_mutable(object);
405
406 /* Choose the longest vertex group name list among all linked duplicates. */
407 if (BLI_listbase_count(&object->defbase) < BLI_listbase_count(new_defbase)) {
408 BLI_freelistN(&object->defbase);
409 }
410 else {
411 /* Clear the list in case the it was already assigned from another object. */
412 BLI_freelistN(new_defbase);
413 *new_defbase = object->defbase;
414 BKE_object_defgroup_active_index_set(object, object->actdef);
415 }
416 }
417 }
418}
419
421{
422 /* Old SpeedControlVars->flags. */
423#define STRIP_SPEED_INTEGRATE (1 << 0)
424#define STRIP_SPEED_COMPRESS_IPO_Y (1 << 2)
425
426 LISTBASE_FOREACH (Strip *, strip, seqbase) {
427 if (strip->type == STRIP_TYPE_SPEED) {
428 SpeedControlVars *v = (SpeedControlVars *)strip->effectdata;
429 const char *substr = nullptr;
430 float globalSpeed = v->globalSpeed;
431 if (strip->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
432 if (globalSpeed == 1.0f) {
433 v->speed_control_type = SEQ_SPEED_STRETCH;
434 }
435 else {
436 v->speed_control_type = SEQ_SPEED_MULTIPLY;
437 v->speed_fader = globalSpeed * (float(strip->input1->len) /
439 scene, strip->input1) -
440 strip->input1->start),
441 1.0f));
442 }
443 }
444 else if (v->flags & STRIP_SPEED_INTEGRATE) {
445 v->speed_control_type = SEQ_SPEED_MULTIPLY;
446 v->speed_fader = strip->speed_fader * globalSpeed;
447 }
448 else if (v->flags & STRIP_SPEED_COMPRESS_IPO_Y) {
449 globalSpeed *= 100.0f;
450 v->speed_control_type = SEQ_SPEED_LENGTH;
451 v->speed_fader_length = strip->speed_fader * globalSpeed;
452 substr = "speed_length";
453 }
454 else {
455 v->speed_control_type = SEQ_SPEED_FRAME_NUMBER;
456 v->speed_fader_frame_number = int(strip->speed_fader * globalSpeed);
457 substr = "speed_frame_number";
458 }
459
461
462 if (substr || globalSpeed != 1.0f) {
464 &scene->id, strip, &RNA_Strip, "speed_factor", 0, nullptr);
465 if (fcu) {
466 if (globalSpeed != 1.0f) {
467 for (int i = 0; i < fcu->totvert; i++) {
468 BezTriple *bezt = &fcu->bezt[i];
469 bezt->vec[0][1] *= globalSpeed;
470 bezt->vec[1][1] *= globalSpeed;
471 bezt->vec[2][1] *= globalSpeed;
472 }
473 }
474 if (substr) {
475 char *new_path = BLI_string_replaceN(fcu->rna_path, "speed_factor", substr);
476 MEM_freeN(fcu->rna_path);
477 fcu->rna_path = new_path;
478 }
479 }
480 }
481 }
482 else if (strip->type == STRIP_TYPE_META) {
483 do_versions_sequencer_speed_effect_recursive(scene, &strip->seqbase);
484 }
485 }
486
487#undef STRIP_SPEED_INTEGRATE
488#undef STRIP_SPEED_COMPRESS_IPO_Y
489}
490
491static bool do_versions_sequencer_color_tags(Strip *strip, void * /*user_data*/)
492{
494 return true;
495}
496
497static bool do_versions_sequencer_color_balance_sop(Strip *strip, void * /*user_data*/)
498{
500 if (smd->type == seqModifierType_ColorBalance) {
501 StripColorBalance *cb = &((ColorBalanceModifierData *)smd)->color_balance;
503 for (int i = 0; i < 3; i++) {
504 copy_v3_fl(cb->slope, 1.0f);
505 copy_v3_fl(cb->offset, 1.0f);
506 copy_v3_fl(cb->power, 1.0f);
507 }
508 }
509 }
510 return true;
511}
512
519{
520 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
521 if (ELEM(node->type_legacy,
534 {
535 bNodeSocket *geometry_socket = static_cast<bNodeSocket *>(node->inputs.first);
536 add_realize_instances_before_socket(ntree, node, geometry_socket);
537 }
538 /* Also realize instances for the profile input of the curve to mesh node. */
539 if (node->type_legacy == GEO_NODE_CURVE_TO_MESH) {
540 bNodeSocket *profile_socket = (bNodeSocket *)BLI_findlink(&node->inputs, 1);
541 add_realize_instances_before_socket(ntree, node, profile_socket);
542 }
543 }
544}
545
552{
554 bmain, "Realize Instances 2.93 Legacy", "GeometryNodeTree");
555
556 node_tree->tree_interface.add_socket(
557 "Geometry", "", "NodeSocketGeometry", NODE_INTERFACE_SOCKET_OUTPUT, nullptr);
558 node_tree->tree_interface.add_socket(
559 "Geometry", "", "NodeSocketGeometry", NODE_INTERFACE_SOCKET_INPUT, nullptr);
560
561 bNode *group_input = blender::bke::node_add_static_node(nullptr, *node_tree, NODE_GROUP_INPUT);
562 group_input->locx_legacy = -400.0f;
563 bNode *group_output = blender::bke::node_add_static_node(nullptr, *node_tree, NODE_GROUP_OUTPUT);
564 group_output->locx_legacy = 500.0f;
565 group_output->flag |= NODE_DO_OUTPUT;
566
568 join->locx_legacy = group_output->locx_legacy - 175.0f;
569 join->locy_legacy = group_output->locy_legacy;
571 nullptr, *node_tree, GEO_NODE_POINTS_TO_VERTICES);
572 conv->locx_legacy = join->locx_legacy - 175.0f;
573 conv->locy_legacy = join->locy_legacy - 70.0;
575 nullptr, *node_tree, GEO_NODE_SEPARATE_COMPONENTS);
576 separate->locx_legacy = join->locx_legacy - 350.0f;
577 separate->locy_legacy = join->locy_legacy + 50.0f;
579 nullptr, *node_tree, GEO_NODE_REALIZE_INSTANCES);
580 realize->locx_legacy = separate->locx_legacy - 200.0f;
581 realize->locy_legacy = join->locy_legacy;
582
584 *group_input,
585 *static_cast<bNodeSocket *>(group_input->outputs.first),
586 *realize,
587 *static_cast<bNodeSocket *>(realize->inputs.first));
589 *realize,
590 *static_cast<bNodeSocket *>(realize->outputs.first),
591 *separate,
592 *static_cast<bNodeSocket *>(separate->inputs.first));
594 *conv,
595 *static_cast<bNodeSocket *>(conv->outputs.first),
596 *join,
597 *static_cast<bNodeSocket *>(join->inputs.first));
599 *separate,
600 *static_cast<bNodeSocket *>(BLI_findlink(&separate->outputs, 3)),
601 *join,
602 *static_cast<bNodeSocket *>(join->inputs.first));
604 *separate,
605 *static_cast<bNodeSocket *>(BLI_findlink(&separate->outputs, 1)),
606 *conv,
607 *static_cast<bNodeSocket *>(conv->inputs.first));
609 *separate,
610 *static_cast<bNodeSocket *>(BLI_findlink(&separate->outputs, 2)),
611 *join,
612 *static_cast<bNodeSocket *>(join->inputs.first));
614 *separate,
615 *static_cast<bNodeSocket *>(separate->outputs.first),
616 *join,
617 *static_cast<bNodeSocket *>(join->inputs.first));
619 *join,
620 *static_cast<bNodeSocket *>(join->outputs.first),
621 *group_output,
622 *static_cast<bNodeSocket *>(group_output->inputs.first));
623
624 LISTBASE_FOREACH (bNode *, node, &node_tree->nodes) {
626 }
627
629 return node_tree;
630}
631
632static void strip_speed_factor_fix_rna_path(Strip *strip, ListBase *fcurves)
633{
634 char name_esc[(sizeof(strip->name) - 2) * 2];
635 BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc));
636 char *path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].pitch", name_esc);
637 FCurve *fcu = BKE_fcurve_find(fcurves, path, 0);
638 if (fcu != nullptr) {
639 MEM_freeN(fcu->rna_path);
640 fcu->rna_path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].speed_factor", name_esc);
641 }
642 MEM_freeN(path);
643}
644
645static bool version_fix_seq_meta_range(Strip *strip, void *user_data)
646{
647 Scene *scene = (Scene *)user_data;
648 if (strip->type == STRIP_TYPE_META) {
650 }
651 return true;
652}
653
654static bool strip_speed_factor_set(Strip *strip, void *user_data)
655{
656 const Scene *scene = static_cast<const Scene *>(user_data);
657 if (strip->type == STRIP_TYPE_SOUND_RAM) {
658 /* Move `pitch` animation to `speed_factor` */
659 if (scene->adt && scene->adt->action) {
661 }
662 if (scene->adt && !BLI_listbase_is_empty(&scene->adt->drivers)) {
664 }
665
666 /* Pitch value of 0 has been found in some files. This would cause problems. */
667 if (strip->pitch <= 0.0f) {
668 strip->pitch = 1.0f;
669 }
670
671 strip->speed_factor = strip->pitch;
672 }
673 else {
674 strip->speed_factor = 1.0f;
675 }
676 return true;
677}
678
680{
681 using namespace blender;
682 using namespace blender::bke;
683 /* Otherwise `ntree->typeInfo` is null. */
685 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
686 if (node->type_legacy != GEO_NODE_TRANSFER_ATTRIBUTE_DEPRECATED) {
687 continue;
688 }
689 bNodeSocket *old_geometry_socket = blender::bke::node_find_socket(*node, SOCK_IN, "Source");
691 node->storage;
692 switch (storage->mode) {
694 bNode *sample_nearest_surface = blender::bke::node_add_static_node(
695 nullptr, *ntree, GEO_NODE_SAMPLE_NEAREST_SURFACE);
696 sample_nearest_surface->parent = node->parent;
697 sample_nearest_surface->custom1 = storage->data_type;
698 sample_nearest_surface->locx_legacy = node->locx_legacy;
699 sample_nearest_surface->locy_legacy = node->locy_legacy;
700 static auto socket_remap = []() {
702 map.add_new("Attribute", "Value");
703 map.add_new("Attribute_001", "Value");
704 map.add_new("Attribute_002", "Value");
705 map.add_new("Attribute_003", "Value");
706 map.add_new("Attribute_004", "Value");
707 map.add_new("Source", "Mesh");
708 map.add_new("Source Position", "Sample Position");
709 return map;
710 }();
711 node_tree_relink_with_socket_id_map(*ntree, *node, *sample_nearest_surface, socket_remap);
712 break;
713 }
715 /* These domains weren't supported by the index transfer mode, but were selectable. */
716 const AttrDomain domain = ELEM(AttrDomain(storage->domain),
720 AttrDomain(storage->domain);
721
722 /* Use a sample index node to retrieve the data with this node's index output. */
724 nullptr, *ntree, GEO_NODE_SAMPLE_INDEX);
725 NodeGeometrySampleIndex *sample_storage = static_cast<NodeGeometrySampleIndex *>(
726 sample_index->storage);
727 sample_storage->data_type = storage->data_type;
728 sample_storage->domain = int8_t(domain);
729 sample_index->parent = node->parent;
730 sample_index->locx_legacy = node->locx_legacy + 25.0f;
731 sample_index->locy_legacy = node->locy_legacy;
732 if (old_geometry_socket->link) {
734 *ntree,
735 *old_geometry_socket->link->fromnode,
736 *old_geometry_socket->link->fromsock,
737 *sample_index,
738 *blender::bke::node_find_socket(*sample_index, SOCK_IN, "Geometry"));
739 }
740
742 nullptr, *ntree, GEO_NODE_SAMPLE_NEAREST);
743 sample_nearest->parent = node->parent;
744 sample_nearest->custom1 = storage->data_type;
745 sample_nearest->custom2 = int8_t(domain);
746 sample_nearest->locx_legacy = node->locx_legacy - 25.0f;
747 sample_nearest->locy_legacy = node->locy_legacy;
748 if (old_geometry_socket->link) {
750 *ntree,
751 *old_geometry_socket->link->fromnode,
752 *old_geometry_socket->link->fromsock,
753 *sample_nearest,
754 *blender::bke::node_find_socket(*sample_nearest, SOCK_IN, "Geometry"));
755 }
756 static auto sample_nearest_remap = []() {
758 map.add_new("Source Position", "Sample Position");
759 return map;
760 }();
761 node_tree_relink_with_socket_id_map(*ntree, *node, *sample_nearest, sample_nearest_remap);
762
763 static auto sample_index_remap = []() {
765 map.add_new("Attribute", "Value");
766 map.add_new("Attribute_001", "Value");
767 map.add_new("Attribute_002", "Value");
768 map.add_new("Attribute_003", "Value");
769 map.add_new("Attribute_004", "Value");
770 map.add_new("Source Position", "Sample Position");
771 return map;
772 }();
773 node_tree_relink_with_socket_id_map(*ntree, *node, *sample_index, sample_index_remap);
774
776 *ntree,
777 *sample_nearest,
778 *blender::bke::node_find_socket(*sample_nearest, SOCK_OUT, "Index"),
779 *sample_index,
780 *blender::bke::node_find_socket(*sample_index, SOCK_IN, "Index"));
781 break;
782 }
785 nullptr, *ntree, GEO_NODE_SAMPLE_INDEX);
786 NodeGeometrySampleIndex *sample_storage = static_cast<NodeGeometrySampleIndex *>(
787 sample_index->storage);
788 sample_storage->data_type = storage->data_type;
789 sample_storage->domain = storage->domain;
790 sample_storage->clamp = 1;
791 sample_index->parent = node->parent;
792 sample_index->locx_legacy = node->locx_legacy;
793 sample_index->locy_legacy = node->locy_legacy;
794 const bool index_was_linked =
795 blender::bke::node_find_socket(*node, SOCK_IN, "Index")->link != nullptr;
796 static auto socket_remap = []() {
798 map.add_new("Attribute", "Value");
799 map.add_new("Attribute_001", "Value");
800 map.add_new("Attribute_002", "Value");
801 map.add_new("Attribute_003", "Value");
802 map.add_new("Attribute_004", "Value");
803 map.add_new("Source", "Geometry");
804 map.add_new("Index", "Index");
805 return map;
806 }();
807 node_tree_relink_with_socket_id_map(*ntree, *node, *sample_index, socket_remap);
808
809 if (!index_was_linked) {
810 /* Add an index input node, since the new node doesn't use an implicit input. */
812 index->parent = node->parent;
813 index->locx_legacy = node->locx_legacy - 25.0f;
814 index->locy_legacy = node->locy_legacy - 25.0f;
816 *ntree,
817 *index,
818 *blender::bke::node_find_socket(*index, SOCK_OUT, "Index"),
819 *sample_index,
820 *blender::bke::node_find_socket(*sample_index, SOCK_IN, "Index"));
821 }
822 break;
823 }
824 }
825 /* The storage must be freed manually because the node type isn't defined anymore. */
826 MEM_freeN(node->storage);
827 blender::bke::node_remove_node(nullptr, *ntree, *node, false);
828 }
829}
830
837{
838 blender::Vector<bNode *> new_nodes;
839 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree.nodes) {
840 if (!ELEM(node->type_legacy,
847 {
848 continue;
849 }
850 bNodeSocket *primitive_output_socket = nullptr;
851 bNodeSocket *uv_map_output_socket = nullptr;
852 LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
853 if (STREQ(socket->name, "UV Map")) {
854 uv_map_output_socket = socket;
855 }
856 if (socket->type == SOCK_GEOMETRY) {
857 primitive_output_socket = socket;
858 }
859 }
860 if (uv_map_output_socket != nullptr) {
861 continue;
862 }
863 uv_map_output_socket = &version_node_add_socket(
864 ntree, *node, SOCK_OUT, "NodeSocketVector", "UV Map");
865
866 bNode *store_attribute_node = &version_node_add_empty(ntree,
867 "GeometryNodeStoreNamedAttribute");
868 new_nodes.append(store_attribute_node);
869 store_attribute_node->parent = node->parent;
870 store_attribute_node->locx_legacy = node->locx_legacy + 25;
871 store_attribute_node->locy_legacy = node->locy_legacy;
872 auto &storage = *MEM_callocN<NodeGeometryStoreNamedAttribute>(__func__);
873 store_attribute_node->storage = &storage;
874 storage.domain = int8_t(blender::bke::AttrDomain::Corner);
875 /* Intentionally use 3D instead of 2D vectors, because 2D vectors did not exist in older
876 * releases and would make the file crash when trying to open it. */
877 storage.data_type = CD_PROP_FLOAT3;
878
879 bNodeSocket &store_attribute_geometry_input = version_node_add_socket(
880 ntree, *store_attribute_node, SOCK_IN, "NodeSocketGeometry", "Geometry");
881 bNodeSocket &store_attribute_name_input = version_node_add_socket(
882 ntree, *store_attribute_node, SOCK_IN, "NodeSocketString", "Name");
883 bNodeSocket &store_attribute_value_input = version_node_add_socket(
884 ntree, *store_attribute_node, SOCK_IN, "NodeSocketVector", "Value");
885 bNodeSocket &store_attribute_geometry_output = version_node_add_socket(
886 ntree, *store_attribute_node, SOCK_OUT, "NodeSocketGeometry", "Geometry");
887 LISTBASE_FOREACH (bNodeLink *, link, &ntree.links) {
888 if (link->fromsock == primitive_output_socket) {
889 link->fromnode = store_attribute_node;
890 link->fromsock = &store_attribute_geometry_output;
891 }
892 }
893
894 bNodeSocketValueString *name_value = static_cast<bNodeSocketValueString *>(
895 store_attribute_name_input.default_value);
896 const char *uv_map_name = node->type_legacy == GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE ? "UVMap" :
897 "uv_map";
898 STRNCPY(name_value->value, uv_map_name);
899
901 *node,
902 *primitive_output_socket,
903 *store_attribute_node,
904 store_attribute_geometry_input);
906 ntree, *node, *uv_map_output_socket, *store_attribute_node, store_attribute_value_input);
907 }
908
909 /* Move nodes to the front so that they are drawn behind existing nodes. */
910 for (bNode *node : new_nodes) {
911 BLI_remlink(&ntree.nodes, node);
912 BLI_addhead(&ntree.nodes, node);
913 }
914 if (!new_nodes.is_empty()) {
916 }
917}
918
925{
926 using namespace blender;
927 Vector<bNode *> new_nodes;
928 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree.nodes) {
929 if (node->idname != StringRef("GeometryNodeExtrudeMesh")) {
930 continue;
931 }
932 if (static_cast<const NodeGeometryExtrudeMesh *>(node->storage)->mode !=
934 {
935 continue;
936 }
937 bNodeSocket *geometry_in_socket = blender::bke::node_find_socket(*node, SOCK_IN, "Mesh");
938 bNodeSocket *geometry_out_socket = blender::bke::node_find_socket(*node, SOCK_OUT, "Mesh");
939
940 Map<bNodeSocket *, bNodeLink *> in_links_per_socket;
942 LISTBASE_FOREACH (bNodeLink *, link, &ntree.links) {
943 in_links_per_socket.add(link->tosock, link);
944 out_links_per_socket.add(link->fromsock, link);
945 }
946
947 bNodeLink *geometry_in_link = in_links_per_socket.lookup_default(geometry_in_socket, nullptr);
948 Span<bNodeLink *> geometry_out_links = out_links_per_socket.lookup(geometry_out_socket);
949 if (!geometry_in_link || geometry_out_links.is_empty()) {
950 continue;
951 }
952
953 const bool versioning_already_done = [&]() {
954 if (geometry_in_link->fromnode->idname != StringRef("GeometryNodeCaptureAttribute")) {
955 return false;
956 }
957 bNode *capture_node = geometry_in_link->fromnode;
958 const NodeGeometryAttributeCapture &capture_storage =
959 *static_cast<const NodeGeometryAttributeCapture *>(capture_node->storage);
960 if (capture_storage.data_type_legacy != CD_PROP_BOOL ||
961 bke::AttrDomain(capture_storage.domain) != bke::AttrDomain::Face)
962 {
963 return false;
964 }
965 bNodeSocket *capture_in_socket = blender::bke::node_find_socket(
966 *capture_node, SOCK_IN, "Value_003");
967 bNodeLink *capture_in_link = in_links_per_socket.lookup_default(capture_in_socket, nullptr);
968 if (!capture_in_link) {
969 return false;
970 }
971 if (capture_in_link->fromnode->idname != StringRef("GeometryNodeInputShadeSmooth")) {
972 return false;
973 }
974 if (geometry_out_links.size() != 1) {
975 return false;
976 }
977 bNodeLink *geometry_out_link = geometry_out_links.first();
978 if (geometry_out_link->tonode->idname != StringRef("GeometryNodeSetShadeSmooth")) {
979 return false;
980 }
981 bNode *set_smooth_node = geometry_out_link->tonode;
983 *set_smooth_node, SOCK_IN, "Shade Smooth");
984 bNodeLink *connecting_link = in_links_per_socket.lookup_default(smooth_in_socket, nullptr);
985 if (!connecting_link) {
986 return false;
987 }
988 if (connecting_link->fromnode != capture_node) {
989 return false;
990 }
991 return true;
992 }();
993 if (versioning_already_done) {
994 continue;
995 }
996
997 bNode &capture_node = version_node_add_empty(ntree, "GeometryNodeCaptureAttribute");
998 capture_node.parent = node->parent;
999 capture_node.locx_legacy = node->locx_legacy - 25;
1000 capture_node.locy_legacy = node->locy_legacy;
1001 new_nodes.append(&capture_node);
1002 auto *capture_node_storage = MEM_callocN<NodeGeometryAttributeCapture>(__func__);
1003 capture_node.storage = capture_node_storage;
1004 capture_node_storage->data_type_legacy = CD_PROP_BOOL;
1005 capture_node_storage->domain = int8_t(bke::AttrDomain::Face);
1006 bNodeSocket &capture_node_geo_in = version_node_add_socket(
1007 ntree, capture_node, SOCK_IN, "NodeSocketGeometry", "Geometry");
1008 bNodeSocket &capture_node_geo_out = version_node_add_socket(
1009 ntree, capture_node, SOCK_OUT, "NodeSocketGeometry", "Geometry");
1010 bNodeSocket &capture_node_value_in = version_node_add_socket(
1011 ntree, capture_node, SOCK_IN, "NodeSocketBool", "Value_003");
1012 bNodeSocket &capture_node_attribute_out = version_node_add_socket(
1013 ntree, capture_node, SOCK_OUT, "NodeSocketBool", "Attribute_003");
1014
1015 bNode &is_smooth_node = version_node_add_empty(ntree, "GeometryNodeInputShadeSmooth");
1016 is_smooth_node.parent = node->parent;
1017 is_smooth_node.locx_legacy = capture_node.locx_legacy - 25;
1018 is_smooth_node.locy_legacy = capture_node.locy_legacy;
1019 bNodeSocket &is_smooth_out = version_node_add_socket(
1020 ntree, is_smooth_node, SOCK_OUT, "NodeSocketBool", "Smooth");
1021 new_nodes.append(&is_smooth_node);
1023 ntree, is_smooth_node, is_smooth_out, capture_node, capture_node_value_in);
1024 version_node_add_link(ntree, capture_node, capture_node_geo_out, *node, *geometry_in_socket);
1025 geometry_in_link->tonode = &capture_node;
1026 geometry_in_link->tosock = &capture_node_geo_in;
1027
1028 bNode &set_smooth_node = version_node_add_empty(ntree, "GeometryNodeSetShadeSmooth");
1029 set_smooth_node.custom1 = int16_t(blender::bke::AttrDomain::Face);
1030 set_smooth_node.parent = node->parent;
1031 set_smooth_node.locx_legacy = node->locx_legacy + 25;
1032 set_smooth_node.locy_legacy = node->locy_legacy;
1033 new_nodes.append(&set_smooth_node);
1034 bNodeSocket &set_smooth_node_geo_in = version_node_add_socket(
1035 ntree, set_smooth_node, SOCK_IN, "NodeSocketGeometry", "Geometry");
1036 bNodeSocket &set_smooth_node_geo_out = version_node_add_socket(
1037 ntree, set_smooth_node, SOCK_OUT, "NodeSocketGeometry", "Geometry");
1038 bNodeSocket &set_smooth_node_smooth_in = version_node_add_socket(
1039 ntree, set_smooth_node, SOCK_IN, "NodeSocketBool", "Shade Smooth");
1040
1042 ntree, *node, *geometry_out_socket, set_smooth_node, set_smooth_node_geo_in);
1043
1044 for (bNodeLink *link : geometry_out_links) {
1045 link->fromnode = &set_smooth_node;
1046 link->fromsock = &set_smooth_node_geo_out;
1047 }
1049 capture_node,
1050 capture_node_attribute_out,
1051 set_smooth_node,
1052 set_smooth_node_smooth_in);
1053 }
1054
1055 /* Move nodes to the front so that they are drawn behind existing nodes. */
1056 for (bNode *node : new_nodes) {
1057 BLI_remlink(&ntree.nodes, node);
1058 BLI_addhead(&ntree.nodes, node);
1059 }
1060 if (!new_nodes.is_empty()) {
1062 }
1063}
1064
1065/* Change the action strip (if a NLA strip is preset) to HOLD instead of HOLD FORWARD to maintain
1066 * backwards compatibility. */
1068{
1069 ID *id;
1070 FOREACH_MAIN_ID_BEGIN (bmain, id) {
1071 AnimData *adt = BKE_animdata_from_id(id);
1072 /* We only want to preserve existing behavior if there's an action and 1 or more NLA strips. */
1073 if (adt == nullptr || adt->action == nullptr ||
1075 {
1076 continue;
1077 }
1078
1081 }
1082 }
1084}
1085
1087{
1088 if (MAIN_VERSION_FILE_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_FILE_ATLEAST(bmain, 300, 1)) {
1089 /* Set zero user text objects to have a fake user. */
1090 LISTBASE_FOREACH (Text *, text, &bmain->texts) {
1091 if (text->id.us == 0) {
1092 id_fake_user_set(&text->id);
1093 }
1094 }
1095 }
1096
1097 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 3)) {
1098 sort_linked_ids(bmain);
1099 assert_sorted_ids(bmain);
1100 }
1101
1102 if (MAIN_VERSION_FILE_ATLEAST(bmain, 300, 3)) {
1103 assert_sorted_ids(bmain);
1104 }
1105
1106 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 11)) {
1108 }
1109
1110 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 13)) {
1111 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1112 if (scene->ed != nullptr) {
1113 do_versions_sequencer_speed_effect_recursive(scene, &scene->ed->seqbase);
1114 }
1115 }
1116 }
1117
1118 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 25)) {
1120 }
1121
1122 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 26)) {
1123 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1124 ToolSettings *tool_settings = scene->toolsettings;
1125 ImagePaintSettings *imapaint = &tool_settings->imapaint;
1126 if (imapaint->canvas != nullptr &&
1128 {
1129 imapaint->canvas = nullptr;
1130 }
1131 if (imapaint->stencil != nullptr &&
1133 {
1134 imapaint->stencil = nullptr;
1135 }
1136 if (imapaint->clone != nullptr &&
1138 {
1139 imapaint->clone = nullptr;
1140 }
1141 }
1142 }
1143
1144 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 28)) {
1145 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1146 if (ntree->type == NTREE_GEOMETRY) {
1148 }
1149 }
1150 }
1151
1152 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 30)) {
1154 }
1155
1156 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 32)) {
1157 /* Update Switch Node Non-Fields switch input to Switch_001. */
1158 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1159 if (ntree->type != NTREE_GEOMETRY) {
1160 continue;
1161 }
1162
1163 LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
1164 if (link->tonode->type_legacy == GEO_NODE_SWITCH) {
1165 if (STREQ(link->tosock->identifier, "Switch")) {
1166 bNode *to_node = link->tonode;
1167
1168 uint8_t mode = ((NodeSwitch *)to_node->storage)->input_type;
1169 if (ELEM(mode,
1175 {
1176 link->tosock = link->tosock->next;
1177 }
1178 }
1179 }
1180 }
1181 }
1182 }
1183
1184 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 33)) {
1185 /* This was missing from #move_vertex_group_names_to_object_data. */
1186 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
1188 /* This uses the fact that the active vertex group index starts counting at 1. */
1189 if (BKE_object_defgroup_active_index_get(object) == 0) {
1191 }
1192 }
1193 }
1194 }
1195
1196 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 35)) {
1197 /* Add a new modifier to realize instances from previous modifiers.
1198 * Previously that was done automatically by geometry nodes. */
1199 bNodeTree *realize_instances_node_tree = nullptr;
1200 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
1201 LISTBASE_FOREACH_MUTABLE (ModifierData *, md, &ob->modifiers) {
1202 if (md->type != eModifierType_Nodes) {
1203 continue;
1204 }
1205 if (md->next == nullptr) {
1206 break;
1207 }
1208 if (md->next->type == eModifierType_Nodes) {
1209 continue;
1210 }
1212 if (nmd->node_group == nullptr) {
1213 continue;
1214 }
1215
1217 STRNCPY(new_nmd->modifier.name, "Realize Instances 2.93 Legacy");
1218 BKE_modifier_unique_name(&ob->modifiers, &new_nmd->modifier);
1219 BLI_insertlinkafter(&ob->modifiers, md, new_nmd);
1220 if (realize_instances_node_tree == nullptr) {
1221 realize_instances_node_tree = add_realize_node_tree(bmain);
1222 }
1223 new_nmd->node_group = realize_instances_node_tree;
1224 }
1225 }
1226 }
1227
1228 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 37)) {
1229 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
1230 if (ntree->type == NTREE_GEOMETRY) {
1231 LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
1232 if (node->type_legacy == GEO_NODE_BOUNDING_BOX) {
1233 bNodeSocket *geometry_socket = static_cast<bNodeSocket *>(node->inputs.first);
1234 add_realize_instances_before_socket(ntree, node, geometry_socket);
1235 }
1236 }
1237 }
1238 }
1239 }
1240
1241 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 301, 6)) {
1242 { /* Ensure driver variable names are unique within the driver. */
1243 ID *id;
1244 FOREACH_MAIN_ID_BEGIN (bmain, id) {
1245 AnimData *adt = BKE_animdata_from_id(id);
1246 if (adt == nullptr) {
1247 continue;
1248 }
1249 LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
1250 ChannelDriver *driver = fcu->driver;
1251 /* Ensure the uniqueness front to back. Given a list of identically
1252 * named variables, the last one gets to keep its original name. This
1253 * matches the evaluation order, and thus shouldn't change the evaluated
1254 * value of the driver expression. */
1255 LISTBASE_FOREACH (DriverVar *, dvar, &driver->variables) {
1256 BLI_uniquename(&driver->variables,
1257 dvar,
1258 dvar->name,
1259 '_',
1260 offsetof(DriverVar, name),
1261 sizeof(dvar->name));
1262 }
1263 }
1264 }
1266 }
1267
1268 /* Ensure tiled image sources contain a UDIM token. */
1269 LISTBASE_FOREACH (Image *, ima, &bmain->images) {
1270 if (ima->source == IMA_SRC_TILED) {
1271 BKE_image_ensure_tile_token(ima->filepath, sizeof(ima->filepath));
1272 }
1273 }
1274 }
1275
1276 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 14)) {
1277 /* Sequencer channels region. */
1278 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1279 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1280 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1281 if (sl->spacetype != SPACE_SEQ) {
1282 continue;
1283 }
1284 SpaceSeq *sseq = (SpaceSeq *)sl;
1285 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
1286 &sl->regionbase;
1287 sseq->flag |= SEQ_CLAMP_VIEW;
1288
1290 continue;
1291 }
1292
1293 ARegion *timeline_region = BKE_region_find_in_listbase_by_type(regionbase,
1295
1296 if (timeline_region == nullptr) {
1297 continue;
1298 }
1299
1300 timeline_region->v2d.cur.ymax = 8.5f;
1301 timeline_region->v2d.align &= ~V2D_ALIGN_NO_NEG_Y;
1302 }
1303 }
1304 }
1305 }
1306
1307 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 5)) {
1308 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
1310 if (ed == nullptr) {
1311 continue;
1312 }
1315 }
1316 }
1317
1318 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 6)) {
1319 /* In the Dope Sheet, for every mode other than Timeline, open the Properties panel. */
1320 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
1321 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1322 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1323 if (sl->spacetype != SPACE_ACTION) {
1324 continue;
1325 }
1326
1327 /* Skip the timeline, it shouldn't get its Properties panel opened. */
1328 SpaceAction *saction = (SpaceAction *)sl;
1329 if (saction->mode == SACTCONT_TIMELINE) {
1330 continue;
1331 }
1332
1333 const bool is_first_space = sl == area->spacedata.first;
1334 ListBase *regionbase = is_first_space ? &area->regionbase : &sl->regionbase;
1336 if (region == nullptr) {
1337 continue;
1338 }
1339
1340 region->flag &= ~RGN_FLAG_HIDDEN;
1341 }
1342 }
1343 }
1344 }
1345
1346 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 1)) {
1347 /* Split the transfer attribute node into multiple smaller nodes. */
1348 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1349 if (ntree->type == NTREE_GEOMETRY) {
1351 }
1352 }
1354 }
1355
1356 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 13)) {
1358 }
1359
1366}
1367
1369{
1370 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1371 if (ntree->type == NTREE_GEOMETRY) {
1372 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1373 if (node->type_legacy == GEO_NODE_SWITCH) {
1374 LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
1375 /* Skip the "switch" socket. */
1376 if (socket == node->inputs.first) {
1377 continue;
1378 }
1379 STRNCPY(socket->name, socket->name[0] == 'A' ? "False" : "True");
1380
1381 /* Replace "A" and "B", but keep the unique number suffix at the end. */
1382 char number_suffix[8];
1383 STRNCPY(number_suffix, socket->identifier + 1);
1385 socket->identifier, sizeof(socket->identifier), socket->name, number_suffix);
1386 }
1387 }
1388 }
1389 }
1390 }
1392}
1393
1394static bool replace_bbone_len_scale_rnapath(char **p_old_path, int *p_index)
1395{
1396 char *old_path = *p_old_path;
1397
1398 if (old_path == nullptr) {
1399 return false;
1400 }
1401
1402 int len = strlen(old_path);
1403
1404 if (BLI_str_endswith(old_path, ".bbone_curveiny") ||
1405 BLI_str_endswith(old_path, ".bbone_curveouty"))
1406 {
1407 old_path[len - 1] = 'z';
1408 return true;
1409 }
1410
1411 if (BLI_str_endswith(old_path, ".bbone_scaleinx") ||
1412 BLI_str_endswith(old_path, ".bbone_scaleiny") ||
1413 BLI_str_endswith(old_path, ".bbone_scaleoutx") ||
1414 BLI_str_endswith(old_path, ".bbone_scaleouty"))
1415 {
1416 int index = (old_path[len - 1] == 'y' ? 2 : 0);
1417
1418 old_path[len - 1] = 0;
1419
1420 if (p_index) {
1421 *p_index = index;
1422 }
1423 else {
1424 *p_old_path = BLI_sprintfN("%s[%d]", old_path, index);
1425 MEM_freeN(old_path);
1426 }
1427
1428 return true;
1429 }
1430
1431 return false;
1432}
1433
1435{
1436 /* Update driver variable paths. */
1437 if (fcu->driver) {
1438 LISTBASE_FOREACH (DriverVar *, dvar, &fcu->driver->variables) {
1440 replace_bbone_len_scale_rnapath(&dtar->rna_path, nullptr);
1441 }
1443 }
1444 }
1445
1446 /* Update F-Curve's path. */
1448}
1449
1451{
1452 LISTBASE_FOREACH (Bone *, bone, lb) {
1453 if (bone->flag & BONE_ADD_PARENT_END_ROLL) {
1454 bone->bbone_flag |= BBONE_ADD_PARENT_END_ROLL;
1455 }
1456
1457 copy_v3_fl3(bone->scale_in, bone->scale_in_x, 1.0f, bone->scale_in_z);
1458 copy_v3_fl3(bone->scale_out, bone->scale_out_x, 1.0f, bone->scale_out_z);
1459
1460 do_version_bones_bbone_len_scale(&bone->childbase);
1461 }
1462}
1463
1465{
1466 /* Binding array data could be freed without properly resetting its size data. */
1467 LISTBASE_FOREACH (bConstraint *, con, lb) {
1468 if (con->type == CONSTRAINT_TYPE_SPLINEIK) {
1470 if (data->points == nullptr) {
1471 data->numpoints = 0;
1472 }
1473 }
1474 }
1475}
1476
1478 bNode *node,
1479 bNodeSocket *socket)
1480{
1481 const bNodeSocketValueFloat *socket_value = (const bNodeSocketValueFloat *)socket->default_value;
1482 const float old_value = socket_value->value;
1483 blender::bke::node_remove_socket(*ntree, *node, *socket);
1485 *ntree,
1486 *node,
1487 SOCK_IN,
1489 "Size",
1490 "Size");
1491 bNodeSocketValueVector *value_vector = (bNodeSocketValueVector *)new_socket->default_value;
1492 copy_v3_fl(value_vector->value, old_value);
1493 return new_socket;
1494}
1495
1496static bool strip_transform_origin_set(Strip *strip, void * /*user_data*/)
1497{
1499 if (strip->data->transform != nullptr) {
1500 transform->origin[0] = transform->origin[1] = 0.5f;
1501 }
1502 return true;
1503}
1504
1505static bool strip_transform_filter_set(Strip *strip, void * /*user_data*/)
1506{
1508 if (strip->data->transform != nullptr) {
1510 }
1511 return true;
1512}
1513
1514static bool strip_meta_channels_ensure(Strip *strip, void * /*user_data*/)
1515{
1516 if (strip->type == STRIP_TYPE_META) {
1518 }
1519 return true;
1520}
1521
1535
1537{
1538 using namespace blender;
1539 if (nmd->settings.properties == nullptr) {
1540 return;
1541 }
1542 /* Before versioning the properties, make sure it hasn't been done already. */
1543 LISTBASE_FOREACH (const IDProperty *, property, &nmd->settings.properties->data.group) {
1544 if (strstr(property->name, "_use_attribute") || strstr(property->name, "_attribute_name")) {
1545 return;
1546 }
1547 }
1548
1550 if (!ELEM(property->type, IDP_FLOAT, IDP_INT, IDP_ARRAY)) {
1551 continue;
1552 }
1553
1554 if (strstr(property->name, "_use_attribute") || strstr(property->name, "_attribute_name")) {
1555 continue;
1556 }
1557
1558 char use_attribute_prop_name[MAX_IDPROP_NAME];
1559 SNPRINTF(use_attribute_prop_name, "%s%s", property->name, "_use_attribute");
1560
1561 IDProperty *use_attribute_prop = bke::idprop::create(use_attribute_prop_name, 0).release();
1562 IDP_AddToGroup(nmd->settings.properties, use_attribute_prop);
1563
1564 char attribute_name_prop_name[MAX_IDPROP_NAME];
1565 SNPRINTF(attribute_name_prop_name, "%s%s", property->name, "_attribute_name");
1566
1567 IDProperty *attribute_prop = bke::idprop::create(attribute_name_prop_name, "").release();
1568 IDP_AddToGroup(nmd->settings.properties, attribute_prop);
1569 }
1570}
1571
1572/* Copy of the function before the fixes. */
1573static void legacy_vec_roll_to_mat3_normalized(const float nor[3],
1574 const float roll,
1575 float r_mat[3][3])
1576{
1577 const float SAFE_THRESHOLD = 1.0e-5f; /* theta above this value has good enough precision. */
1578 const float CRITICAL_THRESHOLD = 1.0e-9f; /* above this is safe under certain conditions. */
1579 const float THRESHOLD_SQUARED = CRITICAL_THRESHOLD * CRITICAL_THRESHOLD;
1580
1581 const float x = nor[0];
1582 const float y = nor[1];
1583 const float z = nor[2];
1584
1585 const float theta = 1.0f + y; /* remapping Y from [-1,+1] to [0,2]. */
1586 const float theta_alt = x * x + z * z; /* Helper value for matrix calculations. */
1587 float rMatrix[3][3], bMatrix[3][3];
1588
1590
1591 /* When theta is close to zero (nor is aligned close to negative Y Axis),
1592 * we have to check we do have non-null X/Z components as well.
1593 * Also, due to float precision errors, nor can be (0.0, -0.99999994, 0.0) which results
1594 * in theta being close to zero. This will cause problems when theta is used as divisor.
1595 */
1596 if (theta > SAFE_THRESHOLD || (theta > CRITICAL_THRESHOLD && theta_alt > THRESHOLD_SQUARED)) {
1597 /* nor is *not* aligned to negative Y-axis (0,-1,0). */
1598
1599 bMatrix[0][1] = -x;
1600 bMatrix[1][0] = x;
1601 bMatrix[1][1] = y;
1602 bMatrix[1][2] = z;
1603 bMatrix[2][1] = -z;
1604
1605 if (theta > SAFE_THRESHOLD) {
1606 /* nor differs significantly from negative Y axis (0,-1,0): apply the general case. */
1607 bMatrix[0][0] = 1 - x * x / theta;
1608 bMatrix[2][2] = 1 - z * z / theta;
1609 bMatrix[2][0] = bMatrix[0][2] = -x * z / theta;
1610 }
1611 else {
1612 /* nor is close to negative Y axis (0,-1,0): apply the special case. */
1613 bMatrix[0][0] = (x + z) * (x - z) / -theta_alt;
1614 bMatrix[2][2] = -bMatrix[0][0];
1615 bMatrix[2][0] = bMatrix[0][2] = 2.0f * x * z / theta_alt;
1616 }
1617 }
1618 else {
1619 /* nor is very close to negative Y axis (0,-1,0): use simple symmetry by Z axis. */
1620 unit_m3(bMatrix);
1621 bMatrix[0][0] = bMatrix[1][1] = -1.0;
1622 }
1623
1624 /* Make Roll matrix */
1625 axis_angle_normalized_to_mat3(rMatrix, nor, roll);
1626
1627 /* Combine and output result */
1628 mul_m3_m3m3(r_mat, rMatrix, bMatrix);
1629}
1630
1631static void correct_bone_roll_value(const float head[3],
1632 const float tail[3],
1633 const float check_x_axis[3],
1634 const float check_y_axis[3],
1635 float *r_roll)
1636{
1637 const float SAFE_THRESHOLD = 1.0e-5f;
1638 float vec[3], bone_mat[3][3], vec2[3];
1639
1640 /* Compute the Y axis vector. */
1641 sub_v3_v3v3(vec, tail, head);
1642 normalize_v3(vec);
1643
1644 /* Only correct when in the danger zone. */
1645 if (1.0f + vec[1] < SAFE_THRESHOLD * 2 && (vec[0] || vec[2])) {
1646 /* Use the armature matrix to double-check if adjustment is needed.
1647 * This should minimize issues if the file is bounced back and forth between
1648 * 2.92 and 2.91, provided Edit Mode isn't entered on the armature in 2.91. */
1649 vec_roll_to_mat3(vec, *r_roll, bone_mat);
1650
1651 UNUSED_VARS_NDEBUG(check_y_axis);
1652 BLI_assert(dot_v3v3(bone_mat[1], check_y_axis) > 0.999f);
1653
1654 if (dot_v3v3(bone_mat[0], check_x_axis) < 0.999f) {
1655 /* Recompute roll using legacy code to interpret the old value. */
1656 legacy_vec_roll_to_mat3_normalized(vec, *r_roll, bone_mat);
1657 mat3_to_vec_roll(bone_mat, vec2, r_roll);
1658 BLI_assert(compare_v3v3(vec, vec2, 0.001f));
1659 }
1660 }
1661}
1662
1663/* Update the armature Bone roll fields for bones very close to -Y direction. */
1665{
1666 LISTBASE_FOREACH (Bone *, bone, lb) {
1667 /* Parent-relative orientation (used for posing). */
1669 bone->head, bone->tail, bone->bone_mat[0], bone->bone_mat[1], &bone->roll);
1670
1671 /* Absolute orientation (used for Edit mode). */
1673 bone->arm_head, bone->arm_tail, bone->arm_mat[0], bone->arm_mat[1], &bone->arm_roll);
1674
1675 do_version_bones_roll(&bone->childbase);
1676 }
1677}
1678
1680{
1681 /* Add the new Offset socket. */
1682 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1683 if (node->type_legacy != GEO_NODE_SET_POSITION) {
1684 continue;
1685 }
1686 if (BLI_listbase_count(&node->inputs) < 4) {
1687 /* The offset socket didn't exist in the file yet. */
1688 return;
1689 }
1690 bNodeSocket *old_offset_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 3));
1691 if (old_offset_socket->type == SOCK_VECTOR) {
1692 /* Versioning happened already. */
1693 return;
1694 }
1695 /* Change identifier of old socket, so that the there is no name collision. */
1696 STRNCPY(old_offset_socket->identifier, "Offset_old");
1698 *ntree, *node, SOCK_IN, SOCK_VECTOR, PROP_TRANSLATION, "Offset", "Offset");
1699 }
1700
1701 /* Relink links that were connected to Position while Offset was enabled. */
1702 LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
1703 if (link->tonode->type_legacy != GEO_NODE_SET_POSITION) {
1704 continue;
1705 }
1706 if (!STREQ(link->tosock->identifier, "Position")) {
1707 continue;
1708 }
1709 bNodeSocket *old_offset_socket = static_cast<bNodeSocket *>(
1710 BLI_findlink(&link->tonode->inputs, 3));
1711 /* This assumes that the offset is not linked to something else. That seems to be a reasonable
1712 * assumption, because the node is probably only ever used in one or the other mode. */
1713 const bool offset_enabled =
1714 ((bNodeSocketValueBoolean *)old_offset_socket->default_value)->value;
1715 if (offset_enabled) {
1716 /* Relink to new offset socket. */
1717 link->tosock = old_offset_socket->next;
1718 }
1719 }
1720
1721 /* Remove old Offset socket. */
1722 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1723 if (node->type_legacy != GEO_NODE_SET_POSITION) {
1724 continue;
1725 }
1726 bNodeSocket *old_offset_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 3));
1727 blender::bke::node_remove_socket(*ntree, *node, *old_offset_socket);
1728 }
1729}
1730
1732{
1733 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1734 LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
1736 }
1737 LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
1739 }
1740 }
1741}
1742
1743static bool version_merge_still_offsets(Strip *strip, void * /*user_data*/)
1744{
1745 strip->startofs -= strip->startstill;
1746 strip->endofs -= strip->endstill;
1747 strip->startstill = 0;
1748 strip->endstill = 0;
1749 return true;
1750}
1751
1752static bool version_fix_delete_flag(Strip *strip, void * /*user_data*/)
1753{
1754 strip->flag &= ~SEQ_FLAG_DELETE;
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 || ((strip->type & STRIP_TYPE_EFFECT) &&
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,
1806 offsetof(bConstraint, 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,
1840 offsetof(ModifierData, 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(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 /* In geometry nodes, replace shader combine/separate color nodes with function nodes */
1940 if (ntree->type == NTREE_GEOMETRY) {
1945
1949 version_node_input_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "Image", "Color");
1950
1951 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
1952 switch (node->type_legacy) {
1954 node->type_legacy = FN_NODE_COMBINE_COLOR;
1956 storage->mode = NODE_COMBSEP_COLOR_RGB;
1957 STRNCPY(node->idname, "FunctionNodeCombineColor");
1958 node->storage = storage;
1959 break;
1960 }
1961 case SH_NODE_SEPRGB_LEGACY: {
1962 node->type_legacy = FN_NODE_SEPARATE_COLOR;
1964 storage->mode = NODE_COMBSEP_COLOR_RGB;
1965 STRNCPY(node->idname, "FunctionNodeSeparateColor");
1966 node->storage = storage;
1967 break;
1968 }
1969 }
1970 }
1971 }
1972
1973 /* In compositing nodes, replace combine/separate RGBA/HSVA/YCbCrA/YCCA nodes with
1974 * combine/separate color */
1975 if (ntree->type == NTREE_COMPOSIT) {
1980
1985
1990
1995
2000
2005
2010
2015
2016 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2017 switch (node->type_legacy) {
2019 node->type_legacy = CMP_NODE_COMBINE_COLOR;
2022 STRNCPY(node->idname, "CompositorNodeCombineColor");
2023 node->storage = storage;
2024 break;
2025 }
2027 node->type_legacy = CMP_NODE_COMBINE_COLOR;
2030 STRNCPY(node->idname, "CompositorNodeCombineColor");
2031 node->storage = storage;
2032 break;
2033 }
2035 node->type_legacy = CMP_NODE_COMBINE_COLOR;
2038 storage->ycc_mode = node->custom1;
2039 STRNCPY(node->idname, "CompositorNodeCombineColor");
2040 node->storage = storage;
2041 break;
2042 }
2044 node->type_legacy = CMP_NODE_COMBINE_COLOR;
2047 STRNCPY(node->idname, "CompositorNodeCombineColor");
2048 node->storage = storage;
2049 break;
2050 }
2052 node->type_legacy = CMP_NODE_SEPARATE_COLOR;
2055 STRNCPY(node->idname, "CompositorNodeSeparateColor");
2056 node->storage = storage;
2057 break;
2058 }
2060 node->type_legacy = CMP_NODE_SEPARATE_COLOR;
2063 STRNCPY(node->idname, "CompositorNodeSeparateColor");
2064 node->storage = storage;
2065 break;
2066 }
2068 node->type_legacy = CMP_NODE_SEPARATE_COLOR;
2071 storage->ycc_mode = node->custom1;
2072 STRNCPY(node->idname, "CompositorNodeSeparateColor");
2073 node->storage = storage;
2074 break;
2075 }
2077 node->type_legacy = CMP_NODE_SEPARATE_COLOR;
2080 STRNCPY(node->idname, "CompositorNodeSeparateColor");
2081 node->storage = storage;
2082 break;
2083 }
2084 }
2085 }
2086 }
2087
2088 /* In texture nodes, replace combine/separate RGBA with combine/separate color */
2089 if (ntree->type == NTREE_TEXTURE) {
2090 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2091 switch (node->type_legacy) {
2093 node->type_legacy = TEX_NODE_COMBINE_COLOR;
2094 node->custom1 = NODE_COMBSEP_COLOR_RGB;
2095 STRNCPY(node->idname, "TextureNodeCombineColor");
2096 break;
2097 }
2099 node->type_legacy = TEX_NODE_SEPARATE_COLOR;
2100 node->custom1 = NODE_COMBSEP_COLOR_RGB;
2101 STRNCPY(node->idname, "TextureNodeSeparateColor");
2102 break;
2103 }
2104 }
2105 }
2106 }
2107
2108 /* In shader nodes, replace combine/separate RGB/HSV with combine/separate color */
2109 if (ntree->type == NTREE_SHADER) {
2114
2118
2122 version_node_input_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "Image", "Color");
2123
2127
2128 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2129 switch (node->type_legacy) {
2131 node->type_legacy = SH_NODE_COMBINE_COLOR;
2133 storage->mode = NODE_COMBSEP_COLOR_RGB;
2134 STRNCPY(node->idname, "ShaderNodeCombineColor");
2135 node->storage = storage;
2136 break;
2137 }
2139 node->type_legacy = SH_NODE_COMBINE_COLOR;
2141 storage->mode = NODE_COMBSEP_COLOR_HSV;
2142 STRNCPY(node->idname, "ShaderNodeCombineColor");
2143 node->storage = storage;
2144 break;
2145 }
2146 case SH_NODE_SEPRGB_LEGACY: {
2147 node->type_legacy = SH_NODE_SEPARATE_COLOR;
2149 storage->mode = NODE_COMBSEP_COLOR_RGB;
2150 STRNCPY(node->idname, "ShaderNodeSeparateColor");
2151 node->storage = storage;
2152 break;
2153 }
2154 case SH_NODE_SEPHSV_LEGACY: {
2155 node->type_legacy = SH_NODE_SEPARATE_COLOR;
2157 storage->mode = NODE_COMBSEP_COLOR_HSV;
2158 STRNCPY(node->idname, "ShaderNodeSeparateColor");
2159 node->storage = storage;
2160 break;
2161 }
2162 }
2163 }
2164 }
2165}
2166
2168{
2169 version_node_input_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Fac", "Factor_Float");
2170 version_node_input_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Color1", "A_Color");
2171 version_node_input_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Color2", "B_Color");
2172 version_node_output_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Color", "Result_Color");
2173 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2174 if (node->type_legacy == SH_NODE_MIX_RGB_LEGACY) {
2175 STRNCPY(node->idname, "ShaderNodeMix");
2176 node->type_legacy = SH_NODE_MIX;
2178 data->blend_type = node->custom1;
2179 data->clamp_result = (node->custom2 & SHD_MIXRGB_CLAMP) ? 1 : 0;
2180 data->clamp_factor = 1;
2181 data->data_type = SOCK_RGBA;
2182 data->factor_mode = NODE_MIX_MODE_UNIFORM;
2183 node->storage = data;
2184 }
2185 }
2186}
2187
2189{
2190 /* Fix bug where curves in image format were not properly copied to file output
2191 * node, incorrectly sharing a pointer with the scene settings. Copy the data
2192 * structure now as it should have been done in the first place. */
2193 if (format->view_settings.curve_mapping) {
2194 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2195 if (format != &scene->r.im_format && ELEM(format->view_settings.curve_mapping,
2196 scene->view_settings.curve_mapping,
2197 scene->r.im_format.view_settings.curve_mapping))
2198 {
2199 format->view_settings.curve_mapping = BKE_curvemapping_copy(
2200 format->view_settings.curve_mapping);
2201 break;
2202 }
2203 }
2204
2205 /* Remove any invalid curves with missing data. */
2206 if (format->view_settings.curve_mapping->cm[0].curve == nullptr) {
2207 BKE_curvemapping_free(format->view_settings.curve_mapping);
2208 format->view_settings.curve_mapping = nullptr;
2209 format->view_settings.flag &= ~COLORMANAGE_VIEW_USE_CURVES;
2210 }
2211 }
2212}
2213
2219{
2220 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
2221
2222 switch (sl->spacetype) {
2223 case SPACE_FILE: {
2225 regionbase, RGN_TYPE_UI, "versioning: UI region for file", RGN_TYPE_TOOLS))
2226 {
2227 ui_region->alignment = RGN_ALIGN_TOP;
2228 ui_region->flag |= RGN_FLAG_DYNAMIC_SIZE;
2229 }
2230
2232 regionbase, RGN_TYPE_EXECUTE, "versioning: execute region for file", RGN_TYPE_UI))
2233 {
2234 exec_region->alignment = RGN_ALIGN_BOTTOM;
2235 exec_region->flag = RGN_FLAG_DYNAMIC_SIZE;
2236 }
2237
2238 if (ARegion *tool_props_region = do_versions_add_region_if_not_found(
2239 regionbase,
2241 "versioning: tool props region for file",
2243 {
2244 tool_props_region->alignment = RGN_ALIGN_RIGHT;
2245 tool_props_region->flag = RGN_FLAG_HIDDEN;
2246 }
2247 break;
2248 }
2249 case SPACE_CLIP: {
2250 ARegion *region;
2251
2253 regionbase, RGN_TYPE_UI, "versioning: properties region for clip", RGN_TYPE_HEADER);
2254 region->alignment = RGN_ALIGN_RIGHT;
2255 region->flag &= ~RGN_FLAG_HIDDEN;
2256
2258 regionbase, RGN_TYPE_CHANNELS, "versioning: channels region for clip", RGN_TYPE_UI);
2259 region->alignment = RGN_ALIGN_LEFT;
2260 region->flag &= ~RGN_FLAG_HIDDEN;
2261 region->v2d.scroll = V2D_SCROLL_BOTTOM;
2263
2265 regionbase, RGN_TYPE_PREVIEW, "versioning: preview region for clip", RGN_TYPE_WINDOW);
2266 region->flag &= ~RGN_FLAG_HIDDEN;
2267
2268 break;
2269 }
2270 case SPACE_SEQ: {
2271 ARegion *region;
2272
2273 do_versions_ensure_region(regionbase,
2275 "versioning: channels region for sequencer",
2277
2278 region = do_versions_ensure_region(regionbase,
2280 "versioning: preview region for sequencer",
2283
2284 break;
2285 }
2286 }
2287}
2288
2294 const char *parent_rna_path,
2295 NlaStrip *strip)
2296{
2297 if (!strip) {
2298 return;
2299 }
2300
2301 /* Escape the strip name for inclusion in the RNA path. */
2302 char name_esc_strip[sizeof(strip->name) * 2];
2303 BLI_str_escape(name_esc_strip, strip->name, sizeof(name_esc_strip));
2304
2305 const std::string rna_path_strip = std::string(parent_rna_path) + ".strips[\"" + name_esc_strip +
2306 "\"]";
2307
2308 { /* Rename .frame_start -> .frame_start_raw: */
2309 const std::string rna_path_prop = rna_path_strip + ".frame_start";
2311 liboverride, rna_path_prop.c_str(), (rna_path_prop + "_raw").c_str());
2312 }
2313
2314 { /* Rename .frame_end -> .frame_end_raw: */
2315 const std::string rna_path_prop = rna_path_strip + ".frame_end";
2317 liboverride, rna_path_prop.c_str(), (rna_path_prop + "_raw").c_str());
2318 }
2319
2320 { /* Remove .frame_start_ui: */
2321 const std::string rna_path_prop = rna_path_strip + ".frame_start_ui";
2323 }
2324
2325 { /* Remove .frame_end_ui: */
2326 const std::string rna_path_prop = rna_path_strip + ".frame_end_ui";
2328 }
2329
2330 /* Handle meta-strip contents. */
2331 LISTBASE_FOREACH (NlaStrip *, substrip, &strip->strips) {
2332 version_liboverride_nla_strip_frame_start_end(liboverride, rna_path_strip.c_str(), substrip);
2333 }
2334}
2335
2338{
2339 IDOverrideLibrary *liboverride = id->override_library;
2340 if (!liboverride) {
2341 return;
2342 }
2343
2344 int track_index;
2345 LISTBASE_FOREACH_INDEX (NlaTrack *, track, &adt->nla_tracks, track_index) {
2346 char *rna_path_track = BLI_sprintfN("animation_data.nla_tracks[%d]", track_index);
2347
2348 LISTBASE_FOREACH (NlaStrip *, strip, &track->strips) {
2350 }
2351
2352 MEM_freeN(rna_path_track);
2353 }
2354}
2355
2356/* NOLINTNEXTLINE: readability-function-size */
2357void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
2358{
2359 /* The #SCE_SNAP_SEQ flag has been removed in favor of the #SCE_SNAP which can be used for each
2360 * snap_flag member individually. */
2361 enum { SCE_SNAP_SEQ = (1 << 7) };
2362
2363 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 1)) {
2364 /* Set default value for the new bisect_threshold parameter in the mirror modifier. */
2365 if (!DNA_struct_member_exists(fd->filesdna, "MirrorModifierData", "float", "bisect_threshold"))
2366 {
2367 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2368 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
2369 if (md->type == eModifierType_Mirror) {
2371 /* This was the previous hard-coded value. */
2372 mmd->bisect_threshold = 0.001f;
2373 }
2374 }
2375 }
2376 }
2377 /* Grease Pencil: Set default value for dilate pixels. */
2378 if (!DNA_struct_member_exists(fd->filesdna, "BrushGpencilSettings", "int", "dilate_pixels")) {
2379 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
2380 if (brush->gpencil_settings) {
2381 brush->gpencil_settings->dilate_pixels = 1;
2382 }
2383 }
2384 }
2385 }
2386
2387 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 2)) {
2389
2390 if (!DNA_struct_member_exists(fd->filesdna, "bPoseChannel", "float", "custom_scale_xyz[3]")) {
2391 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2392 if (ob->pose == nullptr) {
2393 continue;
2394 }
2395 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
2396 copy_v3_fl(pchan->custom_scale_xyz, pchan->custom_scale);
2397 }
2398 }
2399 }
2400 }
2401
2402 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 4)) {
2403 /* Add a properties sidebar to the spreadsheet editor. */
2404 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2405 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2406 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2407 if (sl->spacetype == SPACE_SPREADSHEET) {
2408 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
2409 &sl->regionbase;
2411 regionbase, RGN_TYPE_UI, "sidebar for spreadsheet", RGN_TYPE_FOOTER);
2412 if (new_sidebar != nullptr) {
2413 new_sidebar->alignment = RGN_ALIGN_RIGHT;
2414 new_sidebar->flag |= RGN_FLAG_HIDDEN;
2415 }
2416 }
2417 }
2418 }
2419 }
2420
2421 /* Enable spreadsheet filtering in old files without row filters. */
2422 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2423 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2424 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2425 if (sl->spacetype == SPACE_SPREADSHEET) {
2426 SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl;
2427 sspreadsheet->filter_flag |= SPREADSHEET_FILTER_ENABLE;
2428 }
2429 }
2430 }
2431 }
2432
2433 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2434 if (ntree->type == NTREE_GEOMETRY) {
2435 version_node_socket_name(ntree, GEO_NODE_BOUNDING_BOX, "Mesh", "Bounding Box");
2436 }
2437 }
2439
2440 if (!DNA_struct_member_exists(fd->filesdna, "FileAssetSelectParams", "short", "import_method"))
2441 {
2442 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2443 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2444 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2445 if (sl->spacetype == SPACE_FILE) {
2446 SpaceFile *sfile = (SpaceFile *)sl;
2447 if (sfile->asset_params) {
2449 }
2450 }
2451 }
2452 }
2453 }
2454 }
2455
2456 /* Initialize length-wise scale B-Bone settings. */
2457 if (!DNA_struct_member_exists(fd->filesdna, "Bone", "int", "bbone_flag")) {
2458 /* Update armature data and pose channels. */
2459 LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
2460 do_version_bones_bbone_len_scale(&arm->bonebase);
2461 }
2462
2463 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2464 if (ob->pose) {
2465 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
2466 copy_v3_fl3(pchan->scale_in, pchan->scale_in_x, 1.0f, pchan->scale_in_z);
2467 copy_v3_fl3(pchan->scale_out, pchan->scale_out_x, 1.0f, pchan->scale_out_z);
2468 }
2469 }
2470 }
2471
2472 /* Update action curves and drivers. */
2473 LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
2474 LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, &act->curves) {
2476 }
2477 }
2478
2479 BKE_animdata_main_cb(bmain, [](ID * /*id*/, AnimData *adt) {
2480 LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, &adt->drivers) {
2482 }
2483 });
2484 }
2485 }
2486
2487 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 5)) {
2488 /* Add a dataset sidebar to the spreadsheet editor. */
2489 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2490 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2491 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2492 if (sl->spacetype == SPACE_SPREADSHEET) {
2493 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
2494 &sl->regionbase;
2495 ARegion *spreadsheet_dataset_region = do_versions_add_region_if_not_found(
2496 regionbase, RGN_TYPE_CHANNELS, "spreadsheet dataset region", RGN_TYPE_FOOTER);
2497
2498 if (spreadsheet_dataset_region) {
2499 spreadsheet_dataset_region->alignment = RGN_ALIGN_LEFT;
2500 spreadsheet_dataset_region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
2501 }
2502 }
2503 }
2504 }
2505 }
2506 }
2507
2508 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 6)) {
2509 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2510 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2511 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
2512 /* Disable View Layers filter. */
2513 if (space->spacetype == SPACE_OUTLINER) {
2514 SpaceOutliner *space_outliner = (SpaceOutliner *)space;
2515 space_outliner->filter |= SO_FILTER_NO_VIEW_LAYERS;
2516 }
2517 }
2518 }
2519 }
2520 }
2521
2522 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 7)) {
2523 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2524 ToolSettings *tool_settings = scene->toolsettings;
2525 tool_settings->snap_flag |= SCE_SNAP_SEQ;
2526 short snap_mode = tool_settings->snap_mode;
2527 short snap_node_mode = tool_settings->snap_node_mode;
2528 short snap_uv_mode = tool_settings->snap_uv_mode;
2529 tool_settings->snap_mode &= ~((1 << 4) | (1 << 5) | (1 << 6));
2530 tool_settings->snap_node_mode &= ~((1 << 5) | (1 << 6));
2531 tool_settings->snap_uv_mode &= ~(1 << 4);
2532 if (snap_mode & (1 << 4)) {
2533 tool_settings->snap_mode |= (1 << 6); /* SCE_SNAP_TO_INCREMENT */
2534 }
2535 if (snap_mode & (1 << 5)) {
2536 tool_settings->snap_mode |= (1 << 4); /* SCE_SNAP_TO_EDGE_MIDPOINT */
2537 }
2538 if (snap_mode & (1 << 6)) {
2539 tool_settings->snap_mode |= (1 << 5); /* SCE_SNAP_TO_EDGE_PERPENDICULAR */
2540 }
2541 if (snap_node_mode & (1 << 5)) {
2542 tool_settings->snap_node_mode |= (1 << 0); /* SCE_SNAP_TO_NODE_X */
2543 }
2544 if (snap_node_mode & (1 << 6)) {
2545 tool_settings->snap_node_mode |= (1 << 1); /* SCE_SNAP_TO_NODE_Y */
2546 }
2547 if (snap_uv_mode & (1 << 4)) {
2548 tool_settings->snap_uv_mode |= (1 << 6); /* SCE_SNAP_TO_INCREMENT */
2549 }
2550
2551 SequencerToolSettings *sequencer_tool_settings = blender::seq::tool_settings_ensure(scene);
2552 sequencer_tool_settings->snap_mode = SEQ_SNAP_TO_STRIPS | SEQ_SNAP_TO_CURRENT_FRAME |
2554 sequencer_tool_settings->snap_distance = 15;
2555 }
2556 }
2557
2558 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 8)) {
2559 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2560 if (scene->master_collection != nullptr) {
2561 BLI_strncpy(scene->master_collection->id.name + 2,
2563 sizeof(scene->master_collection->id.name) - 2);
2564 }
2565 }
2566 }
2567
2568 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 9)) {
2569 /* Fix a bug where reordering FCurves and bActionGroups could cause some corruption. Just
2570 * reconstruct all the action groups & ensure that the FCurves of a group are continuously
2571 * stored (i.e. not mixed with other groups) to be sure. See #89435. */
2572 LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
2574 }
2575
2576 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2577 if (ntree->type == NTREE_GEOMETRY) {
2578 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2579 if (node->type_legacy == GEO_NODE_SUBDIVIDE_MESH) {
2580 STRNCPY(node->idname, "GeometryNodeMeshSubdivide");
2581 }
2582 }
2583 }
2584 }
2586 }
2587
2588 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 10)) {
2589 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2590 ToolSettings *tool_settings = scene->toolsettings;
2591 if (tool_settings->snap_uv_mode & (1 << 4)) {
2592 tool_settings->snap_uv_mode |= (1 << 6); /* SCE_SNAP_TO_INCREMENT */
2593 tool_settings->snap_uv_mode &= ~(1 << 4);
2594 }
2595 }
2596 LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
2597 if (!(mat->lineart.flags & LRT_MATERIAL_CUSTOM_OCCLUSION_EFFECTIVENESS)) {
2598 mat->lineart.mat_occlusion = 1;
2599 }
2600 }
2601 }
2602
2603 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 13)) {
2604 /* Convert Surface Deform to sparse-capable bind structure. */
2605 if (!DNA_struct_member_exists(
2606 fd->filesdna, "SurfaceDeformModifierData", "int", "mesh_verts_num"))
2607 {
2608 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2609 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
2610 if (md->type == eModifierType_SurfaceDeform) {
2612 if (smd->bind_verts_num && smd->verts) {
2613 smd->mesh_verts_num = smd->bind_verts_num;
2614
2615 for (uint i = 0; i < smd->bind_verts_num; i++) {
2616 smd->verts[i].vertex_idx = i;
2617 }
2618 }
2619 }
2620 }
2621 if (ob->type == OB_GPENCIL_LEGACY) {
2622 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
2623 if (md->type == eGpencilModifierType_Lineart) {
2626 lmd->chain_smooth_tolerance = 0.2f;
2627 }
2628 }
2629 }
2630 }
2631 }
2632
2633 if (!DNA_struct_member_exists(
2634 fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library"))
2635 {
2636 LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
2637 BKE_asset_library_reference_init_default(&workspace->asset_library_ref);
2638 }
2639 }
2640
2641 if (!DNA_struct_member_exists(
2642 fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library_ref"))
2643 {
2644 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2645 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2646 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
2647 if (space->spacetype == SPACE_FILE) {
2648 SpaceFile *sfile = (SpaceFile *)space;
2649 if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) {
2650 continue;
2651 }
2653 }
2654 }
2655 }
2656 }
2657 }
2658
2659 /* Set default 2D annotation placement. */
2660 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2661 ToolSettings *ts = scene->toolsettings;
2663 }
2664 }
2665
2666 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 14)) {
2667 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2668 ToolSettings *tool_settings = scene->toolsettings;
2669 tool_settings->snap_flag &= ~SCE_SNAP_SEQ;
2670 }
2671 }
2672
2673 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 15)) {
2674 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2675 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2676 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2677 if (sl->spacetype == SPACE_SEQ) {
2678 SpaceSeq *sseq = (SpaceSeq *)sl;
2680 }
2681 }
2682 }
2683 }
2684 }
2685
2686 /* Font names were copied directly into ID names, see: #90417. */
2687 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 16)) {
2688 ListBase *lb = which_libbase(bmain, ID_VF);
2690 }
2691
2692 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 17)) {
2693 if (!DNA_struct_member_exists(
2694 fd->filesdna, "View3DOverlay", "float", "normals_constant_screen_size"))
2695 {
2696 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2697 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2698 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2699 if (sl->spacetype == SPACE_VIEW3D) {
2700 View3D *v3d = (View3D *)sl;
2702 }
2703 }
2704 }
2705 }
2706 }
2707
2708 /* Fix SplineIK constraint's inconsistency between binding points array and its stored size.
2709 */
2710 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2711 /* NOTE: Objects should never have SplineIK constraint, so no need to apply this fix on
2712 * their constraints. */
2713 if (ob->pose) {
2714 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
2716 }
2717 }
2718 }
2719 }
2720
2721 /* Move visibility from Cycles to Blender. */
2722 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 17)) {
2723 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
2725 int flag = 0;
2726
2727 if (cvisibility) {
2728 flag |= version_cycles_property_boolean(cvisibility, "camera", true) ? 0 : OB_HIDE_CAMERA;
2729 flag |= version_cycles_property_boolean(cvisibility, "diffuse", true) ? 0 :
2731 flag |= version_cycles_property_boolean(cvisibility, "glossy", true) ? 0 : OB_HIDE_GLOSSY;
2732 flag |= version_cycles_property_boolean(cvisibility, "transmission", true) ?
2733 0 :
2735 flag |= version_cycles_property_boolean(cvisibility, "scatter", true) ?
2736 0 :
2738 flag |= version_cycles_property_boolean(cvisibility, "shadow", true) ? 0 : OB_HIDE_SHADOW;
2739 }
2740
2742 if (cobject) {
2743 flag |= version_cycles_property_boolean(cobject, "is_holdout", false) ? OB_HOLDOUT : 0;
2744 flag |= version_cycles_property_boolean(cobject, "is_shadow_catcher", false) ?
2746 0;
2747 }
2748
2749 if (object->type == OB_LAMP) {
2751 }
2752
2753 /* Clear unused bits from old version, and add new flags. */
2754 object->visibility_flag &= (OB_HIDE_VIEWPORT | OB_HIDE_SELECT | OB_HIDE_RENDER);
2755 object->visibility_flag |= flag;
2756 }
2757 }
2758
2759 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 18)) {
2760 if (!DNA_struct_member_exists(
2761 fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library_ref"))
2762 {
2763 LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
2764 BKE_asset_library_reference_init_default(&workspace->asset_library_ref);
2765 }
2766 }
2767
2768 if (!DNA_struct_member_exists(
2769 fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library_ref"))
2770 {
2771 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2772 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2773 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
2774 if (space->spacetype != SPACE_FILE) {
2775 continue;
2776 }
2777
2778 SpaceFile *sfile = (SpaceFile *)space;
2779 if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) {
2780 continue;
2781 }
2783 }
2784 }
2785 }
2786 }
2787
2788 /* Previously, only text ending with `.py` would run, apply this logic
2789 * to existing files so text that happens to have the "Register" enabled
2790 * doesn't suddenly start running code on startup that was previously ignored. */
2791 LISTBASE_FOREACH (Text *, text, &bmain->texts) {
2792 if ((text->flags & TXT_ISSCRIPT) && !BLI_path_extension_check(text->id.name + 2, ".py")) {
2793 text->flags &= ~TXT_ISSCRIPT;
2794 }
2795 }
2796 }
2797
2798 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 19)) {
2799 /* Disable Fade Inactive Overlay by default as it is redundant after introducing flash on
2800 * mode transfer. */
2801 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2802 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2803 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2804 if (sl->spacetype == SPACE_VIEW3D) {
2805 View3D *v3d = (View3D *)sl;
2807 }
2808 }
2809 }
2810 }
2811
2812 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2813 SequencerToolSettings *sequencer_tool_settings = blender::seq::tool_settings_ensure(scene);
2814 sequencer_tool_settings->overlap_mode = SEQ_OVERLAP_SHUFFLE;
2815 }
2816 }
2817
2818 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 20)) {
2819 /* Use new vector Size socket in Cube Mesh Primitive node. */
2820 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
2821 if (ntree->type != NTREE_GEOMETRY) {
2822 continue;
2823 }
2824
2825 LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
2826 if (link->tonode->type_legacy == GEO_NODE_MESH_PRIMITIVE_CUBE) {
2827 bNode *node = link->tonode;
2828 if (STREQ(link->tosock->identifier, "Size") && link->tosock->type == SOCK_FLOAT) {
2829 bNode *link_fromnode = link->fromnode;
2830 bNodeSocket *link_fromsock = link->fromsock;
2831 bNodeSocket *socket = link->tosock;
2832 BLI_assert(socket);
2833
2835 ntree, node, socket);
2837 *ntree, *link_fromnode, *link_fromsock, *node, *new_socket);
2838 }
2839 }
2840 }
2841
2842 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2843 if (node->type_legacy != GEO_NODE_MESH_PRIMITIVE_CUBE) {
2844 continue;
2845 }
2846 LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
2847 if (STREQ(socket->identifier, "Size") && (socket->type == SOCK_FLOAT)) {
2848 do_version_replace_float_size_with_vector(ntree, node, socket);
2849 break;
2850 }
2851 }
2852 }
2853 }
2854 }
2855
2856 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 22)) {
2857 if (!DNA_struct_member_exists(
2858 fd->filesdna, "LineartGpencilModifierData", "bool", "use_crease_on_smooth"))
2859 {
2860 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2861 if (ob->type == OB_GPENCIL_LEGACY) {
2862 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
2863 if (md->type == eGpencilModifierType_Lineart) {
2866 }
2867 }
2868 }
2869 }
2870 }
2871 }
2872
2873 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 23)) {
2874 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2875 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2876 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2877 if (sl->spacetype == SPACE_FILE) {
2878 SpaceFile *sfile = (SpaceFile *)sl;
2879 if (sfile->asset_params) {
2881 }
2882 }
2883 }
2884 }
2885 }
2886
2887 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2888 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2889 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2890 if (sl->spacetype == SPACE_SEQ) {
2891 SpaceSeq *sseq = (SpaceSeq *)sl;
2892 int seq_show_safe_margins = (sseq->flag & SEQ_PREVIEW_SHOW_SAFE_MARGINS);
2893 int seq_show_gpencil = (sseq->flag & SEQ_PREVIEW_SHOW_GPENCIL);
2894 int seq_show_fcurves = (sseq->flag & SEQ_TIMELINE_SHOW_FCURVES);
2895 int seq_show_safe_center = (sseq->flag & SEQ_PREVIEW_SHOW_SAFE_CENTER);
2896 int seq_show_metadata = (sseq->flag & SEQ_PREVIEW_SHOW_METADATA);
2897 int seq_show_strip_name = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_NAME);
2898 int seq_show_strip_source = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE);
2899 int seq_show_strip_duration = (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_DURATION);
2900 int seq_show_grid = (sseq->flag & SEQ_TIMELINE_SHOW_GRID);
2901 int show_strip_offset = (sseq->draw_flag & SEQ_TIMELINE_SHOW_STRIP_OFFSETS);
2902 sseq->preview_overlay.flag = (seq_show_safe_margins | seq_show_gpencil |
2903 seq_show_safe_center | seq_show_metadata);
2904 sseq->timeline_overlay.flag = (seq_show_fcurves | seq_show_strip_name |
2905 seq_show_strip_source | seq_show_strip_duration |
2906 seq_show_grid | show_strip_offset);
2907 }
2908 }
2909 }
2910 }
2911 }
2912
2913 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 24)) {
2914 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2915 SequencerToolSettings *sequencer_tool_settings = blender::seq::tool_settings_ensure(scene);
2916 sequencer_tool_settings->pivot_point = V3D_AROUND_CENTER_MEDIAN;
2917
2918 if (scene->ed != nullptr) {
2919 blender::seq::for_each_callback(&scene->ed->seqbase, strip_transform_origin_set, nullptr);
2920 }
2921 }
2922 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2923 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2924 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2925 if (sl->spacetype == SPACE_SEQ) {
2926 SpaceSeq *sseq = (SpaceSeq *)sl;
2928 }
2929 }
2930 }
2931 }
2932
2933 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2934 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2935 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2936 if (sl->spacetype == SPACE_SEQ) {
2937 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
2938 &sl->regionbase;
2939 LISTBASE_FOREACH (ARegion *, region, regionbase) {
2940 if (region->regiontype == RGN_TYPE_WINDOW) {
2941 region->v2d.min[1] = 4.0f;
2942 }
2943 }
2944 }
2945 }
2946 }
2947 }
2948 }
2949
2950 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 25)) {
2951 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
2952 if (ntree->type == NTREE_SHADER) {
2953 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
2955 }
2956 }
2957 }
2959
2960 enum {
2961 R_EXR_TILE_FILE = (1 << 10),
2962 R_FULL_SAMPLE = (1 << 15),
2963 };
2964 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2965 scene->r.scemode &= ~(R_EXR_TILE_FILE | R_FULL_SAMPLE);
2966 }
2967 }
2968
2969 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 25)) {
2970 enum {
2971 DENOISER_NLM = 1,
2973 };
2974
2975 /* Removal of NLM denoiser. */
2976 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
2977 IDProperty *cscene = version_cycles_properties_from_ID(&scene->id);
2978
2979 if (cscene) {
2980 if (version_cycles_property_int(cscene, "denoiser", DENOISER_NLM) == DENOISER_NLM) {
2982 }
2983 }
2984 }
2985 }
2986
2987 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 26)) {
2988 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
2989 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
2990 if (md->type == eModifierType_Nodes) {
2992 }
2993 }
2994 }
2995
2996 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2997 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2998 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
2999 switch (sl->spacetype) {
3000 case SPACE_FILE: {
3001 SpaceFile *sfile = (SpaceFile *)sl;
3002 if (sfile->params) {
3005 }
3006
3007 /* New default import method: Append with reuse. */
3008 if (sfile->asset_params) {
3010 }
3011 break;
3012 }
3013 default:
3014 break;
3015 }
3016 }
3017 }
3018 }
3019 }
3020
3021 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 29)) {
3022 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3023 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3024 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3025 switch (sl->spacetype) {
3026 case SPACE_SEQ: {
3027 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3028 &sl->regionbase;
3029 LISTBASE_FOREACH (ARegion *, region, regionbase) {
3030 if (region->regiontype == RGN_TYPE_WINDOW) {
3031 region->v2d.max[1] = blender::seq::MAX_CHANNELS;
3032 }
3033 }
3034 break;
3035 }
3036 }
3037 }
3038 }
3039 }
3040 }
3041
3042 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 31)) {
3043 /* Swap header with the tool header so the regular header is always on the edge. */
3044 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3045 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3046 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3047 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3048 &sl->regionbase;
3049 ARegion *region_tool = nullptr, *region_head = nullptr;
3050 int region_tool_index = -1, region_head_index = -1, i;
3051 LISTBASE_FOREACH_INDEX (ARegion *, region, regionbase, i) {
3052 if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
3053 region_tool = region;
3054 region_tool_index = i;
3055 }
3056 else if (region->regiontype == RGN_TYPE_HEADER) {
3057 region_head = region;
3058 region_head_index = i;
3059 }
3060 }
3061 if ((region_tool && region_head) && (region_head_index > region_tool_index)) {
3062 BLI_listbase_swaplinks(regionbase, region_tool, region_head);
3063 }
3064 }
3065 }
3066 }
3067
3068 /* Set strip color tags to STRIP_COLOR_NONE. */
3069 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3070 if (scene->ed != nullptr) {
3072 &scene->ed->seqbase, do_versions_sequencer_color_tags, nullptr);
3073 }
3074 }
3075
3076 /* Show sequencer color tags by default. */
3077 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3078 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3079 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3080 if (sl->spacetype == SPACE_SEQ) {
3081 SpaceSeq *sseq = (SpaceSeq *)sl;
3083 }
3084 }
3085 }
3086 }
3087
3088 /* Set defaults for new color balance modifier parameters. */
3089 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3090 if (scene->ed != nullptr) {
3092 &scene->ed->seqbase, do_versions_sequencer_color_balance_sop, nullptr);
3093 }
3094 }
3095 }
3096
3097 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 33)) {
3098 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3099 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3100 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3101 switch (sl->spacetype) {
3102 case SPACE_SEQ: {
3103 SpaceSeq *sseq = (SpaceSeq *)sl;
3104 enum { SEQ_DRAW_SEQUENCE = 0 };
3105 if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
3106 sseq->mainb = SEQ_DRAW_IMG_IMBUF;
3107 }
3108 break;
3109 }
3110 case SPACE_TEXT: {
3111 SpaceText *st = (SpaceText *)sl;
3112 st->flags &= ~ST_FLAG_UNUSED_4;
3113 break;
3114 }
3115 }
3116 }
3117 }
3118 }
3119 }
3120
3121 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 36)) {
3122 /* Update the `idnames` for renamed geometry and function nodes. */
3123 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3124 if (ntree->type != NTREE_GEOMETRY) {
3125 continue;
3126 }
3127 version_node_id(ntree, FN_NODE_COMPARE, "FunctionNodeCompareFloats");
3128 version_node_id(ntree, GEO_NODE_CAPTURE_ATTRIBUTE, "GeometryNodeCaptureAttribute");
3129 version_node_id(ntree, GEO_NODE_MESH_BOOLEAN, "GeometryNodeMeshBoolean");
3130 version_node_id(ntree, GEO_NODE_FILL_CURVE, "GeometryNodeFillCurve");
3131 version_node_id(ntree, GEO_NODE_FILLET_CURVE, "GeometryNodeFilletCurve");
3132 version_node_id(ntree, GEO_NODE_REVERSE_CURVE, "GeometryNodeReverseCurve");
3133 version_node_id(ntree, GEO_NODE_SAMPLE_CURVE, "GeometryNodeSampleCurve");
3134 version_node_id(ntree, GEO_NODE_RESAMPLE_CURVE, "GeometryNodeResampleCurve");
3135 version_node_id(ntree, GEO_NODE_SUBDIVIDE_CURVE, "GeometryNodeSubdivideCurve");
3136 version_node_id(ntree, GEO_NODE_TRIM_CURVE, "GeometryNodeTrimCurve");
3137 version_node_id(ntree, GEO_NODE_REPLACE_MATERIAL, "GeometryNodeReplaceMaterial");
3138 version_node_id(ntree, GEO_NODE_SUBDIVIDE_MESH, "GeometryNodeSubdivideMesh");
3139 version_node_id(ntree, GEO_NODE_SET_MATERIAL, "GeometryNodeSetMaterial");
3140 version_node_id(ntree, GEO_NODE_SPLIT_EDGES, "GeometryNodeSplitEdges");
3141 }
3142
3143 /* Update bone roll after a fix to vec_roll_to_mat3_normalized. */
3144 LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
3145 do_version_bones_roll(&arm->bonebase);
3146 }
3147 }
3148
3149 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 37)) {
3150 /* Node Editor: toggle overlays on. */
3151 if (!DNA_struct_exists(fd->filesdna, "SpaceNodeOverlay")) {
3152 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3153 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3154 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
3155 if (space->spacetype == SPACE_NODE) {
3156 SpaceNode *snode = (SpaceNode *)space;
3159 }
3160 }
3161 }
3162 }
3163 }
3164 }
3165
3166 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 38)) {
3167 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3168 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3169 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
3170 if (space->spacetype == SPACE_FILE) {
3171 SpaceFile *sfile = (SpaceFile *)space;
3172 FileAssetSelectParams *asset_params = sfile->asset_params;
3173 if (asset_params) {
3174 asset_params->base_params.filter_id = FILTER_ID_ALL;
3175 }
3176 }
3177 }
3178 }
3179 }
3180 }
3181
3182 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 39)) {
3183 LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
3184 wm->xr.session_settings.base_scale = 1.0f;
3185 wm->xr.session_settings.draw_flags |= (V3D_OFSDRAW_SHOW_SELECTION |
3188 }
3189 }
3190
3191 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 40)) {
3192 /* Update the `idnames` for renamed geometry and function nodes. */
3193 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3194 if (ntree->type != NTREE_GEOMETRY) {
3195 continue;
3196 }
3197 version_node_id(ntree, FN_NODE_SLICE_STRING, "FunctionNodeSliceString");
3199 }
3200
3201 /* Add storage to viewer node. */
3202 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3203 if (ntree->type != NTREE_GEOMETRY) {
3204 continue;
3205 }
3206 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3207 if (node->type_legacy == GEO_NODE_VIEWER) {
3208 if (node->storage == nullptr) {
3210 data->data_type = CD_PROP_FLOAT;
3211 node->storage = data;
3212 }
3213 }
3214 }
3215 }
3216
3217 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3218 if (ntree->type == NTREE_GEOMETRY) {
3220 ntree, GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, "Geometry", "Mesh");
3221 version_node_input_socket_name(ntree, GEO_NODE_POINTS_TO_VOLUME, "Geometry", "Points");
3222 version_node_output_socket_name(ntree, GEO_NODE_POINTS_TO_VOLUME, "Geometry", "Volume");
3223 version_node_socket_name(ntree, GEO_NODE_SUBDIVISION_SURFACE, "Geometry", "Mesh");
3224 version_node_socket_name(ntree, GEO_NODE_RESAMPLE_CURVE, "Geometry", "Curve");
3225 version_node_socket_name(ntree, GEO_NODE_SUBDIVIDE_CURVE, "Geometry", "Curve");
3226 version_node_socket_name(ntree, GEO_NODE_SET_CURVE_RADIUS, "Geometry", "Curve");
3227 version_node_socket_name(ntree, GEO_NODE_SET_CURVE_TILT, "Geometry", "Curve");
3228 version_node_socket_name(ntree, GEO_NODE_SET_CURVE_HANDLES, "Geometry", "Curve");
3229 version_node_socket_name(ntree, GEO_NODE_TRANSLATE_INSTANCES, "Geometry", "Instances");
3230 version_node_socket_name(ntree, GEO_NODE_ROTATE_INSTANCES, "Geometry", "Instances");
3231 version_node_socket_name(ntree, GEO_NODE_SCALE_INSTANCES, "Geometry", "Instances");
3232 version_node_output_socket_name(ntree, GEO_NODE_MESH_BOOLEAN, "Geometry", "Mesh");
3233 version_node_input_socket_name(ntree, GEO_NODE_MESH_BOOLEAN, "Geometry 1", "Mesh 1");
3234 version_node_input_socket_name(ntree, GEO_NODE_MESH_BOOLEAN, "Geometry 2", "Mesh 2");
3235 version_node_socket_name(ntree, GEO_NODE_SUBDIVIDE_MESH, "Geometry", "Mesh");
3236 version_node_socket_name(ntree, GEO_NODE_TRIANGULATE, "Geometry", "Mesh");
3240 ntree, GEO_NODE_MESH_PRIMITIVE_CYLINDER, "Geometry", "Mesh");
3243 ntree, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, "Geometry", "Mesh");
3247 ntree, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, "Geometry", "Mesh");
3248 version_node_socket_name(ntree, GEO_NODE_SET_POINT_RADIUS, "Geometry", "Points");
3249 }
3250 }
3251 }
3252
3253 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 42)) {
3254 /* Use consistent socket identifiers for the math node.
3255 * The code to make unique identifiers from the names was inconsistent. */
3256 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3257 if (ntree->type != NTREE_CUSTOM) {
3259 }
3260 }
3262
3263 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3264 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3265 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3266 if (sl->spacetype == SPACE_SEQ) {
3267 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3268 &sl->regionbase;
3269 LISTBASE_FOREACH (ARegion *, region, regionbase) {
3270 if (region->regiontype == RGN_TYPE_WINDOW) {
3271 region->v2d.min[1] = 1.0f;
3272 }
3273 }
3274 }
3275 }
3276 }
3277 }
3278
3279 /* Change minimum zoom to 0.05f in the node editor. */
3280 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3281 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3282 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3283 if (sl->spacetype == SPACE_NODE) {
3284 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3285 &sl->regionbase;
3286 LISTBASE_FOREACH (ARegion *, region, regionbase) {
3287 if (region->regiontype == RGN_TYPE_WINDOW) {
3288 region->v2d.minzoom = std::min(region->v2d.minzoom, 0.05f);
3289 }
3290 }
3291 }
3292 }
3293 }
3294 }
3295 }
3296
3297 /* Special case to handle older in-development 3.1 files, before change from 3.0 branch gets
3298 * merged in master. */
3299 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 42) ||
3300 (bmain->versionfile == 301 && !MAIN_VERSION_FILE_ATLEAST(bmain, 301, 3)))
3301 {
3302 /* Update LibOverride operations regarding insertions in RNA collections (i.e. modifiers,
3303 * constraints and NLA tracks). */
3304 ID *id_iter;
3305 FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
3306 if (ID_IS_OVERRIDE_LIBRARY_REAL(id_iter)) {
3308 if (GS(id_iter->name) == ID_OB) {
3310 }
3311 }
3312 }
3314 }
3315
3316 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 301, 4)) {
3317 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3318 if (ntree->type != NTREE_GEOMETRY) {
3319 continue;
3320 }
3321 version_node_id(ntree, GEO_NODE_CURVE_SPLINE_PARAMETER, "GeometryNodeSplineParameter");
3322 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3323 if (node->type_legacy == GEO_NODE_CURVE_SPLINE_PARAMETER) {
3325 ntree, node, SOCK_OUT, SOCK_INT, PROP_NONE, "Index", "Index");
3326 }
3327
3328 /* Convert float compare into a more general compare node. */
3329 if (node->type_legacy == FN_NODE_COMPARE) {
3330 if (node->storage == nullptr) {
3332 data->data_type = SOCK_FLOAT;
3333 data->operation = node->custom1;
3334 STRNCPY(node->idname, "FunctionNodeCompare");
3335 node->storage = data;
3336 }
3337 }
3338 }
3339 }
3340
3341 /* Add a toggle for the breadcrumbs overlay in the node editor. */
3342 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3343 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3344 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
3345 if (space->spacetype == SPACE_NODE) {
3346 SpaceNode *snode = (SpaceNode *)space;
3348 }
3349 }
3350 }
3351 }
3352 }
3353
3354 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 301, 6)) {
3355 /* Add node storage for map range node. */
3356 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3357 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3358 if (node->type_legacy == SH_NODE_MAP_RANGE) {
3359 if (node->storage == nullptr) {
3361 data->clamp = node->custom1;
3362 data->data_type = CD_PROP_FLOAT;
3363 data->interpolation_type = node->custom2;
3364 node->storage = data;
3365 }
3366 }
3367 }
3368 }
3370
3371 /* Update spreadsheet data set region type. */
3372 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3373 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3374 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3375 if (sl->spacetype == SPACE_SPREADSHEET) {
3376 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3377 &sl->regionbase;
3378 LISTBASE_FOREACH (ARegion *, region, regionbase) {
3379 if (region->regiontype == RGN_TYPE_CHANNELS) {
3380 region->regiontype = RGN_TYPE_TOOLS;
3381 }
3382 }
3383 }
3384 }
3385 }
3386 }
3387
3388 LISTBASE_FOREACH (Curve *, curve, &bmain->curves) {
3389 LISTBASE_FOREACH (Nurb *, nurb, &curve->nurb) {
3390 /* Previously other flags were ignored if CU_NURB_CYCLIC is set. */
3391 if (nurb->flagu & CU_NURB_CYCLIC) {
3392 nurb->flagu = CU_NURB_CYCLIC;
3394 }
3395 /* Previously other flags were ignored if CU_NURB_CYCLIC is set. */
3396 if (nurb->flagv & CU_NURB_CYCLIC) {
3397 nurb->flagv = CU_NURB_CYCLIC;
3399 }
3400 }
3401 }
3402
3403 /* Initialize the bone wireframe opacity setting. */
3404 if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "bone_wire_alpha")) {
3405 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3406 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3407 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3408 if (sl->spacetype == SPACE_VIEW3D) {
3409 View3D *v3d = (View3D *)sl;
3410 v3d->overlay.bone_wire_alpha = 1.0f;
3411 }
3412 }
3413 }
3414 }
3415 }
3416
3417 /* Rename sockets on multiple nodes */
3418 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3419 if (ntree->type == NTREE_GEOMETRY) {
3421 ntree, GEO_NODE_STRING_TO_CURVES, "Curves", "Curve Instances");
3423 ntree, GEO_NODE_INPUT_MESH_EDGE_ANGLE, "Angle", "Unsigned Angle");
3425 ntree, GEO_NODE_INPUT_MESH_ISLAND, "Index", "Island Index");
3427 ntree, GEO_NODE_TRANSFER_ATTRIBUTE_DEPRECATED, "Target", "Source");
3428 }
3429 }
3430 }
3431
3432 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 301, 7) ||
3433 (bmain->versionfile == 302 && !MAIN_VERSION_FILE_ATLEAST(bmain, 302, 4)))
3434 {
3435 /* Duplicate value for two flags that mistakenly had the same numeric value. */
3436 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3437 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
3438 if (md->type == eModifierType_WeightVGProximity) {
3442 }
3443 }
3444 }
3445 }
3446 }
3447
3448 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 2)) {
3449 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3450 if (scene->ed != nullptr) {
3451 blender::seq::for_each_callback(&scene->ed->seqbase, strip_transform_filter_set, nullptr);
3452 }
3453 }
3454 }
3455
3456 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 6)) {
3457 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3458 ToolSettings *tool_settings = scene->toolsettings;
3459 tool_settings->snap_flag_seq = tool_settings->snap_flag &
3460 ~(short(SCE_SNAP) | short(SCE_SNAP_SEQ));
3461 if (tool_settings->snap_flag & SCE_SNAP_SEQ) {
3462 tool_settings->snap_flag_seq |= SCE_SNAP;
3463 tool_settings->snap_flag &= ~SCE_SNAP_SEQ;
3464 }
3465
3466 tool_settings->snap_flag_node = tool_settings->snap_flag;
3467 tool_settings->snap_uv_flag |= tool_settings->snap_flag & SCE_SNAP;
3468 }
3469
3470 /* Alter NURBS knot mode flags to fit new modes. */
3471 LISTBASE_FOREACH (Curve *, curve, &bmain->curves) {
3472 LISTBASE_FOREACH (Nurb *, nurb, &curve->nurb) {
3473 /* CU_NURB_BEZIER and CU_NURB_ENDPOINT were ignored if combined. */
3474 if (nurb->flagu & CU_NURB_BEZIER && nurb->flagu & CU_NURB_ENDPOINT) {
3475 nurb->flagu &= ~(CU_NURB_BEZIER | CU_NURB_ENDPOINT);
3477 }
3478 else if (nurb->flagu & CU_NURB_CYCLIC) {
3479 /* In 45d038181ae2 cyclic bezier support is added, but CU_NURB_ENDPOINT still ignored. */
3480 nurb->flagu = CU_NURB_CYCLIC | (nurb->flagu & CU_NURB_BEZIER);
3482 }
3483 /* Bezier NURBS of order 3 were clamped to first control point. */
3484 if (nurb->orderu == 3 && (nurb->flagu & CU_NURB_BEZIER)) {
3485 nurb->flagu |= CU_NURB_ENDPOINT;
3487 }
3488 /* CU_NURB_BEZIER and CU_NURB_ENDPOINT were ignored if combined. */
3489 if (nurb->flagv & CU_NURB_BEZIER && nurb->flagv & CU_NURB_ENDPOINT) {
3490 nurb->flagv &= ~(CU_NURB_BEZIER | CU_NURB_ENDPOINT);
3492 }
3493 else if (nurb->flagv & CU_NURB_CYCLIC) {
3494 /* In 45d038181ae2 cyclic bezier support is added, but CU_NURB_ENDPOINT still ignored. */
3495 nurb->flagv = CU_NURB_CYCLIC | (nurb->flagv & CU_NURB_BEZIER);
3497 }
3498 /* Bezier NURBS of order 3 were clamped to first control point. */
3499 if (nurb->orderv == 3 && (nurb->flagv & CU_NURB_BEZIER)) {
3500 nurb->flagv |= CU_NURB_ENDPOINT;
3502 }
3503 }
3504 }
3505
3506 /* Change grease pencil smooth iterations to match old results with new algorithm. */
3507 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3508 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
3509 if (md->type == eGpencilModifierType_Smooth) {
3511 if (gpmd->step == 1 && gpmd->factor <= 0.5f) {
3512 gpmd->factor *= 2.0f;
3513 }
3514 else {
3515 gpmd->step = 1 + int(gpmd->factor * max_ff(0.0f,
3516 min_ff(5.1f * sqrtf(gpmd->step) - 3.0f,
3517 gpmd->step + 2.0f)));
3518 gpmd->factor = 1.0f;
3519 }
3520 }
3521 }
3522 }
3523 }
3524
3525 /* Rebuild active/render color attribute references. */
3526 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 6)) {
3527 LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
3528 /* Buggy code in wm_toolsystem broke smear in old files,
3529 * reset to defaults. */
3530 if (br->sculpt_brush_type == SCULPT_BRUSH_TYPE_SMEAR) {
3531 br->alpha = 1.0f;
3532 br->spacing = 5;
3533 br->flag &= ~BRUSH_ALPHA_PRESSURE;
3534 br->flag &= ~BRUSH_SPACE_ATTEN;
3535 br->curve_preset = BRUSH_CURVE_SPHERE;
3536 }
3537 }
3538
3539 LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
3540 for (int step = 0; step < 2; step++) {
3541 CustomDataLayer *actlayer = nullptr;
3542
3543 int vact1, vact2;
3544
3545 if (step) {
3546 vact1 = CustomData_get_render_layer_index(&me->vert_data, CD_PROP_COLOR);
3547 vact2 = CustomData_get_render_layer_index(&me->corner_data, CD_PROP_BYTE_COLOR);
3548 }
3549 else {
3550 vact1 = CustomData_get_active_layer_index(&me->vert_data, CD_PROP_COLOR);
3551 vact2 = CustomData_get_active_layer_index(&me->corner_data, CD_PROP_BYTE_COLOR);
3552 }
3553
3554 if (vact1 != -1) {
3555 actlayer = me->vert_data.layers + vact1;
3556 }
3557 else if (vact2 != -1) {
3558 actlayer = me->corner_data.layers + vact2;
3559 }
3560
3561 if (actlayer) {
3562 if (step) {
3563 BKE_id_attributes_default_color_set(&me->id, actlayer->name);
3564 }
3565 else {
3566 BKE_id_attributes_active_color_set(&me->id, actlayer->name);
3567 }
3568 }
3569 }
3570 }
3571 }
3572
3573 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 7)) {
3574 /* Generate 'system' liboverrides IDs.
3575 * NOTE: This is a fairly rough process, based on very basic heuristics. Should be enough for a
3576 * do_version code though, this is a new optional feature, not a critical conversion. */
3577 ID *id;
3578 FOREACH_MAIN_ID_BEGIN (bmain, id) {
3579 if (!ID_IS_OVERRIDE_LIBRARY_REAL(id) || ID_IS_LINKED(id)) {
3580 /* Ignore non-real liboverrides, and linked ones. */
3581 continue;
3582 }
3583 if (GS(id->name) == ID_OB) {
3584 /* Never 'lock' an object into a system override for now. */
3585 continue;
3586 }
3588 /* Do not 'lock' an ID already edited by the user. */
3589 continue;
3590 }
3591 id->override_library->flag |= LIBOVERRIDE_FLAG_SYSTEM_DEFINED;
3592 }
3594
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 != nullptr) {
3601 continue;
3602 }
3603 brush->curves_sculpt_settings = MEM_callocN<BrushCurvesSculptSettings>(__func__);
3604 brush->curves_sculpt_settings->add_amount = 1;
3605 }
3606
3607 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3608 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3609 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3610 if (sl->spacetype == SPACE_OUTLINER) {
3611 SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
3612 space_outliner->filter &= ~SO_FILTER_CLEARED_1;
3613 }
3614 }
3615 }
3616 }
3617 }
3618
3619 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 9)) {
3620 /* Sequencer channels region. */
3621 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3622 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3623 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3624 if (sl->spacetype != SPACE_SEQ) {
3625 continue;
3626 }
3628 continue;
3629 }
3630
3631 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3632 &sl->regionbase;
3634 if (!region) {
3635 /* Find sequencer tools region. */
3636 ARegion *tools_region = BKE_region_find_in_listbase_by_type(regionbase,
3638 region = do_versions_add_region(RGN_TYPE_CHANNELS, "channels region");
3639 BLI_insertlinkafter(regionbase, tools_region, region);
3640 region->alignment = RGN_ALIGN_LEFT;
3642 }
3643
3644 ARegion *timeline_region = BKE_region_find_in_listbase_by_type(regionbase,
3646 if (timeline_region != nullptr) {
3647 timeline_region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
3648 }
3649 }
3650 }
3651 }
3652
3653 /* Initialize channels. */
3654 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3656 if (ed == nullptr) {
3657 continue;
3658 }
3660 blender::seq::for_each_callback(&scene->ed->seqbase, strip_meta_channels_ensure, nullptr);
3661
3662 ed->displayed_channels = &ed->channels;
3663
3664 ListBase *previous_channels = &ed->channels;
3665 LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) {
3666 ms->old_channels = previous_channels;
3667 previous_channels = &ms->parent_strip->channels;
3668 /* If `MetaStack` exists, active channels must point to last link. */
3669 ed->displayed_channels = &ms->parent_strip->channels;
3670 }
3671 }
3672 }
3673
3674 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 10)) {
3675 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3676 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3677 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3678 if (sl->spacetype != SPACE_FILE) {
3679 continue;
3680 }
3681 SpaceFile *sfile = (SpaceFile *)sl;
3682 if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) {
3683 continue;
3684 }
3686 }
3687 }
3688 }
3689
3690 /* While vertex-colors were experimental the smear tool became corrupt due
3691 * to bugs in the wm_toolsystem API (auto-creation of sculpt brushes
3692 * was broken). Go through and reset all smear brushes. */
3693 LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
3694 if (br->sculpt_brush_type == SCULPT_BRUSH_TYPE_SMEAR) {
3695 br->alpha = 1.0f;
3696 br->spacing = 5;
3697 br->flag &= ~BRUSH_ALPHA_PRESSURE;
3698 br->flag &= ~BRUSH_SPACE_ATTEN;
3699 br->curve_preset = BRUSH_CURVE_SPHERE;
3700 }
3701 }
3702
3703 /* Rebuild active/render color attribute references. */
3704 LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
3705 for (int step = 0; step < 2; step++) {
3706 CustomDataLayer *actlayer = nullptr;
3707
3708 int vact1, vact2;
3709
3710 if (step) {
3711 vact1 = CustomData_get_render_layer_index(&me->vert_data, CD_PROP_COLOR);
3712 vact2 = CustomData_get_render_layer_index(&me->corner_data, CD_PROP_BYTE_COLOR);
3713 }
3714 else {
3715 vact1 = CustomData_get_active_layer_index(&me->vert_data, CD_PROP_COLOR);
3716 vact2 = CustomData_get_active_layer_index(&me->corner_data, CD_PROP_BYTE_COLOR);
3717 }
3718
3719 if (vact1 != -1) {
3720 actlayer = me->vert_data.layers + vact1;
3721 }
3722 else if (vact2 != -1) {
3723 actlayer = me->corner_data.layers + vact2;
3724 }
3725
3726 if (actlayer) {
3727 if (step) {
3728 BKE_id_attributes_default_color_set(&me->id, actlayer->name);
3729 }
3730 else {
3731 BKE_id_attributes_active_color_set(&me->id, actlayer->name);
3732 }
3733 }
3734 }
3735 }
3736
3737 /* Update data transfer modifiers */
3738 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3739 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
3740 if (md->type == eModifierType_DataTransfer) {
3742
3743 for (int i = 0; i < DT_MULTILAYER_INDEX_MAX; i++) {
3744 if (dtmd->layers_select_src[i] == 0) {
3746 }
3747
3748 if (dtmd->layers_select_dst[i] == 0) {
3750 }
3751 }
3752 }
3753 }
3754 }
3755 }
3756
3757 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 12)) {
3758 /* UV/Image show background grid option. */
3759 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3760 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3761 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
3762 if (space->spacetype == SPACE_IMAGE) {
3763 SpaceImage *sima = (SpaceImage *)space;
3765 }
3766 }
3767 }
3768 }
3769
3770 /* Add node storage for the merge by distance node. */
3771 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3772 if (ntree->type == NTREE_GEOMETRY) {
3773 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3774 if (node->type_legacy == GEO_NODE_MERGE_BY_DISTANCE) {
3775 if (node->storage == nullptr) {
3777 __func__);
3779 node->storage = data;
3780 }
3781 }
3782 }
3783 }
3784 }
3786
3787 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
3788 if (ntree->type == NTREE_GEOMETRY) {
3790 ntree, GEO_NODE_SUBDIVISION_SURFACE, "Crease", "Edge Crease");
3791 }
3792 }
3793 }
3794
3795 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 13)) {
3796 /* Enable named attributes overlay in node editor. */
3797 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3798 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3799 LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
3800 if (space->spacetype == SPACE_NODE) {
3801 SpaceNode *snode = (SpaceNode *)space;
3803 }
3804 }
3805 }
3806 }
3807
3808 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3809 BrushCurvesSculptSettings *settings = brush->curves_sculpt_settings;
3810 if (settings == nullptr) {
3811 continue;
3812 }
3813 if (settings->curve_length == 0.0f) {
3814 settings->curve_length = 0.3f;
3815 }
3816 }
3817 }
3818
3819 if (!DNA_struct_member_exists(fd->filesdna, "Sculpt", "float", "automasking_cavity_factor")) {
3820 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3821 if (scene->toolsettings && scene->toolsettings->sculpt) {
3822 scene->toolsettings->sculpt->automasking_cavity_factor = 0.5f;
3823 }
3824 }
3825 }
3826
3827 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 14)) {
3828 /* Compensate for previously wrong squared distance. */
3829 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3830 scene->r.bake.max_ray_distance = safe_sqrtf(scene->r.bake.max_ray_distance);
3831 }
3832 }
3833
3834 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 1)) {
3835 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3837 }
3839
3840 /* Initialize brush curves sculpt settings. */
3841 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3842 if (brush->ob_mode != OB_MODE_SCULPT_CURVES) {
3843 continue;
3844 }
3845 if (brush->curves_sculpt_settings->points_per_curve == 0) {
3846 brush->curves_sculpt_settings->points_per_curve = 8;
3847 }
3848 }
3849
3850 /* UDIM Packing. */
3851 if (!DNA_struct_member_exists(fd->filesdna, "ImagePackedFile", "int", "tile_number")) {
3852 LISTBASE_FOREACH (Image *, ima, &bmain->images) {
3853 int view;
3854 LISTBASE_FOREACH_INDEX (ImagePackedFile *, imapf, &ima->packedfiles, view) {
3855 imapf->view = view;
3856 imapf->tile_number = 1001;
3857 }
3858 }
3859 }
3860
3861 /* Merge still offsets into start/end offsets. */
3862 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3864 if (ed != nullptr) {
3866 }
3867 }
3868
3869 /* Use the curves type enum for the set spline type node, instead of a special one. */
3870 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3871 if (ntree->type == NTREE_GEOMETRY) {
3872 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3873 if (node->type_legacy == GEO_NODE_CURVE_SPLINE_TYPE) {
3874 NodeGeometryCurveSplineType *storage = (NodeGeometryCurveSplineType *)node->storage;
3875 switch (storage->spline_type) {
3876 case 0: /* GEO_NODE_SPLINE_TYPE_BEZIER */
3877 storage->spline_type = CURVE_TYPE_BEZIER;
3878 break;
3879 case 1: /* GEO_NODE_SPLINE_TYPE_NURBS */
3880 storage->spline_type = CURVE_TYPE_NURBS;
3881 break;
3882 case 2: /* GEO_NODE_SPLINE_TYPE_POLY */
3883 storage->spline_type = CURVE_TYPE_POLY;
3884 break;
3885 }
3886 }
3887 }
3888 }
3889 }
3891
3892 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
3893 LISTBASE_FOREACH (GpencilModifierData *, gpd, &ob->greasepencil_modifiers) {
3894 if (gpd->type == eGpencilModifierType_Lineart) {
3896 lmd->shadow_camera_near = 0.1f;
3897 lmd->shadow_camera_far = 200.0f;
3898 lmd->shadow_camera_size = 200.0f;
3899 }
3900 }
3901 }
3902 }
3903
3904 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 2)) {
3905 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3906 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3907 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3908 if (sl->spacetype == SPACE_CLIP) {
3909 ((SpaceClip *)sl)->mask_info.blend_factor = 1.0;
3910 }
3911 }
3912 }
3913 }
3914 }
3915
3916 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 3)) {
3917 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3918 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3919 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3920 if (sl->spacetype == SPACE_CLIP) {
3921 ((SpaceClip *)sl)->mask_info.draw_flag |= MASK_DRAWFLAG_SPLINE;
3922 }
3923 else if (sl->spacetype == SPACE_IMAGE) {
3924 ((SpaceImage *)sl)->mask_info.draw_flag |= MASK_DRAWFLAG_SPLINE;
3925 }
3926 }
3927 }
3928 }
3929
3930 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3931 ToolSettings *tool_settings = scene->toolsettings;
3932 /* Zero isn't a valid value, use for versioning. */
3933 if (tool_settings->snap_face_nearest_steps == 0) {
3934 /* Minimum of snap steps for face nearest is 1. */
3935 tool_settings->snap_face_nearest_steps = 1;
3936 /* Set snap to edited and non-edited as default. */
3938 }
3939 }
3940 }
3941
3942 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 4)) {
3943 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
3944 if (ntree->type == NTREE_COMPOSIT) {
3945 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
3946 if (node->type_legacy == CMP_NODE_OUTPUT_FILE) {
3947 LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
3948 if (sock->storage) {
3949 NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)sock->storage;
3950 version_fix_image_format_copy(bmain, &sockdata->format);
3951 }
3952 }
3953
3954 if (node->storage) {
3955 NodeImageMultiFile *nimf = (NodeImageMultiFile *)node->storage;
3957 }
3958 }
3959 }
3960 }
3961 }
3963
3964 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3965 version_fix_image_format_copy(bmain, &scene->r.im_format);
3966 }
3967 }
3968
3969 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 5)) {
3970 /* Fix for #98925 - remove channels region, that was initialized in incorrect editor types. */
3971 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3972 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3973 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
3974 if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_CLIP, SPACE_GRAPH, SPACE_NLA, SPACE_SEQ)) {
3975 continue;
3976 }
3977
3978 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
3979 &sl->regionbase;
3980 ARegion *channels_region = BKE_region_find_in_listbase_by_type(regionbase,
3982 if (channels_region) {
3983 MEM_delete(channels_region->runtime);
3984 BLI_freelinkN(regionbase, channels_region);
3985 }
3986 }
3987 }
3988 }
3989 }
3990
3991 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 6)) {
3992 /* Initialize brush curves sculpt settings. */
3993 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
3994 if (brush->ob_mode != OB_MODE_SCULPT_CURVES) {
3995 continue;
3996 }
3997 brush->curves_sculpt_settings->density_add_attempts = 100;
3998 }
3999
4000 /* Disable 'show_bounds' option of curve objects. Option was set as there was no object mode
4001 * outline implementation. See #95933. */
4002 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
4003 if (ob->type == OB_CURVES) {
4004 ob->dtx &= ~OB_DRAWBOUNDOX;
4005 }
4006 }
4007
4009 }
4010
4011 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 1)) {
4012 /* Image generation information transferred to tiles. */
4013 if (!DNA_struct_member_exists(fd->filesdna, "ImageTile", "int", "gen_x")) {
4014 LISTBASE_FOREACH (Image *, ima, &bmain->images) {
4015 LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
4016 tile->gen_x = ima->gen_x;
4017 tile->gen_y = ima->gen_y;
4018 tile->gen_type = ima->gen_type;
4019 tile->gen_flag = ima->gen_flag;
4020 tile->gen_depth = ima->gen_depth;
4021 copy_v4_v4(tile->gen_color, ima->gen_color);
4022 }
4023 }
4024 }
4025
4026 /* Convert mix rgb node to new mix node and add storage. */
4027 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
4029 }
4031
4032 /* Face sets no longer store whether the corresponding face is hidden. */
4033 LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
4034 int *face_sets = (int *)CustomData_get_layer(&mesh->face_data, CD_SCULPT_FACE_SETS);
4035 if (face_sets) {
4036 for (int i = 0; i < mesh->faces_num; i++) {
4037 face_sets[i] = abs(face_sets[i]);
4038 }
4039 }
4040 }
4041
4042 /* Custom grids in UV Editor have separate X and Y divisions. */
4043 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4044 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4045 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4046 switch (sl->spacetype) {
4047 case SPACE_IMAGE: {
4048 SpaceImage *sima = (SpaceImage *)sl;
4049 sima->custom_grid_subdiv[0] = 10;
4050 sima->custom_grid_subdiv[1] = 10;
4051 break;
4052 }
4053 }
4054 }
4055 }
4056 }
4057 }
4058
4059 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 2)) {
4060 /* Initialize brush curves sculpt settings. */
4061 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
4062 brush->automasking_cavity_factor = 0.5f;
4063 }
4064 }
4065
4066 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 3)) {
4067 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4068 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4069 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4070 if (sl->spacetype == SPACE_VIEW3D) {
4071 View3D *v3d = (View3D *)sl;
4072 v3d->flag2 |= V3D_SHOW_VIEWER;
4075 }
4076 if (sl->spacetype == SPACE_IMAGE) {
4077 SpaceImage *sima = (SpaceImage *)sl;
4078 if (sima->flag & SI_FLAG_UNUSED_18) { /* Was #SI_CUSTOM_GRID. */
4080 sima->flag &= ~SI_FLAG_UNUSED_18;
4081 }
4082 }
4083 }
4084 }
4085 }
4086
4087 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
4088 if (ntree->type != NTREE_GEOMETRY) {
4089 continue;
4090 }
4091 version_node_id(ntree, GEO_NODE_OFFSET_POINT_IN_CURVE, "GeometryNodeOffsetPointInCurve");
4092 }
4093 }
4094
4095 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 4)) {
4096 /* Update brush sculpt settings. */
4097 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
4098 brush->automasking_cavity_factor = 1.0f;
4099 }
4100 }
4101
4102 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 5)) {
4103 /* Fix for #101622 - update flags of sequence editor regions that were not initialized
4104 * properly. */
4105 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4106 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4107 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4108 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
4109 &sl->regionbase;
4110 if (sl->spacetype == SPACE_SEQ) {
4111 LISTBASE_FOREACH (ARegion *, region, regionbase) {
4112 if (region->regiontype == RGN_TYPE_TOOLS) {
4113 region->v2d.flag &= ~V2D_VIEWSYNC_AREA_VERTICAL;
4114 }
4115 if (region->regiontype == RGN_TYPE_CHANNELS) {
4116 region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
4117 }
4118 }
4119 }
4120 }
4121 }
4122 }
4123 }
4124
4125 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 6)) {
4126 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
4127 if (ntree->type != NTREE_GEOMETRY) {
4128 continue;
4129 }
4130 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
4131 if (node->type_legacy != GEO_NODE_SAMPLE_CURVE) {
4132 continue;
4133 }
4134 static_cast<NodeGeometryCurveSample *>(node->storage)->use_all_curves = true;
4135 static_cast<NodeGeometryCurveSample *>(node->storage)->data_type = CD_PROP_FLOAT;
4136 bNodeSocket *curve_socket = blender::bke::node_find_socket(*node, SOCK_IN, "Curve");
4137 BLI_assert(curve_socket != nullptr);
4138 STRNCPY(curve_socket->name, "Curves");
4139 STRNCPY(curve_socket->identifier, "Curves");
4140 }
4141 }
4142 }
4143
4144 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 2)) {
4145 LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
4146 MovieTracking *tracking = &clip->tracking;
4147
4148 const float frame_center_x = float(clip->lastsize[0]) / 2;
4149 const float frame_center_y = float(clip->lastsize[1]) / 2;
4150
4151 tracking->camera.principal_point[0] = (tracking->camera.principal_legacy[0] -
4152 frame_center_x) /
4153 frame_center_x;
4154 tracking->camera.principal_point[1] = (tracking->camera.principal_legacy[1] -
4155 frame_center_y) /
4156 frame_center_y;
4157 }
4158 }
4159
4160 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 4)) {
4161 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
4162 if (ntree->type == NTREE_GEOMETRY) {
4163 version_node_socket_name(ntree, GEO_NODE_COLLECTION_INFO, "Geometry", "Instances");
4164 }
4165 }
4166
4167 /* UVSeam fixing distance. */
4168 if (!DNA_struct_member_exists(fd->filesdna, "Image", "short", "seam_margin")) {
4169 LISTBASE_FOREACH (Image *, image, &bmain->images) {
4170 image->seam_margin = 8;
4171 }
4172 }
4173
4174 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
4175 if (ntree->type == NTREE_GEOMETRY) {
4177 }
4178 }
4179 }
4180
4181 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 6)) {
4182 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4183 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4184 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4185 if (sl->spacetype == SPACE_VIEW3D) {
4186 View3D *v3d = (View3D *)sl;
4189 }
4190 }
4191 }
4192 }
4193 }
4194
4195 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 7)) {
4196 LISTBASE_FOREACH (Light *, light, &bmain->lights) {
4197 light->radius = light->area_size;
4198 }
4199 /* Grease Pencil Build modifier:
4200 * Set default value for new natural draw-speed factor and maximum gap. */
4201 if (!DNA_struct_member_exists(
4202 fd->filesdna, "BuildGpencilModifierData", "float", "speed_fac") ||
4203 !DNA_struct_member_exists(
4204 fd->filesdna, "BuildGpencilModifierData", "float", "speed_maxgap"))
4205 {
4206 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
4207 LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
4208 if (md->type == eGpencilModifierType_Build) {
4210 mmd->speed_fac = 1.2f;
4211 mmd->speed_maxgap = 0.5f;
4212 }
4213 }
4214 }
4215 }
4216 }
4217
4218 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 8)) {
4219 const int CV_SCULPT_SELECTION_ENABLED = (1 << 1);
4220 LISTBASE_FOREACH (Curves *, curves_id, &bmain->hair_curves) {
4221 curves_id->flag &= ~CV_SCULPT_SELECTION_ENABLED;
4222 }
4223 LISTBASE_FOREACH (Curves *, curves_id, &bmain->hair_curves) {
4224 AttributeOwner owner = AttributeOwner::from_id(&curves_id->id);
4225 BKE_attribute_rename(owner, ".selection_point_float", ".selection", nullptr);
4226 BKE_attribute_rename(owner, ".selection_curve_float", ".selection", nullptr);
4227 }
4228
4229 /* Toggle the Invert Vertex Group flag on Armature modifiers in some cases. */
4230 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
4231 bool after_armature = false;
4232 LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
4233 if (md->type == eModifierType_Armature) {
4235 if (amd->multi) {
4236 /* Toggle the invert vertex group flag on operational Multi Modifier entries. */
4237 if (after_armature && amd->defgrp_name[0]) {
4239 }
4240 }
4241 else {
4242 /* Disabled multi modifiers don't reset propagation, but non-multi ones do. */
4243 after_armature = false;
4244 }
4245 /* Multi Modifier is only valid and operational after an active Armature modifier. */
4246 if (md->mode & (eModifierMode_Realtime | eModifierMode_Render)) {
4247 after_armature = true;
4248 }
4249 }
4251 /* These modifiers will also allow a following Multi Modifier to work. */
4252 after_armature = (md->mode & (eModifierMode_Realtime | eModifierMode_Render)) != 0;
4253 }
4254 else {
4255 after_armature = false;
4256 }
4257 }
4258 }
4259 }
4260
4261 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 9)) {
4262 /* Enable legacy normal and rotation outputs in Distribute Points on Faces node. */
4263 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
4264 if (ntree->type != NTREE_GEOMETRY) {
4265 continue;
4266 }
4267 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
4268 if (node->type_legacy != GEO_NODE_DISTRIBUTE_POINTS_ON_FACES) {
4269 continue;
4270 }
4271 node->custom2 = true;
4272 }
4273 }
4274 }
4275
4276 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 305, 10)) {
4277 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4278 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4279 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4280 if (sl->spacetype != SPACE_FILE) {
4281 continue;
4282 }
4283 SpaceFile *sfile = reinterpret_cast<SpaceFile *>(sl);
4284 if (!sfile->asset_params) {
4285 continue;
4286 }
4287
4288 /* When an asset browser uses the default import method, make it follow the new
4289 * preference setting. This means no effective default behavior change. */
4292 }
4293 }
4294 }
4295 }
4296
4297 if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "int", "shadow_pool_size")) {
4298 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4299 scene->eevee.flag |= SCE_EEVEE_SHADOW_ENABLED;
4300 scene->eevee.shadow_pool_size = 512;
4301 }
4302 }
4303
4304 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4305 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4306 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4307 if (sl->spacetype == SPACE_VIEW3D) {
4308 View3D *v3d = (View3D *)sl;
4311 }
4312 }
4313 }
4314 }
4315
4316 /* Fix possible uncleared `SEQ_FLAG_DELETE` flag */
4317 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4319 if (ed != nullptr) {
4321 }
4322 }
4323
4324 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
4325 if (brush->ob_mode == OB_MODE_SCULPT_CURVES) {
4326 if (brush->curves_sculpt_settings->curve_parameter_falloff == nullptr) {
4327 brush->curves_sculpt_settings->curve_parameter_falloff = BKE_curvemapping_add(
4328 1, 0.0f, 0.0f, 1.0f, 1.0f);
4329 }
4330 }
4331 }
4332 }
4333
4334 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 3)) {
4335 /* Z bias for retopology overlay. */
4336 if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "retopology_offset")) {
4337 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4338 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4339 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4340 if (sl->spacetype == SPACE_VIEW3D) {
4341 View3D *v3d = (View3D *)sl;
4342 v3d->overlay.retopology_offset = 0.2f;
4343 }
4344 }
4345 }
4346 }
4347 }
4348
4349 /* Use `SEQ_SINGLE_FRAME_CONTENT` flag instead of weird function to check if strip has multiple
4350 * frames. */
4351 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4353 if (ed != nullptr) {
4355 &ed->seqbase, version_set_seq_single_frame_content, nullptr);
4356 }
4357 }
4358
4359 LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
4360 if (ntree->type == NTREE_GEOMETRY) {
4362 }
4363 }
4364 }
4365
4366 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 5)) {
4367 /* Some regions used to be added/removed dynamically. Ensure they are always there, there is a
4368 * `ARegionType.poll()` now. */
4369 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4370 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4371 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4373
4374 /* Ensure expected region state. Previously this was modified to hide/unhide regions. */
4375
4376 const ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
4377 &sl->regionbase;
4378 if (sl->spacetype == SPACE_SEQ) {
4379 ARegion *region_main = BKE_region_find_in_listbase_by_type(regionbase,
4381 region_main->flag &= ~RGN_FLAG_HIDDEN;
4382 region_main->alignment = RGN_ALIGN_NONE;
4383
4384 ARegion *region_preview = BKE_region_find_in_listbase_by_type(regionbase,
4386 region_preview->flag &= ~RGN_FLAG_HIDDEN;
4387 region_preview->alignment = RGN_ALIGN_NONE;
4388
4389 ARegion *region_channels = BKE_region_find_in_listbase_by_type(regionbase,
4391 region_channels->alignment = RGN_ALIGN_LEFT;
4392 }
4393 }
4394 }
4395
4396 /* Replace old hard coded names with brush names, see: #106057. */
4397 const char *tool_replace_table[][2] = {
4398 {"selection_paint", "Paint Selection"},
4399 {"add", "Add"},
4400 {"delete", "Delete"},
4401 {"density", "Density"},
4402 {"comb", "Comb"},
4403 {"snake_hook", "Snake Hook"},
4404 {"grow_shrink", "Grow / Shrink"},
4405 {"pinch", "Pinch"},
4406 {"puff", "Puff"},
4407 {"smooth", "Comb"},
4408 {"slide", "Slide"},
4409 };
4410 LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
4414 "builtin_brush.",
4415 tool_replace_table,
4416 ARRAY_SIZE(tool_replace_table));
4417 }
4418 }
4419
4420 /* Rename Grease Pencil weight draw brush. */
4421 do_versions_rename_id(bmain, ID_BR, "Draw Weight", "Weight Draw");
4422 }
4423
4424 /* `fcm->name` was never used to store modifier name so it has always been an empty string.
4425 * Now this property supports name editing. So assign value to name variable of F-modifier
4426 * otherwise modifier interface would show an empty name field.
4427 * Also ensure uniqueness when opening old files. */
4428 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 7)) {
4429 LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
4430 LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
4431 LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) {
4432 BKE_fmodifier_name_set(fcm, "");
4433 }
4434 }
4435 }
4436 }
4437
4438 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 8)) {
4439 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
4440 ob->flag |= OB_FLAG_USE_SIMULATION_CACHE;
4441 }
4442 }
4443
4444 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 9)) {
4445 /* Fix sound strips with speed factor set to 0. See #107289. */
4446 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4448 if (ed != nullptr) {
4450 &ed->seqbase, version_seq_fix_broken_sound_strips, nullptr);
4451 }
4452 }
4453
4454 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4455 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4456 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4457 if (sl->spacetype == SPACE_ACTION) {
4458 SpaceAction *saction = reinterpret_cast<SpaceAction *>(sl);
4460 }
4461 }
4462 }
4463 }
4464
4465 /* Enable the iTaSC ITASC_TRANSLATE_ROOT_BONES flag for backward compatibility.
4466 * See #104606. */
4467 LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
4468 if (ob->type != OB_ARMATURE || ob->pose == nullptr) {
4469 continue;
4470 }
4471 bPose *pose = ob->pose;
4472 if (pose->iksolver != IKSOLVER_ITASC || pose->ikparam == nullptr) {
4473 continue;
4474 }
4475 bItasc *ikparam = (bItasc *)pose->ikparam;
4476 ikparam->flag |= ITASC_TRANSLATE_ROOT_BONES;
4477 }
4478 }
4479
4480 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 10)) {
4481 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4482 /* Set default values for new members. */
4483 short snap_mode_geom = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 4) | (1 << 5);
4484 scene->toolsettings->snap_mode_tools = snap_mode_geom;
4485 scene->toolsettings->plane_axis = 2;
4486 }
4487 }
4488
4489 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 11)) {
4491
4492 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
4493 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
4494 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
4495 /* #107870: Movie Clip Editor hangs in "Clip" view */
4496 if (sl->spacetype == SPACE_CLIP) {
4497 const ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
4498 &sl->regionbase;
4499 ARegion *region_main = BKE_region_find_in_listbase_by_type(regionbase,
4501 region_main->flag &= ~RGN_FLAG_HIDDEN;
4502 ARegion *region_tools = BKE_region_find_in_listbase_by_type(regionbase,
4504 region_tools->alignment = RGN_ALIGN_LEFT;
4505 if (!(region_tools->flag & RGN_FLAG_HIDDEN_BY_USER)) {
4506 region_tools->flag &= ~RGN_FLAG_HIDDEN;
4507 }
4508 }
4509 }
4510 }
4511 }
4512
4513 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
4514 if (ntree->type == NTREE_COMPOSIT) {
4515 version_node_socket_name(ntree, CMP_NODE_LENSDIST, "Distort", "Distortion");
4516 }
4517 }
4519 }
4520
4521 {
4522 /* Keep this block, even when empty. */
4523 LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
4524 scene->toolsettings->uvcalc_iterations = 10;
4525 scene->toolsettings->uvcalc_weight_factor = 1.0f;
4526 STRNCPY(scene->toolsettings->uvcalc_weight_group, "uv_importance");
4527 }
4528 }
4529
4536}
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:82
void vec_roll_to_mat3(const float vec[3], float roll, float r_mat[3][3])
Definition armature.cc:2721
void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll)
Definition armature.cc:2566
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:267
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< blender::StringRef > name)
Definition attribute.cc:986
#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:1193
void BKE_nurb_knot_calc_v(Nurb *nu)
Definition curve.cc:1198
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:601
int BKE_object_defgroup_active_index_get(const Object *ob)
Definition deform.cc:596
ListBase * BKE_object_defgroup_list_mutable(Object *ob)
Definition deform.cc:585
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:766
void IDP_FreeFromGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:760
float IDP_coerce_to_float_or_zero(const IDProperty *prop)
Definition idprop.cc:839
eIDPropertyUIDataType IDP_ui_data_type(const IDProperty *prop)
Definition idprop.cc:1681
bool IDP_ui_data_supported(const IDProperty *prop)
Definition idprop.cc:1703
@ 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:807
#define IDP_String(prop)
double IDP_coerce_to_double_or_zero(const IDProperty *prop)
Definition idprop.cc:823
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:725
IDProperty * IDP_GetProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition idprop.cc:887
IDPropertyUIData * IDP_ui_data_ensure(IDProperty *prop)
Definition idprop.cc:1751
#define IDP_Array(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:1248
void id_sort_by_name(ListBase *lb, ID *id, ID *id_sorting_hint)
Definition lib_id.cc:1770
void id_fake_user_set(ID *id)
Definition lib_id.cc:391
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:563
ListBase * which_libbase(Main *bmain, short type)
Definition main.cc:887
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
Definition BKE_main.hh:634
#define FOREACH_MAIN_LISTBASE_END
Definition BKE_main.hh:544
#define FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb)
Definition BKE_main.hh:537
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
Definition BKE_main.hh:557
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:800
#define FOREACH_NODETREE_END
Definition BKE_node.hh:866
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition BKE_node.hh:856
#define NODE_GROUP_INPUT
Definition BKE_node.hh:799
#define GEO_NODE_SET_POSITION
#define GEO_NODE_MERGE_BY_DISTANCE
#define GEO_NODE_TRIANGULATE
#define SH_NODE_COMBINE_COLOR
#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 SH_NODE_COMBRGB_LEGACY
#define GEO_NODE_CURVE_SPLINE_PARAMETER
#define CMP_NODE_SEPHSVA_LEGACY
#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 CMP_NODE_COMBYCCA_LEGACY
#define SH_NODE_BSDF_PRINCIPLED
#define CMP_NODE_SEPRGBA_LEGACY
#define CMP_NODE_SEPARATE_COLOR
#define GEO_NODE_SET_POINT_RADIUS
#define GEO_NODE_VIEWER
#define GEO_NODE_SET_CURVE_TILT
#define SH_NODE_SEPARATE_COLOR
#define SH_NODE_SUBSURFACE_SCATTERING
#define GEO_NODE_OFFSET_POINT_IN_CURVE
#define SH_NODE_MAP_RANGE
#define TEX_NODE_DECOMPOSE_LEGACY
#define GEO_NODE_INPUT_MESH_ISLAND
#define GEO_NODE_MESH_PRIMITIVE_CUBE
#define GEO_NODE_DISTRIBUTE_POINTS_ON_FACES
#define SH_NODE_SEPRGB_LEGACY
#define CMP_NODE_COMBYUVA_LEGACY
#define GEO_NODE_MESH_PRIMITIVE_CONE
#define GEO_NODE_REPLACE_MATERIAL
#define GEO_NODE_REVERSE_CURVE
#define GEO_NODE_MESH_BOOLEAN
#define CMP_NODE_SEPYUVA_LEGACY
#define TEX_NODE_COMBINE_COLOR
#define CMP_NODE_COMBHSVA_LEGACY
#define FN_NODE_COMBINE_COLOR
#define GEO_NODE_TRANSLATE_INSTANCES
#define TEX_NODE_SEPARATE_COLOR
#define GEO_NODE_MESH_PRIMITIVE_LINE
#define GEO_NODE_TRIM_CURVE
#define FN_NODE_COMPARE
#define SH_NODE_SEPHSV_LEGACY
#define GEO_NODE_SWITCH
#define TEX_NODE_COMPOSE_LEGACY
#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 CMP_NODE_COMBINE_COLOR
#define CMP_NODE_COMBRGBA_LEGACY
#define GEO_NODE_CAPTURE_ATTRIBUTE
#define FN_NODE_SEPARATE_COLOR
#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 CMP_NODE_SEPYCCA_LEGACY
#define GEO_NODE_COLLECTION_INFO
#define GEO_NODE_TRANSFER_ATTRIBUTE_DEPRECATED
#define SH_NODE_COMBHSV_LEGACY
#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:829
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:599
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:688
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
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
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.
float[3] Vector
#define CLOG_ERROR(clg_ref,...)
Definition CLG_log.h:182
@ LIBOVERRIDE_OP_INSERT_AFTER
Definition DNA_ID.h:230
@ LIBOVERRIDE_FLAG_SYSTEM_DEFINED
Definition DNA_ID.h:353
@ 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
@ CURVE_TYPE_BEZIER
@ CURVE_TYPE_NURBS
@ CURVE_TYPE_POLY
@ 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
@ CMP_NODE_COMBSEP_COLOR_YCC
@ CMP_NODE_COMBSEP_COLOR_YUV
@ CMP_NODE_COMBSEP_COLOR_RGB
@ CMP_NODE_COMBSEP_COLOR_HSV
@ SHD_SUBSURFACE_BURLEY
@ SHD_SUBSURFACE_RANDOM_WALK_SKIN
@ SHD_SUBSURFACE_RANDOM_WALK
@ GEO_NODE_EXTRUDE_MESH_EDGES
@ NTREE_TEXTURE
@ NTREE_CUSTOM
@ NTREE_SHADER
@ NTREE_GEOMETRY
@ NTREE_COMPOSIT
@ SOCK_OUT
@ SOCK_IN
@ NODE_DO_OUTPUT
@ 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
@ NODE_COMBSEP_COLOR_RGB
@ NODE_COMBSEP_COLOR_HSV
@ 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_FLAG_USE_SIMULATION_CACHE
@ OB_LATTICE
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_GPENCIL_LEGACY
@ OB_CURVES
@ OB_DRAWBOUNDOX
@ SEQ_SNAP_TO_STRIPS
@ SEQ_SNAP_TO_STRIP_HOLD
@ SEQ_SNAP_TO_CURRENT_FRAME
@ SCE_EEVEE_SHADOW_ENABLED
@ SEQ_OVERLAP_SHUFFLE
@ GP_PROJECT_VIEWSPACE
@ GP_PROJECT_CURSOR
@ SCE_SNAP_TO_INCLUDE_EDITED
@ SCE_SNAP
@ SCE_SNAP_TO_INCLUDE_NONEDITED
@ 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
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ RGN_ALIGN_NONE
@ SEQ_FLAG_DELETE
@ SEQ_SINGLE_FRAME_CONTENT
@ SEQ_USE_EFFECT_DEFAULT_FADE
@ SEQ_TRANSFORM_FILTER_BILINEAR
@ STRIP_TYPE_SOUND_RAM
@ STRIP_TYPE_IMAGE
@ STRIP_TYPE_SPEED
@ STRIP_TYPE_EFFECT
@ STRIP_TYPE_META
@ STRIP_COLOR_NONE
@ SEQ_SPEED_STRETCH
@ SEQ_SPEED_MULTIPLY
@ SEQ_SPEED_LENGTH
@ SEQ_SPEED_FRAME_NUMBER
@ seqModifierType_ColorBalance
@ 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_SCROLL_RIGHT
@ V2D_SCROLL_BOTTOM
@ V2D_VIEWSYNC_AREA_VERTICAL
@ 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:221
@ PROP_TRANSLATION
Definition RNA_types.hh:249
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:43
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
@ DENOISER_OPENIMAGEDENOISE
Definition denoise.h:13
#define offsetof(t, d)
#define sqrtf(x)
uint nor
#define abs
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
#define FILTER_ID_ALL
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
#define ID_IS_LINKED(_id)
#define FILTER_ID_GR
#define MAX_IDPROP_NAME
#define GS(a)
const ccl_global KernelWorkTile * tile
format
#define LOG(severity)
Definition log.h:32
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:2864
void node_remove_node(Main *bmain, bNodeTree &ntree, bNode &node, bool do_id_user, bool remove_animation=true)
Definition node.cc:4649
void node_remove_socket(bNodeTree &ntree, bNode &node, bNodeSocket &sock)
Definition node.cc:3575
void node_tree_set_type(bNodeTree &ntree)
Definition node.cc:2586
bool node_set_selected(bNode &node, bool select)
Definition node.cc:4967
bNodeSocket * node_add_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, StringRefNull idname, StringRefNull identifier, StringRefNull name)
Definition node.cc:3136
void node_rebuild_id_vector(bNodeTree &node_tree)
Definition node.cc:4568
bNode * node_add_static_node(const bContext *C, bNodeTree &ntree, int type)
Definition node.cc:3804
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
Definition node.cc:4087
bNodeTree * node_tree_add_tree(Main *bmain, StringRef name, StringRef idname)
Definition node.cc:4362
bNodeSocket * node_add_static_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, int type, int subtype, StringRefNull identifier, StringRefNull name)
Definition node.cc:3529
std::optional< StringRefNull > node_static_socket_type(int type, int subtype, std::optional< int > dimensions=std::nullopt)
Definition node.cc:3167
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
void channels_ensure(ListBase *channels)
Definition channels.cc:38
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:272
void retiming_data_clear(Strip *strip)
constexpr int MAX_CHANNELS
void time_update_meta_strip_range(const Scene *scene, Strip *strip_meta)
void for_each_callback(ListBase *seqbase, ForEachFunc callback, void *user_data)
Definition iterator.cc:59
SequencerToolSettings * tool_settings_ensure(Scene *scene)
Definition sequencer.cc:362
int effect_get_num_inputs(int strip_type)
Definition effects.cc:286
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:124
#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:103
struct GpencilModifierData * next
ListBase group
Definition DNA_ID.h:138
double * default_array
Definition DNA_ID.h:102
int * default_array
Definition DNA_ID.h:75
char * description
Definition DNA_ID.h:51
int len
Definition DNA_ID.h:165
char name[64]
Definition DNA_ID.h:154
IDPropertyData data
Definition DNA_ID.h:159
char subtype
Definition DNA_ID.h:151
char type
Definition DNA_ID.h:146
Definition DNA_ID.h:404
struct Library * lib
Definition DNA_ID.h:410
char name[66]
Definition DNA_ID.h:415
struct Image * stencil
struct Image * canvas
void * first
ListBase brushes
Definition BKE_main.hh:271
ListBase scenes
Definition BKE_main.hh:245
ListBase wm
Definition BKE_main.hh:276
ListBase actions
Definition BKE_main.hh:269
ListBase texts
Definition BKE_main.hh:263
ListBase meshes
Definition BKE_main.hh:248
ListBase movieclips
Definition BKE_main.hh:280
ListBase hair_curves
Definition BKE_main.hh:289
ListBase lights
Definition BKE_main.hh:255
ListBase nodetrees
Definition BKE_main.hh:270
ListBase materials
Definition BKE_main.hh:251
ListBase armatures
Definition BKE_main.hh:268
ListBase curves
Definition BKE_main.hh:249
ListBase screens
Definition BKE_main.hh:261
short versionfile
Definition BKE_main.hh:156
ListBase workspaces
Definition BKE_main.hh:284
ListBase images
Definition BKE_main.hh:253
ListBase objects
Definition BKE_main.hh:247
struct ModifierData * next
MovieTrackingCamera camera
char name[64]
ListBase strips
ImageFormatData format
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 void versioning_replace_legacy_combined_and_separate_color_nodes(bNodeTree *ntree)
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 bool version_fix_delete_flag(Strip *strip, void *)
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:139