Blender V5.3
versioning_401.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#define DNA_DEPRECATED_ALLOW
10
11#include "ANIM_armature_iter.hh"
12
13/* Define macros in `DNA_genfile.h`. */
14#define DNA_GENFILE_VERSIONING_MACROS
15
16#include "DNA_anim_types.h"
17#include "DNA_brush_types.h"
18#include "DNA_genfile.h"
20#include "DNA_material_types.h"
21#include "DNA_mesh_types.h"
22#include "DNA_modifier_types.h"
23#include "DNA_scene_types.h"
24#include "DNA_screen_types.h"
25#include "DNA_sequence_types.h"
26
27#undef DNA_GENFILE_VERSIONING_MACROS
28
29#include "BLI_listbase.hh"
30#include "BLI_math_vector_c.hh"
32#include "BLI_string.hh"
33#include "BLI_string_utf8.hh"
34#include "BLI_task.hh"
35
36#include "BKE_anim_data.hh"
37#include "BKE_armature.hh"
38#include "BKE_grease_pencil.hh"
39#include "BKE_main.hh"
40#include "BKE_nla.hh"
41#include "BKE_node.hh"
43#include "BKE_node_runtime.hh"
44
45#include "SEQ_iterator.hh"
46#include "SEQ_sequencer.hh"
47
48#include "readfile.hh"
49
50#include "versioning_common.hh"
51
52namespace blender {
53
66{
67 bool any_valid_tweakmode_left = false;
68
69 ID *id;
70 FOREACH_MAIN_ID_BEGIN (bmain, id) {
72 if (!adt || !(adt->flag & ADT_NLA_EDIT_ON)) {
73 continue;
74 }
75
76 if (adt->act_track && adt->actstrip) {
77 /* Expected case. */
78 any_valid_tweakmode_left = true;
79 continue;
80 }
81
82 /* Not enough info in the blend file to reliably stay in tweak mode. This is the most important
83 * part of this versioning code, as it prevents future nullptr access. */
84 BKE_nla_tweakmode_exit({*id, *adt});
85 }
87
88 if (any_valid_tweakmode_left) {
89 /* There are still NLA strips correctly in tweak mode. */
90 return;
91 }
92
93 /* Nothing is in a valid tweakmode, so just disable the corresponding flags on all scenes. */
94 for (Scene &scene : bmain->scenes) {
95 scene.flag &= ~SCE_NLA_EDIT_ON;
96 }
97}
98
100{
101 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 23)) {
103 }
104}
105
107{
108 for (GreasePencilDrawingBase *base : grease_pencil->drawings()) {
109 if (base->type != GP_DRAWING) {
110 continue;
111 }
112 bke::greasepencil::Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
113 MutableSpan<float> radii = drawing.radii_for_write();
114 threading::parallel_for(radii.index_range(), 8192, [&](const IndexRange range) {
115 for (const int i : range) {
116 radii[i] *= bke::greasepencil::LEGACY_RADIUS_CONVERSION_FACTOR;
117 }
118 });
119 }
120}
121
123{
124 for (bNode &node : ntree->nodes) {
125 if (node.type_legacy != SH_NODE_TEX_NOISE) {
126 continue;
127 }
129 continue;
130 }
131
132 (static_cast<NodeTexNoise *>(node.storage))->type = SHD_NOISE_FBM;
133
134 bNodeSocket *roughness_socket = bke::node_find_socket(node, SOCK_IN, "Roughness"_ustr);
135 if (roughness_socket == nullptr) {
136 /* Noise Texture node was created before the Roughness input was added. */
137 continue;
138 }
139
140 float *roughness = version_cycles_node_socket_float_value(roughness_socket);
141
142 bNodeLink *roughness_link = nullptr;
143 bNode *roughness_from_node = nullptr;
144 bNodeSocket *roughness_from_socket = nullptr;
145
146 for (bNodeLink &link : ntree->links) {
147 /* Find links, nodes and sockets. */
148 if (link.tosock == roughness_socket) {
149 roughness_link = &link;
150 roughness_from_node = link.fromnode;
151 roughness_from_socket = link.fromsock;
152 }
153 }
154
155 if (roughness_link != nullptr) {
156 /* Add Clamp node before Roughness input. */
157
158 bNode *clamp_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_CLAMP);
159 clamp_node->parent = node.parent;
160 clamp_node->custom1 = NODE_CLAMP_MINMAX;
161 clamp_node->locx_legacy = node.locx_legacy;
162 clamp_node->locy_legacy = node.locy_legacy - 300.0f;
163 clamp_node->flag |= NODE_COLLAPSED;
164 bNodeSocket *clamp_socket_value = bke::node_find_socket(*clamp_node, SOCK_IN, "Value"_ustr);
165 bNodeSocket *clamp_socket_min = bke::node_find_socket(*clamp_node, SOCK_IN, "Min"_ustr);
166 bNodeSocket *clamp_socket_max = bke::node_find_socket(*clamp_node, SOCK_IN, "Max"_ustr);
167 bNodeSocket *clamp_socket_out = bke::node_find_socket(*clamp_node, SOCK_OUT, "Result"_ustr);
168
169 *version_cycles_node_socket_float_value(clamp_socket_min) = 0.0f;
170 *version_cycles_node_socket_float_value(clamp_socket_max) = 1.0f;
171
172 bke::node_remove_link(ntree, *roughness_link);
174 *ntree, *roughness_from_node, *roughness_from_socket, *clamp_node, *clamp_socket_value);
175 bke::node_add_link(*ntree, *clamp_node, *clamp_socket_out, node, *roughness_socket);
176 }
177 else {
178 *roughness = std::clamp(*roughness, 0.0f, 1.0f);
179 }
180 }
181
183}
184
186{
187 version_node_input_socket_name(ntree, SH_NODE_TEX_MUSGRAVE_DEPRECATED, "Dimension", "Roughness");
188 for (bNode &node : ntree->nodes) {
189 if (node.type_legacy != SH_NODE_TEX_MUSGRAVE_DEPRECATED) {
190 continue;
191 }
193 continue;
194 }
195
196 STRNCPY_UTF8(node.idname, "ShaderNodeTexNoise");
197 node.type_legacy = SH_NODE_TEX_NOISE;
198 NodeTexNoise *data = MEM_new<NodeTexNoise>(__func__);
199 NodeTexMusgrave *musgrave_data = static_cast<NodeTexMusgrave *>(node.storage);
200 data->base = musgrave_data->base;
201 data->dimensions = musgrave_data->dimensions;
202 data->normalize = false;
203 data->type = musgrave_data->musgrave_type;
204 MEM_delete(musgrave_data);
205 node.storage = data;
206
207 bNodeLink *detail_link = nullptr;
208 bNode *detail_from_node = nullptr;
209 bNodeSocket *detail_from_socket = nullptr;
210
211 bNodeLink *roughness_link = nullptr;
212 bNode *roughness_from_node = nullptr;
213 bNodeSocket *roughness_from_socket = nullptr;
214
215 bNodeLink *lacunarity_link = nullptr;
216 bNode *lacunarity_from_node = nullptr;
217 bNodeSocket *lacunarity_from_socket = nullptr;
218
219 for (bNodeLink &link : ntree->links) {
220 /* Find links, nodes and sockets. */
221 if (link.tonode == &node) {
222 if (STREQ(link.tosock->identifier, "Detail")) {
223 detail_link = &link;
224 detail_from_node = link.fromnode;
225 detail_from_socket = link.fromsock;
226 }
227 if (STREQ(link.tosock->identifier, "Roughness")) {
228 roughness_link = &link;
229 roughness_from_node = link.fromnode;
230 roughness_from_socket = link.fromsock;
231 }
232 if (STREQ(link.tosock->identifier, "Lacunarity")) {
233 lacunarity_link = &link;
234 lacunarity_from_node = link.fromnode;
235 lacunarity_from_socket = link.fromsock;
236 }
237 }
238 }
239
240 uint8_t noise_type = (static_cast<NodeTexNoise *>(node.storage))->type;
241 float locy_offset = 0.0f;
242
243 bNodeSocket *fac_socket = bke::node_find_socket(node, SOCK_OUT, "Fac"_ustr);
244 /* Clear label because Musgrave output socket label is set to "Height" instead of "Fac". */
245 fac_socket->label[0] = '\0';
246
247 bNodeSocket *detail_socket = bke::node_find_socket(node, SOCK_IN, "Detail"_ustr);
248 float *detail = version_cycles_node_socket_float_value(detail_socket);
249
250 if (detail_link != nullptr) {
251 locy_offset -= 80.0f;
252
253 /* Add Minimum Math node and Subtract Math node before Detail input. */
254
255 bNode *min_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
256 min_node->parent = node.parent;
257 min_node->custom1 = NODE_MATH_MINIMUM;
258 min_node->locx_legacy = node.locx_legacy;
259 min_node->locy_legacy = node.locy_legacy - 320.0f;
260 min_node->flag |= NODE_COLLAPSED;
261 bNodeSocket *min_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&min_node->inputs, 0));
262 bNodeSocket *min_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&min_node->inputs, 1));
263 bNodeSocket *min_socket_out = bke::node_find_socket(*min_node, SOCK_OUT, "Value"_ustr);
264
265 bNode *sub1_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
266 sub1_node->parent = node.parent;
267 sub1_node->custom1 = NODE_MATH_SUBTRACT;
268 sub1_node->locx_legacy = node.locx_legacy;
269 sub1_node->locy_legacy = node.locy_legacy - 360.0f;
270 sub1_node->flag |= NODE_COLLAPSED;
271 bNodeSocket *sub1_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&sub1_node->inputs, 0));
272 bNodeSocket *sub1_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&sub1_node->inputs, 1));
273 bNodeSocket *sub1_socket_out = bke::node_find_socket(*sub1_node, SOCK_OUT, "Value"_ustr);
274
275 *version_cycles_node_socket_float_value(min_socket_B) = 14.0f;
276 *version_cycles_node_socket_float_value(sub1_socket_B) = 1.0f;
277
278 bke::node_remove_link(ntree, *detail_link);
280 *ntree, *detail_from_node, *detail_from_socket, *sub1_node, *sub1_socket_A);
281 bke::node_add_link(*ntree, *sub1_node, *sub1_socket_out, *min_node, *min_socket_A);
282 bke::node_add_link(*ntree, *min_node, *min_socket_out, node, *detail_socket);
283
285 locy_offset -= 40.0f;
286
287 /* Add Greater Than Math node before Subtract Math node. */
288
289 bNode *greater_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
290 greater_node->parent = node.parent;
291 greater_node->custom1 = NODE_MATH_GREATER_THAN;
292 greater_node->locx_legacy = node.locx_legacy;
293 greater_node->locy_legacy = node.locy_legacy - 400.0f;
294 greater_node->flag |= NODE_COLLAPSED;
295 bNodeSocket *greater_socket_A = static_cast<bNodeSocket *>(
296 BLI_findlink(&greater_node->inputs, 0));
297 bNodeSocket *greater_socket_B = static_cast<bNodeSocket *>(
298 BLI_findlink(&greater_node->inputs, 1));
299 bNodeSocket *greater_socket_out = bke::node_find_socket(
300 *greater_node, SOCK_OUT, "Value"_ustr);
301
302 *version_cycles_node_socket_float_value(greater_socket_B) = 1.0f;
303
305 *ntree, *detail_from_node, *detail_from_socket, *greater_node, *greater_socket_A);
306 bke::node_add_link(*ntree, *greater_node, *greater_socket_out, *sub1_node, *sub1_socket_B);
307 }
308 else {
309 /* Add Clamp node and Multiply Math node behind Fac output. */
310
311 bNode *clamp_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_CLAMP);
312 clamp_node->parent = node.parent;
313 clamp_node->custom1 = NODE_CLAMP_MINMAX;
314 clamp_node->locx_legacy = node.locx_legacy;
315 clamp_node->locy_legacy = node.locy_legacy + 40.0f;
316 clamp_node->flag |= NODE_COLLAPSED;
317 bNodeSocket *clamp_socket_value = bke::node_find_socket(
318 *clamp_node, SOCK_IN, "Value"_ustr);
319 bNodeSocket *clamp_socket_min = bke::node_find_socket(*clamp_node, SOCK_IN, "Min"_ustr);
320 bNodeSocket *clamp_socket_max = bke::node_find_socket(*clamp_node, SOCK_IN, "Max"_ustr);
321 bNodeSocket *clamp_socket_out = bke::node_find_socket(
322 *clamp_node, SOCK_OUT, "Result"_ustr);
323
324 bNode *mul_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
325 mul_node->parent = node.parent;
326 mul_node->custom1 = NODE_MATH_MULTIPLY;
327 mul_node->locx_legacy = node.locx_legacy;
328 mul_node->locy_legacy = node.locy_legacy + 80.0f;
329 mul_node->flag |= NODE_COLLAPSED;
330 bNodeSocket *mul_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&mul_node->inputs, 0));
331 bNodeSocket *mul_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&mul_node->inputs, 1));
332 bNodeSocket *mul_socket_out = bke::node_find_socket(*mul_node, SOCK_OUT, "Value"_ustr);
333
334 *version_cycles_node_socket_float_value(clamp_socket_min) = 0.0f;
335 *version_cycles_node_socket_float_value(clamp_socket_max) = 1.0f;
336
337 if (noise_type == SHD_NOISE_MULTIFRACTAL) {
338 /* Add Subtract Math node and Add Math node after Multiply Math node. */
339
340 bNode *sub2_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
341 sub2_node->parent = node.parent;
342 sub2_node->custom1 = NODE_MATH_SUBTRACT;
343 sub2_node->custom2 = SHD_MATH_CLAMP;
344 sub2_node->locx_legacy = node.locx_legacy;
345 sub2_node->locy_legacy = node.locy_legacy + 120.0f;
346 sub2_node->flag |= NODE_COLLAPSED;
347 bNodeSocket *sub2_socket_A = static_cast<bNodeSocket *>(
348 BLI_findlink(&sub2_node->inputs, 0));
349 bNodeSocket *sub2_socket_B = static_cast<bNodeSocket *>(
350 BLI_findlink(&sub2_node->inputs, 1));
351 bNodeSocket *sub2_socket_out = bke::node_find_socket(*sub2_node, SOCK_OUT, "Value"_ustr);
352
353 bNode *add_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
354 add_node->parent = node.parent;
355 add_node->custom1 = NODE_MATH_ADD;
356 add_node->locx_legacy = node.locx_legacy;
357 add_node->locy_legacy = node.locy_legacy + 160.0f;
358 add_node->flag |= NODE_COLLAPSED;
359 bNodeSocket *add_socket_A = static_cast<bNodeSocket *>(
360 BLI_findlink(&add_node->inputs, 0));
361 bNodeSocket *add_socket_B = static_cast<bNodeSocket *>(
362 BLI_findlink(&add_node->inputs, 1));
363 bNodeSocket *add_socket_out = bke::node_find_socket(*add_node, SOCK_OUT, "Value"_ustr);
364
365 *version_cycles_node_socket_float_value(sub2_socket_A) = 1.0f;
366
367 for (bNodeLink &link : ntree->links.items_reversed_mutable()) {
368 if (link.fromsock == fac_socket) {
369 bke::node_add_link(*ntree, *add_node, *add_socket_out, *link.tonode, *link.tosock);
370 bke::node_remove_link(ntree, link);
371 }
372 }
373
374 bke::node_add_link(*ntree, *mul_node, *mul_socket_out, *add_node, *add_socket_A);
376 *ntree, *detail_from_node, *detail_from_socket, *sub2_node, *sub2_socket_B);
377 bke::node_add_link(*ntree, *sub2_node, *sub2_socket_out, *add_node, *add_socket_B);
378 }
379 else {
380 for (bNodeLink &link : ntree->links.items_reversed_mutable()) {
381 if (link.fromsock == fac_socket) {
382 bke::node_add_link(*ntree, *mul_node, *mul_socket_out, *link.tonode, *link.tosock);
383 bke::node_remove_link(ntree, link);
384 }
385 }
386 }
387
388 bke::node_add_link(*ntree, node, *fac_socket, *mul_node, *mul_socket_A);
390 *ntree, *detail_from_node, *detail_from_socket, *clamp_node, *clamp_socket_value);
391 bke::node_add_link(*ntree, *clamp_node, *clamp_socket_out, *mul_node, *mul_socket_B);
392 }
393 }
394 else {
395 if (*detail < 1.0f) {
397 /* Add Multiply Math node behind Fac output. */
398
399 bNode *mul_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
400 mul_node->parent = node.parent;
401 mul_node->custom1 = NODE_MATH_MULTIPLY;
402 mul_node->locx_legacy = node.locx_legacy;
403 mul_node->locy_legacy = node.locy_legacy + 40.0f;
404 mul_node->flag |= NODE_COLLAPSED;
405 bNodeSocket *mul_socket_A = static_cast<bNodeSocket *>(
406 BLI_findlink(&mul_node->inputs, 0));
407 bNodeSocket *mul_socket_B = static_cast<bNodeSocket *>(
408 BLI_findlink(&mul_node->inputs, 1));
409 bNodeSocket *mul_socket_out = bke::node_find_socket(*mul_node, SOCK_OUT, "Value"_ustr);
410
412
413 if (noise_type == SHD_NOISE_MULTIFRACTAL) {
414 /* Add an Add Math node after Multiply Math node. */
415
416 bNode *add_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
417 add_node->parent = node.parent;
418 add_node->custom1 = NODE_MATH_ADD;
419 add_node->locx_legacy = node.locx_legacy;
420 add_node->locy_legacy = node.locy_legacy + 80.0f;
421 add_node->flag |= NODE_COLLAPSED;
422 bNodeSocket *add_socket_A = static_cast<bNodeSocket *>(
423 BLI_findlink(&add_node->inputs, 0));
424 bNodeSocket *add_socket_B = static_cast<bNodeSocket *>(
425 BLI_findlink(&add_node->inputs, 1));
426 bNodeSocket *add_socket_out = bke::node_find_socket(*add_node, SOCK_OUT, "Value"_ustr);
427
428 *version_cycles_node_socket_float_value(add_socket_B) = 1.0f - *detail;
429
430 for (bNodeLink &link : ntree->links.items_reversed_mutable()) {
431 if (link.fromsock == fac_socket) {
432 bke::node_add_link(*ntree, *add_node, *add_socket_out, *link.tonode, *link.tosock);
433 bke::node_remove_link(ntree, link);
434 }
435 }
436
437 bke::node_add_link(*ntree, *mul_node, *mul_socket_out, *add_node, *add_socket_A);
438 }
439 else {
440 for (bNodeLink &link : ntree->links.items_reversed_mutable()) {
441 if (link.fromsock == fac_socket) {
442 bke::node_add_link(*ntree, *mul_node, *mul_socket_out, *link.tonode, *link.tosock);
443 bke::node_remove_link(ntree, link);
444 }
445 }
446 }
447
448 bke::node_add_link(*ntree, node, *fac_socket, *mul_node, *mul_socket_A);
449
450 *detail = 0.0f;
451 }
452 }
453 else {
454 *detail = std::fminf(*detail - 1.0f, 14.0f);
455 }
456 }
457
458 bNodeSocket *roughness_socket = bke::node_find_socket(node, SOCK_IN, "Roughness"_ustr);
459 float *roughness = version_cycles_node_socket_float_value(roughness_socket);
460 bNodeSocket *lacunarity_socket = bke::node_find_socket(node, SOCK_IN, "Lacunarity"_ustr);
461 float *lacunarity = version_cycles_node_socket_float_value(lacunarity_socket);
462
463 *roughness = std::fmaxf(*roughness, 1e-5f);
464 *lacunarity = std::fmaxf(*lacunarity, 1e-5f);
465
466 if (roughness_link != nullptr) {
467 /* Add Maximum Math node after output of roughness_from_node. Add Multiply Math node and
468 * Power Math node before Roughness input. */
469
470 bNode *max1_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
471 max1_node->parent = node.parent;
472 max1_node->custom1 = NODE_MATH_MAXIMUM;
473 max1_node->locx_legacy = node.locx_legacy;
474 max1_node->locy_legacy = node.locy_legacy - 400.0f + locy_offset;
475 max1_node->flag |= NODE_COLLAPSED;
476 bNodeSocket *max1_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&max1_node->inputs, 0));
477 bNodeSocket *max1_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&max1_node->inputs, 1));
478 bNodeSocket *max1_socket_out = bke::node_find_socket(*max1_node, SOCK_OUT, "Value"_ustr);
479
480 bNode *mul_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
481 mul_node->parent = node.parent;
482 mul_node->custom1 = NODE_MATH_MULTIPLY;
483 mul_node->locx_legacy = node.locx_legacy;
484 mul_node->locy_legacy = node.locy_legacy - 360.0f + locy_offset;
485 mul_node->flag |= NODE_COLLAPSED;
486 bNodeSocket *mul_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&mul_node->inputs, 0));
487 bNodeSocket *mul_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&mul_node->inputs, 1));
488 bNodeSocket *mul_socket_out = bke::node_find_socket(*mul_node, SOCK_OUT, "Value"_ustr);
489
490 bNode *pow_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
491 pow_node->parent = node.parent;
492 pow_node->custom1 = NODE_MATH_POWER;
493 pow_node->locx_legacy = node.locx_legacy;
494 pow_node->locy_legacy = node.locy_legacy - 320.0f + locy_offset;
495 pow_node->flag |= NODE_COLLAPSED;
496 bNodeSocket *pow_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&pow_node->inputs, 0));
497 bNodeSocket *pow_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&pow_node->inputs, 1));
498 bNodeSocket *pow_socket_out = bke::node_find_socket(*pow_node, SOCK_OUT, "Value"_ustr);
499
500 *version_cycles_node_socket_float_value(max1_socket_B) = -1e-5f;
501 *version_cycles_node_socket_float_value(mul_socket_B) = -1.0f;
502 *version_cycles_node_socket_float_value(pow_socket_A) = *lacunarity;
503
504 bke::node_remove_link(ntree, *roughness_link);
506 *ntree, *roughness_from_node, *roughness_from_socket, *max1_node, *max1_socket_A);
507 bke::node_add_link(*ntree, *max1_node, *max1_socket_out, *mul_node, *mul_socket_A);
508 bke::node_add_link(*ntree, *mul_node, *mul_socket_out, *pow_node, *pow_socket_B);
509 bke::node_add_link(*ntree, *pow_node, *pow_socket_out, node, *roughness_socket);
510
511 if (lacunarity_link != nullptr) {
512 /* Add Maximum Math node after output of lacunarity_from_node. */
513
514 bNode *max2_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
515 max2_node->parent = node.parent;
516 max2_node->custom1 = NODE_MATH_MAXIMUM;
517 max2_node->locx_legacy = node.locx_legacy;
518 max2_node->locy_legacy = node.locy_legacy - 440.0f + locy_offset;
519 max2_node->flag |= NODE_COLLAPSED;
520 bNodeSocket *max2_socket_A = static_cast<bNodeSocket *>(
521 BLI_findlink(&max2_node->inputs, 0));
522 bNodeSocket *max2_socket_B = static_cast<bNodeSocket *>(
523 BLI_findlink(&max2_node->inputs, 1));
524 bNodeSocket *max2_socket_out = bke::node_find_socket(*max2_node, SOCK_OUT, "Value"_ustr);
525
526 *version_cycles_node_socket_float_value(max2_socket_B) = -1e-5f;
527
528 bke::node_remove_link(ntree, *lacunarity_link);
530 *ntree, *lacunarity_from_node, *lacunarity_from_socket, *max2_node, *max2_socket_A);
531 bke::node_add_link(*ntree, *max2_node, *max2_socket_out, *pow_node, *pow_socket_A);
532 bke::node_add_link(*ntree, *max2_node, *max2_socket_out, node, *lacunarity_socket);
533 }
534 }
535 else if ((lacunarity_link != nullptr) && (roughness_link == nullptr)) {
536 /* Add Maximum Math node after output of lacunarity_from_node. Add Power Math node before
537 * Roughness input. */
538
539 bNode *max2_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
540 max2_node->parent = node.parent;
541 max2_node->custom1 = NODE_MATH_MAXIMUM;
542 max2_node->locx_legacy = node.locx_legacy;
543 max2_node->locy_legacy = node.locy_legacy - 360.0f + locy_offset;
544 max2_node->flag |= NODE_COLLAPSED;
545 bNodeSocket *max2_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&max2_node->inputs, 0));
546 bNodeSocket *max2_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&max2_node->inputs, 1));
547 bNodeSocket *max2_socket_out = bke::node_find_socket(*max2_node, SOCK_OUT, "Value"_ustr);
548
549 bNode *pow_node = bke::node_add_static_node(nullptr, *ntree, SH_NODE_MATH);
550 pow_node->parent = node.parent;
551 pow_node->custom1 = NODE_MATH_POWER;
552 pow_node->locx_legacy = node.locx_legacy;
553 pow_node->locy_legacy = node.locy_legacy - 320.0f + locy_offset;
554 pow_node->flag |= NODE_COLLAPSED;
555 bNodeSocket *pow_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&pow_node->inputs, 0));
556 bNodeSocket *pow_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&pow_node->inputs, 1));
557 bNodeSocket *pow_socket_out = bke::node_find_socket(*pow_node, SOCK_OUT, "Value"_ustr);
558
559 *version_cycles_node_socket_float_value(max2_socket_B) = -1e-5f;
560 *version_cycles_node_socket_float_value(pow_socket_A) = *lacunarity;
561 *version_cycles_node_socket_float_value(pow_socket_B) = -(*roughness);
562
563 bke::node_remove_link(ntree, *lacunarity_link);
565 *ntree, *lacunarity_from_node, *lacunarity_from_socket, *max2_node, *max2_socket_A);
566 bke::node_add_link(*ntree, *max2_node, *max2_socket_out, *pow_node, *pow_socket_A);
567 bke::node_add_link(*ntree, *max2_node, *max2_socket_out, node, *lacunarity_socket);
568 bke::node_add_link(*ntree, *pow_node, *pow_socket_out, node, *roughness_socket);
569 }
570 else {
571 *roughness = std::pow(*lacunarity, -(*roughness));
572 }
573 }
574
576}
577
579{
580 /* Split viewer was replaced with a regular split node, so add a viewer node,
581 * and link it to the new split node to achieve the same behavior of the split viewer node. */
582
583 for (bNode &node : ntree->nodes.items_mutable()) {
584 if (node.type_legacy != CMP_NODE_SPLITVIEWER__DEPRECATED) {
585 continue;
586 }
587
588 STRNCPY_UTF8(node.idname, "CompositorNodeSplit");
589 node.type_legacy = CMP_NODE_SPLIT;
590 MEM_delete_void(node.storage);
591 node.storage = nullptr;
592
593 bNode *viewer_node = bke::node_add_static_node(nullptr, *ntree, CMP_NODE_VIEWER);
594 /* Nodes are created stacked on top of each other, so separate them a bit. */
595 viewer_node->locx_legacy = node.locx_legacy + node.width + viewer_node->width / 4.0f;
596 viewer_node->locy_legacy = node.locy_legacy;
597 viewer_node->flag &= ~NODE_PREVIEW;
598
599 bNodeSocket *split_out_socket = bke::node_add_static_socket(
600 *ntree, node, SOCK_OUT, SOCK_IMAGE, PROP_NONE, "Image", "Image");
601 bNodeSocket *viewer_in_socket = bke::node_find_socket(*viewer_node, SOCK_IN, "Image"_ustr);
602
603 bke::node_add_link(*ntree, node, *split_out_socket, *viewer_node, *viewer_in_socket);
604 }
605}
606
607void version_socket_identifier_suffixes_for_dynamic_types(const ListBaseT<bNodeSocket> &sockets,
608 const char *separator,
609 const std::optional<int> total)
610{
611 int index = 0;
612 for (bNodeSocket &socket : sockets) {
613 if (socket.is_available()) {
614 if (char *pos = strstr(socket.identifier, separator)) {
615 /* End the identifier at the separator so that the old suffix is ignored. */
616 *pos = '\0';
617 socket.runtime->identifier_ustr = UString(socket.identifier);
618
619 if (total.has_value()) {
620 index++;
621 if (index == *total) {
622 return;
623 }
624 }
625 }
626 }
627 else {
628 /* Rename existing identifiers so that they don't conflict with the renamed one. Those will
629 * be removed after versioning code. */
630 BLI_strncat(socket.identifier, "_deprecated", sizeof(socket.identifier));
631 socket.runtime->identifier_ustr = UString(socket.identifier);
632 }
633 }
634}
635
637{
638 for (bNode &node : ntree.nodes) {
639 switch (node.type_legacy) {
641 /* This node requires the extra `total` parameter, because the `Group Index` identifier
642 * also has a space in the name, that should not be treated as separator. */
645 break;
652 case GEO_NODE_RAYCAST:
657 case GEO_NODE_VIEWER:
660 break;
661 }
662 }
663}
664
666{
667 for (bNode &node : ntree.nodes) {
668 if (!ELEM(node.type_legacy, GEO_NODE_SWITCH, GEO_NODE_SAMPLE_CURVE)) {
669 continue;
670 }
673 }
674}
675
677 bNode &node,
678 bNodeSocket &socket)
679{
680 if (socket.type == SOCK_ROTATION) {
681 return;
682 }
683 socket.type = SOCK_ROTATION;
684 STRNCPY_UTF8(socket.idname, "NodeSocketRotation");
685 auto *old_value = static_cast<bNodeSocketValueVector *>(socket.default_value);
686 auto *new_value = MEM_new<bNodeSocketValueRotation>(__func__);
687 copy_v3_v3(new_value->value_euler, old_value->value);
688 socket.default_value = new_value;
689 MEM_delete(old_value);
690 for (bNodeLink &link : ntree.links.items_mutable()) {
691 if (link.tosock != &socket) {
692 continue;
693 }
694 if (ELEM(link.fromsock->type, SOCK_ROTATION, SOCK_VECTOR, SOCK_FLOAT) &&
695 !link.fromnode->is_reroute())
696 {
697 /* No need to add the conversion node when implicit conversions will work. */
698 continue;
699 }
700 if (STREQ(link.fromnode->idname, "FunctionNodeEulerToRotation")) {
701 /* Make versioning idempotent. */
702 continue;
703 }
704 bNode *convert = bke::node_add_node(nullptr, ntree, "FunctionNodeEulerToRotation"_ustr);
705 convert->parent = node.parent;
706 convert->locx_legacy = node.locx_legacy - 40;
707 convert->locy_legacy = node.locy_legacy;
708 link.tonode = convert;
709 link.tosock = bke::node_find_socket(*convert, SOCK_IN, "Euler"_ustr);
710
711 bke::node_add_link(ntree,
712 *convert,
713 *bke::node_find_socket(*convert, SOCK_OUT, "Rotation"_ustr),
714 node,
715 socket);
716 }
717}
718
720 bNode &node,
721 bNodeSocket &socket)
722{
723 /* Rely on generic node declaration update to change the socket type. */
724 for (bNodeLink &link : ntree.links.items_mutable()) {
725 if (link.fromsock != &socket) {
726 continue;
727 }
728 if (ELEM(link.tosock->type, SOCK_ROTATION, SOCK_VECTOR) && !link.tonode->is_reroute()) {
729 /* No need to add the conversion node when implicit conversions will work. */
730 continue;
731 }
732 if (STREQ(link.tonode->idname,
733 "FunctionNodeRotationToEuler")) { /* Make versioning idempotent. */
734 continue;
735 }
736 bNode *convert = bke::node_add_node(nullptr, ntree, "FunctionNodeRotationToEuler"_ustr);
737 convert->parent = node.parent;
738 convert->locx_legacy = node.locx_legacy + 40;
739 convert->locy_legacy = node.locy_legacy;
740 link.fromnode = convert;
741 link.fromsock = bke::node_find_socket(*convert, SOCK_OUT, "Euler"_ustr);
742
744 ntree, node, socket, *convert, *bke::node_find_socket(*convert, SOCK_IN, "Rotation"_ustr));
745 }
746}
747
749{
750 for (bNode &node : ntree.nodes.items_mutable()) {
751 if (STR_ELEM(node.idname,
752 "GeometryNodeInstanceOnPoints",
753 "GeometryNodeRotateInstances",
754 "GeometryNodeTransform"))
755 {
756 bNodeSocket *socket = bke::node_find_socket(node, SOCK_IN, "Rotation"_ustr);
758 }
759 if (STR_ELEM(node.idname,
760 "GeometryNodeDistributePointsOnFaces",
761 "GeometryNodeObjectInfo",
762 "GeometryNodeInputInstanceRotation"))
763 {
764 bNodeSocket *socket = bke::node_find_socket(node, SOCK_OUT, "Rotation"_ustr);
766 }
767 }
768}
769
771{
773 for (bNodeLink &link : ntree.links) {
775 out_links_per_socket.add(link.fromsock, &link);
776 }
777 }
778
779 for (bNode &node : ntree.nodes.items_mutable()) {
780 if (node.type_legacy != GEO_NODE_OBJECT_INFO) {
781 continue;
782 }
784 const Span<bNodeLink *> links = out_links_per_socket.lookup(scale);
785 if (links.is_empty()) {
786 continue;
787 }
788 bNode *absolute_value = bke::node_add_node(nullptr, ntree, "ShaderNodeVectorMath"_ustr);
789 absolute_value->custom1 = NODE_VECTOR_MATH_ABSOLUTE;
790 absolute_value->parent = node.parent;
791 absolute_value->locx_legacy = node.locx_legacy + 100;
792 absolute_value->locy_legacy = node.locy_legacy - 50;
793 bke::node_add_link(*&ntree, node, *scale, *absolute_value, *absolute_value->inputs.first());
794 for (bNodeLink *link : links) {
795 link->fromnode = absolute_value;
796 link->fromsock = absolute_value->outputs.first();
797 }
798 }
799}
800
806{
807 bNodeTreeInterface &tree_interface = ntree->tree_interface;
808
809 tree_interface.foreach_item([](bNodeTreeInterfaceItem &item) -> bool {
811 bNodeTreeInterfaceSocket &socket = reinterpret_cast<bNodeTreeInterfaceSocket &>(item);
812 StringRef corrected_socket_type = legacy_socket_idname_to_socket_type(socket.socket_type);
813 if (socket.socket_type != corrected_socket_type) {
814 MEM_delete(socket.socket_type);
815 socket.socket_type = BLI_strdup(corrected_socket_type.data());
816 }
817 }
818 return true;
819 });
820}
821
822static bool strip_filter_bilinear_to_auto(Strip *strip, void * /*user_data*/)
823{
824 StripTransform *transform = strip->data->transform;
825 if (transform != nullptr && transform->filter == SEQ_TRANSFORM_FILTER_BILINEAR) {
827 }
828 return true;
829}
830
831void blo_do_versions_401(FileData *fd, Library * /*lib*/, Main *bmain)
832{
833 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 1)) {
836 }
837 }
838
839 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 4)) {
840 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
841 if (ntree->type != NTREE_CUSTOM) {
842 /* versioning_update_noise_texture_node must be done before
843 * versioning_replace_musgrave_texture_node. */
845
846 /* Convert Musgrave Texture nodes to Noise Texture nodes. */
848 }
849 }
851 }
852
853 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 5)) {
854 /* Unify Material::blend_shadow and Cycles.use_transparent_shadows into the
855 * Material::blend_flag. */
856 bool is_eevee = all_scenes_use(bmain,
858 for (Material &material : bmain->materials) {
859 bool transparent_shadows = true;
860 if (is_eevee) {
861 transparent_shadows = material.blend_shadow != MA_BS_SOLID;
862 }
863 else if (IDProperty *cmat = version_cycles_properties_from_ID(&material.id)) {
864 transparent_shadows = version_cycles_property_boolean(
865 cmat, "use_transparent_shadow", true);
866 }
867 SET_FLAG_FROM_TEST(material.blend_flag, transparent_shadows, MA_BL_TRANSPARENT_SHADOW);
868 }
869 }
870
871 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 5)) {
873 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
874 if (ntree->type == NTREE_COMPOSIT) {
876 }
877 }
879 }
880
881 /* 401 6 did not require any do_version here. */
882
883 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 7)) {
884 if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "int", "volumetric_ray_depth")) {
885 SceneEEVEE default_eevee;
886 for (Scene &scene : bmain->scenes) {
887 scene.eevee.volumetric_ray_depth = default_eevee.volumetric_ray_depth;
888 }
889 }
890
891 if (!DNA_struct_member_exists(fd->filesdna, "Material", "char", "surface_render_method")) {
892 for (Material &mat : bmain->materials) {
893 mat.surface_render_method = (mat.blend_method == MA_BM_BLEND) ? MA_SURFACE_METHOD_FORWARD :
895 }
896 }
897
898 for (bScreen &screen : bmain->screens) {
899 for (ScrArea &area : screen.areabase) {
900 for (SpaceLink &sl : area.spacedata) {
901 const ListBaseT<ARegion> *regionbase = (&sl == area.spacedata.first_) ?
902 &area.regionbase :
903 &sl.regionbase;
904 for (ARegion &region : *regionbase) {
905 if (region.regiontype != RGN_TYPE_ASSET_SHELF_HEADER) {
906 continue;
907 }
908 region.alignment &= ~RGN_SPLIT_PREV;
909 region.alignment |= RGN_ALIGN_HIDE_WITH_PREV;
910 }
911 }
912 }
913 }
914
915 if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "gtao_thickness")) {
916 SceneEEVEE default_eevee;
917 for (Scene &scene : bmain->scenes) {
918 scene.eevee.gtao_thickness = default_eevee.gtao_thickness;
919 scene.eevee.fast_gi_bias = default_eevee.fast_gi_bias;
920 }
921 }
922
923 if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "float", "data_display_size")) {
924 LightProbe default_probe;
925 for (LightProbe &probe : bmain->lightprobes) {
926 probe.data_display_size = default_probe.data_display_size;
927 }
928 }
929
930 for (Mesh &mesh : bmain->meshes) {
932 }
933 }
934
935 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 8)) {
936 for (bNodeTree &ntree : bmain->nodetrees) {
937 if (ntree.type != NTREE_GEOMETRY) {
938 continue;
939 }
941 }
942 }
943
944 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 9)) {
945 if (!DNA_struct_member_exists(fd->filesdna, "Material", "char", "displacement_method")) {
946 /* Replace Cycles.displacement_method by Material::displacement_method. */
947 for (Material &material : bmain->materials) {
949 if (IDProperty *cmat = version_cycles_properties_from_ID(&material.id)) {
950 displacement_method = eMaterial_DisplacementMethod(
951 version_cycles_property_int(cmat, "displacement_method", MA_DISPLACEMENT_BUMP));
952 }
953 material.displacement_method = displacement_method;
954 }
955 }
956
957 /* Prevent custom bone colors from having alpha zero.
958 * Part of the fix for issue #115434. */
959 for (bArmature &arm : bmain->armatures) {
960 animrig::ANIM_armature_foreach_bone(&arm.bonebase, [](Bone *bone) {
961 bone->color.custom.solid[3] = 255;
962 bone->color.custom.select[3] = 255;
963 bone->color.custom.active[3] = 255;
964 });
965 if (arm.edbo) {
966 for (EditBone &ebone : *arm.edbo) {
967 ebone.color.custom.solid[3] = 255;
968 ebone.color.custom.select[3] = 255;
969 ebone.color.custom.active[3] = 255;
970 }
971 }
972 }
973 for (Object &obj : bmain->objects) {
974 if (obj.pose == nullptr) {
975 continue;
976 }
977 for (bPoseChannel &pchan : obj.pose->chanbase) {
978 pchan.color.custom.solid[3] = 255;
979 pchan.color.custom.select[3] = 255;
980 pchan.color.custom.active[3] = 255;
981 }
982 }
983 }
984
985 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 10)) {
986 if (!DNA_struct_member_exists(
987 fd->filesdna, "SceneEEVEE", "RaytraceEEVEE", "ray_tracing_options"))
988 {
989 for (Scene &scene : bmain->scenes) {
998 }
999 }
1000
1001 for (bNodeTree &ntree : bmain->nodetrees) {
1002 if (ntree.type == NTREE_GEOMETRY) {
1006 }
1007 }
1008 }
1009
1010 if (MAIN_VERSION_FILE_ATLEAST(bmain, 400, 20) && !MAIN_VERSION_FILE_ATLEAST(bmain, 401, 11)) {
1011 /* Convert old socket lists into new interface items. */
1012 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1014 }
1016 }
1017
1018 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 12)) {
1019 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1020 if (ntree->type == NTREE_COMPOSIT) {
1021 for (bNode &node : ntree->nodes) {
1022 if (node.type_legacy == CMP_NODE_PIXELATE) {
1023 node.custom1 = 1;
1024 }
1025 }
1026 }
1027 }
1029 }
1030
1031 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 13)) {
1032 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1033 if (ntree->type == NTREE_COMPOSIT) {
1034 for (bNode &node : ntree->nodes) {
1035 if (node.type_legacy == CMP_NODE_MAP_UV) {
1037 }
1038 }
1039 }
1040 }
1042 }
1043
1044 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 14)) {
1045 const Brush default_brush;
1046 for (Brush &brush : bmain->brushes) {
1047 brush.automasking_start_normal_limit = default_brush.automasking_start_normal_limit;
1048 brush.automasking_start_normal_falloff = default_brush.automasking_start_normal_falloff;
1049
1050 brush.automasking_view_normal_limit = default_brush.automasking_view_normal_limit;
1051 brush.automasking_view_normal_falloff = default_brush.automasking_view_normal_falloff;
1052 }
1053 }
1054
1055 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 15)) {
1056 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
1057 if (ntree->type == NTREE_COMPOSIT) {
1058 for (bNode &node : ntree->nodes) {
1059 if (node.type_legacy == CMP_NODE_KEYING) {
1061 NodeKeyingData &keying_data = *static_cast<NodeKeyingData *>(node.storage);
1062 keying_data.edge_kernel_radius = max_ii(keying_data.edge_kernel_radius - 1, 0);
1063 }
1064 }
1065 }
1066 }
1067 }
1069 }
1070
1071 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 16)) {
1072 for (Scene &scene : bmain->scenes) {
1073 Sculpt *sculpt = scene.toolsettings->sculpt;
1074 if (sculpt != nullptr) {
1075 Sculpt default_sculpt = {};
1078 }
1079 }
1080 }
1081
1082 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 17)) {
1083 for (Scene &scene : bmain->scenes) {
1084 ToolSettings *ts = scene.toolsettings;
1085 int input_sample_values[9];
1086
1087 input_sample_values[0] = ts->imapaint.paint.num_input_samples_deprecated;
1088 input_sample_values[1] = ts->sculpt != nullptr ?
1090 1;
1091 input_sample_values[2] = ts->curves_sculpt != nullptr ?
1093 1;
1094
1095 input_sample_values[3] = ts->gp_paint != nullptr ?
1097 1;
1098 input_sample_values[4] = ts->gp_vertexpaint != nullptr ?
1100 1;
1101 input_sample_values[5] = ts->gp_sculptpaint != nullptr ?
1103 1;
1104 input_sample_values[6] = ts->gp_weightpaint != nullptr ?
1106 1;
1107
1108 input_sample_values[7] = ts->vpaint != nullptr ?
1110 1;
1111 input_sample_values[8] = ts->wpaint != nullptr ?
1113 1;
1114
1115 int unified_value = 1;
1116 for (int i = 0; i < 9; i++) {
1117 if (input_sample_values[i] != 1) {
1118 if (unified_value == 1) {
1119 unified_value = input_sample_values[i];
1120 }
1121 else {
1122 /* In the case of a user having multiple tools with different num_input_value values
1123 * set we cannot support this in the single UnifiedPaintSettings value, so fallback
1124 * to 1 instead of deciding that one value is more canonical than the other.
1125 */
1126 break;
1127 }
1128 }
1129 }
1130
1131 ts->unified_paint_settings.input_samples = unified_value;
1132 }
1133 for (Brush &brush : bmain->brushes) {
1134 brush.input_samples = 1;
1135 }
1136 }
1137
1138 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 18)) {
1139 for (Scene &scene : bmain->scenes) {
1140 if (scene.ed != nullptr) {
1142 }
1143 }
1144 }
1145
1146 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 19)) {
1147 for (bNodeTree &ntree : bmain->nodetrees) {
1148 if (ntree.type == NTREE_GEOMETRY) {
1149 version_node_socket_name(&ntree, FN_NODE_ROTATE_ROTATION, "Rotation 1", "Rotation");
1150 version_node_socket_name(&ntree, FN_NODE_ROTATE_ROTATION, "Rotation 2", "Rotate By");
1151 }
1152 }
1153 }
1154
1155 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 20)) {
1156 for (Object &ob : bmain->objects) {
1157 int uid = 1;
1158 for (ModifierData &md : ob.modifiers) {
1159 /* These identifiers are not necessarily stable for linked data. If the linked data has a
1160 * new modifier inserted, the identifiers of other modifiers can change. */
1161 md.persistent_uid = uid++;
1162 }
1163 }
1164 }
1165
1166 if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 21)) {
1167 for (Brush &brush : bmain->brushes) {
1168 /* The `sculpt_flag` was used to store the `BRUSH_DIR_IN`
1169 * With the fix for #115313 this is now just using the `brush->flag`. */
1170 if (brush.gpencil_settings &&
1171 (brush.gpencil_settings->sculpt_flag & eGP_Sculpt_Flag(BRUSH_DIR_IN)) != 0)
1172 {
1173 brush.flag |= BRUSH_DIR_IN;
1174 }
1175 }
1176 }
1177}
1178
1179} // namespace blender
Iterators for armatures.
Low-level operations for grease pencil.
#define FOREACH_MAIN_ID_END
Definition BKE_main.hh:735
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
Definition BKE_main.hh:949
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
Definition BKE_main.hh:729
#define FOREACH_NODETREE_END
Definition BKE_node.hh:936
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
Definition BKE_node.hh:926
#define SH_NODE_TEX_NOISE
#define GEO_NODE_OBJECT_INFO
#define GEO_NODE_STORE_NAMED_ATTRIBUTE
#define FN_NODE_ROTATE_ROTATION
#define CMP_NODE_VIEWER
#define GEO_NODE_SAMPLE_NEAREST_SURFACE
#define GEO_NODE_EVALUATE_AT_INDEX
#define GEO_NODE_ATTRIBUTE_STATISTIC
#define GEO_NODE_VIEWER
#define SH_NODE_MATH
#define GEO_NODE_INPUT_NAMED_ATTRIBUTE
#define GEO_NODE_RAYCAST
#define CMP_NODE_SPLIT
#define GEO_NODE_SWITCH
#define GEO_NODE_EVALUATE_ON_DOMAIN
#define CMP_NODE_MAP_UV
#define GEO_NODE_ACCUMULATE_FIELD
#define GEO_NODE_SAMPLE_CURVE
#define SH_NODE_TEX_MUSGRAVE_DEPRECATED
#define CMP_NODE_PIXELATE
#define GEO_NODE_SAMPLE_UV_SURFACE
#define SH_NODE_CLAMP
#define GEO_NODE_CAPTURE_ATTRIBUTE
#define CMP_NODE_SPLITVIEWER__DEPRECATED
#define CMP_NODE_KEYING
#define GEO_NODE_BLUR_ATTRIBUTE
#define GEO_NODE_SAMPLE_INDEX
#define STR_ELEM(...)
#define STRNCPY_UTF8(dst, src)
blenloader genfile private function prototypes
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
#define STREQ(a, b)
Span< Value > lookup(const Key &key) const
void add(const Key &key, const Value &value)
constexpr IndexRange index_range() const
Definition BLI_span.hh:676
constexpr bool is_empty() const
Definition BLI_span.hh:264
const T & data(const Action &owning_action) const
MutableSpan< float > radii_for_write()
constexpr const char * data() const
float3x3 scale(float3x3 mat, float2 scale)
void node_remove_link(bNodeTree *ntree, bNodeLink &link)
Definition node.cc:4676
bNode * node_add_node(const bContext *C, bNodeTree &ntree, UString idname, std::optional< int > unique_identifier=std::nullopt)
Definition node.cc:4260
bNode * node_add_static_node(const bContext *C, bNodeTree &ntree, int type)
Definition node.cc:4283
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
Definition node.cc:4638
bNodeSocket * node_add_static_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, int type, int subtype, StringRefNull identifier, StringRefNull name)
Definition node.cc:3980
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, UString identifier)
Definition node.cc:3036
BLI_INLINE Texture * wrap(MTLTexture *texture)
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
Definition iterator.cc:60
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Definition BLI_task.hh:69
BMesh Iterators.
bool version_node_ensure_storage_or_invalidate(bNode &node)
static void change_output_socket_to_rotation_type(bNodeTree &ntree, bNode &node, bNodeSocket &socket)
StringRef legacy_socket_idname_to_socket_type(StringRef idname)
@ RAYTRACE_EEVEE_USE_DENOISE
void do_versions_after_linking_401(FileData *fd, Main *bmain)
MINLINE void copy_v3_v3(float r[3], const float a[3])
@ SHD_NOISE_RIDGED_MULTIFRACTAL
@ SHD_NOISE_HETERO_TERRAIN
@ SHD_NOISE_MULTIFRACTAL
@ RGN_TYPE_ASSET_SHELF_HEADER
static void version_nla_tweakmode_incomplete(Main *bmain)
@ NODE_MATH_GREATER_THAN
static void version_geometry_nodes_use_rotation_socket(bNodeTree &ntree)
MINLINE int max_ii(int a, int b)
float * version_cycles_node_socket_float_value(bNodeSocket *socket)
void MEM_delete_void(void *vmemh)
static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
@ RGN_ALIGN_HIDE_WITH_PREV
const char * RE_engine_id_BLENDER_EEVEE
Definition scene.cc:1717
int version_cycles_property_int(IDProperty *idprop, const char *name, int default_value)
void version_socket_update_is_used(bNodeTree *ntree)
void BKE_nla_tweakmode_exit(OwnedAnimData owned_adt)
static bool strip_filter_bilinear_to_auto(Strip *strip, void *)
void blo_do_versions_401(FileData *fd, Library *lib, Main *bmain)
AnimData * BKE_animdata_from_id(const ID *id)
Definition anim_data.cc:93
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:541
static void versioning_fix_socket_subtype_idnames(bNodeTree *ntree)
BMesh const char void * data
unsigned char uint8_t
Definition BKE_text.h:79
static void versioning_grease_pencil_stroke_radii_scaling(GreasePencil *grease_pencil)
bool all_scenes_use(Main *bmain, const Span< const char * > engines)
static void versioning_update_noise_texture_node(bNodeTree *ntree)
void version_socket_identifier_suffixes_for_dynamic_types(const ListBaseT< bNodeSocket > &sockets, const char *separator, const std::optional< int > total)
@ CMP_NODE_INTERPOLATION_ANISOTROPIC
@ ME_NO_OVERLAPPING_TOPOLOGY
static void fix_geometry_nodes_object_info_scale(bNodeTree &ntree)
bool version_cycles_property_boolean(IDProperty *idprop, const char *name, bool default_value)
static void versioning_nodes_dynamic_sockets(bNodeTree &ntree)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
void version_node_input_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
IDProperty * version_cycles_properties_from_ID(ID *id)
static void versioning_nodes_dynamic_sockets_2(bNodeTree &ntree)
@ NODE_VECTOR_MATH_ABSOLUTE
@ SEQ_TRANSFORM_FILTER_BILINEAR
static void versioning_replace_splitviewer(bNodeTree *ntree)
const char * RE_engine_id_BLENDER_EEVEE_NEXT
Definition scene.cc:1718
static void change_input_socket_to_rotation_type(bNodeTree &ntree, bNode &node, bNodeSocket &socket)
@ RAYTRACE_EEVEE_DENOISE_SPATIAL
@ RAYTRACE_EEVEE_DENOISE_BILATERAL
@ RAYTRACE_EEVEE_DENOISE_TEMPORAL
char char size_t char * BLI_strncat(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void version_node_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
unsigned char select[4]
unsigned char solid[4]
unsigned char active[4]
eAnimData_Flag flag
DNA_DEPRECATED float automasking_view_normal_falloff
DNA_DEPRECATED float automasking_start_normal_falloff
DNA_DEPRECATED float automasking_start_normal_limit
DNA_DEPRECATED float automasking_view_normal_limit
ListBaseT< Strip > seqbase
std::unique_ptr< SDNA > filesdna
Definition readfile.hh:111
ListBaseT< bArmature > armatures
Definition BKE_main.hh:407
ListBaseT< bNodeTree > nodetrees
Definition BKE_main.hh:409
ListBaseT< Brush > brushes
Definition BKE_main.hh:410
ListBaseT< Material > materials
Definition BKE_main.hh:392
ListBaseT< Object > objects
Definition BKE_main.hh:388
ListBaseT< Mesh > meshes
Definition BKE_main.hh:389
ListBaseT< Scene > scenes
Definition BKE_main.hh:386
ListBaseT< GreasePencil > grease_pencils
Definition BKE_main.hh:418
ListBaseT< LightProbe > lightprobes
Definition BKE_main.hh:404
ListBaseT< bScreen > screens
Definition BKE_main.hh:400
DNA_DEPRECATED int edge_kernel_radius
DNA_DEPRECATED NodeTexBase base
DNA_DEPRECATED int dimensions
DNA_DEPRECATED int musgrave_type
ListBaseT< ModifierData > modifiers
struct bPose * pose
RaytraceEEVEE_Flag flag
RaytraceEEVEE_DenoiseStages denoise_stages
struct RaytraceEEVEE ray_tracing_options
DNA_DEPRECATED float gtao_thickness
struct Editing * ed
struct SceneEEVEE eevee
struct ToolSettings * toolsettings
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
DNA_DEPRECATED int automasking_boundary_edges_propagation_steps
CurvesSculpt * curves_sculpt
DNA_DEPRECATED struct UnifiedPaintSettings unified_paint_settings
struct ImagePaintSettings imapaint
GpSculptPaint * gp_sculptpaint
GpVertexPaint * gp_vertexpaint
GpWeightPaint * gp_weightpaint
ListBaseT< EditBone > * edbo
ListBaseT< Bone > bonebase
eNodeSocketDatatype type
ListBaseT< bNodeLink > links
bNodeTreeInterface tree_interface
eNodeTree_Type type
ListBaseT< bNode > nodes
struct bNode * parent
ListBaseT< bNodeSocket > outputs
ListBaseT< bNodeSocket > inputs
ListBaseT< bPoseChannel > chanbase
ListBaseT< struct ScrArea > areabase