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