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