Blender V5.3
versioning_405.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#define DNA_DEPRECATED_ALLOW
10
11#include <fmt/format.h>
12
13#include "DNA_anim_types.h"
14#include "DNA_brush_types.h"
15#include "DNA_light_types.h"
16#include "DNA_mesh_types.h"
19#include "DNA_screen_types.h"
20#include "DNA_sequence_types.h"
21
22#include "BLI_listbase.hh"
23#include "BLI_math_vector_c.hh"
24#include "BLI_set.hh"
25#include "BLI_string.hh"
26#include "BLI_string_utf8.hh"
27#include "BLI_string_utils.hh"
28#include "BLI_sys_types.hh"
29#include "BLI_vector.hh"
30
31#include "BKE_anim_data.hh"
32#include "BKE_animsys.hh"
33#include "BKE_armature.hh"
34#include "BKE_curves.hh"
35#include "BKE_customdata.hh"
36#include "BKE_fcurve.hh"
37#include "BKE_grease_pencil.hh"
38#include "BKE_idprop.hh"
39#include "BKE_lib_id.hh"
40#include "BKE_lib_query.hh"
41#include "BKE_main.hh"
43#include "BKE_node.hh"
45#include "BKE_node_runtime.hh"
46#include "BKE_paint.hh"
47
48#include "SEQ_iterator.hh"
49#include "SEQ_sequencer.hh"
50
51#include "ANIM_action.hh"
53#include "ANIM_armature_iter.hh"
54
55#include "RNA_access.hh"
56
57#include "readfile.hh"
58
59#include "versioning_common.hh"
60
61namespace blender {
62
63// static CLG_LogRef LOG = {"blend.doversion"};
64
66{
67 for (FModifier &fcurve_modifier : fcurve.modifiers) {
68 if (fcurve_modifier.type != FMODIFIER_TYPE_NOISE) {
69 continue;
70 }
71 FMod_Noise *data = static_cast<FMod_Noise *>(fcurve_modifier.data);
72 if (data->legacy_noise) {
73 /* We don't want to modify anything if the noise is set to legacy, because the issue only
74 * occurred on the new style noise. */
75 continue;
76 }
77 data->offset *= data->size;
78 }
79}
80
86{
87 auto fix_curves = [](bke::CurvesGeometry &curves) {
88 if (curves.custom_knots != nullptr) {
89 return;
90 }
91
92 int8_t *knot_modes = static_cast<int8_t *>(CustomData_get_layer_named_for_write(
93 &curves.curve_data_legacy, CD_PROP_INT8, "knots_mode", curves.curve_num));
94 if (knot_modes == nullptr) {
95 return;
96 }
97
98 for (const int curve : curves.curves_range()) {
99 int8_t &knot_mode = knot_modes[curve];
100 if (knot_mode == NURBS_KNOT_MODE_CUSTOM) {
101 knot_mode = NURBS_KNOT_MODE_NORMAL;
102 }
103 }
104 curves.nurbs_custom_knots_update_size();
105 };
106
107 for (Curves &curves_id : bmain->hair_curves) {
108 bke::CurvesGeometry &curves = curves_id.geometry.wrap();
109 fix_curves(curves);
110 }
111
113 for (GreasePencilDrawingBase *base : grease_pencil.drawings()) {
114 if (base->type != GP_DRAWING) {
115 continue;
116 }
117 bke::greasepencil::Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
118 fix_curves(drawing.strokes_for_write());
119 }
120 }
121}
122
123static void nlastrips_apply_fcurve_versioning(ListBaseT<NlaStrip> &strips)
124{
125 for (NlaStrip &strip : strips) {
126 for (FCurve &fcurve : strip.fcurves) {
128 }
129
130 /* Check sub-strips (if meta-strips). */
132 }
133}
134
135/* A new Clamp boolean input was added that either enables clamping or disables it. Previously,
136 * Clamp was disabled when the maximum was zero. So we enable Clamp for non zero or linked maximum
137 * input. */
139{
140 for (bNode &node : node_tree->nodes) {
141 if (node.type_legacy != CMP_NODE_GLARE) {
142 continue;
143 }
144
145 bNodeSocket *clamp_input = bke::node_find_socket(node, SOCK_IN, "Clamp Highlights"_ustr);
146 bNodeSocket *maximum_input = bke::node_find_socket(node, SOCK_IN, "Maximum Highlights"_ustr);
147
148 const float maximum = maximum_input->default_value_typed<bNodeSocketValueFloat>()->value;
149 if (version_node_socket_is_used(maximum_input) || maximum != 0.0) {
150 clamp_input->default_value_typed<bNodeSocketValueBoolean>()->value = true;
151 }
152 }
153}
154
155/* The Rotate Star 45 option was converted into a Diagonal Star input. */
157{
158 NodeGlare *storage = static_cast<NodeGlare *>(node->storage);
159 if (!storage) {
160 return;
161 }
162
163 /* Input already exists, was already versioned. */
164 if (bke::node_find_socket(*node, SOCK_IN, "Diagonal Star"_ustr)) {
165 return;
166 }
167
168 bNodeSocket *diagonal_star_input = bke::node_add_static_socket(
169 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Diagonal Star", "Diagonal");
170 diagonal_star_input->default_value_typed<bNodeSocketValueBoolean>()->value = storage->star_45;
171}
172
173/* The Rotate Star 45 option was converted into a Diagonal Star input. */
175 bNode *node)
176{
177 /* Compute the RNA path of the node. */
178 char escaped_node_name[sizeof(node->name) * 2 + 1];
179 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
180 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
181
182 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
183 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
184 * path. */
185 if (!fcurve->rna_path().startswith(node_rna_path)) {
186 return;
187 }
188
189 /* Change the RNA path of the FCurve from the old property to the new input. */
190 if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_rotate_45")) {
191 fcurve->rna_path_set_move(
192 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[14].default_value"));
193 }
194 });
195}
196
197/* The options were converted into inputs. */
199{
200 NodeBokehImage *storage = static_cast<NodeBokehImage *>(node->storage);
201 if (!storage) {
202 return;
203 }
204
205 if (!bke::node_find_socket(*node, SOCK_IN, "Flaps"_ustr)) {
207 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Flaps", "Flaps");
208 input->default_value_typed<bNodeSocketValueInt>()->value = storage->flaps;
209 }
210
211 if (!bke::node_find_socket(*node, SOCK_IN, "Angle"_ustr)) {
213 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Angle", "Angle");
214 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->angle;
215 }
216
217 if (!bke::node_find_socket(*node, SOCK_IN, "Roundness"_ustr)) {
219 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Roundness", "Roundness");
220 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->rounding;
221 }
222
223 if (!bke::node_find_socket(*node, SOCK_IN, "Catadioptric Size"_ustr)) {
224 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
225 *node,
226 SOCK_IN,
229 "Catadioptric Size",
230 "Catadioptric Size");
231 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->catadioptric;
232 }
233
234 if (!bke::node_find_socket(*node, SOCK_IN, "Color Shift"_ustr)) {
236 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Color Shift", "Color Shift");
237 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->lensshift;
238 }
239
240 MEM_delete(storage);
241 node->storage = nullptr;
242}
243
244/* The options were converted into inputs. */
246 bNode *node)
247{
248 /* Compute the RNA path of the node. */
249 char escaped_node_name[sizeof(node->name) * 2 + 1];
250 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
251 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
252
253 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
254 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
255 * path. */
256 if (!fcurve->rna_path().startswith(node_rna_path)) {
257 return;
258 }
259
260 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
261 * values of the FCurves frames when needed. */
262 if (BLI_str_endswith(fcurve->rna_path().c_str(), "flaps")) {
263 fcurve->rna_path_set_move(
264 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[0].default_value"));
265 }
266 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "angle")) {
267 fcurve->rna_path_set_move(
268 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
269 }
270 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "rounding")) {
271 fcurve->rna_path_set_move(
272 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
273 }
274 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "catadioptric")) {
275 fcurve->rna_path_set_move(
276 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
277 }
278 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "shift")) {
279 fcurve->rna_path_set_move(
280 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
281 }
282 });
283}
284
285/* The options were converted into inputs. */
287{
288 if (!bke::node_find_socket(*node, SOCK_IN, "Start Frame"_ustr)) {
290 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Start Frame", "Start Frame");
291 input->default_value_typed<bNodeSocketValueInt>()->value = node->custom1;
292 }
293
294 if (!bke::node_find_socket(*node, SOCK_IN, "End Frame"_ustr)) {
296 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "End Frame", "End Frame");
297 input->default_value_typed<bNodeSocketValueInt>()->value = node->custom2;
298 }
299}
300
301/* The options were converted into inputs. */
303 bNode *node)
304{
305 /* Compute the RNA path of the node. */
306 char escaped_node_name[sizeof(node->name) * 2 + 1];
307 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
308 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
309
310 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
311 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
312 * path. */
313 if (!fcurve->rna_path().startswith(node_rna_path)) {
314 return;
315 }
316
317 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
318 * values of the FCurves frames when needed. */
319 if (BLI_str_endswith(fcurve->rna_path().c_str(), "frame_start")) {
320 fcurve->rna_path_set_move(
321 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[0].default_value"));
322 }
323 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "frame_end")) {
324 fcurve->rna_path_set_move(
325 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
326 }
327 });
328}
329
330/* The options were converted into inputs. */
332{
333 NodeMask *storage = static_cast<NodeMask *>(node->storage);
334 if (!storage) {
335 return;
336 }
337
338 if (!bke::node_find_socket(*node, SOCK_IN, "Size X"_ustr)) {
340 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Size X", "Size X");
341 input->default_value_typed<bNodeSocketValueInt>()->value = storage->size_x;
342 }
343
344 if (!bke::node_find_socket(*node, SOCK_IN, "Size Y"_ustr)) {
346 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Size Y", "Size Y");
347 input->default_value_typed<bNodeSocketValueInt>()->value = storage->size_y;
348 }
349
350 if (!bke::node_find_socket(*node, SOCK_IN, "Feather"_ustr)) {
352 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Feather", "Feather");
353 input->default_value_typed<bNodeSocketValueBoolean>()->value = !(
355 }
356
357 if (!bke::node_find_socket(*node, SOCK_IN, "Motion Blur"_ustr)) {
359 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Motion Blur", "Motion Blur");
360 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(
362 }
363
364 if (!bke::node_find_socket(*node, SOCK_IN, "Motion Blur Samples"_ustr)) {
366 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Motion Blur Samples", "Samples");
367 input->default_value_typed<bNodeSocketValueInt>()->value = node->custom2;
368 }
369
370 if (!bke::node_find_socket(*node, SOCK_IN, "Motion Blur Shutter"_ustr)) {
372 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Motion Blur Shutter", "Shutter");
373 input->default_value_typed<bNodeSocketValueFloat>()->value = node->custom3;
374 }
375
376 MEM_delete(storage);
377 node->storage = nullptr;
378}
379
380/* The options were converted into inputs. */
382{
383 /* Compute the RNA path of the node. */
384 char escaped_node_name[sizeof(node->name) * 2 + 1];
385 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
386 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
387
388 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
389 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
390 * path. */
391 if (!fcurve->rna_path().startswith(node_rna_path)) {
392 return;
393 }
394
395 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
396 * values of the FCurves frames when needed. */
397 if (BLI_str_endswith(fcurve->rna_path().c_str(), "size_x")) {
398 fcurve->rna_path_set_move(
399 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[0].default_value"));
400 }
401 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "size_y")) {
402 fcurve->rna_path_set_move(
403 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
404 }
405 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_feather")) {
406 fcurve->rna_path_set_move(
407 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
408 }
409 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_motion_blur")) {
410 fcurve->rna_path_set_move(
411 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
412 }
413 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "motion_blur_samples")) {
414 fcurve->rna_path_set_move(
415 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
416 }
417 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "motion_blur_shutter")) {
418 fcurve->rna_path_set_move(
419 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
420 }
421 });
422}
423
424/* The options were converted into inputs. */
426{
427 if (!bke::node_find_socket(*node, SOCK_IN, "Switch"_ustr)) {
429 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Switch", "Switch");
430 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1);
431 }
432}
433
434/* The options were converted into inputs. */
436{
437 /* Compute the RNA path of the node. */
438 char escaped_node_name[sizeof(node->name) * 2 + 1];
439 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
440 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
441
442 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
443 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
444 * path. */
445 if (!fcurve->rna_path().startswith(node_rna_path)) {
446 return;
447 }
448
449 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
450 * values of the FCurves frames when needed. */
451 if (BLI_str_endswith(fcurve->rna_path().c_str(), "check")) {
452 fcurve->rna_path_set_move(
453 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[0].default_value"));
454 }
455 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "inputs[0].default_value")) {
456 /* The new input was added at the start, so offset the animation indices by 1. */
457 fcurve->rna_path_set_move(
458 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
459 }
460 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "inputs[1].default_value")) {
461 fcurve->rna_path_set_move(
462 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
463 }
464 });
465}
466
467/* The options were converted into inputs. */
469{
470 if (!bke::node_find_socket(*node, SOCK_IN, "Factor"_ustr)) {
472 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Factor", "Factor");
473 input->default_value_typed<bNodeSocketValueFloat>()->value = node->custom1 / 100.0f;
474 }
475}
476
477/* The options were converted into inputs. */
479{
480 /* Compute the RNA path of the node. */
481 char escaped_node_name[sizeof(node->name) * 2 + 1];
482 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
483 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
484
485 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
486 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
487 * path. */
488 if (!fcurve->rna_path().startswith(node_rna_path)) {
489 return;
490 }
491
492 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
493 * values of the FCurves frames when needed. */
494 if (BLI_str_endswith(fcurve->rna_path().c_str(), "factor")) {
495 fcurve->rna_path_set_move(
496 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[0].default_value"));
497 adjust_fcurve_key_frame_values(
498 fcurve, PROP_FLOAT, [&](const float value) { return value / 100.0f; });
499 }
500 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "inputs[0].default_value")) {
501 /* The new input was added at the start, so offset the animation indices by 1. */
502 fcurve->rna_path_set_move(
503 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
504 }
505 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "inputs[1].default_value")) {
506 fcurve->rna_path_set_move(
507 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
508 }
509 });
510}
511
512/* The options were converted into inputs. */
514{
515 if (!bke::node_find_socket(*node, SOCK_IN, "Invert Color"_ustr)) {
517 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Invert Color", "Invert Color");
518 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1 &
520 }
521
522 if (!bke::node_find_socket(*node, SOCK_IN, "Invert Alpha"_ustr)) {
524 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Invert Alpha", "Invert Alpha");
525 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1 &
526 CMP_CHAN_A);
527 }
528}
529
530/* The options were converted into inputs. */
532{
533 /* Compute the RNA path of the node. */
534 char escaped_node_name[sizeof(node->name) * 2 + 1];
535 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
536 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
537
538 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
539 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
540 * path. */
541 if (!fcurve->rna_path().startswith(node_rna_path)) {
542 return;
543 }
544
545 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
546 * values of the FCurves frames when needed. */
547 if (BLI_str_endswith(fcurve->rna_path().c_str(), "invert_rgb")) {
548 fcurve->rna_path_set_move(
549 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
550 }
551 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "invert_alpha")) {
552 fcurve->rna_path_set_move(
553 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
554 }
555 });
556}
557
558/* The options were converted into inputs. */
560{
561 if (!bke::node_find_socket(*node, SOCK_IN, "Use Alpha"_ustr)) {
563 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Use Alpha", "Use Alpha");
564 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1);
565 }
566
567 if (!bke::node_find_socket(*node, SOCK_IN, "Anti-Alias"_ustr)) {
569 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Anti-Alias", "Anti-Alias");
570 input->default_value_typed<bNodeSocketValueBoolean>()->value = !bool(node->custom2);
571 }
572}
573
574/* The options were converted into inputs. */
576 bNode *node)
577{
578 /* Compute the RNA path of the node. */
579 char escaped_node_name[sizeof(node->name) * 2 + 1];
580 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
581 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
582
583 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
584 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
585 * path. */
586 if (!fcurve->rna_path().startswith(node_rna_path)) {
587 return;
588 }
589
590 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
591 * values of the FCurves frames when needed. */
592 if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_alpha")) {
593 fcurve->rna_path_set_move(
594 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
595 }
596 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_antialias_z")) {
597 fcurve->rna_path_set_move(
598 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
599 }
600 });
601}
602
603/* The options were converted into inputs. */
605{
606 NodeTonemap *storage = static_cast<NodeTonemap *>(node->storage);
607 if (!storage) {
608 return;
609 }
610
611 if (!bke::node_find_socket(*node, SOCK_IN, "Key"_ustr)) {
613 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Key", "Key");
614 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->key;
615 }
616
617 if (!bke::node_find_socket(*node, SOCK_IN, "Balance"_ustr)) {
619 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Balance", "Balance");
620 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->offset;
621 }
622
623 if (!bke::node_find_socket(*node, SOCK_IN, "Gamma"_ustr)) {
625 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Gamma", "Gamma");
626 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->gamma;
627 }
628
629 if (!bke::node_find_socket(*node, SOCK_IN, "Intensity"_ustr)) {
631 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Intensity", "Intensity");
632 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->f;
633 }
634
635 if (!bke::node_find_socket(*node, SOCK_IN, "Contrast"_ustr)) {
637 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Contrast", "Contrast");
638 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->m;
639 }
640
641 if (!bke::node_find_socket(*node, SOCK_IN, "Light Adaptation"_ustr)) {
642 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
643 *node,
644 SOCK_IN,
647 "Light Adaptation",
648 "Light Adaptation");
649 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->a;
650 }
651
652 if (!bke::node_find_socket(*node, SOCK_IN, "Chromatic Adaptation"_ustr)) {
653 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
654 *node,
655 SOCK_IN,
658 "Chromatic Adaptation",
659 "Chromatic Adaptation");
660 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->c;
661 }
662}
663
664/* The options were converted into inputs. */
666{
667 /* Compute the RNA path of the node. */
668 char escaped_node_name[sizeof(node->name) * 2 + 1];
669 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
670 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
671
672 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
673 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
674 * path. */
675 if (!fcurve->rna_path().startswith(node_rna_path)) {
676 return;
677 }
678
679 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
680 * values of the FCurves frames when needed. */
681 if (BLI_str_endswith(fcurve->rna_path().c_str(), "key")) {
682 fcurve->rna_path_set_move(
683 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
684 }
685 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "offset")) {
686 fcurve->rna_path_set_move(
687 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
688 }
689 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "gamma")) {
690 fcurve->rna_path_set_move(
691 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
692 }
693 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "intensity")) {
694 fcurve->rna_path_set_move(
695 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
696 }
697 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "contrast")) {
698 fcurve->rna_path_set_move(
699 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
700 }
701 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "adaptation")) {
702 fcurve->rna_path_set_move(
703 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[6].default_value"));
704 }
705 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "correction")) {
706 fcurve->rna_path_set_move(
707 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[7].default_value"));
708 }
709 });
710}
711
712/* The options were converted into inputs. */
714{
715 if (!bke::node_find_socket(*node, SOCK_IN, "Size"_ustr)) {
717 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Size", "Size");
718 input->default_value_typed<bNodeSocketValueInt>()->value = node->custom2;
719 }
720
721 if (!bke::node_find_socket(*node, SOCK_IN, "Falloff Size"_ustr)) {
723 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Falloff Size", "Falloff Size");
724 input->default_value_typed<bNodeSocketValueFloat>()->value = node->custom3;
725 }
726}
727
728/* The options were converted into inputs. */
730{
731 /* Compute the RNA path of the node. */
732 char escaped_node_name[sizeof(node->name) * 2 + 1];
733 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
734 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
735
736 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
737 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
738 * path. */
739 if (!fcurve->rna_path().startswith(node_rna_path)) {
740 return;
741 }
742
743 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
744 * values of the FCurves frames when needed. */
745 if (BLI_str_endswith(fcurve->rna_path().c_str(), "distance")) {
746 fcurve->rna_path_set_move(
747 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
748 }
749 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "edge")) {
750 fcurve->rna_path_set_move(
751 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
752 }
753 });
754}
755
756/* The options were converted into inputs. */
758{
759 if (!bke::node_find_socket(*node, SOCK_IN, "Size"_ustr)) {
761 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Size", "Size");
762 input->default_value_typed<bNodeSocketValueInt>()->value = node->custom2;
763 }
764}
765
766/* The options were converted into inputs. */
768{
769 /* Compute the RNA path of the node. */
770 char escaped_node_name[sizeof(node->name) * 2 + 1];
771 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
772 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
773
774 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
775 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
776 * path. */
777 if (!fcurve->rna_path().startswith(node_rna_path)) {
778 return;
779 }
780
781 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
782 * values of the FCurves frames when needed. */
783 if (BLI_str_endswith(fcurve->rna_path().c_str(), "distance")) {
784 fcurve->rna_path_set_move(
785 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
786 }
787 });
788}
789
790/* The options were converted into inputs. */
792{
793 if (!bke::node_find_socket(*node, SOCK_IN, "Size"_ustr)) {
795 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Size", "Size");
796 input->default_value_typed<bNodeSocketValueInt>()->value = node->custom1;
797 }
798}
799
800/* The options were converted into inputs. */
802{
803 /* Compute the RNA path of the node. */
804 char escaped_node_name[sizeof(node->name) * 2 + 1];
805 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
806 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
807
808 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
809 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
810 * path. */
811 if (!fcurve->rna_path().startswith(node_rna_path)) {
812 return;
813 }
814
815 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
816 * values of the FCurves frames when needed. */
817 if (BLI_str_endswith(fcurve->rna_path().c_str(), "pixel_size")) {
818 fcurve->rna_path_set_move(
819 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
820 }
821 });
822}
823
824/* The options were converted into inputs. */
826{
827 NodeKuwaharaData *storage = static_cast<NodeKuwaharaData *>(node->storage);
828 if (!storage) {
829 return;
830 }
831
832 if (!bke::node_find_socket(*node, SOCK_IN, "Uniformity"_ustr)) {
834 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Uniformity", "Uniformity");
835 input->default_value_typed<bNodeSocketValueInt>()->value = storage->uniformity;
836 }
837
838 if (!bke::node_find_socket(*node, SOCK_IN, "Sharpness"_ustr)) {
840 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Sharpness", "Sharpness");
841 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->sharpness;
842 }
843
844 if (!bke::node_find_socket(*node, SOCK_IN, "Eccentricity"_ustr)) {
846 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Eccentricity", "Eccentricity");
847 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->eccentricity;
848 }
849
850 if (!bke::node_find_socket(*node, SOCK_IN, "High Precision"_ustr)) {
852 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "High Precision", "High Precision");
853 input->default_value_typed<bNodeSocketValueBoolean>()->value = storage->high_precision;
854 }
855}
856
857/* The options were converted into inputs. */
859{
860 /* Compute the RNA path of the node. */
861 char escaped_node_name[sizeof(node->name) * 2 + 1];
862 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
863 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
864
865 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
866 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
867 * path. */
868 if (!fcurve->rna_path().startswith(node_rna_path)) {
869 return;
870 }
871
872 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
873 * values of the FCurves frames when needed. */
874 if (BLI_str_endswith(fcurve->rna_path().c_str(), "uniformity")) {
875 fcurve->rna_path_set_move(
876 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
877 }
878 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "sharpness")) {
879 fcurve->rna_path_set_move(
880 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
881 }
882 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "eccentricity")) {
883 fcurve->rna_path_set_move(
884 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
885 }
886 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "high_precision")) {
887 fcurve->rna_path_set_move(
888 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
889 }
890 });
891}
892
893/* The options were converted into inputs. */
895{
896 if (!bke::node_find_socket(*node, SOCK_IN, "Color Threshold"_ustr)) {
898 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Color Threshold", "Color Threshold");
899 input->default_value_typed<bNodeSocketValueFloat>()->value = node->custom3;
900 }
901
902 if (!bke::node_find_socket(*node, SOCK_IN, "Neighbor Threshold"_ustr)) {
903 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
904 *node,
905 SOCK_IN,
908 "Neighbor Threshold",
909 "Neighbor Threshold");
910 input->default_value_typed<bNodeSocketValueFloat>()->value = node->custom4;
911 }
912}
913
914/* The options were converted into inputs. */
916 bNode *node)
917{
918 /* Compute the RNA path of the node. */
919 char escaped_node_name[sizeof(node->name) * 2 + 1];
920 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
921 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
922
923 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
924 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
925 * path. */
926 if (!fcurve->rna_path().startswith(node_rna_path)) {
927 return;
928 }
929
930 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
931 * values of the FCurves frames when needed. */
932 if (BLI_str_endswith(fcurve->rna_path().c_str(), "threshold")) {
933 fcurve->rna_path_set_move(
934 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
935 }
936 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "threshold_neighbor")) {
937 fcurve->rna_path_set_move(
938 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
939 }
940 });
941}
942
943/* The options were converted into inputs. */
945{
946 NodeDenoise *storage = static_cast<NodeDenoise *>(node->storage);
947 if (!storage) {
948 return;
949 }
950
951 if (!bke::node_find_socket(*node, SOCK_IN, "HDR"_ustr)) {
953 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "HDR", "HDR");
954 input->default_value_typed<bNodeSocketValueBoolean>()->value = storage->hdr;
955 }
956}
957
958/* The options were converted into inputs. */
960{
961 /* Compute the RNA path of the node. */
962 char escaped_node_name[sizeof(node->name) * 2 + 1];
963 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
964 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
965
966 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
967 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
968 * path. */
969 if (!fcurve->rna_path().startswith(node_rna_path)) {
970 return;
971 }
972
973 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
974 * values of the FCurves frames when needed. */
975 if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_hdr")) {
976 fcurve->rna_path_set_move(
977 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
978 }
979 });
980}
981
982/* The options were converted into inputs. */
984{
985 NodeAntiAliasingData *storage = static_cast<NodeAntiAliasingData *>(node->storage);
986 if (!storage) {
987 return;
988 }
989
990 if (!bke::node_find_socket(*node, SOCK_IN, "Threshold"_ustr)) {
992 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Threshold", "Threshold");
993 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->threshold;
994 }
995
996 if (!bke::node_find_socket(*node, SOCK_IN, "Contrast Limit"_ustr)) {
998 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Contrast Limit", "Contrast Limit");
999 /* Contrast limit was previously divided by 10. */
1000 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->contrast_limit * 10.0f;
1001 }
1002
1003 if (!bke::node_find_socket(*node, SOCK_IN, "Corner Rounding"_ustr)) {
1005 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Corner Rounding", "Corner Rounding");
1006 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->corner_rounding;
1007 }
1008
1009 MEM_delete(storage);
1010 node->storage = nullptr;
1011}
1012
1013/* The options were converted into inputs. */
1015 bNode *node)
1016{
1017 /* Compute the RNA path of the node. */
1018 char escaped_node_name[sizeof(node->name) * 2 + 1];
1019 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1020 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1021
1022 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1023 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1024 * path. */
1025 if (!fcurve->rna_path().startswith(node_rna_path)) {
1026 return;
1027 }
1028
1029 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1030 * values of the FCurves frames when needed. */
1031 if (BLI_str_endswith(fcurve->rna_path().c_str(), "threshold")) {
1032 fcurve->rna_path_set_move(
1033 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
1034 }
1035 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "contrast_limit")) {
1036 fcurve->rna_path_set_move(
1037 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1038 /* Contrast limit was previously divided by 10. */
1039 adjust_fcurve_key_frame_values(
1040 fcurve, PROP_FLOAT, [&](const float value) { return value * 10.0f; });
1041 }
1042 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "corner_rounding")) {
1043 fcurve->rna_path_set_move(
1044 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1045 }
1046 });
1047}
1048
1049/* The options were converted into inputs. */
1051{
1052 NodeBlurData *storage = static_cast<NodeBlurData *>(node->storage);
1053 if (!storage) {
1054 return;
1055 }
1056
1057 if (!bke::node_find_socket(*node, SOCK_IN, "Samples"_ustr)) {
1059 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Samples", "Samples");
1060 input->default_value_typed<bNodeSocketValueInt>()->value = storage->samples;
1061 }
1062
1063 if (!bke::node_find_socket(*node, SOCK_IN, "Shutter"_ustr)) {
1065 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Shutter", "Shutter");
1066 /* Shutter was previously divided by 2. */
1067 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->fac * 2.0f;
1068 }
1069
1070 MEM_delete(storage);
1071 node->storage = nullptr;
1072}
1073
1074/* The options were converted into inputs. */
1076 bNode *node)
1077{
1078 /* Compute the RNA path of the node. */
1079 char escaped_node_name[sizeof(node->name) * 2 + 1];
1080 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1081 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1082
1083 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1084 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1085 * path. */
1086 if (!fcurve->rna_path().startswith(node_rna_path)) {
1087 return;
1088 }
1089
1090 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1091 * values of the FCurves frames when needed. */
1092 if (BLI_str_endswith(fcurve->rna_path().c_str(), "samples")) {
1093 fcurve->rna_path_set_move(
1094 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1095 }
1096 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "factor")) {
1097 fcurve->rna_path_set_move(
1098 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
1099 /* Shutter was previously divided by 2. */
1100 adjust_fcurve_key_frame_values(
1101 fcurve, PROP_FLOAT, [&](const float value) { return value * 2.0f; });
1102 }
1103 });
1104}
1105
1106/* The options were converted into inputs. */
1108{
1109 NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
1110 if (!storage) {
1111 return;
1112 }
1113
1114 if (!bke::node_find_socket(*node, SOCK_IN, "Minimum"_ustr)) {
1116 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Minimum", "Minimum");
1117 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t2;
1118 }
1119
1120 if (!bke::node_find_socket(*node, SOCK_IN, "Maximum"_ustr)) {
1122 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Maximum", "Maximum");
1123 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t1;
1124 }
1125}
1126
1127/* The options were converted into inputs. */
1129 bNode *node)
1130{
1131 /* Compute the RNA path of the node. */
1132 char escaped_node_name[sizeof(node->name) * 2 + 1];
1133 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1134 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1135
1136 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1137 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1138 * path. */
1139 if (!fcurve->rna_path().startswith(node_rna_path)) {
1140 return;
1141 }
1142
1143 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1144 * values of the FCurves frames when needed. */
1145 if (BLI_str_endswith(fcurve->rna_path().c_str(), "limit_min")) {
1146 fcurve->rna_path_set_move(
1147 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
1148 }
1149 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "limit_max")) {
1150 fcurve->rna_path_set_move(
1151 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1152 }
1153 });
1154}
1155
1156/* The options were converted into inputs. */
1158{
1159 NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
1160 if (!storage) {
1161 return;
1162 }
1163
1164 if (!bke::node_find_socket(*node, SOCK_IN, "Minimum"_ustr)) {
1166 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Minimum", "Minimum");
1167 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t2;
1168 }
1169
1170 if (!bke::node_find_socket(*node, SOCK_IN, "Maximum"_ustr)) {
1172 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Maximum", "Maximum");
1173 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t1;
1174 }
1175
1176 if (!bke::node_find_socket(*node, SOCK_IN, "Falloff"_ustr)) {
1178 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Falloff", "Falloff");
1179 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->fstrength;
1180 }
1181
1182 MEM_delete(storage);
1183 node->storage = nullptr;
1184}
1185
1186/* The options were converted into inputs. */
1188 bNode *node)
1189{
1190 /* Compute the RNA path of the node. */
1191 char escaped_node_name[sizeof(node->name) * 2 + 1];
1192 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1193 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1194
1195 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1196 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1197 * path. */
1198 if (!fcurve->rna_path().startswith(node_rna_path)) {
1199 return;
1200 }
1201
1202 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1203 * values of the FCurves frames when needed. */
1204 if (BLI_str_endswith(fcurve->rna_path().c_str(), "threshold")) {
1205 fcurve->rna_path_set_move(
1206 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1207 }
1208 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "tolerance")) {
1209 fcurve->rna_path_set_move(
1210 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1211 }
1212 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "gain")) {
1213 fcurve->rna_path_set_move(
1214 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
1215 }
1216 });
1217}
1218
1219/* The options were converted into inputs. */
1221{
1222 NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
1223 if (!storage) {
1224 return;
1225 }
1226
1227 if (!bke::node_find_socket(*node, SOCK_IN, "Hue"_ustr)) {
1229 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Hue", "Hue");
1230 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t1;
1231 }
1232
1233 if (!bke::node_find_socket(*node, SOCK_IN, "Saturation"_ustr)) {
1235 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Saturation", "Saturation");
1236 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t2;
1237 }
1238
1239 if (!bke::node_find_socket(*node, SOCK_IN, "Value"_ustr)) {
1241 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Value", "Value");
1242 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t3;
1243 }
1244
1245 MEM_delete(storage);
1246 node->storage = nullptr;
1247}
1248
1249/* The options were converted into inputs. */
1251 bNode *node)
1252{
1253 /* Compute the RNA path of the node. */
1254 char escaped_node_name[sizeof(node->name) * 2 + 1];
1255 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1256 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1257
1258 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1259 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1260 * path. */
1261 if (!fcurve->rna_path().startswith(node_rna_path)) {
1262 return;
1263 }
1264
1265 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1266 * values of the FCurves frames when needed. */
1267 if (BLI_str_endswith(fcurve->rna_path().c_str(), "color_hue")) {
1268 fcurve->rna_path_set_move(
1269 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1270 }
1271 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "color_saturation")) {
1272 fcurve->rna_path_set_move(
1273 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1274 }
1275 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "color_value")) {
1276 fcurve->rna_path_set_move(
1277 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
1278 }
1279 });
1280}
1281
1282/* The options were converted into inputs. */
1284{
1285 NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
1286 if (!storage) {
1287 return;
1288 }
1289
1290 if (!bke::node_find_socket(*node, SOCK_IN, "Tolerance"_ustr)) {
1292 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Tolerance", "Tolerance");
1293 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t1;
1294 }
1295
1296 if (!bke::node_find_socket(*node, SOCK_IN, "Falloff"_ustr)) {
1298 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Falloff", "Falloff");
1299 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t2;
1300 }
1301
1302 MEM_delete(storage);
1303 node->storage = nullptr;
1304}
1305
1306/* The options were converted into inputs. */
1308 bNode *node)
1309{
1310 /* Compute the RNA path of the node. */
1311 char escaped_node_name[sizeof(node->name) * 2 + 1];
1312 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1313 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1314
1315 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1316 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1317 * path. */
1318 if (!fcurve->rna_path().startswith(node_rna_path)) {
1319 return;
1320 }
1321
1322 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1323 * values of the FCurves frames when needed. */
1324 if (BLI_str_endswith(fcurve->rna_path().c_str(), "tolerance")) {
1325 fcurve->rna_path_set_move(
1326 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1327 }
1328 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "falloff")) {
1329 fcurve->rna_path_set_move(
1330 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1331 }
1332 });
1333}
1334
1335/* The options were converted into inputs. */
1337{
1338 NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
1339 if (!storage) {
1340 return;
1341 }
1342
1343 if (!bke::node_find_socket(*node, SOCK_IN, "Tolerance"_ustr)) {
1345 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Tolerance", "Tolerance");
1346 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t1;
1347 }
1348
1349 if (!bke::node_find_socket(*node, SOCK_IN, "Falloff"_ustr)) {
1351 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Falloff", "Falloff");
1352 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t2;
1353 }
1354}
1355
1356/* The options were converted into inputs. */
1358 bNode *node)
1359{
1360 /* Compute the RNA path of the node. */
1361 char escaped_node_name[sizeof(node->name) * 2 + 1];
1362 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1363 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1364
1365 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1366 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1367 * path. */
1368 if (!fcurve->rna_path().startswith(node_rna_path)) {
1369 return;
1370 }
1371
1372 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1373 * values of the FCurves frames when needed. */
1374 if (BLI_str_endswith(fcurve->rna_path().c_str(), "tolerance")) {
1375 fcurve->rna_path_set_move(
1376 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1377 }
1378 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "falloff")) {
1379 fcurve->rna_path_set_move(
1380 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1381 }
1382 });
1383}
1384
1385/* The options were converted into inputs. */
1387{
1388 NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
1389 if (!storage) {
1390 return;
1391 }
1392
1393 if (!bke::node_find_socket(*node, SOCK_IN, "Minimum"_ustr)) {
1395 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Minimum", "Minimum");
1396 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t2;
1397 }
1398
1399 if (!bke::node_find_socket(*node, SOCK_IN, "Maximum"_ustr)) {
1401 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Maximum", "Maximum");
1402 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t1;
1403 }
1404
1405 MEM_delete(storage);
1406 node->storage = nullptr;
1407}
1408
1409/* The options were converted into inputs. */
1411 bNode *node)
1412{
1413 /* Compute the RNA path of the node. */
1414 char escaped_node_name[sizeof(node->name) * 2 + 1];
1415 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1416 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1417
1418 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1419 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1420 * path. */
1421 if (!fcurve->rna_path().startswith(node_rna_path)) {
1422 return;
1423 }
1424
1425 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1426 * values of the FCurves frames when needed. */
1427 if (BLI_str_endswith(fcurve->rna_path().c_str(), "limit_min")) {
1428 fcurve->rna_path_set_move(
1429 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
1430 }
1431 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "limit_max")) {
1432 fcurve->rna_path_set_move(
1433 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1434 }
1435 });
1436}
1437
1438/* The options were converted into inputs. */
1440{
1441 NodeColorspill *storage = static_cast<NodeColorspill *>(node->storage);
1442 if (!storage) {
1443 return;
1444 }
1445
1446 if (!bke::node_find_socket(*node, SOCK_IN, "Limit Strength"_ustr)) {
1448 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Limit Strength", "Limit Strength");
1449 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->limscale;
1450 }
1451
1452 if (!bke::node_find_socket(*node, SOCK_IN, "Use Spill Strength"_ustr)) {
1453 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1454 *node,
1455 SOCK_IN,
1457 PROP_NONE,
1458 "Use Spill Strength",
1459 "Use Spill Strength");
1460 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(storage->unspill);
1461 }
1462
1463 if (!bke::node_find_socket(*node, SOCK_IN, "Spill Strength"_ustr)) {
1465 *node_tree, *node, SOCK_IN, SOCK_RGBA, PROP_NONE, "Spill Strength", "Spill Strength");
1466 input->default_value_typed<bNodeSocketValueRGBA>()->value[0] = storage->uspillr;
1467 input->default_value_typed<bNodeSocketValueRGBA>()->value[1] = storage->uspillg;
1468 input->default_value_typed<bNodeSocketValueRGBA>()->value[2] = storage->uspillb;
1469 }
1470}
1471
1472/* The options were converted into inputs. */
1474 bNode *node)
1475{
1476 /* Compute the RNA path of the node. */
1477 char escaped_node_name[sizeof(node->name) * 2 + 1];
1478 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1479 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1480
1481 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1482 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1483 * path. */
1484 if (!fcurve->rna_path().startswith(node_rna_path)) {
1485 return;
1486 }
1487
1488 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1489 * values of the FCurves frames when needed. */
1490 if (BLI_str_endswith(fcurve->rna_path().c_str(), "ratio")) {
1491 fcurve->rna_path_set_move(
1492 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1493 }
1494 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_unspill")) {
1495 fcurve->rna_path_set_move(
1496 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1497 }
1498 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "unspill_red")) {
1499 fcurve->rna_path_set_move(
1500 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
1501 fcurve->array_index = 0;
1502 }
1503 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "unspill_green")) {
1504 fcurve->rna_path_set_move(
1505 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
1506 fcurve->array_index = 1;
1507 }
1508 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "unspill_blue")) {
1509 fcurve->rna_path_set_move(
1510 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
1511 fcurve->array_index = 2;
1512 }
1513 });
1514}
1515
1516/* The options were converted into inputs. */
1518{
1519 NodeKeyingScreenData *storage = static_cast<NodeKeyingScreenData *>(node->storage);
1520 if (!storage) {
1521 return;
1522 }
1523
1524 if (!bke::node_find_socket(*node, SOCK_IN, "Smoothness"_ustr)) {
1526 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Smoothness", "Smoothness");
1527 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->smoothness;
1528 }
1529}
1530
1531/* The options were converted into inputs. */
1533 bNode *node)
1534{
1535 /* Compute the RNA path of the node. */
1536 char escaped_node_name[sizeof(node->name) * 2 + 1];
1537 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1538 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1539
1540 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1541 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1542 * path. */
1543 if (!fcurve->rna_path().startswith(node_rna_path)) {
1544 return;
1545 }
1546
1547 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1548 * values of the FCurves frames when needed. */
1549 if (BLI_str_endswith(fcurve->rna_path().c_str(), "smoothness")) {
1550 fcurve->rna_path_set_move(
1551 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[0].default_value"));
1552 }
1553 });
1554}
1555
1556/* The options were converted into inputs. */
1558{
1559 NodeKeyingData *storage = static_cast<NodeKeyingData *>(node->storage);
1560 if (!storage) {
1561 return;
1562 }
1563
1564 if (!bke::node_find_socket(*node, SOCK_IN, "Preprocess Blur Size"_ustr)) {
1565 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1566 *node,
1567 SOCK_IN,
1568 SOCK_INT,
1569 PROP_NONE,
1570 "Preprocess Blur Size",
1571 "Preprocess Blur Size");
1572 input->default_value_typed<bNodeSocketValueInt>()->value = storage->blur_pre;
1573 }
1574
1575 if (!bke::node_find_socket(*node, SOCK_IN, "Key Balance"_ustr)) {
1577 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Key Balance", "Key Balance");
1578 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->screen_balance;
1579 }
1580
1581 if (!bke::node_find_socket(*node, SOCK_IN, "Edge Search Size"_ustr)) {
1583 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Edge Search Size", "Edge Search Size");
1584 input->default_value_typed<bNodeSocketValueInt>()->value = storage->edge_kernel_radius;
1585 }
1586
1587 if (!bke::node_find_socket(*node, SOCK_IN, "Edge Tolerance"_ustr)) {
1589 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Edge Tolerance", "Edge Tolerance");
1590 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->edge_kernel_tolerance;
1591 }
1592
1593 if (!bke::node_find_socket(*node, SOCK_IN, "Black Level"_ustr)) {
1595 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Black Level", "Black Level");
1596 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->clip_black;
1597 }
1598
1599 if (!bke::node_find_socket(*node, SOCK_IN, "White Level"_ustr)) {
1601 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "White Level", "White Level");
1602 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->clip_white;
1603 }
1604
1605 if (!bke::node_find_socket(*node, SOCK_IN, "Postprocess Blur Size"_ustr)) {
1606 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1607 *node,
1608 SOCK_IN,
1609 SOCK_INT,
1610 PROP_NONE,
1611 "Postprocess Blur Size",
1612 "Postprocess Blur Size");
1613 input->default_value_typed<bNodeSocketValueInt>()->value = storage->blur_post;
1614 }
1615
1616 if (!bke::node_find_socket(*node, SOCK_IN, "Postprocess Dilate Size"_ustr)) {
1617 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1618 *node,
1619 SOCK_IN,
1620 SOCK_INT,
1621 PROP_NONE,
1622 "Postprocess Dilate Size",
1623 "Postprocess Dilate Size");
1624 input->default_value_typed<bNodeSocketValueInt>()->value = storage->dilate_distance;
1625 }
1626
1627 if (!bke::node_find_socket(*node, SOCK_IN, "Postprocess Feather Size"_ustr)) {
1628 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1629 *node,
1630 SOCK_IN,
1631 SOCK_INT,
1632 PROP_NONE,
1633 "Postprocess Feather Size",
1634 "Postprocess Feather Size");
1635 input->default_value_typed<bNodeSocketValueInt>()->value = storage->feather_distance;
1636 }
1637
1638 if (!bke::node_find_socket(*node, SOCK_IN, "Despill Strength"_ustr)) {
1639 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1640 *node,
1641 SOCK_IN,
1642 SOCK_FLOAT,
1644 "Despill Strength",
1645 "Despill Strength");
1646 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->despill_factor;
1647 }
1648
1649 if (!bke::node_find_socket(*node, SOCK_IN, "Despill Balance"_ustr)) {
1651 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Despill Balance", "Despill Balance");
1652 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->despill_balance;
1653 }
1654}
1655
1656/* The options were converted into inputs. */
1658{
1659 /* Compute the RNA path of the node. */
1660 char escaped_node_name[sizeof(node->name) * 2 + 1];
1661 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1662 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1663
1664 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1665 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1666 * path. */
1667 if (!fcurve->rna_path().startswith(node_rna_path)) {
1668 return;
1669 }
1670
1671 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1672 * values of the FCurves frames when needed. */
1673 if (BLI_str_endswith(fcurve->rna_path().c_str(), "blur_pre")) {
1674 fcurve->rna_path_set_move(
1675 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1676 }
1677 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "screen_balance")) {
1678 fcurve->rna_path_set_move(
1679 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1680 }
1681 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "clip_black")) {
1682 fcurve->rna_path_set_move(
1683 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
1684 }
1685 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "clip_white")) {
1686 fcurve->rna_path_set_move(
1687 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
1688 }
1689 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "edge_kernel_radius")) {
1690 fcurve->rna_path_set_move(
1691 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[6].default_value"));
1692 }
1693 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "edge_kernel_tolerance")) {
1694 fcurve->rna_path_set_move(
1695 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[7].default_value"));
1696 }
1697 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "blur_post")) {
1698 fcurve->rna_path_set_move(
1699 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[10].default_value"));
1700 }
1701 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "dilate_distance")) {
1702 fcurve->rna_path_set_move(
1703 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[11].default_value"));
1704 }
1705 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "feather_distance")) {
1706 fcurve->rna_path_set_move(
1707 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[12].default_value"));
1708 }
1709 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "despill_factor")) {
1710 fcurve->rna_path_set_move(
1711 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[13].default_value"));
1712 }
1713 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "despill_balance")) {
1714 fcurve->rna_path_set_move(
1715 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[14].default_value"));
1716 }
1717 });
1718}
1719
1720/* The options were converted into inputs. */
1722{
1723 if (!bke::node_find_socket(*node, SOCK_IN, "Index"_ustr)) {
1725 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Index", "Index");
1726 input->default_value_typed<bNodeSocketValueInt>()->value = node->custom1;
1727 }
1728
1729 if (!bke::node_find_socket(*node, SOCK_IN, "Anti-Alias"_ustr)) {
1731 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Anti-Alias", "Anti-Alias");
1732 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom2);
1733 }
1734}
1735
1736/* The options were converted into inputs. */
1738{
1739 /* Compute the RNA path of the node. */
1740 char escaped_node_name[sizeof(node->name) * 2 + 1];
1741 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1742 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1743
1744 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1745 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1746 * path. */
1747 if (!fcurve->rna_path().startswith(node_rna_path)) {
1748 return;
1749 }
1750
1751 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1752 * values of the FCurves frames when needed. */
1753 if (BLI_str_endswith(fcurve->rna_path().c_str(), "index")) {
1754 fcurve->rna_path_set_move(
1755 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
1756 }
1757 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_antialiasing")) {
1758 fcurve->rna_path_set_move(
1759 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1760 }
1761 });
1762}
1763
1764/* The options were converted into inputs. */
1766{
1767 if (!bke::node_find_socket(*node, SOCK_IN, "Invert"_ustr)) {
1769 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Invert", "Invert");
1770 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom2);
1771 }
1772}
1773
1774/* The options were converted into inputs. */
1776 bNode *node)
1777{
1778 /* Compute the RNA path of the node. */
1779 char escaped_node_name[sizeof(node->name) * 2 + 1];
1780 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1781 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1782
1783 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1784 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1785 * path. */
1786 if (!fcurve->rna_path().startswith(node_rna_path)) {
1787 return;
1788 }
1789
1790 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1791 * values of the FCurves frames when needed. */
1792 if (BLI_str_endswith(fcurve->rna_path().c_str(), "invert")) {
1793 fcurve->rna_path_set_move(
1794 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
1795 }
1796 });
1797}
1798
1799/* The options were converted into inputs. */
1801{
1803 if (!storage) {
1804 return;
1805 }
1806
1807 if (!bke::node_find_socket(*node, SOCK_IN, "Motion Blur"_ustr)) {
1809 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Motion Blur", "Motion Blur");
1810 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(storage->flag);
1811 }
1812
1813 if (!bke::node_find_socket(*node, SOCK_IN, "Motion Blur Samples"_ustr)) {
1815 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Motion Blur Samples", "Samples");
1816 input->default_value_typed<bNodeSocketValueInt>()->value = storage->motion_blur_samples;
1817 }
1818
1819 if (!bke::node_find_socket(*node, SOCK_IN, "Motion Blur Shutter"_ustr)) {
1821 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Motion Blur Shutter", "Shutter");
1822 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->motion_blur_shutter;
1823 }
1824}
1825
1826/* The options were converted into inputs. */
1828 bNode *node)
1829{
1830 /* Compute the RNA path of the node. */
1831 char escaped_node_name[sizeof(node->name) * 2 + 1];
1832 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
1833 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
1834
1835 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
1836 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
1837 * path. */
1838 if (!fcurve->rna_path().startswith(node_rna_path)) {
1839 return;
1840 }
1841
1842 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
1843 * values of the FCurves frames when needed. */
1844 if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_motion_blur")) {
1845 fcurve->rna_path_set_move(
1846 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
1847 }
1848 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "motion_blur_samples")) {
1849 fcurve->rna_path_set_move(
1850 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
1851 }
1852 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "motion_blur_shutter")) {
1853 fcurve->rna_path_set_move(
1854 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
1855 }
1856 });
1857}
1858
1859/* The options were converted into inputs. */
1861{
1862 NodeColorCorrection *storage = static_cast<NodeColorCorrection *>(node->storage);
1863 if (!storage) {
1864 return;
1865 }
1866
1867 if (!bke::node_find_socket(*node, SOCK_IN, "Master Saturation"_ustr)) {
1868 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1869 *node,
1870 SOCK_IN,
1871 SOCK_FLOAT,
1873 "Master Saturation",
1874 "Master Saturation");
1875 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->master.saturation;
1876 }
1877
1878 if (!bke::node_find_socket(*node, SOCK_IN, "Master Contrast"_ustr)) {
1880 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Master Contrast", "Master Contrast");
1881 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->master.contrast;
1882 }
1883
1884 if (!bke::node_find_socket(*node, SOCK_IN, "Master Gamma"_ustr)) {
1886 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Master Gamma", "Master Gamma");
1887 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->master.gamma;
1888 }
1889
1890 if (!bke::node_find_socket(*node, SOCK_IN, "Master Gain"_ustr)) {
1892 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Master Gain", "Master Gain");
1893 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->master.gain;
1894 }
1895
1896 if (!bke::node_find_socket(*node, SOCK_IN, "Master Lift"_ustr)) {
1898 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Master Lift", "Master Lift");
1899 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->master.lift;
1900 }
1901
1902 if (!bke::node_find_socket(*node, SOCK_IN, "Shadows Saturation"_ustr)) {
1903 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1904 *node,
1905 SOCK_IN,
1906 SOCK_FLOAT,
1908 "Shadows Saturation",
1909 "Shadows Saturation");
1910 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->shadows.saturation;
1911 }
1912
1913 if (!bke::node_find_socket(*node, SOCK_IN, "Shadows Contrast"_ustr)) {
1914 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1915 *node,
1916 SOCK_IN,
1917 SOCK_FLOAT,
1919 "Shadows Contrast",
1920 "Shadows Contrast");
1921 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->shadows.contrast;
1922 }
1923
1924 if (!bke::node_find_socket(*node, SOCK_IN, "Shadows Gamma"_ustr)) {
1926 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Shadows Gamma", "Shadows Gamma");
1927 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->shadows.gamma;
1928 }
1929
1930 if (!bke::node_find_socket(*node, SOCK_IN, "Shadows Gain"_ustr)) {
1932 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Shadows Gain", "Shadows Gain");
1933 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->shadows.gain;
1934 }
1935
1936 if (!bke::node_find_socket(*node, SOCK_IN, "Shadows Lift"_ustr)) {
1938 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Shadows Lift", "Shadows Lift");
1939 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->shadows.lift;
1940 }
1941
1942 if (!bke::node_find_socket(*node, SOCK_IN, "Midtones Saturation"_ustr)) {
1943 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1944 *node,
1945 SOCK_IN,
1946 SOCK_FLOAT,
1948 "Midtones Saturation",
1949 "Midtones Saturation");
1950 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->midtones.saturation;
1951 }
1952
1953 if (!bke::node_find_socket(*node, SOCK_IN, "Midtones Contrast"_ustr)) {
1954 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1955 *node,
1956 SOCK_IN,
1957 SOCK_FLOAT,
1959 "Midtones Contrast",
1960 "Midtones Contrast");
1961 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->midtones.contrast;
1962 }
1963
1964 if (!bke::node_find_socket(*node, SOCK_IN, "Midtones Gamma"_ustr)) {
1966 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Midtones Gamma", "Midtones Gamma");
1967 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->midtones.gamma;
1968 }
1969
1970 if (!bke::node_find_socket(*node, SOCK_IN, "Midtones Gain"_ustr)) {
1972 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Midtones Gain", "Midtones Gain");
1973 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->midtones.gain;
1974 }
1975
1976 if (!bke::node_find_socket(*node, SOCK_IN, "Midtones Lift"_ustr)) {
1978 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Midtones Lift", "Midtones Lift");
1979 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->midtones.lift;
1980 }
1981
1982 if (!bke::node_find_socket(*node, SOCK_IN, "Highlights Saturation"_ustr)) {
1983 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1984 *node,
1985 SOCK_IN,
1986 SOCK_FLOAT,
1988 "Highlights Saturation",
1989 "Highlights Saturation");
1990 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->highlights.saturation;
1991 }
1992
1993 if (!bke::node_find_socket(*node, SOCK_IN, "Highlights Contrast"_ustr)) {
1994 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
1995 *node,
1996 SOCK_IN,
1997 SOCK_FLOAT,
1999 "Highlights Contrast",
2000 "Highlights Contrast");
2001 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->highlights.contrast;
2002 }
2003
2004 if (!bke::node_find_socket(*node, SOCK_IN, "Highlights Gamma"_ustr)) {
2005 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
2006 *node,
2007 SOCK_IN,
2008 SOCK_FLOAT,
2010 "Highlights Gamma",
2011 "Highlights Gamma");
2012 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->highlights.gamma;
2013 }
2014
2015 if (!bke::node_find_socket(*node, SOCK_IN, "Highlights Gain"_ustr)) {
2017 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Highlights Gain", "Highlights Gain");
2018 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->highlights.gain;
2019 }
2020
2021 if (!bke::node_find_socket(*node, SOCK_IN, "Highlights Lift"_ustr)) {
2023 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Highlights Lift", "Highlights Lift");
2024 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->highlights.lift;
2025 }
2026
2027 if (!bke::node_find_socket(*node, SOCK_IN, "Midtones Start"_ustr)) {
2029 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Midtones Start", "Midtones Start");
2030 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->startmidtones;
2031 }
2032
2033 if (!bke::node_find_socket(*node, SOCK_IN, "Midtones End"_ustr)) {
2035 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Midtones End", "Midtones End");
2036 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->endmidtones;
2037 }
2038
2039 if (!bke::node_find_socket(*node, SOCK_IN, "Apply On Red"_ustr)) {
2041 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Apply On Red", "Apply On Red");
2042 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1 & (1 << 0));
2043 }
2044
2045 if (!bke::node_find_socket(*node, SOCK_IN, "Apply On Green"_ustr)) {
2047 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Apply On Green", "Apply On Green");
2048 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1 & (1 << 1));
2049 }
2050
2051 if (!bke::node_find_socket(*node, SOCK_IN, "Apply On Blue"_ustr)) {
2053 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Apply On Blue", "Apply On Blue");
2054 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1 & (1 << 2));
2055 }
2056
2057 MEM_delete(storage);
2058 node->storage = nullptr;
2059}
2060
2061/* The options were converted into inputs. */
2063 bNode *node)
2064{
2065 /* Compute the RNA path of the node. */
2066 char escaped_node_name[sizeof(node->name) * 2 + 1];
2067 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2068 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2069
2070 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2071 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2072 * path. */
2073 if (!fcurve->rna_path().startswith(node_rna_path)) {
2074 return;
2075 }
2076
2077 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2078 * values of the FCurves frames when needed. */
2079 if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_motion_blur")) {
2080 fcurve->rna_path_set_move(
2081 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
2082 }
2083 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "master_saturation")) {
2084 fcurve->rna_path_set_move(
2085 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2086 }
2087 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "master_contrast")) {
2088 fcurve->rna_path_set_move(
2089 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2090 }
2091 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "master_gamma")) {
2092 fcurve->rna_path_set_move(
2093 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
2094 }
2095 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "master_gain")) {
2096 fcurve->rna_path_set_move(
2097 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
2098 }
2099 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "master_lift")) {
2100 fcurve->rna_path_set_move(
2101 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[6].default_value"));
2102 }
2103 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "highlights_saturation")) {
2104 fcurve->rna_path_set_move(
2105 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[7].default_value"));
2106 }
2107 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "highlights_contrast")) {
2108 fcurve->rna_path_set_move(
2109 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[8].default_value"));
2110 }
2111 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "highlights_gamma")) {
2112 fcurve->rna_path_set_move(
2113 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[9].default_value"));
2114 }
2115 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "highlights_gain")) {
2116 fcurve->rna_path_set_move(
2117 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[10].default_value"));
2118 }
2119 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "highlights_lift")) {
2120 fcurve->rna_path_set_move(
2121 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[11].default_value"));
2122 }
2123 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "midtones_saturation")) {
2124 fcurve->rna_path_set_move(
2125 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[12].default_value"));
2126 }
2127 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "midtones_contrast")) {
2128 fcurve->rna_path_set_move(
2129 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[13].default_value"));
2130 }
2131 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "midtones_gamma")) {
2132 fcurve->rna_path_set_move(
2133 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[14].default_value"));
2134 }
2135 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "midtones_gain")) {
2136 fcurve->rna_path_set_move(
2137 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[15].default_value"));
2138 }
2139 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "midtones_lift")) {
2140 fcurve->rna_path_set_move(
2141 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[16].default_value"));
2142 }
2143 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "shadows_saturation")) {
2144 fcurve->rna_path_set_move(
2145 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[17].default_value"));
2146 }
2147 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "shadows_contrast")) {
2148 fcurve->rna_path_set_move(
2149 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[18].default_value"));
2150 }
2151 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "shadows_gamma")) {
2152 fcurve->rna_path_set_move(
2153 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[19].default_value"));
2154 }
2155 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "shadows_gain")) {
2156 fcurve->rna_path_set_move(
2157 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[20].default_value"));
2158 }
2159 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "shadows_lift")) {
2160 fcurve->rna_path_set_move(
2161 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[21].default_value"));
2162 }
2163 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "midtones_start")) {
2164 fcurve->rna_path_set_move(
2165 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[22].default_value"));
2166 }
2167 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "midtones_end")) {
2168 fcurve->rna_path_set_move(
2169 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[23].default_value"));
2170 }
2171 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "red")) {
2172 fcurve->rna_path_set_move(
2173 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[24].default_value"));
2174 }
2175 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "green")) {
2176 fcurve->rna_path_set_move(
2177 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[25].default_value"));
2178 }
2179 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "blue")) {
2180 fcurve->rna_path_set_move(
2181 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[26].default_value"));
2182 }
2183 });
2184}
2185
2186/* The options were converted into inputs. */
2188{
2189 NodeLensDist *storage = static_cast<NodeLensDist *>(node->storage);
2190 if (!storage) {
2191 return;
2192 }
2193
2194 /* Use Projector boolean option is now an enum between two types. */
2195 storage->distortion_type = storage->proj ? CMP_NODE_LENS_DISTORTION_HORIZONTAL :
2197
2198 if (!bke::node_find_socket(*node, SOCK_IN, "Jitter"_ustr)) {
2200 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Jitter", "Jitter");
2201 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(storage->jit);
2202 }
2203
2204 if (!bke::node_find_socket(*node, SOCK_IN, "Fit"_ustr)) {
2206 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Fit", "Fit");
2207 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(storage->fit);
2208 }
2209}
2210
2211/* The options were converted into inputs. */
2213 bNode *node)
2214{
2215 /* Compute the RNA path of the node. */
2216 char escaped_node_name[sizeof(node->name) * 2 + 1];
2217 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2218 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2219
2220 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2221 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2222 * path. */
2223 if (!fcurve->rna_path().startswith(node_rna_path)) {
2224 return;
2225 }
2226
2227 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2228 * values of the FCurves frames when needed. */
2229 if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_jitter")) {
2230 fcurve->rna_path_set_move(
2231 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2232 }
2233 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_fit")) {
2234 fcurve->rna_path_set_move(
2235 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
2236 }
2237 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_projector")) {
2238 fcurve->rna_path_set_move(BLI_sprintfN("%s.%s", node_rna_path.c_str(), "distortion_type"));
2239 }
2240 });
2241}
2242
2243/* The options were converted into inputs. */
2245{
2246 NodeBoxMask *storage = static_cast<NodeBoxMask *>(node->storage);
2247 if (!storage) {
2248 return;
2249 }
2250
2251 if (!bke::node_find_socket(*node, SOCK_IN, "Position"_ustr)) {
2253 *node_tree, *node, SOCK_IN, SOCK_VECTOR, PROP_FACTOR, "Position", "Position");
2254 input->default_value_typed<bNodeSocketValueVector>()->value[0] = storage->x;
2255 input->default_value_typed<bNodeSocketValueVector>()->value[1] = storage->y;
2256 }
2257
2258 if (!bke::node_find_socket(*node, SOCK_IN, "Size"_ustr)) {
2260 *node_tree, *node, SOCK_IN, SOCK_VECTOR, PROP_FACTOR, "Size", "Size");
2261 input->default_value_typed<bNodeSocketValueVector>()->value[0] = storage->width;
2262 input->default_value_typed<bNodeSocketValueVector>()->value[1] = storage->height;
2263 }
2264
2265 if (!bke::node_find_socket(*node, SOCK_IN, "Rotation"_ustr)) {
2267 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Rotation", "Rotation");
2268 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->rotation;
2269 }
2270
2271 MEM_delete(storage);
2272 node->storage = nullptr;
2273}
2274
2275/* The options were converted into inputs. */
2277{
2278 /* Compute the RNA path of the node. */
2279 char escaped_node_name[sizeof(node->name) * 2 + 1];
2280 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2281 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2282
2283 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2284 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2285 * path. */
2286 if (!fcurve->rna_path().startswith(node_rna_path)) {
2287 return;
2288 }
2289
2290 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2291 * values of the FCurves frames when needed. */
2292 if (BLI_str_endswith(fcurve->rna_path().c_str(), "x")) {
2293 fcurve->rna_path_set_move(
2294 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2295 fcurve->array_index = 0;
2296 }
2297 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "y")) {
2298 fcurve->rna_path_set_move(
2299 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2300 fcurve->array_index = 1;
2301 }
2302 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "mask_width")) {
2303 fcurve->rna_path_set_move(
2304 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2305 fcurve->array_index = 0;
2306 }
2307 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "mask_height")) {
2308 fcurve->rna_path_set_move(
2309 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2310 fcurve->array_index = 1;
2311 }
2312 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "rotation")) {
2313 fcurve->rna_path_set_move(
2314 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
2315 }
2316 });
2317}
2318
2319/* The options were converted into inputs. */
2321{
2322 NodeEllipseMask *storage = static_cast<NodeEllipseMask *>(node->storage);
2323 if (!storage) {
2324 return;
2325 }
2326
2327 if (!bke::node_find_socket(*node, SOCK_IN, "Position"_ustr)) {
2329 *node_tree, *node, SOCK_IN, SOCK_VECTOR, PROP_FACTOR, "Position", "Position");
2330 input->default_value_typed<bNodeSocketValueVector>()->value[0] = storage->x;
2331 input->default_value_typed<bNodeSocketValueVector>()->value[1] = storage->y;
2332 }
2333
2334 if (!bke::node_find_socket(*node, SOCK_IN, "Size"_ustr)) {
2336 *node_tree, *node, SOCK_IN, SOCK_VECTOR, PROP_FACTOR, "Size", "Size");
2337 input->default_value_typed<bNodeSocketValueVector>()->value[0] = storage->width;
2338 input->default_value_typed<bNodeSocketValueVector>()->value[1] = storage->height;
2339 }
2340
2341 if (!bke::node_find_socket(*node, SOCK_IN, "Rotation"_ustr)) {
2343 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Rotation", "Rotation");
2344 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->rotation;
2345 }
2346
2347 MEM_delete(storage);
2348 node->storage = nullptr;
2349}
2350
2351/* The options were converted into inputs. */
2353 bNode *node)
2354{
2355 /* Compute the RNA path of the node. */
2356 char escaped_node_name[sizeof(node->name) * 2 + 1];
2357 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2358 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2359
2360 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2361 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2362 * path. */
2363 if (!fcurve->rna_path().startswith(node_rna_path)) {
2364 return;
2365 }
2366
2367 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2368 * values of the FCurves frames when needed. */
2369 if (BLI_str_endswith(fcurve->rna_path().c_str(), "x")) {
2370 fcurve->rna_path_set_move(
2371 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2372 fcurve->array_index = 0;
2373 }
2374 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "y")) {
2375 fcurve->rna_path_set_move(
2376 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2377 fcurve->array_index = 1;
2378 }
2379 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "mask_width")) {
2380 fcurve->rna_path_set_move(
2381 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2382 fcurve->array_index = 0;
2383 }
2384 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "mask_height")) {
2385 fcurve->rna_path_set_move(
2386 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2387 fcurve->array_index = 1;
2388 }
2389 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "rotation")) {
2390 fcurve->rna_path_set_move(
2391 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
2392 }
2393 });
2394}
2395
2396/* The options were converted into inputs. */
2398{
2399 NodeSunBeams *storage = static_cast<NodeSunBeams *>(node->storage);
2400 if (!storage) {
2401 return;
2402 }
2403
2404 if (!bke::node_find_socket(*node, SOCK_IN, "Source"_ustr)) {
2406 *node_tree, *node, SOCK_IN, SOCK_VECTOR, PROP_FACTOR, "Source", "Source");
2407 input->default_value_typed<bNodeSocketValueVector>()->value[0] = storage->source[0];
2408 input->default_value_typed<bNodeSocketValueVector>()->value[1] = storage->source[1];
2409 }
2410
2411 if (!bke::node_find_socket(*node, SOCK_IN, "Length"_ustr)) {
2413 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Length", "Length");
2414 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->ray_length;
2415 }
2416
2417 MEM_delete(storage);
2418 node->storage = nullptr;
2419}
2420
2421/* The options were converted into inputs. */
2423 bNode *node)
2424{
2425 /* Compute the RNA path of the node. */
2426 char escaped_node_name[sizeof(node->name) * 2 + 1];
2427 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2428 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2429
2430 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2431 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2432 * path. */
2433 if (!fcurve->rna_path().startswith(node_rna_path)) {
2434 return;
2435 }
2436
2437 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2438 * values of the FCurves frames when needed. */
2439 if (BLI_str_endswith(fcurve->rna_path().c_str(), "source")) {
2440 fcurve->rna_path_set_move(
2441 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
2442 }
2443 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "ray_length")) {
2444 fcurve->rna_path_set_move(
2445 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2446 }
2447 });
2448}
2449
2450/* The options were converted into inputs. */
2452{
2453 NodeDBlurData *storage = static_cast<NodeDBlurData *>(node->storage);
2454 if (!storage) {
2455 return;
2456 }
2457
2458 if (!bke::node_find_socket(*node, SOCK_IN, "Samples"_ustr)) {
2460 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Samples", "Samples");
2461 input->default_value_typed<bNodeSocketValueInt>()->value = storage->iter;
2462 }
2463
2464 if (!bke::node_find_socket(*node, SOCK_IN, "Center"_ustr)) {
2466 *node_tree, *node, SOCK_IN, SOCK_VECTOR, PROP_FACTOR, "Center", "Center");
2467 input->default_value_typed<bNodeSocketValueVector>()->value[0] = storage->center_x;
2468 input->default_value_typed<bNodeSocketValueVector>()->value[1] = storage->center_y;
2469 }
2470
2471 if (!bke::node_find_socket(*node, SOCK_IN, "Translation Amount"_ustr)) {
2473 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Translation Amount", "Amount");
2474 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->distance;
2475 }
2476
2477 if (!bke::node_find_socket(*node, SOCK_IN, "Translation Direction"_ustr)) {
2479 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Translation Direction", "Direction");
2480 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->angle;
2481 }
2482
2483 if (!bke::node_find_socket(*node, SOCK_IN, "Rotation"_ustr)) {
2485 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Rotation", "Rotation");
2486 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->spin;
2487 }
2488
2489 if (!bke::node_find_socket(*node, SOCK_IN, "Scale"_ustr)) {
2491 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Scale", "Scale");
2492 /* Scale was previously minus 1. */
2493 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->zoom + 1.0f;
2494 }
2495
2496 MEM_delete(storage);
2497 node->storage = nullptr;
2498}
2499
2500/* The options were converted into inputs. */
2502 bNode *node)
2503{
2504 /* Compute the RNA path of the node. */
2505 char escaped_node_name[sizeof(node->name) * 2 + 1];
2506 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2507 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2508
2509 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2510 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2511 * path. */
2512 if (!fcurve->rna_path().startswith(node_rna_path)) {
2513 return;
2514 }
2515
2516 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2517 * values of the FCurves frames when needed. */
2518 if (BLI_str_endswith(fcurve->rna_path().c_str(), "iterations")) {
2519 fcurve->rna_path_set_move(
2520 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
2521 }
2522 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "center_x")) {
2523 fcurve->rna_path_set_move(
2524 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2525 fcurve->array_index = 0;
2526 }
2527 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "center_y")) {
2528 fcurve->rna_path_set_move(
2529 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2530 fcurve->array_index = 1;
2531 }
2532 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "spin")) {
2533 fcurve->rna_path_set_move(
2534 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2535 }
2536 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "zoom")) {
2537 fcurve->rna_path_set_move(
2538 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
2539 /* Scale was previously minus 1. */
2540 adjust_fcurve_key_frame_values(
2541 fcurve, PROP_FLOAT, [&](const float value) { return value + 1.0f; });
2542 }
2543 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "distance")) {
2544 fcurve->rna_path_set_move(
2545 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
2546 }
2547 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "angle")) {
2548 fcurve->rna_path_set_move(
2549 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[6].default_value"));
2550 }
2551 });
2552}
2553
2554/* The options were converted into inputs. */
2556{
2557 NodeBilateralBlurData *storage = static_cast<NodeBilateralBlurData *>(node->storage);
2558 if (!storage) {
2559 return;
2560 }
2561
2562 if (!bke::node_find_socket(*node, SOCK_IN, "Size"_ustr)) {
2564 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Size", "Size");
2565 input->default_value_typed<bNodeSocketValueInt>()->value = std::ceil(storage->iter +
2566 storage->sigma_space);
2567 }
2568
2569 if (!bke::node_find_socket(*node, SOCK_IN, "Threshold"_ustr)) {
2571 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Threshold", "Threshold");
2572 /* Threshold was previously multiplied by 3. */
2573 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->sigma_color / 3.0f;
2574 }
2575
2576 MEM_delete(storage);
2577 node->storage = nullptr;
2578}
2579
2580/* The options were converted into inputs. */
2582 bNode *node)
2583{
2584 /* Compute the RNA path of the node. */
2585 char escaped_node_name[sizeof(node->name) * 2 + 1];
2586 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2587 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2588
2589 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2590 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2591 * path. */
2592 if (!fcurve->rna_path().startswith(node_rna_path)) {
2593 return;
2594 }
2595
2596 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2597 * values of the FCurves frames when needed. */
2598 if (BLI_str_endswith(fcurve->rna_path().c_str(), "iterations")) {
2599 fcurve->rna_path_set_move(
2600 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
2601 }
2602 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "sigma_color")) {
2603 fcurve->rna_path_set_move(
2604 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2605 }
2606 });
2607}
2608
2609/* The Use Alpha option and Alpha input were removed. If Use Alpha was disabled, set the input
2610 * alpha to 1 using a Set Alpha node, otherwise, if the Alpha input is linked, set it to the image
2611 * using a Set Alpha node. */
2613{
2614 /* Maps the names of the viewer and composite nodes to the links going into their image and alpha
2615 * inputs. */
2616 Map<std::string, bNodeLink *> node_to_image_link_map;
2617 Map<std::string, bNodeLink *> node_to_alpha_link_map;
2618
2619 /* Find links going into the composite and viewer nodes. */
2620 for (bNodeLink &link : node_tree->links) {
2622 continue;
2623 }
2624
2625 if (StringRef(link.tosock->identifier) == "Image") {
2626 node_to_image_link_map.add_new(link.tonode->name, &link);
2627 }
2628 else if (StringRef(link.tosock->identifier) == "Alpha") {
2629 node_to_alpha_link_map.add_new(link.tonode->name, &link);
2630 }
2631 }
2632
2633 for (bNode &node : node_tree->nodes) {
2635 continue;
2636 }
2637
2638 bNodeSocket *image_input = bke::node_find_socket(node, SOCK_IN, "Image"_ustr);
2639
2640 /* Use Alpha is disabled, so we need to set the alpha to 1. */
2641 if (node.custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) {
2642 /* Nothing is connected to the image, just set the default value alpha to 1. */
2643 if (!node_to_image_link_map.contains(node.name)) {
2644 image_input->default_value_typed<bNodeSocketValueRGBA>()->value[3] = 1.0f;
2645 continue;
2646 }
2647
2648 bNodeLink *image_link = node_to_image_link_map.lookup(node.name);
2649
2650 /* Add a set alpha node and make the necessary connections. */
2651 bNode *set_alpha_node = bke::node_add_static_node(nullptr, *node_tree, CMP_NODE_SETALPHA);
2652 set_alpha_node->parent = node.parent;
2653 set_alpha_node->location[0] = node.location[0] - node.width - 20.0f;
2654 set_alpha_node->location[1] = node.location[1];
2655
2656 bNodeSocket *set_alpha_input = bke::node_find_socket(*set_alpha_node, SOCK_IN, "Image"_ustr);
2657 bNodeSocket *set_alpha_type = bke::node_find_socket(*set_alpha_node, SOCK_IN, "Type"_ustr);
2658 bNodeSocket *set_alpha_output = bke::node_find_socket(
2659 *set_alpha_node, SOCK_OUT, "Image"_ustr);
2660
2661 set_alpha_type->default_value_typed<bNodeSocketValueMenu>()->value =
2663
2664 version_node_add_link(*node_tree,
2665 *image_link->fromnode,
2666 *image_link->fromsock,
2667 *set_alpha_node,
2668 *set_alpha_input);
2669 version_node_add_link(*node_tree, *set_alpha_node, *set_alpha_output, node, *image_input);
2670
2671 bke::node_remove_link(node_tree, *image_link);
2672 continue;
2673 }
2674
2675 /* If we don't continue, the alpha input is connected and Use Alpha is enabled, so we need to
2676 * set the alpha using a Set Alpha node. */
2677 if (!node_to_alpha_link_map.contains(node.name)) {
2678 continue;
2679 }
2680
2681 bNodeLink *alpha_link = node_to_alpha_link_map.lookup(node.name);
2682
2683 /* Add a set alpha node and make the necessary connections. */
2684 bNode *set_alpha_node = bke::node_add_static_node(nullptr, *node_tree, CMP_NODE_SETALPHA);
2685 set_alpha_node->parent = node.parent;
2686 set_alpha_node->location[0] = node.location[0] - node.width - 20.0f;
2687 set_alpha_node->location[1] = node.location[1];
2688
2689 bNodeSocket *set_alpha_input = bke::node_find_socket(*set_alpha_node, SOCK_IN, "Image"_ustr);
2690 bNodeSocket *set_alpha_alpha = bke::node_find_socket(*set_alpha_node, SOCK_IN, "Alpha"_ustr);
2691 bNodeSocket *set_alpha_type = bke::node_find_socket(*set_alpha_node, SOCK_IN, "Type"_ustr);
2692 bNodeSocket *set_alpha_output = bke::node_find_socket(*set_alpha_node, SOCK_OUT, "Image"_ustr);
2693
2694 set_alpha_type->default_value_typed<bNodeSocketValueMenu>()->value =
2696
2697 version_node_add_link(*node_tree,
2698 *alpha_link->fromnode,
2699 *alpha_link->fromsock,
2700 *set_alpha_node,
2701 *set_alpha_alpha);
2702 version_node_add_link(*node_tree, *set_alpha_node, *set_alpha_output, node, *image_input);
2703 bke::node_remove_link(node_tree, *alpha_link);
2704
2705 if (!node_to_image_link_map.contains(node.name)) {
2706 copy_v4_v4(set_alpha_input->default_value_typed<bNodeSocketValueRGBA>()->value,
2707 image_input->default_value_typed<bNodeSocketValueRGBA>()->value);
2708 }
2709 else {
2710 bNodeLink *image_link = node_to_image_link_map.lookup(node.name);
2711 version_node_add_link(*node_tree,
2712 *image_link->fromnode,
2713 *image_link->fromsock,
2714 *set_alpha_node,
2715 *set_alpha_input);
2716 bke::node_remove_link(node_tree, *image_link);
2717 }
2718 }
2719}
2720
2721/* The Convert Premultiplied option was removed. If enabled, a convert alpha node will be added
2722 * before and after the node to perform the adjustment in straight alpha. */
2724{
2725 for (bNodeLink &link : node_tree->links.items_reversed_mutable()) {
2726 if (link.tonode->type_legacy != CMP_NODE_BRIGHTCONTRAST) {
2727 continue;
2728 }
2729
2730 if (!bool(link.tonode->custom1)) {
2731 continue;
2732 }
2733
2734 if (StringRef(link.tosock->identifier) != "Image") {
2735 continue;
2736 }
2737
2738 bNode *convert_alpha_node = bke::node_add_static_node(nullptr, *node_tree, CMP_NODE_PREMULKEY);
2739 convert_alpha_node->parent = link.tonode->parent;
2740 convert_alpha_node->location[0] = link.tonode->location[0] - link.tonode->width - 20.0f;
2741 convert_alpha_node->location[1] = link.tonode->location[1];
2742
2743 bNodeSocket *convert_alpha_input = bke::node_find_socket(
2744 *convert_alpha_node, SOCK_IN, "Image"_ustr);
2745 bNodeSocket *convert_alpha_type = bke::node_find_socket(
2746 *convert_alpha_node, SOCK_IN, "Type"_ustr);
2747 bNodeSocket *convert_alpha_output = bke::node_find_socket(
2748 *convert_alpha_node, SOCK_OUT, "Image"_ustr);
2749
2750 convert_alpha_type->default_value_typed<bNodeSocketValueMenu>()->value =
2752
2754 *node_tree, *link.fromnode, *link.fromsock, *convert_alpha_node, *convert_alpha_input);
2756 *node_tree, *convert_alpha_node, *convert_alpha_output, *link.tonode, *link.tosock);
2757
2758 bke::node_remove_link(node_tree, link);
2759 }
2760
2761 for (bNodeLink &link : node_tree->links.items_reversed_mutable()) {
2762 if (link.fromnode->type_legacy != CMP_NODE_BRIGHTCONTRAST) {
2763 continue;
2764 }
2765
2766 if (!bool(link.fromnode->custom1)) {
2767 continue;
2768 }
2769
2770 bNode *convert_alpha_node = bke::node_add_static_node(nullptr, *node_tree, CMP_NODE_PREMULKEY);
2771 convert_alpha_node->parent = link.fromnode->parent;
2772 convert_alpha_node->location[0] = link.fromnode->location[0] + link.fromnode->width + 20.0f;
2773 convert_alpha_node->location[1] = link.fromnode->location[1];
2774
2775 bNodeSocket *convert_alpha_input = bke::node_find_socket(
2776 *convert_alpha_node, SOCK_IN, "Image"_ustr);
2777 bNodeSocket *convert_alpha_type = bke::node_find_socket(
2778 *convert_alpha_node, SOCK_IN, "Type"_ustr);
2779 bNodeSocket *convert_alpha_output = bke::node_find_socket(
2780 *convert_alpha_node, SOCK_OUT, "Image"_ustr);
2781
2782 convert_alpha_type->default_value_typed<bNodeSocketValueMenu>()->value =
2784
2786 *node_tree, *link.fromnode, *link.fromsock, *convert_alpha_node, *convert_alpha_input);
2788 *node_tree, *convert_alpha_node, *convert_alpha_output, *link.tonode, *link.tosock);
2789
2790 bke::node_remove_link(node_tree, link);
2791 }
2792}
2793
2794/* The Premultiply Mix option was removed. If enabled, the image is converted to premultiplied then
2795 * to straight, and both are mixed using a mix node. */
2797{
2798 for (bNodeLink &link : node_tree->links.items_reversed_mutable()) {
2799 if (link.tonode->type_legacy != CMP_NODE_ALPHAOVER) {
2800 continue;
2801 }
2802
2803 const float mix_factor = static_cast<NodeTwoFloats *>(link.tonode->storage)->x;
2804 if (mix_factor == 0.0f) {
2805 continue;
2806 }
2807
2808 if (StringRef(link.tosock->identifier) != "Image_001") {
2809 continue;
2810 }
2811
2812 /* Disable Convert Premultiplied option, since this will be done manually. */
2813 link.tonode->custom1 = false;
2814
2815 bNode *mix_node = bke::node_add_static_node(nullptr, *node_tree, SH_NODE_MIX);
2816 mix_node->parent = link.tonode->parent;
2817 mix_node->location[0] = link.tonode->location[0] - link.tonode->width - 20.0f;
2818 mix_node->location[1] = link.tonode->location[1];
2819 static_cast<NodeShaderMix *>(mix_node->storage)->data_type = SOCK_RGBA;
2820
2821 bNodeSocket *mix_a_input = bke::node_find_socket(*mix_node, SOCK_IN, "A_Color"_ustr);
2822 bNodeSocket *mix_b_input = bke::node_find_socket(*mix_node, SOCK_IN, "B_Color"_ustr);
2823 bNodeSocket *mix_factor_input = bke::node_find_socket(*mix_node, SOCK_IN, "Factor_Float"_ustr);
2824 bNodeSocket *mix_output = bke::node_find_socket(*mix_node, SOCK_OUT, "Result_Color"_ustr);
2825
2826 mix_factor_input->default_value_typed<bNodeSocketValueFloat>()->value = mix_factor;
2827
2828 bNode *to_straight_node = bke::node_add_static_node(nullptr, *node_tree, CMP_NODE_PREMULKEY);
2829 to_straight_node->parent = link.tonode->parent;
2830 to_straight_node->location[0] = mix_node->location[0] - mix_node->width - 20.0f;
2831 to_straight_node->location[1] = mix_node->location[1];
2832
2833 bNodeSocket *to_straight_input = bke::node_find_socket(
2834 *to_straight_node, SOCK_IN, "Image"_ustr);
2835 bNodeSocket *to_straight_type = bke::node_find_socket(*to_straight_node, SOCK_IN, "Type"_ustr);
2836 bNodeSocket *to_straight_output = bke::node_find_socket(
2837 *to_straight_node, SOCK_OUT, "Image"_ustr);
2838
2839 to_straight_type->default_value_typed<bNodeSocketValueMenu>()->value =
2841
2842 bNode *to_premultiplied_node = bke::node_add_static_node(
2843 nullptr, *node_tree, CMP_NODE_PREMULKEY);
2844 to_premultiplied_node->parent = link.tonode->parent;
2845 to_premultiplied_node->location[0] = to_straight_node->location[0] - to_straight_node->width -
2846 20.0f;
2847 to_premultiplied_node->location[1] = to_straight_node->location[1];
2848
2849 bNodeSocket *to_premultiplied_input = bke::node_find_socket(
2850 *to_premultiplied_node, SOCK_IN, "Image"_ustr);
2851 bNodeSocket *to_premultiplied_type = bke::node_find_socket(
2852 *to_premultiplied_node, SOCK_IN, "Type"_ustr);
2853 bNodeSocket *to_premultiplied_output = bke::node_find_socket(
2854 *to_premultiplied_node, SOCK_OUT, "Image"_ustr);
2855
2856 to_premultiplied_type->default_value_typed<bNodeSocketValueMenu>()->value =
2858
2859 version_node_add_link(*node_tree,
2860 *link.fromnode,
2861 *link.fromsock,
2862 *to_premultiplied_node,
2863 *to_premultiplied_input);
2864 version_node_add_link(*node_tree,
2865 *to_premultiplied_node,
2866 *to_premultiplied_output,
2867 *to_straight_node,
2868 *to_straight_input);
2870 *node_tree, *to_premultiplied_node, *to_premultiplied_output, *mix_node, *mix_b_input);
2872 *node_tree, *to_straight_node, *to_straight_output, *mix_node, *mix_a_input);
2873 version_node_add_link(*node_tree, *mix_node, *mix_output, *link.tonode, *link.tosock);
2874
2875 bke::node_remove_link(node_tree, link);
2876 }
2877
2878 for (bNode &node : node_tree->nodes) {
2879 if (node.type_legacy == CMP_NODE_ALPHAOVER) {
2881 NodeTwoFloats *storage = static_cast<NodeTwoFloats *>(node.storage);
2882 MEM_delete(storage);
2883 node.storage = nullptr;
2884 }
2885 }
2886 }
2887}
2888
2889/* The options were converted into inputs. */
2891{
2892 if (!bke::node_find_socket(*node, SOCK_IN, "Straight Alpha"_ustr)) {
2894 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Straight Alpha", "Straight Alpha");
2895 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1);
2896 }
2897}
2898
2899/* The options were converted into inputs. */
2901 bNode *node)
2902{
2903 /* Compute the RNA path of the node. */
2904 char escaped_node_name[sizeof(node->name) * 2 + 1];
2905 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2906 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2907
2908 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2909 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2910 * path. */
2911 if (!fcurve->rna_path().startswith(node_rna_path)) {
2912 return;
2913 }
2914
2915 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2916 * values of the FCurves frames when needed. */
2917 if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_premultiply")) {
2918 fcurve->rna_path_set_move(
2919 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
2920 }
2921 });
2922}
2923
2924/* The options were converted into inputs. */
2926{
2927 if (!bke::node_find_socket(*node, SOCK_IN, "Extend Bounds"_ustr)) {
2929 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Extend Bounds", "Extend Bounds");
2930 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1);
2931 }
2932}
2933
2934/* The options were converted into inputs. */
2936 bNode *node)
2937{
2938 /* Compute the RNA path of the node. */
2939 char escaped_node_name[sizeof(node->name) * 2 + 1];
2940 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
2941 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
2942
2943 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
2944 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
2945 * path. */
2946 if (!fcurve->rna_path().startswith(node_rna_path)) {
2947 return;
2948 }
2949
2950 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
2951 * values of the FCurves frames when needed. */
2952 if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_extended_bounds")) {
2953 fcurve->rna_path_set_move(
2954 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
2955 }
2956 });
2957}
2958
2959/* The XY Offset option was removed. If enabled, the image is translated in relative space using X
2960 * and Y, so add a Translate node to achieve the same function. */
2962{
2963 for (bNodeLink &link : node_tree->links.items_reversed_mutable()) {
2964 if (link.fromnode->type_legacy != CMP_NODE_SCALE) {
2965 continue;
2966 }
2967 if (!version_node_ensure_storage_or_invalidate(*link.fromnode)) {
2968 continue;
2969 }
2970
2971 if (link.fromnode->custom1 != CMP_NODE_SCALE_RENDER_SIZE) {
2972 continue;
2973 }
2974
2975 const float x = link.fromnode->custom3;
2976 const float y = link.fromnode->custom4;
2977 if (x == 0.0f && y == 0.0f) {
2978 continue;
2979 }
2980
2981 bNode *translate_node = bke::node_add_static_node(nullptr, *node_tree, CMP_NODE_TRANSLATE);
2982 translate_node->parent = link.fromnode->parent;
2983 translate_node->location[0] = link.fromnode->location[0] + link.fromnode->width + 20.0f;
2984 translate_node->location[1] = link.fromnode->location[1];
2985 static_cast<NodeTranslateData *>(translate_node->storage)->interpolation =
2986 static_cast<NodeScaleData *>(link.fromnode->storage)->interpolation;
2987 static_cast<NodeTranslateData *>(translate_node->storage)->relative = true;
2988
2989 bNodeSocket *translate_image_input = bke::node_find_socket(
2990 *translate_node, SOCK_IN, "Image"_ustr);
2991 bNodeSocket *translate_x_input = bke::node_find_socket(*translate_node, SOCK_IN, "X"_ustr);
2992 bNodeSocket *translate_y_input = bke::node_find_socket(*translate_node, SOCK_IN, "Y"_ustr);
2993 bNodeSocket *translate_image_output = bke::node_find_socket(
2994 *translate_node, SOCK_OUT, "Image"_ustr);
2995
2996 translate_x_input->default_value_typed<bNodeSocketValueFloat>()->value = x;
2997 translate_y_input->default_value_typed<bNodeSocketValueFloat>()->value = y;
2998
3000 *node_tree, *link.fromnode, *link.fromsock, *translate_node, *translate_image_input);
3002 *node_tree, *translate_node, *translate_image_output, *link.tonode, *link.tosock);
3003
3004 bke::node_remove_link(node_tree, link);
3005 }
3006}
3007
3013static void version_escape_curly_braces(char string[], const int string_array_length)
3014{
3015 int bytes_processed = 0;
3016 while (bytes_processed < string_array_length && string[bytes_processed] != '\0') {
3017 if (string[bytes_processed] == '{') {
3019 string, string_array_length, bytes_processed, bytes_processed + 1, "{{");
3020 bytes_processed += 2;
3021 continue;
3022 }
3023 if (string[bytes_processed] == '}') {
3025 string, string_array_length, bytes_processed, bytes_processed + 1, "}}");
3026 bytes_processed += 2;
3027 continue;
3028 }
3029 bytes_processed++;
3030 }
3031}
3032
3033/* The Gamma option was removed. If enabled, a Gamma node will be added before and after
3034 * the node to perform the adjustment in sRGB space. */
3036{
3037 for (bNodeLink &link : node_tree->links.items_reversed_mutable()) {
3038 if (!ELEM(link.tonode->type_legacy, CMP_NODE_BLUR, CMP_NODE_DEFOCUS)) {
3039 continue;
3040 }
3041 if (!version_node_ensure_storage_or_invalidate(*link.tonode)) {
3042 continue;
3043 }
3044
3045 if (link.tonode->type_legacy == CMP_NODE_BLUR &&
3046 !bool(static_cast<NodeBlurData *>(link.tonode->storage)->gamma))
3047 {
3048 continue;
3049 }
3050
3051 if (link.tonode->type_legacy == CMP_NODE_DEFOCUS &&
3052 !bool(static_cast<NodeDefocus *>(link.tonode->storage)->gamco))
3053 {
3054 continue;
3055 }
3056
3057 if (StringRef(link.tosock->identifier) != "Image") {
3058 continue;
3059 }
3060
3061 bNode *gamma_node = bke::node_add_static_node(nullptr, *node_tree, SH_NODE_GAMMA);
3062 gamma_node->parent = link.tonode->parent;
3063 gamma_node->location[0] = link.tonode->location[0] - link.tonode->width - 20.0f;
3064 gamma_node->location[1] = link.tonode->location[1];
3065
3066 bNodeSocket *color_input = bke::node_find_socket(*gamma_node, SOCK_IN, "Color"_ustr);
3067 bNodeSocket *color_output = bke::node_find_socket(*gamma_node, SOCK_OUT, "Color"_ustr);
3068
3069 bNodeSocket *gamma_input = bke::node_find_socket(*gamma_node, SOCK_IN, "Gamma"_ustr);
3070 gamma_input->default_value_typed<bNodeSocketValueFloat>()->value = 2.0f;
3071
3072 version_node_add_link(*node_tree, *link.fromnode, *link.fromsock, *gamma_node, *color_input);
3073 version_node_add_link(*node_tree, *gamma_node, *color_output, *link.tonode, *link.tosock);
3074
3075 bke::node_remove_link(node_tree, link);
3076 }
3077
3078 for (bNodeLink &link : node_tree->links.items_reversed_mutable()) {
3079 if (!ELEM(link.fromnode->type_legacy, CMP_NODE_BLUR, CMP_NODE_DEFOCUS)) {
3080 continue;
3081 }
3082 if (!version_node_ensure_storage_or_invalidate(*link.fromnode)) {
3083 continue;
3084 }
3085
3086 if (link.fromnode->type_legacy == CMP_NODE_BLUR &&
3087 !bool(static_cast<NodeBlurData *>(link.fromnode->storage)->gamma))
3088 {
3089 continue;
3090 }
3091
3092 if (link.fromnode->type_legacy == CMP_NODE_DEFOCUS &&
3093 !bool(static_cast<NodeDefocus *>(link.fromnode->storage)->gamco))
3094 {
3095 continue;
3096 }
3097
3098 bNode *gamma_node = bke::node_add_static_node(nullptr, *node_tree, SH_NODE_GAMMA);
3099 gamma_node->parent = link.fromnode->parent;
3100 gamma_node->location[0] = link.fromnode->location[0] + link.fromnode->width + 20.0f;
3101 gamma_node->location[1] = link.fromnode->location[1];
3102
3103 bNodeSocket *color_input = bke::node_find_socket(*gamma_node, SOCK_IN, "Color"_ustr);
3104 bNodeSocket *color_output = bke::node_find_socket(*gamma_node, SOCK_OUT, "Color"_ustr);
3105
3106 bNodeSocket *gamma_input = bke::node_find_socket(*gamma_node, SOCK_IN, "Gamma"_ustr);
3107 gamma_input->default_value_typed<bNodeSocketValueFloat>()->value = 0.5f;
3108
3109 version_node_add_link(*node_tree, *link.fromnode, *link.fromsock, *gamma_node, *color_input);
3110 version_node_add_link(*node_tree, *gamma_node, *color_output, *link.tonode, *link.tosock);
3111
3112 bke::node_remove_link(node_tree, link);
3113 }
3114}
3115
3123{
3124 if (nodetree.type != NTREE_COMPOSIT) {
3125 return;
3126 }
3127
3128 for (bNode &node : nodetree.nodes) {
3129 if (!STREQ(node.idname, "CompositorNodeOutputFile")) {
3130 continue;
3131 }
3133 continue;
3134 }
3135
3136 NodeCompositorFileOutput *node_data = static_cast<NodeCompositorFileOutput *>(node.storage);
3138
3139 for (bNodeSocket &sock : node.inputs) {
3140 NodeImageMultiFileSocket *socket_data = static_cast<NodeImageMultiFileSocket *>(
3141 sock.storage);
3143 }
3144 }
3145}
3146
3147/* The Relative option was removed. Insert Relative To Pixel nodes for the X and Y inputs to
3148 * convert relative values to pixel values. */
3150{
3151 for (bNode &node : node_tree->nodes) {
3152 if (!STREQ(node.idname, "CompositorNodeTranslate")) {
3153 continue;
3154 }
3156 continue;
3157 }
3158
3159 const NodeTranslateData *data = static_cast<NodeTranslateData *>(node.storage);
3160 if (!data) {
3161 continue;
3162 }
3163
3164 if (!bool(data->relative)) {
3165 continue;
3166 }
3167
3168 /* Find links going into the node. */
3169 bNodeLink *image_link = nullptr;
3170 bNodeLink *x_link = nullptr;
3171 bNodeLink *y_link = nullptr;
3172 for (bNodeLink &link : node_tree->links) {
3173 if (link.tonode != &node) {
3174 continue;
3175 }
3176
3177 if (StringRef(link.tosock->identifier) == "Image") {
3178 image_link = &link;
3179 }
3180
3181 if (StringRef(link.tosock->identifier) == "X") {
3182 x_link = &link;
3183 }
3184
3185 if (StringRef(link.tosock->identifier) == "Y") {
3186 y_link = &link;
3187 }
3188 }
3189
3190 /* Image input is unlinked, so the node does nothing. */
3191 if (!image_link) {
3192 continue;
3193 }
3194
3195 /* Add a Relative To Pixel node, assign it the input of the X translation and connect it to the
3196 * X translation input. */
3197 bNode *x_relative_to_pixel_node = bke::node_add_node(
3198 nullptr, *node_tree, "CompositorNodeRelativeToPixel"_ustr);
3199 x_relative_to_pixel_node->parent = node.parent;
3200 x_relative_to_pixel_node->location[0] = node.location[0] - node.width - 20.0f;
3201 x_relative_to_pixel_node->location[1] = node.location[1];
3202
3203 x_relative_to_pixel_node->custom1 = CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_FLOAT;
3205
3206 bNodeSocket *x_image_input = bke::node_find_socket(
3207 *x_relative_to_pixel_node, SOCK_IN, "Image"_ustr);
3208 bNodeSocket *x_value_input = bke::node_find_socket(
3209 *x_relative_to_pixel_node, SOCK_IN, "Float Value"_ustr);
3210 bNodeSocket *x_value_output = bke::node_find_socket(
3211 *x_relative_to_pixel_node, SOCK_OUT, "Float Value"_ustr);
3212
3213 bNodeSocket *x_input = bke::node_find_socket(node, SOCK_IN, "X"_ustr);
3214 x_value_input->default_value_typed<bNodeSocketValueFloat>()->value =
3215 x_input->default_value_typed<bNodeSocketValueFloat>()->value;
3216
3217 version_node_add_link(*node_tree, *x_relative_to_pixel_node, *x_value_output, node, *x_input);
3218 version_node_add_link(*node_tree,
3219 *image_link->fromnode,
3220 *image_link->fromsock,
3221 *x_relative_to_pixel_node,
3222 *x_image_input);
3223
3224 if (x_link) {
3225 version_node_add_link(*node_tree,
3226 *x_link->fromnode,
3227 *x_link->fromsock,
3228 *x_relative_to_pixel_node,
3229 *x_value_input);
3230 bke::node_remove_link(node_tree, *x_link);
3231 }
3232
3233 /* Add a Relative To Pixel node, assign it the input of the Y translation and connect it to the
3234 * Y translation input. */
3235 bNode *y_relative_to_pixel_node = bke::node_add_node(
3236 nullptr, *node_tree, "CompositorNodeRelativeToPixel"_ustr);
3237 y_relative_to_pixel_node->parent = node.parent;
3238 y_relative_to_pixel_node->location[0] = node.location[0] - node.width - 20.0f;
3239 y_relative_to_pixel_node->location[1] = node.location[1] - 20.0f;
3240
3241 y_relative_to_pixel_node->custom1 = CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_FLOAT;
3243
3244 bNodeSocket *y_image_input = bke::node_find_socket(
3245 *y_relative_to_pixel_node, SOCK_IN, "Image"_ustr);
3246 bNodeSocket *y_value_input = bke::node_find_socket(
3247 *y_relative_to_pixel_node, SOCK_IN, "Float Value"_ustr);
3248 bNodeSocket *y_value_output = bke::node_find_socket(
3249 *y_relative_to_pixel_node, SOCK_OUT, "Float Value"_ustr);
3250
3251 bNodeSocket *y_input = bke::node_find_socket(node, SOCK_IN, "Y"_ustr);
3252 y_value_input->default_value_typed<bNodeSocketValueFloat>()->value =
3253 y_input->default_value_typed<bNodeSocketValueFloat>()->value;
3254
3255 version_node_add_link(*node_tree, *y_relative_to_pixel_node, *y_value_output, node, *y_input);
3256 version_node_add_link(*node_tree,
3257 *image_link->fromnode,
3258 *image_link->fromsock,
3259 *y_relative_to_pixel_node,
3260 *y_image_input);
3261
3262 if (y_link) {
3263 version_node_add_link(*node_tree,
3264 *y_link->fromnode,
3265 *y_link->fromsock,
3266 *y_relative_to_pixel_node,
3267 *y_value_input);
3268 bke::node_remove_link(node_tree, *y_link);
3269 }
3270 }
3271}
3272
3273/* The options were converted into inputs, but the Relative option was removed. If relative is
3274 * enabled, we add Relative To Pixel nodes to convert the relative values to pixels. */
3276{
3277 NodeTwoXYs *storage = static_cast<NodeTwoXYs *>(node->storage);
3278 if (!storage) {
3279 return;
3280 }
3281
3282 if (!bke::node_find_socket(*node, SOCK_IN, "X"_ustr)) {
3284 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "X", "X");
3285 input->default_value_typed<bNodeSocketValueInt>()->value = storage->x1;
3286 }
3287
3288 if (!bke::node_find_socket(*node, SOCK_IN, "Y"_ustr)) {
3290 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Y", "Y");
3291 input->default_value_typed<bNodeSocketValueInt>()->value = storage->y2;
3292 }
3293
3294 if (!bke::node_find_socket(*node, SOCK_IN, "Width"_ustr)) {
3296 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Width", "Width");
3297 input->default_value_typed<bNodeSocketValueInt>()->value = storage->x2 - storage->x1;
3298 }
3299
3300 if (!bke::node_find_socket(*node, SOCK_IN, "Height"_ustr)) {
3302 *node_tree, *node, SOCK_IN, SOCK_INT, PROP_NONE, "Height", "Height");
3303 input->default_value_typed<bNodeSocketValueInt>()->value = storage->y1 - storage->y2;
3304 }
3305
3306 if (!bke::node_find_socket(*node, SOCK_IN, "Alpha Crop"_ustr)) {
3308 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Alpha Crop", "Alpha Crop");
3309 input->default_value_typed<bNodeSocketValueBoolean>()->value = !bool(node->custom1);
3310 }
3311
3312 /* Find links going into the node. */
3313 bNodeLink *image_link = nullptr;
3314 for (bNodeLink &link : node_tree->links) {
3315 if (link.tonode != node) {
3316 continue;
3317 }
3318
3319 if (StringRef(link.tosock->identifier) == "Image") {
3320 image_link = &link;
3321 }
3322 }
3323
3324 /* If Relative is not enabled or no image is connected, nothing else to do. */
3325 if (!bool(node->custom2) || !image_link) {
3326 MEM_delete(storage);
3327 node->storage = nullptr;
3328 return;
3329 }
3330
3331 bNode *x_relative_to_pixel_node = bke::node_add_node(
3332 nullptr, *node_tree, "CompositorNodeRelativeToPixel"_ustr);
3333 x_relative_to_pixel_node->parent = node->parent;
3334 x_relative_to_pixel_node->location[0] = node->location[0] - node->width - 20.0f;
3335 x_relative_to_pixel_node->location[1] = node->location[1];
3336
3337 x_relative_to_pixel_node->custom1 = CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_FLOAT;
3339
3340 bNodeSocket *x_image_input = bke::node_find_socket(
3341 *x_relative_to_pixel_node, SOCK_IN, "Image"_ustr);
3342 bNodeSocket *x_value_input = bke::node_find_socket(
3343 *x_relative_to_pixel_node, SOCK_IN, "Float Value"_ustr);
3344 bNodeSocket *x_value_output = bke::node_find_socket(
3345 *x_relative_to_pixel_node, SOCK_OUT, "Float Value"_ustr);
3346
3347 x_value_input->default_value_typed<bNodeSocketValueFloat>()->value = storage->fac_x1;
3348
3349 bNodeSocket *x_input = bke::node_find_socket(*node, SOCK_IN, "X"_ustr);
3350 version_node_add_link(*node_tree, *x_relative_to_pixel_node, *x_value_output, *node, *x_input);
3351 version_node_add_link(*node_tree,
3352 *image_link->fromnode,
3353 *image_link->fromsock,
3354 *x_relative_to_pixel_node,
3355 *x_image_input);
3356
3357 bNode *y_relative_to_pixel_node = bke::node_add_node(
3358 nullptr, *node_tree, "CompositorNodeRelativeToPixel"_ustr);
3359 y_relative_to_pixel_node->parent = node->parent;
3360 y_relative_to_pixel_node->location[0] = node->location[0] - node->width - 20.0f;
3361 y_relative_to_pixel_node->location[1] = node->location[1] - 10;
3362
3363 y_relative_to_pixel_node->custom1 = CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_FLOAT;
3365
3366 bNodeSocket *y_image_input = bke::node_find_socket(
3367 *y_relative_to_pixel_node, SOCK_IN, "Image"_ustr);
3368 bNodeSocket *y_value_input = bke::node_find_socket(
3369 *y_relative_to_pixel_node, SOCK_IN, "Float Value"_ustr);
3370 bNodeSocket *y_value_output = bke::node_find_socket(
3371 *y_relative_to_pixel_node, SOCK_OUT, "Float Value"_ustr);
3372
3373 bNodeSocket *y_input = bke::node_find_socket(*node, SOCK_IN, "Y"_ustr);
3374 y_value_input->default_value_typed<bNodeSocketValueFloat>()->value = storage->fac_y2;
3375
3376 version_node_add_link(*node_tree, *y_relative_to_pixel_node, *y_value_output, *node, *y_input);
3377 version_node_add_link(*node_tree,
3378 *image_link->fromnode,
3379 *image_link->fromsock,
3380 *y_relative_to_pixel_node,
3381 *y_image_input);
3382
3383 bNode *width_relative_to_pixel_node = bke::node_add_node(
3384 nullptr, *node_tree, "CompositorNodeRelativeToPixel"_ustr);
3385 width_relative_to_pixel_node->parent = node->parent;
3386 width_relative_to_pixel_node->location[0] = node->location[0] - node->width - 20.0f;
3387 width_relative_to_pixel_node->location[1] = node->location[1] - 20;
3388
3389 width_relative_to_pixel_node->custom1 = CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_FLOAT;
3390 width_relative_to_pixel_node->custom2 = CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_X;
3391
3392 bNodeSocket *width_image_input = bke::node_find_socket(
3393 *width_relative_to_pixel_node, SOCK_IN, "Image"_ustr);
3394 bNodeSocket *width_value_input = bke::node_find_socket(
3395 *width_relative_to_pixel_node, SOCK_IN, "Float Value"_ustr);
3396 bNodeSocket *width_value_output = bke::node_find_socket(
3397 *width_relative_to_pixel_node, SOCK_OUT, "Float Value"_ustr);
3398
3399 bNodeSocket *width_input = bke::node_find_socket(*node, SOCK_IN, "Width"_ustr);
3400 width_value_input->default_value_typed<bNodeSocketValueFloat>()->value = storage->fac_x2 -
3401 storage->fac_x1;
3402
3404 *node_tree, *width_relative_to_pixel_node, *width_value_output, *node, *width_input);
3405 version_node_add_link(*node_tree,
3406 *image_link->fromnode,
3407 *image_link->fromsock,
3408 *width_relative_to_pixel_node,
3409 *width_image_input);
3410
3411 bNode *height_relative_to_pixel_node = bke::node_add_node(
3412 nullptr, *node_tree, "CompositorNodeRelativeToPixel"_ustr);
3413 height_relative_to_pixel_node->parent = node->parent;
3414 height_relative_to_pixel_node->location[0] = node->location[0] - node->width - 20.0f;
3415 height_relative_to_pixel_node->location[1] = node->location[1] - 30;
3416
3417 height_relative_to_pixel_node->custom1 = CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_FLOAT;
3418 height_relative_to_pixel_node->custom2 = CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_Y;
3419
3420 bNodeSocket *height_image_input = bke::node_find_socket(
3421 *height_relative_to_pixel_node, SOCK_IN, "Image"_ustr);
3422 bNodeSocket *height_value_input = bke::node_find_socket(
3423 *height_relative_to_pixel_node, SOCK_IN, "Float Value"_ustr);
3424 bNodeSocket *height_value_output = bke::node_find_socket(
3425 *height_relative_to_pixel_node, SOCK_OUT, "Float Value"_ustr);
3426
3427 bNodeSocket *height_input = bke::node_find_socket(*node, SOCK_IN, "Height"_ustr);
3428 height_value_input->default_value_typed<bNodeSocketValueFloat>()->value = storage->fac_y1 -
3429 storage->fac_y2;
3430
3432 *node_tree, *height_relative_to_pixel_node, *height_value_output, *node, *height_input);
3433 version_node_add_link(*node_tree,
3434 *image_link->fromnode,
3435 *image_link->fromsock,
3436 *height_relative_to_pixel_node,
3437 *height_image_input);
3438
3439 MEM_delete(storage);
3440 node->storage = nullptr;
3441}
3442
3443/* The options were converted into inputs. */
3445{
3446 /* Compute the RNA path of the node. */
3447 char escaped_node_name[sizeof(node->name) * 2 + 1];
3448 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
3449 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
3450
3451 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
3452 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
3453 * path. */
3454 if (!fcurve->rna_path().startswith(node_rna_path)) {
3455 return;
3456 }
3457
3458 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
3459 * values of the FCurves frames when needed. */
3460 if (BLI_str_endswith(fcurve->rna_path().c_str(), "min_x")) {
3461 fcurve->rna_path_set_move(
3462 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
3463 }
3464 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "max_y")) {
3465 fcurve->rna_path_set_move(
3466 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
3467 }
3468 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "max_x")) {
3469 fcurve->rna_path_set_move(
3470 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
3471 }
3472 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "min_y")) {
3473 fcurve->rna_path_set_move(
3474 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"));
3475 }
3476 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_crop_size")) {
3477 fcurve->rna_path_set_move(
3478 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
3479 adjust_fcurve_key_frame_values(
3480 fcurve, PROP_BOOLEAN, [&](const float value) { return 1.0f - value; });
3481 }
3482 });
3483}
3484
3485/* The options were converted into inputs. */
3487{
3488 NodeColorBalance *storage = static_cast<NodeColorBalance *>(node->storage);
3489 if (!storage) {
3490 return;
3491 }
3492
3493 if (!bke::node_find_socket(*node, SOCK_IN, "Color Lift"_ustr)) {
3495 *node_tree, *node, SOCK_IN, SOCK_RGBA, PROP_NONE, "Color Lift", "Lift");
3496 copy_v3_v3(input->default_value_typed<bNodeSocketValueRGBA>()->value, storage->lift);
3497 }
3498
3499 if (!bke::node_find_socket(*node, SOCK_IN, "Color Gamma"_ustr)) {
3501 *node_tree, *node, SOCK_IN, SOCK_RGBA, PROP_NONE, "Color Gamma", "Gamma");
3502 copy_v3_v3(input->default_value_typed<bNodeSocketValueRGBA>()->value, storage->gamma);
3503 }
3504
3505 if (!bke::node_find_socket(*node, SOCK_IN, "Color Gain"_ustr)) {
3507 *node_tree, *node, SOCK_IN, SOCK_RGBA, PROP_NONE, "Color Gain", "Gain");
3508 copy_v3_v3(input->default_value_typed<bNodeSocketValueRGBA>()->value, storage->gain);
3509 }
3510
3511 if (!bke::node_find_socket(*node, SOCK_IN, "Color Offset"_ustr)) {
3513 *node_tree, *node, SOCK_IN, SOCK_RGBA, PROP_NONE, "Color Offset", "Offset");
3514 copy_v3_v3(input->default_value_typed<bNodeSocketValueRGBA>()->value, storage->offset);
3515 }
3516
3517 if (!bke::node_find_socket(*node, SOCK_IN, "Color Power"_ustr)) {
3519 *node_tree, *node, SOCK_IN, SOCK_RGBA, PROP_NONE, "Color Power", "Power");
3520 copy_v3_v3(input->default_value_typed<bNodeSocketValueRGBA>()->value, storage->power);
3521 }
3522
3523 if (!bke::node_find_socket(*node, SOCK_IN, "Color Slope"_ustr)) {
3525 *node_tree, *node, SOCK_IN, SOCK_RGBA, PROP_NONE, "Color Slope", "Slope");
3526 copy_v3_v3(input->default_value_typed<bNodeSocketValueRGBA>()->value, storage->slope);
3527 }
3528
3529 if (!bke::node_find_socket(*node, SOCK_IN, "Base Offset"_ustr)) {
3531 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Base Offset", "Offset");
3532 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->offset_basis;
3533 }
3534
3535 if (!bke::node_find_socket(*node, SOCK_IN, "Input Temperature"_ustr)) {
3536 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
3537 *node,
3538 SOCK_IN,
3539 SOCK_FLOAT,
3541 "Input Temperature",
3542 "Temperature");
3543 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->input_temperature;
3544 }
3545
3546 if (!bke::node_find_socket(*node, SOCK_IN, "Input Tint"_ustr)) {
3548 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Input Tint", "Tint");
3549 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->input_tint;
3550 }
3551
3552 if (!bke::node_find_socket(*node, SOCK_IN, "Output Temperature"_ustr)) {
3553 bNodeSocket *input = bke::node_add_static_socket(*node_tree,
3554 *node,
3555 SOCK_IN,
3556 SOCK_FLOAT,
3558 "Output Temperature",
3559 "Temperature");
3560 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->output_temperature;
3561 }
3562
3563 if (!bke::node_find_socket(*node, SOCK_IN, "Output Tint"_ustr)) {
3565 *node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Output Tint", "Tint");
3566 input->default_value_typed<bNodeSocketValueFloat>()->value = storage->output_tint;
3567 }
3568
3569 MEM_delete(storage);
3570 node->storage = nullptr;
3571}
3572
3573/* The options were converted into inputs. */
3575 bNode *node)
3576{
3577 /* Compute the RNA path of the node. */
3578 char escaped_node_name[sizeof(node->name) * 2 + 1];
3579 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
3580 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
3581
3582 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
3583 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
3584 * path. */
3585 if (!fcurve->rna_path().startswith(node_rna_path)) {
3586 return;
3587 }
3588
3589 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
3590 * values of the FCurves frames when needed. */
3591 if (BLI_str_endswith(fcurve->rna_path().c_str(), "lift")) {
3592 fcurve->rna_path_set_move(
3593 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
3594 }
3595 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "gamma")) {
3596 fcurve->rna_path_set_move(
3597 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"));
3598 }
3599 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "gain")) {
3600 fcurve->rna_path_set_move(
3601 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[7].default_value"));
3602 }
3603 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "offset_basis")) {
3604 fcurve->rna_path_set_move(
3605 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[8].default_value"));
3606 }
3607 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "offset")) {
3608 fcurve->rna_path_set_move(
3609 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[9].default_value"));
3610 }
3611 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "power")) {
3612 fcurve->rna_path_set_move(
3613 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[11].default_value"));
3614 }
3615 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "slope")) {
3616 fcurve->rna_path_set_move(
3617 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[13].default_value"));
3618 }
3619 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "input_temperature")) {
3620 fcurve->rna_path_set_move(
3621 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[14].default_value"));
3622 }
3623 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "input_tint")) {
3624 fcurve->rna_path_set_move(
3625 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[15].default_value"));
3626 }
3627 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "output_temperature")) {
3628 fcurve->rna_path_set_move(
3629 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[16].default_value"));
3630 }
3631 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "output_tint")) {
3632 fcurve->rna_path_set_move(
3633 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[17].default_value"));
3634 }
3635 });
3636}
3637
3638/* The Coordinates outputs were moved into their own Texture Coordinate node. If used, add a
3639 * Texture Coordinates node and use it instead. */
3641{
3642 for (bNode &node : node_tree->nodes) {
3643 if (!STREQ(node.idname, "CompositorNodeImageInfo")) {
3644 continue;
3645 }
3646
3647 bNodeLink *input_link = nullptr;
3648 bNodeLink *output_texture_link = nullptr;
3649 bNodeLink *output_pixel_link = nullptr;
3650 for (bNodeLink &link : node_tree->links) {
3651 if (link.tonode == &node) {
3652 input_link = &link;
3653 }
3654
3655 if (link.fromnode == &node && StringRef(link.fromsock->identifier) == "Texture Coordinates")
3656 {
3657 output_texture_link = &link;
3658 }
3659
3660 if (link.fromnode == &node && StringRef(link.fromsock->identifier) == "Pixel Coordinates") {
3661 output_pixel_link = &link;
3662 }
3663 }
3664
3665 if (!output_texture_link && !output_pixel_link) {
3666 continue;
3667 }
3668
3669 bNode *image_coordinates_node = bke::node_add_node(
3670 nullptr, *node_tree, "CompositorNodeImageCoordinates"_ustr);
3671 image_coordinates_node->parent = node.parent;
3672 image_coordinates_node->location[0] = node.location[0];
3673 image_coordinates_node->location[1] = node.location[1] - node.height - 10.0f;
3674
3675 if (input_link) {
3676 bNodeSocket *image_input = bke::node_find_socket(
3677 *image_coordinates_node, SOCK_IN, "Image"_ustr);
3678 version_node_add_link(*node_tree,
3679 *input_link->fromnode,
3680 *input_link->fromsock,
3681 *image_coordinates_node,
3682 *image_input);
3683 }
3684
3685 if (output_texture_link) {
3686 bNodeSocket *uniform_output = bke::node_find_socket(
3687 *image_coordinates_node, SOCK_OUT, "Uniform"_ustr);
3688 version_node_add_link(*node_tree,
3689 *image_coordinates_node,
3690 *uniform_output,
3691 *output_texture_link->tonode,
3692 *output_texture_link->tosock);
3693 bke::node_remove_link(node_tree, *output_texture_link);
3694 }
3695
3696 if (output_pixel_link) {
3697 bNodeSocket *pixel_output = bke::node_find_socket(
3698 *image_coordinates_node, SOCK_OUT, "Pixel"_ustr);
3699 version_node_add_link(*node_tree,
3700 *image_coordinates_node,
3701 *pixel_output,
3702 *output_pixel_link->tonode,
3703 *output_pixel_link->tosock);
3704 bke::node_remove_link(node_tree, *output_pixel_link);
3705 }
3706 }
3707}
3708
3714{
3715 Vector<bNodeTreeInterfaceSocket *> sockets_to_remove;
3716 node_tree->tree_interface.foreach_item([&](bNodeTreeInterfaceItem &item) {
3718 return true;
3719 }
3720
3721 bNodeTreeInterfaceSocket &interface_socket =
3723 bke::bNodeSocketType *base_typeinfo = bke::node_socket_type_find(interface_socket.socket_type);
3724 if (!base_typeinfo) {
3725 return true;
3726 }
3727
3728 if (base_typeinfo->type == SOCK_VECTOR) {
3729 if (interface_socket.socket_data == nullptr) {
3730 sockets_to_remove.append(&interface_socket);
3731 return true;
3732 }
3734 .dimensions = 3;
3735 }
3736 return true;
3737 });
3738
3739 for (bNodeTreeInterfaceSocket *socket : sockets_to_remove) {
3740 node_tree->tree_interface.remove_item(socket->item);
3741 }
3742
3743 for (bNode &node : node_tree->nodes) {
3744 for (bNodeSocket &socket : node.inputs) {
3745 if (socket.type == SOCK_VECTOR) {
3746 socket.default_value_typed<bNodeSocketValueVector>()->dimensions = 3;
3747 }
3748 }
3749 for (bNodeSocket &socket : node.outputs) {
3750 if (socket.type == SOCK_VECTOR) {
3751 socket.default_value_typed<bNodeSocketValueVector>()->dimensions = 3;
3752 }
3753 }
3754 }
3755}
3756
3757/* The options were converted into inputs, but the Relative option was removed. If relative is
3758 * enabled, we add Relative To Pixel nodes to convert the relative values to pixels. */
3760{
3761 NodeBlurData *storage = static_cast<NodeBlurData *>(node->storage);
3762 if (!storage) {
3763 return;
3764 }
3765
3766 bNodeSocket *size_input = bke::node_find_socket(*node, SOCK_IN, "Size"_ustr);
3767 const float old_size = size_input->default_value_typed<bNodeSocketValueFloat>()->value;
3768
3770 size_input->default_value_typed<bNodeSocketValueVector>()->value[0] = old_size * storage->sizex;
3771 size_input->default_value_typed<bNodeSocketValueVector>()->value[1] = old_size * storage->sizey;
3772
3773 if (!bke::node_find_socket(*node, SOCK_IN, "Extend Bounds"_ustr)) {
3775 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Extend Bounds", "Extend Bounds");
3776 input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1 & (1 << 1));
3777 }
3778
3779 if (!bke::node_find_socket(*node, SOCK_IN, "Separable"_ustr)) {
3781 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Separable", "Separable");
3782 input->default_value_typed<bNodeSocketValueBoolean>()->value = !bool(storage->bokeh);
3783 }
3784
3785 /* Find links going into the node. */
3786 bNodeLink *image_link = nullptr;
3787 bNodeLink *size_link = nullptr;
3788 for (bNodeLink &link : node_tree->links) {
3789 if (link.tonode != node) {
3790 continue;
3791 }
3792
3793 if (StringRef(link.tosock->identifier) == "Image") {
3794 image_link = &link;
3795 }
3796
3797 if (StringRef(link.tosock->identifier) == "Size") {
3798 size_link = &link;
3799 }
3800 }
3801
3802 if (size_link) {
3803 bNode *multiply_node = bke::node_add_node(nullptr, *node_tree, "ShaderNodeVectorMath"_ustr);
3804 multiply_node->parent = node->parent;
3805 multiply_node->location[0] = node->location[0] - node->width - 40.0f;
3806 multiply_node->location[1] = node->location[1];
3807
3808 multiply_node->custom1 = NODE_VECTOR_MATH_SCALE;
3809
3810 bNodeSocket *vector_input = bke::node_find_socket(*multiply_node, SOCK_IN, "Vector"_ustr);
3811 bNodeSocket *scale_input = bke::node_find_socket(*multiply_node, SOCK_IN, "Scale"_ustr);
3812 bNodeSocket *vector_output = bke::node_find_socket(*multiply_node, SOCK_OUT, "Vector"_ustr);
3813
3814 if (storage->relative) {
3815 vector_input->default_value_typed<bNodeSocketValueVector>()->value[0] = storage->percentx /
3816 100.0f;
3817 vector_input->default_value_typed<bNodeSocketValueVector>()->value[1] = storage->percenty /
3818 100.0f;
3819 }
3820 else {
3821 vector_input->default_value_typed<bNodeSocketValueVector>()->value[0] = storage->sizex;
3822 vector_input->default_value_typed<bNodeSocketValueVector>()->value[1] = storage->sizey;
3823 }
3824
3826 *node_tree, *size_link->fromnode, *size_link->fromsock, *multiply_node, *scale_input);
3827 bNodeLink &new_link = version_node_add_link(
3828 *node_tree, *multiply_node, *vector_output, *node, *size_input);
3829 bke::node_remove_link(node_tree, *size_link);
3830 size_link = &new_link;
3831 }
3832
3833 /* If Relative is not enabled or no image is connected, nothing else to do. */
3834 if (!bool(storage->relative) || !image_link) {
3835 return;
3836 }
3837
3838 bNode *relative_to_pixel_node = bke::node_add_node(
3839 nullptr, *node_tree, "CompositorNodeRelativeToPixel"_ustr);
3840 relative_to_pixel_node->parent = node->parent;
3841 relative_to_pixel_node->location[0] = node->location[0] - node->width - 20.0f;
3842 relative_to_pixel_node->location[1] = node->location[1];
3843
3844 relative_to_pixel_node->custom1 = CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_VECTOR;
3845 switch (storage->aspect) {
3848 break;
3851 break;
3853 relative_to_pixel_node->custom2 =
3855 break;
3856 default:
3858 break;
3859 }
3860
3861 bNodeSocket *image_input = bke::node_find_socket(*relative_to_pixel_node, SOCK_IN, "Image"_ustr);
3862 bNodeSocket *vector_input = bke::node_find_socket(
3863 *relative_to_pixel_node, SOCK_IN, "Vector Value"_ustr);
3864 bNodeSocket *vector_output = bke::node_find_socket(
3865 *relative_to_pixel_node, SOCK_OUT, "Vector Value"_ustr);
3866
3867 version_node_add_link(*node_tree,
3868 *image_link->fromnode,
3869 *image_link->fromsock,
3870 *relative_to_pixel_node,
3871 *image_input);
3872 if (size_link) {
3873 version_node_add_link(*node_tree,
3874 *size_link->fromnode,
3875 *size_link->fromsock,
3876 *relative_to_pixel_node,
3877 *vector_input);
3878 bke::node_remove_link(node_tree, *size_link);
3879 }
3880 else {
3881 vector_input->default_value_typed<bNodeSocketValueVector>()->value[0] = (storage->percentx /
3882 100.0f) *
3883 old_size;
3884 vector_input->default_value_typed<bNodeSocketValueVector>()->value[1] = (storage->percenty /
3885 100.0f) *
3886 old_size;
3887 }
3888 version_node_add_link(*node_tree, *relative_to_pixel_node, *vector_output, *node, *size_input);
3889}
3890
3891/* The options were converted into inputs. */
3893{
3894 /* Compute the RNA path of the node. */
3895 char escaped_node_name[sizeof(node->name) * 2 + 1];
3896 BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name));
3897 const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name);
3898
3899 BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) {
3900 /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA
3901 * path. */
3902 if (!fcurve->rna_path().startswith(node_rna_path)) {
3903 return;
3904 }
3905
3906 /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the
3907 * values of the FCurves frames when needed. */
3908 if (BLI_str_endswith(fcurve->rna_path().c_str(), "size_x")) {
3909 fcurve->rna_path_set_move(
3910 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
3911 fcurve->array_index = 0;
3912 }
3913 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "size_y")) {
3914 fcurve->rna_path_set_move(
3915 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"));
3916 fcurve->array_index = 1;
3917 }
3918 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_extended_bounds")) {
3919 fcurve->rna_path_set_move(
3920 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"));
3921 }
3922 else if (BLI_str_endswith(fcurve->rna_path().c_str(), "use_bokeh")) {
3923 fcurve->rna_path_set_move(
3924 BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"));
3925 adjust_fcurve_key_frame_values(
3926 fcurve, PROP_BOOLEAN, [&](const float value) { return 1.0f - value; });
3927 }
3928 });
3929}
3930
3931/* Unified paint settings need a default curve for the color jitter options. */
3944
3945/* GP_BRUSH_* settings in gpencil_settings->flag2 were deprecated and replaced with
3946 * brush->color_jitter_flag. */
3948{
3949 BrushGpencilSettings *settings = brush->gpencil_settings;
3950 if (settings->flag2 & GP_BRUSH_UNUSED_2) {
3951 brush->color_jitter_flag |= BRUSH_COLOR_JITTER_USE_HUE_AT_STROKE;
3952 }
3953 if (settings->flag2 & GP_BRUSH_UNUSED_3) {
3954 brush->color_jitter_flag |= BRUSH_COLOR_JITTER_USE_SAT_AT_STROKE;
3955 }
3956 if (settings->flag2 & GP_BRUSH_UNUSED_4) {
3957 brush->color_jitter_flag |= BRUSH_COLOR_JITTER_USE_VAL_AT_STROKE;
3958 }
3959 if (settings->flag2 & GP_BRUSH_UNUSED_5) {
3960 brush->color_jitter_flag |= BRUSH_COLOR_JITTER_USE_HUE_RAND_PRESS;
3961 }
3962 if (settings->flag2 & GP_BRUSH_UNUSED_6) {
3963 brush->color_jitter_flag |= BRUSH_COLOR_JITTER_USE_SAT_RAND_PRESS;
3964 }
3965 if (settings->flag2 & GP_BRUSH_UNUSED_7) {
3966 brush->color_jitter_flag |= BRUSH_COLOR_JITTER_USE_VAL_RAND_PRESS;
3967 }
3968}
3969
3970/* The options were converted into inputs. */
3972{
3973 if (!bke::node_find_socket(*node, SOCK_IN, "Flip X"_ustr)) {
3975 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Flip X", "Flip X");
3976 input->default_value_typed<bNodeSocketValueBoolean>()->value = ELEM(node->custom1, 0, 2);
3977 }
3978
3979 if (!bke::node_find_socket(*node, SOCK_IN, "Flip Y"_ustr)) {
3981 *node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Flip Y", "Flip Y");
3982 input->default_value_typed<bNodeSocketValueBoolean>()->value = ELEM(node->custom1, 1, 2);
3983 }
3984}
3985
3987{
3988 Map<bNodeSocket *, bNodeLink *> links_to_level_and_max_inputs;
3989 for (bNodeLink &link : tree.links) {
3990 if (link.tosock) {
3991 if (ELEM(StringRef(link.tosock->identifier), "Level", "Max")) {
3992 links_to_level_and_max_inputs.add(link.tosock, &link);
3993 }
3994 }
3995 }
3996 for (bNode &node : tree.nodes.items_mutable()) {
3998 continue;
3999 }
4000 bNodeSocket *level_input = bke::node_find_socket(node, SOCK_IN, "Level"_ustr);
4001 if (!level_input || level_input->type != SOCK_INT) {
4002 continue;
4003 }
4004 bNodeLink *link = links_to_level_and_max_inputs.lookup_default(level_input, nullptr);
4005 if (link) {
4006 bNode *origin_node = link->fromnode;
4007 if (origin_node->type_legacy == SH_NODE_CLAMP) {
4008 bNodeSocket *max_input_socket = bke::node_find_socket(*origin_node, SOCK_IN, "Max"_ustr);
4009 if (max_input_socket->type == SOCK_FLOAT &&
4010 !links_to_level_and_max_inputs.contains(max_input_socket))
4011 {
4012 if (max_input_socket->default_value_typed<bNodeSocketValueFloat>()->value <= 11.0f) {
4013 /* There is already a clamp node, so no need to add another one. */
4014 continue;
4015 }
4016 }
4017 }
4018 /* Insert clamp node. */
4019 bNode &clamp_node = version_node_add_empty(tree, "ShaderNodeClamp");
4020 clamp_node.parent = node.parent;
4021 clamp_node.location[0] = node.location[0] - 25;
4022 clamp_node.location[1] = node.location[1];
4023 bNodeSocket &clamp_value_input = version_node_add_socket(
4024 tree, clamp_node, SOCK_IN, "NodeSocketFloat", "Value");
4025 bNodeSocket &clamp_min_input = version_node_add_socket(
4026 tree, clamp_node, SOCK_IN, "NodeSocketFloat", "Min");
4027 bNodeSocket &clamp_max_input = version_node_add_socket(
4028 tree, clamp_node, SOCK_IN, "NodeSocketFloat", "Max");
4029 bNodeSocket &clamp_value_output = version_node_add_socket(
4030 tree, clamp_node, SOCK_OUT, "NodeSocketFloat", "Result");
4031
4032 static_cast<bNodeSocketValueFloat *>(clamp_min_input.default_value)->value = 0.0f;
4033 static_cast<bNodeSocketValueFloat *>(clamp_max_input.default_value)->value = 11.0f;
4034
4035 link->tosock = &clamp_value_input;
4036 version_node_add_link(tree, clamp_node, clamp_value_output, node, *level_input);
4037 }
4038 else {
4039 /* Clamp value directly. */
4040 bNodeSocketValueInt *value = level_input->default_value_typed<bNodeSocketValueInt>();
4041 value->value = std::clamp(value->value, 0, 11);
4042 }
4043 }
4044
4046}
4047
4049{
4050 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 12)) {
4052 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
4053 if (ntree->type == NTREE_COMPOSIT) {
4055 }
4056 }
4058 }
4059
4060 /* For each F-Curve, set the F-Curve flags based on the property type it animates. This is to
4061 * correct F-Curves created while the bug (#136347) was in active use. Since this bug did not
4062 * appear before 4.4, and this versioning code has a bit of a performance impact (going over all
4063 * F-Curves of all Actions, and resolving them all to their RNA properties), it will be skipped
4064 * if the blend file is old enough to not be affected. */
4065 if (MAIN_VERSION_FILE_ATLEAST(bmain, 404, 0) && !MAIN_VERSION_FILE_ATLEAST(bmain, 405, 13)) {
4066 for (bAction &dna_action : bmain->actions) {
4067 animrig::Action &action = dna_action.wrap();
4068 for (const animrig::Slot *slot : action.slots()) {
4069 Span<ID *> slot_users = slot->users(*bmain);
4070 if (slot_users.is_empty()) {
4071 /* If nothing is using this slot, the RNA paths cannot be resolved, and so there
4072 * is no way to find the animated property type. */
4073 continue;
4074 }
4075 animrig::foreach_fcurve_in_action_slot(action, slot->handle, [&](FCurve &fcurve) {
4076 /* Loop over all slot users, because when the slot is shared, not all F-Curves may
4077 * resolve on all users. For example, a custom property might only exist on a subset of
4078 * the users. */
4079 for (ID *slot_user : slot_users) {
4080 PointerRNA slot_user_ptr = RNA_id_pointer_create(slot_user);
4081 PointerRNA ptr;
4082 PropertyRNA *prop;
4083 if (!RNA_path_resolve_property(&slot_user_ptr, fcurve.rna_path().c_str(), &ptr, &prop))
4084 {
4085 continue;
4086 }
4087
4088 animrig::update_autoflags_fcurve_direct(&fcurve, RNA_property_type(prop));
4089 break;
4090 }
4091 });
4092 }
4093 }
4094 }
4095
4096 /* Because this was backported to 4.4 (f1e829a459) we need to exclude anything that was already
4097 * saved with that version otherwise we would apply the fix twice. */
4098 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 404, 32) ||
4099 (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 14) && bmain->versionfile >= 405))
4100 {
4101 for (bAction &dna_action : bmain->actions) {
4102 animrig::Action &action = dna_action.wrap();
4103 animrig::foreach_fcurve_in_action(
4104 action, [&](FCurve &fcurve) { version_fix_fcurve_noise_offset(fcurve); });
4105 }
4106
4107 BKE_animdata_main_cb(bmain, [](ID * /* id */, AnimData *adt) {
4108 for (FCurve &fcurve : adt->drivers) {
4110 }
4111 for (NlaTrack &track : adt->nla_tracks) {
4113 }
4114 });
4115 }
4116
4117 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 20)) {
4118 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4119 if (node_tree->type == NTREE_COMPOSIT) {
4120 for (bNode &node : node_tree->nodes) {
4121 if (node.type_legacy == CMP_NODE_GLARE) {
4123 }
4124 }
4125 }
4126 }
4128 }
4129
4130 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 22)) {
4131 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4132 if (node_tree->type == NTREE_COMPOSIT) {
4133 for (bNode &node : node_tree->nodes) {
4134 if (node.type_legacy == CMP_NODE_BOKEHIMAGE) {
4136 }
4137 }
4138 }
4139 }
4141 }
4142
4143 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 23)) {
4144 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4145 if (node_tree->type == NTREE_COMPOSIT) {
4146 for (bNode &node : node_tree->nodes) {
4147 if (node.type_legacy == CMP_NODE_TIME) {
4149 }
4150 }
4151 }
4152 }
4154 }
4155
4156 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 24)) {
4157 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4158 if (node_tree->type == NTREE_COMPOSIT) {
4159 for (bNode &node : node_tree->nodes) {
4160 if (node.type_legacy == CMP_NODE_MASK) {
4162 }
4163 }
4164 }
4165 }
4167 }
4168
4169 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 25)) {
4170 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4171 if (node_tree->type == NTREE_COMPOSIT) {
4172 for (bNode &node : node_tree->nodes) {
4173 if (node.type_legacy == CMP_NODE_SWITCH) {
4175 }
4176 }
4177 }
4178 }
4180 }
4181
4182 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 26)) {
4183 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4184 if (node_tree->type == NTREE_COMPOSIT) {
4185 for (bNode &node : node_tree->nodes) {
4186 if (node.type_legacy == CMP_NODE_SPLIT) {
4188 }
4189 }
4190 }
4191 }
4193 }
4194
4195 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 27)) {
4196 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4197 if (node_tree->type == NTREE_COMPOSIT) {
4198 for (bNode &node : node_tree->nodes) {
4199 if (node.type_legacy == CMP_NODE_INVERT) {
4201 }
4202 }
4203 }
4204 }
4206 }
4207
4208 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 28)) {
4209 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4210 if (node_tree->type == NTREE_COMPOSIT) {
4211 for (bNode &node : node_tree->nodes) {
4212 if (node.type_legacy == CMP_NODE_ZCOMBINE) {
4214 }
4215 }
4216 }
4217 }
4219 }
4220
4221 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 29)) {
4222 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4223 if (node_tree->type == NTREE_COMPOSIT) {
4224 for (bNode &node : node_tree->nodes) {
4225 if (node.type_legacy == CMP_NODE_TONEMAP) {
4227 }
4228 }
4229 }
4230 }
4232 }
4233
4234 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 30)) {
4235 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4236 if (node_tree->type == NTREE_COMPOSIT) {
4237 for (bNode &node : node_tree->nodes) {
4238 if (node.type_legacy == CMP_NODE_DILATEERODE) {
4240 }
4241 }
4242 }
4243 }
4245 }
4246
4247 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 31)) {
4248 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4249 if (node_tree->type == NTREE_COMPOSIT) {
4250 for (bNode &node : node_tree->nodes) {
4251 if (node.type_legacy == CMP_NODE_INPAINT) {
4253 }
4254 }
4255 }
4256 }
4258 }
4259
4260 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 32)) {
4261 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4262 if (node_tree->type == NTREE_COMPOSIT) {
4263 for (bNode &node : node_tree->nodes) {
4264 if (node.type_legacy == CMP_NODE_PIXELATE) {
4266 }
4267 }
4268 }
4269 }
4271 }
4272
4273 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 33)) {
4274 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4275 if (node_tree->type == NTREE_COMPOSIT) {
4276 for (bNode &node : node_tree->nodes) {
4277 if (node.type_legacy == CMP_NODE_KUWAHARA) {
4279 }
4280 }
4281 }
4282 }
4284 }
4285
4286 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 34)) {
4287 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4288 if (node_tree->type == NTREE_COMPOSIT) {
4289 for (bNode &node : node_tree->nodes) {
4290 if (node.type_legacy == CMP_NODE_DESPECKLE) {
4292 }
4293 }
4294 }
4295 }
4297 }
4298
4299 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 35)) {
4300 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4301 if (node_tree->type == NTREE_COMPOSIT) {
4302 for (bNode &node : node_tree->nodes) {
4303 if (node.type_legacy == CMP_NODE_DENOISE) {
4305 }
4306 }
4307 }
4308 }
4310 }
4311
4312 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 36)) {
4313 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4314 if (node_tree->type == NTREE_COMPOSIT) {
4315 for (bNode &node : node_tree->nodes) {
4316 if (node.type_legacy == CMP_NODE_ANTIALIASING) {
4318 }
4319 }
4320 }
4321 }
4323 }
4324
4325 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 37)) {
4326 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4327 if (node_tree->type == NTREE_COMPOSIT) {
4328 for (bNode &node : node_tree->nodes) {
4329 if (node.type_legacy == CMP_NODE_VECBLUR) {
4331 }
4332 }
4333 }
4334 }
4336 }
4337
4338 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 38)) {
4339 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4340 if (node_tree->type == NTREE_COMPOSIT) {
4341 for (bNode &node : node_tree->nodes) {
4342 if (node.type_legacy == CMP_NODE_CHANNEL_MATTE) {
4344 }
4345 }
4346 }
4347 }
4349 }
4350
4351 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 39)) {
4352 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4353 if (node_tree->type == NTREE_COMPOSIT) {
4354 for (bNode &node : node_tree->nodes) {
4355 if (node.type_legacy == CMP_NODE_CHROMA_MATTE) {
4357 }
4358 }
4359 }
4360 }
4362 }
4363
4364 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 40)) {
4365 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4366 if (node_tree->type == NTREE_COMPOSIT) {
4367 for (bNode &node : node_tree->nodes) {
4368 if (node.type_legacy == CMP_NODE_COLOR_MATTE) {
4370 }
4371 }
4372 }
4373 }
4375 }
4376
4377 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 41)) {
4378 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4379 if (node_tree->type == NTREE_COMPOSIT) {
4380 for (bNode &node : node_tree->nodes) {
4381 if (node.type_legacy == CMP_NODE_DIFF_MATTE) {
4383 }
4384 }
4385 }
4386 }
4388 }
4389
4390 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 42)) {
4391 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4392 if (node_tree->type == NTREE_COMPOSIT) {
4393 for (bNode &node : node_tree->nodes) {
4394 if (node.type_legacy == CMP_NODE_DIST_MATTE) {
4396 }
4397 }
4398 }
4399 }
4401 }
4402
4403 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 43)) {
4404 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4405 if (node_tree->type == NTREE_COMPOSIT) {
4406 for (bNode &node : node_tree->nodes) {
4407 if (node.type_legacy == CMP_NODE_LUMA_MATTE) {
4409 }
4410 }
4411 }
4412 }
4414 }
4415
4416 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 44)) {
4417 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4418 if (node_tree->type == NTREE_COMPOSIT) {
4419 for (bNode &node : node_tree->nodes) {
4420 if (node.type_legacy == CMP_NODE_COLOR_SPILL) {
4422 }
4423 }
4424 }
4425 }
4427 }
4428
4429 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 45)) {
4430 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4431 if (node_tree->type == NTREE_COMPOSIT) {
4432 for (bNode &node : node_tree->nodes) {
4433 if (node.type_legacy == CMP_NODE_KEYINGSCREEN) {
4435 }
4436 }
4437 }
4438 }
4440 }
4441
4442 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 47)) {
4443 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4444 if (node_tree->type == NTREE_COMPOSIT) {
4445 for (bNode &node : node_tree->nodes) {
4446 if (node.type_legacy == CMP_NODE_KEYING) {
4448 }
4449 }
4450 }
4451 }
4453 }
4454
4455 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 48)) {
4456 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4457 if (node_tree->type == NTREE_COMPOSIT) {
4458 for (bNode &node : node_tree->nodes) {
4459 if (node.type_legacy == CMP_NODE_ID_MASK) {
4461 }
4462 }
4463 }
4464 }
4466 }
4467
4468 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 49)) {
4469 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4470 if (node_tree->type == NTREE_COMPOSIT) {
4471 for (bNode &node : node_tree->nodes) {
4472 if (node.type_legacy == CMP_NODE_STABILIZE2D) {
4474 }
4475 }
4476 }
4477 }
4479 }
4480
4481 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 50)) {
4482 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4483 if (node_tree->type == NTREE_COMPOSIT) {
4484 for (bNode &node : node_tree->nodes) {
4485 if (node.type_legacy == CMP_NODE_PLANETRACKDEFORM) {
4487 }
4488 }
4489 }
4490 }
4492 }
4493
4494 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 52)) {
4495 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4496 if (node_tree->type == NTREE_COMPOSIT) {
4497 for (bNode &node : node_tree->nodes) {
4498 if (node.type_legacy == CMP_NODE_COLORCORRECTION) {
4500 }
4501 }
4502 }
4503 }
4505 }
4506
4507 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 53)) {
4508 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4509 if (node_tree->type == NTREE_COMPOSIT) {
4510 for (bNode &node : node_tree->nodes) {
4511 if (node.type_legacy == CMP_NODE_LENSDIST) {
4513 }
4514 }
4515 }
4516 }
4518 }
4519
4520 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 54)) {
4521 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4522 if (node_tree->type == NTREE_COMPOSIT) {
4523 for (bNode &node : node_tree->nodes) {
4524 if (node.type_legacy == CMP_NODE_MASK_BOX) {
4526 }
4527 }
4528 }
4529 }
4531 }
4532
4533 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 55)) {
4534 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4535 if (node_tree->type == NTREE_COMPOSIT) {
4536 for (bNode &node : node_tree->nodes) {
4537 if (node.type_legacy == CMP_NODE_MASK_ELLIPSE) {
4539 }
4540 }
4541 }
4542 }
4544 }
4545
4546 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 58)) {
4547 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4548 if (node_tree->type == NTREE_COMPOSIT) {
4549 for (bNode &node : node_tree->nodes) {
4550 if (node.type_legacy == CMP_NODE_SUNBEAMS_DEPRECATED) {
4552 }
4553 }
4554 }
4555 }
4557 }
4558
4559 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 59)) {
4560 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4561 if (node_tree->type == NTREE_COMPOSIT) {
4562 for (bNode &node : node_tree->nodes) {
4563 if (node.type_legacy == CMP_NODE_DBLUR) {
4565 }
4566 }
4567 }
4568 }
4570 }
4571
4572 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 60)) {
4573 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4574 if (node_tree->type == NTREE_COMPOSIT) {
4575 for (bNode &node : node_tree->nodes) {
4576 if (node.type_legacy == CMP_NODE_BILATERALBLUR) {
4578 }
4579 }
4580 }
4581 }
4583 }
4584
4585 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 64)) {
4586 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4587 if (node_tree->type == NTREE_COMPOSIT) {
4588 for (bNode &node : node_tree->nodes) {
4589 if (node.type_legacy == CMP_NODE_ALPHAOVER) {
4591 }
4592 }
4593 }
4594 }
4596 }
4597
4598 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 69)) {
4599 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4600 if (node_tree->type == NTREE_COMPOSIT) {
4601 for (bNode &node : node_tree->nodes) {
4602 if (node.type_legacy == CMP_NODE_BOKEHBLUR) {
4604 }
4605 }
4606 }
4607 }
4609 }
4610
4611 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 75)) {
4612 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4613 if (node_tree->type == NTREE_COMPOSIT) {
4614 for (bNode &node : node_tree->nodes) {
4615 if (node.type_legacy == CMP_NODE_CROP) {
4617 }
4618 }
4619 }
4620 }
4622 }
4623
4624 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 76)) {
4625 ToolSettings toolsettings_default = {};
4626 for (Scene &scene : bmain->scenes) {
4627 scene.toolsettings->snap_playhead_mode = toolsettings_default.snap_playhead_mode;
4628 scene.toolsettings->snap_step_frames = toolsettings_default.snap_step_frames;
4629 scene.toolsettings->snap_step_seconds = toolsettings_default.snap_step_seconds;
4630 scene.toolsettings->playhead_snap_distance = toolsettings_default.playhead_snap_distance;
4631 }
4632 }
4633
4634 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 77)) {
4635 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4636 if (node_tree->type == NTREE_COMPOSIT) {
4637 for (bNode &node : node_tree->nodes) {
4638 if (node.type_legacy == CMP_NODE_COLORBALANCE) {
4640 }
4641 }
4642 }
4643 }
4645 }
4646
4647 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 80)) {
4648 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
4649 if (node_tree->type == NTREE_COMPOSIT) {
4650 for (bNode &node : node_tree->nodes) {
4651 if (node.type_legacy == CMP_NODE_BLUR) {
4653 }
4654 }
4655 }
4656 }
4658 }
4659
4666}
4667
4669{
4670 Set<bNode *> curve_to_mesh_nodes;
4671 for (bNode &node : tree->nodes) {
4672 if (STREQ(node.idname, "GeometryNodeCurveToMesh")) {
4673 curve_to_mesh_nodes.add(&node);
4674 }
4675 }
4676
4677 for (bNode *curve_to_mesh : curve_to_mesh_nodes) {
4679 bke::node_find_socket(*curve_to_mesh, SOCK_IN, "Profile Curve"_ustr)))
4680 {
4681 /* No additional versioning is needed when the profile curve input is unused. */
4682 continue;
4683 }
4684
4685 if (bke::node_find_socket(*curve_to_mesh, SOCK_IN, "Scale"_ustr)) {
4686 /* Make versioning idempotent. */
4687 continue;
4688 }
4690 tree, curve_to_mesh, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Scale", "Scale");
4691 /* Use a default scale value of 1. */
4692 scale_socket->default_value_typed<bNodeSocketValueFloat>()->value = 1.0f;
4693
4694 bNode &named_attribute = version_node_add_empty(*tree, "GeometryNodeInputNamedAttribute");
4695 NodeGeometryInputNamedAttribute *named_attribute_storage =
4696 MEM_new<NodeGeometryInputNamedAttribute>(__func__);
4697 named_attribute_storage->data_type = CD_PROP_FLOAT;
4698 named_attribute.storage = named_attribute_storage;
4699 named_attribute.parent = curve_to_mesh->parent;
4700 named_attribute.location[0] = curve_to_mesh->location[0] - 25;
4701 named_attribute.location[1] = curve_to_mesh->location[1];
4702 named_attribute.flag &= ~NODE_SELECT;
4703
4705 tree, &named_attribute, SOCK_IN, SOCK_STRING, PROP_NONE, "Name", "Name");
4706 STRNCPY(name_input->default_value_typed<bNodeSocketValueString>()->value, "radius");
4707
4709 tree, &named_attribute, SOCK_OUT, SOCK_BOOLEAN, PROP_NONE, "Exists", "Exists");
4711 tree, &named_attribute, SOCK_OUT, SOCK_FLOAT, PROP_NONE, "Attribute", "Attribute");
4712
4713 bNode &switch_node = version_node_add_empty(*tree, "GeometryNodeSwitch");
4714 NodeSwitch *switch_storage = MEM_new<NodeSwitch>(__func__);
4715 switch_storage->input_type = SOCK_FLOAT;
4716 switch_node.storage = switch_storage;
4717 switch_node.parent = curve_to_mesh->parent;
4718 switch_node.location[0] = curve_to_mesh->location[0] - 25;
4719 switch_node.location[1] = curve_to_mesh->location[1];
4720 switch_node.flag &= ~NODE_SELECT;
4721
4723 tree, &switch_node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Switch", "Switch");
4725 tree, &switch_node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "False", "False");
4726 false_input->default_value_typed<bNodeSocketValueFloat>()->value = 1.0f;
4727
4729 tree, &switch_node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "True", "True");
4730
4732 named_attribute,
4733 *bke::node_find_socket(named_attribute, SOCK_OUT, "Exists"_ustr),
4734 switch_node,
4735 *bke::node_find_socket(switch_node, SOCK_IN, "Switch"_ustr));
4737 named_attribute,
4738 *bke::node_find_socket(named_attribute, SOCK_OUT, "Attribute"_ustr),
4739 switch_node,
4740 *bke::node_find_socket(switch_node, SOCK_IN, "True"_ustr));
4741
4743 tree, &switch_node, SOCK_OUT, SOCK_FLOAT, PROP_NONE, "Output", "Output");
4744
4746 switch_node,
4747 *bke::node_find_socket(switch_node, SOCK_OUT, "Output"_ustr),
4748 *curve_to_mesh,
4749 *bke::node_find_socket(*curve_to_mesh, SOCK_IN, "Scale"_ustr));
4750 }
4751
4753}
4754
4755static bool strip_effect_overdrop_to_alphaover(Strip *strip, void * /*user_data*/)
4756{
4757 if (strip->type == STRIP_TYPE_OVERDROP_REMOVED) {
4758 strip->type = STRIP_TYPE_ALPHAOVER;
4759 }
4760 if (strip->blend_mode == STRIP_BLEND_OVERDROP_REMOVED) {
4761 strip->blend_mode = STRIP_BLEND_ALPHAOVER;
4762 }
4763 return true;
4764}
4765
4767{
4768 for (Scene &scene : bmain->scenes) {
4769 if (scene.ed != nullptr) {
4771 }
4772 }
4773}
4774
4776{
4777 for (bScreen &screen : bmain->screens) {
4778 for (ScrArea &area : screen.areabase) {
4779 for (SpaceLink &sl : area.spacedata) {
4780 if (sl.spacetype != SPACE_FILE) {
4781 continue;
4782 }
4783 SpaceFile *sfile = reinterpret_cast<SpaceFile *>(&sl);
4784 if (sfile->params) {
4785 if (sfile->params->list_thumbnail_size == 0) {
4786 sfile->params->list_thumbnail_size = 16;
4787 }
4788 if (sfile->params->list_column_size == 0) {
4789 sfile->params->list_column_size = 500;
4790 }
4791 }
4792 if (sfile->asset_params) {
4793 if (sfile->asset_params->base_params.list_thumbnail_size == 0) {
4795 }
4796 if (sfile->asset_params->base_params.list_column_size == 0) {
4798 }
4800 }
4801 }
4802 }
4803 }
4804}
4805
4807{
4808 for (bScreen &screen : bmain->screens) {
4809 for (ScrArea &area : screen.areabase) {
4810 for (SpaceLink &sl : area.spacedata) {
4811 if (sl.spacetype == SPACE_IMAGE) {
4812 SpaceImage *sima = reinterpret_cast<SpaceImage *>(&sl);
4813 if (sima->flag & SI_NO_DRAW_TEXPAINT) {
4814 sima->flag |= SI_NO_DRAW_UV_GUIDE;
4815 }
4816 }
4817 }
4818 }
4819 }
4820}
4821
4823{
4824 for (bScreen &screen : bmain->screens) {
4825 for (ScrArea &area : screen.areabase) {
4826 for (SpaceLink &sl : area.spacedata) {
4827 if (sl.spacetype == SPACE_IMAGE) {
4828 SpaceImage *sima = reinterpret_cast<SpaceImage *>(&sl);
4829 /* Remove ID Code from screen name */
4830 const char *workspace_name = screen.id.name + 2;
4831 /* Don't set uv_face_opacity for Texture Paint or Shading since these are workspaces
4832 * where it's important to have unobstructed view of the Image Editor to see Image
4833 * Textures. UV Editing is the only other default workspace with an Image Editor. */
4834 if (STREQ(workspace_name, "UV Editing")) {
4835 sima->uv_face_opacity = 1.0f;
4836 }
4837 }
4838 }
4839 }
4840 }
4841}
4842
4844{
4845 for (Brush &brush : bmain->brushes) {
4846 if (ELEM(brush.sculpt_brush_type,
4847 SCULPT_BRUSH_TYPE_FLATTEN,
4848 SCULPT_BRUSH_TYPE_FILL,
4849 SCULPT_BRUSH_TYPE_SCRAPE))
4850 {
4851 if (brush.sculpt_brush_type == SCULPT_BRUSH_TYPE_FLATTEN) {
4852 brush.plane_height = 1.0f;
4853 brush.plane_depth = 1.0f;
4854 brush.area_radius_factor = 1.0f;
4855 brush.plane_inversion_mode = BRUSH_PLANE_INVERT_DISPLACEMENT;
4856 }
4857
4858 if (brush.sculpt_brush_type == SCULPT_BRUSH_TYPE_FILL) {
4859 brush.plane_height = 0.0f;
4860 brush.plane_depth = 1.0f;
4861 brush.plane_inversion_mode = brush.flag & BRUSH_INVERT_TO_SCRAPE_FILL ?
4864 }
4865
4866 if (brush.sculpt_brush_type == SCULPT_BRUSH_TYPE_SCRAPE) {
4867 brush.plane_height = 1.0f;
4868 brush.plane_depth = 0.0f;
4869 brush.plane_inversion_mode = brush.flag & BRUSH_INVERT_TO_SCRAPE_FILL ?
4872
4873 /* Note, this fix was committed after some users had already run the versioning after
4874 * 4.5 was released. Since 4.5 is an LTS and will be used for the foreseeable future to
4875 * transition between 4.x and 5.x the fix has been added here, even though that does
4876 * not fix the issue for some users with custom brush assets who have started using 4.5
4877 * already.
4878 *
4879 * Since the `sculpt_brush_type` field changed from 'SCULPT_BRUSH_TYPE_SCRAPE' to
4880 * 'SCULPT_BRUSH_TYPE_PLANE', we do not have a value that can be used to definitively apply
4881 * a corrective versioning step along with a subversion bump without potentially affecting
4882 * some false positives.
4883 *
4884 * See #142151 for more details. */
4885 brush.plane_offset *= -1.0f;
4886 }
4887
4888 if (brush.flag & BRUSH_PLANE_TRIM) {
4889 brush.plane_height *= brush.plane_trim;
4890 brush.plane_depth *= brush.plane_trim;
4891 }
4892
4893 brush.stabilize_normal = (brush.flag & BRUSH_ORIGINAL_NORMAL) ? 1.0f : 0.0f;
4894 brush.stabilize_plane = (brush.flag & BRUSH_ORIGINAL_PLANE) ? 1.0f : 0.0f;
4897
4898 brush.sculpt_brush_type = SCULPT_BRUSH_TYPE_PLANE;
4899 }
4900 }
4901}
4902
4904{
4906 auto &socket = reinterpret_cast<bNodeTreeInterfaceSocket &>(item);
4908 socket.structure_type = NodeSocketInterfaceStructureType::Single;
4909 }
4910 else {
4911 socket.structure_type = NodeSocketInterfaceStructureType::Auto;
4912 }
4913 }
4914 else {
4915 auto &panel = reinterpret_cast<bNodeTreeInterfacePanel &>(item);
4916 for (bNodeTreeInterfaceItem *item : Span(panel.items_array, panel.items_num)) {
4918 }
4919 }
4920}
4921
4923{
4924 for (bArmature &arm : bmain->armatures) {
4925 animrig::ANIM_armature_foreach_bone(
4926 &arm.bonebase, [](Bone *bone) { bone->drawtype = ARM_DRAW_TYPE_ARMATURE_DEFINED; });
4927 BLI_assert_msg(!arm.edbo, "Armatures should not be saved in edit mode");
4928 }
4929}
4930
4931void blo_do_versions_405(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
4932{
4933
4934 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 2)) {
4936 }
4937
4938 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 4)) {
4939 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
4940 if (ntree->type == NTREE_GEOMETRY) {
4942 }
4943 }
4945 }
4946
4947 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 5)) {
4948 for (Scene &scene : bmain->scenes) {
4949 ToolSettings *tool_settings = scene.toolsettings;
4950 tool_settings->snap_flag_seq |= SCE_SNAP;
4951
4952 SequencerToolSettings *sequencer_tool_settings = seq::tool_settings_ensure(&scene);
4953 sequencer_tool_settings->snap_mode |= SEQ_SNAP_TO_FRAME_RANGE;
4954 }
4955 }
4956
4957 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 6)) {
4959 }
4960
4961 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 7)) {
4962 for (bNodeTree &ntree : bmain->nodetrees) {
4963 if (ntree.type == NTREE_GEOMETRY) {
4964 for (bNode &node : ntree.nodes) {
4965 if (STREQ(node.idname, "GeometryNodeStoreNamedGrid")) {
4966 switch (node.custom1) {
4967 case CD_PROP_FLOAT:
4968 node.custom1 = VOLUME_GRID_FLOAT;
4969 break;
4970 case CD_PROP_FLOAT2:
4971 case CD_PROP_FLOAT3:
4973 break;
4974 default:
4975 node.custom1 = VOLUME_GRID_FLOAT;
4976 break;
4977 }
4978 }
4979 }
4980 }
4981 }
4982 }
4983
4984 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 9)) {
4985 for (bScreen &screen : bmain->screens) {
4986 for (ScrArea &area : screen.areabase) {
4987 for (SpaceLink &sl : area.spacedata) {
4988 if (sl.spacetype != SPACE_FILE) {
4989 continue;
4990 }
4991 SpaceFile *sfile = reinterpret_cast<SpaceFile *>(&sl);
4992 if (sfile->asset_params) {
4994 }
4995 }
4996 }
4997 }
4998 }
4999
5000 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 15)) {
5001 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
5002 if (ntree->type != NTREE_COMPOSIT) {
5003 continue;
5004 }
5005 for (bNode &node : ntree->nodes) {
5006 if (node.type_legacy != CMP_NODE_SCALE) {
5007 continue;
5008 }
5009 if (node.storage != nullptr) {
5010 continue;
5011 }
5012 NodeScaleData *data = MEM_new<NodeScaleData>(__func__);
5013 data->interpolation = CMP_NODE_INTERPOLATION_BILINEAR;
5014 node.storage = data;
5015 }
5016 }
5018 }
5019
5020 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 16)) {
5021 for (Scene &scene : bmain->scenes) {
5025 }
5026 }
5027
5028 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 17)) {
5031 }
5032
5033 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 18)) {
5034 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
5035 if (ntree->type == NTREE_COMPOSIT) {
5036 for (bNode &node : ntree->nodes) {
5037 if (node.type_legacy == CMP_NODE_CORNERPIN) {
5039 }
5040 }
5041 }
5042 }
5044 }
5045
5046 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 19)) {
5047 for (bScreen &screen : bmain->screens) {
5048 for (ScrArea &area : screen.areabase) {
5049 for (SpaceLink &sl : area.spacedata) {
5050 if (sl.spacetype == SPACE_PROPERTIES) {
5051 SpaceProperties *sbuts = reinterpret_cast<SpaceProperties *>(&sl);
5052 /* Translates to 0xFFFFFFFF, so other tabs can be added without versioning. */
5053 sbuts->visible_tabs = uint(-1);
5054 }
5055 }
5056 }
5057 }
5058 }
5059
5060 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 20)) {
5061 /* Older files uses non-UTF8 aware string copy, ensure names are valid UTF8.
5062 * The slot names are not unique so no further changes are needed. */
5063 for (Image &image : bmain->images) {
5064 for (RenderSlot &slot : image.renderslots) {
5065 if (slot.name[0]) {
5067 }
5068 }
5069 }
5070 for (Scene &scene : bmain->scenes) {
5071 scene.r.ppm_factor = 72.0f;
5072 scene.r.ppm_base = 0.0254f;
5073 }
5074 }
5075
5076 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 21)) {
5077 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5078 if (node_tree->type == NTREE_COMPOSIT) {
5079 for (bNode &node : node_tree->nodes) {
5080 if (node.type_legacy == CMP_NODE_GLARE) {
5082 }
5083 }
5084 }
5085 }
5087 }
5088
5089 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 22)) {
5090 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5091 if (node_tree->type == NTREE_COMPOSIT) {
5092 for (bNode &node : node_tree->nodes) {
5093 if (node.type_legacy == CMP_NODE_BOKEHIMAGE) {
5095 }
5096 }
5097 }
5098 }
5100 }
5101
5102 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 23)) {
5103 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5104 if (node_tree->type == NTREE_COMPOSIT) {
5105 for (bNode &node : node_tree->nodes) {
5106 if (node.type_legacy == CMP_NODE_TIME) {
5108 }
5109 }
5110 }
5111 }
5113 }
5114
5115 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 24)) {
5116 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5117 if (node_tree->type == NTREE_COMPOSIT) {
5118 for (bNode &node : node_tree->nodes) {
5119 if (node.type_legacy == CMP_NODE_MASK) {
5121 }
5122 }
5123 }
5124 }
5126 }
5127
5128 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 25)) {
5129 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5130 if (node_tree->type == NTREE_COMPOSIT) {
5131 for (bNode &node : node_tree->nodes) {
5132 if (node.type_legacy == CMP_NODE_SWITCH) {
5134 }
5135 }
5136 }
5137 }
5139 }
5140
5141 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 26)) {
5142 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5143 if (node_tree->type == NTREE_COMPOSIT) {
5144 for (bNode &node : node_tree->nodes) {
5145 if (node.type_legacy == CMP_NODE_SPLIT) {
5147 }
5148 }
5149 }
5150 }
5152 }
5153
5154 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 27)) {
5155 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5156 if (node_tree->type == NTREE_COMPOSIT) {
5157 for (bNode &node : node_tree->nodes) {
5158 if (node.type_legacy == CMP_NODE_INVERT) {
5160 }
5161 }
5162 }
5163 }
5165 }
5166
5167 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 28)) {
5168 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5169 if (node_tree->type == NTREE_COMPOSIT) {
5170 for (bNode &node : node_tree->nodes) {
5171 if (node.type_legacy == CMP_NODE_ZCOMBINE) {
5173 }
5174 }
5175 }
5176 }
5178 }
5179
5180 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 29)) {
5181 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5182 if (node_tree->type == NTREE_COMPOSIT) {
5183 for (bNode &node : node_tree->nodes) {
5184 if (node.type_legacy == CMP_NODE_TONEMAP) {
5186 }
5187 }
5188 }
5189 }
5191 }
5192
5193 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 30)) {
5194 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5195 if (node_tree->type == NTREE_COMPOSIT) {
5196 for (bNode &node : node_tree->nodes) {
5197 if (node.type_legacy == CMP_NODE_DILATEERODE) {
5199 }
5200 }
5201 }
5202 }
5204 }
5205
5206 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 31)) {
5207 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5208 if (node_tree->type == NTREE_COMPOSIT) {
5209 for (bNode &node : node_tree->nodes) {
5210 if (node.type_legacy == CMP_NODE_INPAINT) {
5212 }
5213 }
5214 }
5215 }
5217 }
5218
5219 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 32)) {
5220 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5221 if (node_tree->type == NTREE_COMPOSIT) {
5222 for (bNode &node : node_tree->nodes) {
5223 if (node.type_legacy == CMP_NODE_PIXELATE) {
5225 }
5226 }
5227 }
5228 }
5230 }
5231
5232 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 33)) {
5233 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5234 if (node_tree->type == NTREE_COMPOSIT) {
5235 for (bNode &node : node_tree->nodes) {
5236 if (node.type_legacy == CMP_NODE_KUWAHARA) {
5238 }
5239 }
5240 }
5241 }
5243 }
5244
5245 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 34)) {
5246 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5247 if (node_tree->type == NTREE_COMPOSIT) {
5248 for (bNode &node : node_tree->nodes) {
5249 if (node.type_legacy == CMP_NODE_DESPECKLE) {
5251 }
5252 }
5253 }
5254 }
5256 }
5257
5258 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 35)) {
5259 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5260 if (node_tree->type == NTREE_COMPOSIT) {
5261 for (bNode &node : node_tree->nodes) {
5262 if (node.type_legacy == CMP_NODE_DENOISE) {
5264 }
5265 }
5266 }
5267 }
5269 }
5270
5271 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 36)) {
5272 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5273 if (node_tree->type == NTREE_COMPOSIT) {
5274 for (bNode &node : node_tree->nodes) {
5275 if (node.type_legacy == CMP_NODE_ANTIALIASING) {
5277 }
5278 }
5279 }
5280 }
5282 }
5283
5284 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 37)) {
5285 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5286 if (node_tree->type == NTREE_COMPOSIT) {
5287 for (bNode &node : node_tree->nodes) {
5288 if (node.type_legacy == CMP_NODE_VECBLUR) {
5290 }
5291 }
5292 }
5293 }
5295 }
5296
5297 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 38)) {
5298 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5299 if (node_tree->type == NTREE_COMPOSIT) {
5300 for (bNode &node : node_tree->nodes) {
5301 if (node.type_legacy == CMP_NODE_CHANNEL_MATTE) {
5303 }
5304 }
5305 }
5306 }
5308 }
5309
5310 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 39)) {
5311 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5312 if (node_tree->type == NTREE_COMPOSIT) {
5313 for (bNode &node : node_tree->nodes) {
5314 if (node.type_legacy == CMP_NODE_CHROMA_MATTE) {
5316 }
5317 }
5318 }
5319 }
5321 }
5322
5323 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 40)) {
5324 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5325 if (node_tree->type == NTREE_COMPOSIT) {
5326 for (bNode &node : node_tree->nodes) {
5327 if (node.type_legacy == CMP_NODE_COLOR_MATTE) {
5329 }
5330 }
5331 }
5332 }
5334 }
5335
5336 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 41)) {
5337 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5338 if (node_tree->type == NTREE_COMPOSIT) {
5339 for (bNode &node : node_tree->nodes) {
5340 if (node.type_legacy == CMP_NODE_DIFF_MATTE) {
5342 }
5343 }
5344 }
5345 }
5347 }
5348
5349 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 42)) {
5350 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5351 if (node_tree->type == NTREE_COMPOSIT) {
5352 for (bNode &node : node_tree->nodes) {
5353 if (node.type_legacy == CMP_NODE_DIST_MATTE) {
5355 }
5356 }
5357 }
5358 }
5360 }
5361
5362 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 43)) {
5363 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5364 if (node_tree->type == NTREE_COMPOSIT) {
5365 for (bNode &node : node_tree->nodes) {
5366 if (node.type_legacy == CMP_NODE_LUMA_MATTE) {
5368 }
5369 }
5370 }
5371 }
5373 }
5374
5375 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 44)) {
5376 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5377 if (node_tree->type == NTREE_COMPOSIT) {
5378 for (bNode &node : node_tree->nodes) {
5379 if (node.type_legacy == CMP_NODE_COLOR_SPILL) {
5381 }
5382 }
5383 }
5384 }
5386 }
5387
5388 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 45)) {
5389 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5390 if (node_tree->type == NTREE_COMPOSIT) {
5391 for (bNode &node : node_tree->nodes) {
5392 if (node.type_legacy == CMP_NODE_KEYINGSCREEN) {
5394 }
5395 }
5396 }
5397 }
5399 }
5400
5401 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 46)) {
5402 for (bScreen &screen : bmain->screens) {
5403 for (ScrArea &area : screen.areabase) {
5404 for (SpaceLink &sl : area.spacedata) {
5405 if (sl.spacetype == SPACE_SEQ) {
5406 ListBaseT<ARegion> *regionbase = (&sl == area.spacedata.first_) ? &area.regionbase :
5407 &sl.regionbase;
5408 for (ARegion &region : *regionbase) {
5409 if (region.regiontype == RGN_TYPE_WINDOW) {
5410 region.v2d.keepzoom |= V2D_KEEPZOOM;
5411 region.v2d.keepofs |= V2D_KEEPOFS_X | V2D_KEEPOFS_Y;
5412 }
5413 }
5414 }
5415 }
5416 }
5417 }
5418 }
5419
5420 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 47)) {
5421 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5422 if (node_tree->type == NTREE_COMPOSIT) {
5423 for (bNode &node : node_tree->nodes) {
5424 if (node.type_legacy == CMP_NODE_KEYING) {
5426 }
5427 }
5428 }
5429 }
5431 }
5432
5433 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 48)) {
5434 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5435 if (node_tree->type == NTREE_COMPOSIT) {
5436 for (bNode &node : node_tree->nodes) {
5437 if (node.type_legacy == CMP_NODE_ID_MASK) {
5439 }
5440 }
5441 }
5442 }
5444 }
5445
5446 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 49)) {
5447 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5448 if (node_tree->type == NTREE_COMPOSIT) {
5449 for (bNode &node : node_tree->nodes) {
5450 if (node.type_legacy == CMP_NODE_STABILIZE2D) {
5452 }
5453 }
5454 }
5455 }
5457 }
5458
5459 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 50)) {
5460 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5461 if (node_tree->type == NTREE_COMPOSIT) {
5462 for (bNode &node : node_tree->nodes) {
5463 if (node.type_legacy == CMP_NODE_PLANETRACKDEFORM) {
5465 }
5466 }
5467 }
5468 }
5470 }
5471
5472 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 51)) {
5473 const Object dob;
5474 for (Object &object : bmain->objects) {
5475 object.shadow_terminator_normal_offset = dob.shadow_terminator_normal_offset;
5476 object.shadow_terminator_geometry_offset = dob.shadow_terminator_geometry_offset;
5477 object.shadow_terminator_shading_offset = dob.shadow_terminator_shading_offset;
5478 /* Copy Cycles' property into Blender Object. */
5480 if (cob) {
5481 object.shadow_terminator_geometry_offset = version_cycles_property_float(
5482 cob, "shadow_terminator_geometry_offset", dob.shadow_terminator_geometry_offset);
5483 object.shadow_terminator_shading_offset = version_cycles_property_float(
5484 cob, "shadow_terminator_offset", dob.shadow_terminator_shading_offset);
5485 }
5486 }
5487 }
5488
5489 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 52)) {
5490 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5491 if (node_tree->type == NTREE_COMPOSIT) {
5492 for (bNode &node : node_tree->nodes) {
5493 if (node.type_legacy == CMP_NODE_COLORCORRECTION) {
5495 }
5496 }
5497 }
5498 }
5500 }
5501
5502 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 53)) {
5503 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5504 if (node_tree->type == NTREE_COMPOSIT) {
5505 for (bNode &node : node_tree->nodes) {
5506 if (node.type_legacy == CMP_NODE_LENSDIST) {
5508 }
5509 }
5510 }
5511 }
5513 }
5514
5515 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 54)) {
5516 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5517 if (node_tree->type == NTREE_COMPOSIT) {
5518 for (bNode &node : node_tree->nodes) {
5519 if (node.type_legacy == CMP_NODE_MASK_BOX) {
5521 }
5522 }
5523 }
5524 }
5526 }
5527
5528 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 55)) {
5529 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5530 if (node_tree->type == NTREE_COMPOSIT) {
5531 for (bNode &node : node_tree->nodes) {
5532 if (node.type_legacy == CMP_NODE_MASK_ELLIPSE) {
5534 }
5535 }
5536 }
5537 }
5539 }
5540
5541 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 56)) {
5543 }
5544
5545 /* Enforce that bone envelope radii match for parent and connected children. */
5546 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 57)) {
5547 for (bArmature &arm : bmain->armatures) {
5548 animrig::ANIM_armature_foreach_bone(&arm.bonebase, [](Bone *bone) {
5549 if (bone->parent && (bone->flag & BONE_CONNECTED)) {
5550 bone->rad_head = bone->parent->rad_tail;
5551 }
5552 });
5553 if (arm.edbo) {
5554 for (EditBone &ebone : *arm.edbo) {
5555 if (ebone.parent && (ebone.flag & BONE_CONNECTED)) {
5556 ebone.rad_head = ebone.parent->rad_tail;
5557 }
5558 }
5559 }
5560 }
5561 }
5562
5563 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 58)) {
5564 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5565 if (node_tree->type == NTREE_COMPOSIT) {
5566 for (bNode &node : node_tree->nodes) {
5567 if (node.type_legacy == CMP_NODE_SUNBEAMS_DEPRECATED) {
5568 do_version_sun_beams_node_options_to_inputs(node_tree, &node);
5569 }
5570 }
5571 }
5572 }
5574 }
5575
5576 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 59)) {
5577 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5578 if (node_tree->type == NTREE_COMPOSIT) {
5579 for (bNode &node : node_tree->nodes) {
5580 if (node.type_legacy == CMP_NODE_DBLUR) {
5582 }
5583 }
5584 }
5585 }
5587 }
5588
5589 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 60)) {
5590 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5591 if (node_tree->type == NTREE_COMPOSIT) {
5592 for (bNode &node : node_tree->nodes) {
5593 if (node.type_legacy == CMP_NODE_BILATERALBLUR) {
5595 }
5596 }
5597 }
5598 }
5600 }
5601
5602 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 61)) {
5603 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5604 if (node_tree->type == NTREE_COMPOSIT) {
5606 }
5607 }
5609 }
5610
5611 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 62)) {
5612 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5613 if (node_tree->type == NTREE_COMPOSIT) {
5615 }
5616 }
5618 }
5619
5620 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 63)) {
5621 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5622 if (node_tree->type == NTREE_COMPOSIT) {
5624 }
5625 }
5627 }
5628
5629 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 64)) {
5630 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5631 if (node_tree->type == NTREE_COMPOSIT) {
5632 for (bNode &node : node_tree->nodes) {
5633 if (node.type_legacy == CMP_NODE_ALPHAOVER) {
5635 }
5636 }
5637 }
5638 }
5640 }
5641
5642 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 65)) {
5643 for (bScreen &screen : bmain->screens) {
5644 for (ScrArea &area : screen.areabase) {
5645 for (SpaceLink &sl : area.spacedata) {
5646 if (sl.spacetype == SPACE_SEQ) {
5647 ListBaseT<ARegion> *regionbase = (&sl == area.spacedata.first_) ? &area.regionbase :
5648 &sl.regionbase;
5649 for (ARegion &region : *regionbase) {
5650 if (region.regiontype == RGN_TYPE_WINDOW) {
5651 region.v2d.flag |= V2D_ZOOM_IGNORE_KEEPOFS;
5652 }
5653 }
5654 }
5655 }
5656 }
5657 }
5658 }
5659
5660 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 66)) {
5661 /* Clear unused draw flag (used to be SEQ_DRAW_BACKDROP). */
5662 for (bScreen &screen : bmain->screens) {
5663 for (ScrArea &area : screen.areabase) {
5664 for (SpaceLink &sl : area.spacedata) {
5665 if (sl.spacetype == SPACE_SEQ) {
5666 SpaceSeq *space_sequencer = reinterpret_cast<SpaceSeq *>(&sl);
5667 space_sequencer->draw_flag &= ~SEQ_DRAW_UNUSED_0;
5668 }
5669 }
5670 }
5671 }
5672 }
5673
5674 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 67)) {
5675 /* Version render output paths (both primary on scene as well as those in
5676 * the File Output compositor node) to escape curly braces. */
5677 {
5678 for (Scene &scene : bmain->scenes) {
5680 if (scene.nodetree) {
5682 }
5683 }
5684
5685 for (bNodeTree &nodetree : bmain->nodetrees) {
5687 }
5688 }
5689 }
5690
5691 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 68)) {
5692 /* Fix brush->tip_scale_x which should never be zero. */
5693 for (Brush &brush : bmain->brushes) {
5694 if (brush.tip_scale_x == 0.0f) {
5695 brush.tip_scale_x = 1.0f;
5696 }
5697 }
5698 }
5699
5700 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 69)) {
5701 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5702 if (node_tree->type == NTREE_COMPOSIT) {
5703 for (bNode &node : node_tree->nodes) {
5704 if (node.type_legacy == CMP_NODE_BOKEHBLUR) {
5706 }
5707 }
5708 }
5709 }
5711 }
5712
5713 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 70)) {
5714 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5715 if (node_tree->type == NTREE_COMPOSIT) {
5717 }
5718 }
5720 }
5721
5722 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 71)) {
5723 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5724 if (node_tree->type == NTREE_COMPOSIT) {
5726 }
5727 }
5729 }
5730
5731 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 72)) {
5733 }
5734
5735 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 73)) {
5736 /* Make #Curve::type the source of truth for the curve type.
5737 * Previously #Curve::vfont was checked which is error prone
5738 * since the member can become null at run-time, see: #139133. */
5739 for (Curve &cu : bmain->curves) {
5740 if (ELEM(cu.ob_type, OB_CURVES_LEGACY, OB_FONT, OB_SURF)) {
5741 continue;
5742 }
5743 ObjectType ob_type = OB_CURVES_LEGACY;
5744 if (cu.vfont) {
5745 ob_type = OB_FONT;
5746 }
5747 else {
5748 for (const Nurb &nu : cu.nurb) {
5749 if (nu.pntsv > 1) {
5750 ob_type = OB_SURF;
5751 break;
5752 }
5753 }
5754 }
5755 cu.ob_type = ob_type;
5756 }
5757 }
5758
5759 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 74)) {
5760 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5761 if (node_tree->type == NTREE_COMPOSIT) {
5763 }
5764 }
5766 }
5767
5768 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 75)) {
5769 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5770 if (node_tree->type == NTREE_COMPOSIT) {
5771 for (bNode &node : node_tree->nodes) {
5772 if (node.type_legacy == CMP_NODE_CROP) {
5774 }
5775 }
5776 }
5777 }
5779 }
5780
5781 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 76)) {
5782 for (Light &light : bmain->lights) {
5783 if (light.temperature == 0.0f) {
5784 light.temperature = 6500.0f;
5785 }
5786 }
5787 }
5788
5789 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 77)) {
5790 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5791 if (node_tree->type == NTREE_COMPOSIT) {
5792 for (bNode &node : node_tree->nodes) {
5793 if (node.type_legacy == CMP_NODE_COLORBALANCE) {
5795 }
5796 }
5797 }
5798 }
5800 }
5801
5802 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 78)) {
5803 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5804 if (node_tree->type == NTREE_COMPOSIT) {
5806 }
5807 }
5809 }
5810
5811 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 79)) {
5812 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5813 if (ELEM(GS(id->name), ID_MA, ID_LA, ID_WO, ID_TE, ID_SCE, ID_LS)) {
5814 /* These node trees should not have interface sockets. However, in some files they were
5815 * added through the Python API. Remove these interface sockets here before they cause
5816 * problems further down the line. */
5818 }
5820 }
5822 }
5823
5824 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 80)) {
5825 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5826 if (node_tree->type == NTREE_COMPOSIT) {
5827 for (bNode &node : node_tree->nodes) {
5828 if (node.type_legacy == CMP_NODE_BLUR) {
5830 }
5831 }
5832 }
5833 }
5835 }
5836
5837 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 81)) {
5838 for (bNodeTree &ntree : bmain->nodetrees) {
5839 if (ntree.type == NTREE_GEOMETRY) {
5840 node_interface_single_value_to_structure_type(ntree.tree_interface.root_panel.item);
5841 }
5842 }
5843 }
5844
5845 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 83)) {
5846 for (Object &ob : bmain->objects) {
5847 if (ob.soft) {
5848 ob.soft->fuzzyness = std::max<int>(1, ob.soft->fuzzyness);
5849 }
5850 }
5851 }
5852
5853 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 84)) {
5854 for (Scene &scene : bmain->scenes) {
5856 }
5857
5858 for (Brush &brush : bmain->brushes) {
5859 if (brush.gpencil_settings) {
5861 }
5862 }
5863 }
5864
5865 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 85)) {
5866 FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
5867 if (node_tree->type == NTREE_COMPOSIT) {
5868 for (bNode &node : node_tree->nodes) {
5869 if (node.type_legacy == CMP_NODE_FLIP) {
5871 }
5872 }
5873 }
5874 }
5876 }
5877
5878 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 86)) {
5880 }
5881
5882 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 87)) {
5883 FOREACH_NODETREE_BEGIN (bmain, tree, id) {
5884 if (tree->type == NTREE_GEOMETRY) {
5886 }
5887 }
5889 }
5890
5897}
5898
5899} // namespace blender
Functions and classes to work with Actions.
Functionality to iterate an Action in various ways.
Iterators for armatures.
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
Low-level operations for grease pencil.
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
Definition BKE_main.hh:949
#define FOREACH_NODETREE_END
Definition BKE_node.hh:936
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition BKE_node.hh:926
#define CMP_NODE_PREMULKEY
#define CMP_NODE_DENOISE
#define CMP_NODE_MASK
#define CMP_NODE_SCALE
#define GEO_NODE_SUBDIVISION_SURFACE
#define CMP_NODE_VECBLUR
#define CMP_NODE_TIME
#define CMP_NODE_COLOR_SPILL
#define CMP_CHAN_RGB
#define CMP_NODE_DESPECKLE
#define CMP_NODE_VIEWER
#define CMP_NODE_LUMA_MATTE
#define CMP_NODE_CORNERPIN
#define CMP_NODE_KEYINGSCREEN
#define CMP_NODE_MASK_ELLIPSE
#define GEO_NODE_SUBDIVIDE_MESH
#define CMP_NODE_BILATERALBLUR
#define CMP_NODE_TRANSLATE
#define CMP_NODE_TONEMAP
#define CMP_NODE_INPAINT
#define CMP_NODE_COLORBALANCE
#define CMP_NODE_BOKEHIMAGE
#define CMP_NODE_KUWAHARA
#define CMP_NODE_DIFF_MATTE
#define CMP_NODE_ALPHAOVER
#define CMP_NODE_CROP
#define CMP_NODE_CHROMA_MATTE
#define CMP_NODE_GLARE
#define CMP_NODE_PLANETRACKDEFORM
#define CMP_NODE_DILATEERODE
#define CMP_NODE_SPLIT
#define SH_NODE_GAMMA
#define CMP_NODE_ID_MASK
#define CMP_NODE_BOKEHBLUR
#define CMP_NODE_LENSDIST
#define CMP_NODE_ZCOMBINE
#define CMP_NODE_SUNBEAMS_DEPRECATED
#define CMP_NODE_COLORCORRECTION
#define CMP_NODE_SETALPHA
#define CMP_NODE_STABILIZE2D
#define CMP_NODE_PIXELATE
#define SH_NODE_MIX
#define CMP_NODE_SWITCH
#define SH_NODE_CLAMP
#define CMP_NODE_COMPOSITE_DEPRECATED
#define CMP_NODE_MASK_BOX
#define CMP_NODE_DEFOCUS
#define CMP_NODE_KEYING
#define CMP_NODE_ANTIALIASING
#define CMP_NODE_INVERT
#define CMP_NODE_COLOR_MATTE
#define CMP_NODE_DIST_MATTE
#define CMP_NODE_DBLUR
#define CMP_NODE_BLUR
#define CMP_CHAN_A
#define CMP_NODE_BRIGHTCONTRAST
#define CMP_NODE_FLIP
#define CMP_NODE_CHANNEL_MATTE
#define FILE_MAX
#define STRNLEN(str)
#define BLI_assert_unreachable()
#define ELEM(...)
#define BLI_assert_msg(a, msg)
#define STREQ(a, b)
Definition scene.h:133
constexpr Span()=default
bool add(const Key &key, const Value &value)
Definition BLI_map.hh:295
const Value & lookup(const Key &key) const
Definition BLI_map.hh:545
Value lookup_default(const Key &key, const Value &default_value) const
Definition BLI_map.hh:570
void add_new(const Key &key, const Value &value)
Definition BLI_map.hh:265
bool contains(const Key &key) const
Definition BLI_map.hh:353
bool add(const Key &key)
Definition BLI_set.hh:248
constexpr bool is_empty() const
Definition BLI_span.hh:264
void append(const T &value)
Span< const Slot * > slots() const
bke::CurvesGeometry & strokes_for_write()
#define storage(slot, qualifiers)
void foreach_fcurve_in_action_slot(Action &action, slot_handle_t handle, FunctionRef< void(FCurve &fcurve)> callback)
T & get_item_as(bNodeTreeInterfaceItem &item)
T & get_socket_data_as(bNodeTreeInterfaceSocket &item)
void node_modify_socket_type_static(bNodeTree *ntree, bNode *node, bNodeSocket *sock, int type, int subtype)
Definition node.cc:3448
void node_remove_link(bNodeTree *ntree, bNodeLink &link)
Definition node.cc:4676
bNode * node_add_node(const bContext *C, bNodeTree &ntree, UString idname, std::optional< int > unique_identifier=std::nullopt)
Definition node.cc:4260
bNodeSocketType * node_socket_type_find(StringRef idname)
Definition node.cc:2966
bNode * node_add_static_node(const bContext *C, bNodeTree &ntree, int type)
Definition node.cc:4283
bNodeSocket * node_add_static_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, int type, int subtype, StringRefNull identifier, StringRefNull name)
Definition node.cc:3980
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, UString identifier)
Definition node.cc:3036
BLI_INLINE Texture * wrap(MTLTexture *texture)
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
Definition iterator.cc:60
SequencerToolSettings * tool_settings_ensure(Scene *scene)
Definition sequencer.cc:393
BMesh Iterators.
bool version_node_ensure_storage_or_invalidate(bNode &node)
static void do_version_split_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_X
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_PER_DIMENSION
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_Y
static void do_version_mask_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
bool version_node_socket_is_used(bNodeSocket *sock)
static void do_version_invert_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_replace_image_info_node_coordinates(bNodeTree *node_tree)
static void do_version_z_combine_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_alpha_over_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
char * STRNCPY(char(&dst)[N], const char *src)
static void do_version_bilateral_blur_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_inpaint_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_convert_gp_jitter_flags(Brush *brush)
static void do_version_color_spill_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
MINLINE void copy_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition BKE_text.h:55
static void do_version_bilateral_blur_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
@ V2D_ZOOM_IGNORE_KEEPOFS
static void do_version_bright_contrast_remove_premultiplied(bNodeTree *node_tree)
@ CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_FLOAT
@ CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_VECTOR
static void do_version_composite_viewer_remove_alpha(bNodeTree *node_tree)
int bool bool BLI_str_endswith(const char *__restrict str, const char *__restrict end) ATTR_NONNULL(1
@ CMP_NODE_ALPHA_CONVERT_PREMULTIPLY
@ CMP_NODE_ALPHA_CONVERT_UNPREMULTIPLY
static void do_version_color_spill_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
void BKE_fcurves_id_cb(struct ID *id, FunctionRef< void(ID *, FCurve *)> func)
static void do_version_despeckle_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void fix_curve_nurbs_knot_mode_custom(Main *bmain)
static void do_version_color_matte_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
float version_cycles_property_float(IDProperty *idprop, const char *name, float default_value)
static void version_escape_curly_braces(char string[], const int string_array_length)
@ BRUSH_COLOR_JITTER_USE_SAT_RAND_PRESS
@ BRUSH_COLOR_JITTER_USE_HUE_AT_STROKE
@ BRUSH_COLOR_JITTER_USE_VAL_AT_STROKE
@ BRUSH_COLOR_JITTER_USE_HUE_RAND_PRESS
@ BRUSH_COLOR_JITTER_USE_SAT_AT_STROKE
@ BRUSH_COLOR_JITTER_USE_VAL_RAND_PRESS
static void clamp_subdivision_node_level_input(bNodeTree &tree)
static void asset_browser_add_list_view(Main *bmain)
static void do_version_difference_matte_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_bokeh_blur_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_vector_sockets_dimensions(bNodeTree *node_tree)
static void do_version_id_mask_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_denoise_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_id_mask_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_kuwahara_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
void BKE_animdata_main_cb(struct Main *bmain, FunctionRef< void(ID *, AnimData *)> func)
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
static void do_version_z_combine_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_init_default_jitter_curves_in_unified_paint_settings(ToolSettings *ts)
static void do_version_lens_distortion_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_box_mask_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_mask_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_split_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
@ BRUSH_PLANE_INVERT_DISPLACEMENT
@ BRUSH_PLANE_SWAP_HEIGHT_AND_DEPTH
bNode & version_node_add_empty(bNodeTree &ntree, const char *idname)
static void do_version_crop_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
@ NURBS_KNOT_MODE_NORMAL
@ NURBS_KNOT_MODE_CUSTOM
@ SCULPT_BRUSH_TYPE_PLANE
@ STRIP_TYPE_OVERDROP_REMOVED
static void do_version_despeckle_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
void version_socket_update_is_used(bNodeTree *ntree)
static void do_version_difference_matte_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
size_t BLI_string_replace_range(char *string, size_t string_maxncpy, int src_beg, int src_end, const char *dst)
@ CMP_NODE_SETALPHA_MODE_REPLACE_ALPHA
static void do_version_luminance_matte_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
@ FMODIFIER_TYPE_NOISE
static void do_version_scale_node_remove_translate(bNodeTree *node_tree)
static void do_version_pixelate_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_plane_track_deform_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_vector_blur_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
@ CMP_NODE_LENS_DISTORTION_HORIZONTAL
@ CMP_NODE_LENS_DISTORTION_RADIAL
static void do_version_crop_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
@ CMP_NODE_OUTPUT_IGNORE_ALPHA
static void do_version_lens_distortion_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_stabilize_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_new_glare_clamp_input(bNodeTree *node_tree)
static void do_version_switch_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_color_correction_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
BMesh const char void * data
static void do_version_color_balance_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static bool strip_effect_overdrop_to_alphaover(Strip *strip, void *)
@ VOLUME_GRID_VECTOR_FLOAT
static void node_interface_single_value_to_structure_type(bNodeTreeInterfaceItem &item)
static void do_version_bokeh_image_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
static void do_version_blur_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_pixelate_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_anti_alias_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
@ CMP_NODE_MASK_FLAG_MOTION_BLUR
@ CMP_NODE_MASK_FLAG_NO_FEATHER
static void version_sequencer_update_overdrop(Main *bmain)
static void do_version_glare_node_star_45_option_to_input(bNodeTree *node_tree, bNode *node)
@ FILE_ASSET_IMPORT_INSTANCE_COLLECTIONS_ON_LINK
static void do_version_time_curve_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_alpha_over_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_bokeh_image_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_dilate_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_distance_matte_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_plane_track_deform_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void version_escape_curly_braces_in_compositor_file_output_nodes(bNodeTree &nodetree)
@ CMP_NODE_INTERPOLATION_ANISOTROPIC
@ CMP_NODE_INTERPOLATION_BILINEAR
void version_node_tree_clear_interface(bNodeTree &ntree)
static void do_version_translate_node_remove_relative(bNodeTree *node_tree)
static void do_version_color_correction_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_stabilize_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void version_show_texpaint_to_show_uv(Main *bmain)
static void do_version_alpha_over_remove_premultiply(bNodeTree *node_tree)
static void do_version_kuwahara_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_node_curve_to_mesh_scale_input(bNodeTree *tree)
static void do_version_vector_blur_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_inpaint_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_color_balance_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
@ STRIP_BLEND_OVERDROP_REMOVED
static void do_version_time_curve_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_keying_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_anti_alias_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void version_fix_fcurve_noise_offset(FCurve &fcurve)
static void do_version_tone_map_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_switch_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_blur_defocus_nodes_remove_gamma(bNodeTree *node_tree)
static void do_version_sun_beams_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
ID_Type GS(const char *name)
Definition DNA_ID.h:410
void * CustomData_get_layer_named_for_write(CustomData *data, eCustomDataType type, StringRef name, int totelem)
IDProperty * version_cycles_properties_from_ID(ID *id)
static void do_version_denoise_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
@ SEQ_SNAP_TO_FRAME_RANGE
static void do_version_distance_matte_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void nlastrips_apply_fcurve_versioning(ListBaseT< NlaStrip > &strips)
static void do_version_directional_blur_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
CurveMapping * BKE_paint_default_curve()
Definition scene.cc:157
@ CMP_NODE_SCALE_RENDER_SIZE
@ NODE_VECTOR_MATH_SCALE
@ BRUSH_ORIGINAL_NORMAL
@ BRUSH_INVERT_TO_SCRAPE_FILL
static void do_version_glare_node_star_45_option_to_input_animation(bNodeTree *node_tree, bNode *node)
static void do_version_keying_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
MINLINE void copy_v4_v4(float r[4], const float a[4])
@ CMP_NODE_BLUR_ASPECT_NONE
@ CMP_NODE_BLUR_ASPECT_X
@ CMP_NODE_BLUR_ASPECT_Y
static void do_version_luminance_matte_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_channel_matte_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_tone_map_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void version_convert_sculpt_planar_brushes(Main *bmain)
static void do_version_keying_screen_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_directional_blur_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
void do_versions_after_linking_405(FileData *fd, Main *bmain)
static void version_set_uv_face_overlay_defaults(Main *bmain)
static void do_version_dilate_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void version_set_default_bone_drawtype(Main *bmain)
@ PROP_FACTOR
Definition RNA_types.hh:308
@ PROP_COLOR_TEMPERATURE
Definition RNA_types.hh:347
static void do_version_blur_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
void version_node_socket_index_animdata(Main *bmain, const int node_tree_type, const int node_type, const int socket_index_orig, const int socket_index_offset, const int total_number_of_sockets)
static void do_version_ellipse_mask_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_chroma_matte_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
bNodeLink & version_node_add_link(bNodeTree &ntree, bNode &node_a, bNodeSocket &socket_a, bNode &node_b, bNodeSocket &socket_b)
static void do_version_flip_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_sun_beams_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_chroma_matte_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
int BLI_str_utf8_invalid_strip(char *str, size_t str_len) ATTR_NONNULL(1)
static void do_version_box_mask_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
bNodeSocket * version_node_add_socket_if_not_exist(bNodeTree *ntree, bNode *node, int in_out, int type, int subtype, const char *identifier, const char *name)
signed char int8_t
Definition BKE_text.h:76
static void do_version_channel_matte_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_invert_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
void blo_do_versions_405(FileData *fd, Library *lib, Main *bmain)
bNodeSocket & version_node_add_socket(bNodeTree &ntree, bNode &node, const eNodeSocketInOut in_out, const char *idname, const char *identifier)
static void do_version_color_matte_node_options_to_inputs(bNodeTree *node_tree, bNode *node)
static void do_version_bokeh_blur_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_keying_screen_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
static void do_version_ellipse_mask_node_options_to_inputs_animation(bNodeTree *node_tree, bNode *node)
ListBaseT< Strip > seqbase
ListBaseT< FModifier > modifiers
eFModifier_Types type
eFileAssetImportFlags import_flags
unsigned short list_thumbnail_size
char name[258]
Definition DNA_ID.h:433
ListBaseT< bArmature > armatures
Definition BKE_main.hh:407
ListBaseT< bNodeTree > nodetrees
Definition BKE_main.hh:409
ListBaseT< Curves > hair_curves
Definition BKE_main.hh:428
ListBaseT< Brush > brushes
Definition BKE_main.hh:410
ListBaseT< Object > objects
Definition BKE_main.hh:388
ListBaseT< Image > images
Definition BKE_main.hh:394
ListBaseT< bAction > actions
Definition BKE_main.hh:408
ListBaseT< Scene > scenes
Definition BKE_main.hh:386
ListBaseT< GreasePencil > grease_pencils
Definition BKE_main.hh:418
ListBaseT< bScreen > screens
Definition BKE_main.hh:400
DNA_DEPRECATED char gamma
DNA_DEPRECATED char gamco
DNA_DEPRECATED char path[1024]
DNA_DEPRECATED short interpolation
eNodeSocketDatatype input_type
float shadow_terminator_shading_offset
float shadow_terminator_geometry_offset
float shadow_terminator_normal_offset
struct Editing * ed
struct RenderData r
struct ToolSettings * toolsettings
struct SceneGpencil grease_pencil_settings
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
FileSelectParams * params
FileAssetSelectParams * asset_params
eSpaceImage_Flag flag
DNA_DEPRECATED struct UnifiedPaintSettings unified_paint_settings
struct CurveMapping * curve_rand_saturation
struct CurveMapping * curve_rand_value
struct CurveMapping * curve_rand_hue
ListBaseT< EditBone > * edbo
ListBaseT< Bone > bonebase
eNodeSocketDatatype type
ListBaseT< bNodeLink > links
bNodeTreeInterface tree_interface
eNodeTree_Type type
ListBaseT< bNode > nodes
struct bNode * parent
ListBaseT< struct ScrArea > areabase
Defines a socket type.
Definition BKE_node.hh:163
eNodeSocketDatatype type
Definition BKE_node.hh:198