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