Blender V4.5
rna_nodetree.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#include <climits>
10#include <cstdlib>
11#include <cstring>
12#include <type_traits>
13
15#include "BLI_math_rotation.h"
16#include "BLI_string.h"
17
18#include "BLT_translation.hh"
19
20#include "DNA_node_types.h"
21#include "DNA_object_types.h"
22#include "DNA_texture_types.h"
23
24#include "BKE_animsys.h"
25#include "BKE_attribute.hh"
26#include "BKE_context.hh"
27#include "BKE_geometry_set.hh"
28#include "BKE_node.hh"
30
31#include "RNA_define.hh"
32#include "RNA_enum_types.hh"
33
34#include "rna_internal.hh"
35#include "rna_internal_types.hh"
36
38
39#include "WM_types.hh"
40
42 {SOCK_OUT, "OUT", 0, "Output", ""},
43 {0, nullptr, 0, nullptr, nullptr}};
44
46 {SOCK_FLOAT, "FLOAT", ICON_NODE_SOCKET_FLOAT, "Float", ""},
47 {SOCK_INT, "INT", ICON_NODE_SOCKET_INT, "Integer", ""},
48 {SOCK_BOOLEAN, "BOOLEAN", ICON_NODE_SOCKET_BOOLEAN, "Boolean", ""},
49 {SOCK_VECTOR, "VECTOR", ICON_NODE_SOCKET_VECTOR, "Vector", ""},
50 {SOCK_ROTATION, "ROTATION", ICON_NODE_SOCKET_ROTATION, "Rotation", ""},
51 {SOCK_MATRIX, "MATRIX", ICON_NODE_SOCKET_MATRIX, "Matrix", ""},
52 {SOCK_STRING, "STRING", ICON_NODE_SOCKET_STRING, "String", ""},
53 {SOCK_MENU, "MENU", ICON_NODE_SOCKET_MENU, "Menu", ""},
54 {SOCK_RGBA, "RGBA", ICON_NODE_SOCKET_RGBA, "Color", ""},
55 {SOCK_OBJECT, "OBJECT", ICON_NODE_SOCKET_OBJECT, "Object", ""},
56 {SOCK_IMAGE, "IMAGE", ICON_NODE_SOCKET_IMAGE, "Image", ""},
57 {SOCK_GEOMETRY, "GEOMETRY", ICON_NODE_SOCKET_GEOMETRY, "Geometry", ""},
58 {SOCK_COLLECTION, "COLLECTION", ICON_NODE_SOCKET_COLLECTION, "Collection", ""},
59 {SOCK_TEXTURE, "TEXTURE", ICON_NODE_SOCKET_TEXTURE, "Texture", ""},
60 {SOCK_MATERIAL, "MATERIAL", ICON_NODE_SOCKET_MATERIAL, "Material", ""},
61 {SOCK_BUNDLE, "BUNDLE", ICON_NODE_SOCKET_BUNDLE, "Bundle", ""},
62 {SOCK_CLOSURE, "CLOSURE", ICON_NODE_SOCKET_CLOSURE, "Closure", ""},
63 {0, nullptr, 0, nullptr, nullptr},
64};
65
68 "NONE",
69 0,
70 "None",
71 "Default color tag for new nodes and node groups"},
72 {int(blender::bke::NodeColorTag::Attribute), "ATTRIBUTE", 0, "Attribute", ""},
73 {int(blender::bke::NodeColorTag::Color), "COLOR", 0, "Color", ""},
74 {int(blender::bke::NodeColorTag::Converter), "CONVERTER", 0, "Converter", ""},
75 {int(blender::bke::NodeColorTag::Distort), "DISTORT", 0, "Distort", ""},
76 {int(blender::bke::NodeColorTag::Filter), "FILTER", 0, "Filter", ""},
77 {int(blender::bke::NodeColorTag::Geometry), "GEOMETRY", 0, "Geometry", ""},
78 {int(blender::bke::NodeColorTag::Input), "INPUT", 0, "Input", ""},
79 {int(blender::bke::NodeColorTag::Matte), "MATTE", 0, "Matte", ""},
80 {int(blender::bke::NodeColorTag::Output), "OUTPUT", 0, "Output", ""},
81 {int(blender::bke::NodeColorTag::Script), "SCRIPT", 0, "Script", ""},
82 {int(blender::bke::NodeColorTag::Shader), "SHADER", 0, "Shader", ""},
83 {int(blender::bke::NodeColorTag::Texture), "TEXTURE", 0, "Texture", ""},
84 {int(blender::bke::NodeColorTag::Vector), "VECTOR", 0, "Vector", ""},
85 {int(blender::bke::NodeColorTag::Pattern), "PATTERN", 0, "Pattern", ""},
86 {int(blender::bke::NodeColorTag::Interface), "INTERFACE", 0, "Interface", ""},
87 {int(blender::bke::NodeColorTag::Group), "GROUP", 0, "Group", ""},
88 {0, nullptr, 0, nullptr, nullptr},
89};
90
92 {NODE_MAPPING_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
94 "TEXTURE",
95 0,
96 "Texture",
97 "Transform a texture by inverse mapping the texture coordinate"},
99 "VECTOR",
100 0,
101 "Vector",
102 "Transform a direction vector (Location is ignored)"},
104 "NORMAL",
105 0,
106 "Normal",
107 "Transform a unit normal vector (Location is ignored)"},
108 {0, nullptr, 0, nullptr, nullptr},
109};
110
113 "AXIS_ANGLE",
114 0,
115 "Axis Angle",
116 "Rotate a point using axis angle"},
117 {NODE_VECTOR_ROTATE_TYPE_AXIS_X, "X_AXIS", 0, "X Axis", "Rotate a point using X axis"},
118 {NODE_VECTOR_ROTATE_TYPE_AXIS_Y, "Y_AXIS", 0, "Y Axis", "Rotate a point using Y axis"},
119 {NODE_VECTOR_ROTATE_TYPE_AXIS_Z, "Z_AXIS", 0, "Z Axis", "Rotate a point using Z axis"},
120 {NODE_VECTOR_ROTATE_TYPE_EULER_XYZ, "EULER_XYZ", 0, "Euler", "Rotate a point using XYZ order"},
121 {0, nullptr, 0, nullptr, nullptr},
122};
123
126 {NODE_MATH_ADD, "ADD", 0, "Add", "A + B"},
127 {NODE_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
128 {NODE_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "A * B"},
129 {NODE_MATH_DIVIDE, "DIVIDE", 0, "Divide", "A / B"},
130 {NODE_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
132 {NODE_MATH_POWER, "POWER", 0, "Power", "A power B"},
133 {NODE_MATH_LOGARITHM, "LOGARITHM", 0, "Logarithm", "Logarithm A base B"},
134 {NODE_MATH_SQRT, "SQRT", 0, "Square Root", "Square root of A"},
135 {NODE_MATH_INV_SQRT, "INVERSE_SQRT", 0, "Inverse Square Root", "1 / Square root of A"},
136 {NODE_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Magnitude of A"},
137 {NODE_MATH_EXPONENT, "EXPONENT", 0, "Exponent", "exp(A)"},
139 {NODE_MATH_MINIMUM, "MINIMUM", 0, "Minimum", "The minimum from A and B"},
140 {NODE_MATH_MAXIMUM, "MAXIMUM", 0, "Maximum", "The maximum from A and B"},
141 {NODE_MATH_LESS_THAN, "LESS_THAN", 0, "Less Than", "1 if A < B else 0"},
142 {NODE_MATH_GREATER_THAN, "GREATER_THAN", 0, "Greater Than", "1 if A > B else 0"},
143 {NODE_MATH_SIGN, "SIGN", 0, "Sign", "Returns the sign of A"},
144 {NODE_MATH_COMPARE, "COMPARE", 0, "Compare", "1 if (A == B) within tolerance C else 0"},
146 "SMOOTH_MIN",
147 0,
148 "Smooth Minimum",
149 "The minimum from A and B with smoothing C"},
151 "SMOOTH_MAX",
152 0,
153 "Smooth Maximum",
154 "The maximum from A and B with smoothing C"},
157 "ROUND",
158 0,
159 "Round",
160 "Round A to the nearest integer. Round upward if the fraction part is 0.5"},
161 {NODE_MATH_FLOOR, "FLOOR", 0, "Floor", "The largest integer smaller than or equal A"},
162 {NODE_MATH_CEIL, "CEIL", 0, "Ceil", "The smallest integer greater than or equal A"},
163 {NODE_MATH_TRUNC, "TRUNC", 0, "Truncate", "The integer part of A, removing fractional digits"},
165 {NODE_MATH_FRACTION, "FRACT", 0, "Fraction", "The fraction part of A"},
167 "MODULO",
168 0,
169 "Truncated Modulo",
170 "The remainder of truncated division using fmod(A,B)"},
172 "FLOORED_MODULO",
173 0,
174 "Floored Modulo",
175 "The remainder of floored division"},
176 {NODE_MATH_WRAP, "WRAP", 0, "Wrap", "Wrap value to range, wrap(A,B)"},
177 {NODE_MATH_SNAP, "SNAP", 0, "Snap", "Snap to increment, snap(A,B)"},
179 "PINGPONG",
180 0,
181 "Ping-Pong",
182 "Wraps a value and reverses every other cycle (A,B)"},
183 RNA_ENUM_ITEM_HEADING(CTX_N_(BLT_I18NCONTEXT_ID_NODETREE, "Trigonometric"), nullptr),
184 {NODE_MATH_SINE, "SINE", 0, "Sine", "sin(A)"},
185 {NODE_MATH_COSINE, "COSINE", 0, "Cosine", "cos(A)"},
186 {NODE_MATH_TANGENT, "TANGENT", 0, "Tangent", "tan(A)"},
188 {NODE_MATH_ARCSINE, "ARCSINE", 0, "Arcsine", "arcsin(A)"},
189 {NODE_MATH_ARCCOSINE, "ARCCOSINE", 0, "Arccosine", "arccos(A)"},
190 {NODE_MATH_ARCTANGENT, "ARCTANGENT", 0, "Arctangent", "arctan(A)"},
191 {NODE_MATH_ARCTAN2, "ARCTAN2", 0, "Arctan2", "The signed angle arctan(A / B)"},
193 {NODE_MATH_SINH, "SINH", 0, "Hyperbolic Sine", "sinh(A)"},
194 {NODE_MATH_COSH, "COSH", 0, "Hyperbolic Cosine", "cosh(A)"},
195 {NODE_MATH_TANH, "TANH", 0, "Hyperbolic Tangent", "tanh(A)"},
197 {NODE_MATH_RADIANS, "RADIANS", 0, "To Radians", "Convert from degrees to radians"},
198 {NODE_MATH_DEGREES, "DEGREES", 0, "To Degrees", "Convert from radians to degrees"},
199 {0, nullptr, 0, nullptr, nullptr},
200};
201
203 {NODE_VECTOR_MATH_ADD, "ADD", 0, "Add", "A + B"},
204 {NODE_VECTOR_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
205 {NODE_VECTOR_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "Entry-wise multiply"},
206 {NODE_VECTOR_MATH_DIVIDE, "DIVIDE", 0, "Divide", "Entry-wise divide"},
207 {NODE_VECTOR_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
209 {NODE_VECTOR_MATH_CROSS_PRODUCT, "CROSS_PRODUCT", 0, "Cross Product", "A cross B"},
210 {NODE_VECTOR_MATH_PROJECT, "PROJECT", 0, "Project", "Project A onto B"},
212 "REFLECT",
213 0,
214 "Reflect",
215 "Reflect A around the normal B. B doesn't need to be normalized."},
217 "REFRACT",
218 0,
219 "Refract",
220 "For a given incident vector A, surface normal B and ratio of indices of refraction, Ior, "
221 "refract returns the refraction vector, R"},
223 "FACEFORWARD",
224 0,
225 "Faceforward",
226 "Orients a vector A to point away from a surface B as defined by its normal C. "
227 "Returns (dot(B, C) < 0) ? A : -A"},
228 {NODE_VECTOR_MATH_DOT_PRODUCT, "DOT_PRODUCT", 0, "Dot Product", "A dot B"},
230 {NODE_VECTOR_MATH_DISTANCE, "DISTANCE", 0, "Distance", "Distance between A and B"},
231 {NODE_VECTOR_MATH_LENGTH, "LENGTH", 0, "Length", "Length of A"},
232 {NODE_VECTOR_MATH_SCALE, "SCALE", 0, "Scale", "A multiplied by Scale"},
233 {NODE_VECTOR_MATH_NORMALIZE, "NORMALIZE", 0, "Normalize", "Normalize A"},
235 {NODE_VECTOR_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Entry-wise absolute"},
236 {NODE_VECTOR_MATH_POWER, "POWER", 0, "Power", "Entry-wise power"},
237 {NODE_VECTOR_MATH_SIGN, "SIGN", 0, "Sign", "Entry-wise sign"},
238 {NODE_VECTOR_MATH_MINIMUM, "MINIMUM", 0, "Minimum", "Entry-wise minimum"},
239 {NODE_VECTOR_MATH_MAXIMUM, "MAXIMUM", 0, "Maximum", "Entry-wise maximum"},
240 {NODE_VECTOR_MATH_FLOOR, "FLOOR", 0, "Floor", "Entry-wise floor"},
241 {NODE_VECTOR_MATH_CEIL, "CEIL", 0, "Ceil", "Entry-wise ceil"},
242 {NODE_VECTOR_MATH_FRACTION, "FRACTION", 0, "Fraction", "The fraction part of A entry-wise"},
243 {NODE_VECTOR_MATH_MODULO, "MODULO", 0, "Modulo", "Entry-wise modulo using fmod(A,B)"},
244 {NODE_VECTOR_MATH_WRAP, "WRAP", 0, "Wrap", "Entry-wise wrap(A,B)"},
246 "SNAP",
247 0,
248 "Snap",
249 "Round A to the largest integer multiple of B less than or equal A"},
251 {NODE_VECTOR_MATH_SINE, "SINE", 0, "Sine", "Entry-wise sin(A)"},
252 {NODE_VECTOR_MATH_COSINE, "COSINE", 0, "Cosine", "Entry-wise cos(A)"},
253 {NODE_VECTOR_MATH_TANGENT, "TANGENT", 0, "Tangent", "Entry-wise tan(A)"},
254 {0, nullptr, 0, nullptr, nullptr},
255};
256
258 {NODE_BOOLEAN_MATH_AND, "AND", 0, "And", "True when both inputs are true"},
259 {NODE_BOOLEAN_MATH_OR, "OR", 0, "Or", "True when at least one input is true"},
260 {NODE_BOOLEAN_MATH_NOT, "NOT", 0, "Not", "Opposite of the input"},
262 {NODE_BOOLEAN_MATH_NAND, "NAND", 0, "Not And", "True when at least one input is false"},
263 {NODE_BOOLEAN_MATH_NOR, "NOR", 0, "Nor", "True when both inputs are false"},
265 "XNOR",
266 0,
267 "Equal",
268 "True when both inputs are equal (exclusive nor)"},
270 "XOR",
271 0,
272 "Not Equal",
273 "True when both inputs are different (exclusive or)"},
276 "IMPLY",
277 0,
278 "Imply",
279 "True unless the first input is true and the second is false"},
281 "NIMPLY",
282 0,
283 "Subtract",
284 "True when the first input is true and the second is false (not imply)"},
285 {0, nullptr, 0, nullptr, nullptr},
286};
287
290 "LESS_THAN",
291 0,
292 "Less Than",
293 "True when the first input is smaller than second input"},
295 "LESS_EQUAL",
296 0,
297 "Less Than or Equal",
298 "True when the first input is smaller than the second input or equal"},
300 "GREATER_THAN",
301 0,
302 "Greater Than",
303 "True when the first input is greater than the second input"},
305 "GREATER_EQUAL",
306 0,
307 "Greater Than or Equal",
308 "True when the first input is greater than the second input or equal"},
309 {NODE_COMPARE_EQUAL, "EQUAL", 0, "Equal", "True when both inputs are approximately equal"},
311 "NOT_EQUAL",
312 0,
313 "Not Equal",
314 "True when both inputs are not approximately equal"},
315 {0, nullptr, 0, nullptr, nullptr},
316};
317
320 {NODE_INTEGER_MATH_ADD, "ADD", 0, "Add", "A + B"},
321 {NODE_INTEGER_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
322 {NODE_INTEGER_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "A * B"},
323 {NODE_INTEGER_MATH_DIVIDE, "DIVIDE", 0, "Divide", "A / B"},
324 {NODE_INTEGER_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
326 {NODE_INTEGER_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Non-negative value of A, abs(A)"},
327 {NODE_INTEGER_MATH_NEGATE, "NEGATE", 0, "Negate", "-A"},
328 {NODE_INTEGER_MATH_POWER, "POWER", 0, "Power", "A power B, pow(A,B)"},
331 "MINIMUM",
332 0,
333 "Minimum",
334 "The minimum value from A and B, min(A,B)"},
336 "MAXIMUM",
337 0,
338 "Maximum",
339 "The maximum value from A and B, max(A,B)"},
340 {NODE_INTEGER_MATH_SIGN, "SIGN", 0, "Sign", "Return the sign of A, sign(A)"},
343 "DIVIDE_ROUND",
344 0,
345 "Divide Round",
346 "Divide and round result toward zero"},
348 "DIVIDE_FLOOR",
349 0,
350 "Divide Floor",
351 "Divide and floor result, the largest integer smaller than or equal A"},
353 "DIVIDE_CEIL",
354 0,
355 "Divide Ceiling",
356 "Divide and ceil result, the smallest integer greater than or equal A"},
359 "FLOORED_MODULO",
360 0,
361 "Floored Modulo",
362 "Modulo that is periodic for both negative and positive operands"},
363 {NODE_INTEGER_MATH_MODULO, "MODULO", 0, "Modulo", "Modulo which is the remainder of A / B"},
366 "GCD",
367 0,
368 "Greatest Common Divisor",
369 "The largest positive integer that divides into each of the values A and B, "
370 "e.g. GCD(8,12) = 4"},
372 "LCM",
373 0,
374 "Least Common Multiple",
375 "The smallest positive integer that is divisible by both A and B, e.g. LCM(6,10) = 30"},
376 {0, nullptr, 0, nullptr, nullptr},
377};
378
381 "LESS_THAN",
382 0,
383 "Less Than",
384 "True when the first input is smaller than second input"},
386 "LESS_EQUAL",
387 0,
388 "Less Than or Equal",
389 "True when the first input is smaller than the second input or equal"},
391 "GREATER_THAN",
392 0,
393 "Greater Than",
394 "True when the first input is greater than the second input"},
396 "GREATER_EQUAL",
397 0,
398 "Greater Than or Equal",
399 "True when the first input is greater than the second input or equal"},
400 {NODE_COMPARE_EQUAL, "EQUAL", 0, "Equal", "True when both inputs are approximately equal"},
402 "NOT_EQUAL",
403 0,
404 "Not Equal",
405 "True when both inputs are not approximately equal"},
407 "BRIGHTER",
408 0,
409 "Brighter",
410 "True when the first input is brighter"},
411 {NODE_COMPARE_COLOR_DARKER, "DARKER", 0, "Darker", "True when the first input is darker"},
412 {0, nullptr, 0, nullptr, nullptr},
413};
414
417 "ROUND",
418 0,
419 "Round",
420 "Round the float up or down to the nearest integer"},
422 "FLOOR",
423 0,
424 "Floor",
425 "Round the float down to the next smallest integer"},
427 "CEILING",
428 0,
429 "Ceiling",
430 "Round the float up to the next largest integer"},
432 "TRUNCATE",
433 0,
434 "Truncate",
435 "Round the float to the closest integer in the direction of zero (floor if positive; ceiling "
436 "if negative)"},
437 {0, nullptr, 0, nullptr, nullptr},
438};
439
442 "LINEAR",
443 0,
444 "Linear",
445 "Linear interpolation between From Min and From Max values"},
447 "STEPPED",
448 0,
449 "Stepped Linear",
450 "Stepped linear interpolation between From Min and From Max values"},
452 "SMOOTHSTEP",
453 0,
454 "Smooth Step",
455 "Smooth Hermite edge interpolation between From Min and From Max values"},
457 "SMOOTHERSTEP",
458 0,
459 "Smoother Step",
460 "Smoother Hermite edge interpolation between From Min and From Max values"},
461 {0, nullptr, 0, nullptr, nullptr},
462};
463
465 {NODE_CLAMP_MINMAX, "MINMAX", 0, "Min Max", "Constrain value between min and max"},
467 "RANGE",
468 0,
469 "Range",
470 "Constrain value between min and max, swapping arguments when min > max"},
471 {0, nullptr, 0, nullptr, nullptr},
472};
473
475 {1, "1D", 0, "1D", "Use the scalar value W as input"},
476 {2, "2D", 0, "2D", "Use the 2D vector (X, Y) as input. The Z component is ignored."},
477 {3, "3D", 0, "3D", "Use the 3D vector (X, Y, Z) as input"},
478 {4, "4D", 0, "4D", "Use the 4D vector (X, Y, Z, W) as input"},
479 {0, nullptr, 0, nullptr, nullptr},
480};
481
483 {0, "SOFTEN", 0, "Soften", ""},
484 {1, "SHARPEN", 0, "Box Sharpen", "An aggressive sharpening filter"},
485 {7, "SHARPEN_DIAMOND", 0, "Diamond Sharpen", "A moderate sharpening filter"},
486 {2, "LAPLACE", 0, "Laplace", ""},
487 {3, "SOBEL", 0, "Sobel", ""},
488 {4, "PREWITT", 0, "Prewitt", ""},
489 {5, "KIRSCH", 0, "Kirsch", ""},
490 {6, "SHADOW", 0, "Shadow", ""},
491 {0, nullptr, 0, nullptr, nullptr},
492};
493
496 "FREE",
497 ICON_HANDLE_FREE,
498 "Free",
499 "The handle can be moved anywhere, and doesn't influence the point's other handle"},
501 "AUTO",
502 ICON_HANDLE_AUTO,
503 "Auto",
504 "The location is automatically calculated to be smooth"},
506 "VECTOR",
507 ICON_HANDLE_VECTOR,
508 "Vector",
509 "The location is calculated to point to the next/previous control point"},
511 "ALIGN",
512 ICON_HANDLE_ALIGNED,
513 "Align",
514 "The location is constrained to point in the opposite direction as the other handle"},
515 {0, nullptr, 0, nullptr, nullptr}};
516
518 {GEO_NODE_CURVE_HANDLE_LEFT, "LEFT", ICON_NONE, "Left", "Use the left handles"},
519 {GEO_NODE_CURVE_HANDLE_RIGHT, "RIGHT", ICON_NONE, "Right", "Use the right handles"},
520 {0, nullptr, 0, nullptr, nullptr}};
521
524 "RGB",
525 ICON_NONE,
526 "RGB",
527 "Use RGB (Red, Green, Blue) color processing"},
529 "HSV",
530 ICON_NONE,
531 "HSV",
532 "Use HSV (Hue, Saturation, Value) color processing"},
534 "HSL",
535 ICON_NONE,
536 "HSL",
537 "Use HSL (Hue, Saturation, Lightness) color processing"},
538 {0, nullptr, 0, nullptr, nullptr},
539};
540
542 {SOCK_FLOAT, "FLOAT", 0, "Float", ""},
543 {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
544 {SOCK_RGBA, "RGBA", 0, "Color", ""},
545 {SOCK_ROTATION, "ROTATION", 0, "Rotation", ""},
546 {0, nullptr, 0, nullptr, nullptr},
547};
548
550 {GEO_NODE_MESH_CIRCLE_FILL_NONE, "NONE", 0, "None", ""},
551 {GEO_NODE_MESH_CIRCLE_FILL_NGON, "NGON", 0, "N-Gon", ""},
552 {GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN, "TRIANGLE_FAN", 0, "Triangles", ""},
553 {0, nullptr, 0, nullptr, nullptr},
554};
555
557 {GEO_NODE_GIZMO_COLOR_PRIMARY, "PRIMARY", 0, "Primary", ""},
558 {GEO_NODE_GIZMO_COLOR_SECONDARY, "SECONDARY", 0, "Secondary", ""},
559 {GEO_NODE_GIZMO_COLOR_X, "X", 0, "X", ""},
560 {GEO_NODE_GIZMO_COLOR_Y, "Y", 0, "Y", ""},
561 {GEO_NODE_GIZMO_COLOR_Z, "Z", 0, "Z", ""},
562 {0, nullptr, 0, nullptr, nullptr},
563};
564
566 {GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_ARROW, "ARROW", 0, "Arrow", ""},
567 {GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_CROSS, "CROSS", 0, "Cross", ""},
568 {GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_BOX, "BOX", 0, "Box", ""},
569 {0, nullptr, 0, nullptr, nullptr},
570};
571
572#ifndef RNA_RUNTIME
574 {CMP_NODE_INTERPOLATION_NEAREST, "NEAREST", 0, "Nearest", "Use Nearest interpolation"},
575 {CMP_NODE_INTERPOLATION_BILINEAR, "BILINEAR", 0, "Bilinear", "Use Bilinear interpolation"},
576 {CMP_NODE_INTERPOLATION_BICUBIC, "BICUBIC", 0, "Bicubic", "Use Cubic B-Spline interpolation"},
577 {0, nullptr, 0, nullptr, nullptr},
578};
579
582 "ALL",
583 0,
584 "All",
585 "Use shaders for all renderers and viewports, unless there exists a more specific output"},
586 {SHD_OUTPUT_EEVEE, "EEVEE", 0, "EEVEE", "Use shaders for EEVEE renderer"},
587 {SHD_OUTPUT_CYCLES, "CYCLES", 0, "Cycles", "Use shaders for Cycles renderer"},
588 {0, nullptr, 0, nullptr, nullptr},
589};
590
592 {0, "CryptoObject", 0, "Object", "Use Object layer"},
593 {1, "CryptoMaterial", 0, "Material", "Use Material layer"},
594 {2, "CryptoAsset", 0, "Asset", "Use Asset layer"},
595 {0, nullptr, 0, nullptr, nullptr},
596};
597
598#endif /* !RNA_RUNTIME */
599
600#undef ITEM_ATTRIBUTE
601#undef ITEM_FLOAT
602#undef ITEM_VECTOR
603#undef ITEM_COLOR
604#undef ITEM_BOOLEAN
605
606#ifdef RNA_RUNTIME
607
608# include <fmt/format.h>
609
610# include "BLI_string.h"
611# include "BLI_string_utf8.h"
612
613# include "BKE_context.hh"
614# include "BKE_cryptomatte.hh"
615# include "BKE_global.hh"
616# include "BKE_image.hh"
617# include "BKE_main_invariants.hh"
618# include "BKE_node_legacy_types.hh"
619# include "BKE_node_runtime.hh"
620# include "BKE_node_tree_update.hh"
621# include "BKE_report.hh"
622# include "BKE_scene.hh"
623# include "BKE_texture.h"
624
625# include "BLF_api.hh"
626
627# include "ED_node.hh"
628# include "ED_render.hh"
629
630# include "GPU_material.hh"
631
632# include "NOD_common.hh"
633# include "NOD_composite.hh"
634# include "NOD_fn_format_string.hh"
635# include "NOD_geo_bake.hh"
636# include "NOD_geo_bundle.hh"
638# include "NOD_geo_closure.hh"
640# include "NOD_geo_index_switch.hh"
641# include "NOD_geo_menu_switch.hh"
642# include "NOD_geo_repeat.hh"
643# include "NOD_geo_simulation.hh"
644# include "NOD_geometry.hh"
646# include "NOD_shader.h"
647# include "NOD_socket.hh"
648# include "NOD_socket_items.hh"
649# include "NOD_texture.h"
650
651# include "RE_engine.h"
652# include "RE_pipeline.h"
653# include "RE_texture.h"
654
655# include "DNA_scene_types.h"
656# include "DNA_text_types.h"
657
658# include "WM_api.hh"
659
660# include "DEG_depsgraph_query.hh"
661
662using blender::float2;
679
680extern FunctionRNA rna_NodeTree_poll_func;
681extern FunctionRNA rna_NodeTree_update_func;
682extern FunctionRNA rna_NodeTree_get_from_context_func;
683extern FunctionRNA rna_NodeTree_valid_socket_type_func;
684extern FunctionRNA rna_Node_poll_func;
685extern FunctionRNA rna_Node_poll_instance_func;
686extern FunctionRNA rna_Node_update_func;
687extern FunctionRNA rna_Node_insert_link_func;
688extern FunctionRNA rna_Node_init_func;
689extern FunctionRNA rna_Node_copy_func;
690extern FunctionRNA rna_Node_free_func;
691extern FunctionRNA rna_Node_draw_buttons_func;
692extern FunctionRNA rna_Node_draw_buttons_ext_func;
693extern FunctionRNA rna_Node_draw_label_func;
694
695void rna_Node_socket_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr);
696
697int rna_node_tree_idname_to_enum(const char *idname)
698{
699 using namespace blender;
701 for (const int i : types.index_range()) {
702 const bke::bNodeTreeType *nt = types[i];
703 if (nt->idname == idname) {
704 return i;
705 }
706 }
707 return -1;
708}
709
711{
713 return types.index_range().contains(value) ? types[value] : nullptr;
714}
715
717 void *data, bool (*poll)(void *data, blender::bke::bNodeTreeType *), bool *r_free)
718{
719 using namespace blender;
720 EnumPropertyItem tmp = {0};
721 EnumPropertyItem *item = nullptr;
722 int totitem = 0;
723
725 for (const int i : types.index_range()) {
727 if (poll && !poll(data, nt)) {
728 continue;
729 }
730
731 tmp.value = i;
732 tmp.identifier = nt->idname.c_str();
733 tmp.icon = nt->ui_icon;
734 tmp.name = nt->ui_name.c_str();
735 tmp.description = nt->ui_description.c_str();
736
737 RNA_enum_item_add(&item, &totitem, &tmp);
738 }
739
740 if (totitem == 0) {
741 *r_free = false;
743 }
744
745 RNA_enum_item_end(&item, &totitem);
746 *r_free = true;
747
748 return item;
749}
750
751int rna_node_socket_idname_to_enum(const char *idname)
752{
753 using namespace blender;
754
756
757 /* Regular socket types use the base type as their enum value.
758 * Custom sockets don't have a base type and are used directly as the enum entry. */
759 if (socket_type->type == SOCK_CUSTOM) {
760 return bke::node_socket_types_get().first_index(socket_type);
761 }
762
763 bke::bNodeSocketType *base_socket_type = bke::node_socket_type_find_static(socket_type->type,
764 PROP_NONE);
765 BLI_assert(base_socket_type != nullptr);
766 return bke::node_socket_types_get().first_index(base_socket_type);
767}
768
770{
772 return types.index_range().contains(value) ? types[value] : nullptr;
773}
774
776 void *data, bool (*poll)(void *data, blender::bke::bNodeSocketType *), bool *r_free)
777{
778 using namespace blender;
779 EnumPropertyItem *item = nullptr;
780 EnumPropertyItem tmp = {0};
781 int totitem = 0;
782 StructRNA *srna;
783
785 for (const int i : types.index_range()) {
786 bke::bNodeSocketType *stype = types[i];
787 if (poll && !poll(data, stype)) {
788 continue;
789 }
790
791 srna = stype->ext_socket.srna;
792 tmp.value = i;
793 tmp.identifier = stype->idname.c_str();
794 tmp.icon = RNA_struct_ui_icon(srna);
797
798 RNA_enum_item_add(&item, &totitem, &tmp);
799 }
800
801 if (totitem == 0) {
802 *r_free = false;
804 }
805
806 RNA_enum_item_end(&item, &totitem);
807 *r_free = true;
808
809 return item;
810}
811
812static const char *get_legacy_node_type(const PointerRNA *ptr)
813{
814 const bNode *node = ptr->data_as<bNode>();
815 const blender::bke::bNodeType *ntype = node->typeinfo;
816 if (ntype->type_legacy == NODE_CUSTOM) {
817 return "CUSTOM";
818 }
819 if (ntype->type_legacy == NODE_CUSTOM_GROUP) {
820 return "CUSTOM GROUP";
821 }
822 if (ntype->type_legacy == NODE_UNDEFINED) {
823 return "UNDEFINED";
824 }
825 if (ntype->enum_name_legacy) {
826 return ntype->enum_name_legacy;
827 }
828 return ntype->idname.c_str();
829}
830
831static int rna_node_type_length(PointerRNA *ptr)
832{
833 const char *legacy_type = get_legacy_node_type(ptr);
834 BLI_assert(legacy_type);
835 return strlen(legacy_type);
836}
837
838static void rna_node_type_get(PointerRNA *ptr, char *value)
839{
840 const char *legacy_type = get_legacy_node_type(ptr);
841 BLI_assert(legacy_type);
842 strcpy(value, legacy_type);
843}
844
845static void rna_Node_bl_idname_get(PointerRNA *ptr, char *value)
846{
847 const bNode *node = ptr->data_as<bNode>();
848 const blender::bke::bNodeType *ntype = node->typeinfo;
849 blender::StringRef(ntype->idname).copy_unsafe(value);
850}
851
852static int rna_Node_bl_idname_length(PointerRNA *ptr)
853{
854 const bNode *node = ptr->data_as<bNode>();
855 const blender::bke::bNodeType *ntype = node->typeinfo;
856 return ntype->idname.size();
857}
858
859static void rna_Node_bl_idname_set(PointerRNA *ptr, const char *value)
860{
861 bNode *node = ptr->data_as<bNode>();
862 blender::bke::bNodeType *ntype = node->typeinfo;
863 ntype->idname = value;
864}
865
866static void rna_Node_bl_label_get(PointerRNA *ptr, char *value)
867{
868 const bNode *node = ptr->data_as<bNode>();
869 const blender::bke::bNodeType *ntype = node->typeinfo;
870 blender::StringRef(ntype->ui_name).copy_unsafe(value);
871}
872
873static int rna_Node_bl_label_length(PointerRNA *ptr)
874{
875 const bNode *node = ptr->data_as<bNode>();
876 const blender::bke::bNodeType *ntype = node->typeinfo;
877 return ntype->ui_name.size();
878}
879
880static void rna_Node_bl_label_set(PointerRNA *ptr, const char *value)
881{
882 bNode *node = ptr->data_as<bNode>();
883 blender::bke::bNodeType *ntype = node->typeinfo;
884 ntype->ui_name = value;
885}
886
887static void rna_Node_bl_description_get(PointerRNA *ptr, char *value)
888{
889 const bNode *node = ptr->data_as<bNode>();
890 const blender::bke::bNodeType *ntype = node->typeinfo;
891 blender::StringRef(ntype->ui_description).copy_unsafe(value);
892}
893
894static int rna_Node_bl_description_length(PointerRNA *ptr)
895{
896 const bNode *node = ptr->data_as<bNode>();
897 const blender::bke::bNodeType *ntype = node->typeinfo;
898 return ntype->ui_description.size();
899}
900
901static void rna_Node_bl_description_set(PointerRNA *ptr, const char *value)
902{
903 bNode *node = ptr->data_as<bNode>();
904 blender::bke::bNodeType *ntype = node->typeinfo;
905 ntype->ui_description = value;
906}
907
908static float2 node_parent_offset(const bNode &node)
909{
910 return node.parent ? float2(node.parent->location[0], node.parent->location[1]) : float2(0);
911}
912
913static void rna_Node_location_get(PointerRNA *ptr, float *value)
914{
915 const bNode *node = ptr->data_as<bNode>();
916 copy_v2_v2(value, float2(node->location[0], node->location[1]) - node_parent_offset(*node));
917}
918
919static void move_child_nodes(bNode &node, const float2 &delta)
920{
921 for (bNode *child : node.direct_children_in_frame()) {
922 child->location[0] += delta.x;
923 child->location[1] += delta.y;
924 if (child->is_frame()) {
925 move_child_nodes(*child, delta);
926 }
927 }
928}
929
930static void rna_Node_location_set(PointerRNA *ptr, const float *value)
931{
932 bNode *node = ptr->data_as<bNode>();
933 const float2 new_location = float2(value) + node_parent_offset(*node);
934 if (node->is_frame()) {
935 move_child_nodes(*node, new_location - float2(node->location[0], node->location[1]));
936 }
937 node->location[0] = new_location.x;
938 node->location[1] = new_location.y;
939}
940
941/* ******** Node Tree ******** */
942
943static StructRNA *rna_NodeTree_refine(PointerRNA *ptr)
944{
945 bNodeTree *ntree = ptr->data_as<bNodeTree>();
946
947 if (ntree->typeinfo->rna_ext.srna) {
948 return ntree->typeinfo->rna_ext.srna;
949 }
950 else {
951 return &RNA_NodeTree;
952 }
953}
954
955static bool rna_NodeTree_poll(const bContext *C, blender::bke::bNodeTreeType *ntreetype)
956{
957 ParameterList list;
958 FunctionRNA *func;
959 void *ret;
960 bool visible;
961
963 nullptr, ntreetype->rna_ext.srna, nullptr); /* dummy */
964 func = &rna_NodeTree_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
965
966 RNA_parameter_list_create(&list, &ptr, func);
967 RNA_parameter_set_lookup(&list, "context", &C);
968 ntreetype->rna_ext.call(const_cast<bContext *>(C), &ptr, func, &list);
969
970 RNA_parameter_get_lookup(&list, "visible", &ret);
971 visible = *static_cast<bool *>(ret);
972
974
975 return visible;
976}
977
978static void rna_NodeTree_update_reg(bNodeTree *ntree)
979{
980 ParameterList list;
981 FunctionRNA *func;
982
984 func = &rna_NodeTree_update_func; /* RNA_struct_find_function(&ptr, "update"); */
985
986 RNA_parameter_list_create(&list, &ptr, func);
987 ntree->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
988
990}
991
992static void rna_NodeTree_get_from_context(const bContext *C,
994 bNodeTree **r_ntree,
995 ID **r_id,
996 ID **r_from)
997{
998 ParameterList list;
999 FunctionRNA *func;
1000 void *ret1, *ret2, *ret3;
1001
1003 nullptr, ntreetype->rna_ext.srna, nullptr); /* dummy */
1004 // RNA_struct_find_function(&ptr, "get_from_context");
1005 func = &rna_NodeTree_get_from_context_func;
1006
1007 RNA_parameter_list_create(&list, &ptr, func);
1008 RNA_parameter_set_lookup(&list, "context", &C);
1009 ntreetype->rna_ext.call(const_cast<bContext *>(C), &ptr, func, &list);
1010
1011 RNA_parameter_get_lookup(&list, "result_1", &ret1);
1012 RNA_parameter_get_lookup(&list, "result_2", &ret2);
1013 RNA_parameter_get_lookup(&list, "result_3", &ret3);
1014 *r_ntree = *(bNodeTree **)ret1;
1015 *r_id = *(ID **)ret2;
1016 *r_from = *(ID **)ret3;
1017
1019}
1020
1021static bool rna_NodeTree_valid_socket_type(blender::bke::bNodeTreeType *ntreetype,
1022 blender::bke::bNodeSocketType *socket_type)
1023{
1024 ParameterList list;
1025 FunctionRNA *func;
1026 void *ret;
1027 bool valid;
1028
1030 nullptr, ntreetype->rna_ext.srna, nullptr); /* dummy */
1031 func = &rna_NodeTree_valid_socket_type_func;
1032
1033 RNA_parameter_list_create(&list, &ptr, func);
1034 RNA_parameter_set_lookup(&list, "idname", socket_type->idname.c_str());
1035 ntreetype->rna_ext.call(nullptr, &ptr, func, &list);
1036
1037 RNA_parameter_get_lookup(&list, "valid", &ret);
1038 valid = *static_cast<bool *>(ret);
1039
1041
1042 return valid;
1043}
1044
1045static bool rna_NodeTree_unregister(Main *bmain, StructRNA *type)
1046{
1049
1050 if (!nt) {
1051 return false;
1052 }
1053
1056
1058
1059 /* update while blender is running */
1062 return true;
1063}
1064
1065static StructRNA *rna_NodeTree_register(Main *bmain,
1067 void *data,
1068 const char *identifier,
1069 StructValidateFunc validate,
1070 StructCallbackFunc call,
1072{
1074 bNodeTree dummy_ntree = {};
1075 bool have_function[4];
1076
1077 /* setup dummy tree & tree type to store static properties in */
1078 blender::bke::bNodeTreeType dummy_nt = {};
1079 dummy_ntree.typeinfo = &dummy_nt;
1080 PointerRNA dummy_ntree_ptr = RNA_pointer_create_discrete(nullptr, &RNA_NodeTree, &dummy_ntree);
1081
1082 /* validate the python class */
1083 if (validate(&dummy_ntree_ptr, data, have_function) != 0) {
1084 return nullptr;
1085 }
1086
1087 if (strlen(identifier) >= sizeof(dummy_ntree.idname)) {
1089 RPT_ERROR,
1090 "Registering node tree class: '%s' is too long, maximum length is %d",
1091 identifier,
1092 int(sizeof(dummy_ntree.idname)));
1093 return nullptr;
1094 }
1095
1096 /* check if we have registered this tree type before, and remove it */
1098 if (nt) {
1100 RPT_INFO,
1101 "Registering node tree class: '%s', bl_idname '%s' has been registered before, "
1102 "unregistering previous",
1103 identifier,
1104 dummy_nt.idname.c_str());
1105
1106 /* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for nullptr. */
1107 if (!rna_NodeTree_unregister(bmain, nt->rna_ext.srna)) {
1109 RPT_ERROR,
1110 "Registering node tree class: '%s', bl_idname '%s' could not be unregistered",
1111 identifier,
1112 dummy_nt.idname.c_str());
1113 return nullptr;
1114 }
1115 }
1116
1117 /* create a new node tree type */
1118 nt = MEM_new<blender::bke::bNodeTreeType>(__func__, dummy_nt);
1119
1120 nt->type = NTREE_CUSTOM;
1121
1122 nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname.c_str(), &RNA_NodeTree);
1123 nt->rna_ext.data = data;
1124 nt->rna_ext.call = call;
1125 nt->rna_ext.free = free;
1127
1128 RNA_def_struct_ui_text(nt->rna_ext.srna, nt->ui_name.c_str(), nt->ui_description.c_str());
1130
1131 nt->poll = (have_function[0]) ? rna_NodeTree_poll : nullptr;
1132 nt->update = (have_function[1]) ? rna_NodeTree_update_reg : nullptr;
1133 nt->get_from_context = (have_function[2]) ? rna_NodeTree_get_from_context : nullptr;
1134 nt->valid_socket_type = (have_function[3]) ? rna_NodeTree_valid_socket_type : nullptr;
1135
1137
1138 /* update while blender is running */
1141 return nt->rna_ext.srna;
1142}
1143
1144static bool rna_NodeTree_check(bNodeTree *ntree, ReportList *reports)
1145{
1147 if (reports) {
1149 RPT_ERROR,
1150 "Node tree '%s' has undefined type %s",
1151 ntree->id.name + 2,
1152 ntree->idname);
1153 }
1154 return false;
1155 }
1156 else {
1157 return true;
1158 }
1159}
1160
1161static void rna_NodeTree_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
1162{
1163 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
1164
1167
1168 BKE_main_ensure_invariants(*bmain, ntree->id);
1169}
1170
1171static void rna_NodeTree_update_asset(Main *bmain, Scene *scene, PointerRNA *ptr)
1172{
1173 rna_NodeTree_update(bmain, scene, ptr);
1175 blender::bke::node_update_asset_metadata(*reinterpret_cast<bNodeTree *>(ptr->owner_id));
1176}
1177
1178static const EnumPropertyItem *rna_NodeTree_color_tag_itemf(bContext * /*C*/,
1179 PointerRNA *ptr,
1180 PropertyRNA * /*prop*/,
1181 bool *r_free)
1182{
1183 const bNodeTree &ntree = *reinterpret_cast<const bNodeTree *>(ptr->owner_id);
1184
1185 EnumPropertyItem *items = nullptr;
1186 int items_num = 0;
1187
1188 for (const EnumPropertyItem *item = rna_enum_node_color_tag_items; item->identifier; item++) {
1189 switch (blender::bke::NodeColorTag(item->value)) {
1192 if (ntree.type == NTREE_GEOMETRY) {
1193 RNA_enum_item_add(&items, &items_num, item);
1194 }
1195 break;
1196 }
1199 if (ntree.type == NTREE_SHADER) {
1200 RNA_enum_item_add(&items, &items_num, item);
1201 }
1202 break;
1203 }
1207 if (ntree.type == NTREE_COMPOSIT) {
1208 RNA_enum_item_add(&items, &items_num, item);
1209 }
1210 break;
1211 }
1215 break;
1216 }
1217 default: {
1218 RNA_enum_item_add(&items, &items_num, item);
1219 break;
1220 }
1221 }
1222 }
1223
1224 RNA_enum_item_end(&items, &items_num);
1225
1226 *r_free = true;
1227 return items;
1228}
1229
1230static bNode *rna_NodeTree_node_new(bNodeTree *ntree,
1231 bContext *C,
1234{
1236 bNode *node;
1237
1238 if (!rna_NodeTree_check(ntree, reports)) {
1239 return nullptr;
1240 }
1241
1242 /* If the given idname is an alias, translate it to the proper idname. */
1244
1245 ntype = blender::bke::node_type_find(type);
1246 if (!ntype) {
1247 BKE_reportf(reports, RPT_ERROR, "Node type %s undefined", type.c_str());
1248 return nullptr;
1249 }
1250
1251 const char *disabled_hint = nullptr;
1252 if (ntype->poll && !ntype->poll(ntype, ntree, &disabled_hint)) {
1253 if (disabled_hint) {
1255 RPT_ERROR,
1256 "Cannot add node of type %s to node tree '%s'\n %s",
1257 type.c_str(),
1258 ntree->id.name + 2,
1259 disabled_hint);
1260 return nullptr;
1261 }
1262 else {
1264 RPT_ERROR,
1265 "Cannot add node of type %s to node tree '%s'",
1266 type.c_str(),
1267 ntree->id.name + 2);
1268 return nullptr;
1269 }
1270 }
1271
1272 node = blender::bke::node_add_node(C, *ntree, type);
1273 BLI_assert(node && node->typeinfo);
1274
1275 if (ntree->type == NTREE_TEXTURE) {
1276 ntreeTexCheckCyclics(ntree);
1277 }
1278
1279 Main *bmain = CTX_data_main(C);
1280 BKE_main_ensure_invariants(*bmain, ntree->id);
1282
1283 return node;
1284}
1285
1286static void rna_NodeTree_node_remove(bNodeTree *ntree,
1287 Main *bmain,
1289 PointerRNA *node_ptr)
1290{
1291 bNode *node = node_ptr->data_as<bNode>();
1292
1293 if (!rna_NodeTree_check(ntree, reports)) {
1294 return;
1295 }
1296
1297 if (BLI_findindex(&ntree->nodes, node) == -1) {
1298 BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name);
1299 return;
1300 }
1301
1302 blender::bke::node_remove_node(bmain, *ntree, *node, true);
1303
1304 node_ptr->invalidate();
1305
1306 BKE_main_ensure_invariants(*bmain, ntree->id);
1308}
1309
1310static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1311{
1312 bNode *node = static_cast<bNode *>(ntree->nodes.first);
1313
1314 if (!rna_NodeTree_check(ntree, reports)) {
1315 return;
1316 }
1317
1318 while (node) {
1319 bNode *next_node = node->next;
1320
1321 blender::bke::node_remove_node(bmain, *ntree, *node, true);
1322
1323 node = next_node;
1324 }
1325
1326 BKE_main_ensure_invariants(*bmain, ntree->id);
1328}
1329
1330static PointerRNA rna_NodeTree_active_node_get(PointerRNA *ptr)
1331{
1332 bNodeTree *ntree = ptr->data_as<bNodeTree>();
1333 bNode *node = blender::bke::node_get_active(*ntree);
1334 return RNA_pointer_create_with_parent(*ptr, &RNA_Node, node);
1335}
1336
1337static void rna_NodeTree_active_node_set(PointerRNA *ptr,
1338 const PointerRNA value,
1339 ReportList * /*reports*/)
1340{
1341 bNodeTree *ntree = ptr->data_as<bNodeTree>();
1342 bNode *node = static_cast<bNode *>(value.data);
1343
1344 if (node && BLI_findindex(&ntree->nodes, node) != -1) {
1345 blender::bke::node_set_active(*ntree, *node);
1346
1347 /* Handle NODE_DO_OUTPUT as well. */
1348 if (node->typeinfo->nclass == NODE_CLASS_OUTPUT && node->type_legacy != CMP_NODE_OUTPUT_FILE) {
1349 /* If this node becomes the active output, the others of the same type can't be the active
1350 * output anymore. */
1351 for (bNode *other_node : ntree->all_nodes()) {
1352 if (other_node->type_legacy == node->type_legacy) {
1353 other_node->flag &= ~NODE_DO_OUTPUT;
1354 }
1355 }
1356 node->flag |= NODE_DO_OUTPUT;
1359 }
1360 }
1361 else {
1363 }
1364}
1365
1366static void node_viewer_set_shortcut_fn(bNode *node, bNodeTree &ntree, int value)
1367{
1368 /* Avoid having two nodes with the same shortcut. */
1369 for (bNode *other_node : ntree.all_nodes()) {
1370 if ((other_node->is_type("CompositorNodeViewer") ||
1371 other_node->is_type("GeometryNodeViewer")) &&
1372 other_node->custom1 == value)
1373 {
1374 other_node->custom1 = NODE_VIEWER_SHORTCUT_NONE;
1375 }
1376 }
1377 node->custom1 = value;
1378}
1379
1380void rna_Node_Viewer_shortcut_node_set(PointerRNA *ptr, PropertyRNA * /*prop*/, int value)
1381{
1382 bNode *curr_node = ptr->data_as<bNode>();
1383 bNodeTree &ntree = curr_node->owner_tree();
1384
1385 node_viewer_set_shortcut_fn(curr_node, ntree, value);
1386}
1387
1389{
1390 bNode *curr_node = ptr->data_as<bNode>();
1391 return curr_node->custom1;
1392}
1393
1395{
1396 bNode *curr_node = ptr->data_as<bNode>();
1397 bNodeTree &ntree = curr_node->owner_tree();
1398
1399 node_viewer_set_shortcut_fn(curr_node, ntree, value);
1400}
1401
1402static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree,
1403 Main *bmain,
1405 bNodeSocket *fromsock,
1406 bNodeSocket *tosock,
1407 bool verify_limits,
1408 bool handle_dynamic_sockets)
1409{
1410 if (!rna_NodeTree_check(ntree, reports)) {
1411 return nullptr;
1412 }
1413
1414 bNode *fromnode = blender::bke::node_find_node_try(*ntree, *fromsock);
1415 bNode *tonode = blender::bke::node_find_node_try(*ntree, *tosock);
1416 /* check validity of the sockets:
1417 * if sockets from different trees are passed in this will fail!
1418 */
1419 if (!fromnode || !tonode) {
1420 return nullptr;
1421 }
1422
1423 if (fromsock->in_out == tosock->in_out) {
1424 BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets");
1425 return nullptr;
1426 }
1427
1428 if (fromsock->in_out == SOCK_IN) {
1429 std::swap(fromsock, tosock);
1430 std::swap(fromnode, tonode);
1431 }
1432
1433 if (handle_dynamic_sockets) {
1434 bNodeLink new_link{};
1435 new_link.fromnode = fromnode;
1436 new_link.fromsock = fromsock;
1437 new_link.tonode = tonode;
1438 new_link.tosock = tosock;
1439
1440 if (fromnode->typeinfo->insert_link) {
1441 if (!fromnode->typeinfo->insert_link(ntree, fromnode, &new_link)) {
1442 return nullptr;
1443 }
1444 }
1445 if (tonode->typeinfo->insert_link) {
1446 if (!tonode->typeinfo->insert_link(ntree, tonode, &new_link)) {
1447 return nullptr;
1448 }
1449 }
1450
1451 fromsock = new_link.fromsock;
1452 tosock = new_link.tosock;
1453 }
1454
1455 if (verify_limits) {
1456 /* remove other socket links if limit is exceeded */
1457 if (blender::bke::node_count_socket_links(*ntree, *fromsock) + 1 >
1459 {
1460 blender::bke::node_remove_socket_links(*ntree, *fromsock);
1461 }
1462 if (blender::bke::node_count_socket_links(*ntree, *tosock) + 1 >
1464 {
1466 }
1467 if (tosock->flag & SOCK_MULTI_INPUT) {
1468 LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
1469 if (link->fromsock == fromsock && link->tosock == tosock) {
1470 blender::bke::node_remove_link(ntree, *link);
1471 }
1472 }
1473 }
1474 }
1475
1476 bNodeLink &ret = blender::bke::node_add_link(*ntree, *fromnode, *fromsock, *tonode, *tosock);
1477
1478 /* not an issue from the UI, clear hidden from API to keep valid state. */
1479 fromsock->flag &= ~SOCK_HIDDEN;
1480 tosock->flag &= ~SOCK_HIDDEN;
1481
1482 BKE_main_ensure_invariants(*bmain, ntree->id);
1484
1485 return &ret;
1486}
1487
1488static void rna_NodeTree_link_remove(bNodeTree *ntree,
1489 Main *bmain,
1491 PointerRNA *link_ptr)
1492{
1493 bNodeLink *link = link_ptr->data_as<bNodeLink>();
1494
1495 if (!rna_NodeTree_check(ntree, reports)) {
1496 return;
1497 }
1498
1499 if (BLI_findindex(&ntree->links, link) == -1) {
1500 BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree");
1501 return;
1502 }
1503
1504 blender::bke::node_remove_link(ntree, *link);
1505 link_ptr->invalidate();
1506
1507 BKE_main_ensure_invariants(*bmain, ntree->id);
1509}
1510
1511static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1512{
1513 bNodeLink *link = static_cast<bNodeLink *>(ntree->links.first);
1514
1515 if (!rna_NodeTree_check(ntree, reports)) {
1516 return;
1517 }
1518
1519 while (link) {
1520 bNodeLink *next_link = link->next;
1521
1522 blender::bke::node_remove_link(ntree, *link);
1523
1524 link = next_link;
1525 }
1526 BKE_main_ensure_invariants(*bmain, ntree->id);
1528}
1529
1530static bool rna_NodeTree_contains_tree(bNodeTree *tree, bNodeTree *sub_tree)
1531{
1532 return blender::bke::node_tree_contains_tree(*tree, *sub_tree);
1533}
1534
1535static void rna_NodeTree_bl_idname_get(PointerRNA *ptr, char *value)
1536{
1537 const bNodeTree *node = ptr->data_as<bNodeTree>();
1538 const blender::bke::bNodeTreeType *ntype = node->typeinfo;
1539 blender::StringRef(ntype->idname).copy_unsafe(value);
1540}
1541
1542static int rna_NodeTree_bl_idname_length(PointerRNA *ptr)
1543{
1544 const bNodeTree *node = ptr->data_as<bNodeTree>();
1545 const blender::bke::bNodeTreeType *ntype = node->typeinfo;
1546 return ntype->idname.size();
1547}
1548
1549static void rna_NodeTree_bl_idname_set(PointerRNA *ptr, const char *value)
1550{
1551 bNodeTree *node = ptr->data_as<bNodeTree>();
1553 ntype->idname = value;
1554}
1555
1556static void rna_NodeTree_bl_label_get(PointerRNA *ptr, char *value)
1557{
1558 const bNodeTree *node = ptr->data_as<bNodeTree>();
1559 const blender::bke::bNodeTreeType *ntype = node->typeinfo;
1560 blender::StringRef(ntype->ui_name).copy_unsafe(value);
1561}
1562
1563static int rna_NodeTree_bl_label_length(PointerRNA *ptr)
1564{
1565 const bNodeTree *node = ptr->data_as<bNodeTree>();
1566 const blender::bke::bNodeTreeType *ntype = node->typeinfo;
1567 return ntype->ui_name.size();
1568}
1569
1570static void rna_NodeTree_bl_label_set(PointerRNA *ptr, const char *value)
1571{
1572 bNodeTree *node = ptr->data_as<bNodeTree>();
1574 ntype->ui_name = value;
1575}
1576
1577static void rna_NodeTree_bl_description_get(PointerRNA *ptr, char *value)
1578{
1579 const bNodeTree *node = ptr->data_as<bNodeTree>();
1580 const blender::bke::bNodeTreeType *ntype = node->typeinfo;
1581 blender::StringRef(ntype->ui_description).copy_unsafe(value);
1582}
1583
1584static int rna_NodeTree_bl_description_length(PointerRNA *ptr)
1585{
1586 const bNodeTree *node = ptr->data_as<bNodeTree>();
1587 const blender::bke::bNodeTreeType *ntype = node->typeinfo;
1588 return ntype->ui_description.size();
1589}
1590
1591static void rna_NodeTree_bl_description_set(PointerRNA *ptr, const char *value)
1592{
1593 bNodeTree *node = ptr->data_as<bNodeTree>();
1595 ntype->ui_description = value;
1596}
1597
1598static void rna_NodeTree_debug_lazy_function_graph(bNodeTree *tree,
1599 bContext *C,
1600 const char **r_str,
1601 int *r_len)
1602{
1603 *r_len = 0;
1604 *r_str = nullptr;
1605 if (DEG_is_original(tree)) {
1606 /* The graph is only stored on the evaluated data. */
1609 }
1610 std::lock_guard lock{tree->runtime->geometry_nodes_lazy_function_graph_info_mutex};
1611 if (!tree->runtime->geometry_nodes_lazy_function_graph_info) {
1612 return;
1613 }
1614 std::string dot_str = tree->runtime->geometry_nodes_lazy_function_graph_info->graph.to_dot();
1615 *r_str = BLI_strdup(dot_str.c_str());
1616 *r_len = dot_str.size();
1617}
1618
1619static void rna_NodeTree_debug_zone_body_lazy_function_graph(
1620 ID *tree_id, bNode *node, bContext *C, const char **r_str, int *r_len)
1621{
1622 *r_len = 0;
1623 *r_str = nullptr;
1624 bNodeTree *tree = reinterpret_cast<bNodeTree *>(tree_id);
1625 if (DEG_is_original(tree)) {
1626 /* The graph is only stored on the evaluated data. */
1629 }
1630 std::lock_guard lock{tree->runtime->geometry_nodes_lazy_function_graph_info_mutex};
1631 if (!tree->runtime->geometry_nodes_lazy_function_graph_info) {
1632 return;
1633 }
1634 const auto *graph = tree->runtime->geometry_nodes_lazy_function_graph_info
1635 ->debug_zone_body_graphs.lookup_default(node->identifier, nullptr);
1636 if (!graph) {
1637 return;
1638 }
1639 std::string dot_str = graph->to_dot();
1640 *r_str = BLI_strdup(dot_str.c_str());
1641 *r_len = dot_str.size();
1642}
1643
1644static void rna_NodeTree_debug_zone_lazy_function_graph(
1645 ID *tree_id, bNode *node, bContext *C, const char **r_str, int *r_len)
1646{
1647 *r_len = 0;
1648 *r_str = nullptr;
1649 Main *bmain = CTX_data_main(C);
1651 bNodeTree *tree = reinterpret_cast<bNodeTree *>(tree_id);
1652
1653 if (tree->type != NTREE_GEOMETRY) {
1654 return;
1655 }
1656 /* By creating this data we tell the evaluation that we want to log it. */
1657 tree->runtime->logged_zone_graphs = std::make_unique<blender::bke::LoggedZoneGraphs>();
1658 BLI_SCOPED_DEFER([&]() { tree->runtime->logged_zone_graphs.reset(); })
1659
1660 /* Make sure that dependencies of this tree will be evaluated. */
1662 /* Actually do evaluation. */
1664
1665 /* Get logged graph if it was evaluated. */
1666 std::optional<std::string> dot_str = tree->runtime->logged_zone_graphs->graph_by_zone_id.pop_try(
1667 node->identifier);
1668 if (!dot_str) {
1669 return;
1670 }
1671 *r_str = BLI_strdup(dot_str->c_str());
1672 *r_len = dot_str->size();
1673}
1674
1675static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C)
1676{
1677 Main *bmain = CTX_data_main(C);
1678 ntree->tree_interface.tag_items_changed_generic();
1679 BKE_main_ensure_invariants(*bmain, ntree->id);
1680}
1681
1682/* ******** NodeLink ******** */
1683
1684static bool rna_NodeLink_is_hidden_get(PointerRNA *ptr)
1685{
1686 bNodeLink *link = static_cast<bNodeLink *>(ptr->data);
1688}
1689
1690static void rna_NodeLink_swap_multi_input_sort_id(
1691 ID *id, bNodeLink *self, Main *bmain, ReportList *reports, bNodeLink *other)
1692{
1693 if (self->tosock != other->tosock) {
1694 BKE_report(reports, RPT_ERROR_INVALID_INPUT, "The links must be siblings");
1695 return;
1696 }
1697
1698 std::swap(self->multi_input_sort_id, other->multi_input_sort_id);
1699
1700 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
1702 BKE_main_ensure_invariants(*bmain, ntree->id);
1704}
1705
1706/* ******** Node ******** */
1707
1708static StructRNA *rna_Node_refine(PointerRNA *ptr)
1709{
1710 bNode *node = ptr->data_as<bNode>();
1711
1712 if (node->typeinfo->rna_ext.srna) {
1713 return node->typeinfo->rna_ext.srna;
1714 }
1715 else {
1716 return ptr->type;
1717 }
1718}
1719
1720static std::optional<std::string> rna_Node_path(const PointerRNA *ptr)
1721{
1722 const bNode *node = ptr->data_as<bNode>();
1723 char name_esc[sizeof(node->name) * 2];
1724
1725 BLI_str_escape(name_esc, node->name, sizeof(name_esc));
1726 return fmt::format("nodes[\"{}\"]", name_esc);
1727}
1728
1729std::optional<std::string> rna_Node_ImageUser_path(const PointerRNA *ptr)
1730{
1731 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
1732 if (!ELEM(ntree->type, NTREE_SHADER, NTREE_CUSTOM)) {
1733 return std::nullopt;
1734 }
1735
1736 for (bNode *node = static_cast<bNode *>(ntree->nodes.first); node; node = node->next) {
1737 switch (node->type_legacy) {
1739 NodeTexEnvironment *data = static_cast<NodeTexEnvironment *>(node->storage);
1740 if (&data->iuser != ptr->data) {
1741 continue;
1742 }
1743 break;
1744 }
1745 case SH_NODE_TEX_IMAGE: {
1746 NodeTexImage *data = static_cast<NodeTexImage *>(node->storage);
1747 if (&data->iuser != ptr->data) {
1748 continue;
1749 }
1750 break;
1751 }
1752 default:
1753 continue;
1754 }
1755
1756 char name_esc[sizeof(node->name) * 2];
1757 BLI_str_escape(name_esc, node->name, sizeof(name_esc));
1758 return fmt::format("nodes[\"{}\"].image_user", name_esc);
1759 }
1760
1761 return std::nullopt;
1762}
1763
1764static bool rna_Node_poll(const blender::bke::bNodeType *ntype,
1765 const bNodeTree *ntree,
1766 const char ** /*r_disabled_hint*/)
1767{
1768 ParameterList list;
1769 FunctionRNA *func;
1770 void *ret;
1771 bool visible;
1772
1773 PointerRNA ptr = RNA_pointer_create_discrete(nullptr, ntype->rna_ext.srna, nullptr); /* dummy */
1774 func = &rna_Node_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
1775
1776 RNA_parameter_list_create(&list, &ptr, func);
1777 RNA_parameter_set_lookup(&list, "node_tree", &ntree);
1778 ntype->rna_ext.call(nullptr, &ptr, func, &list);
1779
1780 RNA_parameter_get_lookup(&list, "visible", &ret);
1781 visible = *static_cast<bool *>(ret);
1782
1784
1785 return visible;
1786}
1787
1788static bool rna_Node_poll_instance(const bNode *node,
1789 const bNodeTree *ntree,
1790 const char ** /*disabled_info*/)
1791{
1792 ParameterList list;
1793 FunctionRNA *func;
1794 void *ret;
1795 bool visible;
1796
1798 nullptr, node->typeinfo->rna_ext.srna, const_cast<bNode *>(node)); /* dummy */
1799 func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */
1800
1801 RNA_parameter_list_create(&list, &ptr, func);
1802 RNA_parameter_set_lookup(&list, "node_tree", &ntree);
1803 node->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
1804
1805 RNA_parameter_get_lookup(&list, "visible", &ret);
1806 visible = *static_cast<bool *>(ret);
1807
1809
1810 return visible;
1811}
1812
1813static bool rna_Node_poll_instance_default(const bNode *node,
1814 const bNodeTree *ntree,
1815 const char **disabled_info)
1816{
1817 /* use the basic poll function */
1818 return rna_Node_poll(node->typeinfo, ntree, disabled_info);
1819}
1820
1821static void rna_Node_update_reg(bNodeTree *ntree, bNode *node)
1822{
1823 ParameterList list;
1824 FunctionRNA *func;
1825
1827 reinterpret_cast<ID *>(ntree), node->typeinfo->rna_ext.srna, node);
1828 func = &rna_Node_update_func; /* RNA_struct_find_function(&ptr, "update"); */
1829
1830 RNA_parameter_list_create(&list, &ptr, func);
1831 node->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
1832
1834}
1835
1836static bool rna_Node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
1837{
1838 ParameterList list;
1839 FunctionRNA *func;
1840
1842 reinterpret_cast<ID *>(ntree), node->typeinfo->rna_ext.srna, node);
1843 func = &rna_Node_insert_link_func;
1844
1845 RNA_parameter_list_create(&list, &ptr, func);
1846 RNA_parameter_set_lookup(&list, "link", &link);
1847 node->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
1848
1850 return true;
1851}
1852
1853static void rna_Node_init(const bContext *C, PointerRNA *ptr)
1854{
1855 bNode *node = ptr->data_as<bNode>();
1856 ParameterList list;
1857 FunctionRNA *func;
1858
1859 func = &rna_Node_init_func; /* RNA_struct_find_function(&ptr, "init"); */
1860
1861 RNA_parameter_list_create(&list, ptr, func);
1862 node->typeinfo->rna_ext.call(const_cast<bContext *>(C), ptr, func, &list);
1863
1865}
1866
1867static void rna_Node_copy(PointerRNA *ptr, const bNode *copynode)
1868{
1869 bNode *node = ptr->data_as<bNode>();
1870 ParameterList list;
1871 FunctionRNA *func;
1872
1873 func = &rna_Node_copy_func; /* RNA_struct_find_function(&ptr, "copy"); */
1874
1875 RNA_parameter_list_create(&list, ptr, func);
1876 RNA_parameter_set_lookup(&list, "node", &copynode);
1877 node->typeinfo->rna_ext.call(nullptr, ptr, func, &list);
1878
1880}
1881
1882static void rna_Node_free(PointerRNA *ptr)
1883{
1884 bNode *node = ptr->data_as<bNode>();
1885 ParameterList list;
1886 FunctionRNA *func;
1887
1888 func = &rna_Node_free_func; /* RNA_struct_find_function(&ptr, "free"); */
1889
1890 RNA_parameter_list_create(&list, ptr, func);
1891 node->typeinfo->rna_ext.call(nullptr, ptr, func, &list);
1892
1894}
1895
1896static void rna_Node_draw_buttons(uiLayout *layout, bContext *C, PointerRNA *ptr)
1897{
1898 bNode *node = ptr->data_as<bNode>();
1899 ParameterList list;
1900 FunctionRNA *func;
1901
1902 func = &rna_Node_draw_buttons_func; /* RNA_struct_find_function(&ptr, "draw_buttons"); */
1903
1904 RNA_parameter_list_create(&list, ptr, func);
1905 RNA_parameter_set_lookup(&list, "context", &C);
1906 RNA_parameter_set_lookup(&list, "layout", &layout);
1907 node->typeinfo->rna_ext.call(C, ptr, func, &list);
1908
1910}
1911
1912static void rna_Node_draw_buttons_ext(uiLayout *layout, bContext *C, PointerRNA *ptr)
1913{
1914 bNode *node = ptr->data_as<bNode>();
1915 ParameterList list;
1916 FunctionRNA *func;
1917
1918 func = &rna_Node_draw_buttons_ext_func; /* RNA_struct_find_function(&ptr, "draw_buttons_ext"); */
1919
1920 RNA_parameter_list_create(&list, ptr, func);
1921 RNA_parameter_set_lookup(&list, "context", &C);
1922 RNA_parameter_set_lookup(&list, "layout", &layout);
1923 node->typeinfo->rna_ext.call(C, ptr, func, &list);
1924
1926}
1927
1928static void rna_Node_draw_label(const bNodeTree *ntree,
1929 const bNode *node,
1930 char *label,
1931 int label_maxncpy)
1932{
1933 ParameterList list;
1934 FunctionRNA *func;
1935 void *ret;
1936 char *rlabel;
1937
1938 func = &rna_Node_draw_label_func; /* RNA_struct_find_function(&ptr, "draw_label"); */
1939
1941 const_cast<ID *>(&ntree->id), &RNA_Node, const_cast<bNode *>(node));
1942 RNA_parameter_list_create(&list, &ptr, func);
1943 node->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
1944
1945 RNA_parameter_get_lookup(&list, "label", &ret);
1946 rlabel = static_cast<char *>(ret);
1947 BLI_strncpy(label, rlabel != nullptr ? rlabel : "", label_maxncpy);
1948
1950}
1951
1952static bool rna_Node_is_registered_node_type(StructRNA *type)
1953{
1954 return (RNA_struct_blender_type_get(type) != nullptr);
1955}
1956
1957static bool rna_Node_is_builtin(blender::bke::bNodeType *nt)
1958{
1959 BLI_assert(nt);
1960
1961 /* `nt->rna_ext.data` is the python object. If it's nullptr then it's a
1962 * builtin node. */
1963 return nt->rna_ext.data == nullptr;
1964}
1965
1966static void rna_Node_is_registered_node_type_runtime(bContext * /*C*/,
1967 ReportList * /*reports*/,
1968 PointerRNA *ptr,
1969 ParameterList *parms)
1970{
1971 int result = (RNA_struct_blender_type_get(ptr->type) != nullptr);
1972 RNA_parameter_set_lookup(parms, "result", &result);
1973}
1974
1975static bool rna_Node_unregister(Main *bmain, StructRNA *type)
1976{
1979
1980 if (!nt || rna_Node_is_builtin(nt)) {
1981 return false;
1982 }
1983
1986
1987 /* this also frees the allocated nt pointer, no MEM_free call needed! */
1989
1990 /* update while blender is running */
1993 return true;
1994}
1995
1996/* Generic internal registration function.
1997 * Can be used to implement callbacks for registerable RNA node sub-types.
1998 */
1999static blender::bke::bNodeType *rna_Node_register_base(Main *bmain,
2001 StructRNA *basetype,
2002 void *data,
2003 const char *identifier,
2004 StructValidateFunc validate,
2005 StructCallbackFunc call,
2007{
2009 bNode dummy_node = {};
2010 FunctionRNA *func;
2011 PropertyRNA *parm;
2012 bool have_function[10];
2013
2014 /* setup dummy node & node type to store static properties in */
2015 blender::bke::bNodeType dummy_nt = {};
2016 /* this does some additional initialization of default values */
2017 blender::bke::node_type_base_custom(dummy_nt, identifier, "", "CUSTOM", 0);
2018
2019 dummy_node.typeinfo = &dummy_nt;
2020 PointerRNA dummy_node_ptr = RNA_pointer_create_discrete(nullptr, basetype, &dummy_node);
2021
2022 /* validate the python class */
2023 if (validate(&dummy_node_ptr, data, have_function) != 0) {
2024 return nullptr;
2025 }
2026
2027 if (strlen(identifier) >= sizeof(dummy_node.idname)) {
2029 RPT_ERROR,
2030 "Registering node class: '%s' is too long, maximum length is %d",
2031 identifier,
2032 int(sizeof(dummy_node.idname)));
2033 return nullptr;
2034 }
2035
2036 /* check if we have registered this node type before, and remove it */
2037 nt = blender::bke::node_type_find(dummy_nt.idname);
2038 if (nt) {
2039 /* If it's an internal node, we cannot proceed. */
2040 if (rna_Node_is_builtin(nt)) {
2042 RPT_ERROR,
2043 "Registering node class: '%s', bl_idname '%s' is a builtin node",
2044 identifier,
2045 dummy_nt.idname.c_str());
2046 return nullptr;
2047 }
2048
2050 RPT_INFO,
2051 "Registering node class: '%s', bl_idname '%s' has been registered before, "
2052 "unregistering previous",
2053 identifier,
2054 dummy_nt.idname.c_str());
2055
2056 /* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for nullptr. */
2057 if (!rna_Node_unregister(bmain, nt->rna_ext.srna)) {
2059 RPT_ERROR,
2060 "Registering node class: '%s', bl_idname '%s' could not be unregistered",
2061 identifier,
2062 dummy_nt.idname.c_str());
2063 return nullptr;
2064 }
2065 }
2066
2067 /* create a new node type */
2068 nt = MEM_new<blender::bke::bNodeType>(__func__, dummy_nt);
2069 nt->free_self = [](blender::bke::bNodeType *type) { MEM_delete(type); };
2070
2071 nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname.c_str(), basetype);
2072 nt->rna_ext.data = data;
2073 nt->rna_ext.call = call;
2074 nt->rna_ext.free = free;
2076
2077 RNA_def_struct_ui_text(nt->rna_ext.srna, nt->ui_name.c_str(), nt->ui_description.c_str());
2079
2081 nt->rna_ext.srna, "is_registered_node_type", rna_Node_is_registered_node_type_runtime);
2082 RNA_def_function_ui_description(func, "True if a registered node type");
2084 parm = RNA_def_boolean(func, "result", false, "Result", "");
2085 RNA_def_function_return(func, parm);
2086
2087 /* XXX bad level call! needed to initialize the basic draw functions ... */
2089
2090 nt->poll = (have_function[0]) ? rna_Node_poll : nullptr;
2091 nt->poll_instance = (have_function[1]) ? rna_Node_poll_instance : rna_Node_poll_instance_default;
2092 nt->updatefunc = (have_function[2]) ? rna_Node_update_reg : nullptr;
2093 nt->insert_link = (have_function[3]) ? rna_Node_insert_link : nullptr;
2094 nt->initfunc_api = (have_function[4]) ? rna_Node_init : nullptr;
2095 nt->copyfunc_api = (have_function[5]) ? rna_Node_copy : nullptr;
2096 nt->freefunc_api = (have_function[6]) ? rna_Node_free : nullptr;
2097 nt->draw_buttons = (have_function[7]) ? rna_Node_draw_buttons : nullptr;
2098 nt->draw_buttons_ex = (have_function[8]) ? rna_Node_draw_buttons_ext : nullptr;
2099 nt->labelfunc = (have_function[9]) ? rna_Node_draw_label : nullptr;
2100
2101 /* sanitize size values in case not all have been registered */
2102 if (nt->maxwidth < nt->minwidth) {
2103 nt->maxwidth = nt->minwidth;
2104 }
2105 if (nt->maxheight < nt->minheight) {
2106 nt->maxheight = nt->minheight;
2107 }
2108 CLAMP(nt->width, nt->minwidth, nt->maxwidth);
2109 CLAMP(nt->height, nt->minheight, nt->maxheight);
2110
2111 return nt;
2112}
2113
2114static StructRNA *rna_Node_register(Main *bmain,
2116 void *data,
2117 const char *identifier,
2118 StructValidateFunc validate,
2119 StructCallbackFunc call,
2121{
2122 blender::bke::bNodeType *nt = rna_Node_register_base(
2123 bmain, reports, &RNA_Node, data, identifier, validate, call, free);
2124 if (!nt) {
2125 return nullptr;
2126 }
2127
2129
2130 /* update while blender is running */
2133 return nt->rna_ext.srna;
2134}
2135
2136static const EnumPropertyItem *itemf_function_check(
2137 const EnumPropertyItem *original_item_array,
2138 blender::FunctionRef<bool(const EnumPropertyItem *item)> value_supported)
2139{
2140 EnumPropertyItem *item_array = nullptr;
2141 int items_len = 0;
2142
2143 for (const EnumPropertyItem *item = original_item_array; item->identifier != nullptr; item++) {
2144 if (value_supported(item)) {
2145 RNA_enum_item_add(&item_array, &items_len, item);
2146 }
2147 }
2148
2149 RNA_enum_item_end(&item_array, &items_len);
2150 return item_array;
2151}
2152
2153static bool geometry_node_asset_trait_flag_get(PointerRNA *ptr,
2155{
2156 const bNodeTree *ntree = ptr->data_as<bNodeTree>();
2157 if (!ntree->geometry_node_asset_traits) {
2158 return false;
2159 }
2160 return ntree->geometry_node_asset_traits->flag & flag;
2161}
2162
2163static void geometry_node_asset_trait_flag_set(PointerRNA *ptr,
2165 const bool value)
2166{
2167 bNodeTree *ntree = ptr->data_as<bNodeTree>();
2168 if (!ntree->geometry_node_asset_traits) {
2170 }
2172}
2173
2174static bool rna_GeometryNodeTree_is_tool_get(PointerRNA *ptr)
2175{
2176 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_TOOL);
2177}
2178static void rna_GeometryNodeTree_is_tool_set(PointerRNA *ptr, bool value)
2179{
2180 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_TOOL, value);
2181}
2182
2183static bool rna_GeometryNodeTree_is_modifier_get(PointerRNA *ptr)
2184{
2185 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_MODIFIER);
2186}
2187static void rna_GeometryNodeTree_is_modifier_set(PointerRNA *ptr, bool value)
2188{
2189 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_MODIFIER, value);
2190}
2191
2192static bool rna_GeometryNodeTree_is_mode_object_get(PointerRNA *ptr)
2193{
2194 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_OBJECT);
2195}
2196static void rna_GeometryNodeTree_is_mode_object_set(PointerRNA *ptr, bool value)
2197{
2198 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_OBJECT, value);
2199}
2200
2201static bool rna_GeometryNodeTree_is_mode_edit_get(PointerRNA *ptr)
2202{
2203 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_EDIT);
2204}
2205static void rna_GeometryNodeTree_is_mode_edit_set(PointerRNA *ptr, bool value)
2206{
2207 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_EDIT, value);
2208}
2209
2210static bool rna_GeometryNodeTree_is_mode_sculpt_get(PointerRNA *ptr)
2211{
2212 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_SCULPT);
2213}
2214static void rna_GeometryNodeTree_is_mode_sculpt_set(PointerRNA *ptr, bool value)
2215{
2216 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_SCULPT, value);
2217}
2218
2219static bool rna_GeometryNodeTree_is_mode_paint_get(PointerRNA *ptr)
2220{
2221 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_PAINT);
2222}
2223static void rna_GeometryNodeTree_is_mode_paint_set(PointerRNA *ptr, bool value)
2224{
2225 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_PAINT, value);
2226}
2227
2228static bool rna_GeometryNodeTree_is_type_mesh_get(PointerRNA *ptr)
2229{
2230 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_MESH);
2231}
2232static void rna_GeometryNodeTree_is_type_mesh_set(PointerRNA *ptr, bool value)
2233{
2234 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_MESH, value);
2235}
2236
2237static bool rna_GeometryNodeTree_is_type_curve_get(PointerRNA *ptr)
2238{
2239 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_CURVE);
2240}
2241static void rna_GeometryNodeTree_is_type_curve_set(PointerRNA *ptr, bool value)
2242{
2243 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_CURVE, value);
2244}
2245
2246static bool rna_GeometryNodeTree_is_type_pointcloud_get(PointerRNA *ptr)
2247{
2248 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_POINTCLOUD);
2249}
2250static void rna_GeometryNodeTree_is_type_pointcloud_set(PointerRNA *ptr, bool value)
2251{
2252 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_POINTCLOUD, value);
2253}
2254
2255static bool rna_GeometryNodeTree_use_wait_for_click_get(PointerRNA *ptr)
2256{
2257 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_WAIT_FOR_CURSOR);
2258}
2259static void rna_GeometryNodeTree_use_wait_for_click_set(PointerRNA *ptr, bool value)
2260{
2261 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_WAIT_FOR_CURSOR, value);
2262}
2263
2264static bool rna_GeometryNodeTree_is_type_grease_pencil_get(PointerRNA *ptr)
2265{
2266 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_GREASE_PENCIL);
2267}
2268static void rna_GeometryNodeTree_is_type_grease_pencil_set(PointerRNA *ptr, bool value)
2269{
2270 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_GREASE_PENCIL, value);
2271}
2272
2273static bool random_value_type_supported(const EnumPropertyItem *item)
2274{
2276}
2277static const EnumPropertyItem *rna_FunctionNodeRandomValue_type_itemf(bContext * /*C*/,
2278 PointerRNA * /*ptr*/,
2279 PropertyRNA * /*prop*/,
2280 bool *r_free)
2281{
2282 *r_free = true;
2283 return itemf_function_check(rna_enum_attribute_type_items, random_value_type_supported);
2284}
2285
2287{
2288 return ELEM(item->value,
2298}
2299
2300static bool generic_attribute_type_supported_with_socket(const EnumPropertyItem *item)
2301{
2302 return generic_attribute_type_supported(item) &&
2304}
2305
2306static const EnumPropertyItem *rna_GeometryNodeAttributeType_type_with_socket_itemf(
2307 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
2308{
2309 *r_free = true;
2310 return itemf_function_check(rna_enum_attribute_type_items,
2311 generic_attribute_type_supported_with_socket);
2312}
2313
2314static const EnumPropertyItem *rna_GeometryNodeAttributeDomain_attribute_domain_itemf(
2315 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
2316{
2317 using namespace blender;
2318 EnumPropertyItem *item_array = nullptr;
2319 int items_len = 0;
2320
2321 for (const EnumPropertyItem *item = rna_enum_attribute_domain_items; item->identifier != nullptr;
2322 item++)
2323 {
2324 RNA_enum_item_add(&item_array, &items_len, item);
2325 }
2326 RNA_enum_item_end(&item_array, &items_len);
2327
2328 *r_free = true;
2329 return item_array;
2330}
2331
2332static StructRNA *rna_ShaderNode_register(Main *bmain,
2334 void *data,
2335 const char *identifier,
2336 StructValidateFunc validate,
2337 StructCallbackFunc call,
2339{
2340 blender::bke::bNodeType *nt = rna_Node_register_base(
2341 bmain, reports, &RNA_ShaderNode, data, identifier, validate, call, free);
2342 if (!nt) {
2343 return nullptr;
2344 }
2345
2347
2348 /* update while blender is running */
2350
2351 return nt->rna_ext.srna;
2352}
2353
2354static StructRNA *rna_CompositorNode_register(Main *bmain,
2356 void *data,
2357 const char *identifier,
2358 StructValidateFunc validate,
2359 StructCallbackFunc call,
2361{
2362 blender::bke::bNodeType *nt = rna_Node_register_base(
2363 bmain, reports, &RNA_CompositorNode, data, identifier, validate, call, free);
2364 if (!nt) {
2365 return nullptr;
2366 }
2367
2369
2370 /* update while blender is running */
2372
2373 return nt->rna_ext.srna;
2374}
2375
2376static StructRNA *rna_TextureNode_register(Main *bmain,
2378 void *data,
2379 const char *identifier,
2380 StructValidateFunc validate,
2381 StructCallbackFunc call,
2383{
2384 blender::bke::bNodeType *nt = rna_Node_register_base(
2385 bmain, reports, &RNA_TextureNode, data, identifier, validate, call, free);
2386 if (!nt) {
2387 return nullptr;
2388 }
2389
2391
2392 /* update while blender is running */
2394
2395 return nt->rna_ext.srna;
2396}
2397
2398static StructRNA *rna_GeometryNode_register(Main *bmain,
2400 void *data,
2401 const char *identifier,
2402 StructValidateFunc validate,
2403 StructCallbackFunc call,
2405{
2406 blender::bke::bNodeType *nt = rna_Node_register_base(
2407 bmain, reports, &RNA_GeometryNode, data, identifier, validate, call, free);
2408 if (!nt) {
2409 return nullptr;
2410 }
2411
2413
2414 /* update while blender is running */
2416
2417 return nt->rna_ext.srna;
2418}
2419
2420static StructRNA *rna_FunctionNode_register(Main *bmain,
2422 void *data,
2423 const char *identifier,
2424 StructValidateFunc validate,
2425 StructCallbackFunc call,
2427{
2428 blender::bke::bNodeType *nt = rna_Node_register_base(
2429 bmain, reports, &RNA_FunctionNode, data, identifier, validate, call, free);
2430 if (!nt) {
2431 return nullptr;
2432 }
2433
2435
2436 /* update while blender is running */
2438
2439 return nt->rna_ext.srna;
2440}
2441
2442static IDProperty **rna_Node_idprops(PointerRNA *ptr)
2443{
2444 bNode *node = ptr->data_as<bNode>();
2445 return &node->prop;
2446}
2447
2448static void rna_Node_parent_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
2449{
2450 bNode *node = ptr->data_as<bNode>();
2451 bNode *parent = static_cast<bNode *>(value.data);
2452 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2453
2454 if (!parent) {
2455 blender::bke::node_detach_node(*ntree, *node);
2456 return;
2457 }
2458
2459 /* XXX only Frame node allowed for now,
2460 * in the future should have a poll function or so to test possible attachment.
2461 */
2462 if (!parent->is_frame()) {
2463 return;
2464 }
2465
2466 if (blender::bke::node_is_parent_and_child(*node, *parent)) {
2467 return;
2468 }
2469
2470 blender::bke::node_detach_node(*ntree, *node);
2471 blender::bke::node_attach_node(*ntree, *node, *parent);
2472}
2473
2474static void rna_Node_internal_links_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
2475{
2476 bNode *node = ptr->data_as<bNode>();
2478 int len;
2480 rna_iterator_array_begin(iter, ptr, begin, sizeof(bNodeLink), len, false, nullptr);
2481}
2482
2487static bool allow_identifier_lookup(const bNode &node)
2488{
2489 switch (node.type_legacy) {
2491 case SH_NODE_MIX:
2492 case FN_NODE_COMPARE:
2493 case SH_NODE_MAP_RANGE:
2494 return false;
2495 default:
2496 return true;
2497 }
2498}
2499
2500static bNodeSocket *find_socket_by_key(bNode &node,
2501 const eNodeSocketInOut in_out,
2502 const blender::StringRef key)
2503{
2504 ListBase *sockets = in_out == SOCK_IN ? &node.inputs : &node.outputs;
2505 if (allow_identifier_lookup(node)) {
2506 LISTBASE_FOREACH (bNodeSocket *, socket, sockets) {
2507 if (socket->is_available()) {
2508 if (socket->identifier == key) {
2509 return socket;
2510 }
2511 }
2512 }
2513 }
2514 LISTBASE_FOREACH (bNodeSocket *, socket, sockets) {
2515 if (socket->is_available()) {
2516 if (socket->name == key) {
2517 return socket;
2518 }
2519 }
2520 }
2521 return nullptr;
2522}
2523
2524static bool rna_NodeInputs_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
2525{
2526 bNode *node = ptr->data_as<bNode>();
2527 if (bNodeSocket *socket = find_socket_by_key(*node, SOCK_IN, key)) {
2528 rna_pointer_create_with_ancestors(*ptr, &RNA_NodeSocket, socket, *r_ptr);
2529 return true;
2530 }
2531 return false;
2532}
2533
2534static bool rna_NodeOutputs_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
2535{
2536 bNode *node = ptr->data_as<bNode>();
2537 if (bNodeSocket *socket = find_socket_by_key(*node, SOCK_OUT, key)) {
2538 rna_pointer_create_with_ancestors(*ptr, &RNA_NodeSocket, socket, *r_ptr);
2539 return true;
2540 }
2541 return false;
2542}
2543
2544static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value)
2545{
2546 bNode *node = ptr->data_as<bNode>();
2547 bNode *parent = static_cast<bNode *>(value.data);
2548
2549 /* XXX only Frame node allowed for now,
2550 * in the future should have a poll function or so to test possible attachment.
2551 */
2552 if (!parent->is_frame()) {
2553 return false;
2554 }
2555
2556 if (node->is_frame() && blender::bke::node_is_parent_and_child(*node, *parent)) {
2557 return false;
2558 }
2559
2560 return true;
2561}
2562
2563void rna_Node_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
2564{
2565 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2566 bNode *node = ptr->data_as<bNode>();
2568 BKE_main_ensure_invariants(*bmain, ntree->id);
2569}
2570
2571void rna_Node_update_relations(Main *bmain, Scene *scene, PointerRNA *ptr)
2572{
2573 rna_Node_update(bmain, scene, ptr);
2575}
2576
2577static void rna_Node_socket_value_update(ID *id, bNode * /*node*/, bContext *C)
2578{
2579 BKE_ntree_update_tag_all(reinterpret_cast<bNodeTree *>(id));
2581}
2582
2583static void rna_Node_select_set(PointerRNA *ptr, bool value)
2584{
2585 bNode *node = ptr->data_as<bNode>();
2586 blender::bke::node_set_selected(*node, value);
2587}
2588
2589static void rna_Node_name_set(PointerRNA *ptr, const char *value)
2590{
2591 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2592 bNode *node = ptr->data_as<bNode>();
2593 char oldname[sizeof(node->name)];
2594
2595 /* make a copy of the old name first */
2596 STRNCPY(oldname, node->name);
2597 /* set new name */
2598 STRNCPY_UTF8(node->name, value);
2599
2600 blender::bke::node_unique_name(*ntree, *node);
2601
2602 /* fix all the animation data which may link to this */
2603 BKE_animdata_fix_paths_rename_all(nullptr, "nodes", oldname, node->name);
2604}
2605
2606static int rna_Node_color_tag_get(PointerRNA *ptr)
2607{
2608 bNode *node = ptr->data_as<bNode>();
2609
2610 const int nclass = node->typeinfo->ui_class == nullptr ? node->typeinfo->nclass :
2611 node->typeinfo->ui_class(node);
2612
2613 switch (nclass) {
2614 case NODE_CLASS_INPUT:
2616 case NODE_CLASS_OUTPUT:
2626 case NODE_CLASS_MATTE:
2628 case NODE_CLASS_DISTORT:
2630 case NODE_CLASS_PATTERN:
2632 case NODE_CLASS_TEXTURE:
2634 case NODE_CLASS_SCRIPT:
2638 case NODE_CLASS_SHADER:
2644 case NODE_CLASS_GROUP:
2646 case NODE_CLASS_LAYOUT:
2647 break;
2648 }
2649
2651}
2652
2653static bool allow_adding_sockets(const bNode &node)
2654{
2656}
2657
2658static bool allow_changing_sockets(bNode *node)
2659{
2661}
2662
2663static bNodeSocket *rna_Node_inputs_new(ID *id,
2664 bNode *node,
2665 Main *bmain,
2667 const char *type,
2668 const char *name,
2669 const char *identifier,
2670 const bool use_multi_input)
2671{
2672 if (!allow_adding_sockets(*node)) {
2673 BKE_report(reports, RPT_ERROR, "Cannot add socket to built-in node");
2674 return nullptr;
2675 }
2676 if (identifier == nullptr) {
2677 /* Use the name as default identifier if no separate identifier is provided. */
2678 identifier = name;
2679 }
2680
2681 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2683 *ntree, *node, SOCK_IN, type, identifier, name);
2684
2685 if (sock == nullptr) {
2686 BKE_report(reports, RPT_ERROR, "Unable to create socket");
2687 }
2688 else {
2689 if (use_multi_input) {
2690 sock->flag |= SOCK_MULTI_INPUT;
2691 }
2692 BKE_main_ensure_invariants(*bmain, ntree->id);
2694 }
2695
2696 return sock;
2697}
2698
2699static bNodeSocket *rna_Node_outputs_new(ID *id,
2700 bNode *node,
2701 Main *bmain,
2703 const char *type,
2704 const char *name,
2705 const char *identifier,
2706 const bool use_multi_input)
2707{
2708 if (!allow_adding_sockets(*node)) {
2709 BKE_report(reports, RPT_ERROR, "Cannot add socket to built-in node");
2710 return nullptr;
2711 }
2712
2713 if (use_multi_input) {
2714 BKE_report(reports, RPT_ERROR, "Output sockets cannot be multi-input");
2715 return nullptr;
2716 }
2717
2718 if (identifier == nullptr) {
2719 /* Use the name as default identifier if no separate identifier is provided. */
2720 identifier = name;
2721 }
2722
2723 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2725 *ntree, *node, SOCK_OUT, type, identifier, name);
2726
2727 if (sock == nullptr) {
2728 BKE_report(reports, RPT_ERROR, "Unable to create socket");
2729 }
2730 else {
2731 BKE_main_ensure_invariants(*bmain, ntree->id);
2733 }
2734
2735 return sock;
2736}
2737
2738static void rna_Node_socket_remove(
2739 ID *id, bNode *node, Main *bmain, ReportList *reports, bNodeSocket *sock)
2740{
2741 if (!allow_changing_sockets(node)) {
2742 BKE_report(reports, RPT_ERROR, "Unable to remove socket from built-in node");
2743 return;
2744 }
2745
2746 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2747
2748 if (BLI_findindex(&node->inputs, sock) == -1 && BLI_findindex(&node->outputs, sock) == -1) {
2749 BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
2750 }
2751 else {
2752 blender::bke::node_remove_socket(*ntree, *node, *sock);
2753
2754 BKE_main_ensure_invariants(*bmain, ntree->id);
2756 }
2757}
2758
2759static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain, ReportList *reports)
2760{
2761 if (!allow_changing_sockets(node)) {
2762 BKE_report(reports, RPT_ERROR, "Unable to remove sockets from built-in node");
2763 return;
2764 }
2765
2766 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2767 bNodeSocket *sock, *nextsock;
2768
2769 for (sock = static_cast<bNodeSocket *>(node->inputs.first); sock; sock = nextsock) {
2770 nextsock = sock->next;
2771 blender::bke::node_remove_socket(*ntree, *node, *sock);
2772 }
2773
2774 BKE_main_ensure_invariants(*bmain, ntree->id);
2776}
2777
2778static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain, ReportList *reports)
2779{
2780 if (!allow_changing_sockets(node)) {
2781 BKE_report(reports, RPT_ERROR, "Unable to remove socket from built-in node");
2782 return;
2783 }
2784
2785 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2786 bNodeSocket *sock, *nextsock;
2787
2788 for (sock = static_cast<bNodeSocket *>(node->outputs.first); sock; sock = nextsock) {
2789 nextsock = sock->next;
2790 blender::bke::node_remove_socket(*ntree, *node, *sock);
2791 }
2792
2793 BKE_main_ensure_invariants(*bmain, ntree->id);
2795}
2796
2797static void rna_Node_inputs_move(
2798 ID *id, bNode *node, Main *bmain, ReportList *reports, int from_index, int to_index)
2799{
2800 if (!allow_changing_sockets(node)) {
2801 BKE_report(reports, RPT_ERROR, "Unable to move sockets in built-in node");
2802 return;
2803 }
2804
2805 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2806 bNodeSocket *sock;
2807
2808 if (from_index == to_index) {
2809 return;
2810 }
2811 if (from_index < 0 || to_index < 0) {
2812 return;
2813 }
2814
2815 sock = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, from_index));
2816 if (to_index < from_index) {
2817 bNodeSocket *nextsock = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, to_index));
2818 if (nextsock) {
2819 BLI_remlink(&node->inputs, sock);
2820 BLI_insertlinkbefore(&node->inputs, nextsock, sock);
2821 }
2822 }
2823 else {
2824 bNodeSocket *prevsock = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, to_index));
2825 if (prevsock) {
2826 BLI_remlink(&node->inputs, sock);
2827 BLI_insertlinkafter(&node->inputs, prevsock, sock);
2828 }
2829 }
2830
2832 BKE_main_ensure_invariants(*bmain, ntree->id);
2834}
2835
2836static void rna_Node_outputs_move(
2837 ID *id, bNode *node, Main *bmain, ReportList *reports, int from_index, int to_index)
2838{
2839 if (!allow_changing_sockets(node)) {
2840 BKE_report(reports, RPT_ERROR, "Unable to move sockets in built-in node");
2841 return;
2842 }
2843
2844 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2845 bNodeSocket *sock;
2846
2847 if (from_index == to_index) {
2848 return;
2849 }
2850 if (from_index < 0 || to_index < 0) {
2851 return;
2852 }
2853
2854 sock = static_cast<bNodeSocket *>(BLI_findlink(&node->outputs, from_index));
2855 if (to_index < from_index) {
2856 bNodeSocket *nextsock = static_cast<bNodeSocket *>(BLI_findlink(&node->outputs, to_index));
2857 if (nextsock) {
2858 BLI_remlink(&node->outputs, sock);
2859 BLI_insertlinkbefore(&node->outputs, nextsock, sock);
2860 }
2861 }
2862 else {
2863 bNodeSocket *prevsock = static_cast<bNodeSocket *>(BLI_findlink(&node->outputs, to_index));
2864 if (prevsock) {
2865 BLI_remlink(&node->outputs, sock);
2866 BLI_insertlinkafter(&node->outputs, prevsock, sock);
2867 }
2868 }
2869
2871 BKE_main_ensure_invariants(*bmain, ntree->id);
2873}
2874
2875static void rna_Node_width_range(
2876 PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
2877{
2878 bNode *node = ptr->data_as<bNode>();
2879 *min = *softmin = node->typeinfo->minwidth;
2880 *max = *softmax = node->typeinfo->maxwidth;
2881}
2882
2883static void rna_Node_height_range(
2884 PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
2885{
2886 bNode *node = ptr->data_as<bNode>();
2887 *min = *softmin = node->typeinfo->minheight;
2888 *max = *softmax = node->typeinfo->maxheight;
2889}
2890
2891static void rna_Node_dimensions_get(PointerRNA *ptr, float *value)
2892{
2893 bNode *node = ptr->data_as<bNode>();
2894 const float2 dimensions = blender::bke::node_dimensions_get(*node);
2895 value[0] = dimensions[0];
2896 value[1] = dimensions[1];
2897}
2898
2899/* ******** Node Types ******** */
2900
2901static void rna_NodeInternalSocketTemplate_name_get(PointerRNA *ptr, char *value)
2902{
2904 ptr->data);
2905 strcpy(value, stemp->name);
2906}
2907
2908static int rna_NodeInternalSocketTemplate_name_length(PointerRNA *ptr)
2909{
2911 ptr->data);
2912 return strlen(stemp->name);
2913}
2914
2915static void rna_NodeInternalSocketTemplate_identifier_get(PointerRNA *ptr, char *value)
2916{
2918 ptr->data);
2919 strcpy(value, stemp->identifier);
2920}
2921
2922static int rna_NodeInternalSocketTemplate_identifier_length(PointerRNA *ptr)
2923{
2925 ptr->data);
2926 return strlen(stemp->identifier);
2927}
2928
2929static int rna_NodeInternalSocketTemplate_type_get(PointerRNA *ptr)
2930{
2932 ptr->data);
2933 return stemp->type;
2934}
2935
2936static PointerRNA rna_NodeInternal_input_template(StructRNA *srna, int index)
2937{
2938 blender::bke::bNodeType *ntype = static_cast<blender::bke::bNodeType *>(
2940 if (ntype && ntype->inputs) {
2942 int i = 0;
2943 while (i < index && stemp->type >= 0) {
2944 i++;
2945 stemp++;
2946 }
2947 if (i == index && stemp->type >= 0) {
2949 nullptr, &RNA_NodeInternalSocketTemplate, stemp);
2950 return ptr;
2951 }
2952 }
2953 return PointerRNA_NULL;
2954}
2955
2956static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index)
2957{
2958 blender::bke::bNodeType *ntype = static_cast<blender::bke::bNodeType *>(
2960 if (ntype && ntype->outputs) {
2962 int i = 0;
2963 while (i < index && stemp->type >= 0) {
2964 i++;
2965 stemp++;
2966 }
2967 if (i == index && stemp->type >= 0) {
2969 nullptr, &RNA_NodeInternalSocketTemplate, stemp);
2970 return ptr;
2971 }
2972 }
2973 return PointerRNA_NULL;
2974}
2975
2976static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree)
2977{
2978 blender::bke::bNodeType *ntype = static_cast<blender::bke::bNodeType *>(
2980 const char *disabled_hint;
2981 return ntype && (!ntype->poll || ntype->poll(ntype, ntree, &disabled_hint));
2982}
2983
2984static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree)
2985{
2986 blender::bke::bNodeType *ntype = node->typeinfo;
2987 const char *disabled_hint;
2988 if (ntype->poll_instance) {
2989 return ntype->poll_instance(node, ntree, &disabled_hint);
2990 }
2991 else {
2992 /* fall back to basic poll function */
2993 return !ntype->poll || ntype->poll(ntype, ntree, &disabled_hint);
2994 }
2995}
2996
2997static void rna_NodeInternal_update(ID *id, bNode *node, Main *bmain)
2998{
2999 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
3001 BKE_main_ensure_invariants(*bmain, ntree->id);
3002}
3003
3004static void rna_NodeInternal_draw_buttons(ID *id, bNode *node, bContext *C, uiLayout *layout)
3005{
3006 if (node->typeinfo->draw_buttons) {
3007 PointerRNA ptr = RNA_pointer_create_discrete(id, &RNA_Node, node);
3008 node->typeinfo->draw_buttons(layout, C, &ptr);
3009 }
3010}
3011
3012static void rna_NodeInternal_draw_buttons_ext(ID *id, bNode *node, bContext *C, uiLayout *layout)
3013{
3014 if (node->typeinfo->draw_buttons_ex) {
3015 PointerRNA ptr = RNA_pointer_create_discrete(id, &RNA_Node, node);
3016 node->typeinfo->draw_buttons_ex(layout, C, &ptr);
3017 }
3018 else if (node->typeinfo->draw_buttons) {
3019 PointerRNA ptr = RNA_pointer_create_discrete(id, &RNA_Node, node);
3020 node->typeinfo->draw_buttons(layout, C, &ptr);
3021 }
3022}
3023
3024static StructRNA *rna_NodeCustomGroup_register(Main *bmain,
3026 void *data,
3027 const char *identifier,
3028 StructValidateFunc validate,
3029 StructCallbackFunc call,
3031{
3032 blender::bke::bNodeType *nt = rna_Node_register_base(
3033 bmain, reports, &RNA_NodeCustomGroup, data, identifier, validate, call, free);
3034 if (!nt) {
3035 return nullptr;
3036 }
3037
3039
3040 /* update while blender is running */
3042
3043 return nt->rna_ext.srna;
3044}
3045
3046static StructRNA *rna_GeometryNodeCustomGroup_register(Main *bmain,
3048 void *data,
3049 const char *identifier,
3050 StructValidateFunc validate,
3051 StructCallbackFunc call,
3053{
3054 blender::bke::bNodeType *nt = rna_Node_register_base(
3055 bmain, reports, &RNA_GeometryNodeCustomGroup, data, identifier, validate, call, free);
3056
3057 if (!nt) {
3058 return nullptr;
3059 }
3060
3062
3064
3066
3068
3069 return nt->rna_ext.srna;
3070}
3071
3073
3074static StructRNA *rna_ShaderNodeCustomGroup_register(Main *bmain,
3076 void *data,
3077 const char *identifier,
3078 StructValidateFunc validate,
3079 StructCallbackFunc call,
3081{
3082 blender::bke::bNodeType *nt = rna_Node_register_base(
3083 bmain, reports, &RNA_ShaderNodeCustomGroup, data, identifier, validate, call, free);
3084
3085 if (!nt) {
3086 return nullptr;
3087 }
3088
3090
3092
3094
3096
3097 return nt->rna_ext.srna;
3098}
3099
3100static StructRNA *rna_CompositorNodeCustomGroup_register(Main *bmain,
3102 void *data,
3103 const char *identifier,
3104 StructValidateFunc validate,
3105 StructCallbackFunc call,
3107{
3108 blender::bke::bNodeType *nt = rna_Node_register_base(
3109 bmain, reports, &RNA_CompositorNodeCustomGroup, data, identifier, validate, call, free);
3110 if (!nt) {
3111 return nullptr;
3112 }
3113
3115
3117
3119
3121
3122 return nt->rna_ext.srna;
3123}
3124
3125static void rna_CompositorNode_tag_need_exec(bNode *node)
3126{
3128}
3129
3130static void rna_Node_tex_image_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
3131{
3132 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3133 bNode *node = ptr->data_as<bNode>();
3134
3136 BKE_main_ensure_invariants(*bmain, ntree->id);
3139}
3140
3141static void rna_NodeGroup_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
3142{
3143 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3144 bNode *node = ptr->data_as<bNode>();
3145
3147 BKE_main_ensure_invariants(*bmain, ntree->id);
3149}
3150
3151static void rna_NodeGroup_node_tree_set(PointerRNA *ptr,
3152 const PointerRNA value,
3153 ReportList * /*reports*/)
3154{
3155 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3156 bNode *node = ptr->data_as<bNode>();
3157 bNodeTree *ngroup = static_cast<bNodeTree *>(value.data);
3158
3159 const char *disabled_hint = nullptr;
3160 if (blender::bke::node_group_poll(ntree, ngroup, &disabled_hint)) {
3161 if (node->id) {
3162 id_us_min(node->id);
3163 }
3164 if (ngroup) {
3165 id_us_plus(&ngroup->id);
3166 }
3167
3168 node->id = &ngroup->id;
3169 }
3170}
3171
3172static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
3173{
3174 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3175 bNodeTree *ngroup = static_cast<bNodeTree *>(value.data);
3176
3177 /* only allow node trees of the same type as the group node's tree */
3178 if (ngroup->type != ntree->type) {
3179 return false;
3180 }
3181
3182 const char *disabled_hint = nullptr;
3183 return blender::bke::node_group_poll(ntree, ngroup, &disabled_hint);
3184}
3185
3186static void rna_Node_scene_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
3187{
3188 bNode *node = ptr->data_as<bNode>();
3189
3190 if (node->id) {
3191 id_us_min(node->id);
3192 node->id = nullptr;
3193 }
3194
3195 node->id = static_cast<ID *>(value.data);
3196
3197 id_us_plus(node->id);
3198}
3199
3200static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3201{
3202 bNode *node = ptr->data_as<bNode>();
3203 Image *ima = reinterpret_cast<Image *>(node->id);
3204 ImageUser *iuser = static_cast<ImageUser *>(node->storage);
3205
3206 if (node->type_legacy == CMP_NODE_CRYPTOMATTE &&
3208 {
3209 return;
3210 }
3211
3212 BKE_image_multilayer_index(ima->rr, iuser);
3213 BKE_image_signal(bmain, ima, iuser, IMA_SIGNAL_SRC_CHANGE);
3214
3215 rna_Node_update(bmain, scene, ptr);
3216
3217 if (scene != nullptr && scene->nodetree != nullptr) {
3219 }
3220}
3221
3222static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
3223{
3224 EnumPropertyItem *item = nullptr;
3225 EnumPropertyItem tmp = {0};
3226 int i = 0, totitem = 0;
3227
3228 while (rl) {
3229 tmp.identifier = rl->name;
3230 /* Little trick: using space char instead empty string
3231 * makes the item selectable in the drop-down. */
3232 if (rl->name[0] == '\0') {
3233 tmp.name = " ";
3234 }
3235 else {
3236 tmp.name = rl->name;
3237 }
3238 tmp.value = i++;
3239 RNA_enum_item_add(&item, &totitem, &tmp);
3240 rl = rl->next;
3241 }
3242
3243 RNA_enum_item_end(&item, &totitem);
3244
3245 return item;
3246}
3247
3248static const EnumPropertyItem *rna_ShaderNodeMix_data_type_itemf(bContext * /*C*/,
3249 PointerRNA *ptr,
3250 PropertyRNA * /*prop*/,
3251 bool *r_free)
3252{
3253 *r_free = true;
3254
3255 const auto rotation_supported_mix = [&](const EnumPropertyItem *item) -> bool {
3256 const eNodeSocketDatatype data_type = eNodeSocketDatatype(item->value);
3257 if (data_type == SOCK_ROTATION) {
3258 const bNodeTree *tree = reinterpret_cast<const bNodeTree *>(ptr->owner_id);
3259 if (tree->type == NTREE_GEOMETRY) {
3260 return true;
3261 }
3262 }
3263 return ELEM(data_type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA);
3264 };
3265
3266 return itemf_function_check(rna_enum_mix_data_type_items, rotation_supported_mix);
3267}
3268
3269static const EnumPropertyItem *rna_Node_image_layer_itemf(bContext * /*C*/,
3270 PointerRNA *ptr,
3271 PropertyRNA * /*prop*/,
3272 bool *r_free)
3273{
3274 bNode *node = ptr->data_as<bNode>();
3275 Image *ima = reinterpret_cast<Image *>(node->id);
3276 const EnumPropertyItem *item = nullptr;
3277 RenderLayer *rl;
3278
3279 if (node->type_legacy == CMP_NODE_CRYPTOMATTE &&
3281 {
3283 }
3284
3285 if (ima == nullptr || ima->rr == nullptr) {
3286 *r_free = false;
3288 }
3289
3290 rl = static_cast<RenderLayer *>(ima->rr->layers.first);
3291 item = renderresult_layers_add_enum(rl);
3292
3293 *r_free = true;
3294
3295 return item;
3296}
3297
3298static bool rna_Node_image_has_layers_get(PointerRNA *ptr)
3299{
3300 bNode *node = ptr->data_as<bNode>();
3301 Image *ima = reinterpret_cast<Image *>(node->id);
3302
3303 if (node->type_legacy == CMP_NODE_CRYPTOMATTE &&
3305 {
3306 return false;
3307 }
3308
3309 if (!ima || !(ima->rr)) {
3310 return false;
3311 }
3312
3313 return RE_layers_have_name(ima->rr);
3314}
3315
3316static bool rna_Node_image_has_views_get(PointerRNA *ptr)
3317{
3318 bNode *node = ptr->data_as<bNode>();
3319 Image *ima = reinterpret_cast<Image *>(node->id);
3320
3321 if (node->type_legacy == CMP_NODE_CRYPTOMATTE &&
3323 {
3324 return false;
3325 }
3326
3327 if (!ima || !(ima->rr)) {
3328 return false;
3329 }
3330
3331 return BLI_listbase_count_at_most(&ima->rr->views, 2) > 1;
3332}
3333
3334static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv)
3335{
3336 EnumPropertyItem *item = nullptr;
3337 EnumPropertyItem tmp = {0, "ALL", 0, "All", ""};
3338 int i = 1, totitem = 0;
3339
3340 /* option to use all views */
3341 RNA_enum_item_add(&item, &totitem, &tmp);
3342
3343 while (rv) {
3344 tmp.identifier = rv->name;
3345 /* Little trick: using space char instead empty string
3346 * makes the item selectable in the drop-down. */
3347 if (rv->name[0] == '\0') {
3348 tmp.name = " ";
3349 }
3350 else {
3351 tmp.name = rv->name;
3352 }
3353 tmp.value = i++;
3354 RNA_enum_item_add(&item, &totitem, &tmp);
3355 rv = rv->next;
3356 }
3357
3358 RNA_enum_item_end(&item, &totitem);
3359
3360 return item;
3361}
3362
3363static const EnumPropertyItem *rna_Node_image_view_itemf(bContext * /*C*/,
3364 PointerRNA *ptr,
3365 PropertyRNA * /*prop*/,
3366 bool *r_free)
3367{
3368 bNode *node = ptr->data_as<bNode>();
3369 Image *ima = reinterpret_cast<Image *>(node->id);
3370 const EnumPropertyItem *item = nullptr;
3371 RenderView *rv;
3372
3373 if (node->type_legacy == CMP_NODE_CRYPTOMATTE &&
3375 {
3377 }
3378
3379 if (ima == nullptr || ima->rr == nullptr) {
3380 *r_free = false;
3382 }
3383
3384 rv = static_cast<RenderView *>(ima->rr->views.first);
3385 item = renderresult_views_add_enum(rv);
3386
3387 *r_free = true;
3388
3389 return item;
3390}
3391
3392static const EnumPropertyItem *rna_Node_view_layer_itemf(bContext * /*C*/,
3393 PointerRNA *ptr,
3394 PropertyRNA * /*prop*/,
3395 bool *r_free)
3396{
3397 bNode *node = ptr->data_as<bNode>();
3398 Scene *sce = reinterpret_cast<Scene *>(node->id);
3399 const EnumPropertyItem *item = nullptr;
3400 RenderLayer *rl;
3401
3402 if (sce == nullptr) {
3403 *r_free = false;
3405 }
3406
3407 rl = static_cast<RenderLayer *>(sce->view_layers.first);
3408 item = renderresult_layers_add_enum(rl);
3409
3410 *r_free = true;
3411
3412 return item;
3413}
3414
3415static void rna_Node_view_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3416{
3417 rna_Node_update_relations(bmain, scene, ptr);
3418 if (scene != nullptr && scene->nodetree != nullptr) {
3420 }
3421}
3422
3423static const EnumPropertyItem *rna_Node_channel_itemf(bContext * /*C*/,
3424 PointerRNA *ptr,
3425 PropertyRNA * /*prop*/,
3426 bool *r_free)
3427{
3428 bNode *node = ptr->data_as<bNode>();
3429 EnumPropertyItem *item = nullptr;
3430 EnumPropertyItem tmp = {0};
3431 int totitem = 0;
3432
3433 switch (node->custom1) {
3435 tmp.identifier = "R";
3436 tmp.name = "R";
3437 tmp.value = 1;
3438 RNA_enum_item_add(&item, &totitem, &tmp);
3439 tmp.identifier = "G";
3440 tmp.name = "G";
3441 tmp.value = 2;
3442 RNA_enum_item_add(&item, &totitem, &tmp);
3443 tmp.identifier = "B";
3444 tmp.name = "B";
3445 tmp.value = 3;
3446 RNA_enum_item_add(&item, &totitem, &tmp);
3447 break;
3449 tmp.identifier = "H";
3450 tmp.name = "H";
3451 tmp.value = 1;
3452 RNA_enum_item_add(&item, &totitem, &tmp);
3453 tmp.identifier = "S";
3454 tmp.name = "S";
3455 tmp.value = 2;
3456 RNA_enum_item_add(&item, &totitem, &tmp);
3457 tmp.identifier = "V";
3458 tmp.name = "V";
3459 tmp.value = 3;
3460 RNA_enum_item_add(&item, &totitem, &tmp);
3461 break;
3463 tmp.identifier = "Y";
3464 tmp.name = "Y";
3465 tmp.value = 1;
3466 RNA_enum_item_add(&item, &totitem, &tmp);
3467 tmp.identifier = "G";
3468 tmp.name = "U";
3469 tmp.value = 2;
3470 RNA_enum_item_add(&item, &totitem, &tmp);
3471 tmp.identifier = "V";
3472 tmp.name = "V";
3473 tmp.value = 3;
3474 RNA_enum_item_add(&item, &totitem, &tmp);
3475 break;
3477 tmp.identifier = "Y";
3478 tmp.name = "Y";
3479 tmp.value = 1;
3480 RNA_enum_item_add(&item, &totitem, &tmp);
3481 tmp.identifier = "CB";
3482 tmp.name = "Cr";
3483 tmp.value = 2;
3484 RNA_enum_item_add(&item, &totitem, &tmp);
3485 tmp.identifier = "CR";
3486 tmp.name = "Cb";
3487 tmp.value = 3;
3488 RNA_enum_item_add(&item, &totitem, &tmp);
3489 break;
3490 default:
3492 }
3493
3494 RNA_enum_item_end(&item, &totitem);
3495 *r_free = true;
3496
3497 return item;
3498}
3499
3500static void rna_Image_Node_update_id(Main *bmain, Scene *scene, PointerRNA *ptr)
3501{
3502 bNode *node = ptr->data_as<bNode>();
3503
3505 rna_Node_update_relations(bmain, scene, ptr);
3506}
3507
3508static void rna_NodeOutputFile_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
3509{
3510 bNode *node = ptr->data_as<bNode>();
3511 rna_iterator_listbase_begin(iter, ptr, &node->inputs, nullptr);
3512}
3513
3514static PointerRNA rna_NodeOutputFile_slot_file_get(CollectionPropertyIterator *iter)
3515{
3516 bNodeSocket *sock = static_cast<bNodeSocket *>(rna_iterator_listbase_get(iter));
3518 iter->parent, &RNA_NodeOutputFileSlotFile, sock->storage);
3519 return ptr;
3520}
3521
3522/* --------------------------------------------------------------------
3523 * Glare Node Compatibility Setters/Getters.
3524 *
3525 * The Glare node properties are now deprecated and replaced corresponding inputs. So we provide
3526 * setters/getters for compatibility until those are removed in 5.0. See the
3527 * do_version_glare_node_options_to_inputs function for conversion
3528 */
3529
3530static float rna_NodeGlare_threshold_get(PointerRNA *ptr)
3531{
3532 bNode *node = ptr->data_as<bNode>();
3534 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3535 ptr->owner_id, &RNA_NodeSocket, input);
3536 return RNA_float_get(&input_rna_pointer, "default_value");
3537}
3538
3539static void rna_NodeGlare_threshold_set(PointerRNA *ptr, const float value)
3540{
3541 bNode *node = ptr->data_as<bNode>();
3543 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3544 ptr->owner_id, &RNA_NodeSocket, input);
3545 RNA_float_set(&input_rna_pointer, "default_value", value);
3546}
3547
3548static float rna_NodeGlare_mix_get(PointerRNA *ptr)
3549{
3550 bNode *node = ptr->data_as<bNode>();
3552 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3553 ptr->owner_id, &RNA_NodeSocket, input);
3554 return RNA_float_get(&input_rna_pointer, "default_value") - 1;
3555}
3556
3557static void rna_NodeGlare_mix_set(PointerRNA *ptr, const float value)
3558{
3559 bNode *node = ptr->data_as<bNode>();
3561 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3562 ptr->owner_id, &RNA_NodeSocket, input);
3563 const float mix_value = 1.0f - blender::math::clamp(-value, 0.0f, 1.0f);
3564 RNA_float_set(&input_rna_pointer, "default_value", mix_value);
3565}
3566
3567static int rna_NodeGlare_size_get(PointerRNA *ptr)
3568{
3569 bNode *node = ptr->data_as<bNode>();
3571 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3572 ptr->owner_id, &RNA_NodeSocket, input);
3573 const float size_value = RNA_float_get(&input_rna_pointer, "default_value");
3574 if (size_value == 0.0f) {
3575 return 1;
3576 }
3577 return blender::math::max(1, 9 - int(-std::log2(size_value)));
3578}
3579
3580static void rna_NodeGlare_size_set(PointerRNA *ptr, const int value)
3581{
3582 bNode *node = ptr->data_as<bNode>();
3584 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3585 ptr->owner_id, &RNA_NodeSocket, input);
3586 const float size_value = blender::math::pow(2.0f, float(value - 9));
3587 RNA_float_set(&input_rna_pointer, "default_value", size_value);
3588}
3589
3590static int rna_NodeGlare_streaks_get(PointerRNA *ptr)
3591{
3592 bNode *node = ptr->data_as<bNode>();
3594 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3595 ptr->owner_id, &RNA_NodeSocket, input);
3596 return blender::math::clamp(RNA_int_get(&input_rna_pointer, "default_value"), 1, 16);
3597}
3598
3599static void rna_NodeGlare_streaks_set(PointerRNA *ptr, const int value)
3600{
3601 bNode *node = ptr->data_as<bNode>();
3603 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3604 ptr->owner_id, &RNA_NodeSocket, input);
3605 RNA_int_set(&input_rna_pointer, "default_value", blender::math::clamp(value, 1, 16));
3606}
3607
3608static float rna_NodeGlare_angle_offset_get(PointerRNA *ptr)
3609{
3610 bNode *node = ptr->data_as<bNode>();
3611 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Streaks Angle");
3612 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3613 ptr->owner_id, &RNA_NodeSocket, input);
3614 return RNA_float_get(&input_rna_pointer, "default_value");
3615}
3616
3617static void rna_NodeGlare_angle_offset_set(PointerRNA *ptr, const float value)
3618{
3619 bNode *node = ptr->data_as<bNode>();
3620 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Streaks Angle");
3621 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3622 ptr->owner_id, &RNA_NodeSocket, input);
3623 RNA_float_set(&input_rna_pointer, "default_value", value);
3624}
3625
3626static int rna_NodeGlare_iterations_get(PointerRNA *ptr)
3627{
3628 bNode *node = ptr->data_as<bNode>();
3630 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3631 ptr->owner_id, &RNA_NodeSocket, input);
3632 return blender::math::clamp(RNA_int_get(&input_rna_pointer, "default_value"), 2, 5);
3633}
3634
3635static void rna_NodeGlare_iterations_set(PointerRNA *ptr, const int value)
3636{
3637 bNode *node = ptr->data_as<bNode>();
3639 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3640 ptr->owner_id, &RNA_NodeSocket, input);
3641 RNA_int_set(&input_rna_pointer, "default_value", blender::math::clamp(value, 2, 5));
3642}
3643
3644static float rna_NodeGlare_fade_get(PointerRNA *ptr)
3645{
3646 bNode *node = ptr->data_as<bNode>();
3648 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3649 ptr->owner_id, &RNA_NodeSocket, input);
3650 return blender::math::clamp(RNA_float_get(&input_rna_pointer, "default_value"), 0.75f, 1.0f);
3651}
3652
3653static void rna_NodeGlare_fade_set(PointerRNA *ptr, const float value)
3654{
3655 bNode *node = ptr->data_as<bNode>();
3657 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3658 ptr->owner_id, &RNA_NodeSocket, input);
3659 RNA_float_set(&input_rna_pointer, "default_value", blender::math::clamp(value, 0.75f, 1.0f));
3660}
3661
3662static float rna_NodeGlare_color_modulation_get(PointerRNA *ptr)
3663{
3664 bNode *node = ptr->data_as<bNode>();
3665 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Color Modulation");
3666 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3667 ptr->owner_id, &RNA_NodeSocket, input);
3668 return blender::math::clamp(RNA_float_get(&input_rna_pointer, "default_value"), 0.0f, 1.0f);
3669}
3670
3671static void rna_NodeGlare_color_modulation_set(PointerRNA *ptr, const float value)
3672{
3673 bNode *node = ptr->data_as<bNode>();
3674 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Color Modulation");
3675 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3676 ptr->owner_id, &RNA_NodeSocket, input);
3677 RNA_float_set(&input_rna_pointer, "default_value", blender::math::clamp(value, 0.0f, 1.0f));
3678}
3679
3680static int rna_NodeSplit_factor_get(PointerRNA *ptr)
3681{
3682 bNode *node = ptr->data_as<bNode>();
3684 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3685 ptr->owner_id, &RNA_NodeSocket, input);
3686 return int(blender::math::clamp(RNA_float_get(&input_rna_pointer, "default_value"), 0.0f, 1.0f) *
3687 100.0f);
3688}
3689
3690static void rna_NodeSplit_factor_set(PointerRNA *ptr, const int value)
3691{
3692 bNode *node = ptr->data_as<bNode>();
3694 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3695 ptr->owner_id, &RNA_NodeSocket, input);
3697 &input_rna_pointer, "default_value", blender::math::clamp(value / 100.0f, 0.0f, 1.0f));
3698}
3699
3700static float rna_NodeAntiAlias_contrast_limit_get(PointerRNA *ptr)
3701{
3702 bNode *node = static_cast<bNode *>(ptr->data);
3703 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Contrast Limit");
3704 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3705 ptr->owner_id, &RNA_NodeSocket, input);
3706 /* Contrast limit was previously divided by 10. */
3707 return blender::math::clamp(
3708 RNA_float_get(&input_rna_pointer, "default_value") / 10.0f, 0.0f, 1.0f);
3709}
3710
3711static void rna_NodeAntiAlias_contrast_limit_set(PointerRNA *ptr, const float value)
3712{
3713 bNode *node = static_cast<bNode *>(ptr->data);
3714 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Contrast Limit");
3715 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3716 ptr->owner_id, &RNA_NodeSocket, input);
3717 /* Contrast limit was previously divided by 10. */
3718 RNA_float_set(&input_rna_pointer, "default_value", value * 10.0f);
3719}
3720
3721static float rna_NodeVectorBlur_shutter_get(PointerRNA *ptr)
3722{
3723 bNode *node = static_cast<bNode *>(ptr->data);
3725 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3726 ptr->owner_id, &RNA_NodeSocket, input);
3727 /* Shutter was previously divided by 2. */
3728 return RNA_float_get(&input_rna_pointer, "default_value") / 2.0f;
3729}
3730
3731static void rna_NodeVectorBlur_shutter_set(PointerRNA *ptr, const float value)
3732{
3733 bNode *node = static_cast<bNode *>(ptr->data);
3735 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3736 ptr->owner_id, &RNA_NodeSocket, input);
3737 /* Shutter was previously divided by 2. */
3738 RNA_float_set(&input_rna_pointer, "default_value", value * 2.0f);
3739}
3740
3741static float rna_NodeColorSpill_unspill_red_get(PointerRNA *ptr)
3742{
3743 bNode *node = static_cast<bNode *>(ptr->data);
3744 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Spill Strength");
3745 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3746 ptr->owner_id, &RNA_NodeSocket, input);
3747 float spill_strength[4];
3748 RNA_float_get_array(&input_rna_pointer, "default_value", spill_strength);
3749 return spill_strength[0];
3750}
3751
3752static void rna_NodeColorSpill_unspill_red_set(PointerRNA *ptr, const float value)
3753{
3754 bNode *node = static_cast<bNode *>(ptr->data);
3755 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Spill Strength");
3756 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3757 ptr->owner_id, &RNA_NodeSocket, input);
3758 float spill_strength[4];
3759 RNA_float_get_array(&input_rna_pointer, "default_value", spill_strength);
3760 spill_strength[0] = value;
3761 RNA_float_set_array(&input_rna_pointer, "default_value", spill_strength);
3762}
3763
3764static float rna_NodeColorSpill_unspill_green_get(PointerRNA *ptr)
3765{
3766 bNode *node = static_cast<bNode *>(ptr->data);
3767 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Spill Strength");
3768 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3769 ptr->owner_id, &RNA_NodeSocket, input);
3770 float spill_strength[4];
3771 RNA_float_get_array(&input_rna_pointer, "default_value", spill_strength);
3772 return spill_strength[1];
3773}
3774
3775static void rna_NodeColorSpill_unspill_green_set(PointerRNA *ptr, const float value)
3776{
3777 bNode *node = static_cast<bNode *>(ptr->data);
3778 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Spill Strength");
3779 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3780 ptr->owner_id, &RNA_NodeSocket, input);
3781 float spill_strength[4];
3782 RNA_float_get_array(&input_rna_pointer, "default_value", spill_strength);
3783 spill_strength[1] = value;
3784 RNA_float_set_array(&input_rna_pointer, "default_value", spill_strength);
3785}
3786
3787static float rna_NodeColorSpill_unspill_blue_get(PointerRNA *ptr)
3788{
3789 bNode *node = static_cast<bNode *>(ptr->data);
3790 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Spill Strength");
3791 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3792 ptr->owner_id, &RNA_NodeSocket, input);
3793 float spill_strength[4];
3794 RNA_float_get_array(&input_rna_pointer, "default_value", spill_strength);
3795 return spill_strength[2];
3796}
3797
3798static void rna_NodeColorSpill_unspill_blue_set(PointerRNA *ptr, const float value)
3799{
3800 bNode *node = static_cast<bNode *>(ptr->data);
3801 bNodeSocket *input = blender::bke::node_find_socket(*node, SOCK_IN, "Spill Strength");
3802 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3803 ptr->owner_id, &RNA_NodeSocket, input);
3804 float spill_strength[4];
3805 RNA_float_get_array(&input_rna_pointer, "default_value", spill_strength);
3806 spill_strength[2] = value;
3807 RNA_float_set_array(&input_rna_pointer, "default_value", spill_strength);
3808}
3809
3810static bool rna_NodeLensDistortion_projector_get(PointerRNA *ptr)
3811{
3812 return RNA_enum_get(ptr, "distortion_type") == CMP_NODE_LENS_DISTORTION_HORIZONTAL;
3813}
3814
3815static void rna_NodeLensDistortion_projector_set(PointerRNA *ptr, const bool value)
3816{
3818 "distortion_type",
3820}
3821
3822static float rna_NodeDirectionalBlur_scale_get(PointerRNA *ptr)
3823{
3824 bNode *node = static_cast<bNode *>(ptr->data);
3826 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3827 ptr->owner_id, &RNA_NodeSocket, input);
3828 /* Scale was previously minus 1. */
3829 return RNA_float_get(&input_rna_pointer, "default_value") - 1.0f;
3830}
3831
3832static void rna_NodeDirectionalBlur_scale_set(PointerRNA *ptr, const float value)
3833{
3834 bNode *node = static_cast<bNode *>(ptr->data);
3836 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3837 ptr->owner_id, &RNA_NodeSocket, input);
3838 /* Scale was previously minus 1. */
3839 RNA_float_set(&input_rna_pointer, "default_value", value + 1.0f);
3840}
3841
3842static float rna_NodeBilateralBlur_threshold_get(PointerRNA *ptr)
3843{
3844 bNode *node = static_cast<bNode *>(ptr->data);
3846 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3847 ptr->owner_id, &RNA_NodeSocket, input);
3848 /* Threshold was previously multiplied by 3. */
3849 return RNA_float_get(&input_rna_pointer, "default_value") * 3.0f;
3850}
3851
3852static void rna_NodeBilateralBlur_threshold_set(PointerRNA *ptr, const float value)
3853{
3854 bNode *node = static_cast<bNode *>(ptr->data);
3856 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3857 ptr->owner_id, &RNA_NodeSocket, input);
3858 /* Threshold was previously multiplied by 3. */
3859 RNA_float_set(&input_rna_pointer, "default_value", value / 3.0f);
3860}
3861
3862static float rna_NodeBilateralBlur_sigma_space_get(PointerRNA * /*ptr*/)
3863{
3864 /* Sigma Space no longer exists. */
3865 return 0.0f;
3866}
3867
3868static void rna_NodeBilateralBlur_sigma_space_set(PointerRNA *ptr, const float value)
3869{
3870 bNode *node = static_cast<bNode *>(ptr->data);
3872 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3873 ptr->owner_id, &RNA_NodeSocket, input);
3874 const int size = input->default_value_typed<bNodeSocketValueInt>()->value;
3875 /* The size input is ceil(iterations + sigma_space). */
3876 RNA_int_set(&input_rna_pointer, "default_value", size + int(std::ceil(value)));
3877}
3878
3879static bool rna_NodeCrop_use_crop_size_get(PointerRNA *ptr)
3880{
3881 bNode *node = ptr->data_as<bNode>();
3883 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3884 ptr->owner_id, &RNA_NodeSocket, input);
3885 return !RNA_boolean_get(&input_rna_pointer, "default_value");
3886}
3887
3888static void rna_NodeCrop_use_crop_size_set(PointerRNA *ptr, const bool value)
3889{
3890 bNode *node = ptr->data_as<bNode>();
3892 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3893 ptr->owner_id, &RNA_NodeSocket, input);
3894 RNA_boolean_set(&input_rna_pointer, "default_value", !value);
3895}
3896
3897static int rna_NodeCrop_max_x_get(PointerRNA *ptr)
3898{
3899 bNode *node = ptr->data_as<bNode>();
3900 bNodeSocket *x_input = blender::bke::node_find_socket(*node, SOCK_IN, "X");
3901 bNodeSocket *width_input = blender::bke::node_find_socket(*node, SOCK_IN, "Width");
3902 PointerRNA x_input_rna_pointer = RNA_pointer_create_discrete(
3903 ptr->owner_id, &RNA_NodeSocket, x_input);
3904 PointerRNA width_input_rna_pointer = RNA_pointer_create_discrete(
3905 ptr->owner_id, &RNA_NodeSocket, width_input);
3906 return RNA_int_get(&x_input_rna_pointer, "default_value") +
3907 RNA_int_get(&width_input_rna_pointer, "default_value");
3908}
3909
3910static void rna_NodeCrop_max_x_set(PointerRNA *ptr, const int value)
3911{
3912 bNode *node = ptr->data_as<bNode>();
3913 bNodeSocket *x_input = blender::bke::node_find_socket(*node, SOCK_IN, "X");
3914 bNodeSocket *width_input = blender::bke::node_find_socket(*node, SOCK_IN, "Width");
3915 PointerRNA x_input_rna_pointer = RNA_pointer_create_discrete(
3916 ptr->owner_id, &RNA_NodeSocket, x_input);
3917 PointerRNA width_input_rna_pointer = RNA_pointer_create_discrete(
3918 ptr->owner_id, &RNA_NodeSocket, width_input);
3919 RNA_int_set(&width_input_rna_pointer,
3920 "default_value",
3921 value - RNA_int_get(&x_input_rna_pointer, "default_value"));
3922}
3923
3924static int rna_NodeCrop_min_y_get(PointerRNA *ptr)
3925{
3926 bNode *node = ptr->data_as<bNode>();
3927 bNodeSocket *y_input = blender::bke::node_find_socket(*node, SOCK_IN, "Y");
3928 bNodeSocket *height_input = blender::bke::node_find_socket(*node, SOCK_IN, "Height");
3929 PointerRNA y_input_rna_pointer = RNA_pointer_create_discrete(
3930 ptr->owner_id, &RNA_NodeSocket, y_input);
3931 PointerRNA height_input_rna_pointer = RNA_pointer_create_discrete(
3932 ptr->owner_id, &RNA_NodeSocket, height_input);
3933 return RNA_int_get(&y_input_rna_pointer, "default_value") +
3934 RNA_int_get(&height_input_rna_pointer, "default_value");
3935}
3936
3937static void rna_NodeCrop_min_y_set(PointerRNA *ptr, const int value)
3938{
3939 bNode *node = ptr->data_as<bNode>();
3940 bNodeSocket *y_input = blender::bke::node_find_socket(*node, SOCK_IN, "Y");
3941 bNodeSocket *height_input = blender::bke::node_find_socket(*node, SOCK_IN, "Height");
3942 PointerRNA y_input_rna_pointer = RNA_pointer_create_discrete(
3943 ptr->owner_id, &RNA_NodeSocket, y_input);
3944 PointerRNA height_input_rna_pointer = RNA_pointer_create_discrete(
3945 ptr->owner_id, &RNA_NodeSocket, height_input);
3946 RNA_int_set(&height_input_rna_pointer,
3947 "default_value",
3948 value - RNA_int_get(&y_input_rna_pointer, "default_value"));
3949}
3950
3951static bool rna_NodeBlur_use_bokeh_get(PointerRNA *ptr)
3952{
3953 bNode *node = ptr->data_as<bNode>();
3955 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3956 ptr->owner_id, &RNA_NodeSocket, input);
3957 return !RNA_boolean_get(&input_rna_pointer, "default_value");
3958}
3959
3960static void rna_NodeCrop_use_bokeh_set(PointerRNA *ptr, const bool value)
3961{
3962 bNode *node = ptr->data_as<bNode>();
3964 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
3965 ptr->owner_id, &RNA_NodeSocket, input);
3966 RNA_boolean_set(&input_rna_pointer, "default_value", !value);
3967}
3968
3969static int rna_NodeBlur_size_x_get(PointerRNA *ptr)
3970{
3971 bNode *node = ptr->data_as<bNode>();
3973 return int(input->default_value_typed<bNodeSocketValueVector>()->value[0]);
3974}
3975
3976static void rna_NodeCrop_size_x_set(PointerRNA *ptr, const int value)
3977{
3978 bNode *node = ptr->data_as<bNode>();
3980 input->default_value_typed<bNodeSocketValueVector>()->value[0] = float(value);
3981}
3982
3983static int rna_NodeBlur_size_y_get(PointerRNA *ptr)
3984{
3985 bNode *node = ptr->data_as<bNode>();
3987 return int(input->default_value_typed<bNodeSocketValueVector>()->value[1]);
3988}
3989
3990static void rna_NodeCrop_size_y_set(PointerRNA *ptr, const int value)
3991{
3992 bNode *node = ptr->data_as<bNode>();
3994 input->default_value_typed<bNodeSocketValueVector>()->value[1] = float(value);
3995}
3996
3997static int rna_NodeFlip_axis_get(PointerRNA *ptr)
3998{
3999 bNode *node = ptr->data_as<bNode>();
4000 const bNodeSocket *x_input = blender::bke::node_find_socket(*node, SOCK_IN, "Flip X");
4001 const bNodeSocket *y_input = blender::bke::node_find_socket(*node, SOCK_IN, "Flip Y");
4002 const bool flip_x = x_input->default_value_typed<bNodeSocketValueBoolean>()->value;
4003 const bool flip_y = y_input->default_value_typed<bNodeSocketValueBoolean>()->value;
4004 if (flip_x && flip_y) {
4005 return 2;
4006 }
4007
4008 if (flip_y) {
4009 return 1;
4010 }
4011
4012 return 0;
4013}
4014
4015static void rna_NodeFlip_axis_set(PointerRNA *ptr, const int value)
4016{
4017 bNode *node = ptr->data_as<bNode>();
4018 bNodeSocket *x_input = blender::bke::node_find_socket(*node, SOCK_IN, "Flip X");
4019 bNodeSocket *y_input = blender::bke::node_find_socket(*node, SOCK_IN, "Flip Y");
4020 x_input->default_value_typed<bNodeSocketValueBoolean>()->value = value != 1;
4021 y_input->default_value_typed<bNodeSocketValueBoolean>()->value = value != 0;
4022}
4023
4024/* A getter that returns the value of the input socket with the given template identifier and type.
4025 * The RNA pointer is assumed to represent a node. */
4026template<typename T, const char *identifier>
4027static T rna_node_property_to_input_getter(PointerRNA *ptr)
4028{
4029 bNode *node = ptr->data_as<bNode>();
4031 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
4032 ptr->owner_id, &RNA_NodeSocket, input);
4033 if constexpr (std::is_same_v<T, bool>) {
4034 return RNA_boolean_get(&input_rna_pointer, "default_value");
4035 }
4036 else if constexpr (std::is_same_v<T, int>) {
4037 return RNA_int_get(&input_rna_pointer, "default_value");
4038 }
4039 else if constexpr (std::is_same_v<T, float>) {
4040 return RNA_float_get(&input_rna_pointer, "default_value");
4041 }
4042 else {
4044 return T(0);
4045 }
4046}
4047
4048/* A setter that sets the given value to the input socket with the given template identifier and
4049 * type. The RNA pointer is assumed to represent a node. */
4050template<typename T, const char *identifier>
4051static void rna_node_property_to_input_setter(PointerRNA *ptr, const T value)
4052{
4053 bNode *node = ptr->data_as<bNode>();
4055 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
4056 ptr->owner_id, &RNA_NodeSocket, input);
4057 if constexpr (std::is_same_v<T, bool>) {
4058 RNA_boolean_set(&input_rna_pointer, "default_value", value);
4059 }
4060 else if constexpr (std::is_same_v<T, int>) {
4061 RNA_int_set(&input_rna_pointer, "default_value", value);
4062 }
4063 else if constexpr (std::is_same_v<T, float>) {
4064 RNA_float_set(&input_rna_pointer, "default_value", value);
4065 }
4066 else {
4068 }
4069}
4070
4071/* A getter that returns the value of the array input socket with the given template identifier and
4072 * type. The RNA pointer is assumed to represent a node. */
4073template<typename T, const char *identifier>
4074static void rna_node_array_property_to_input_getter(PointerRNA *ptr, T *value)
4075{
4076 bNode *node = ptr->data_as<bNode>();
4078 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
4079 ptr->owner_id, &RNA_NodeSocket, input);
4080 if constexpr (std::is_same_v<T, bool>) {
4081 return RNA_boolean_get_array(&input_rna_pointer, "default_value", value);
4082 }
4083 else if constexpr (std::is_same_v<T, int>) {
4084 return RNA_int_get_array(&input_rna_pointer, "default_value", value);
4085 }
4086 else if constexpr (std::is_same_v<T, float>) {
4087 return RNA_float_get_array(&input_rna_pointer, "default_value", value);
4088 }
4089 else {
4091 return T(0);
4092 }
4093}
4094
4095/* A setter that sets the given value to the array input socket with the given template identifier
4096 * and type. The RNA pointer is assumed to represent a node. */
4097template<typename T, const char *identifier>
4098static void rna_node_array_property_to_input_setter(PointerRNA *ptr, const T *value)
4099{
4100 bNode *node = ptr->data_as<bNode>();
4102 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
4103 ptr->owner_id, &RNA_NodeSocket, input);
4104 if constexpr (std::is_same_v<T, bool>) {
4105 RNA_boolean_set_array(&input_rna_pointer, "default_value", value);
4106 }
4107 else if constexpr (std::is_same_v<T, int>) {
4108 RNA_int_set_array(&input_rna_pointer, "default_value", value);
4109 }
4110 else if constexpr (std::is_same_v<T, float>) {
4111 RNA_float_set_array(&input_rna_pointer, "default_value", value);
4112 }
4113 else {
4115 }
4116}
4117
4118/* A getter that returns the value of the component of the vector input socket with the given
4119 * template identifier and component index. The RNA pointer is assumed to represent a node. */
4120template<const char *identifier, int index>
4121static float rna_node_property_to_vector_input_getter(PointerRNA *ptr)
4122{
4123 bNode *node = ptr->data_as<bNode>();
4125 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
4126 ptr->owner_id, &RNA_NodeSocket, input);
4127
4128 float vector[4];
4129 RNA_float_get_array(&input_rna_pointer, "default_value", vector);
4130 return vector[index];
4131}
4132
4133/* A setter that sets the given value to the component of the input vector socket with the given
4134 * template identifier and component index. The RNA pointer is assumed to represent a node. */
4135template<const char *identifier, int index>
4136static void rna_node_property_to_vector_input_setter(PointerRNA *ptr, const float value)
4137{
4138 bNode *node = ptr->data_as<bNode>();
4140 PointerRNA input_rna_pointer = RNA_pointer_create_discrete(
4141 ptr->owner_id, &RNA_NodeSocket, input);
4142
4143 float vector[4];
4144 RNA_float_get_array(&input_rna_pointer, "default_value", vector);
4145 vector[index] = value;
4146 RNA_float_set_array(&input_rna_pointer, "default_value", vector);
4147}
4148
4149/* The following are global static strings used as template arguments to
4150 * rna_node_property_to_input_getter and rna_node_property_to_input_setter. */
4151
4152/* Glare node. */
4153static const char node_input_diagonal_star[] = "Diagonal Star";
4154
4155/* Bokeh Image node. */
4156static const char node_input_flaps[] = "Flaps";
4157static const char node_input_angle[] = "Angle";
4158static const char node_input_roundness[] = "Roundness";
4159static const char node_input_catadioptric_size[] = "Catadioptric Size";
4160static const char node_input_color_shift[] = "Color Shift";
4161
4162/* Time node. */
4163static const char node_input_start_frame[] = "Start Frame";
4164static const char node_input_end_frame[] = "End Frame";
4165
4166/* Mask node. */
4167static const char node_input_size_x[] = "Size X";
4168static const char node_input_size_y[] = "Size Y";
4169static const char node_input_feather[] = "Feather";
4170static const char node_input_motion_blur[] = "Motion Blur";
4171static const char node_input_motion_blur_samples[] = "Motion Blur Samples";
4172static const char node_input_motion_blur_shutter[] = "Motion Blur Shutter";
4173
4174/* Switch node. */
4175static const char node_input_switch[] = "Switch";
4176
4177/* Invert node. */
4178static const char node_input_invert_color[] = "Invert Color";
4179static const char node_input_invert_alpha[] = "Invert Alpha";
4180
4181/* Z Combine node. */
4182static const char node_input_use_alpha[] = "Use Alpha";
4183static const char node_input_anti_alias[] = "Anti-Alias";
4184
4185/* Tone Map node. */
4186static const char node_input_key[] = "Key";
4187static const char node_input_balance[] = "Balance";
4188static const char node_input_gamma[] = "Gamma";
4189static const char node_input_intensity[] = "Intensity";
4190static const char node_input_contrast[] = "Contrast";
4191static const char node_input_light_adaptation[] = "Light Adaptation";
4192static const char node_input_chromatic_adaptation[] = "Chromatic Adaptation";
4193
4194/* Dilate/Erode node. */
4195static const char node_input_size[] = "Size";
4196static const char node_input_falloff_size[] = "Falloff Size";
4197
4198/* Kuwahara node. */
4199static const char node_input_high_precision[] = "High Precision";
4200static const char node_input_uniformity[] = "Uniformity";
4201static const char node_input_sharpness[] = "Sharpness";
4202static const char node_input_eccentricity[] = "Eccentricity";
4203
4204/* Despeckle node. */
4205static const char node_input_color_threshold[] = "Color Threshold";
4206static const char node_input_neighbor_threshold[] = "Neighbor Threshold";
4207
4208/* Denoise node. */
4209static const char node_input_hdr[] = "HDR";
4210
4211/* Anti-Alias node. */
4212static const char node_input_threshold[] = "Threshold";
4213static const char node_input_corner_rounding[] = "Corner Rounding";
4214
4215/* Vector Blur node. */
4216static const char node_input_samples[] = "Samples";
4217
4218/* Channel Key node. */
4219static const char node_input_minimum[] = "Minimum";
4220static const char node_input_maximum[] = "Maximum";
4221
4222/* Chroma Key node. */
4223static const char node_input_falloff[] = "Falloff";
4224
4225/* Color Key node. */
4226static const char node_input_hue[] = "Hue";
4227static const char node_input_saturation[] = "Saturation";
4228static const char node_input_value[] = "Value";
4229
4230/* Difference Key node. */
4231static const char node_input_tolerance[] = "Tolerance";
4232
4233/* Color Spill node. */
4234static const char node_input_limit_strength[] = "Limit Strength";
4235static const char node_input_use_spill_strength[] = "Use Spill Strength";
4236static const char node_input_spill_strength[] = "Spill Strength";
4237
4238/* Keying Screen node. */
4239static const char node_input_smoothness[] = "Smoothness";
4240
4241/* Keying node. */
4242static const char node_input_preprocess_blur_size[] = "Preprocess Blur Size";
4243static const char node_input_key_balance[] = "Key Balance";
4244static const char node_input_edge_search_size[] = "Edge Search Size";
4245static const char node_input_edge_tolerance[] = "Edge Tolerance";
4246static const char node_input_black_level[] = "Black Level";
4247static const char node_input_white_level[] = "White Level";
4248static const char node_input_postprocess_blur_size[] = "Postprocess Blur Size";
4249static const char node_input_postprocess_dilate_size[] = "Postprocess Dilate Size";
4250static const char node_input_postprocess_feather_size[] = "Postprocess Feather Size";
4251static const char node_input_despill_strength[] = "Despill Strength";
4252static const char node_input_despill_balance[] = "Despill Balance";
4253
4254/* ID Key node. */
4255static const char node_input_index[] = "Index";
4256
4257/* Stabilize 2D node. */
4258static const char node_input_invert[] = "Invert";
4259
4260/* Color Correction node. */
4261static const char node_input_master_saturation[] = "Master Saturation";
4262static const char node_input_master_contrast[] = "Master Contrast";
4263static const char node_input_master_gamma[] = "Master Gamma";
4264static const char node_input_master_gain[] = "Master Gain";
4265static const char node_input_master_lift[] = "Master Lift";
4266static const char node_input_highlights_saturation[] = "Highlights Saturation";
4267static const char node_input_highlights_contrast[] = "Highlights Contrast";
4268static const char node_input_highlights_gamma[] = "Highlights Gamma";
4269static const char node_input_highlights_gain[] = "Highlights Gain";
4270static const char node_input_highlights_lift[] = "Highlights Lift";
4271static const char node_input_midtones_saturation[] = "Midtones Saturation";
4272static const char node_input_midtones_contrast[] = "Midtones Contrast";
4273static const char node_input_midtones_gamma[] = "Midtones Gamma";
4274static const char node_input_midtones_gain[] = "Midtones Gain";
4275static const char node_input_midtones_lift[] = "Midtones Lift";
4276static const char node_input_shadows_saturation[] = "Shadows Saturation";
4277static const char node_input_shadows_contrast[] = "Shadows Contrast";
4278static const char node_input_shadows_gamma[] = "Shadows Gamma";
4279static const char node_input_shadows_gain[] = "Shadows Gain";
4280static const char node_input_shadows_lift[] = "Shadows Lift";
4281static const char node_input_midtones_start[] = "Midtones Start";
4282static const char node_input_midtones_end[] = "Midtones End";
4283static const char node_input_apply_on_red[] = "Apply On Red";
4284static const char node_input_apply_on_green[] = "Apply On Green";
4285static const char node_input_apply_on_blue[] = "Apply On Blue";
4286
4287/* Lens Distortion node. */
4288static const char node_input_fit[] = "Fit";
4289static const char node_input_jitter[] = "Jitter";
4290
4291/* Box Mask node. */
4292static const char node_input_position[] = "Position";
4293static const char node_input_rotation[] = "Rotation";
4294
4295/* Sun Beams node. */
4296static const char node_input_source[] = "Source";
4297static const char node_input_length[] = "Length";
4298
4299/* Directional Blur node. */
4300static const char node_input_center[] = "Center";
4301static const char node_input_translation_amount[] = "Translation Amount";
4302static const char node_input_translation_direction[] = "Translation Direction";
4303
4304/* Alpha Over node. */
4305static const char node_input_straight_alpha[] = "Straight Alpha";
4306
4307/* Bokeh Blur node. */
4308static const char node_input_extend_bounds[] = "Extend Bounds";
4309
4310/* Crop node. */
4311static const char node_input_x[] = "X";
4312static const char node_input_y[] = "Y";
4313
4314/* Color Balance node. */
4315static const char node_input_color_lift[] = "Color Lift";
4316static const char node_input_color_gamma[] = "Color Gamma";
4317static const char node_input_color_gain[] = "Color Gain";
4318static const char node_input_color_offset[] = "Color Offset";
4319static const char node_input_color_power[] = "Color Power";
4320static const char node_input_color_slope[] = "Color Slope";
4321static const char node_input_base_offset[] = "Base Offset";
4322static const char node_input_input_temperature[] = "Input Temperature";
4323static const char node_input_input_tint[] = "Input Tint";
4324static const char node_input_output_temperature[] = "Output Temperature";
4325static const char node_input_output_tint[] = "Output Tint";
4326
4327/* --------------------------------------------------------------------
4328 * White Balance Node.
4329 */
4330
4331static void rna_NodeColorBalance_input_whitepoint_get(PointerRNA *ptr, float value[3])
4332{
4333 bNode *node = ptr->data_as<bNode>();
4334 bNodeSocket *temperature_input = blender::bke::node_find_socket(
4335 *node, SOCK_IN, "Input Temperature");
4336 bNodeSocket *tint_input = blender::bke::node_find_socket(*node, SOCK_IN, "Input Tint");
4338 temperature_input->default_value_typed<bNodeSocketValueFloat>()->value,
4339 tint_input->default_value_typed<bNodeSocketValueFloat>()->value,
4340 value);
4341}
4342
4343static void rna_NodeColorBalance_input_whitepoint_set(PointerRNA *ptr, const float value[3])
4344{
4345 bNode *node = ptr->data_as<bNode>();
4346 bNodeSocket *temperature_input = blender::bke::node_find_socket(
4347 *node, SOCK_IN, "Input Temperature");
4348 bNodeSocket *tint_input = blender::bke::node_find_socket(*node, SOCK_IN, "Input Tint");
4350 value,
4351 temperature_input->default_value_typed<bNodeSocketValueFloat>()->value,
4352 tint_input->default_value_typed<bNodeSocketValueFloat>()->value);
4353}
4354
4355static void rna_NodeColorBalance_output_whitepoint_get(PointerRNA *ptr, float value[3])
4356{
4357 bNode *node = ptr->data_as<bNode>();
4358 bNodeSocket *temperature_input = blender::bke::node_find_socket(
4359 *node, SOCK_IN, "Output Temperature");
4360 bNodeSocket *tint_input = blender::bke::node_find_socket(*node, SOCK_IN, "Output Tint");
4362 temperature_input->default_value_typed<bNodeSocketValueFloat>()->value,
4363 tint_input->default_value_typed<bNodeSocketValueFloat>()->value,
4364 value);
4365}
4366
4367static void rna_NodeColorBalance_output_whitepoint_set(PointerRNA *ptr, const float value[3])
4368{
4369 bNode *node = ptr->data_as<bNode>();
4370 bNodeSocket *temperature_input = blender::bke::node_find_socket(
4371 *node, SOCK_IN, "Output Temperature");
4372 bNodeSocket *tint_input = blender::bke::node_find_socket(*node, SOCK_IN, "Output Tint");
4374 value,
4375 temperature_input->default_value_typed<bNodeSocketValueFloat>()->value,
4376 tint_input->default_value_typed<bNodeSocketValueFloat>()->value);
4377}
4378
4379static void rna_NodeCryptomatte_source_set(PointerRNA *ptr, int value)
4380{
4381 bNode *node = ptr->data_as<bNode>();
4382 if (node->id && node->custom1 != value) {
4383 id_us_min(node->id);
4384 node->id = nullptr;
4385 }
4386 node->custom1 = value;
4387}
4388
4389static int rna_NodeCryptomatte_layer_name_get(PointerRNA *ptr)
4390{
4391 int index = 0;
4392 bNode *node = ptr->data_as<bNode>();
4393 NodeCryptomatte *storage = static_cast<NodeCryptomatte *>(node->storage);
4394 LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, index) {
4395 if (STREQLEN(storage->layer_name, layer->name, sizeof(storage->layer_name))) {
4396 return index;
4397 }
4398 }
4399 return 0;
4400}
4401
4402static void rna_NodeCryptomatte_layer_name_set(PointerRNA *ptr, int new_value)
4403{
4404 bNode *node = ptr->data_as<bNode>();
4405 NodeCryptomatte *storage = static_cast<NodeCryptomatte *>(node->storage);
4406
4407 CryptomatteLayer *layer = static_cast<CryptomatteLayer *>(
4408 BLI_findlink(&storage->runtime.layers, new_value));
4409 if (layer) {
4410 STRNCPY(storage->layer_name, layer->name);
4411 }
4412}
4413
4414static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext * /*C*/,
4415 PointerRNA *ptr,
4416 PropertyRNA * /*prop*/,
4417 bool *r_free)
4418{
4419 bNode *node = ptr->data_as<bNode>();
4420 NodeCryptomatte *storage = static_cast<NodeCryptomatte *>(node->storage);
4421 EnumPropertyItem *item = nullptr;
4422 EnumPropertyItem temp = {0, "", 0, "", ""};
4423 int totitem = 0;
4424
4425 int layer_index;
4426 LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, layer_index) {
4427 temp.value = layer_index;
4428 temp.identifier = layer->name;
4429 temp.name = layer->name;
4430 RNA_enum_item_add(&item, &totitem, &temp);
4431 }
4432
4433 RNA_enum_item_end(&item, &totitem);
4434 *r_free = true;
4435
4436 return item;
4437}
4438
4439static PointerRNA rna_NodeCryptomatte_scene_get(PointerRNA *ptr)
4440{
4441 bNode *node = ptr->data_as<bNode>();
4442
4443 ID *scene = (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER) ? node->id : nullptr;
4444 return RNA_id_pointer_create(scene);
4445}
4446
4447static void rna_NodeCryptomatte_scene_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
4448{
4449 bNode *node = ptr->data_as<bNode>();
4450
4452 rna_Node_scene_set(ptr, value, reports);
4453 }
4454}
4455
4456static PointerRNA rna_NodeCryptomatte_image_get(PointerRNA *ptr)
4457{
4458 bNode *node = ptr->data_as<bNode>();
4459
4460 ID *image = (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) ? node->id : nullptr;
4461 return RNA_id_pointer_create(image);
4462}
4463
4464static void rna_NodeCryptomatte_image_set(PointerRNA *ptr,
4465 PointerRNA value,
4466 ReportList * /*reports*/)
4467{
4468 bNode *node = ptr->data_as<bNode>();
4469
4471 if (node->id)
4472 id_us_min(node->id);
4473 if (value.data)
4474 id_us_plus(static_cast<ID *>(value.data));
4475
4476 node->id = static_cast<ID *>(value.data);
4477 }
4478}
4479
4480static bool rna_NodeCryptomatte_image_poll(PointerRNA * /*ptr*/, PointerRNA value)
4481{
4482 Image *image = reinterpret_cast<Image *>(value.owner_id);
4483 return image->type == IMA_TYPE_MULTILAYER;
4484}
4485
4486static void rna_NodeCryptomatte_matte_get(PointerRNA *ptr, char *value)
4487{
4488 bNode *node = ptr->data_as<bNode>();
4489 NodeCryptomatte *nc = static_cast<NodeCryptomatte *>(node->storage);
4490 char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
4491 strcpy(value, matte_id);
4492 MEM_freeN(matte_id);
4493}
4494
4495static int rna_NodeCryptomatte_matte_length(PointerRNA *ptr)
4496{
4497 bNode *node = ptr->data_as<bNode>();
4498 NodeCryptomatte *nc = static_cast<NodeCryptomatte *>(node->storage);
4499 char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
4500 int result = strlen(matte_id);
4501 MEM_freeN(matte_id);
4502 return result;
4503}
4504
4505static void rna_NodeCryptomatte_matte_set(PointerRNA *ptr, const char *value)
4506{
4507 bNode *node = ptr->data_as<bNode>();
4508 NodeCryptomatte *nc = static_cast<NodeCryptomatte *>(node->storage);
4510}
4511
4512static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr)
4513{
4515 rna_Node_update(bmain, scene, ptr);
4516}
4517
4518static void rna_NodeCryptomatte_update_remove(Main *bmain, Scene *scene, PointerRNA *ptr)
4519{
4521 rna_Node_update(bmain, scene, ptr);
4522}
4523
4524static PointerRNA rna_Node_paired_output_get(PointerRNA *ptr)
4525{
4526 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
4527 bNode *node = ptr->data_as<bNode>();
4529 node->type_legacy);
4530 bNode *output_node = zone_type.get_corresponding_output(*ntree, *node);
4531 PointerRNA r_ptr = RNA_pointer_create_discrete(&ntree->id, &RNA_Node, output_node);
4532 return r_ptr;
4533}
4534
4535static bool rna_Node_pair_with_output(
4536 ID *id, bNode *node, bContext *C, ReportList *reports, bNode *output_node)
4537{
4538 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
4540 node->type_legacy);
4541 if (output_node->type_legacy != zone_type.output_type) {
4543 reports,
4544 RPT_ERROR,
4545 "Can't pair zone input node %s with %s because it does not have the same zone type",
4546 node->name,
4547 output_node->name);
4548 return false;
4549 }
4550 for (const bNode *other_input_node : ntree->nodes_by_type(zone_type.input_idname)) {
4551 if (other_input_node != node) {
4552 if (zone_type.get_corresponding_output(*ntree, *other_input_node) == output_node) {
4554 RPT_ERROR,
4555 "The output node %s is already paired with %s",
4556 output_node->name,
4557 other_input_node->name);
4558 return false;
4559 }
4560 }
4561 }
4562 int &output_node_id = zone_type.get_corresponding_output_id(*node);
4563 output_node_id = output_node->identifier;
4564
4568 return true;
4569}
4570
4571template<typename Accessor>
4572static void rna_Node_ItemArray_remove(ID *id,
4573 bNode *node,
4574 Main *bmain,
4576 typename Accessor::ItemT *item_to_remove)
4577{
4578 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
4579 if (item_to_remove < *ref.items || item_to_remove >= *ref.items + *ref.items_num) {
4580 if constexpr (Accessor::has_name) {
4581 char **name_ptr = Accessor::get_name(*item_to_remove);
4582 if (name_ptr && *name_ptr) {
4583 BKE_reportf(reports, RPT_ERROR, "Unable to locate item '%s' in node", *name_ptr);
4584 return;
4585 }
4586 }
4587 else {
4588 BKE_report(reports, RPT_ERROR, "Unable to locate item in node");
4589 }
4590 return;
4591 }
4592 const int remove_index = item_to_remove - *ref.items;
4594 ref.items, ref.items_num, ref.active_index, remove_index, Accessor::destruct_item);
4595
4596 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
4598 BKE_main_ensure_invariants(*bmain, ntree->id);
4600}
4601
4602template<typename Accessor> static void rna_Node_ItemArray_clear(ID *id, bNode *node, Main *bmain)
4603{
4604 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
4605 blender::dna::array::clear(ref.items, ref.items_num, ref.active_index, Accessor::destruct_item);
4606
4607 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
4609 BKE_main_ensure_invariants(*bmain, ntree->id);
4611}
4612
4613template<typename Accessor>
4614static void rna_Node_ItemArray_move(
4615 ID *id, bNode *node, Main *bmain, const int from_index, const int to_index)
4616{
4617 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
4618 const int items_num = *ref.items_num;
4619 if (from_index < 0 || to_index < 0 || from_index >= items_num || to_index >= items_num) {
4620 return;
4621 }
4622 blender::dna::array::move_index(*ref.items, items_num, from_index, to_index);
4623
4624 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
4626 BKE_main_ensure_invariants(*bmain, ntree->id);
4628}
4629
4630template<typename Accessor> static PointerRNA rna_Node_ItemArray_active_get(PointerRNA *ptr)
4631{
4632 bNode *node = ptr->data_as<bNode>();
4633 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
4634 typename Accessor::ItemT *active_item = nullptr;
4635 const int active_index = *ref.active_index;
4636 const int items_num = *ref.items_num;
4637 if (active_index >= 0 && active_index < items_num) {
4638 active_item = &(*ref.items)[active_index];
4639 }
4640 return RNA_pointer_create_discrete(ptr->owner_id, Accessor::item_srna, active_item);
4641}
4642template<typename Accessor>
4643static void rna_Node_ItemArray_active_set(PointerRNA *ptr,
4644 PointerRNA value,
4645 ReportList * /*reports*/)
4646{
4647 using ItemT = typename Accessor::ItemT;
4648 bNode *node = ptr->data_as<bNode>();
4649 ItemT *item = static_cast<ItemT *>(value.data);
4650
4651 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
4652 if (item >= *ref.items && item < *ref.items + *ref.items_num) {
4653 *ref.active_index = item - *ref.items;
4654 }
4655}
4656
4657template<typename Accessor>
4658static void rna_Node_ItemArray_item_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
4659{
4660 using ItemT = typename Accessor::ItemT;
4661 bNodeTree &ntree = *reinterpret_cast<bNodeTree *>(ptr->owner_id);
4662 ItemT &item = *static_cast<ItemT *>(ptr->data);
4664 BLI_assert(node != nullptr);
4665
4667 BKE_main_ensure_invariants(*bmain, ntree.id);
4668}
4669
4670template<typename Accessor>
4671static const EnumPropertyItem *rna_Node_ItemArray_socket_type_itemf(bContext * /*C*/,
4672 PointerRNA * /*ptr*/,
4673 PropertyRNA * /*prop*/,
4674 bool *r_free)
4675{
4676 *r_free = true;
4677 return itemf_function_check(
4679 return Accessor::supports_socket_type(eNodeSocketDatatype(item->value));
4680 });
4681}
4682
4683template<typename Accessor>
4684static void rna_Node_ItemArray_item_name_set(PointerRNA *ptr, const char *value)
4685{
4686 using ItemT = typename Accessor::ItemT;
4687 bNodeTree &ntree = *reinterpret_cast<bNodeTree *>(ptr->owner_id);
4688 ItemT &item = *static_cast<ItemT *>(ptr->data);
4690 BLI_assert(node != nullptr);
4692}
4693
4694template<typename Accessors>
4695static void rna_Node_ItemArray_item_color_get(PointerRNA *ptr, float *values)
4696{
4697 using ItemT = typename Accessors::ItemT;
4698 ItemT &item = *static_cast<ItemT *>(ptr->data);
4700 Accessors::get_socket_type(item), 0);
4701 ED_node_type_draw_color(socket_type_idname.c_str(), values);
4702}
4703
4704template<typename Accessor>
4705typename Accessor::ItemT *rna_Node_ItemArray_new_with_socket_and_name(
4706 ID *id, bNode *node, Main *bmain, ReportList *reports, int socket_type, const char *name)
4707{
4708 using ItemT = typename Accessor::ItemT;
4709 if (!Accessor::supports_socket_type(eNodeSocketDatatype(socket_type))) {
4710 BKE_report(reports, RPT_ERROR, "Unable to create item with this socket type");
4711 return nullptr;
4712 }
4714 *node, eNodeSocketDatatype(socket_type), name);
4715
4716 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
4718 BKE_main_ensure_invariants(*bmain, ntree->id);
4720
4721 return new_item;
4722}
4723
4724static IndexSwitchItem *rna_NodeIndexSwitchItems_new(ID *id, bNode *node, Main *bmain)
4725{
4727 *node);
4728
4729 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
4731 BKE_main_ensure_invariants(*bmain, ntree->id);
4733
4734 return new_item;
4735}
4736
4737static const EnumPropertyItem *rna_NodeGeometryCaptureAttributeItem_data_type_itemf(
4738 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
4739{
4740 *r_free = true;
4741 /* See #attribute_type_type_with_socket_fn. */
4742 return itemf_function_check(rna_enum_attribute_type_items, [](const EnumPropertyItem *item) {
4743 return ELEM(item->value,
4751 });
4752}
4753
4754/* ******** Node Socket Types ******** */
4755
4756static PointerRNA rna_NodeOutputFile_slot_layer_get(CollectionPropertyIterator *iter)
4757{
4758 bNodeSocket *sock = static_cast<bNodeSocket *>(rna_iterator_listbase_get(iter));
4760 iter->parent, &RNA_NodeOutputFileSlotLayer, sock->storage);
4761 return ptr;
4762}
4763
4764static int rna_NodeOutputFileSocket_find_node(bNodeTree *ntree,
4766 bNode **nodep,
4767 bNodeSocket **sockp)
4768{
4769 bNode *node;
4770 bNodeSocket *sock;
4771
4772 for (node = static_cast<bNode *>(ntree->nodes.first); node; node = node->next) {
4773 for (sock = static_cast<bNodeSocket *>(node->inputs.first); sock; sock = sock->next) {
4774 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(sock->storage);
4775 if (sockdata == data) {
4776 *nodep = node;
4777 *sockp = sock;
4778 return 1;
4779 }
4780 }
4781 }
4782
4783 *nodep = nullptr;
4784 *sockp = nullptr;
4785 return 0;
4786}
4787
4788static void rna_NodeOutputFileSlotFile_path_set(PointerRNA *ptr, const char *value)
4789{
4790 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
4791 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(ptr->data);
4792 bNode *node;
4793 bNodeSocket *sock;
4794
4795 if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
4796 ntreeCompositOutputFileSetPath(node, sock, value);
4797 }
4798}
4799
4800static void rna_NodeOutputFileSlotLayer_name_set(PointerRNA *ptr, const char *value)
4801{
4802 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
4803 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(ptr->data);
4804 bNode *node;
4805 bNodeSocket *sock;
4806
4807 if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
4808 ntreeCompositOutputFileSetLayer(node, sock, value);
4809 }
4810}
4811
4812static bNodeSocket *rna_NodeOutputFile_slots_new(
4813 ID *id, bNode *node, bContext *C, ReportList * /*reports*/, const char *name)
4814{
4815 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
4816 Scene *scene = CTX_data_scene(C);
4817 ImageFormatData *im_format = nullptr;
4818 bNodeSocket *sock;
4819 if (scene) {
4820 im_format = &scene->r.im_format;
4821 }
4822
4823 sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format);
4824
4827
4828 return sock;
4829}
4830
4831static void rna_FrameNode_label_size_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4832{
4834 rna_Node_update(bmain, scene, ptr);
4835}
4836
4837static void rna_ShaderNodeTexIES_mode_set(PointerRNA *ptr, int value)
4838{
4839 bNode *node = ptr->data_as<bNode>();
4840 NodeShaderTexIES *nss = static_cast<NodeShaderTexIES *>(node->storage);
4841
4842 if (nss->mode != value) {
4843 nss->mode = value;
4844 nss->filepath[0] = '\0';
4845
4846 /* replace text datablock by filepath */
4847 if (node->id) {
4848 Text *text = reinterpret_cast<Text *>(node->id);
4849
4850 if (value == NODE_IES_EXTERNAL && text->filepath) {
4851 STRNCPY(nss->filepath, text->filepath);
4853 }
4854
4855 id_us_min(node->id);
4856 node->id = nullptr;
4857 }
4858 }
4859}
4860
4861static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value)
4862{
4863 bNode *node = ptr->data_as<bNode>();
4864 NodeShaderScript *nss = static_cast<NodeShaderScript *>(node->storage);
4865
4866 if (nss->mode != value) {
4867 nss->mode = value;
4868 nss->filepath[0] = '\0';
4869 nss->flag &= ~NODE_SCRIPT_AUTO_UPDATE;
4870
4871 /* replace text data-block by filepath */
4872 if (node->id) {
4873 Text *text = reinterpret_cast<Text *>(node->id);
4874
4875 if (value == NODE_SCRIPT_EXTERNAL && text->filepath) {
4876 STRNCPY(nss->filepath, text->filepath);
4878 }
4879
4880 id_us_min(node->id);
4881 node->id = nullptr;
4882 }
4883
4884 /* remove any bytecode */
4885 if (nss->bytecode) {
4886 MEM_freeN(nss->bytecode);
4887 nss->bytecode = nullptr;
4888 }
4889
4890 nss->bytecode_hash[0] = '\0';
4891 }
4892}
4893
4894static void rna_ShaderNodeScript_bytecode_get(PointerRNA *ptr, char *value)
4895{
4896 bNode *node = ptr->data_as<bNode>();
4897 NodeShaderScript *nss = static_cast<NodeShaderScript *>(node->storage);
4898
4899 strcpy(value, (nss->bytecode) ? nss->bytecode : "");
4900}
4901
4902static int rna_ShaderNodeScript_bytecode_length(PointerRNA *ptr)
4903{
4904 bNode *node = ptr->data_as<bNode>();
4905 NodeShaderScript *nss = static_cast<NodeShaderScript *>(node->storage);
4906
4907 return (nss->bytecode) ? strlen(nss->bytecode) : 0;
4908}
4909
4910static void rna_ShaderNodeScript_bytecode_set(PointerRNA *ptr, const char *value)
4911{
4912 bNode *node = ptr->data_as<bNode>();
4913 NodeShaderScript *nss = static_cast<NodeShaderScript *>(node->storage);
4914
4915 if (nss->bytecode) {
4916 MEM_freeN(nss->bytecode);
4917 }
4918
4919 if (value && value[0]) {
4920 nss->bytecode = BLI_strdup(value);
4921 }
4922 else {
4923 nss->bytecode = nullptr;
4924 }
4925}
4926
4927static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4928{
4929 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
4930 bNode *node = ptr->data_as<bNode>();
4931 RenderEngineType *engine_type = (scene != nullptr) ? RE_engines_find(scene->r.engine) : nullptr;
4932
4933 if (engine_type && engine_type->update_script_node) {
4934 /* auto update node */
4935 RenderEngine *engine = RE_engine_create(engine_type);
4936 engine_type->update_script_node(engine, ntree, node);
4937 RE_engine_free(engine);
4938 }
4939
4941 BKE_main_ensure_invariants(*bmain, ntree->id);
4942}
4943
4944static void rna_ShaderNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4945{
4946 rna_Node_update(bmain, scene, ptr);
4947}
4948
4949void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4950{
4951 rna_Node_update(bmain, scene, ptr);
4952}
4953
4954static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4955{
4956 rna_Node_update(bmain, scene, ptr);
4957}
4958
4959static void rna_ShaderNode_is_active_output_set(PointerRNA *ptr, bool value)
4960{
4961 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
4962 bNode *node = ptr->data_as<bNode>();
4963 if (value) {
4964 /* If this node becomes the active output, the others of the same type can't be the active
4965 * output anymore. */
4966 for (bNode *other_node : ntree->all_nodes()) {
4967 if (other_node->type_legacy == node->type_legacy) {
4968 other_node->flag &= ~NODE_DO_OUTPUT;
4969 }
4970 }
4971 node->flag |= NODE_DO_OUTPUT;
4972 }
4973 else {
4974 node->flag &= ~NODE_DO_OUTPUT;
4975 }
4976}
4977
4978static void rna_GroupOutput_is_active_output_set(PointerRNA *ptr, bool value)
4979{
4980 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
4981 bNode *node = ptr->data_as<bNode>();
4982 if (value) {
4983 /* Make sure that no other group output is active at the same time. */
4984 for (bNode *other_node : ntree->all_nodes()) {
4985 if (other_node->is_group_output()) {
4986 other_node->flag &= ~NODE_DO_OUTPUT;
4987 }
4988 }
4989 node->flag |= NODE_DO_OUTPUT;
4990 }
4991 else {
4992 node->flag &= ~NODE_DO_OUTPUT;
4993 }
4994}
4995
4996static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr)
4997{
4998 bNode *node = ptr->data_as<bNode>();
4999 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
5000 node->storage);
5001 Object *ob = reinterpret_cast<Object *>(node->id);
5002 ParticleSystem *psys = nullptr;
5003
5004 if (ob && shader_point_density->particle_system) {
5005 psys = static_cast<ParticleSystem *>(
5006 BLI_findlink(&ob->particlesystem, shader_point_density->particle_system - 1));
5007 }
5008
5009 PointerRNA value = RNA_pointer_create_discrete(&ob->id, &RNA_ParticleSystem, psys);
5010 return value;
5011}
5012
5013static void rna_ShaderNodePointDensity_psys_set(PointerRNA *ptr,
5014 PointerRNA value,
5015 ReportList * /*reports*/)
5016{
5017 bNode *node = ptr->data_as<bNode>();
5018 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
5019 node->storage);
5020 Object *ob = reinterpret_cast<Object *>(node->id);
5021
5022 if (ob && value.owner_id == &ob->id) {
5023 shader_point_density->particle_system = BLI_findindex(&ob->particlesystem, value.data) + 1;
5024 }
5025 else {
5026 shader_point_density->particle_system = 0;
5027 }
5028}
5029
5030static int point_density_particle_color_source_from_shader(
5031 NodeShaderTexPointDensity *shader_point_density)
5032{
5033 switch (shader_point_density->color_source) {
5035 return TEX_PD_COLOR_PARTAGE;
5039 return TEX_PD_COLOR_PARTVEL;
5040 default:
5041 BLI_assert_msg(0, "Unknown color source");
5042 return TEX_PD_COLOR_CONSTANT;
5043 }
5044}
5045
5046static int point_density_vertex_color_source_from_shader(
5047 NodeShaderTexPointDensity *shader_point_density)
5048{
5049 switch (shader_point_density->ob_color_source) {
5051 return TEX_PD_COLOR_VERTCOL;
5055 return TEX_PD_COLOR_VERTNOR;
5056 default:
5057 BLI_assert_msg(0, "Unknown color source");
5058 return TEX_PD_COLOR_CONSTANT;
5059 }
5060}
5061
5062void rna_ShaderNodePointDensity_density_cache(bNode *self, Depsgraph *depsgraph)
5063{
5064 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
5065 self->storage);
5066 PointDensity *pd = &shader_point_density->pd;
5067
5068 if (depsgraph == nullptr) {
5069 return;
5070 }
5071
5072 /* Make sure there's no cached data. */
5075
5076 /* Create PointDensity structure from node for sampling. */
5078 pd->object = reinterpret_cast<Object *>(self->id);
5079 pd->radius = shader_point_density->radius;
5080 if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
5081 pd->source = TEX_PD_PSYS;
5082 pd->psys = shader_point_density->particle_system;
5084 pd->color_source = point_density_particle_color_source_from_shader(shader_point_density);
5085 }
5086 else {
5087 BLI_assert(shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_OBJECT);
5088 pd->source = TEX_PD_OBJECT;
5090 pd->ob_color_source = point_density_vertex_color_source_from_shader(shader_point_density);
5091 STRNCPY(pd->vertex_attribute_name, shader_point_density->vertex_attribute_name);
5092 }
5093
5094 /* Store resolution, so it can be changed in the UI. */
5095 shader_point_density->cached_resolution = shader_point_density->resolution;
5096
5097 /* Single-threaded sampling of the voxel domain. */
5099}
5100
5101void rna_ShaderNodePointDensity_density_calc(bNode *self,
5102 Depsgraph *depsgraph,
5103 float **values,
5104 int *values_num)
5105{
5106 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
5107 self->storage);
5108 PointDensity *pd = &shader_point_density->pd;
5109 const int resolution = shader_point_density->cached_resolution;
5110
5111 if (depsgraph == nullptr) {
5112 *values_num = 0;
5113 return;
5114 }
5115
5116 /* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */
5117 *values_num = 4 * resolution * resolution * resolution;
5118
5119 if (*values == nullptr) {
5120 *values = MEM_malloc_arrayN<float>(size_t(*values_num), "point density dynamic array");
5121 }
5122
5123 /* Single-threaded sampling of the voxel domain. */
5124 RE_point_density_sample(depsgraph, pd, resolution, *values);
5125
5126 /* We're done, time to clean up. */
5128 *pd = blender::dna::shallow_zero_initialize();
5129
5130 shader_point_density->cached_resolution = 0.0f;
5131}
5132
5133void rna_ShaderNodePointDensity_density_minmax(bNode *self,
5134 Depsgraph *depsgraph,
5135 float r_min[3],
5136 float r_max[3])
5137{
5138 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
5139 self->storage);
5140 PointDensity *pd = &shader_point_density->pd;
5141
5142 if (depsgraph == nullptr) {
5143 zero_v3(r_min);
5144 zero_v3(r_max);
5145 return;
5146 }
5147
5148 RE_point_density_minmax(depsgraph, pd, r_min, r_max);
5149}
5150
5151static int rna_NodeConvertColorSpace_from_color_space_get(PointerRNA *ptr)
5152{
5153 bNode *node = ptr->data_as<bNode>();
5154 NodeConvertColorSpace *node_storage = static_cast<NodeConvertColorSpace *>(node->storage);
5155 return IMB_colormanagement_colorspace_get_named_index(node_storage->from_color_space);
5156}
5157
5158static void rna_NodeConvertColorSpace_from_color_space_set(PointerRNA *ptr, int value)
5159{
5160 bNode *node = ptr->data_as<bNode>();
5161 NodeConvertColorSpace *node_storage = static_cast<NodeConvertColorSpace *>(node->storage);
5162 const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
5163
5164 if (name && name[0]) {
5165 STRNCPY(node_storage->from_color_space, name);
5166 }
5167}
5168static int rna_NodeConvertColorSpace_to_color_space_get(PointerRNA *ptr)
5169{
5170 bNode *node = ptr->data_as<bNode>();
5171 NodeConvertColorSpace *node_storage = static_cast<NodeConvertColorSpace *>(node->storage);
5172 return IMB_colormanagement_colorspace_get_named_index(node_storage->to_color_space);
5173}
5174
5175static void rna_NodeConvertColorSpace_to_color_space_set(PointerRNA *ptr, int value)
5176{
5177 bNode *node = ptr->data_as<bNode>();
5178 NodeConvertColorSpace *node_storage = static_cast<NodeConvertColorSpace *>(node->storage);
5179 const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
5180
5181 if (name && name[0]) {
5182 STRNCPY(node_storage->to_color_space, name);
5183 }
5184}
5185
5186static void rna_reroute_node_socket_type_set(PointerRNA *ptr, const char *value)
5187{
5188 const bNodeTree &ntree = *reinterpret_cast<bNodeTree *>(ptr->owner_id);
5189 blender::bke::bNodeTreeType *ntree_type = ntree.typeinfo;
5190
5191 bNode &node = *ptr->data_as<bNode>();
5192
5193 if (value == nullptr) {
5194 return;
5195 }
5197 if (socket_type == nullptr) {
5198 return;
5199 }
5200 if (socket_type->subtype != PROP_NONE) {
5201 return;
5202 }
5203 if (ntree_type->valid_socket_type && !ntree_type->valid_socket_type(ntree_type, socket_type)) {
5204 return;
5205 }
5206 NodeReroute *storage = static_cast<NodeReroute *>(node.storage);
5207 STRNCPY(storage->type_idname, value);
5208}
5209
5210static const EnumPropertyItem *rna_NodeConvertColorSpace_color_space_itemf(bContext * /*C*/,
5211 PointerRNA * /*ptr*/,
5212 PropertyRNA * /*prop*/,
5213 bool *r_free)
5214{
5215 EnumPropertyItem *items = nullptr;
5216 int totitem = 0;
5217
5219 RNA_enum_item_end(&items, &totitem);
5220
5221 *r_free = true;
5222
5223 return items;
5224}
5225
5226static NodeEnumItem *rna_NodeMenuSwitchItems_new(ID *id,
5227 bNode *node,
5228 Main *bmain,
5229 const char *name)
5230{
5231 NodeEnumItem *new_item =
5233
5234 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
5236 BKE_main_ensure_invariants(*bmain, ntree->id);
5238
5239 return new_item;
5240}
5241
5242static PointerRNA rna_NodeMenuSwitch_enum_definition_get(PointerRNA *ptr)
5243{
5244 /* Return node itself. The data is now directly available on the node and does not have to be
5245 * accessed through "enum_definition". */
5246 return *ptr;
5247}
5248
5249#else
5250
5252 {0, "PLACEHOLDER", 0, "Placeholder", ""},
5253 {0, nullptr, 0, nullptr, nullptr},
5254};
5255
5257 {0, "ALL", 0, "All", ""},
5258 {0, nullptr, 0, nullptr, nullptr},
5259};
5260
5262 {0, "PLACEHOLDER", 0, "Placeholder", ""},
5263 {0, nullptr, 0, nullptr, nullptr},
5264};
5265
5267 {1, "R", 0, "R", "Red"},
5268 {2, "G", 0, "G", "Green"},
5269 {3, "B", 0, "B", "Blue"},
5270 {0, nullptr, 0, nullptr, nullptr},
5271};
5272
5274 {0, "X", 0, "Flip X", ""},
5275 {1, "Y", 0, "Flip Y", ""},
5276 {2, "XY", 0, "Flip X & Y", ""},
5277 {0, nullptr, 0, nullptr, nullptr},
5278};
5279
5281 {0, "ITUBT601", 0, "ITU 601", ""},
5282 {1, "ITUBT709", 0, "ITU 709", ""},
5283 {2, "JFIF", 0, "JPEG", ""},
5284 {0, nullptr, 0, nullptr, nullptr},
5285};
5286
5288 {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
5289 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
5291 "MULTI_GGX",
5292 0,
5293 "Multiscatter GGX",
5294 "GGX with additional correction to account for multiple scattering, preserve energy and "
5295 "prevent unexpected darkening at high roughness"},
5296 {0, nullptr, 0, nullptr, nullptr},
5297};
5298
5301 "PHYSICAL_CONDUCTOR",
5302 0,
5303 "Physical Conductor",
5304 "Fresnel conductor based on the complex refractive index per color channel"},
5306 "F82",
5307 0,
5308 "F82 Tint",
5309 "An approximation of the Fresnel conductor curve based on the colors at perpendicular and "
5310 "near-grazing (roughly 82°) angles"},
5311 {0, nullptr, 0, nullptr, nullptr},
5312};
5313
5315 {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
5316 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
5317 {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
5319 "MULTI_GGX",
5320 0,
5321 "Multiscatter GGX",
5322 "GGX with additional correction to account for multiple scattering, preserve energy and "
5323 "prevent unexpected darkening at high roughness"},
5324 {0, nullptr, 0, nullptr, nullptr},
5325};
5326
5328 {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
5329 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
5331 "MULTI_GGX",
5332 0,
5333 "Multiscatter GGX",
5334 "GGX with additional correction to account for multiple scattering, preserve energy and "
5335 "prevent unexpected darkening at high roughness"},
5336 {0, nullptr, 0, nullptr, nullptr},
5337};
5338
5340 {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
5341 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
5342 {0, nullptr, 0, nullptr, nullptr},
5343};
5344
5346 {SHD_SHEEN_ASHIKHMIN, "ASHIKHMIN", 0, "Ashikhmin", "Classic Ashikhmin velvet (legacy model)"},
5348 "MICROFIBER",
5349 0,
5350 "Microfiber",
5351 "Microflake-based model of multiple scattering between normal-oriented fibers"},
5352 {0, nullptr, 0, nullptr, nullptr},
5353};
5354
5356 {SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", "Use diffuse BSDF"},
5357 {SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", "Use glossy BSDF"},
5358 {0, nullptr, 0, nullptr, nullptr},
5359};
5360
5363 "Reflection",
5364 0,
5365 "Reflection",
5366 "The light that bounces off the surface of the hair"},
5368 "Transmission",
5369 0,
5370 "Transmission",
5371 "The light that passes through the hair and exits on the other side"},
5372 {0, nullptr, 0, nullptr, nullptr},
5373};
5374
5377 "CHIANG",
5378 0,
5379 "Chiang",
5380 "Near-field hair scattering model by Chiang et al. 2016, suitable for close-up looks, but is "
5381 "more noisy when viewing from a distance."},
5383 "HUANG",
5384 0,
5385 "Huang",
5386 "Multi-scale hair scattering model by Huang et al. 2022, suitable for viewing both up close "
5387 "and from a distance, supports elliptical cross-sections and has more precise highlight in "
5388 "forward scattering directions."},
5389 {0, nullptr, 0, nullptr, nullptr},
5390};
5391
5394 "ABSORPTION",
5395 0,
5396 "Absorption Coefficient",
5397 "Directly set the absorption coefficient \"sigma_a\" (this is not the most intuitive way to "
5398 "color hair)"},
5400 "MELANIN",
5401 0,
5402 "Melanin Concentration",
5403 "Define the melanin concentrations below to get the most realistic-looking hair (you can get "
5404 "the concentrations for different types of hair online)"},
5406 "COLOR",
5407 0,
5408 "Direct Coloring",
5409 "Choose the color of your preference, and the shader will approximate the absorption "
5410 "coefficient to render lookalike hair"},
5411 {0, nullptr, 0, nullptr, nullptr},
5412};
5413
5415 {NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
5416 {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
5417 {0, nullptr, 0, nullptr, nullptr},
5418};
5419
5421 {NODE_IES_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
5422 {NODE_IES_EXTERNAL, "EXTERNAL", 0, "External", "Use external .ies file"},
5423 {0, nullptr, 0, nullptr, nullptr},
5424};
5425
5427 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
5429 "MULTI_GGX",
5430 0,
5431 "Multiscatter GGX",
5432 "GGX with additional correction to account for multiple scattering, preserve energy and "
5433 "prevent unexpected darkening at high roughness"},
5434 {0, nullptr, 0, nullptr, nullptr},
5435};
5436
5439 "BURLEY",
5440 0,
5441 "Christensen-Burley",
5442 "Approximation to physically based volume scattering"},
5444 "RANDOM_WALK",
5445 0,
5446 "Random Walk",
5447 "Volumetric approximation to physically based volume scattering, using the scattering radius "
5448 "as specified"},
5450 "RANDOM_WALK_SKIN",
5451 0,
5452 "Random Walk (Skin)",
5453 "Volumetric approximation to physically based volume scattering, with scattering radius "
5454 "automatically adjusted to match color textures. Designed for skin shading."},
5455 {0, nullptr, 0, nullptr, nullptr}};
5456
5459 "REPEAT",
5460 0,
5461 "Repeat",
5462 "Cause the image to repeat horizontally and vertically"},
5464 "EXTEND",
5465 0,
5466 "Extend",
5467 "Extend by repeating edge pixels of the image"},
5469 "CLIP",
5470 0,
5471 "Clip",
5472 "Clip to image size and set exterior pixels as transparent"},
5474 "MIRROR",
5475 0,
5476 "Mirror",
5477 "Repeatedly flip the image horizontally and vertically"},
5478 {0, nullptr, 0, nullptr, nullptr},
5479};
5480
5483 "HENYEY_GREENSTEIN",
5484 0,
5485 "Henyey-Greenstein",
5486 "Henyey-Greenstein, default phase function for the scattering of light"},
5488 "FOURNIER_FORAND",
5489 0,
5490 "Fournier-Forand",
5491 "Fournier-Forand phase function, used for the scattering of light in underwater "
5492 "environments"},
5494 "DRAINE",
5495 0,
5496 "Draine",
5497 "Draine phase functions, mostly used for the scattering of light in interstellar dust"},
5499 "RAYLEIGH",
5500 0,
5501 "Rayleigh",
5502 "Rayleigh phase function, mostly used for particles smaller than the wavelength of light, "
5503 "such as scattering of sunlight in earth's atmosphere"},
5505 "MIE",
5506 0,
5507 "Mie",
5508 "Approximation of Mie scattering in water droplets, used for scattering in clouds and fog"},
5509 {0, nullptr, 0, nullptr, nullptr},
5510};
5511
5512/* -- Common nodes ---------------------------------------------------------- */
5513
5514static void def_group_input(BlenderRNA * /*brna*/, StructRNA * /*srna*/) {}
5515
5516static void def_group_output(BlenderRNA * /*brna*/, StructRNA *srna)
5517{
5518 PropertyRNA *prop;
5519
5520 prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
5521 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_DO_OUTPUT);
5523 prop, "Active Output", "True if this node is used as the active group output");
5524 RNA_def_property_boolean_funcs(prop, nullptr, "rna_GroupOutput_is_active_output_set");
5525 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5526}
5527
5528static void def_group(BlenderRNA * /*brna*/, StructRNA *srna)
5529{
5530 PropertyRNA *prop;
5531
5532 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
5533 RNA_def_property_pointer_sdna(prop, nullptr, "id");
5534 RNA_def_property_struct_type(prop, "NodeTree");
5536 prop, nullptr, "rna_NodeGroup_node_tree_set", nullptr, "rna_NodeGroup_node_tree_poll");
5539 RNA_def_property_ui_text(prop, "Node Tree", "");
5540 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
5541}
5542
5544 const char *struct_name,
5545 const char *base_name,
5546 const char *ui_name,
5547 const char *ui_desc,
5548 const char *reg_func)
5549{
5550 StructRNA *srna;
5551
5552 srna = RNA_def_struct(brna, struct_name, base_name);
5553 RNA_def_struct_ui_text(srna, ui_name, ui_desc);
5554 RNA_def_struct_sdna(srna, "bNode");
5555
5556 RNA_def_struct_register_funcs(srna, reg_func, "rna_Node_unregister", nullptr);
5557
5558 def_group(brna, srna);
5559}
5560
5561static void def_frame(BlenderRNA * /*brna*/, StructRNA *srna)
5562{
5563 PropertyRNA *prop;
5564
5565 prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
5566 RNA_def_property_pointer_sdna(prop, nullptr, "id");
5567 RNA_def_property_struct_type(prop, "Text");
5570 RNA_def_property_ui_text(prop, "Text", "");
5571 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5572
5573 RNA_def_struct_sdna_from(srna, "NodeFrame", "storage");
5575
5576 prop = RNA_def_property(srna, "shrink", PROP_BOOLEAN, PROP_NONE);
5577 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_FRAME_SHRINK);
5578 RNA_def_property_ui_text(prop, "Shrink", "Shrink the frame to minimal bounding box");
5579 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
5580
5581 prop = RNA_def_property(srna, "label_size", PROP_INT, PROP_NONE);
5582 RNA_def_property_int_sdna(prop, nullptr, "label_size");
5583 RNA_def_property_range(prop, 8, 64);
5584 RNA_def_property_ui_text(prop, "Label Font Size", "Font size to use for displaying the label");
5585 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_FrameNode_label_size_update");
5586}
5587
5588static void def_clamp(BlenderRNA * /*brna*/, StructRNA *srna)
5589{
5590 PropertyRNA *prop;
5591
5592 prop = RNA_def_property(srna, "clamp_type", PROP_ENUM, PROP_NONE);
5593 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5595 RNA_def_property_ui_text(prop, "Clamp Type", "");
5596 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5597}
5598
5599static void def_map_range(BlenderRNA * /*brna*/, StructRNA *srna)
5600{
5601 static const EnumPropertyItem rna_enum_data_type_items[] = {
5602 {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
5603 {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
5604 {0, nullptr, 0, nullptr, nullptr},
5605 };
5606
5607 RNA_def_struct_sdna_from(srna, "NodeMapRange", "storage");
5608
5609 PropertyRNA *prop;
5610
5611 prop = RNA_def_property(srna, "clamp", PROP_BOOLEAN, PROP_NONE);
5612 RNA_def_property_boolean_sdna(prop, nullptr, "clamp", 1);
5613 RNA_def_property_ui_text(prop, "Clamp", "Clamp the result to the target range [To Min, To Max]");
5614 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5615
5616 prop = RNA_def_property(srna, "interpolation_type", PROP_ENUM, PROP_NONE);
5617 RNA_def_property_enum_sdna(prop, nullptr, "interpolation_type");
5619 RNA_def_property_ui_text(prop, "Interpolation Type", "");
5620 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5621
5622 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
5623 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "data_type");
5624 RNA_def_property_enum_items(prop, rna_enum_data_type_items);
5625 RNA_def_property_ui_text(prop, "Data Type", "");
5626 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5627}
5628
5629static void def_math(BlenderRNA * /*brna*/, StructRNA *srna)
5630{
5631 PropertyRNA *prop;
5632
5633 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
5634 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5636 RNA_def_property_ui_text(prop, "Operation", "");
5638 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5640
5641 prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
5642 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_MATH_CLAMP);
5643 RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
5644 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5645}
5646
5647static void def_sh_mix(BlenderRNA * /*brna*/, StructRNA *srna)
5648{
5649 static const EnumPropertyItem rna_enum_mix_mode_items[] = {
5650 {NODE_MIX_MODE_UNIFORM, "UNIFORM", 0, "Uniform", "Use a single factor for all components"},
5651 {NODE_MIX_MODE_NON_UNIFORM, "NON_UNIFORM", 0, "Non-Uniform", "Per component factor"},
5652 {0, nullptr, 0, nullptr, nullptr},
5653 };
5654
5655 PropertyRNA *prop;
5656
5657 RNA_def_struct_sdna_from(srna, "NodeShaderMix", "storage");
5658
5659 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
5660 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_ShaderNodeMix_data_type_itemf");
5663 RNA_def_property_ui_text(prop, "Data Type", "");
5664 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
5665
5666 prop = RNA_def_property(srna, "factor_mode", PROP_ENUM, PROP_NONE);
5667 RNA_def_property_enum_items(prop, rna_enum_mix_mode_items);
5669 RNA_def_property_ui_text(prop, "Factor Mode", "");
5670 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
5671
5672 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
5673 RNA_def_property_enum_sdna(prop, nullptr, "blend_type");
5675 RNA_def_property_ui_text(prop, "Blending Mode", "");
5676 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5677
5678 prop = RNA_def_property(srna, "clamp_factor", PROP_BOOLEAN, PROP_NONE);
5679 RNA_def_property_boolean_sdna(prop, nullptr, "clamp_factor", 1);
5680 RNA_def_property_ui_text(prop, "Clamp Factor", "Clamp the factor to [0,1] range");
5681 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5682
5683 prop = RNA_def_property(srna, "clamp_result", PROP_BOOLEAN, PROP_NONE);
5684 RNA_def_property_boolean_sdna(prop, nullptr, "clamp_result", 1);
5685 RNA_def_property_ui_text(prop, "Clamp Result", "Clamp the result to [0,1] range");
5686 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5687}
5688
5689static void def_float_to_int(BlenderRNA * /*brna*/, StructRNA *srna)
5690{
5691 PropertyRNA *prop;
5692
5693 prop = RNA_def_property(srna, "rounding_mode", PROP_ENUM, PROP_NONE);
5694 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5697 prop, "Rounding Mode", "Method used to convert the float to an integer");
5699 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5700}
5701
5702static void def_vector_math(BlenderRNA * /*brna*/, StructRNA *srna)
5703{
5704 PropertyRNA *prop;
5705
5706 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
5707 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5709 RNA_def_property_ui_text(prop, "Operation", "");
5711 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5713}
5714
5715static void def_rgb_curve(BlenderRNA * /*brna*/, StructRNA *srna)
5716{
5717 PropertyRNA *prop;
5718
5719 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
5720 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
5721 RNA_def_property_struct_type(prop, "CurveMapping");
5722 RNA_def_property_ui_text(prop, "Mapping", "");
5723 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5724}
5725
5726static void def_vector_curve(BlenderRNA * /*brna*/, StructRNA *srna)
5727{
5728 PropertyRNA *prop;
5729
5730 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
5731 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
5732 RNA_def_property_struct_type(prop, "CurveMapping");
5733 RNA_def_property_ui_text(prop, "Mapping", "");
5734 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5735}
5736
5737static void def_float_curve(BlenderRNA * /*brna*/, StructRNA *srna)
5738{
5739 PropertyRNA *prop;
5740
5741 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
5742 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
5743 RNA_def_property_struct_type(prop, "CurveMapping");
5744 RNA_def_property_ui_text(prop, "Mapping", "");
5745 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5746}
5747
5748static void def_time(BlenderRNA * /*brna*/, StructRNA *srna)
5749{
5750 PropertyRNA *prop;
5751
5752 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
5753 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
5754 RNA_def_property_struct_type(prop, "CurveMapping");
5755 RNA_def_property_ui_text(prop, "Curve", "");
5756 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5757
5758 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
5760 "rna_node_property_to_input_getter<int, node_input_start_frame>",
5761 "rna_node_property_to_input_setter<int, node_input_start_frame>",
5762 nullptr);
5763 RNA_def_property_ui_text(prop, "Start Frame", "");
5764 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5765
5766 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
5768 "rna_node_property_to_input_getter<int, node_input_end_frame>",
5769 "rna_node_property_to_input_setter<int, node_input_end_frame>",
5770 nullptr);
5771 RNA_def_property_ui_text(prop, "End Frame", "");
5772 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5773}
5774
5775static void def_colorramp(BlenderRNA * /*brna*/, StructRNA *srna)
5776{
5777 PropertyRNA *prop;
5778
5779 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
5780 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
5781 RNA_def_property_struct_type(prop, "ColorRamp");
5782 RNA_def_property_ui_text(prop, "Color Ramp", "");
5783 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5784}
5785
5786static void def_mix_rgb(BlenderRNA * /*brna*/, StructRNA *srna)
5787{
5788 PropertyRNA *prop;
5789
5790 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
5791 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5793 RNA_def_property_ui_text(prop, "Blending Mode", "");
5794 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5795
5796 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
5797 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_MIXRGB_USE_ALPHA);
5798 RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
5799 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5800
5801 prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
5802 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_MIXRGB_CLAMP);
5803 RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
5804 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5805}
5806
5807static void def_texture(BlenderRNA * /*brna*/, StructRNA *srna)
5808{
5809 PropertyRNA *prop;
5810
5811 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
5812 RNA_def_property_pointer_sdna(prop, nullptr, "id");
5813 RNA_def_property_struct_type(prop, "Texture");
5816 RNA_def_property_ui_text(prop, "Texture", "");
5817 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
5818
5819 prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
5820 RNA_def_property_int_sdna(prop, nullptr, "custom1");
5822 prop, "Node Output", "For node-based textures, which output node to use");
5823 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5824}
5825
5826static void def_fn_input_color(BlenderRNA * /*brna*/, StructRNA *srna)
5827{
5828 PropertyRNA *prop;
5829
5830 RNA_def_struct_sdna_from(srna, "NodeInputColor", "storage");
5831
5832 prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_COLOR);
5833 RNA_def_property_array(prop, 4);
5834 RNA_def_property_float_sdna(prop, nullptr, "color");
5835 RNA_def_property_ui_text(prop, "Color", "");
5836 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5837}
5838
5839static void def_fn_input_bool(BlenderRNA * /*brna*/, StructRNA *srna)
5840{
5841 PropertyRNA *prop;
5842
5843 RNA_def_struct_sdna_from(srna, "NodeInputBool", "storage");
5844
5845 prop = RNA_def_property(srna, "boolean", PROP_BOOLEAN, PROP_NONE);
5846 RNA_def_property_boolean_sdna(prop, nullptr, "boolean", 1);
5847 RNA_def_property_ui_text(prop, "Boolean", "Input value used for unconnected socket");
5848 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5849}
5850
5851static void def_fn_input_int(BlenderRNA * /*brna*/, StructRNA *srna)
5852{
5853 PropertyRNA *prop;
5854
5855 RNA_def_struct_sdna_from(srna, "NodeInputInt", "storage");
5856
5857 prop = RNA_def_property(srna, "integer", PROP_INT, PROP_NONE);
5858 RNA_def_property_int_sdna(prop, nullptr, "integer");
5860 RNA_def_property_ui_text(prop, "Integer", "Input value used for unconnected socket");
5861 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5862}
5863
5864static void def_fn_input_rotation(BlenderRNA * /*brna*/, StructRNA *srna)
5865{
5866 PropertyRNA *prop;
5867
5868 RNA_def_struct_sdna_from(srna, "NodeInputRotation", "storage");
5869
5870 prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
5871 RNA_def_property_float_sdna(prop, nullptr, "rotation_euler");
5872 RNA_def_property_ui_text(prop, "Rotation", "Input value used for unconnected socket");
5873 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5874}
5875
5876static void def_fn_input_vector(BlenderRNA * /*brna*/, StructRNA *srna)
5877{
5878 PropertyRNA *prop;
5879
5880 RNA_def_struct_sdna_from(srna, "NodeInputVector", "storage");
5881
5882 prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_XYZ);
5883 RNA_def_property_array(prop, 3);
5884 RNA_def_property_float_sdna(prop, nullptr, "vector");
5885 RNA_def_property_ui_text(prop, "Vector", "");
5886 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5887}
5888
5889static void def_fn_input_string(BlenderRNA * /*brna*/, StructRNA *srna)
5890{
5891 PropertyRNA *prop;
5892
5893 RNA_def_struct_sdna_from(srna, "NodeInputString", "storage");
5894
5895 prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
5896 RNA_def_property_ui_text(prop, "String", "");
5897 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5898}
5899
5900/* -- Shader Nodes ---------------------------------------------------------- */
5901
5902static void def_sh_output(BlenderRNA * /*brna*/, StructRNA *srna)
5903{
5904 PropertyRNA *prop;
5905
5906 prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
5907 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_DO_OUTPUT);
5909 prop, "Active Output", "True if this node is used as the active output");
5910 RNA_def_property_boolean_funcs(prop, nullptr, "rna_ShaderNode_is_active_output_set");
5911 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5912
5913 prop = RNA_def_property(srna, "target", PROP_ENUM, PROP_NONE);
5914 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5917 prop, "Target", "Which renderer and viewport shading types to use the shaders for");
5918 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5919}
5920
5922{
5923 def_sh_output(brna, srna);
5924 def_mix_rgb(brna, srna);
5925}
5926
5927static void def_sh_mapping(BlenderRNA * /*brna*/, StructRNA *srna)
5928{
5929 PropertyRNA *prop;
5930
5931 prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
5932 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5934 RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
5935 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5936}
5937
5938static void def_sh_vector_rotate(BlenderRNA * /*brna*/, StructRNA *srna)
5939{
5940 PropertyRNA *prop;
5941
5942 prop = RNA_def_property(srna, "rotation_type", PROP_ENUM, PROP_NONE);
5943 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5945 RNA_def_property_ui_text(prop, "Type", "Type of angle input");
5946 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5947
5948 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
5949 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", 0);
5950 RNA_def_property_ui_text(prop, "Invert", "Invert the rotation angle");
5951 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5952}
5953
5954static void def_sh_attribute(BlenderRNA * /*brna*/, StructRNA *srna)
5955{
5956 static const EnumPropertyItem prop_attribute_type[] = {
5958 "GEOMETRY",
5959 0,
5960 "Geometry",
5961 "The attribute is associated with the object geometry, and its value "
5962 "varies from vertex to vertex, or within the object volume"},
5964 "OBJECT",
5965 0,
5966 "Object",
5967 "The attribute is associated with the object or mesh data-block itself, "
5968 "and its value is uniform"},
5970 "INSTANCER",
5971 0,
5972 "Instancer",
5973 "The attribute is associated with the instancer particle system or object, "
5974 "falling back to the Object mode if the attribute isn't found, or the object "
5975 "is not instanced"},
5977 "VIEW_LAYER",
5978 0,
5979 "View Layer",
5980 "The attribute is associated with the View Layer, Scene or World that is being rendered"},
5981 {0, nullptr, 0, nullptr, nullptr},
5982 };
5983 PropertyRNA *prop;
5984
5985 RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage");
5986
5987 prop = RNA_def_property(srna, "attribute_type", PROP_ENUM, PROP_NONE);
5988 RNA_def_property_enum_sdna(prop, nullptr, "type");
5989 RNA_def_property_enum_items(prop, prop_attribute_type);
5990 RNA_def_property_ui_text(prop, "Attribute Type", "General type of the attribute");
5991 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
5992
5993 prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
5994 RNA_def_property_string_sdna(prop, nullptr, "name");
5995 RNA_def_property_ui_text(prop, "Attribute Name", "");
5996 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
5997}
5998
5999static void def_sh_tex(BlenderRNA * /*brna*/, StructRNA *srna)
6000{
6001 PropertyRNA *prop;
6002
6003 prop = RNA_def_property(srna, "texture_mapping", PROP_POINTER, PROP_NONE);
6004 RNA_def_property_pointer_sdna(prop, nullptr, "base.tex_mapping");
6006 RNA_def_property_ui_text(prop, "Texture Mapping", "Texture coordinate mapping settings");
6007
6008 prop = RNA_def_property(srna, "color_mapping", PROP_POINTER, PROP_NONE);
6009 RNA_def_property_pointer_sdna(prop, nullptr, "base.color_mapping");
6011 RNA_def_property_ui_text(prop, "Color Mapping", "Color mapping settings");
6012}
6013
6014static void def_sh_tex_sky(BlenderRNA *brna, StructRNA *srna)
6015{
6016 static const EnumPropertyItem prop_sky_type[] = {
6017 {SHD_SKY_PREETHAM, "PREETHAM", 0, "Preetham", "Preetham 1999"},
6018 {SHD_SKY_HOSEK, "HOSEK_WILKIE", 0, "Hosek / Wilkie", "Hosek / Wilkie 2012"},
6019 {SHD_SKY_NISHITA, "NISHITA", 0, "Nishita", "Nishita 1993 improved"},
6020 {0, nullptr, 0, nullptr, nullptr},
6021 };
6022 static float default_dir[3] = {0.0f, 0.0f, 1.0f};
6023
6024 PropertyRNA *prop;
6025
6026 RNA_def_struct_sdna_from(srna, "NodeTexSky", "storage");
6027 def_sh_tex(brna, srna);
6028
6029 prop = RNA_def_property(srna, "sky_type", PROP_ENUM, PROP_NONE);
6030 RNA_def_property_enum_sdna(prop, nullptr, "sky_model");
6031 RNA_def_property_enum_items(prop, prop_sky_type);
6032 RNA_def_property_ui_text(prop, "Sky Type", "Which sky model should be used");
6033 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
6034
6035 prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION);
6036 RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining");
6037 RNA_def_property_array(prop, 3);
6038 RNA_def_property_float_array_default(prop, default_dir);
6039 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6040
6041 prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE);
6042 RNA_def_property_range(prop, 1.0f, 10.0f);
6043 RNA_def_property_ui_range(prop, 1.0f, 10.0f, 10, 3);
6044 RNA_def_property_ui_text(prop, "Turbidity", "Atmospheric turbidity");
6045 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6046
6047 prop = RNA_def_property(srna, "ground_albedo", PROP_FLOAT, PROP_FACTOR);
6048 RNA_def_property_range(prop, 0.0f, 1.0f);
6050 prop, "Ground Albedo", "Ground color that is subtly reflected in the sky");
6051 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6052
6053 prop = RNA_def_property(srna, "sun_disc", PROP_BOOLEAN, PROP_NONE);
6054 RNA_def_property_ui_text(prop, "Sun Disc", "Include the sun itself in the output");
6055 RNA_def_property_boolean_sdna(prop, nullptr, "sun_disc", 1);
6057 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
6058
6059 prop = RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_ANGLE);
6060 RNA_def_property_ui_text(prop, "Sun Size", "Size of sun disc");
6061 RNA_def_property_range(prop, 0.0f, M_PI_2);
6063 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6064
6065 prop = RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
6066 RNA_def_property_ui_text(prop, "Sun Intensity", "Strength of sun");
6067 RNA_def_property_range(prop, 0.0f, 1000.0f);
6069 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6070
6071 prop = RNA_def_property(srna, "sun_elevation", PROP_FLOAT, PROP_ANGLE);
6072 RNA_def_property_ui_text(prop, "Sun Elevation", "Sun angle from horizon");
6074 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6075
6076 prop = RNA_def_property(srna, "sun_rotation", PROP_FLOAT, PROP_ANGLE);
6077 RNA_def_property_ui_text(prop, "Sun Rotation", "Rotation of sun around zenith");
6079 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6080
6081 prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_DISTANCE);
6082 RNA_def_property_ui_text(prop, "Altitude", "Height from sea level");
6083 RNA_def_property_range(prop, 0.0f, 60000.0f);
6084 RNA_def_property_ui_range(prop, 0.0f, 60000.0f, 10, 1);
6086 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6087
6088 prop = RNA_def_property(srna, "air_density", PROP_FLOAT, PROP_FACTOR);
6090 "Air",
6091 "Density of air molecules.\n"
6092 "\u2022 0 - No air.\n"
6093 "\u2022 1 - Clear day atmosphere.\n"
6094 "\u2022 2 - Highly polluted day");
6095 RNA_def_property_range(prop, 0.0f, 10.0f);
6097 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6098
6099 prop = RNA_def_property(srna, "dust_density", PROP_FLOAT, PROP_FACTOR);
6101 "Dust",
6102 "Density of dust molecules and water droplets.\n"
6103 "\u2022 0 - No dust.\n"
6104 "\u2022 1 - Clear day atmosphere.\n"
6105 "\u2022 5 - City like atmosphere.\n"
6106 "\u2022 10 - Hazy day");
6107 RNA_def_property_range(prop, 0.0f, 10.0f);
6109 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6110
6111 prop = RNA_def_property(srna, "ozone_density", PROP_FLOAT, PROP_FACTOR);
6113 "Ozone",
6114 "Density of ozone layer.\n"
6115 "\u2022 0 - No ozone.\n"
6116 "\u2022 1 - Clear day atmosphere.\n"
6117 "\u2022 2 - City like atmosphere");
6118 RNA_def_property_range(prop, 0.0f, 10.0f);
6120 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6121}
6122
6124 {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
6125 {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
6126 {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
6127 {SHD_INTERP_SMART, "Smart", 0, "Smart", "Bicubic when magnifying, else bilinear (OSL only)"},
6128 {0, nullptr, 0, nullptr, nullptr},
6129};
6130
6132{
6133 static const EnumPropertyItem prop_projection_items[] = {
6135 "EQUIRECTANGULAR",
6136 0,
6137 "Equirectangular",
6138 "Equirectangular or latitude-longitude projection"},
6140 "MIRROR_BALL",
6141 0,
6142 "Mirror Ball",
6143 "Projection from an orthographic photo of a mirror ball"},
6144 {0, nullptr, 0, nullptr, nullptr},
6145 };
6146
6147 PropertyRNA *prop;
6148
6149 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
6150 RNA_def_property_pointer_sdna(prop, nullptr, "id");
6151 RNA_def_property_struct_type(prop, "Image");
6154 RNA_def_property_ui_text(prop, "Image", "");
6155 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
6156
6157 RNA_def_struct_sdna_from(srna, "NodeTexEnvironment", "storage");
6158 def_sh_tex(brna, srna);
6159
6160 prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
6161 RNA_def_property_enum_items(prop, prop_projection_items);
6162 RNA_def_property_ui_text(prop, "Projection", "Projection of the input image");
6163 RNA_def_property_update(prop, 0, "rna_Node_update");
6164
6165 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
6167 RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
6168 RNA_def_property_update(prop, 0, "rna_Node_update");
6169
6170 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
6172 RNA_def_property_pointer_sdna(prop, nullptr, "iuser");
6174 prop,
6175 "Image User",
6176 "Parameters defining which layer, pass and frame of the image is displayed");
6177 RNA_def_property_update(prop, 0, "rna_Node_update");
6178}
6179
6180static void def_sh_tex_gabor(BlenderRNA *brna, StructRNA *srna)
6181{
6182 static const EnumPropertyItem prop_gabor_types[] = {
6184 "2D",
6185 0,
6186 "2D",
6187 "Use the 2D vector (X, Y) as input. The Z component is ignored."},
6188 {SHD_GABOR_TYPE_3D, "3D", 0, "3D", "Use the 3D vector (X, Y, Z) as input"},
6189 {0, nullptr, 0, nullptr, nullptr},
6190 };
6191
6192 RNA_def_struct_sdna_from(srna, "NodeTexGabor", "storage");
6193 def_sh_tex(brna, srna);
6194
6195 PropertyRNA *prop;
6196 prop = RNA_def_property(srna, "gabor_type", PROP_ENUM, PROP_NONE);
6197 RNA_def_property_enum_sdna(prop, nullptr, "type");
6198 RNA_def_property_enum_items(prop, prop_gabor_types);
6199 RNA_def_property_ui_text(prop, "Type", "The type of Gabor noise to evaluate");
6200 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
6201}
6202
6203static void def_sh_tex_image(BlenderRNA *brna, StructRNA *srna)
6204{
6205 static const EnumPropertyItem prop_projection_items[] = {
6207 "FLAT",
6208 0,
6209 "Flat",
6210 "Image is projected flat using the X and Y coordinates of the texture vector"},
6211 {SHD_PROJ_BOX,
6212 "BOX",
6213 0,
6214 "Box",
6215 "Image is projected using different components for each side of the object space bounding "
6216 "box"},
6218 "SPHERE",
6219 0,
6220 "Sphere",
6221 "Image is projected spherically using the Z axis as central"},
6223 "TUBE",
6224 0,
6225 "Tube",
6226 "Image is projected from the tube using the Z axis as central"},
6227 {0, nullptr, 0, nullptr, nullptr},
6228 };
6229
6230 PropertyRNA *prop;
6231
6232 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
6233 RNA_def_property_pointer_sdna(prop, nullptr, "id");
6234 RNA_def_property_struct_type(prop, "Image");
6237 RNA_def_property_ui_text(prop, "Image", "");
6238 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
6239
6240 RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
6241 def_sh_tex(brna, srna);
6242
6243 prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
6244 RNA_def_property_enum_items(prop, prop_projection_items);
6246 prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
6248 RNA_def_property_update(prop, 0, "rna_Node_update");
6249
6250 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
6252 RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
6253 RNA_def_property_update(prop, 0, "rna_Node_update");
6254
6255 prop = RNA_def_property(srna, "projection_blend", PROP_FLOAT, PROP_FACTOR);
6257 prop, "Projection Blend", "For box projection, amount of blend to use between sides");
6258 RNA_def_property_update(prop, 0, "rna_Node_update");
6259
6260 prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
6263 prop, "Extension", "How the image is extrapolated past its original bounds");
6265 RNA_def_property_update(prop, 0, "rna_Node_update");
6266
6267 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
6269 RNA_def_property_pointer_sdna(prop, nullptr, "iuser");
6271 prop,
6272 "Image User",
6273 "Parameters defining which layer, pass and frame of the image is displayed");
6274 RNA_def_property_update(prop, 0, "rna_Node_update");
6275}
6276
6277static void def_tex_combsep_color(BlenderRNA * /*brna*/, StructRNA *srna)
6278{
6279 PropertyRNA *prop;
6280
6281 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6282 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6284 RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
6285 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
6286}
6287
6288static void def_geo_image_texture(BlenderRNA * /*brna*/, StructRNA *srna)
6289{
6290 static const EnumPropertyItem fn_tex_prop_interpolation_items[] = {
6291 {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
6292 {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
6293 {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
6294 {0, nullptr, 0, nullptr, nullptr},
6295 };
6296
6297 PropertyRNA *prop;
6298
6299 RNA_def_struct_sdna_from(srna, "NodeGeometryImageTexture", "storage");
6300
6301 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
6302 RNA_def_property_enum_items(prop, fn_tex_prop_interpolation_items);
6303 RNA_def_property_ui_text(prop, "Interpolation", "Method for smoothing values between pixels");
6304 RNA_def_property_update(prop, 0, "rna_Node_update");
6305
6306 prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
6309 prop, "Extension", "How the image is extrapolated past its original bounds");
6311 RNA_def_property_update(prop, 0, "rna_Node_update");
6312}
6313
6315{
6316 PropertyRNA *prop;
6317
6318 RNA_def_struct_sdna_from(srna, "NodeGeometryTransformGizmo", "storage");
6319
6320 prop = RNA_def_property(srna, "use_translation_x", PROP_BOOLEAN, PROP_NONE);
6322 RNA_def_property_ui_text(prop, "Use Translation X", nullptr);
6323 RNA_def_property_update(prop, 0, "rna_Node_update");
6324
6325 prop = RNA_def_property(srna, "use_translation_y", PROP_BOOLEAN, PROP_NONE);
6327 RNA_def_property_ui_text(prop, "Use Translation Y", nullptr);
6328 RNA_def_property_update(prop, 0, "rna_Node_update");
6329
6330 prop = RNA_def_property(srna, "use_translation_z", PROP_BOOLEAN, PROP_NONE);
6332 RNA_def_property_ui_text(prop, "Use Translation Z", nullptr);
6333 RNA_def_property_update(prop, 0, "rna_Node_update");
6334
6335 prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
6337 RNA_def_property_ui_text(prop, "Use Rotation X", nullptr);
6338 RNA_def_property_update(prop, 0, "rna_Node_update");
6339
6340 prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
6342 RNA_def_property_ui_text(prop, "Use Rotation Y", nullptr);
6343 RNA_def_property_update(prop, 0, "rna_Node_update");
6344
6345 prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
6347 RNA_def_property_ui_text(prop, "Use Rotation Z", nullptr);
6348 RNA_def_property_update(prop, 0, "rna_Node_update");
6349
6350 prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
6352 RNA_def_property_ui_text(prop, "Use Scale X", nullptr);
6353 RNA_def_property_update(prop, 0, "rna_Node_update");
6354
6355 prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
6357 RNA_def_property_ui_text(prop, "Use Scale Y", nullptr);
6358 RNA_def_property_update(prop, 0, "rna_Node_update");
6359
6360 prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
6362 RNA_def_property_ui_text(prop, "Use Scale Z", nullptr);
6363 RNA_def_property_update(prop, 0, "rna_Node_update");
6364}
6365
6367{
6368 static const EnumPropertyItem prop_gradient_type[] = {
6369 {SHD_BLEND_LINEAR, "LINEAR", 0, "Linear", "Create a linear progression"},
6370 {SHD_BLEND_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
6372 "EASING",
6373 0,
6374 "Easing",
6375 "Create a progression easing from one step to the next"},
6376 {SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
6377 {SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
6379 "QUADRATIC_SPHERE",
6380 0,
6381 "Quadratic Sphere",
6382 "Create a quadratic progression in the shape of a sphere"},
6383 {SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Create a radial progression"},
6384 {0, nullptr, 0, nullptr, nullptr},
6385 };
6386
6387 PropertyRNA *prop;
6388
6389 RNA_def_struct_sdna_from(srna, "NodeTexGradient", "storage");
6390 def_sh_tex(brna, srna);
6391
6392 prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
6393 RNA_def_property_enum_items(prop, prop_gradient_type);
6394 RNA_def_property_ui_text(prop, "Gradient Type", "Style of the color blending");
6395 RNA_def_property_update(prop, 0, "rna_Node_update");
6396}
6397
6398static void def_sh_tex_noise(BlenderRNA *brna, StructRNA *srna)
6399{
6400 static const EnumPropertyItem prop_noise_type[] = {
6402 "MULTIFRACTAL",
6403 0,
6404 "Multifractal",
6405 "More uneven result (varies with location), more similar to a real terrain"},
6407 "RIDGED_MULTIFRACTAL",
6408 0,
6409 "Ridged Multifractal",
6410 "Create sharp peaks"},
6412 "HYBRID_MULTIFRACTAL",
6413 0,
6414 "Hybrid Multifractal",
6415 "Create peaks and valleys with different roughness values"},
6416 {SHD_NOISE_FBM, "FBM", 0, "fBM", "The standard fractal Perlin noise"},
6418 "HETERO_TERRAIN",
6419 0,
6420 "Hetero Terrain",
6421 "Similar to Hybrid Multifractal creates a heterogeneous terrain, but with the likeness of "
6422 "river channels"},
6423 {0, nullptr, 0, nullptr, nullptr},
6424 };
6425
6426 PropertyRNA *prop;
6427
6428 RNA_def_struct_sdna_from(srna, "NodeTexNoise", "storage");
6429 def_sh_tex(brna, srna);
6430
6431 prop = RNA_def_property(srna, "noise_dimensions", PROP_ENUM, PROP_NONE);
6432 RNA_def_property_enum_sdna(prop, nullptr, "dimensions");
6434 RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
6436 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
6437
6438 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
6439 RNA_def_property_enum_sdna(prop, nullptr, "type");
6441 RNA_def_property_ui_text(prop, "Type", "Type of the Noise texture");
6442 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
6443
6444 prop = RNA_def_property(srna, "normalize", PROP_BOOLEAN, PROP_NONE);
6445 RNA_def_property_boolean_sdna(prop, nullptr, "normalize", 0);
6446 RNA_def_property_ui_text(prop, "Normalize", "Normalize outputs to 0.0 to 1.0 range");
6447 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6448}
6449
6450static void def_sh_tex_checker(BlenderRNA *brna, StructRNA *srna)
6451{
6452 RNA_def_struct_sdna_from(srna, "NodeTexChecker", "storage");
6453 def_sh_tex(brna, srna);
6454}
6455
6456static void def_sh_tex_brick(BlenderRNA *brna, StructRNA *srna)
6457{
6458 PropertyRNA *prop;
6459
6460 RNA_def_struct_sdna_from(srna, "NodeTexBrick", "storage");
6461 def_sh_tex(brna, srna);
6462
6463 prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
6464 RNA_def_property_int_sdna(prop, nullptr, "offset_freq");
6466 RNA_def_property_range(prop, 1, 99);
6468 prop,
6469 "Offset Frequency",
6470 "How often rows are offset. A value of 2 gives an even/uneven pattern of rows.");
6471 RNA_def_property_update(prop, 0, "rna_Node_update");
6472
6473 prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
6474 RNA_def_property_int_sdna(prop, nullptr, "squash_freq");
6476 RNA_def_property_range(prop, 1, 99);
6478 prop, "Squash Frequency", "How often rows consist of \"squished\" bricks");
6479 RNA_def_property_update(prop, 0, "rna_Node_update");
6480
6481 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
6482 RNA_def_property_float_sdna(prop, nullptr, "offset");
6484 RNA_def_property_range(prop, 0.0f, 1.0f);
6486 prop, "Offset Amount", "Determines the brick offset of the various rows");
6487 RNA_def_property_update(prop, 0, "rna_Node_update");
6488
6489 prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
6490 RNA_def_property_float_sdna(prop, nullptr, "squash");
6492 RNA_def_property_range(prop, 0.0f, 99.0f);
6494 prop,
6495 "Squash Amount",
6496 "Factor to adjust the brick's width for particular rows determined by the Offset Frequency");
6497 RNA_def_property_update(prop, 0, "rna_Node_update");
6498}
6499
6500static void def_sh_tex_magic(BlenderRNA *brna, StructRNA *srna)
6501{
6502 PropertyRNA *prop;
6503
6504 RNA_def_struct_sdna_from(srna, "NodeTexMagic", "storage");
6505 def_sh_tex(brna, srna);
6506
6507 prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
6508 RNA_def_property_int_sdna(prop, nullptr, "depth");
6509 RNA_def_property_range(prop, 0, 10);
6510 RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
6511 RNA_def_property_update(prop, 0, "rna_Node_update");
6512}
6513
6514static void def_sh_tex_voronoi(BlenderRNA *brna, StructRNA *srna)
6515{
6516 static EnumPropertyItem prop_distance_items[] = {
6517 {SHD_VORONOI_EUCLIDEAN, "EUCLIDEAN", 0, "Euclidean", "Euclidean distance"},
6518 {SHD_VORONOI_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Manhattan distance"},
6519 {SHD_VORONOI_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Chebychev distance"},
6520 {SHD_VORONOI_MINKOWSKI, "MINKOWSKI", 0, "Minkowski", "Minkowski distance"},
6521 {0, nullptr, 0, nullptr, nullptr}};
6522
6523 static EnumPropertyItem prop_feature_items[] = {
6525 "F1",
6526 0,
6527 "F1",
6528 "Computes the distance to the closest point as well as its position and color"},
6530 "F2",
6531 0,
6532 "F2",
6533 "Computes the distance to the second closest point as well as its position and color"},
6535 "SMOOTH_F1",
6536 0,
6537 "Smooth F1",
6538 "Smoothed version of F1. Weighted sum of neighbor voronoi cells."},
6540 "DISTANCE_TO_EDGE",
6541 0,
6542 "Distance to Edge",
6543 "Computes the distance to the edge of the voronoi cell"},
6545 "N_SPHERE_RADIUS",
6546 0,
6547 "N-Sphere Radius",
6548 "Computes the radius of the n-sphere inscribed in the voronoi cell"},
6549 {0, nullptr, 0, nullptr, nullptr}};
6550
6551 PropertyRNA *prop;
6552
6553 RNA_def_struct_sdna_from(srna, "NodeTexVoronoi", "storage");
6554 def_sh_tex(brna, srna);
6555
6556 prop = RNA_def_property(srna, "voronoi_dimensions", PROP_ENUM, PROP_NONE);
6557 RNA_def_property_enum_sdna(prop, nullptr, "dimensions");
6559 RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
6561 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
6562
6563 prop = RNA_def_property(srna, "distance", PROP_ENUM, PROP_NONE);
6564 RNA_def_property_enum_sdna(prop, nullptr, "distance");
6565 RNA_def_property_enum_items(prop, prop_distance_items);
6567 prop, "Distance Metric", "The distance metric used to compute the texture");
6568 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
6569
6570 prop = RNA_def_property(srna, "feature", PROP_ENUM, PROP_NONE);
6571 RNA_def_property_enum_sdna(prop, nullptr, "feature");
6572 RNA_def_property_enum_items(prop, prop_feature_items);
6574 prop, "Feature Output", "The Voronoi feature that the node will compute");
6575 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
6576
6577 prop = RNA_def_property(srna, "normalize", PROP_BOOLEAN, PROP_NONE);
6578 RNA_def_property_boolean_sdna(prop, nullptr, "normalize", 0);
6579 RNA_def_property_ui_text(prop, "Normalize", "Normalize output Distance to 0.0 to 1.0 range");
6580 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6581}
6582
6583static void def_sh_tex_wave(BlenderRNA *brna, StructRNA *srna)
6584{
6585 static const EnumPropertyItem prop_wave_type_items[] = {
6586 {SHD_WAVE_BANDS, "BANDS", 0, "Bands", "Use standard wave texture in bands"},
6587 {SHD_WAVE_RINGS, "RINGS", 0, "Rings", "Use wave texture in rings"},
6588 {0, nullptr, 0, nullptr, nullptr},
6589 };
6590
6591 static EnumPropertyItem prop_wave_bands_direction_items[] = {
6592 {SHD_WAVE_BANDS_DIRECTION_X, "X", 0, "X", "Bands across X axis"},
6593 {SHD_WAVE_BANDS_DIRECTION_Y, "Y", 0, "Y", "Bands across Y axis"},
6594 {SHD_WAVE_BANDS_DIRECTION_Z, "Z", 0, "Z", "Bands across Z axis"},
6595 {SHD_WAVE_BANDS_DIRECTION_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Bands across diagonal axis"},
6596 {0, nullptr, 0, nullptr, nullptr},
6597 };
6598
6599 static EnumPropertyItem prop_wave_rings_direction_items[] = {
6600 {SHD_WAVE_RINGS_DIRECTION_X, "X", 0, "X", "Rings along X axis"},
6601 {SHD_WAVE_RINGS_DIRECTION_Y, "Y", 0, "Y", "Rings along Y axis"},
6602 {SHD_WAVE_RINGS_DIRECTION_Z, "Z", 0, "Z", "Rings along Z axis"},
6604 "SPHERICAL",
6605 0,
6606 "Spherical",
6607 "Rings along spherical distance"},
6608 {0, nullptr, 0, nullptr, nullptr},
6609 };
6610
6611 static const EnumPropertyItem prop_wave_profile_items[] = {
6612 {SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"},
6613 {SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"},
6614 {SHD_WAVE_PROFILE_TRI, "TRI", 0, "Triangle", "Use a triangle profile"},
6615 {0, nullptr, 0, nullptr, nullptr},
6616 };
6617
6618 PropertyRNA *prop;
6619
6620 RNA_def_struct_sdna_from(srna, "NodeTexWave", "storage");
6621 def_sh_tex(brna, srna);
6622
6623 prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
6624 RNA_def_property_enum_sdna(prop, nullptr, "wave_type");
6625 RNA_def_property_enum_items(prop, prop_wave_type_items);
6626 RNA_def_property_ui_text(prop, "Wave Type", "");
6627 RNA_def_property_update(prop, 0, "rna_Node_update");
6628
6629 prop = RNA_def_property(srna, "bands_direction", PROP_ENUM, PROP_NONE);
6630 RNA_def_property_enum_sdna(prop, nullptr, "bands_direction");
6631 RNA_def_property_enum_items(prop, prop_wave_bands_direction_items);
6632 RNA_def_property_ui_text(prop, "Bands Direction", "");
6633 RNA_def_property_update(prop, 0, "rna_Node_update");
6634
6635 prop = RNA_def_property(srna, "rings_direction", PROP_ENUM, PROP_NONE);
6636 RNA_def_property_enum_sdna(prop, nullptr, "rings_direction");
6637 RNA_def_property_enum_items(prop, prop_wave_rings_direction_items);
6638 RNA_def_property_ui_text(prop, "Rings Direction", "");
6639 RNA_def_property_update(prop, 0, "rna_Node_update");
6640
6641 prop = RNA_def_property(srna, "wave_profile", PROP_ENUM, PROP_NONE);
6642 RNA_def_property_enum_sdna(prop, nullptr, "wave_profile");
6643 RNA_def_property_enum_items(prop, prop_wave_profile_items);
6644 RNA_def_property_ui_text(prop, "Wave Profile", "");
6645 RNA_def_property_update(prop, 0, "rna_Node_update");
6646}
6647
6648static void def_sh_tex_white_noise(BlenderRNA * /*brna*/, StructRNA *srna)
6649{
6650 PropertyRNA *prop;
6651
6652 prop = RNA_def_property(srna, "noise_dimensions", PROP_ENUM, PROP_NONE);
6653 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6655 RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
6657 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6658}
6659
6660static void def_sh_tex_coord(BlenderRNA * /*brna*/, StructRNA *srna)
6661{
6662 PropertyRNA *prop;
6663
6664 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
6665 RNA_def_property_pointer_sdna(prop, nullptr, "id");
6666 RNA_def_property_struct_type(prop, "Object");
6670 prop, "Object", "Use coordinates from this object (for object texture coordinates output)");
6671 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
6672
6673 prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
6674 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
6676 prop, "From Instancer", "Use the parent of the instance object if possible");
6677 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6678}
6679
6680static void def_sh_vect_transform(BlenderRNA * /*brna*/, StructRNA *srna)
6681{
6682 static const EnumPropertyItem prop_vect_type_items[] = {
6683 {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
6684 {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
6686 "NORMAL",
6687 0,
6688 "Normal",
6689 "Transform a normal vector with unit length"},
6690 {0, nullptr, 0, nullptr, nullptr},
6691 };
6692
6693 static const EnumPropertyItem prop_vect_space_items[] = {
6694 {SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""},
6695 {SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""},
6696 {SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""},
6697 {0, nullptr, 0, nullptr, nullptr},
6698 };
6699
6700 PropertyRNA *prop;
6701
6702 RNA_def_struct_sdna_from(srna, "NodeShaderVectTransform", "storage");
6703
6704 prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
6705 RNA_def_property_enum_sdna(prop, nullptr, "type");
6706 RNA_def_property_enum_items(prop, prop_vect_type_items);
6707 RNA_def_property_ui_text(prop, "Type", "");
6708 RNA_def_property_update(prop, 0, "rna_Node_update");
6709
6710 prop = RNA_def_property(srna, "convert_from", PROP_ENUM, PROP_NONE);
6711 RNA_def_property_enum_items(prop, prop_vect_space_items);
6712 RNA_def_property_ui_text(prop, "Convert From", "Space to convert from");
6713 RNA_def_property_update(prop, 0, "rna_Node_update");
6714
6715 prop = RNA_def_property(srna, "convert_to", PROP_ENUM, PROP_NONE);
6716 RNA_def_property_enum_items(prop, prop_vect_space_items);
6717 RNA_def_property_ui_text(prop, "Convert To", "Space to convert to");
6718 RNA_def_property_update(prop, 0, "rna_Node_update");
6719}
6720
6721static void def_sh_tex_wireframe(BlenderRNA * /*brna*/, StructRNA *srna)
6722{
6723 PropertyRNA *prop;
6724
6725 prop = RNA_def_property(srna, "use_pixel_size", PROP_BOOLEAN, PROP_NONE);
6726 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
6727 RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units");
6729 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6730}
6731
6732static void def_sh_tex_pointdensity(BlenderRNA * /*brna*/, StructRNA *srna)
6733{
6734 PropertyRNA *prop;
6735
6736 FunctionRNA *func;
6737 PropertyRNA *parm;
6738
6739 static const EnumPropertyItem point_source_items[] = {
6741 "PARTICLE_SYSTEM",
6742 0,
6743 "Particle System",
6744 "Generate point density from a particle system"},
6746 "OBJECT",
6747 0,
6748 "Object Vertices",
6749 "Generate point density from an object's vertices"},
6750 {0, nullptr, 0, nullptr, nullptr},
6751 };
6752
6753 static const EnumPropertyItem prop_interpolation_items[] = {
6754 {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
6755 {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
6756 {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
6757 {0, nullptr, 0, nullptr, nullptr},
6758 };
6759
6760 static const EnumPropertyItem space_items[] = {
6761 {SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""},
6762 {SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""},
6763 {0, nullptr, 0, nullptr, nullptr},
6764 };
6765
6766 static const EnumPropertyItem particle_color_source_items[] = {
6768 "PARTICLE_AGE",
6769 0,
6770 "Particle Age",
6771 "Lifetime mapped as 0.0 to 1.0 intensity"},
6773 "PARTICLE_SPEED",
6774 0,
6775 "Particle Speed",
6776 "Particle speed (absolute magnitude of velocity) mapped as 0.0 to 1.0 intensity"},
6778 "PARTICLE_VELOCITY",
6779 0,
6780 "Particle Velocity",
6781 "XYZ velocity mapped to RGB colors"},
6782 {0, nullptr, 0, nullptr, nullptr},
6783 };
6784
6785 static const EnumPropertyItem vertex_color_source_items[] = {
6786 {SHD_POINTDENSITY_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"},
6788 "VERTEX_WEIGHT",
6789 0,
6790 "Vertex Weight",
6791 "Vertex group weight"},
6793 "VERTEX_NORMAL",
6794 0,
6795 "Vertex Normal",
6796 "XYZ normal vector mapped to RGB colors"},
6797 {0, nullptr, 0, nullptr, nullptr},
6798 };
6799
6800 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
6801 RNA_def_property_pointer_sdna(prop, nullptr, "id");
6802 RNA_def_property_struct_type(prop, "Object");
6805 RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
6806 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6807
6808 RNA_def_struct_sdna_from(srna, "NodeShaderTexPointDensity", "storage");
6809
6810 prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
6811 RNA_def_property_enum_items(prop, point_source_items);
6812 RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
6813 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6814
6815 prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
6816 RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
6817 RNA_def_property_struct_type(prop, "ParticleSystem");
6819 "rna_ShaderNodePointDensity_psys_get",
6820 "rna_ShaderNodePointDensity_psys_set",
6821 nullptr,
6822 nullptr);
6825 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6826
6827 prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
6828 RNA_def_property_range(prop, 1, 32768);
6830 prop, "Resolution", "Resolution used by the texture holding the point density");
6831 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6832
6833 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
6834 RNA_def_property_float_sdna(prop, nullptr, "radius");
6835 RNA_def_property_range(prop, 0.001, FLT_MAX);
6837 prop, "Radius", "Radius from the shaded sample to look for points within");
6838 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6839
6840 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6842 RNA_def_property_ui_text(prop, "Space", "Coordinate system to calculate voxels in");
6843 RNA_def_property_update(prop, 0, "rna_Node_update");
6844
6845 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
6846 RNA_def_property_enum_items(prop, prop_interpolation_items);
6847 RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
6848 RNA_def_property_update(prop, 0, "rna_Node_update");
6849
6850 prop = RNA_def_property(srna, "particle_color_source", PROP_ENUM, PROP_NONE);
6851 RNA_def_property_enum_sdna(prop, nullptr, "color_source");
6852 RNA_def_property_enum_items(prop, particle_color_source_items);
6853 RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
6854 RNA_def_property_update(prop, 0, "rna_Node_update");
6855
6856 prop = RNA_def_property(srna, "vertex_color_source", PROP_ENUM, PROP_NONE);
6857 RNA_def_property_enum_sdna(prop, nullptr, "ob_color_source");
6858 RNA_def_property_enum_items(prop, vertex_color_source_items);
6859 RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
6860 RNA_def_property_update(prop, 0, "rna_Node_update");
6861
6862 prop = RNA_def_property(srna, "vertex_attribute_name", PROP_STRING, PROP_NONE);
6863 RNA_def_property_ui_text(prop, "Vertex Attribute Name", "Vertex attribute to use for color");
6864 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6865
6866 func = RNA_def_function(srna, "cache_point_density", "rna_ShaderNodePointDensity_density_cache");
6867 RNA_def_function_ui_description(func, "Cache point density data for later calculation");
6868 RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
6869
6870 func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc");
6871 RNA_def_function_ui_description(func, "Calculate point density");
6872 RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
6873 /* TODO: See how array size of 0 works, this shouldn't be used. */
6874 parm = RNA_def_float_array(func, "rgba_values", 1, nullptr, 0, 0, "", "RGBA Values", 0, 0);
6876 RNA_def_function_output(func, parm);
6877
6878 func = RNA_def_function(
6879 srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax");
6880 RNA_def_function_ui_description(func, "Calculate point density");
6881 RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
6882 parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS);
6883 RNA_def_property_array(parm, 3);
6885 RNA_def_function_output(func, parm);
6886 parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_COORDS);
6887 RNA_def_property_array(parm, 3);
6889 RNA_def_function_output(func, parm);
6890}
6891
6892static void def_metallic(BlenderRNA * /*brna*/, StructRNA *srna)
6893{
6894 PropertyRNA *prop;
6895
6896 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6897 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6899 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6900 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6901
6902 prop = RNA_def_property(srna, "fresnel_type", PROP_ENUM, PROP_NONE);
6903 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
6905 RNA_def_property_ui_text(prop, "Fresnel Type", "Fresnel method used to tint the metal");
6906 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6907}
6908
6909static void def_glossy(BlenderRNA * /*brna*/, StructRNA *srna)
6910{
6911 PropertyRNA *prop;
6912
6913 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6914 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6916 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6917 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6918}
6919
6920static void def_glass(BlenderRNA * /*brna*/, StructRNA *srna)
6921{
6922 PropertyRNA *prop;
6923
6924 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6925 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6927 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6928 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6929}
6930
6931static void def_sheen(BlenderRNA * /*brna*/, StructRNA *srna)
6932{
6933 PropertyRNA *prop;
6934
6935 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6936 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6938 RNA_def_property_ui_text(prop, "Distribution", "Sheen shading model");
6939 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6940}
6941
6942static void def_principled(BlenderRNA * /*brna*/, StructRNA *srna)
6943{
6944 PropertyRNA *prop;
6945
6946 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6947 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6949 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6950 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6951
6952 prop = RNA_def_property(srna, "subsurface_method", PROP_ENUM, PROP_NONE);
6953 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
6956 prop, "Subsurface Method", "Method for rendering subsurface scattering");
6957 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6958}
6959
6960static void def_refraction(BlenderRNA * /*brna*/, StructRNA *srna)
6961{
6962 PropertyRNA *prop;
6963
6964 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6965 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6967 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6968 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6969}
6970
6971static void def_scatter(BlenderRNA * /*brna*/, StructRNA *srna)
6972{
6973 PropertyRNA *prop;
6974
6975 prop = RNA_def_property(srna, "phase", PROP_ENUM, PROP_NONE);
6976 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6978 RNA_def_property_ui_text(prop, "Phase", "Phase function for the scattered light");
6979 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6980}
6981
6982static void def_volume_coefficients(BlenderRNA * /*brna*/, StructRNA *srna)
6983{
6984 PropertyRNA *prop;
6985
6986 prop = RNA_def_property(srna, "phase", PROP_ENUM, PROP_NONE);
6987 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6989 RNA_def_property_ui_text(prop, "Phase", "Phase function for the scattered light");
6990 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6991}
6992
6993static void def_toon(BlenderRNA * /*brna*/, StructRNA *srna)
6994{
6995 PropertyRNA *prop;
6996
6997 prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
6998 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7000 RNA_def_property_ui_text(prop, "Component", "Toon BSDF component to use");
7001 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7002}
7003
7004static void def_sh_bump(BlenderRNA * /*brna*/, StructRNA *srna)
7005{
7006 PropertyRNA *prop;
7007
7008 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
7009 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
7011 prop, "Invert", "Invert the bump mapping direction to push into the surface instead of out");
7012 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7013}
7014
7015static void def_hair(BlenderRNA * /*brna*/, StructRNA *srna)
7016{
7017 PropertyRNA *prop;
7018
7019 prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
7020 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7022 RNA_def_property_ui_text(prop, "Component", "Hair BSDF component to use");
7023 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7024}
7025
7026/* RNA initialization for the custom properties. */
7027static void def_hair_principled(BlenderRNA * /*brna*/, StructRNA *srna)
7028{
7029 PropertyRNA *prop;
7030
7031 RNA_def_struct_sdna_from(srna, "NodeShaderHairPrincipled", "storage");
7032
7033 prop = RNA_def_property(srna, "model", PROP_ENUM, PROP_NONE);
7034 RNA_def_property_enum_sdna(prop, nullptr, "model");
7035 RNA_def_property_ui_text(prop, "Scattering model", "Select from Chiang or Huang model");
7038 /* Upon editing, update both the node data AND the UI representation */
7039 /* (This effectively shows/hides the relevant sockets) */
7040 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
7041
7042 prop = RNA_def_property(srna, "parametrization", PROP_ENUM, PROP_NONE);
7043 RNA_def_property_enum_sdna(prop, nullptr, "parametrization");
7045 prop, "Color Parametrization", "Select the shader's color parametrization");
7048 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
7049}
7050
7051static void def_sh_uvmap(BlenderRNA * /*brna*/, StructRNA *srna)
7052{
7053 PropertyRNA *prop;
7054
7055 prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
7056 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
7058 prop, "From Instancer", "Use the parent of the instance object if possible");
7059 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7060
7061 RNA_def_struct_sdna_from(srna, "NodeShaderUVMap", "storage");
7062
7063 prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
7064 RNA_def_property_ui_text(prop, "UV Map", "UV coordinates to be used for mapping");
7065 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7066
7067 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7068}
7069
7070static void def_sh_vertex_color(BlenderRNA * /*brna*/, StructRNA *srna)
7071{
7072 PropertyRNA *prop;
7073
7074 RNA_def_struct_sdna_from(srna, "NodeShaderVertexColor", "storage");
7075
7076 prop = RNA_def_property(srna, "layer_name", PROP_STRING, PROP_NONE);
7077 RNA_def_property_ui_text(prop, "Color Attribute", "Color Attribute");
7078 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7079
7080 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7081}
7082
7083static void def_sh_uvalongstroke(BlenderRNA * /*brna*/, StructRNA *srna)
7084{
7085 PropertyRNA *prop;
7086
7087 prop = RNA_def_property(srna, "use_tips", PROP_BOOLEAN, PROP_NONE);
7088 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
7090 prop, "Use Tips", "Lower half of the texture is for tips of the stroke");
7091 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7092}
7093
7094static void def_sh_normal_map(BlenderRNA * /*brna*/, StructRNA *srna)
7095{
7096 static const EnumPropertyItem prop_space_items[] = {
7097 {SHD_SPACE_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"},
7098 {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"},
7099 {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
7101 "BLENDER_OBJECT",
7102 0,
7103 "Blender Object Space",
7104 "Object space normal mapping, compatible with Blender render baking"},
7106 "BLENDER_WORLD",
7107 0,
7108 "Blender World Space",
7109 "World space normal mapping, compatible with Blender render baking"},
7110 {0, nullptr, 0, nullptr, nullptr},
7111 };
7112
7113 PropertyRNA *prop;
7114
7115 RNA_def_struct_sdna_from(srna, "NodeShaderNormalMap", "storage");
7116
7117 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
7118 RNA_def_property_enum_items(prop, prop_space_items);
7119 RNA_def_property_ui_text(prop, "Space", "Space of the input normal");
7120 RNA_def_property_update(prop, 0, "rna_Node_update");
7121
7122 prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
7123 RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent space maps");
7124 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7125
7126 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7127}
7128
7129static void def_sh_displacement(BlenderRNA * /*brna*/, StructRNA *srna)
7130{
7131 static const EnumPropertyItem prop_space_items[] = {
7133 "OBJECT",
7134 0,
7135 "Object Space",
7136 "Displacement is in object space, affected by object scale"},
7138 "WORLD",
7139 0,
7140 "World Space",
7141 "Displacement is in world space, not affected by object scale"},
7142 {0, nullptr, 0, nullptr, nullptr},
7143 };
7144
7145 PropertyRNA *prop;
7146
7147 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
7148 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7149 RNA_def_property_enum_items(prop, prop_space_items);
7150 RNA_def_property_ui_text(prop, "Space", "Space of the input height");
7151 RNA_def_property_update(prop, 0, "rna_Node_update");
7152
7153 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7154}
7155
7157{
7158 static const EnumPropertyItem prop_space_items[] = {
7160 "TANGENT",
7161 0,
7162 "Tangent Space",
7163 "Tangent space vector displacement mapping"},
7164 {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space vector displacement mapping"},
7165 {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space vector displacement mapping"},
7166 {0, nullptr, 0, nullptr, nullptr},
7167 };
7168
7169 PropertyRNA *prop;
7170
7171 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
7172 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7173 RNA_def_property_enum_items(prop, prop_space_items);
7174 RNA_def_property_ui_text(prop, "Space", "Space of the input height");
7175 RNA_def_property_update(prop, 0, "rna_Node_update");
7176
7177 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7178}
7179
7180static void def_sh_tangent(BlenderRNA * /*brna*/, StructRNA *srna)
7181{
7182 static const EnumPropertyItem prop_direction_type_items[] = {
7183 {SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
7184 {SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
7185 {0, nullptr, 0, nullptr, nullptr},
7186 };
7187
7188 static const EnumPropertyItem prop_axis_items[] = {
7189 {SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
7190 {SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
7191 {SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
7192 {0, nullptr, 0, nullptr, nullptr},
7193 };
7194
7195 PropertyRNA *prop;
7196
7197 RNA_def_struct_sdna_from(srna, "NodeShaderTangent", "storage");
7198
7199 prop = RNA_def_property(srna, "direction_type", PROP_ENUM, PROP_NONE);
7200 RNA_def_property_enum_items(prop, prop_direction_type_items);
7201 RNA_def_property_ui_text(prop, "Direction", "Method to use for the tangent");
7202 RNA_def_property_update(prop, 0, "rna_Node_update");
7203
7204 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
7205 RNA_def_property_enum_items(prop, prop_axis_items);
7206 RNA_def_property_ui_text(prop, "Axis", "Axis for radial tangents");
7207 RNA_def_property_update(prop, 0, "rna_Node_update");
7208
7209 prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
7210 RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent generated from UV");
7211 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7212
7213 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7214}
7215
7216static void def_sh_bevel(BlenderRNA * /*brna*/, StructRNA *srna)
7217{
7218 PropertyRNA *prop;
7219
7220 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
7221 RNA_def_property_int_sdna(prop, nullptr, "custom1");
7222 RNA_def_property_range(prop, 2, 128);
7223 RNA_def_property_ui_range(prop, 2, 16, 1, 1);
7224 RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
7225 RNA_def_property_update(prop, 0, "rna_Node_update");
7226}
7227
7228static void def_sh_ambient_occlusion(BlenderRNA * /*brna*/, StructRNA *srna)
7229{
7230 PropertyRNA *prop;
7231
7232 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
7233 RNA_def_property_int_sdna(prop, nullptr, "custom1");
7234 RNA_def_property_range(prop, 1, 128);
7235 RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
7236 RNA_def_property_update(prop, 0, "rna_Node_update");
7237
7238 prop = RNA_def_property(srna, "inside", PROP_BOOLEAN, PROP_NONE);
7239 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_AO_INSIDE);
7240 RNA_def_property_ui_text(prop, "Inside", "Trace rays towards the inside of the object");
7241 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7242
7243 prop = RNA_def_property(srna, "only_local", PROP_BOOLEAN, PROP_NONE);
7244 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_AO_LOCAL);
7246 prop, "Only Local", "Only consider the object itself when computing AO");
7247 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7248}
7249
7250static void def_sh_subsurface(BlenderRNA * /*brna*/, StructRNA *srna)
7251{
7252 PropertyRNA *prop;
7253
7254 prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
7255 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7257 RNA_def_property_ui_text(prop, "Method", "Method for rendering subsurface scattering");
7258 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
7259}
7260
7261static void def_sh_tex_ies(BlenderRNA * /*brna*/, StructRNA *srna)
7262{
7263 PropertyRNA *prop;
7264
7265 prop = RNA_def_property(srna, "ies", PROP_POINTER, PROP_NONE);
7266 RNA_def_property_pointer_sdna(prop, nullptr, "id");
7267 RNA_def_property_struct_type(prop, "Text");
7270 RNA_def_property_ui_text(prop, "IES Text", "Internal IES file");
7271 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7272
7273 RNA_def_struct_sdna_from(srna, "NodeShaderTexIES", "storage");
7274
7275 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
7276 RNA_def_property_ui_text(prop, "File Path", "IES light path");
7278 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7279
7280 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
7281 RNA_def_property_enum_funcs(prop, nullptr, "rna_ShaderNodeTexIES_mode_set", nullptr);
7284 prop, "Source", "Whether the IES file is loaded from disk or from a text data-block");
7285 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7286
7287 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7288}
7289
7290static void def_sh_output_aov(BlenderRNA * /*brna*/, StructRNA *srna)
7291{
7292 PropertyRNA *prop;
7293
7294 RNA_def_struct_sdna_from(srna, "NodeShaderOutputAOV", "storage");
7295
7296 prop = RNA_def_property(srna, "aov_name", PROP_STRING, PROP_NONE);
7297 RNA_def_property_string_sdna(prop, nullptr, "name");
7298 RNA_def_property_ui_text(prop, "Name", "Name of the AOV that this output writes to");
7299 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7300
7301 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7302}
7303
7304static void def_sh_combsep_color(BlenderRNA * /*brna*/, StructRNA *srna)
7305{
7306 static const EnumPropertyItem type_items[] = {
7308 "RGB",
7309 ICON_NONE,
7310 "RGB",
7311 "Use RGB (Red, Green, Blue) color processing"},
7313 "HSV",
7314 ICON_NONE,
7315 "HSV",
7316 "Use HSV (Hue, Saturation, Value) color processing"},
7318 "HSL",
7319 ICON_NONE,
7320 "HSL",
7321 "Use HSL (Hue, Saturation, Lightness) color processing"},
7322 {0, nullptr, 0, nullptr, nullptr},
7323 };
7324
7325 PropertyRNA *prop;
7326
7327 RNA_def_struct_sdna_from(srna, "NodeCombSepColor", "storage");
7328
7329 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
7330 RNA_def_property_enum_items(prop, type_items);
7331 RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
7332 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
7333}
7334
7335static void def_sh_script(BlenderRNA * /*brna*/, StructRNA *srna)
7336{
7337 PropertyRNA *prop;
7338
7339 prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
7340 RNA_def_property_pointer_sdna(prop, nullptr, "id");
7341 RNA_def_property_struct_type(prop, "Text");
7344 RNA_def_property_ui_text(prop, "Script", "Internal shader script to define the shader");
7345 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
7346
7347 RNA_def_struct_sdna_from(srna, "NodeShaderScript", "storage");
7348
7349 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
7350 RNA_def_property_ui_text(prop, "File Path", "Shader script path");
7352 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
7353
7354 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
7355 RNA_def_property_enum_funcs(prop, nullptr, "rna_ShaderNodeScript_mode_set", nullptr);
7357 RNA_def_property_ui_text(prop, "Script Source", "");
7358 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7359
7360 prop = RNA_def_property(srna, "use_auto_update", PROP_BOOLEAN, PROP_NONE);
7363 prop,
7364 "Auto Update",
7365 "Automatically update the shader when the .osl file changes (external scripts only)");
7366
7367 prop = RNA_def_property(srna, "bytecode", PROP_STRING, PROP_NONE);
7369 "rna_ShaderNodeScript_bytecode_get",
7370 "rna_ShaderNodeScript_bytecode_length",
7371 "rna_ShaderNodeScript_bytecode_set");
7372 RNA_def_property_ui_text(prop, "Bytecode", "Compile bytecode for shader script node");
7373 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7374
7375 prop = RNA_def_property(srna, "bytecode_hash", PROP_STRING, PROP_NONE);
7377 prop, "Bytecode Hash", "Hash of compile bytecode, for quick equality checking");
7378 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7379
7380 /* needs to be reset to avoid bad pointer type in API functions below */
7381 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
7382
7383 /* API functions */
7384
7385# if 0 /* XXX TODO: use general node API for this. */
7386 func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket");
7387 RNA_def_function_ui_description(func, "Find a socket by name");
7388 parm = RNA_def_string(func, "name", nullptr, 0, "Socket name", "");
7390 /*parm =*/RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
7391 parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
7392 RNA_def_function_return(func, parm);
7393
7394 func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket");
7395 RNA_def_function_ui_description(func, "Add a socket");
7397 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "");
7399 parm = RNA_def_enum(func, "type", rna_enum_node_socket_type_items, SOCK_FLOAT, "Type", "");
7401 /*parm =*/RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
7402 parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
7403 RNA_def_function_return(func, parm);
7404
7405 func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket");
7406 RNA_def_function_ui_description(func, "Remove a socket");
7408 parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "");
7410# endif
7411}
7412
7413/* -- Compositor Nodes ------------------------------------------------------ */
7414
7415static void def_cmp_alpha_over(BlenderRNA * /*brna*/, StructRNA *srna)
7416{
7417 PropertyRNA *prop;
7418
7419 prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
7421 prop,
7422 "rna_node_property_to_input_getter<bool, node_input_straight_alpha>",
7423 "rna_node_property_to_input_setter<bool, node_input_straight_alpha>");
7425 prop, "Convert Premultiplied", "(Deprecated: Use Straight Alpha input instead.)");
7426 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7427
7428 prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_FACTOR);
7429 RNA_def_property_float_sdna(prop, nullptr, "custom3");
7430 RNA_def_property_range(prop, 0.0f, 1.0f);
7431 RNA_def_property_ui_text(prop, "Premultiplied", "Mix Factor. (Deprecated: Unused.)");
7432 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7433}
7434
7435static void def_cmp_blur(BlenderRNA * /*brna*/, StructRNA *srna)
7436{
7437 PropertyRNA *prop;
7438
7439 static const EnumPropertyItem filter_type_items[] = {
7440 {R_FILTER_BOX, "FLAT", 0, "Flat", ""},
7441 {R_FILTER_TENT, "TENT", 0, "Tent", ""},
7442 {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
7443 {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
7444 {R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
7445 {R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
7446 {R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
7447 {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
7448 {0, nullptr, 0, nullptr, nullptr},
7449 };
7450
7451 static const EnumPropertyItem aspect_correction_type_items[] = {
7452 {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
7453 {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
7454 {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
7455 {0, nullptr, 0, nullptr, nullptr},
7456 };
7457
7458 /* duplicated in def_cmp_bokehblur */
7459 prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
7460 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
7462 prop,
7463 "Variable Size",
7464 "Support variable blur per pixel when using an image for size input. (Deprecated: Unused.)");
7465 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7466
7467 prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
7469 prop,
7470 "rna_node_property_to_input_getter<bool, node_input_extend_bounds>",
7471 "rna_node_property_to_input_setter<bool, node_input_extend_bounds>");
7473 "Extend Bounds",
7474 "Extend bounds of the input image to fully fit blurred image. "
7475 "(Deprecated: Use Extend Bounds input instead.)");
7476 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7477
7478 RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
7479
7480 prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
7481 RNA_def_property_int_funcs(prop, "rna_NodeBlur_size_x_get", "rna_NodeCrop_size_x_set", nullptr);
7482 RNA_def_property_range(prop, 0, 2048);
7483 RNA_def_property_ui_text(prop, "Size X", "(Deprecated: Use Size input instead.)");
7484 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7485
7486 prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
7487 RNA_def_property_int_funcs(prop, "rna_NodeBlur_size_y_get", "rna_NodeCrop_size_y_set", nullptr);
7488 RNA_def_property_range(prop, 0, 2048);
7489 RNA_def_property_ui_text(prop, "Size Y", "(Deprecated: Use Size input instead.)");
7490 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7491
7492 prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
7493 RNA_def_property_boolean_sdna(prop, nullptr, "relative", 1);
7495 prop,
7496 "Relative",
7497 "Use relative (percent) values to define blur radius. (Deprecated: Unused.)");
7498 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7499
7500 prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE);
7501 RNA_def_property_enum_sdna(prop, nullptr, "aspect");
7502 RNA_def_property_enum_items(prop, aspect_correction_type_items);
7504 prop, "Aspect Correction", "Type of aspect correction to use. (Deprecated: Unused.)");
7505 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7506
7507 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
7508 RNA_def_property_float_sdna(prop, nullptr, "fac");
7509 RNA_def_property_range(prop, 0.0f, 2.0f);
7510 RNA_def_property_ui_text(prop, "Factor", "(Deprecated: Unused.)");
7511 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7512
7513 prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE);
7514 RNA_def_property_float_sdna(prop, nullptr, "percentx");
7515 RNA_def_property_range(prop, 0.0f, 100.0f);
7516 RNA_def_property_ui_text(prop, "Relative Size X", "(Deprecated: Unused.)");
7517 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7518
7519 prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE);
7520 RNA_def_property_float_sdna(prop, nullptr, "percenty");
7521 RNA_def_property_range(prop, 0.0f, 100.0f);
7522 RNA_def_property_ui_text(prop, "Relative Size Y", "(Deprecated: Unused.)");
7523 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7524
7525 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
7526 RNA_def_property_enum_sdna(prop, nullptr, "filtertype");
7527 RNA_def_property_enum_items(prop, filter_type_items);
7528 RNA_def_property_ui_text(prop, "Filter Type", "");
7530 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7531
7532 prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE);
7533 RNA_def_property_boolean_funcs(prop, "rna_NodeBlur_use_bokeh_get", "rna_NodeCrop_use_bokeh_set");
7535 prop, "Bokeh", "Use circular filter (slower). (Deprecated: Use Separable input instead.)");
7536 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7537
7538 prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
7539 RNA_def_property_boolean_sdna(prop, nullptr, "gamma", 1);
7541 prop,
7542 "Gamma",
7543 "Apply filter on gamma corrected values. (Deprecated: Unused. Use Gamma node instead.)");
7544 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7545}
7546
7547static void def_cmp_filter(BlenderRNA * /*brna*/, StructRNA *srna)
7548{
7549 PropertyRNA *prop;
7550
7551 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
7552 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7554 RNA_def_property_ui_text(prop, "Filter Type", "");
7555 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7556}
7557
7558static void def_cmp_map_value(BlenderRNA * /*brna*/, StructRNA *srna)
7559{
7560 PropertyRNA *prop;
7561
7562 RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
7563
7564 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
7565 RNA_def_property_float_sdna(prop, nullptr, "loc");
7566 RNA_def_property_array(prop, 1);
7567 RNA_def_property_range(prop, -1000.0f, 1000.0f);
7568 RNA_def_property_ui_text(prop, "Offset", "");
7569 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7570
7571 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
7572 RNA_def_property_float_sdna(prop, nullptr, "size");
7573 RNA_def_property_array(prop, 1);
7574 RNA_def_property_range(prop, -1000.0f, 1000.0f);
7575 RNA_def_property_ui_text(prop, "Size", "");
7576 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7577
7578 prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
7579 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEXMAP_CLIP_MIN);
7580 RNA_def_property_ui_text(prop, "Use Minimum", "");
7581 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7582
7583 prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
7584 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEXMAP_CLIP_MAX);
7585 RNA_def_property_ui_text(prop, "Use Maximum", "");
7586 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7587
7588 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
7589 RNA_def_property_float_sdna(prop, nullptr, "min");
7590 RNA_def_property_array(prop, 1);
7591 RNA_def_property_range(prop, -1000.0f, 1000.0f);
7592 RNA_def_property_ui_text(prop, "Minimum", "");
7593 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7594
7595 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
7596 RNA_def_property_float_sdna(prop, nullptr, "max");
7597 RNA_def_property_array(prop, 1);
7598 RNA_def_property_range(prop, -1000.0f, 1000.0f);
7599 RNA_def_property_ui_text(prop, "Maximum", "");
7600 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7601}
7602
7603static void def_cmp_map_range(BlenderRNA * /*brna*/, StructRNA *srna)
7604{
7605 PropertyRNA *prop;
7606
7607 prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
7608 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
7609 RNA_def_property_ui_text(prop, "Clamp", "Clamp the result of the node to the target range");
7610 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7611}
7612
7613static void def_cmp_vector_blur(BlenderRNA * /*brna*/, StructRNA *srna)
7614{
7615 PropertyRNA *prop;
7616
7617 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
7619 "rna_node_property_to_input_getter<int, node_input_samples>",
7620 "rna_node_property_to_input_setter<int, node_input_samples>",
7621 nullptr);
7622 RNA_def_property_range(prop, 1, 256);
7623 RNA_def_property_ui_text(prop, "Samples", "(Deprecated: Use Samples input instead.)");
7624 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7625
7626 prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
7627 RNA_def_property_int_sdna(prop, nullptr, "custom1");
7628 RNA_def_property_range(prop, 0, 1024);
7630 "Min Speed",
7631 "Minimum speed for a pixel to be blurred (used to separate background "
7632 "from foreground). (Deprecated.)");
7633 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7634
7635 prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
7636 RNA_def_property_int_sdna(prop, nullptr, "custom2");
7637 RNA_def_property_range(prop, 0, 1024);
7638 RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none. (Deprecated.)");
7639 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7640
7641 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
7643 prop, "rna_NodeVectorBlur_shutter_get", "rna_NodeVectorBlur_shutter_set", nullptr);
7644 RNA_def_property_range(prop, 0.0, 20.0);
7645 RNA_def_property_ui_range(prop, 0.0, 2.0, 1.0, 2);
7647 "Blur Factor",
7648 "Scaling factor for motion vectors (actually, 'shutter speed', in "
7649 "frames). (Deprecated: Use Shutter input instead.)");
7650 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7651
7652 prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
7653 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", 1);
7655 prop,
7656 "Curved",
7657 "Interpolate between frames in a Bézier curve, rather than linearly. (Deprecated.)");
7658 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7659}
7660
7661static void def_cmp_set_alpha(BlenderRNA * /*brna*/, StructRNA *srna)
7662{
7663 PropertyRNA *prop;
7664
7665 static const EnumPropertyItem mode_items[] = {
7667 "APPLY",
7668 0,
7669 "Apply Mask",
7670 "Multiply the input image's RGBA channels by the alpha input value"},
7672 "REPLACE_ALPHA",
7673 0,
7674 "Replace Alpha",
7675 "Replace the input image's alpha channel by the alpha input value"},
7676 {0, nullptr, 0, nullptr, nullptr},
7677 };
7678
7679 RNA_def_struct_sdna_from(srna, "NodeSetAlpha", "storage");
7680
7681 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
7682 RNA_def_property_enum_items(prop, mode_items);
7683 RNA_def_property_ui_text(prop, "Mode", "");
7684 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7685}
7686
7687static void def_cmp_levels(BlenderRNA * /*brna*/, StructRNA *srna)
7688{
7689 PropertyRNA *prop;
7690
7691 static const EnumPropertyItem channel_items[] = {
7692 {CMP_NODE_LEVLES_LUMINANCE, "COMBINED_RGB", 0, "Combined", "Combined RGB"},
7693 {CMP_NODE_LEVLES_RED, "RED", 0, "Red", "Red Channel"},
7694 {CMP_NODE_LEVLES_GREEN, "GREEN", 0, "Green", "Green Channel"},
7695 {CMP_NODE_LEVLES_BLUE, "BLUE", 0, "Blue", "Blue Channel"},
7696 {CMP_NODE_LEVLES_LUMINANCE_BT709, "LUMINANCE", 0, "Luminance", "Luminance Channel"},
7697 {0, nullptr, 0, nullptr, nullptr},
7698 };
7699
7700 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
7701 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7702 RNA_def_property_enum_items(prop, channel_items);
7703 RNA_def_property_ui_text(prop, "Channel", "");
7704 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7705}
7706
7707static void def_node_image_user(BlenderRNA * /*brna*/, StructRNA *srna)
7708{
7709 PropertyRNA *prop;
7710
7711 prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
7712 RNA_def_property_int_sdna(prop, nullptr, "frames");
7715 prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.cc */
7716 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7717
7718 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
7719 RNA_def_property_int_sdna(prop, nullptr, "sfra");
7721 /* copied from the rna_image.cc */
7723 prop,
7724 "Start Frame",
7725 "Global starting frame of the movie/sequence, assuming first picture has a #1");
7726 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7727
7728 prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
7729 RNA_def_property_int_sdna(prop, nullptr, "offset");
7731 /* copied from the rna_image.cc */
7733 prop, "Offset", "Offset the number of the frame to use in the animation");
7734 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7735
7736 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
7737 RNA_def_property_boolean_sdna(prop, nullptr, "cycl", 1);
7739 prop, "Cyclic", "Cycle the images in the movie"); /* copied from the rna_image.cc */
7740 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7741
7742 prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
7743 RNA_def_property_boolean_sdna(prop, nullptr, "flag", IMA_ANIM_ALWAYS);
7744 /* copied from the rna_image.cc */
7745 RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes");
7746 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7747
7748 prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
7749 RNA_def_property_enum_sdna(prop, nullptr, "layer");
7751 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_image_layer_itemf");
7753 RNA_def_property_ui_text(prop, "Layer", "");
7754 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_image_layer_update");
7755
7756 prop = RNA_def_property(srna, "has_layers", PROP_BOOLEAN, PROP_NONE);
7757 RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_layers_get", nullptr);
7759 RNA_def_property_ui_text(prop, "Has Layers", "True if this image has any named layer");
7760
7761 prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
7762 RNA_def_property_enum_sdna(prop, nullptr, "view");
7764 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_image_view_itemf");
7766 RNA_def_property_ui_text(prop, "View", "");
7767 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7768
7769 prop = RNA_def_property(srna, "has_views", PROP_BOOLEAN, PROP_NONE);
7770 RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_views_get", nullptr);
7772 RNA_def_property_ui_text(prop, "Has View", "True if this image has multiple views");
7773}
7774
7775static void def_cmp_image(BlenderRNA *brna, StructRNA *srna)
7776{
7777 PropertyRNA *prop;
7778
7779# if 0
7780 static const EnumPropertyItem type_items[] = {
7781 {IMA_SRC_FILE, "IMAGE", 0, "Image", ""},
7782 {IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
7783 {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
7784 {IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
7785 {0, nullptr, 0, nullptr, nullptr},
7786 };
7787# endif
7788
7789 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
7790 RNA_def_property_pointer_sdna(prop, nullptr, "id");
7791 RNA_def_property_struct_type(prop, "Image");
7794 RNA_def_property_ui_text(prop, "Image", "");
7795 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Image_Node_update_id");
7796
7797 prop = RNA_def_property(srna, "use_straight_alpha_output", PROP_BOOLEAN, PROP_NONE);
7800 "Straight Alpha Output",
7801 "Put node output buffer to straight alpha instead of premultiplied");
7802 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7803
7804 /* NOTE: Image user properties used in the UI are redefined in def_node_image_user,
7805 * to trigger correct updates of the node editor. RNA design problem that prevents
7806 * updates from nested structs. */
7807 RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
7808 def_node_image_user(brna, srna);
7809}
7810
7811static void def_cmp_render_layers(BlenderRNA * /*brna*/, StructRNA *srna)
7812{
7813 PropertyRNA *prop;
7814
7815 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
7816 RNA_def_property_pointer_sdna(prop, nullptr, "id");
7817 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Node_scene_set", nullptr, nullptr);
7818 RNA_def_property_struct_type(prop, "Scene");
7821 RNA_def_property_ui_text(prop, "Scene", "");
7822 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
7823
7824 prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
7825 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7827 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_view_layer_itemf");
7829 RNA_def_property_ui_text(prop, "Layer", "");
7830 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
7831}
7832
7834{
7835 StructRNA *srna;
7836 PropertyRNA *prop;
7837
7838 srna = RNA_def_struct(brna, "NodeOutputFileSlotFile", nullptr);
7839 RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
7841 srna, "Output File Slot", "Single layer file slot of the file output node");
7842
7843 prop = RNA_def_property(srna, "use_node_format", PROP_BOOLEAN, PROP_NONE);
7844 RNA_def_property_boolean_sdna(prop, nullptr, "use_node_format", 1);
7845 RNA_def_property_ui_text(prop, "Use Node Format", "");
7846 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
7847
7848 prop = RNA_def_property(srna, "save_as_render", PROP_BOOLEAN, PROP_NONE);
7849 RNA_def_property_boolean_sdna(prop, nullptr, "save_as_render", 1);
7851 prop, "Save as Render", "Apply render part of display transform when saving byte image");
7852 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
7853
7854 prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
7855 RNA_def_property_struct_type(prop, "ImageFormatSettings");
7856
7857 prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
7858 RNA_def_property_string_sdna(prop, nullptr, "path");
7859 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_NodeOutputFileSlotFile_path_set");
7860 RNA_def_struct_name_property(srna, prop);
7861 RNA_def_property_ui_text(prop, "Path", "Subpath used for this slot");
7865 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
7866}
7868{
7869 StructRNA *srna;
7870 PropertyRNA *prop;
7871
7872 srna = RNA_def_struct(brna, "NodeOutputFileSlotLayer", nullptr);
7873 RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
7875 srna, "Output File Layer Slot", "Multilayer slot of the file output node");
7876
7877 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
7878 RNA_def_property_string_sdna(prop, nullptr, "layer");
7879 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_NodeOutputFileSlotLayer_name_set");
7880 RNA_def_struct_name_property(srna, prop);
7881 RNA_def_property_ui_text(prop, "Name", "OpenEXR layer name used for this slot");
7882 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
7883}
7885 PropertyRNA *cprop,
7886 const char *struct_name)
7887{
7888 StructRNA *srna;
7889 PropertyRNA *parm;
7890 FunctionRNA *func;
7891
7892 RNA_def_property_srna(cprop, struct_name);
7893 srna = RNA_def_struct(brna, struct_name, nullptr);
7894 RNA_def_struct_sdna(srna, "bNode");
7895 RNA_def_struct_ui_text(srna, "File Output Slots", "Collection of File Output node slots");
7896
7897 func = RNA_def_function(srna, "new", "rna_NodeOutputFile_slots_new");
7898 RNA_def_function_ui_description(func, "Add a file slot to this node");
7900 parm = RNA_def_string(func, "name", nullptr, MAX_NAME, "Name", "");
7902 /* return value */
7903 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
7904 RNA_def_function_return(func, parm);
7905
7906 /* NOTE: methods below can use the standard node socket API functions,
7907 * included here for completeness. */
7908
7909 func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
7910 RNA_def_function_ui_description(func, "Remove a file slot from this node");
7912 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
7914
7915 func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear");
7916 RNA_def_function_ui_description(func, "Remove all file slots from this node");
7918
7919 func = RNA_def_function(srna, "move", "rna_Node_inputs_move");
7920 RNA_def_function_ui_description(func, "Move a file slot to another position");
7922 parm = RNA_def_int(
7923 func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
7925 parm = RNA_def_int(
7926 func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
7928}
7930{
7931 PropertyRNA *prop;
7932
7935
7936 RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage");
7937
7938 prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH);
7939 RNA_def_property_string_sdna(prop, nullptr, "base_path");
7940 RNA_def_property_ui_text(prop, "Base Path", "Base output path for the image");
7944 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7945
7946 prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_NONE);
7947 RNA_def_property_int_sdna(prop, nullptr, "active_input");
7948 RNA_def_property_ui_text(prop, "Active Input Index", "Active input index in details view list");
7949 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7950
7951 prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
7952 RNA_def_property_struct_type(prop, "ImageFormatSettings");
7953
7954 prop = RNA_def_property(srna, "save_as_render", PROP_BOOLEAN, PROP_NONE);
7955 RNA_def_property_boolean_sdna(prop, nullptr, "save_as_render", 1);
7957 prop, "Save as Render", "Apply render part of display transform when saving byte image");
7958 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
7959
7960 /* XXX using two different collections here for the same basic DNA list!
7961 * Details of the output slots depend on whether the node is in Multilayer EXR mode.
7962 */
7963
7964 prop = RNA_def_property(srna, "file_slots", PROP_COLLECTION, PROP_NONE);
7966 "rna_NodeOutputFile_slots_begin",
7967 "rna_iterator_listbase_next",
7968 "rna_iterator_listbase_end",
7969 "rna_NodeOutputFile_slot_file_get",
7970 nullptr,
7971 nullptr,
7972 nullptr,
7973 nullptr);
7974 RNA_def_property_struct_type(prop, "NodeOutputFileSlotFile");
7975 RNA_def_property_ui_text(prop, "File Slots", "");
7976 rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileFileSlots");
7977
7978 prop = RNA_def_property(srna, "layer_slots", PROP_COLLECTION, PROP_NONE);
7980 "rna_NodeOutputFile_slots_begin",
7981 "rna_iterator_listbase_next",
7982 "rna_iterator_listbase_end",
7983 "rna_NodeOutputFile_slot_layer_get",
7984 nullptr,
7985 nullptr,
7986 nullptr,
7987 nullptr);
7988 RNA_def_property_struct_type(prop, "NodeOutputFileSlotLayer");
7989 RNA_def_property_ui_text(prop, "EXR Layer Slots", "");
7990 rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileLayerSlots");
7991}
7992
7993static void def_cmp_dilate_erode(BlenderRNA * /*brna*/, StructRNA *srna)
7994{
7995 PropertyRNA *prop;
7996
7997 static const EnumPropertyItem mode_items[] = {
7998 {CMP_NODE_DILATE_ERODE_STEP, "STEP", 0, "Steps", ""},
7999 {CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD, "THRESHOLD", 0, "Threshold", ""},
8000 {CMP_NODE_DILATE_ERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
8001 {CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
8002 {0, nullptr, 0, nullptr, nullptr},
8003 };
8004
8005 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
8006 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8007 RNA_def_property_enum_items(prop, mode_items);
8008 RNA_def_property_ui_text(prop, "Mode", "Growing/shrinking mode");
8009 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8010
8011 prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
8013 "rna_node_property_to_input_getter<int, node_input_size>",
8014 "rna_node_property_to_input_setter<int, node_input_size>",
8015 nullptr);
8016 RNA_def_property_range(prop, -5000, 5000);
8017 RNA_def_property_ui_range(prop, -100, 100, 1, -1);
8019 prop,
8020 "Distance",
8021 "Distance to grow/shrink (number of iterations). (Deprecated: Use Size input instead.)");
8022 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8023
8024 /* CMP_NODE_DILATE_ERODE_DISTANCE_THRESH only */
8025 prop = RNA_def_property(srna, "edge", PROP_FLOAT, PROP_NONE);
8027 "rna_node_property_to_input_getter<float, node_input_falloff_size>",
8028 "rna_node_property_to_input_setter<float, node_input_falloff_size>",
8029 nullptr);
8030 RNA_def_property_range(prop, -100, 100);
8032 prop, "Edge", "Edge to inset. (Deprecated: Use Falloff Size input instead.)");
8034 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8035
8036 RNA_def_struct_sdna_from(srna, "NodeDilateErode", "storage");
8037
8038 /* CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER only */
8039 prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
8040 RNA_def_property_enum_sdna(prop, nullptr, "falloff");
8042 RNA_def_property_ui_text(prop, "Falloff", "Falloff type of the feather");
8044 BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
8045 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8046}
8047
8048static void def_cmp_inpaint(BlenderRNA * /*brna*/, StructRNA *srna)
8049{
8050 PropertyRNA *prop;
8051
8052# if 0
8053 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
8054
8055 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8056 RNA_def_property_enum_items(prop, type_items);
8057 RNA_def_property_ui_text(prop, "Type", "Type of inpaint algorithm");
8058 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8059# endif
8060
8061 prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
8063 "rna_node_property_to_input_getter<int, node_input_size>",
8064 "rna_node_property_to_input_setter<int, node_input_size>",
8065 nullptr);
8066 RNA_def_property_range(prop, 0, 10000);
8068 prop,
8069 "Distance",
8070 "Distance to inpaint (number of iterations). (Deprecated: Use Size input instead.)");
8071 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8072}
8073
8074static void def_cmp_despeckle(BlenderRNA * /*brna*/, StructRNA *srna)
8075{
8076 PropertyRNA *prop;
8077
8078 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
8080 prop,
8081 "rna_node_property_to_input_getter<float, node_input_color_threshold>",
8082 "rna_node_property_to_input_setter<float, node_input_color_threshold>",
8083 nullptr);
8084 RNA_def_property_range(prop, 0.0, 1.0f);
8086 "Threshold",
8087 "Threshold for detecting pixels to despeckle. (Deprecated: Use Color "
8088 "Threshold input instead.)");
8089 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8090
8091 prop = RNA_def_property(srna, "threshold_neighbor", PROP_FLOAT, PROP_NONE);
8093 prop,
8094 "rna_node_property_to_input_getter<float, node_input_neighbor_threshold>",
8095 "rna_node_property_to_input_setter<float, node_input_neighbor_threshold>",
8096 nullptr);
8097 RNA_def_property_range(prop, 0.0, 1.0f);
8099 "Neighbor",
8100 "Threshold for the number of neighbor pixels that must match. "
8101 "(Deprecated: Use Neighbor Threshold instead.)");
8102 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8103}
8104
8105static void def_cmp_scale(BlenderRNA * /*brna*/, StructRNA *srna)
8106{
8107 PropertyRNA *prop;
8108
8109 static const EnumPropertyItem space_items[] = {
8110 {CMP_NODE_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""},
8111 {CMP_NODE_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
8112 {CMP_NODE_SCALE_RENDER_PERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
8113 {CMP_NODE_SCALE_RENDER_SIZE, "RENDER_SIZE", 0, "Render Size", ""},
8114 {0, nullptr, 0, nullptr, nullptr},
8115 };
8116
8117 /* matching bgpic_camera_frame_items[] */
8118 static const EnumPropertyItem space_frame_items[] = {
8119 {CMP_NODE_SCALE_RENDER_SIZE_STRETCH, "STRETCH", 0, "Stretch", ""},
8120 {CMP_NODE_SCALE_RENDER_SIZE_FIT, "FIT", 0, "Fit", ""},
8121 {CMP_NODE_SCALE_RENDER_SIZE_CROP, "CROP", 0, "Crop", ""},
8122 {0, nullptr, 0, nullptr, nullptr},
8123 };
8124
8125 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
8126 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8128 RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
8129 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_CompositorNodeScale_update");
8130
8131 /* expose 2 flags as a enum of 3 items */
8132 prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
8133 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "custom2");
8134 RNA_def_property_enum_items(prop, space_frame_items);
8135 RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
8136 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8137
8138 prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
8139 RNA_def_property_float_sdna(prop, nullptr, "custom3");
8141 "X Offset",
8142 "Offset image horizontally (factor of image size). (Deprecated: Use a "
8143 "Translate node instead.)");
8144 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8145
8146 prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
8147 RNA_def_property_float_sdna(prop, nullptr, "custom4");
8149 prop,
8150 "Y Offset",
8151 "Offset image vertically (factor of image size). (Deprecated: Use Translate node instead.)");
8152 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8153
8154 RNA_def_struct_sdna_from(srna, "NodeScaleData", "storage");
8155
8156 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
8157 RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
8159 RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
8160 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8161}
8162
8163static void def_cmp_rotate(BlenderRNA * /*brna*/, StructRNA *srna)
8164{
8165 PropertyRNA *prop;
8166
8167 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
8168 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8170 RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
8171 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8172}
8173
8174static void def_cmp_diff_matte(BlenderRNA * /*brna*/, StructRNA *srna)
8175{
8176 PropertyRNA *prop;
8177
8178 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
8180 "rna_node_property_to_input_getter<float, node_input_tolerance>",
8181 "rna_node_property_to_input_setter<float, node_input_tolerance>",
8182 nullptr);
8183 RNA_def_property_range(prop, 0.0f, 1.0f);
8185 "Tolerance",
8186 "Color distances below this threshold are keyed. (Deprecated: Use "
8187 "Tolerance input instead.)");
8188 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8189
8190 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
8192 "rna_node_property_to_input_getter<float, node_input_falloff>",
8193 "rna_node_property_to_input_setter<float, node_input_falloff>",
8194 nullptr);
8195 RNA_def_property_range(prop, 0.0f, 1.0f);
8197 "Falloff",
8198 "Color distances below this additional threshold are partially keyed. "
8199 "(Deprecated: Use Falloff input instead.)");
8200 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8201}
8202
8203static void def_cmp_color_matte(BlenderRNA * /*brna*/, StructRNA *srna)
8204{
8205 PropertyRNA *prop;
8206
8207 prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE);
8209 "rna_node_property_to_input_getter<float, node_input_hue>",
8210 "rna_node_property_to_input_setter<float, node_input_hue>",
8211 nullptr);
8212 RNA_def_property_range(prop, 0.0f, 1.0f);
8214 "H",
8215 "Hue tolerance for colors to be considered a keying color. "
8216 "(Deprecated: Use Hue input instead.)");
8217 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8218
8219 prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE);
8221 "rna_node_property_to_input_getter<float, node_input_saturation>",
8222 "rna_node_property_to_input_setter<float, node_input_saturation>",
8223 nullptr);
8224 RNA_def_property_range(prop, 0.0f, 1.0f);
8226 prop,
8227 "S",
8228 "Saturation tolerance for the color. (Deprecated: Use Saturation input instead.)");
8229 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8230
8231 prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE);
8233 "rna_node_property_to_input_getter<float, node_input_value>",
8234 "rna_node_property_to_input_setter<float, node_input_value>",
8235 nullptr);
8236 RNA_def_property_range(prop, 0.0f, 1.0f);
8238 prop, "V", "Value tolerance for the color. (Deprecated: Use Value input instead.)");
8239 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8240}
8241
8242static void def_cmp_distance_matte(BlenderRNA * /*brna*/, StructRNA *srna)
8243{
8244 PropertyRNA *prop;
8245
8246 static const EnumPropertyItem color_space_items[] = {
8247 {CMP_NODE_DISTANCE_MATTE_COLOR_SPACE_RGBA, "RGB", 0, "RGB", "RGB color space"},
8248 {CMP_NODE_DISTANCE_MATTE_COLOR_SPACE_YCCA, "YCC", 0, "YCC", "YCbCr suppression"},
8249 {0, nullptr, 0, nullptr, nullptr},
8250 };
8251
8252 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
8253
8254 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
8255 RNA_def_property_enum_sdna(prop, nullptr, "channel");
8256 RNA_def_property_enum_items(prop, color_space_items);
8257 RNA_def_property_ui_text(prop, "Channel", "");
8258 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8259
8260 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
8262 "rna_node_property_to_input_getter<float, node_input_tolerance>",
8263 "rna_node_property_to_input_setter<float, node_input_tolerance>",
8264 nullptr);
8265 RNA_def_property_range(prop, 0.0f, 1.0f);
8267 "Tolerance",
8268 "Color distances below this threshold are keyed. (Deprecated: Use "
8269 "Tolerance input instead.)");
8270 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8271
8272 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
8274 "rna_node_property_to_input_getter<float, node_input_falloff>",
8275 "rna_node_property_to_input_setter<float, node_input_falloff>",
8276 nullptr);
8277 RNA_def_property_range(prop, 0.0f, 1.0f);
8279 "Falloff",
8280 "Color distances below this additional threshold are partially keyed. "
8281 "(Deprecated: Use Falloff input instead.)");
8282 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8283}
8284
8286{
8287 PropertyRNA *prop;
8288 RNA_def_struct_sdna_from(srna, "NodeConvertColorSpace", "storage");
8289
8290 prop = RNA_def_property(srna, "from_color_space", PROP_ENUM, PROP_NONE);
8294 "rna_NodeConvertColorSpace_from_color_space_get",
8295 "rna_NodeConvertColorSpace_from_color_space_set",
8296 "rna_NodeConvertColorSpace_color_space_itemf");
8297 RNA_def_property_ui_text(prop, "From", "Color space of the input image");
8298 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8299
8300 prop = RNA_def_property(srna, "to_color_space", PROP_ENUM, PROP_NONE);
8304 "rna_NodeConvertColorSpace_to_color_space_get",
8305 "rna_NodeConvertColorSpace_to_color_space_set",
8306 "rna_NodeConvertColorSpace_color_space_itemf");
8307 RNA_def_property_ui_text(prop, "To", "Color space of the output image");
8308 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8309}
8310
8311static void def_cmp_color_spill(BlenderRNA * /*brna*/, StructRNA *srna)
8312{
8313 PropertyRNA *prop;
8314
8315 static const EnumPropertyItem channel_items[] = {
8316 {1, "R", 0, "R", "Red spill suppression"},
8317 {2, "G", 0, "G", "Green spill suppression"},
8318 {3, "B", 0, "B", "Blue spill suppression"},
8319 {0, nullptr, 0, nullptr, nullptr},
8320 };
8321
8322 static const EnumPropertyItem limit_channel_items[] = {
8323 {0, "R", 0, "R", "Limit by red"},
8324 {1, "G", 0, "G", "Limit by green"},
8325 {2, "B", 0, "B", "Limit by blue"},
8326 {0, nullptr, 0, nullptr, nullptr},
8327 };
8328
8329 static const EnumPropertyItem algorithm_items[] = {
8330 {0, "SIMPLE", 0, "Simple", "Simple limit algorithm"},
8331 {1, "AVERAGE", 0, "Average", "Average limit algorithm"},
8332 {0, nullptr, 0, nullptr, nullptr},
8333 };
8334
8335 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
8336 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8337 RNA_def_property_enum_items(prop, channel_items);
8338 RNA_def_property_ui_text(prop, "Channel", "");
8340 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8341
8342 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
8343 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
8344 RNA_def_property_enum_items(prop, algorithm_items);
8345 RNA_def_property_ui_text(prop, "Algorithm", "");
8346 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8347
8348 RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage");
8349
8350 prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
8351 RNA_def_property_enum_sdna(prop, nullptr, "limchan");
8352 RNA_def_property_enum_items(prop, limit_channel_items);
8353 RNA_def_property_ui_text(prop, "Limit Channel", "");
8355 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8356
8357 prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
8359 prop,
8360 "rna_node_property_to_input_getter<float, node_input_limit_strength>",
8361 "rna_node_property_to_input_setter<float, node_input_limit_strength>",
8362 nullptr);
8363 RNA_def_property_range(prop, 0.5f, 1.5f);
8365 prop, "Ratio", "Scale limit by value. (Deprecated: Use Limit Strength input instead.)");
8366 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8367
8368 prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE);
8370 prop,
8371 "rna_node_property_to_input_getter<bool, node_input_use_spill_strength>",
8372 "rna_node_property_to_input_setter<bool, node_input_use_spill_strength>");
8374 "Unspill",
8375 "Compensate all channels (differently) by hand. "
8376 "(Deprecated: Use \"Use Spill Strength\" input instead.)");
8377 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8378
8379 prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE);
8381 prop, "rna_NodeColorSpill_unspill_red_get", "rna_NodeColorSpill_unspill_red_set", nullptr);
8382 RNA_def_property_range(prop, 0.0f, 1.5f);
8384 prop, "R", "Red spillmap scale. (Deprecated: Use Spill Strength input instead.)");
8386 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8387
8388 prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE);
8390 "rna_NodeColorSpill_unspill_green_get",
8391 "rna_NodeColorSpill_unspill_green_set",
8392 nullptr);
8393 RNA_def_property_range(prop, 0.0f, 1.5f);
8395 prop, "G", "Green spillmap scale. (Deprecated: Use Spill Strength input instead.)");
8397 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8398
8399 prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE);
8401 prop, "rna_NodeColorSpill_unspill_blue_get", "rna_NodeColorSpill_unspill_blue_set", nullptr);
8402 RNA_def_property_range(prop, 0.0f, 1.5f);
8404 prop, "B", "Blue spillmap scale. (Deprecated: Use Spill Strength input instead.)");
8406 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8407}
8408
8409static void def_cmp_luma_matte(BlenderRNA * /*brna*/, StructRNA *srna)
8410{
8411 PropertyRNA *prop;
8412
8413 prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
8415 "rna_node_property_to_input_getter<float, node_input_maximum>",
8416 "rna_node_property_to_input_setter<float, node_input_maximum>",
8417 nullptr);
8418 RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
8419 RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
8420 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8421
8422 prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
8424 "rna_node_property_to_input_getter<float, node_input_minimum>",
8425 "rna_node_property_to_input_setter<float, node_input_minimum>",
8426 nullptr);
8427 RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
8428 RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
8429 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8430}
8431
8432static void def_cmp_brightcontrast(BlenderRNA * /*brna*/, StructRNA *srna)
8433{
8434 PropertyRNA *prop;
8435
8436 prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
8437 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
8439 "Convert Premultiplied",
8440 "Keep output image premultiplied alpha. (Deprecated: Unused.)");
8441 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8442}
8443
8444static void def_cmp_chroma_matte(BlenderRNA * /*brna*/, StructRNA *srna)
8445{
8446 PropertyRNA *prop;
8447
8448 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_ANGLE);
8450 "rna_node_property_to_input_getter<float, node_input_maximum>",
8451 "rna_node_property_to_input_setter<float, node_input_maximum>",
8452 nullptr);
8453 RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(80.0f));
8455 "Acceptance",
8456 "Tolerance for a color to be considered a keying color. (Deprecated: "
8457 "Use Maximum input instead.)");
8458 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8459
8460 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_ANGLE);
8462 "rna_node_property_to_input_getter<float, node_input_minimum>",
8463 "rna_node_property_to_input_setter<float, node_input_minimum>",
8464 nullptr);
8465 RNA_def_property_range(prop, 0.0f, DEG2RADF(30.0f));
8467 "Cutoff",
8468 "Tolerance below which colors will be considered as exact matches. "
8469 "(Deprecated: Use Minimum input instead.)");
8470 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8471
8472 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
8473 RNA_def_property_float_sdna(prop, nullptr, "custom4");
8474 RNA_def_property_range(prop, 0.0f, 1.0f);
8475 RNA_def_property_ui_text(prop, "Lift", "Alpha lift. (Deprecated: Unused.)");
8476 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8477
8478 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
8480 "rna_node_property_to_input_getter<float, node_input_falloff>",
8481 "rna_node_property_to_input_setter<float, node_input_falloff>",
8482 nullptr);
8483 RNA_def_property_range(prop, 0.0f, 1.0f);
8485 prop, "Falloff", "Alpha falloff. (Deprecated: Use Minimum input instead.)");
8486 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8487
8488 prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
8489 RNA_def_property_float_sdna(prop, nullptr, "custom3");
8490 RNA_def_property_range(prop, 0.0f, 1.0f);
8492 prop,
8493 "Shadow Adjust",
8494 "Adjusts the brightness of any shadows captured. (Deprecated: Unused.)");
8495 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8496}
8497
8498static void def_cmp_channel_matte(BlenderRNA * /*brna*/, StructRNA *srna)
8499{
8500 PropertyRNA *prop;
8501 static const EnumPropertyItem color_space_items[] = {
8502 {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB (Red, Green, Blue) color space"},
8503 {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV (Hue, Saturation, Value) color space"},
8504 {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV (Y - luma, U V - chroma) color space"},
8506 "YCC",
8507 0,
8508 "YCbCr",
8509 "YCbCr (Y - luma, Cb - blue-difference chroma, Cr - red-difference chroma) color space"},
8510 {0, nullptr, 0, nullptr, nullptr},
8511 };
8512
8513 static const EnumPropertyItem algorithm_items[] = {
8514 {0, "SINGLE", 0, "Single", "Limit by single channel"},
8515 {1, "MAX", 0, "Max", "Limit by maximum of other channels"},
8516 {0, nullptr, 0, nullptr, nullptr},
8517 };
8518
8519 prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
8520 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8521 RNA_def_property_enum_items(prop, color_space_items);
8522 RNA_def_property_ui_text(prop, "Color Space", "");
8523 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8524
8525 prop = RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
8526 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
8528 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_channel_itemf");
8529 RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte");
8531 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8532
8533 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
8534
8535 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
8536 RNA_def_property_enum_sdna(prop, nullptr, "algorithm");
8537 RNA_def_property_enum_items(prop, algorithm_items);
8538 RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel");
8539 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8540
8541 prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
8542 RNA_def_property_enum_sdna(prop, nullptr, "channel");
8544 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_channel_itemf");
8545 RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channel's value");
8547 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8548
8549 prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
8551 "rna_node_property_to_input_getter<float, node_input_maximum>",
8552 "rna_node_property_to_input_setter<float, node_input_maximum>",
8553 nullptr);
8554 RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
8556 prop,
8557 "High",
8558 "Values higher than this setting are 100% opaque. (Deprecated: Use Maximum input instead.)");
8559 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8560
8561 prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
8563 "rna_node_property_to_input_getter<float, node_input_minimum>",
8564 "rna_node_property_to_input_setter<float, node_input_minimum>",
8565 nullptr);
8566 RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
8568 prop,
8569 "Low",
8570 "Values lower than this setting are 100% keyed. (Deprecated: Use Minimum input instead.)");
8571 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8572}
8573
8574static void def_cmp_flip(BlenderRNA * /*brna*/, StructRNA *srna)
8575{
8576 PropertyRNA *prop;
8577
8578 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
8579 RNA_def_property_enum_funcs(prop, "rna_NodeFlip_axis_get", "rna_NodeFlip_axis_set", nullptr);
8581 RNA_def_property_ui_text(prop, "Axis", "(Deprecated: Use Flip X and Flip Y inputs instead.)");
8582 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8583}
8584
8585static void def_cmp_split(BlenderRNA * /*brna*/, StructRNA *srna)
8586{
8587 PropertyRNA *prop;
8588
8589 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
8590 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
8592 RNA_def_property_ui_text(prop, "Axis", "");
8593 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8594
8595 prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR);
8597 prop, "rna_NodeSplit_factor_get", "rna_NodeSplit_factor_set", nullptr);
8598 RNA_def_property_range(prop, 0, 100);
8599 RNA_def_property_ui_text(prop, "Factor", "");
8600 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8601}
8602
8603static void def_cmp_id_mask(BlenderRNA * /*brna*/, StructRNA *srna)
8604{
8605 PropertyRNA *prop;
8606
8607 prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
8609 "rna_node_property_to_input_getter<int, node_input_index>",
8610 "rna_node_property_to_input_setter<int, node_input_index>",
8611 nullptr);
8612 RNA_def_property_range(prop, 0, 32767);
8614 prop,
8615 "Index",
8616 "Pass index number to convert to alpha. (Deprecated: Use Index input instead.)");
8617 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8618
8619 prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
8621 "rna_node_property_to_input_getter<bool, node_input_anti_alias>",
8622 "rna_node_property_to_input_setter<bool, node_input_anti_alias>");
8624 prop,
8625 "Anti-Aliasing",
8626 "Apply an anti-aliasing filter to the mask. (Deprecated: Use Anti-Aliasing input instead.)");
8627 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8628}
8629
8630static void def_cmp_double_edge_mask(BlenderRNA * /*brna*/, StructRNA *srna)
8631{
8632 PropertyRNA *prop;
8633
8634 static const EnumPropertyItem BufEdgeMode_items[] = {
8635 {0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to bleed along edges"},
8636 {1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from touching edges"},
8637 {0, nullptr, 0, nullptr, nullptr},
8638 };
8639
8640 static const EnumPropertyItem InnerEdgeMode_items[] = {
8641 {0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"},
8642 {1,
8643 "ADJACENT_ONLY",
8644 0,
8645 "Adjacent Only",
8646 "Only inner mask pixels adjacent to outer mask pixels are considered during mask "
8647 "calculation"},
8648 {0, nullptr, 0, nullptr, nullptr},
8649 };
8650
8651 prop = RNA_def_property(srna, "inner_mode", PROP_ENUM, PROP_NONE);
8652 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8653 RNA_def_property_enum_items(prop, InnerEdgeMode_items);
8654 RNA_def_property_ui_text(prop, "Inner Edge Mode", "");
8655 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8656
8657 prop = RNA_def_property(srna, "edge_mode", PROP_ENUM, PROP_NONE);
8658 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
8659 RNA_def_property_enum_items(prop, BufEdgeMode_items);
8660 RNA_def_property_ui_text(prop, "Buffer Edge Mode", "");
8661 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8662}
8663
8664static void def_cmp_map_uv(BlenderRNA * /*brna*/, StructRNA *srna)
8665{
8666 PropertyRNA *prop;
8667
8668 static const EnumPropertyItem filter_type_items[] = {
8669 {CMP_NODE_MAP_UV_FILTERING_NEAREST, "NEAREST", 0, "Nearest", ""},
8670 {CMP_NODE_MAP_UV_FILTERING_ANISOTROPIC, "ANISOTROPIC", 0, "Anisotropic", ""},
8671 {0, nullptr, 0, nullptr, nullptr},
8672 };
8673
8674 prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_FACTOR);
8675 RNA_def_property_int_sdna(prop, nullptr, "custom1");
8676 RNA_def_property_range(prop, 0, 100);
8677 RNA_def_property_ui_text(prop, "Alpha", "(Deprecated: Unused.)");
8678 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8679
8680 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
8681 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
8682 RNA_def_property_enum_items(prop, filter_type_items);
8683 RNA_def_property_ui_text(prop, "Filter Type", "");
8685 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8686}
8687
8688static void def_cmp_defocus(BlenderRNA * /*brna*/, StructRNA *srna)
8689{
8690 PropertyRNA *prop;
8691
8692 static const EnumPropertyItem bokeh_items[] = {
8693 {8, "OCTAGON", 0, "Octagonal", "8 sides"},
8694 {7, "HEPTAGON", 0, "Heptagonal", "7 sides"},
8695 {6, "HEXAGON", 0, "Hexagonal", "6 sides"},
8696 {5, "PENTAGON", 0, "Pentagonal", "5 sides"},
8697 {4, "SQUARE", 0, "Square", "4 sides"},
8698 {3, "TRIANGLE", 0, "Triangular", "3 sides"},
8699 {0, "CIRCLE", 0, "Circular", ""},
8700 {0, nullptr, 0, nullptr, nullptr},
8701 };
8702
8703 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
8704 RNA_def_property_pointer_sdna(prop, nullptr, "id");
8705 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Node_scene_set", nullptr, nullptr);
8706 RNA_def_property_struct_type(prop, "Scene");
8710 prop, "Scene", "Scene from which to select the active camera (render scene if undefined)");
8711 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
8712
8713 RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage");
8714
8715 prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE);
8716 RNA_def_property_enum_sdna(prop, nullptr, "bktype");
8717 RNA_def_property_enum_items(prop, bokeh_items);
8718 RNA_def_property_ui_text(prop, "Bokeh Type", "");
8719 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8720
8721 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
8722 RNA_def_property_float_sdna(prop, nullptr, "rotation");
8723 RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
8724 RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset");
8725 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8726
8727 prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
8728 RNA_def_property_boolean_sdna(prop, nullptr, "gamco", 1);
8730 "Gamma Correction",
8731 "Enable gamma correction before and after main process. (Deprecated: "
8732 "Unused. Use Gamma node instead.)");
8733 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8734
8735 /* TODO */
8736 prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
8737 RNA_def_property_float_sdna(prop, nullptr, "fstop");
8738 RNA_def_property_range(prop, 0.0f, 128.0f);
8740 prop,
8741 "F-Stop",
8742 "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles "
8743 "the blur radius");
8744 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8745
8746 prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
8747 RNA_def_property_float_sdna(prop, nullptr, "maxblur");
8748 RNA_def_property_range(prop, 0.0f, 10000.0f);
8749 RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
8750 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8751
8752 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
8753 RNA_def_property_float_sdna(prop, nullptr, "bthresh");
8754 RNA_def_property_range(prop, 0.0f, 100.0f);
8756 "Threshold",
8757 "CoC radius threshold, prevents background bleed on in-focus "
8758 "midground, 0 is disabled. (Deprecated: Unused.)");
8759 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8760
8761 prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
8762 RNA_def_property_boolean_sdna(prop, nullptr, "preview", 1);
8764 prop, "Preview", "Enable low quality mode, useful for preview. (Deprecated: Unused.)");
8765 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8766
8767 prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
8768 RNA_def_property_boolean_negative_sdna(prop, nullptr, "no_zbuf", 1);
8770 "Use Z-Buffer",
8771 "Disable when using an image as input instead of actual z-buffer "
8772 "(auto enabled if node not image based, eg. time node)");
8773 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8774
8775 prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
8776 RNA_def_property_float_sdna(prop, nullptr, "scale");
8777 RNA_def_property_range(prop, 0.0f, 1000.0f);
8779 prop,
8780 "Z-Scale",
8781 "Scale the Z input when not using a z-buffer, controls maximum blur designated "
8782 "by the color white or input value 1");
8783 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8784}
8785
8786static void def_cmp_invert(BlenderRNA * /*brna*/, StructRNA *srna)
8787{
8788 PropertyRNA *prop;
8789
8790 prop = RNA_def_property(srna, "invert_rgb", PROP_BOOLEAN, PROP_NONE);
8792 prop,
8793 "rna_node_property_to_input_getter<bool, node_input_invert_color>",
8794 "rna_node_property_to_input_setter<bool, node_input_invert_color>");
8795 RNA_def_property_ui_text(prop, "RGB", "(Deprecated: Use Invert Color input instead.)");
8796 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8797
8798 prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
8800 prop,
8801 "rna_node_property_to_input_getter<bool, node_input_invert_alpha>",
8802 "rna_node_property_to_input_setter<bool, node_input_invert_alpha>");
8803 RNA_def_property_ui_text(prop, "Alpha", "(Deprecated: Use Invert Alpha input instead.)");
8804 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8805}
8806
8807static void def_cmp_crop(BlenderRNA * /*brna*/, StructRNA *srna)
8808{
8809 PropertyRNA *prop;
8810
8811 prop = RNA_def_property(srna, "use_crop_size", PROP_BOOLEAN, PROP_NONE);
8813 prop, "rna_NodeCrop_use_crop_size_get", "rna_NodeCrop_use_crop_size_set");
8814 RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
8815 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8816
8817 prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
8818 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", 1);
8820 prop, "Relative", "Use relative values to crop image. (Deprecated: Unused.)");
8821 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8822
8823 prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
8825 "rna_node_property_to_input_getter<int, node_input_x>",
8826 "rna_node_property_to_input_setter<int, node_input_x>",
8827 nullptr);
8828 RNA_def_property_range(prop, 0, 10000);
8830 prop, "X1", "Left edge of the cropping rectangle. (Deprecated: Use X input instead.)");
8831 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8832
8833 prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE);
8834 RNA_def_property_int_funcs(prop, "rna_NodeCrop_max_x_get", "rna_NodeCrop_max_x_set", nullptr);
8835 RNA_def_property_range(prop, 0, 10000);
8837 prop, "X2", "Right edge of the cropping rectangle. (Deprecated: Use Width input instead.)");
8838 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8839
8840 prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE);
8841 RNA_def_property_int_funcs(prop, "rna_NodeCrop_min_y_get", "rna_NodeCrop_min_y_set", nullptr);
8842 RNA_def_property_range(prop, 0, 10000);
8844 prop, "Y1", "Top edge of the cropping rectangle. (Deprecated: Use Y input instead.)");
8845 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8846
8847 prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE);
8849 "rna_node_property_to_input_getter<int, node_input_y>",
8850 "rna_node_property_to_input_setter<int, node_input_y>",
8851 nullptr);
8852 RNA_def_property_range(prop, 0, 10000);
8854 prop,
8855 "Y2",
8856 "Bottom edge of the cropping rectangle. (Deprecated: Use Height input instead.)");
8857 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8858
8859 prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
8860 RNA_def_property_float_sdna(prop, nullptr, "custom3");
8861 RNA_def_property_range(prop, 0.0, 1.0);
8863 prop, "X1", "Left edge of the cropping rectangle. (Deprecated: Unused.)");
8864 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8865
8866 prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
8867 RNA_def_property_float_sdna(prop, nullptr, "custom3");
8868 RNA_def_property_range(prop, 0.0, 1.0);
8870 prop, "X2", "Right edge of the cropping rectangle. (Deprecated: Unused.)");
8871 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8872
8873 prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
8874 RNA_def_property_float_sdna(prop, nullptr, "custom3");
8875 RNA_def_property_range(prop, 0.0, 1.0);
8877 prop, "Y1", "Top edge of the cropping rectangle. (Deprecated: Unused.)");
8878 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8879
8880 prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
8881 RNA_def_property_float_sdna(prop, nullptr, "custom3");
8882 RNA_def_property_range(prop, 0.0, 1.0);
8884 prop, "Y2", "Bottom edge of the cropping rectangle. (Deprecated: Unused.)");
8885 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8886}
8887
8888static void def_cmp_dblur(BlenderRNA * /*brna*/, StructRNA *srna)
8889{
8890 PropertyRNA *prop;
8891
8892 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
8894 "rna_node_property_to_input_getter<int, node_input_samples>",
8895 "rna_node_property_to_input_setter<int, node_input_samples>",
8896 nullptr);
8897 RNA_def_property_range(prop, 1, 32);
8898 RNA_def_property_ui_text(prop, "Iterations", "(Deprecated: Use Samples input instead.)");
8899 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8900
8901 prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
8903 "rna_node_property_to_vector_input_getter<node_input_center, 0>",
8904 "rna_node_property_to_vector_input_setter<node_input_center, 0>",
8905 nullptr);
8906 RNA_def_property_range(prop, 0.0f, 1.0f);
8907 RNA_def_property_ui_text(prop, "Center X", "(Deprecated: Use Center input instead.)");
8908 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8909
8910 prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
8912 "rna_node_property_to_vector_input_getter<node_input_center, 1>",
8913 "rna_node_property_to_vector_input_setter<node_input_center, 1>",
8914 nullptr);
8915 RNA_def_property_range(prop, 0.0f, 1.0f);
8916 RNA_def_property_ui_text(prop, "Center Y", "(Deprecated: Use Center input instead.)");
8917 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8918
8919 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
8921 prop,
8922 "rna_node_property_to_input_getter<float, node_input_translation_amount>",
8923 "rna_node_property_to_input_setter<float, node_input_translation_amount>",
8924 nullptr);
8925 RNA_def_property_range(prop, -1.0f, 1.0f);
8927 prop, "Distance", "(Deprecated: Use Translation Amount input instead.)");
8928 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8929
8930 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
8932 prop,
8933 "rna_node_property_to_input_getter<float, node_input_translation_direction>",
8934 "rna_node_property_to_input_setter<float, node_input_translation_direction>",
8935 nullptr);
8936 RNA_def_property_range(prop, 0.0f, DEG2RADF(360.0f));
8938 prop, "Angle", "(Deprecated: Use Translation Direction input instead.)");
8939 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8940
8941 prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_ANGLE);
8943 "rna_node_property_to_input_getter<float, node_input_rotation>",
8944 "rna_node_property_to_input_setter<float, node_input_rotation>",
8945 nullptr);
8946 RNA_def_property_range(prop, DEG2RADF(-360.0f), DEG2RADF(360.0f));
8947 RNA_def_property_ui_text(prop, "Spin", "(Deprecated: Use Rotation input instead.)");
8948 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8949
8950 prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
8952 prop, "rna_NodeDirectionalBlur_scale_get", "rna_NodeDirectionalBlur_scale_set", nullptr);
8953 RNA_def_property_range(prop, 0.0f, 100.0f);
8954 RNA_def_property_ui_text(prop, "Zoom", "(Deprecated: Use Scale input instead.)");
8955 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8956}
8957
8958static void def_cmp_bilateral_blur(BlenderRNA * /*brna*/, StructRNA *srna)
8959{
8960 PropertyRNA *prop;
8961
8962 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
8964 "rna_node_property_to_input_getter<int, node_input_size>",
8965 "rna_node_property_to_input_setter<int, node_input_size>",
8966 nullptr);
8967 RNA_def_property_range(prop, 1, 128);
8968 RNA_def_property_ui_text(prop, "Iterations", "(Deprecated: Use Size input instead.)");
8969 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8970
8971 prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
8973 prop, "rna_NodeBilateralBlur_threshold_get", "rna_NodeBilateralBlur_threshold_set", nullptr);
8974 RNA_def_property_range(prop, 0.01f, 3.0f);
8975 RNA_def_property_ui_text(prop, "Color Sigma", "(Deprecated: Use Threshold input instead.)");
8976 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8977
8978 prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
8980 "rna_NodeBilateralBlur_sigma_space_get",
8981 "rna_NodeBilateralBlur_sigma_space_set",
8982 nullptr);
8983 RNA_def_property_range(prop, 0.01f, 30.0f);
8984 RNA_def_property_ui_text(prop, "Space Sigma", "(Deprecated: Use Size input instead.)");
8985 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8986}
8987
8988static void def_cmp_premul_key(BlenderRNA * /*brna*/, StructRNA *srna)
8989{
8990 PropertyRNA *prop;
8991
8992 static const EnumPropertyItem type_items[] = {
8993 {0, "STRAIGHT_TO_PREMUL", 0, "To Premultiplied", "Convert straight to premultiplied"},
8994 {1, "PREMUL_TO_STRAIGHT", 0, "To Straight", "Convert premultiplied to straight"},
8995 {0, nullptr, 0, nullptr, nullptr},
8996 };
8997
8998 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
8999 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9000 RNA_def_property_enum_items(prop, type_items);
9002 prop, "Mapping", "Conversion between premultiplied alpha and key alpha");
9003 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9004}
9005
9006static void def_cmp_glare(BlenderRNA * /*brna*/, StructRNA *srna)
9007{
9008 PropertyRNA *prop;
9009
9010 static const EnumPropertyItem type_items[] = {
9011 {CMP_NODE_GLARE_BLOOM, "BLOOM", 0, "Bloom", ""},
9012 {CMP_NODE_GLARE_GHOST, "GHOSTS", 0, "Ghosts", ""},
9013 {CMP_NODE_GLARE_STREAKS, "STREAKS", 0, "Streaks", ""},
9014 {CMP_NODE_GLARE_FOG_GLOW, "FOG_GLOW", 0, "Fog Glow", ""},
9015 {CMP_NODE_GLARE_SIMPLE_STAR, "SIMPLE_STAR", 0, "Simple Star", ""},
9016 {0, nullptr, 0, nullptr, nullptr},
9017 };
9018
9019 static const EnumPropertyItem quality_items[] = {
9020 {0, "HIGH", 0, "High", ""},
9021 {1, "MEDIUM", 0, "Medium", ""},
9022 {2, "LOW", 0, "Low", ""},
9023 {0, nullptr, 0, nullptr, nullptr},
9024 };
9025
9026 RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
9027
9028 prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE);
9029 RNA_def_property_enum_sdna(prop, nullptr, "type");
9030 RNA_def_property_enum_items(prop, type_items);
9031 RNA_def_property_ui_text(prop, "Glare Type", "");
9032 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9033
9034 prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
9035 RNA_def_property_enum_sdna(prop, nullptr, "quality");
9036 RNA_def_property_enum_items(prop, quality_items);
9038 prop,
9039 "Quality",
9040 "If not set to high quality, the effect will be applied to a low-res copy "
9041 "of the source image");
9042 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9043
9044 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
9046 prop, "rna_NodeGlare_iterations_get", "rna_NodeGlare_iterations_set", nullptr);
9047 RNA_def_property_range(prop, 2, 5);
9048 RNA_def_property_ui_text(prop, "Iterations", "(Deprecated: Use Iterations input instead)");
9049
9050 prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
9052 prop, "rna_NodeGlare_color_modulation_get", "rna_NodeGlare_color_modulation_set", nullptr);
9053 RNA_def_property_range(prop, 0.0f, 1.0f);
9055 prop,
9056 "Color Modulation",
9057 "Amount of Color Modulation, modulates colors of streaks and ghosts for "
9058 "a spectral dispersion effect. (Deprecated: Use Color Modulation input instead)");
9059
9060 prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
9061 RNA_def_property_float_funcs(prop, "rna_NodeGlare_mix_get", "rna_NodeGlare_mix_set", nullptr);
9062 RNA_def_property_range(prop, -1.0f, 1.0f);
9064 "Mix",
9065 "1 is original image only, 0 is exact 50/50 mix, 1 is processed image "
9066 "only. (Deprecated: Use Strength input instead)");
9067
9068 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
9070 prop, "rna_NodeGlare_threshold_get", "rna_NodeGlare_threshold_set", nullptr);
9071 RNA_def_property_range(prop, 0.0f, FLT_MAX);
9073 "Threshold",
9074 "The glare filter will only be applied to pixels brighter than this "
9075 "value. (Deprecated: Use Threshold input instead)");
9076
9077 prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
9079 prop, "rna_NodeGlare_streaks_get", "rna_NodeGlare_streaks_set", nullptr);
9080 RNA_def_property_range(prop, 1, 16);
9082 prop, "Streaks", "Total number of streaks. (Deprecated: Use Streaks input instead)");
9083
9084 prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE);
9086 prop, "rna_NodeGlare_angle_offset_get", "rna_NodeGlare_angle_offset_set", nullptr);
9087 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
9089 prop, "Angle Offset", "Streak angle offset. (Deprecated: Use Streaks Angle input instead)");
9090
9091 prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
9092 RNA_def_property_float_funcs(prop, "rna_NodeGlare_fade_get", "rna_NodeGlare_fade_set", nullptr);
9093 RNA_def_property_range(prop, 0.75f, 1.0f);
9095 prop, "Fade", "Streak fade-out factor. (Deprecated: Use Fade input instead)");
9096
9097 prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE);
9099 prop,
9100 "rna_node_property_to_input_getter<bool, node_input_diagonal_star>",
9101 "rna_node_property_to_input_setter<bool, node_input_diagonal_star>");
9103 "Rotate 45°",
9104 "Simple star filter: add 45 degree rotation offset. (Deprecated: Use "
9105 "Diagonal input instead)");
9106 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9107
9108 prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
9109 RNA_def_property_int_funcs(prop, "rna_NodeGlare_size_get", "rna_NodeGlare_size_set", nullptr);
9110 RNA_def_property_range(prop, 1, 9);
9112 "Size",
9113 "Glow/glare size (not actual size; relative to initial size of bright "
9114 "area of pixels). (Deprecated: Use Size input instead)");
9115}
9116
9117static void def_cmp_tonemap(BlenderRNA * /*brna*/, StructRNA *srna)
9118{
9119 PropertyRNA *prop;
9120
9121 static const EnumPropertyItem type_items[] = {
9122 {1,
9123 "RD_PHOTORECEPTOR",
9124 0,
9125 "R/D Photoreceptor",
9126 "More advanced algorithm based on eye physiology, by Reinhard and Devlin"},
9127 {0, "RH_SIMPLE", 0, "Rh Simple", "Simpler photographic algorithm by Reinhard"},
9128 {0, nullptr, 0, nullptr, nullptr},
9129 };
9130
9131 RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
9132
9133 prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
9134 RNA_def_property_enum_sdna(prop, nullptr, "type");
9135 RNA_def_property_enum_items(prop, type_items);
9136 RNA_def_property_ui_text(prop, "Tonemap Type", "");
9137 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9138
9139 prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE);
9141 "rna_node_property_to_input_getter<float, node_input_key>",
9142 "rna_node_property_to_input_setter<float, node_input_key>",
9143 nullptr);
9144 RNA_def_property_range(prop, 0.0f, 1.0f);
9146 prop,
9147 "Key",
9148 "The value the average luminance is mapped to. (Deprecated: Use Key input instead.)");
9149 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9150
9151 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
9153 "rna_node_property_to_input_getter<float, node_input_balance>",
9154 "rna_node_property_to_input_setter<float, node_input_balance>",
9155 nullptr);
9156 RNA_def_property_range(prop, 0.001f, 10.0f);
9158 "Offset",
9159 "Normally always 1, but can be used as an extra control to alter the "
9160 "brightness curve. (Deprecated: Use Balance input instead.)");
9161 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9162
9163 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
9165 "rna_node_property_to_input_getter<float, node_input_gamma>",
9166 "rna_node_property_to_input_setter<float, node_input_gamma>",
9167 nullptr);
9168 RNA_def_property_range(prop, 0.001f, 3.0f);
9170 prop, "Gamma", "If not used, set to 1. (Deprecated: Use Gamma input instead.)");
9171 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9172
9173 prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
9175 "rna_node_property_to_input_getter<float, node_input_intensity>",
9176 "rna_node_property_to_input_setter<float, node_input_intensity>",
9177 nullptr);
9178 RNA_def_property_range(prop, -8.0f, 8.0f);
9180 "Intensity",
9181 "If less than zero, darkens image; otherwise, makes it brighter. "
9182 "(Deprecated: Use Intensity input instead.)");
9183 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9184
9185 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
9187 "rna_node_property_to_input_getter<float, node_input_contrast>",
9188 "rna_node_property_to_input_setter<float, node_input_contrast>",
9189 nullptr);
9190 RNA_def_property_range(prop, 0.0f, 1.0f);
9192 prop,
9193 "Contrast",
9194 "Set to 0 to use estimate from input image. (Deprecated: Use Contrast input instead.)");
9195 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9196
9197 prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
9199 prop,
9200 "rna_node_property_to_input_getter<float, node_input_light_adaptation>",
9201 "rna_node_property_to_input_setter<float, node_input_light_adaptation>",
9202 nullptr);
9203 RNA_def_property_range(prop, 0.0f, 1.0f);
9205 "Adaptation",
9206 "If 0, global; if 1, based on pixel intensity. (Deprecated: Use Light "
9207 "Adaptation input instead.)");
9208 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9209
9210 prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
9212 prop,
9213 "rna_node_property_to_input_getter<float, node_input_chromatic_adaptation>",
9214 "rna_node_property_to_input_setter<float, node_input_chromatic_adaptation>",
9215 nullptr);
9216 RNA_def_property_range(prop, 0.0f, 1.0f);
9218 "Color Correction",
9219 "If 0, same for all channels; if 1, each independent (Deprecated: Use "
9220 "Chromatic Adaptation input instead.)");
9221 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9222}
9223
9224static void def_cmp_lensdist(BlenderRNA * /*brna*/, StructRNA *srna)
9225{
9226 PropertyRNA *prop;
9227
9228 static const EnumPropertyItem type_items[] = {
9230 "RADIAL",
9231 0,
9232 "Radial",
9233 "Radially distorts the image to create a barrel or a Pincushion distortion"},
9235 "HORIZONTAL",
9236 0,
9237 "Horizontal",
9238 "Horizontally distorts the image to create a channel/color shifting effect"},
9239 {0, nullptr, 0, nullptr, nullptr},
9240 };
9241
9242 RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
9243
9244 prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
9245 RNA_def_property_enum_sdna(prop, nullptr, "distortion_type");
9246 RNA_def_property_enum_items(prop, type_items);
9247 RNA_def_property_ui_text(prop, "Type", "");
9248 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9249
9250 prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
9252 prop, "rna_NodeLensDistortion_projector_get", "rna_NodeLensDistortion_projector_set");
9254 "Projector",
9255 "Enable/disable projector mode (the effect is applied in horizontal "
9256 "direction only). (Deprecated: Use distortion_type property instead.)");
9257 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9258
9259 prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
9261 "rna_node_property_to_input_getter<bool, node_input_jitter>",
9262 "rna_node_property_to_input_setter<bool, node_input_jitter>");
9264 "Jitter",
9265 "Enable/disable jittering (faster, but also noisier). (Deprecated: Use "
9266 "Jitter input instead.)");
9268 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9269
9270 prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
9272 "rna_node_property_to_input_getter<bool, node_input_fit>",
9273 "rna_node_property_to_input_setter<bool, node_input_fit>");
9275 "Fit",
9276 "For positive distortion factor only: scale image such that black "
9277 "areas are not visible. (Deprecated: Use Fit input instead.)");
9278 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9279}
9280
9281static void def_cmp_colorbalance(BlenderRNA * /*brna*/, StructRNA *srna)
9282{
9283 PropertyRNA *prop;
9284 static float default_1[3] = {1.0f, 1.0f, 1.0f};
9285
9286 static const EnumPropertyItem type_items[] = {
9287 {CMP_NODE_COLOR_BALANCE_LGG, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
9289 "OFFSET_POWER_SLOPE",
9290 0,
9291 "Offset/Power/Slope (ASC-CDL)",
9292 "ASC-CDL standard color correction"},
9294 "WHITEPOINT",
9295 0,
9296 "White Point",
9297 "Chromatic adaption from a different white point"},
9298 {0, nullptr, 0, nullptr, nullptr},
9299 };
9300
9301 prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
9302 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9303 RNA_def_property_enum_items(prop, type_items);
9304 RNA_def_property_ui_text(prop, "Correction Formula", "");
9305 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9306
9307 RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage");
9308
9309 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
9311 prop,
9312 "rna_node_array_property_to_input_getter<float, node_input_color_lift>",
9313 "rna_node_array_property_to_input_setter<float, node_input_color_lift>",
9314 nullptr);
9315 RNA_def_property_array(prop, 3);
9316 RNA_def_property_float_array_default(prop, default_1);
9317 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
9319 prop, "Lift", "Correction for shadows. (Deprecated: Use Lift input instead.)");
9320 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9321
9322 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
9324 prop,
9325 "rna_node_array_property_to_input_getter<float, node_input_color_gamma>",
9326 "rna_node_array_property_to_input_setter<float, node_input_color_gamma>",
9327 nullptr);
9328 RNA_def_property_array(prop, 3);
9329 RNA_def_property_float_array_default(prop, default_1);
9330 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
9332 prop, "Gamma", "Correction for midtones. (Deprecated: Use Gamma input instead.)");
9333 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9334
9335 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
9337 prop,
9338 "rna_node_array_property_to_input_getter<float, node_input_color_gain>",
9339 "rna_node_array_property_to_input_setter<float, node_input_color_gain>",
9340 nullptr);
9341 RNA_def_property_array(prop, 3);
9342 RNA_def_property_float_array_default(prop, default_1);
9343 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
9345 prop, "Gain", "Correction for highlights. (Deprecated: Use Gain input instead.)");
9346 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9347
9348 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
9350 prop,
9351 "rna_node_array_property_to_input_getter<float, node_input_color_offset>",
9352 "rna_node_array_property_to_input_setter<float, node_input_color_offset>",
9353 nullptr);
9354 RNA_def_property_array(prop, 3);
9355 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
9357 prop,
9358 "Offset",
9359 "Correction for entire tonal range. (Deprecated: Use Offset input instead.)");
9360 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9361
9362 prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
9364 prop,
9365 "rna_node_array_property_to_input_getter<float, node_input_color_power>",
9366 "rna_node_array_property_to_input_setter<float, node_input_color_power>",
9367 nullptr);
9368 RNA_def_property_array(prop, 3);
9369 RNA_def_property_float_array_default(prop, default_1);
9370 RNA_def_property_range(prop, 0.0f, FLT_MAX);
9371 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
9373 prop, "Power", "Correction for midtones. (Deprecated: Use Power input instead.)");
9375 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9376
9377 prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
9379 prop,
9380 "rna_node_array_property_to_input_getter<float, node_input_color_slope>",
9381 "rna_node_array_property_to_input_setter<float, node_input_color_slope>",
9382 nullptr);
9383 RNA_def_property_array(prop, 3);
9384 RNA_def_property_float_array_default(prop, default_1);
9385 RNA_def_property_range(prop, 0.0f, FLT_MAX);
9386 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
9388 prop, "Slope", "Correction for highlights. (Deprecated: Use Slope input instead.)");
9389 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9390
9391 prop = RNA_def_property(srna, "offset_basis", PROP_FLOAT, PROP_NONE);
9393 "rna_node_property_to_input_getter<float, node_input_base_offset>",
9394 "rna_node_property_to_input_setter<float, node_input_base_offset>",
9395 nullptr);
9397 RNA_def_property_ui_range(prop, -1.0, 1.0, 1.0, 2);
9399 "Basis",
9400 "Support negative color by using this as the RGB basis. (Deprecated: "
9401 "Use Offset Basis input instead.)");
9402 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9403
9404 prop = RNA_def_property(srna, "input_temperature", PROP_FLOAT, PROP_COLOR_TEMPERATURE);
9406 prop,
9407 "rna_node_property_to_input_getter<float, node_input_input_temperature>",
9408 "rna_node_property_to_input_setter<float, node_input_input_temperature>",
9409 nullptr);
9410 RNA_def_property_float_default(prop, 6500.0f);
9411 RNA_def_property_range(prop, 1800.0f, 100000.0f);
9412 RNA_def_property_ui_range(prop, 2000.0f, 11000.0f, 100, 0);
9414 "Input Temperature",
9415 "Color temperature of the input's white point. (Deprecated: Use Input "
9416 "Temperature input instead.)");
9417 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9418
9419 prop = RNA_def_property(srna, "input_tint", PROP_FLOAT, PROP_FACTOR);
9421 "rna_node_property_to_input_getter<float, node_input_input_tint>",
9422 "rna_node_property_to_input_setter<float, node_input_input_tint>",
9423 nullptr);
9424 RNA_def_property_float_default(prop, 10.0f);
9425 RNA_def_property_range(prop, -500.0f, 500.0f);
9426 RNA_def_property_ui_range(prop, -150.0f, 150.0f, 1, 1);
9428 "Input Tint",
9429 "Color tint of the input's white point (the default of 10 matches "
9430 "daylight). (Deprecated: Use Input Tint input instead.)");
9431 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9432
9433 prop = RNA_def_property(srna, "input_whitepoint", PROP_FLOAT, PROP_COLOR);
9434 RNA_def_property_array(prop, 3);
9436 "rna_NodeColorBalance_input_whitepoint_get",
9437 "rna_NodeColorBalance_input_whitepoint_set",
9438 nullptr);
9440 "Input White Point",
9441 "The color which gets mapped to white "
9442 "(automatically converted to/from temperature and tint)");
9443 RNA_def_property_update(prop, NC_WINDOW, "rna_Node_update");
9444
9445 prop = RNA_def_property(srna, "output_temperature", PROP_FLOAT, PROP_COLOR_TEMPERATURE);
9447 prop,
9448 "rna_node_property_to_input_getter<float, node_input_output_temperature>",
9449 "rna_node_property_to_input_setter<float, node_input_output_temperature>",
9450 nullptr);
9451 RNA_def_property_float_default(prop, 6500.0f);
9452 RNA_def_property_range(prop, 1800.0f, 100000.0f);
9453 RNA_def_property_ui_range(prop, 2000.0f, 11000.0f, 100, 0);
9455 "Output Temperature",
9456 "Color temperature of the output's white point. (Deprecated: Use "
9457 "Output Temperature input instead.)");
9458 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9459
9460 prop = RNA_def_property(srna, "output_tint", PROP_FLOAT, PROP_FACTOR);
9462 "rna_node_property_to_input_getter<float, node_input_output_tint>",
9463 "rna_node_property_to_input_setter<float, node_input_output_tint>",
9464 nullptr);
9465 RNA_def_property_float_default(prop, 10.0f);
9466 RNA_def_property_range(prop, -500.0f, 500.0f);
9467 RNA_def_property_ui_range(prop, -150.0f, 150.0f, 1, 1);
9469 "Output Tint",
9470 "Color tint of the output's white point (the default of 10 matches "
9471 "daylight). (Deprecated: Use Output Tint input instead.)");
9472 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9473
9474 prop = RNA_def_property(srna, "output_whitepoint", PROP_FLOAT, PROP_COLOR);
9475 RNA_def_property_array(prop, 3);
9477 "rna_NodeColorBalance_output_whitepoint_get",
9478 "rna_NodeColorBalance_output_whitepoint_set",
9479 nullptr);
9481 "Output White Point",
9482 "The color which gets white gets mapped to "
9483 "(automatically converted to/from temperature and tint)");
9484 RNA_def_property_update(prop, NC_WINDOW, "rna_Node_update");
9485}
9486
9487static void def_cmp_huecorrect(BlenderRNA * /*brna*/, StructRNA *srna)
9488{
9489 PropertyRNA *prop;
9490
9491 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
9492 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
9493 RNA_def_property_struct_type(prop, "CurveMapping");
9494 RNA_def_property_ui_text(prop, "Mapping", "");
9495 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9496}
9497
9498static void def_cmp_zcombine(BlenderRNA * /*brna*/, StructRNA *srna)
9499{
9500 PropertyRNA *prop;
9501
9502 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
9504 "rna_node_property_to_input_getter<bool, node_input_use_alpha>",
9505 "rna_node_property_to_input_setter<bool, node_input_use_alpha>");
9507 "Use Alpha",
9508 "Take alpha channel into account when doing the Z operation. "
9509 "(Deprecated: Use \"Use Alpha\" input instead.)");
9510 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9511
9512 prop = RNA_def_property(srna, "use_antialias_z", PROP_BOOLEAN, PROP_NONE);
9514 "rna_node_property_to_input_getter<bool, node_input_anti_alias>",
9515 "rna_node_property_to_input_setter<bool, node_input_anti_alias>");
9517 "Anti-Alias Z",
9518 "Anti-alias the z-buffer to try to avoid artifacts, mostly useful for "
9519 "Blender renders. (Deprecated: Use Anti-Alias input instead.)");
9520 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9521}
9522
9523static void def_cmp_ycc(BlenderRNA * /*brna*/, StructRNA *srna)
9524{
9525 PropertyRNA *prop;
9526
9527 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9528 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9530 RNA_def_property_ui_text(prop, "Mode", "");
9531 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9532}
9533
9534static void def_cmp_combsep_color(BlenderRNA * /*brna*/, StructRNA *srna)
9535{
9536 static const EnumPropertyItem mode_items[] = {
9538 "RGB",
9539 ICON_NONE,
9540 "RGB",
9541 "Use RGB (Red, Green, Blue) color processing"},
9543 "HSV",
9544 ICON_NONE,
9545 "HSV",
9546 "Use HSV (Hue, Saturation, Value) color processing"},
9548 "HSL",
9549 ICON_NONE,
9550 "HSL",
9551 "Use HSL (Hue, Saturation, Lightness) color processing"},
9553 "YCC",
9554 ICON_NONE,
9555 "YCbCr",
9556 "Use YCbCr (Y - luma, Cb - blue-difference chroma, Cr - red-difference chroma) color "
9557 "processing"},
9559 "YUV",
9560 ICON_NONE,
9561 "YUV",
9562 "Use YUV (Y - luma, U V - chroma) color processing"},
9563 {0, nullptr, 0, nullptr, nullptr},
9564 };
9565
9566 PropertyRNA *prop;
9567
9568 RNA_def_struct_sdna_from(srna, "NodeCMPCombSepColor", "storage");
9569
9570 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9571 RNA_def_property_enum_items(prop, mode_items);
9572 RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
9573 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9574
9575 prop = RNA_def_property(srna, "ycc_mode", PROP_ENUM, PROP_NONE);
9577 RNA_def_property_ui_text(prop, "Color Space", "Color space used for YCbCrA processing");
9578 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9579}
9580
9581static void def_cmp_movieclip(BlenderRNA * /*brna*/, StructRNA *srna)
9582{
9583 PropertyRNA *prop;
9584
9585 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
9586 RNA_def_property_pointer_sdna(prop, nullptr, "id");
9587 RNA_def_property_struct_type(prop, "MovieClip");
9590 RNA_def_property_ui_text(prop, "Movie Clip", "");
9591 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9592
9593 RNA_def_struct_sdna_from(srna, "MovieClipUser", "storage");
9594}
9595
9596static void def_cmp_stabilize2d(BlenderRNA * /*brna*/, StructRNA *srna)
9597{
9598 PropertyRNA *prop;
9599
9600 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
9601 RNA_def_property_pointer_sdna(prop, nullptr, "id");
9602 RNA_def_property_struct_type(prop, "MovieClip");
9605 RNA_def_property_ui_text(prop, "Movie Clip", "");
9606 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9607
9608 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
9609 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9611 RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
9612 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9613
9614 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
9616 "rna_node_property_to_input_getter<bool, node_input_invert>",
9617 "rna_node_property_to_input_setter<bool, node_input_invert>");
9619 "Invert",
9620 "Invert stabilization to re-introduce motion to the frame. "
9621 "(Deprecated: Use Invert input instead.)");
9622 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9623}
9624
9625static void def_cmp_moviedistortion(BlenderRNA * /*brna*/, StructRNA *srna)
9626{
9627 PropertyRNA *prop;
9628
9629 static const EnumPropertyItem distortion_type_items[] = {
9630 {0, "UNDISTORT", 0, "Undistort", ""},
9631 {1, "DISTORT", 0, "Distort", ""},
9632 {0, nullptr, 0, nullptr, nullptr},
9633 };
9634
9635 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
9636 RNA_def_property_pointer_sdna(prop, nullptr, "id");
9637 RNA_def_property_struct_type(prop, "MovieClip");
9640 RNA_def_property_ui_text(prop, "Movie Clip", "");
9641 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9642
9643 prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
9644 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9645 RNA_def_property_enum_items(prop, distortion_type_items);
9646 RNA_def_property_ui_text(prop, "Distortion", "Distortion to use to filter image");
9647 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9648}
9649
9650static void def_cmp_mask(BlenderRNA * /*brna*/, StructRNA *srna)
9651{
9652 PropertyRNA *prop;
9653
9654 static const EnumPropertyItem aspect_type_items[] = {
9655 {0, "SCENE", 0, "Scene Size", ""},
9656 {CMP_NODE_MASK_FLAG_SIZE_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
9658 "FIXED_SCENE",
9659 0,
9660 "Fixed/Scene",
9661 "Pixel size scaled by scene percentage"},
9662 {0, nullptr, 0, nullptr, nullptr},
9663 };
9664
9665 prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
9666 RNA_def_property_pointer_sdna(prop, nullptr, "id");
9667 RNA_def_property_struct_type(prop, "Mask");
9670 RNA_def_property_ui_text(prop, "Mask", "");
9671 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9672
9673 prop = RNA_def_property(srna, "use_feather", PROP_BOOLEAN, PROP_NONE);
9675 "rna_node_property_to_input_getter<bool, node_input_feather>",
9676 "rna_node_property_to_input_setter<bool, node_input_feather>");
9678 prop,
9679 "Feather",
9680 "Use feather information from the mask. (Deprecated: Use Feather input instead.)");
9681 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9682
9683 prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
9685 prop,
9686 "rna_node_property_to_input_getter<bool, node_input_motion_blur>",
9687 "rna_node_property_to_input_setter<bool, node_input_motion_blur>");
9689 prop,
9690 "Motion Blur",
9691 "Use multi-sampled motion blur of the mask. (Deprecated: Use Motion Blur input instead.)");
9692 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9693
9694 prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
9696 prop,
9697 "rna_node_property_to_input_getter<int, node_input_motion_blur_samples>",
9698 "rna_node_property_to_input_setter<int, node_input_motion_blur_samples>",
9699 nullptr);
9702 prop,
9703 "Samples",
9704 "Number of motion blur samples. (Deprecated: Use Motion Blur Samples input instead.)");
9705 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9706
9707 prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
9709 prop,
9710 "rna_node_property_to_input_getter<float, node_input_motion_blur_shutter>",
9711 "rna_node_property_to_input_setter<float, node_input_motion_blur_shutter>",
9712 nullptr);
9713 RNA_def_property_range(prop, 0.0, 1.0f);
9715 "Shutter",
9716 "Exposure for motion blur as a factor of FPS. (Deprecated: Use Motion "
9717 "Blur Shutter input instead.)");
9718 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9719
9720 prop = RNA_def_property(srna, "size_source", PROP_ENUM, PROP_NONE);
9721 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "custom1");
9722 RNA_def_property_enum_items(prop, aspect_type_items);
9724 prop, "Size Source", "Where to get the mask size from for aspect/size information");
9725 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9726
9727 prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
9729 "rna_node_property_to_input_getter<int, node_input_size_x>",
9730 "rna_node_property_to_input_setter<int, node_input_size_x>",
9731 nullptr);
9732 RNA_def_property_range(prop, 1.0f, 10000.0f);
9733 RNA_def_property_ui_text(prop, "X", "(Deprecated: Use Size X input instead.)");
9734 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9735
9736 prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
9738 "rna_node_property_to_input_getter<int, node_input_size_y>",
9739 "rna_node_property_to_input_setter<int, node_input_size_y>",
9740 nullptr);
9741 RNA_def_property_range(prop, 1.0f, 10000.0f);
9742 RNA_def_property_ui_text(prop, "Y", "(Deprecated: Use Size Y input instead.)");
9743 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9744}
9745
9746static void dev_cmd_transform(BlenderRNA * /*brna*/, StructRNA *srna)
9747{
9748 PropertyRNA *prop;
9749
9750 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
9751 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9753 RNA_def_property_ui_text(prop, "Filter", "Method to use to filter transform");
9754 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9755}
9756
9757/* -- Compositor Nodes ------------------------------------------------------ */
9758
9760 {0, "ADD", 0, "Add", ""},
9761 {1, "SUBTRACT", 0, "Subtract", ""},
9762 {2, "MULTIPLY", 0, "Multiply", ""},
9763 {3, "NOT", 0, "Not", ""},
9764 {0, nullptr, 0, nullptr, nullptr},
9765};
9766
9767static void def_cmp_boxmask(BlenderRNA * /*brna*/, StructRNA *srna)
9768{
9769 PropertyRNA *prop;
9770
9771 prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
9772 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9774 RNA_def_property_ui_text(prop, "Mask Type", "");
9775 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9776
9777 prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
9779 "rna_node_property_to_vector_input_getter<node_input_position, 0>",
9780 "rna_node_property_to_vector_input_setter<node_input_position, 0>",
9781 nullptr);
9783 RNA_def_property_range(prop, -1.0f, 2.0f);
9785 prop, "X", "X position of the middle of the box. (Deprecated: Use Position input instead.)");
9786 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9787
9788 prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
9790 "rna_node_property_to_vector_input_getter<node_input_position, 1>",
9791 "rna_node_property_to_vector_input_setter<node_input_position, 1>",
9792 nullptr);
9794 RNA_def_property_range(prop, -1.0f, 2.0f);
9796 prop, "Y", "Y position of the middle of the box. (Deprecated: Use Position input instead.)");
9797 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9798
9799 prop = RNA_def_property(srna, "mask_width", PROP_FLOAT, PROP_NONE);
9801 "rna_node_property_to_vector_input_getter<node_input_size, 0>",
9802 "rna_node_property_to_vector_input_setter<node_input_size, 0>",
9803 nullptr);
9805 RNA_def_property_range(prop, 0.0f, 2.0f);
9807 prop, "Width", "Width of the box. (Deprecated: Use Size input instead.)");
9808 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9809
9810 prop = RNA_def_property(srna, "mask_height", PROP_FLOAT, PROP_NONE);
9812 "rna_node_property_to_vector_input_getter<node_input_size, 1>",
9813 "rna_node_property_to_vector_input_setter<node_input_size, 1>",
9814 nullptr);
9816 RNA_def_property_range(prop, 0.0f, 2.0f);
9818 prop, "Height", "Height of the box. (Deprecated: Use Size input instead.)");
9819 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9820
9821 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
9823 "rna_node_property_to_input_getter<float, node_input_rotation>",
9824 "rna_node_property_to_input_setter<float, node_input_rotation>",
9825 nullptr);
9827 RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
9829 prop, "Rotation", "Rotation angle of the box. (Deprecated: Use Rotation input instead.)");
9830 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9831}
9832
9833static void def_cmp_ellipsemask(BlenderRNA * /*brna*/, StructRNA *srna)
9834{
9835 PropertyRNA *prop;
9836 prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
9837 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9839 RNA_def_property_ui_text(prop, "Mask Type", "");
9840 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9841
9842 prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
9844 "rna_node_property_to_vector_input_getter<node_input_position, 0>",
9845 "rna_node_property_to_vector_input_setter<node_input_position, 0>",
9846 nullptr);
9848 RNA_def_property_range(prop, -1.0f, 2.0f);
9850 prop,
9851 "X",
9852 "X position of the middle of the ellipse. (Deprecated: Use Position input instead.)");
9853 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9854
9855 prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
9857 "rna_node_property_to_vector_input_getter<node_input_position, 1>",
9858 "rna_node_property_to_vector_input_setter<node_input_position, 1>",
9859 nullptr);
9861 RNA_def_property_range(prop, -1.0f, 2.0f);
9863 prop,
9864 "Y",
9865 "Y position of the middle of the ellipse. (Deprecated: Use Position input instead.)");
9866 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9867
9868 prop = RNA_def_property(srna, "mask_width", PROP_FLOAT, PROP_NONE);
9870 "rna_node_property_to_vector_input_getter<node_input_size, 0>",
9871 "rna_node_property_to_vector_input_setter<node_input_size, 0>",
9872 nullptr);
9874 RNA_def_property_range(prop, 0.0f, 2.0f);
9876 prop, "Width", "Width of the ellipse. (Deprecated: Use Size input instead.)");
9877 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9878
9879 prop = RNA_def_property(srna, "mask_height", PROP_FLOAT, PROP_NONE);
9881 "rna_node_property_to_vector_input_getter<node_input_size, 1>",
9882 "rna_node_property_to_vector_input_setter<node_input_size, 1>",
9883 nullptr);
9885 RNA_def_property_range(prop, 0.0f, 2.0f);
9887 prop, "Height", "Height of the ellipse. (Deprecated: Use Size input instead.)");
9888 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9889
9890 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
9892 "rna_node_property_to_input_getter<float, node_input_rotation>",
9893 "rna_node_property_to_input_setter<float, node_input_rotation>",
9894 nullptr);
9896 RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
9898 prop,
9899 "Rotation",
9900 "Rotation angle of the ellipse. (Deprecated: Use Rotation input instead.)");
9901 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9902}
9903
9904static void def_cmp_bokehblur(BlenderRNA * /*brna*/, StructRNA *srna)
9905{
9906 PropertyRNA *prop;
9907
9908 /* duplicated in def_cmp_blur */
9909 prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
9910 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
9912 prop,
9913 "Variable Size",
9914 "Support variable blur per pixel when using an image for size input. (Deprecated: Unused.)");
9915 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9916
9917 prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
9919 prop,
9920 "rna_node_property_to_input_getter<bool, node_input_extend_bounds>",
9921 "rna_node_property_to_input_setter<bool, node_input_extend_bounds>");
9923 "Extend Bounds",
9924 "Extend bounds of the input image to fully fit blurred image. "
9925 "(Deprecated: Use Extend Bounds input instead.)");
9926 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9927
9928 prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
9929 RNA_def_property_float_sdna(prop, nullptr, "custom4");
9930 RNA_def_property_range(prop, 0.0f, 10000.0f);
9932 prop, "Max Blur", "Blur limit, maximum CoC radius. (Deprecated: Unused.)");
9933 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9934}
9935
9936static void def_cmp_bokehimage(BlenderRNA * /*brna*/, StructRNA *srna)
9937{
9938 PropertyRNA *prop;
9939
9940 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
9942 "rna_node_property_to_input_getter<float, node_input_angle>",
9943 "rna_node_property_to_input_setter<float, node_input_angle>",
9944 nullptr);
9946 RNA_def_property_range(prop, DEG2RADF(-720.0f), DEG2RADF(720.0f));
9948 prop, "Angle", "Angle of the bokeh. (Deprecated: Use Angle input instead)");
9949 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9950
9951 prop = RNA_def_property(srna, "flaps", PROP_INT, PROP_NONE);
9953 "rna_node_property_to_input_getter<int, node_input_flaps>",
9954 "rna_node_property_to_input_setter<int, node_input_flaps>",
9955 nullptr);
9957 RNA_def_property_range(prop, 3, 24);
9959 prop, "Flaps", "Number of flaps. (Deprecated: Use Flaps input instead)");
9960 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9961
9962 prop = RNA_def_property(srna, "rounding", PROP_FLOAT, PROP_NONE);
9964 "rna_node_property_to_input_getter<float, node_input_roundness>",
9965 "rna_node_property_to_input_setter<float, node_input_roundness>",
9966 nullptr);
9968 RNA_def_property_range(prop, -0.0f, 1.0f);
9970 prop,
9971 "Rounding",
9972 "Level of rounding of the bokeh. (Deprecated: Use Roundness input instead)");
9973 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9974
9975 prop = RNA_def_property(srna, "catadioptric", PROP_FLOAT, PROP_NONE);
9977 prop,
9978 "rna_node_property_to_input_getter<float, node_input_catadioptric_size>",
9979 "rna_node_property_to_input_setter<float, node_input_catadioptric_size>",
9980 nullptr);
9982 RNA_def_property_range(prop, -0.0f, 1.0f);
9984 prop,
9985 "Catadioptric",
9986 "Level of catadioptric of the bokeh. (Deprecated: Use Catadioptric Size input instead)");
9987 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9988
9989 prop = RNA_def_property(srna, "shift", PROP_FLOAT, PROP_NONE);
9991 "rna_node_property_to_input_getter<float, node_input_color_shift>",
9992 "rna_node_property_to_input_setter<float, node_input_color_shift>",
9993 nullptr);
9995 RNA_def_property_range(prop, -1.0f, 1.0f);
9997 prop,
9998 "Lens Shift",
9999 "Shift of the lens components. (Deprecated: Use Color Shift input instead)");
10000 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10001}
10002
10003static void def_cmp_switch(BlenderRNA * /*brna*/, StructRNA *srna)
10004{
10005 PropertyRNA *prop;
10006
10007 prop = RNA_def_property(srna, "check", PROP_BOOLEAN, PROP_NONE);
10009 "rna_node_property_to_input_getter<bool, node_input_switch>",
10010 "rna_node_property_to_input_setter<bool, node_input_switch>");
10012 prop,
10013 "Switch",
10014 "Off: first socket, On: second socket. (Deprecated: Use Switch input instead.)");
10015 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10016}
10017
10018static void def_cmp_switch_view(BlenderRNA * /*brna*/, StructRNA * /*srna*/) {}
10019
10020static void def_cmp_colorcorrection(BlenderRNA * /*brna*/, StructRNA *srna)
10021{
10022 PropertyRNA *prop;
10023 prop = RNA_def_property(srna, "red", PROP_BOOLEAN, PROP_NONE);
10025 prop,
10026 "rna_node_property_to_input_getter<bool, node_input_apply_on_red>",
10027 "rna_node_property_to_input_setter<bool, node_input_apply_on_red>");
10030 prop, "Red", "Red channel active. (Deprecated: Use Apply On Red input instead.)");
10031 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10032
10033 prop = RNA_def_property(srna, "green", PROP_BOOLEAN, PROP_NONE);
10035 prop,
10036 "rna_node_property_to_input_getter<bool, node_input_apply_on_green>",
10037 "rna_node_property_to_input_setter<bool, node_input_apply_on_green>");
10040 prop, "Green", "Green channel active. (Deprecated: Use Apply On Green input instead.)");
10041 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10042
10043 prop = RNA_def_property(srna, "blue", PROP_BOOLEAN, PROP_NONE);
10045 prop,
10046 "rna_node_property_to_input_getter<bool, node_input_apply_on_blue>",
10047 "rna_node_property_to_input_setter<bool, node_input_apply_on_blue>");
10050 prop, "Blue", "Blue channel active. (Deprecated: Use Apply On Blue input instead.)");
10051 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10052
10053 prop = RNA_def_property(srna, "midtones_start", PROP_FLOAT, PROP_NONE);
10055 prop,
10056 "rna_node_property_to_input_getter<float, node_input_midtones_start>",
10057 "rna_node_property_to_input_setter<float, node_input_midtones_start>",
10058 nullptr);
10060 RNA_def_property_range(prop, 0, 1);
10062 "Midtones Start",
10063 "Start of midtones. (Deprecated: Use Midtones Start input instead.)");
10064 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10065
10066 prop = RNA_def_property(srna, "midtones_end", PROP_FLOAT, PROP_NONE);
10068 "rna_node_property_to_input_getter<float, node_input_midtones_end>",
10069 "rna_node_property_to_input_setter<float, node_input_midtones_end>",
10070 nullptr);
10072 RNA_def_property_range(prop, 0, 1);
10074 prop, "Midtones End", "End of midtones. (Deprecated: Use Midtones End input instead.)");
10075 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10076
10077 prop = RNA_def_property(srna, "master_saturation", PROP_FLOAT, PROP_NONE);
10079 prop,
10080 "rna_node_property_to_input_getter<float, node_input_master_saturation>",
10081 "rna_node_property_to_input_setter<float, node_input_master_saturation>",
10082 nullptr);
10084 RNA_def_property_range(prop, 0, 4);
10086 prop,
10087 "Master Saturation",
10088 "Master saturation. (Deprecated: Use Master Saturation input instead.)");
10089 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10090
10091 prop = RNA_def_property(srna, "master_contrast", PROP_FLOAT, PROP_NONE);
10093 prop,
10094 "rna_node_property_to_input_getter<float, node_input_master_contrast>",
10095 "rna_node_property_to_input_setter<float, node_input_master_contrast>",
10096 nullptr);
10098 RNA_def_property_range(prop, 0, 4);
10100 "Master Contrast",
10101 "Master contrast. (Deprecated: Use Master Contrast input instead.)");
10102 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10103
10104 prop = RNA_def_property(srna, "master_gamma", PROP_FLOAT, PROP_NONE);
10106 "rna_node_property_to_input_getter<float, node_input_master_gamma>",
10107 "rna_node_property_to_input_setter<float, node_input_master_gamma>",
10108 nullptr);
10110 RNA_def_property_range(prop, 0, 4);
10112 prop, "Master Gamma", "Master gamma. (Deprecated: Use Master Gamma input instead.)");
10113 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10114
10115 prop = RNA_def_property(srna, "master_gain", PROP_FLOAT, PROP_NONE);
10117 "rna_node_property_to_input_getter<float, node_input_master_gain>",
10118 "rna_node_property_to_input_setter<float, node_input_master_gain>",
10119 nullptr);
10121 RNA_def_property_range(prop, 0, 4);
10123 prop, "Master Gain", "Master gain. (Deprecated: Use Master Gain input instead.)");
10124 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10125
10126 prop = RNA_def_property(srna, "master_lift", PROP_FLOAT, PROP_NONE);
10128 "rna_node_property_to_input_getter<float, node_input_master_lift>",
10129 "rna_node_property_to_input_setter<float, node_input_master_lift>",
10130 nullptr);
10132 RNA_def_property_range(prop, -1, 1);
10134 prop, "Master Lift", "Master lift. (Deprecated: Use Master Lift input instead.)");
10135 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10136
10137 //
10138 prop = RNA_def_property(srna, "shadows_saturation", PROP_FLOAT, PROP_NONE);
10140 prop,
10141 "rna_node_property_to_input_getter<float, node_input_shadows_saturation>",
10142 "rna_node_property_to_input_setter<float, node_input_shadows_saturation>",
10143 nullptr);
10145 RNA_def_property_range(prop, 0, 4);
10147 prop,
10148 "Shadows Saturation",
10149 "Shadows saturation. (Deprecated: Use Shadows Saturation input instead.)");
10150 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10151
10152 prop = RNA_def_property(srna, "shadows_contrast", PROP_FLOAT, PROP_NONE);
10154 prop,
10155 "rna_node_property_to_input_getter<float, node_input_shadows_contrast>",
10156 "rna_node_property_to_input_setter<float, node_input_shadows_contrast>",
10157 nullptr);
10159 RNA_def_property_range(prop, 0, 4);
10161 "Shadows Contrast",
10162 "Shadows contrast. (Deprecated: Use Shadows Contrast input instead.)");
10163 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10164
10165 prop = RNA_def_property(srna, "shadows_gamma", PROP_FLOAT, PROP_NONE);
10167 prop,
10168 "rna_node_property_to_input_getter<float, node_input_shadows_gamma>",
10169 "rna_node_property_to_input_setter<float, node_input_shadows_gamma>",
10170 nullptr);
10172 RNA_def_property_range(prop, 0, 4);
10174 prop, "Shadows Gamma", "Shadows gamma. (Deprecated: Use Shadows Gamma input instead.)");
10175 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10176
10177 prop = RNA_def_property(srna, "shadows_gain", PROP_FLOAT, PROP_NONE);
10179 "rna_node_property_to_input_getter<float, node_input_shadows_gain>",
10180 "rna_node_property_to_input_setter<float, node_input_shadows_gain>",
10181 nullptr);
10183 RNA_def_property_range(prop, 0, 4);
10185 prop, "Shadows Gain", "Shadows gain. (Deprecated: Use Shadows Gain input instead.)");
10186 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10187
10188 prop = RNA_def_property(srna, "shadows_lift", PROP_FLOAT, PROP_NONE);
10190 "rna_node_property_to_input_getter<float, node_input_shadows_lift>",
10191 "rna_node_property_to_input_setter<float, node_input_shadows_lift>",
10192 nullptr);
10194 RNA_def_property_range(prop, -1, 1);
10196 prop, "Shadows Lift", "Shadows lift. (Deprecated: Use Shadows Lift input instead.)");
10197 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10198 //
10199 prop = RNA_def_property(srna, "midtones_saturation", PROP_FLOAT, PROP_NONE);
10201 prop,
10202 "rna_node_property_to_input_getter<float, node_input_midtones_saturation>",
10203 "rna_node_property_to_input_setter<float, node_input_midtones_saturation>",
10204 nullptr);
10206 RNA_def_property_range(prop, 0, 4);
10208 prop,
10209 "Midtones Saturation",
10210 "Midtones saturation. (Deprecated: Use Midtones Saturation input instead.)");
10211 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10212
10213 prop = RNA_def_property(srna, "midtones_contrast", PROP_FLOAT, PROP_NONE);
10215 prop,
10216 "rna_node_property_to_input_getter<float, node_input_midtones_contrast>",
10217 "rna_node_property_to_input_setter<float, node_input_midtones_contrast>",
10218 nullptr);
10220 RNA_def_property_range(prop, 0, 4);
10222 prop,
10223 "Midtones Contrast",
10224 "Midtones contrast. (Deprecated: Use Midtones Contrast input instead.)");
10225 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10226
10227 prop = RNA_def_property(srna, "midtones_gamma", PROP_FLOAT, PROP_NONE);
10229 prop,
10230 "rna_node_property_to_input_getter<float, node_input_midtones_gamma>",
10231 "rna_node_property_to_input_setter<float, node_input_midtones_gamma>",
10232 nullptr);
10234 RNA_def_property_range(prop, 0, 4);
10236 prop, "Midtones Gamma", "Midtones gamma. (Deprecated: Use Midtones Gamma input instead.)");
10237 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10238
10239 prop = RNA_def_property(srna, "midtones_gain", PROP_FLOAT, PROP_NONE);
10241 prop,
10242 "rna_node_property_to_input_getter<float, node_input_midtones_gain>",
10243 "rna_node_property_to_input_setter<float, node_input_midtones_gain>",
10244 nullptr);
10246 RNA_def_property_range(prop, 0, 4);
10248 prop, "Midtones Gain", "Midtones gain. (Deprecated: Use Midtones Gain input instead.)");
10249 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10250
10251 prop = RNA_def_property(srna, "midtones_lift", PROP_FLOAT, PROP_NONE);
10253 prop,
10254 "rna_node_property_to_input_getter<float, node_input_midtones_lift>",
10255 "rna_node_property_to_input_setter<float, node_input_midtones_lift>",
10256 nullptr);
10258 RNA_def_property_range(prop, -1, 1);
10260 prop, "Midtones Lift", "Midtones lift. (Deprecated: Use Midtones Lift input instead.)");
10261 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10262 //
10263 prop = RNA_def_property(srna, "highlights_saturation", PROP_FLOAT, PROP_NONE);
10265 prop,
10266 "rna_node_property_to_input_getter<float, node_input_highlights_saturation>",
10267 "rna_node_property_to_input_setter<float, node_input_highlights_saturation>",
10268 nullptr);
10270 RNA_def_property_range(prop, 0, 4);
10272 prop,
10273 "Highlights Saturation",
10274 "Highlights saturation. (Deprecated: Use Highlights Saturation input instead.)");
10275 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10276
10277 prop = RNA_def_property(srna, "highlights_contrast", PROP_FLOAT, PROP_NONE);
10279 prop,
10280 "rna_node_property_to_input_getter<float, node_input_highlights_contrast>",
10281 "rna_node_property_to_input_setter<float, node_input_highlights_contrast>",
10282 nullptr);
10284 RNA_def_property_range(prop, 0, 4);
10286 prop,
10287 "Highlights Contrast",
10288 "Highlights contrast. (Deprecated: Use Highlights Contrast input instead.)");
10289 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10290
10291 prop = RNA_def_property(srna, "highlights_gamma", PROP_FLOAT, PROP_NONE);
10293 prop,
10294 "rna_node_property_to_input_getter<float, node_input_highlights_gamma>",
10295 "rna_node_property_to_input_setter<float, node_input_highlights_gamma>",
10296 nullptr);
10298 RNA_def_property_range(prop, 0, 4);
10300 "Highlights Gamma",
10301 "Highlights gamma. (Deprecated: Use Highlights Gamma input instead.)");
10302 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10303
10304 prop = RNA_def_property(srna, "highlights_gain", PROP_FLOAT, PROP_NONE);
10306 prop,
10307 "rna_node_property_to_input_getter<float, node_input_highlights_gain>",
10308 "rna_node_property_to_input_setter<float, node_input_highlights_gain>",
10309 nullptr);
10311 RNA_def_property_range(prop, 0, 4);
10313 "Highlights Gain",
10314 "Highlights gain. (Deprecated: Use Highlights Gain input instead.)");
10315 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10316
10317 prop = RNA_def_property(srna, "highlights_lift", PROP_FLOAT, PROP_NONE);
10319 prop,
10320 "rna_node_property_to_input_getter<float, node_input_highlights_lift>",
10321 "rna_node_property_to_input_setter<float, node_input_highlights_lift>",
10322 nullptr);
10324 RNA_def_property_range(prop, -1, 1);
10326 "Highlights Lift",
10327 "Highlights lift. (Deprecated: Use Highlights Lift input instead.)");
10328 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10329}
10330
10331static void def_cmp_cornerpin(BlenderRNA * /*brna*/, StructRNA *srna)
10332{
10333 static const EnumPropertyItem cmp_cornerpin_interpolation_items[] = {
10335 "NEAREST",
10336 0,
10337 "Nearest",
10338 "Use Nearest interpolation"},
10340 "BILINEAR",
10341 0,
10342 "Bilinear",
10343 "Use Bilinear interpolation"},
10345 "BICUBIC",
10346 0,
10347 "Bicubic",
10348 "Use Cubic B-Spline interpolation"},
10350 "ANISOTROPIC",
10351 0,
10352 "Anisotropic",
10353 "Use Anisotropic interpolation"},
10354 {0, nullptr, 0, nullptr, nullptr},
10355 };
10356
10357 PropertyRNA *prop;
10358
10359 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
10360 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
10361 RNA_def_property_enum_items(prop, cmp_cornerpin_interpolation_items);
10363 RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
10364 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10365}
10366
10367static void def_cmp_viewer(BlenderRNA * /*brna*/, StructRNA *srna)
10368{
10369 PropertyRNA *prop;
10370
10371 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
10374 "Use Alpha",
10375 "Colors are treated alpha premultiplied, or colors output straight "
10376 "(alpha gets set to 1). (Deprecated: Unused.)");
10377 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10378
10379 prop = RNA_def_property(srna, "ui_shortcut", PROP_INT, PROP_NONE);
10380 RNA_def_property_int_sdna(prop, nullptr, "custom1");
10381 RNA_def_property_int_funcs(prop, nullptr, "rna_Node_Viewer_shortcut_node_set", nullptr);
10385 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10386}
10387
10388static void def_cmp_composite(BlenderRNA * /*brna*/, StructRNA *srna)
10389{
10390 PropertyRNA *prop;
10391
10392 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
10395 "Use Alpha",
10396 "Colors are treated alpha premultiplied, or colors output straight "
10397 "(alpha gets set to 1). (Deprecated: Unused.)");
10398 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10399}
10400
10401static void def_cmp_keyingscreen(BlenderRNA * /*brna*/, StructRNA *srna)
10402{
10403 PropertyRNA *prop;
10404
10405 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
10406 RNA_def_property_pointer_sdna(prop, nullptr, "id");
10407 RNA_def_property_struct_type(prop, "MovieClip");
10410 RNA_def_property_ui_text(prop, "Movie Clip", "");
10411 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
10412
10413 RNA_def_struct_sdna_from(srna, "NodeKeyingScreenData", "storage");
10414
10415 prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
10416 RNA_def_property_string_sdna(prop, nullptr, "tracking_object");
10417 RNA_def_property_ui_text(prop, "Tracking Object", "");
10418 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10419
10420 prop = RNA_def_property(srna, "smoothness", PROP_FLOAT, PROP_FACTOR);
10422 "rna_node_property_to_input_getter<float, node_input_smoothness>",
10423 "rna_node_property_to_input_setter<float, node_input_smoothness>",
10424 nullptr);
10425 RNA_def_property_range(prop, 0.0f, 1.0f);
10426 RNA_def_property_ui_text(prop, "Smoothness", "(Deprecated: Use Smoothness input instead.)");
10427 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10428}
10429
10430static void def_cmp_keying(BlenderRNA * /*brna*/, StructRNA *srna)
10431{
10432 PropertyRNA *prop;
10433
10434 RNA_def_struct_sdna_from(srna, "NodeKeyingData", "storage");
10435
10436 prop = RNA_def_property(srna, "screen_balance", PROP_FLOAT, PROP_FACTOR);
10438 "rna_node_property_to_input_getter<float, node_input_key_balance>",
10439 "rna_node_property_to_input_setter<float, node_input_key_balance>",
10440 nullptr);
10441 RNA_def_property_range(prop, 0.0f, 1.0f);
10443 "Screen Balance",
10444 "Balance between two non-primary channels primary channel is comparing "
10445 "against. (Deprecated: Use Key Balance input instead.)");
10446 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10447
10448 prop = RNA_def_property(srna, "despill_factor", PROP_FLOAT, PROP_FACTOR);
10450 prop,
10451 "rna_node_property_to_input_getter<float, node_input_despill_strength>",
10452 "rna_node_property_to_input_setter<float, node_input_despill_strength>",
10453 nullptr);
10454 RNA_def_property_range(prop, 0.0f, 1.0f);
10456 "Despill Factor",
10457 "Factor of despilling screen color from image. (Deprecated: Use "
10458 "Despill Strength input instead.)");
10459 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10460
10461 prop = RNA_def_property(srna, "despill_balance", PROP_FLOAT, PROP_FACTOR);
10463 prop,
10464 "rna_node_property_to_input_getter<float, node_input_despill_balance>",
10465 "rna_node_property_to_input_setter<float, node_input_despill_balance>",
10466 nullptr);
10467 RNA_def_property_range(prop, 0.0f, 1.0f);
10469 "Despill Balance",
10470 "Balance between non-key colors used to detect amount of key color to "
10471 "be removed. (Deprecated: Use Despill Balance input instead.)");
10472 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10473
10474 prop = RNA_def_property(srna, "clip_black", PROP_FLOAT, PROP_FACTOR);
10476 "rna_node_property_to_input_getter<float, node_input_black_level>",
10477 "rna_node_property_to_input_setter<float, node_input_black_level>",
10478 nullptr);
10479 RNA_def_property_range(prop, 0.0f, 1.0f);
10481 "Clip Black",
10482 "Value of non-scaled matte pixel which considers as fully background "
10483 "pixel. (Deprecated: Use Black Level input instead.)");
10484 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10485
10486 prop = RNA_def_property(srna, "clip_white", PROP_FLOAT, PROP_FACTOR);
10488 "rna_node_property_to_input_getter<float, node_input_white_level>",
10489 "rna_node_property_to_input_setter<float, node_input_white_level>",
10490 nullptr);
10491 RNA_def_property_range(prop, 0.0f, 1.0f);
10493 "Clip White",
10494 "Value of non-scaled matte pixel which considers as fully foreground "
10495 "pixel. (Deprecated: Use White Level input instead.)");
10496 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10497
10498 prop = RNA_def_property(srna, "blur_pre", PROP_INT, PROP_NONE);
10500 prop,
10501 "rna_node_property_to_input_getter<int, node_input_preprocess_blur_size>",
10502 "rna_node_property_to_input_setter<int, node_input_preprocess_blur_size>",
10503 nullptr);
10504 RNA_def_property_range(prop, 0, 2048);
10506 "Pre Blur",
10507 "Chroma pre-blur size which applies before running keyer. (Deprecated: "
10508 "Use Preprocess Blur Size input instead.)");
10509 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10510
10511 prop = RNA_def_property(srna, "blur_post", PROP_INT, PROP_NONE);
10513 prop,
10514 "rna_node_property_to_input_getter<int, node_input_postprocess_blur_size>",
10515 "rna_node_property_to_input_setter<int, node_input_postprocess_blur_size>",
10516 nullptr);
10517 RNA_def_property_range(prop, 0, 2048);
10519 "Post Blur",
10520 "Matte blur size which applies after clipping and dilate/eroding. "
10521 "(Deprecated: Use Postprocess Blur Size input instead.)");
10522 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10523
10524 prop = RNA_def_property(srna, "dilate_distance", PROP_INT, PROP_NONE);
10526 prop,
10527 "rna_node_property_to_input_getter<int, node_input_postprocess_dilate_size>",
10528 "rna_node_property_to_input_setter<int, node_input_postprocess_dilate_size>",
10529 nullptr);
10530 RNA_def_property_range(prop, -100, 100);
10532 "Dilate/Erode",
10533 "Distance to grow/shrink the matte. (Deprecated: Use Postprocess "
10534 "Dilate Size input instead.)");
10535 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10536
10537 prop = RNA_def_property(srna, "edge_kernel_radius", PROP_INT, PROP_NONE);
10539 "rna_node_property_to_input_getter<int, node_input_edge_search_size>",
10540 "rna_node_property_to_input_setter<int, node_input_edge_search_size>",
10541 nullptr);
10542 RNA_def_property_range(prop, 0, 100);
10544 "Edge Kernel Radius",
10545 "Radius of kernel used to detect whether pixel belongs to edge. "
10546 "(Deprecated: Use Edge Search Size input instead.)");
10547 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10548
10549 prop = RNA_def_property(srna, "edge_kernel_tolerance", PROP_FLOAT, PROP_FACTOR);
10551 prop,
10552 "rna_node_property_to_input_getter<float, node_input_edge_tolerance>",
10553 "rna_node_property_to_input_setter<float, node_input_edge_tolerance>",
10554 nullptr);
10555 RNA_def_property_range(prop, 0.0f, 1.0f);
10557 "Edge Kernel Tolerance",
10558 "Tolerance to pixels inside kernel which are treating as belonging to "
10559 "the same plane. (Deprecated: Use Edge Tolerance input instead.)");
10560 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10561
10562 prop = RNA_def_property(srna, "feather_falloff", PROP_ENUM, PROP_NONE);
10563 RNA_def_property_enum_sdna(prop, nullptr, "feather_falloff");
10565 RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type of the feather");
10567 BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
10568 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10569
10570 prop = RNA_def_property(srna, "feather_distance", PROP_INT, PROP_NONE);
10572 prop,
10573 "rna_node_property_to_input_getter<int, node_input_postprocess_feather_size>",
10574 "rna_node_property_to_input_setter<int, node_input_postprocess_feather_size>",
10575 nullptr);
10576 RNA_def_property_range(prop, -100, 100);
10578 "Feather Distance",
10579 "Distance to grow/shrink the feather. (Deprecated: Use Postprocess "
10580 "Feather Size input instead.)");
10581 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10582}
10583
10584static void def_cmp_trackpos(BlenderRNA * /*brna*/, StructRNA *srna)
10585{
10586 PropertyRNA *prop;
10587
10588 static const EnumPropertyItem position_items[] = {
10590 "ABSOLUTE",
10591 0,
10592 "Absolute",
10593 "Output absolute position of a marker"},
10595 "RELATIVE_START",
10596 0,
10597 "Relative Start",
10598 "Output position of a marker relative to first marker of a track"},
10600 "RELATIVE_FRAME",
10601 0,
10602 "Relative Frame",
10603 "Output position of a marker relative to marker at given frame number"},
10605 "ABSOLUTE_FRAME",
10606 0,
10607 "Absolute Frame",
10608 "Output absolute position of a marker at given frame number"},
10609 {0, nullptr, 0, nullptr, nullptr},
10610 };
10611
10612 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
10613 RNA_def_property_pointer_sdna(prop, nullptr, "id");
10614 RNA_def_property_struct_type(prop, "MovieClip");
10617 RNA_def_property_ui_text(prop, "Movie Clip", "");
10618 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
10619
10620 prop = RNA_def_property(srna, "position", PROP_ENUM, PROP_NONE);
10621 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
10622 RNA_def_property_enum_items(prop, position_items);
10623 RNA_def_property_ui_text(prop, "Position", "Which marker position to use for output");
10624 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10625
10626 prop = RNA_def_property(srna, "frame_relative", PROP_INT, PROP_NONE);
10627 RNA_def_property_int_sdna(prop, nullptr, "custom2");
10628 RNA_def_property_ui_text(prop, "Frame", "Frame to be used for relative position");
10629 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10630
10631 RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
10632
10633 prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
10634 RNA_def_property_string_sdna(prop, nullptr, "tracking_object");
10635 RNA_def_property_ui_text(prop, "Tracking Object", "");
10636 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10637
10638 prop = RNA_def_property(srna, "track_name", PROP_STRING, PROP_NONE);
10639 RNA_def_property_string_sdna(prop, nullptr, "track_name");
10640 RNA_def_property_ui_text(prop, "Track", "");
10642 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10643}
10644
10645static void def_cmp_pixelate(BlenderRNA * /*brna*/, StructRNA *srna)
10646{
10647 PropertyRNA *prop;
10648
10649 /* The range of the pixel size is chosen so that it is positive and above zero, and also does not
10650 * exceed the underlying int16_t type. The size limit matches the maximum size used by blur
10651 * nodes. */
10652 prop = RNA_def_property(srna, "pixel_size", PROP_INT, PROP_NONE);
10654 "rna_node_property_to_input_getter<int, node_input_size>",
10655 "rna_node_property_to_input_setter<int, node_input_size>",
10656 nullptr);
10657 RNA_def_property_range(prop, 1, 2048);
10660 prop, "Pixel Size", "Pixel size of the output image. (Deprecated: Use Size input instead.)");
10661 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10662}
10663
10664static void def_cmp_translate(BlenderRNA * /*brna*/, StructRNA *srna)
10665{
10666 static const EnumPropertyItem translate_repeat_axis_items[] = {
10667 {CMP_NODE_TRANSLATE_REPEAT_AXIS_NONE, "NONE", 0, "None", "No repeating"},
10668 {CMP_NODE_TRANSLATE_REPEAT_AXIS_X, "XAXIS", 0, "X Axis", "Repeats on the X axis"},
10669 {CMP_NODE_TRANSLATE_REPEAT_AXIS_Y, "YAXIS", 0, "Y Axis", "Repeats on the Y axis"},
10670 {CMP_NODE_TRANSLATE_REPEAT_AXIS_XY, "BOTH", 0, "Both Axes", "Repeats on both axes"},
10671 {0, nullptr, 0, nullptr, nullptr},
10672 };
10673
10674 PropertyRNA *prop;
10675
10676 RNA_def_struct_sdna_from(srna, "NodeTranslateData", "storage");
10677
10678 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
10679 RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
10681 RNA_def_property_ui_text(prop, "", "");
10682 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10683
10684 prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
10685 RNA_def_property_boolean_sdna(prop, nullptr, "relative", 1);
10687 "Relative",
10688 "Use relative (fraction of input image size) values to define "
10689 "translation. (Deprecated: Unused.)");
10690 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10691
10692 prop = RNA_def_property(srna, "wrap_axis", PROP_ENUM, PROP_NONE);
10693 RNA_def_property_enum_sdna(prop, nullptr, "wrap_axis");
10694 RNA_def_property_enum_items(prop, translate_repeat_axis_items);
10695 RNA_def_property_ui_text(prop, "Repeat", "Repeats image on a specific axis");
10696 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10697}
10698
10699static void def_cmp_planetrackdeform(BlenderRNA * /*brna*/, StructRNA *srna)
10700{
10701 PropertyRNA *prop;
10702
10703 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
10704 RNA_def_property_pointer_sdna(prop, nullptr, "id");
10705 RNA_def_property_struct_type(prop, "MovieClip");
10708 RNA_def_property_ui_text(prop, "Movie Clip", "");
10709 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
10710
10711 RNA_def_struct_sdna_from(srna, "NodePlaneTrackDeformData", "storage");
10712
10713 prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
10714 RNA_def_property_string_sdna(prop, nullptr, "tracking_object");
10715 RNA_def_property_ui_text(prop, "Tracking Object", "");
10716 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10717
10718 prop = RNA_def_property(srna, "plane_track_name", PROP_STRING, PROP_NONE);
10719 RNA_def_property_string_sdna(prop, nullptr, "plane_track_name");
10720 RNA_def_property_ui_text(prop, "Plane Track", "");
10721 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10722
10723 prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
10725 prop,
10726 "rna_node_property_to_input_getter<bool, node_input_motion_blur>",
10727 "rna_node_property_to_input_setter<bool, node_input_motion_blur>");
10729 prop,
10730 "Motion Blur",
10731 "Use multi-sampled motion blur of the mask. (Deprecated: Use Motion Blur input instead.)");
10732 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10733
10734 prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
10736 prop,
10737 "rna_node_property_to_input_getter<int, node_input_motion_blur_samples>",
10738 "rna_node_property_to_input_setter<int, node_input_motion_blur_samples>",
10739 nullptr);
10740 RNA_def_property_range(prop, 1, 64);
10742 prop,
10743 "Samples",
10744 "Number of motion blur samples. (Deprecated: Use Motion Blur Samples input instead.)");
10745 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10746
10747 prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
10749 prop,
10750 "rna_node_property_to_input_getter<float, node_input_motion_blur_shutter>",
10751 "rna_node_property_to_input_setter<float, node_input_motion_blur_shutter>",
10752 nullptr);
10753 RNA_def_property_range(prop, 0.0, 1.0f);
10755 "Shutter",
10756 "Exposure for motion blur as a factor of FPS. (Deprecated: Use Motion "
10757 "Blur Shutter input instead.)");
10758 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10759}
10760
10761static void def_cmp_sunbeams(BlenderRNA * /*brna*/, StructRNA *srna)
10762{
10763 PropertyRNA *prop;
10764
10765 prop = RNA_def_property(srna, "source", PROP_FLOAT, PROP_NONE);
10766 RNA_def_property_array(prop, 2);
10768 "rna_node_array_property_to_input_getter<float, node_input_source>",
10769 "rna_node_array_property_to_input_setter<float, node_input_source>",
10770 nullptr);
10771 RNA_def_property_range(prop, -100.0f, 100.0f);
10772 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
10774 "Source",
10775 "Source point of rays as a factor of the image width and height. "
10776 "(Deprecated: Use Source input instead.)");
10777 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10778
10779 prop = RNA_def_property(srna, "ray_length", PROP_FLOAT, PROP_UNSIGNED);
10781 "rna_node_property_to_input_getter<float, node_input_length>",
10782 "rna_node_property_to_input_setter<float, node_input_length>",
10783 nullptr);
10784 RNA_def_property_range(prop, 0.0f, 100.0f);
10785 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 3);
10787 prop,
10788 "Ray Length",
10789 "Length of rays as a factor of the image size. (Deprecated: Use Length input instead.)");
10790 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10791}
10792
10794{
10795 StructRNA *srna;
10796 PropertyRNA *prop;
10797
10798 srna = RNA_def_struct(brna, "CryptomatteEntry", nullptr);
10799 RNA_def_struct_sdna(srna, "CryptomatteEntry");
10800
10801 prop = RNA_def_property(srna, "encoded_hash", PROP_FLOAT, PROP_NONE);
10803 RNA_def_property_float_sdna(prop, nullptr, "encoded_hash");
10804
10805 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
10807 RNA_def_property_ui_text(prop, "Name", "");
10808 RNA_def_struct_name_property(srna, prop);
10809}
10810
10812{
10813 PropertyRNA *prop;
10814 static float default_1[3] = {1.0f, 1.0f, 1.0f};
10815
10816 prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE);
10818 "rna_NodeCryptomatte_matte_get",
10819 "rna_NodeCryptomatte_matte_length",
10820 "rna_NodeCryptomatte_matte_set");
10822 prop, "Matte Objects", "List of object and material crypto IDs to include in matte");
10823 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10824
10825 prop = RNA_def_property(srna, "add", PROP_FLOAT, PROP_COLOR);
10826 RNA_def_property_float_sdna(prop, nullptr, "runtime.add");
10827 RNA_def_property_float_array_default(prop, default_1);
10830 prop, "Add", "Add object or material to matte, by picking a color from the Pick output");
10832 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_add");
10833
10834 prop = RNA_def_property(srna, "remove", PROP_FLOAT, PROP_COLOR);
10835 RNA_def_property_float_sdna(prop, nullptr, "runtime.remove");
10836 RNA_def_property_float_array_default(prop, default_1);
10839 prop,
10840 "Remove",
10841 "Remove object or material from matte, by picking a color from the Pick output");
10843 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_remove");
10844}
10845
10847{
10848 RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
10849 def_cmp_cryptomatte_common(brna, srna);
10850}
10851
10853{
10854 PropertyRNA *prop;
10855
10856 static const EnumPropertyItem cryptomatte_source_items[] = {
10858 "RENDER",
10859 0,
10860 "Render",
10861 "Use Cryptomatte passes from a render"},
10863 "IMAGE",
10864 0,
10865 "Image",
10866 "Use Cryptomatte passes from an image"},
10867 {0, nullptr, 0, nullptr, nullptr}};
10868
10869 prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
10870 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
10871 RNA_def_property_enum_items(prop, cryptomatte_source_items);
10872 RNA_def_property_enum_funcs(prop, nullptr, "rna_NodeCryptomatte_source_set", nullptr);
10873 RNA_def_property_ui_text(prop, "Source", "Where the Cryptomatte passes are loaded from");
10874 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
10875
10876 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
10878 prop, "rna_NodeCryptomatte_scene_get", "rna_NodeCryptomatte_scene_set", nullptr, nullptr);
10879 RNA_def_property_struct_type(prop, "Scene");
10882 RNA_def_property_ui_text(prop, "Scene", "");
10883 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
10884
10885 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
10887 "rna_NodeCryptomatte_image_get",
10888 "rna_NodeCryptomatte_image_set",
10889 nullptr,
10890 "rna_NodeCryptomatte_image_poll");
10891 RNA_def_property_struct_type(prop, "Image");
10894 RNA_def_property_ui_text(prop, "Image", "");
10895 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
10896
10897 RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
10898 def_cmp_cryptomatte_common(brna, srna);
10899
10900 prop = RNA_def_property(srna, "layer_name", PROP_ENUM, PROP_NONE);
10903 "rna_NodeCryptomatte_layer_name_get",
10904 "rna_NodeCryptomatte_layer_name_set",
10905 "rna_NodeCryptomatte_layer_name_itemf");
10906 RNA_def_property_ui_text(prop, "Cryptomatte Layer", "What Cryptomatte layer is used");
10907 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10908
10909 prop = RNA_def_property(srna, "entries", PROP_COLLECTION, PROP_NONE);
10910 RNA_def_property_collection_sdna(prop, nullptr, "entries", nullptr);
10911 RNA_def_property_struct_type(prop, "CryptomatteEntry");
10912 RNA_def_property_ui_text(prop, "Mattes", "");
10914
10915 /* Included here instead of defining image_user as a property of the node,
10916 * see def_cmp_image for details.
10917 * As mentioned in DNA_node_types.h, iuser is the first member of the Cryptomatte
10918 * storage type, so we can cast node->storage to ImageUser.
10919 * That is required since we can't define the properties from storage->iuser directly... */
10920 RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
10921 def_node_image_user(brna, srna);
10922}
10923
10924static void def_cmp_denoise(BlenderRNA * /*brna*/, StructRNA *srna)
10925{
10926 PropertyRNA *prop;
10927
10928 static const EnumPropertyItem prefilter_items[] = {
10930 "NONE",
10931 0,
10932 "None",
10933 "No prefiltering, use when guiding passes are noise-free"},
10935 "FAST",
10936 0,
10937 "Fast",
10938 "Denoise image and guiding passes together. Improves quality when guiding passes are noisy "
10939 "using least amount of extra processing time."},
10941 "ACCURATE",
10942 0,
10943 "Accurate",
10944 "Prefilter noisy guiding passes before denoising image. Improves quality when guiding "
10945 "passes are noisy using extra processing time."},
10946 {0, nullptr, 0, nullptr, nullptr}};
10947
10948 static const EnumPropertyItem quality_items[] = {
10950 "FOLLOW_SCENE",
10951 0,
10952 "Follow Scene",
10953 "Use the scene's denoising quality setting"},
10954 {CMP_NODE_DENOISE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"},
10956 "BALANCED",
10957 0,
10958 "Balanced",
10959 "Balanced between performance and quality"},
10960 {CMP_NODE_DENOISE_QUALITY_FAST, "FAST", 0, "Fast", "High perfomance"},
10961 {0, nullptr, 0, nullptr, nullptr}};
10962
10963 RNA_def_struct_sdna_from(srna, "NodeDenoise", "storage");
10964
10965 prop = RNA_def_property(srna, "use_hdr", PROP_BOOLEAN, PROP_NONE);
10967 "rna_node_property_to_input_getter<bool, node_input_hdr>",
10968 "rna_node_property_to_input_setter<bool, node_input_hdr>");
10970 RNA_def_property_ui_text(prop, "HDR", "Process HDR images");
10971 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10972
10973 prop = RNA_def_property(srna, "prefilter", PROP_ENUM, PROP_NONE);
10974 RNA_def_property_enum_items(prop, prefilter_items);
10976 RNA_def_property_ui_text(prop, "", "Denoising prefilter");
10977 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10978
10979 prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
10980 RNA_def_property_enum_items(prop, quality_items);
10982 RNA_def_property_ui_text(prop, "", "Denoising quality");
10983 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10984}
10985
10986static void def_cmp_kuwahara(BlenderRNA * /*brna*/, StructRNA *srna)
10987{
10988 PropertyRNA *prop;
10989
10990 RNA_def_struct_sdna_from(srna, "NodeKuwaharaData", "storage");
10991
10992 static const EnumPropertyItem variation_items[] = {
10993 {0, "CLASSIC", 0, "Classic", "Fast but less accurate variation"},
10994 {1, "ANISOTROPIC", 0, "Anisotropic", "Accurate but slower variation"},
10995 {0, nullptr, 0, nullptr, nullptr},
10996 };
10997
10998 prop = RNA_def_property(srna, "variation", PROP_ENUM, PROP_NONE);
10999 RNA_def_property_enum_sdna(prop, nullptr, "variation");
11000 RNA_def_property_enum_items(prop, variation_items);
11001 RNA_def_property_ui_text(prop, "", "Variation of Kuwahara filter to use");
11002 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11003
11004 prop = RNA_def_property(srna, "use_high_precision", PROP_BOOLEAN, PROP_NONE);
11006 prop,
11007 "rna_node_property_to_input_getter<bool, node_input_high_precision>",
11008 "rna_node_property_to_input_setter<bool, node_input_high_precision>");
11010 "High Precision",
11011 "Uses a more precise but slower method. Use if the output contains "
11012 "undesirable noise. (Deprecated: Use High Precision input instead.)");
11013 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11014
11015 prop = RNA_def_property(srna, "uniformity", PROP_INT, PROP_NONE);
11017 "rna_node_property_to_input_getter<int, node_input_uniformity>",
11018 "rna_node_property_to_input_setter<int, node_input_uniformity>",
11019 nullptr);
11020 RNA_def_property_range(prop, 0.0, 50.0);
11021 RNA_def_property_ui_range(prop, 0, 50, 1, -1);
11023 prop,
11024 "Uniformity",
11025 "Controls the uniformity of the direction of the filter. Higher values "
11026 "produces more uniform directions. (Deprecated: Use Uniformity input instead.)");
11027 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11028
11029 prop = RNA_def_property(srna, "sharpness", PROP_FLOAT, PROP_FACTOR);
11031 "rna_node_property_to_input_getter<float, node_input_sharpness>",
11032 "rna_node_property_to_input_setter<float, node_input_sharpness>",
11033 nullptr);
11034 RNA_def_property_range(prop, 0.0f, 1.0f);
11035 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
11037 "Sharpness",
11038 "Controls the sharpness of the filter. 0 means completely smooth while "
11039 "1 means completely sharp. (Deprecated: Use Sharpness input instead.)");
11040 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11041
11042 prop = RNA_def_property(srna, "eccentricity", PROP_FLOAT, PROP_FACTOR);
11044 "rna_node_property_to_input_getter<float, node_input_eccentricity>",
11045 "rna_node_property_to_input_setter<float, node_input_eccentricity>",
11046 nullptr);
11047 RNA_def_property_range(prop, 0.0f, 2.0f);
11048 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.1, 3);
11050 prop,
11051 "Eccentricity",
11052 "Controls how directional the filter is. 0 means the filter is completely omnidirectional "
11053 "while 2 means it is maximally directed along the edges of the image. (Deprecated: Use "
11054 "Eccentricity input instead.)");
11055 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11056}
11057
11058static void def_cmp_antialiasing(BlenderRNA * /*brna*/, StructRNA *srna)
11059{
11060 PropertyRNA *prop;
11061
11062 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
11064 "rna_node_property_to_input_getter<float, node_input_threshold>",
11065 "rna_node_property_to_input_setter<float, node_input_threshold>",
11066 nullptr);
11067 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
11069 "Threshold",
11070 "Threshold to detect edges (smaller threshold makes more sensitive "
11071 "detection). (Deprecated: Use Threshold input instead.)");
11072 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11073
11074 prop = RNA_def_property(srna, "contrast_limit", PROP_FLOAT, PROP_FACTOR);
11076 "rna_NodeAntiAlias_contrast_limit_get",
11077 "rna_NodeAntiAlias_contrast_limit_set",
11078 nullptr);
11079 RNA_def_property_range(prop, 0.0f, 1.0f);
11080 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
11082 prop,
11083 "Contrast Limit",
11084 "How much to eliminate spurious edges to avoid artifacts (the larger value makes less "
11085 "active; the value 2.0, for example, means discard a detected edge if there is a "
11086 "neighboring edge that has 2.0 times bigger contrast than the current one). (Deprecated: "
11087 "Use Contrast Limit input instead.)");
11088 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11089
11090 prop = RNA_def_property(srna, "corner_rounding", PROP_FLOAT, PROP_FACTOR);
11092 prop,
11093 "rna_node_property_to_input_getter<float, node_input_corner_rounding>",
11094 "rna_node_property_to_input_setter<float, node_input_corner_rounding>",
11095 nullptr);
11096 RNA_def_property_range(prop, 0.0f, 1.0f);
11097 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
11099 prop,
11100 "Corner Rounding",
11101 "How much sharp corners will be rounded. (Deprecated: Use Corner Rounding input instead.)");
11102 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11103}
11104
11105/* -- Texture Nodes --------------------------------------------------------- */
11106
11107static void def_tex_output(BlenderRNA * /*brna*/, StructRNA *srna)
11108{
11109 PropertyRNA *prop;
11110
11111 RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage");
11112
11113 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
11114 RNA_def_property_string_sdna(prop, nullptr, "name");
11115 RNA_def_property_ui_text(prop, "Output Name", "");
11116 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11117}
11118
11119static void def_tex_image(BlenderRNA * /*brna*/, StructRNA *srna)
11120{
11121 PropertyRNA *prop;
11122
11123 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
11124 RNA_def_property_pointer_sdna(prop, nullptr, "id");
11125 RNA_def_property_struct_type(prop, "Image");
11128 RNA_def_property_ui_text(prop, "Image", "");
11129 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11130
11131 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
11132 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
11133 RNA_def_property_struct_type(prop, "ImageUser");
11135 prop, "Image User", "Parameters defining the image duration, offset and related settings");
11136 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11137}
11138
11139static void def_tex_bricks(BlenderRNA * /*brna*/, StructRNA *srna)
11140{
11141 PropertyRNA *prop;
11142
11143 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
11144 RNA_def_property_float_sdna(prop, nullptr, "custom3");
11145 RNA_def_property_range(prop, 0.0f, 1.0f);
11147 prop, "Offset Amount", "Determines the brick offset of the various rows");
11148 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11149
11150 prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
11151 RNA_def_property_int_sdna(prop, nullptr, "custom1");
11152 RNA_def_property_range(prop, 2, 99);
11153 RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
11154 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11155
11156 prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
11157 RNA_def_property_float_sdna(prop, nullptr, "custom4");
11158 RNA_def_property_range(prop, 0.0f, 99.0f);
11160 prop,
11161 "Squash Amount",
11162 "Factor to adjust the brick's width for particular rows determined by the Offset Frequency");
11163
11164 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11165
11166 prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
11167 RNA_def_property_int_sdna(prop, nullptr, "custom2");
11168 RNA_def_property_range(prop, 2, 99);
11169 RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
11170 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11171}
11172
11173/* -- Geometry Nodes --------------------------------------------------------- */
11174
11175static void def_geo_curve_sample(BlenderRNA * /*brna*/, StructRNA *srna)
11176{
11177 static EnumPropertyItem mode_items[] = {
11179 "FACTOR",
11180 0,
11181 "Factor",
11182 "Find sample positions on the curve using a factor of its total length"},
11184 "LENGTH",
11185 0,
11186 "Length",
11187 "Find sample positions on the curve using a distance from its beginning"},
11188 {0, nullptr, 0, nullptr, nullptr},
11189 };
11190
11191 RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSample", "storage");
11192
11193 PropertyRNA *prop;
11194 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
11195 RNA_def_property_enum_items(prop, mode_items);
11196 RNA_def_property_ui_text(prop, "Mode", "Method for sampling input");
11198 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
11199
11200 prop = RNA_def_property(srna, "use_all_curves", PROP_BOOLEAN, PROP_NONE);
11202 "All Curves",
11203 "Sample lengths based on the total length of all curves, rather than "
11204 "using a length inside each selected curve");
11206 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
11207
11208 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
11211 prop, nullptr, nullptr, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
11213 RNA_def_property_ui_text(prop, "Data Type", "");
11215 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
11216}
11217
11218static void def_fn_random_value(BlenderRNA * /*brna*/, StructRNA *srna)
11219{
11220 PropertyRNA *prop;
11221
11222 RNA_def_struct_sdna_from(srna, "NodeRandomValue", "storage");
11223
11224 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
11225 RNA_def_property_enum_sdna(prop, nullptr, "data_type");
11227 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_FunctionNodeRandomValue_type_itemf");
11229 RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
11230 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
11231}
11232
11234{
11235 PropertyRNA *prop;
11236
11237 static const EnumPropertyItem rna_node_geometry_distribute_points_on_faces_mode_items[] = {
11239 "RANDOM",
11240 0,
11241 "Random",
11242 "Distribute points randomly on the surface"},
11244 "POISSON",
11245 0,
11246 "Poisson Disk",
11247 "Distribute the points randomly on the surface while taking a minimum distance between "
11248 "points into account"},
11249 {0, nullptr, 0, nullptr, nullptr},
11250 };
11251
11252 prop = RNA_def_property(srna, "distribute_method", PROP_ENUM, PROP_NONE);
11253 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
11254 RNA_def_property_enum_items(prop, rna_node_geometry_distribute_points_on_faces_mode_items);
11256 RNA_def_property_ui_text(prop, "Distribution Method", "Method to use for scattering points");
11258 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
11259
11260 prop = RNA_def_property(srna, "use_legacy_normal", PROP_BOOLEAN, PROP_NONE);
11261 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", 1);
11263 "Legacy Normal",
11264 "Output the normal and rotation values that have been output "
11265 "before the node started taking smooth normals into account");
11267 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
11268}
11269
11271{
11272 PropertyRNA *prop;
11273
11274 RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSetHandles", "storage");
11275
11276 prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
11277 RNA_def_property_enum_sdna(prop, nullptr, "handle_type");
11278 RNA_def_property_ui_text(prop, "Handle Type", "");
11281 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
11282
11283 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
11285 RNA_def_property_ui_text(prop, "Mode", "Whether to update left and right handles");
11288 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
11289}
11290
11291static void def_common_zone_input(BlenderRNA * /*brna*/, StructRNA *srna)
11292{
11293 PropertyRNA *prop;
11294 FunctionRNA *func;
11295 PropertyRNA *parm;
11296
11297 prop = RNA_def_property(srna, "paired_output", PROP_POINTER, PROP_NONE);
11298 RNA_def_property_struct_type(prop, "Node");
11300 RNA_def_property_pointer_funcs(prop, "rna_Node_paired_output_get", nullptr, nullptr, nullptr);
11302 prop, "Paired Output", "Zone output node that this input node is paired with");
11303
11304 func = RNA_def_function(srna, "pair_with_output", "rna_Node_pair_with_output");
11305 RNA_def_function_ui_description(func, "Pair a zone input node with an output node.");
11307 parm = RNA_def_pointer(
11308 func, "output_node", "GeometryNode", "Output Node", "Zone output node to pair with");
11310 /* return value */
11311 parm = RNA_def_boolean(
11312 func, "result", false, "Result", "True if pairing the node was successful");
11313 RNA_def_function_return(func, parm);
11314}
11315
11317{
11318 RNA_def_struct_sdna_from(srna, "NodeGeometrySimulationInput", "storage");
11319
11320 def_common_zone_input(brna, srna);
11321}
11322
11324{
11325 RNA_def_struct_sdna_from(srna, "NodeGeometryRepeatInput", "storage");
11326
11327 def_common_zone_input(brna, srna);
11328}
11329
11331{
11332 RNA_def_struct_sdna_from(srna, "NodeGeometryForeachGeometryElementInput", "storage");
11333
11334 def_common_zone_input(brna, srna);
11335}
11336
11338{
11339 RNA_def_struct_sdna_from(srna, "NodeGeometryClosureInput", "storage");
11340
11341 def_common_zone_input(brna, srna);
11342}
11343
11345 const char *accessor,
11346 const bool add_socket_type)
11347{
11348 static blender::LinearAllocator<> allocator;
11349 PropertyRNA *prop;
11350
11351 char name_set_func[128];
11352 SNPRINTF(name_set_func, "rna_Node_ItemArray_item_name_set<%s>", accessor);
11353
11354 char item_update_func[128];
11355 SNPRINTF(item_update_func, "rna_Node_ItemArray_item_update<%s>", accessor);
11356 const char *item_update_func_ptr = allocator.copy_string(item_update_func).c_str();
11357
11358 char socket_type_itemf[128];
11359 SNPRINTF(socket_type_itemf, "rna_Node_ItemArray_socket_type_itemf<%s>", accessor);
11360
11361 char color_get_func[128];
11362 SNPRINTF(color_get_func, "rna_Node_ItemArray_item_color_get<%s>", accessor);
11363
11364 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
11366 prop, nullptr, nullptr, allocator.copy_string(name_set_func).c_str());
11367 RNA_def_property_ui_text(prop, "Name", "");
11368 RNA_def_struct_name_property(srna, prop);
11369 RNA_def_property_update(prop, NC_NODE | NA_EDITED, item_update_func_ptr);
11370
11371 if (add_socket_type) {
11372 prop = RNA_def_property(srna, "socket_type", PROP_ENUM, PROP_NONE);
11375 prop, nullptr, nullptr, allocator.copy_string(socket_type_itemf).c_str());
11376 RNA_def_property_ui_text(prop, "Socket Type", "");
11378 RNA_def_property_update(prop, NC_NODE | NA_EDITED, item_update_func_ptr);
11379 }
11380
11381 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
11382 RNA_def_property_array(prop, 4);
11384 prop, allocator.copy_string(color_get_func).c_str(), nullptr, nullptr);
11387 prop, "Color", "Color of the corresponding socket type in the node editor");
11388}
11389
11391 const char *item_name,
11392 const char *accessor_name)
11393{
11394 static blender::LinearAllocator<> allocator;
11395 PropertyRNA *parm;
11396 FunctionRNA *func;
11397
11398 char remove_call[128];
11399 SNPRINTF(remove_call, "rna_Node_ItemArray_remove<%s>", accessor_name);
11400 char clear_call[128];
11401 SNPRINTF(clear_call, "rna_Node_ItemArray_clear<%s>", accessor_name);
11402 char move_call[128];
11403 SNPRINTF(move_call, "rna_Node_ItemArray_move<%s>", accessor_name);
11404
11405 func = RNA_def_function(srna, "remove", allocator.copy_string(remove_call).c_str());
11406 RNA_def_function_ui_description(func, "Remove an item");
11408 parm = RNA_def_pointer(func, "item", item_name, "Item", "The item to remove");
11410
11411 func = RNA_def_function(srna, "clear", allocator.copy_string(clear_call).c_str());
11412 RNA_def_function_ui_description(func, "Remove all items");
11414
11415 func = RNA_def_function(srna, "move", allocator.copy_string(move_call).c_str());
11416 RNA_def_function_ui_description(func, "Move an item to another position");
11418 parm = RNA_def_int(
11419 func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the item to move", 0, 10000);
11421 parm = RNA_def_int(
11422 func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the item", 0, 10000);
11424}
11425
11427 const char *item_name,
11428 const char *accessor_name)
11429{
11430 static blender::LinearAllocator<> allocator;
11431 PropertyRNA *parm;
11432 FunctionRNA *func;
11433
11434 char name[128];
11435 SNPRINTF(name, "rna_Node_ItemArray_new_with_socket_and_name<%s>", accessor_name);
11436
11437 func = RNA_def_function(srna, "new", allocator.copy_string(name).c_str());
11438 RNA_def_function_ui_description(func, "Add an item at the end");
11440 parm = RNA_def_enum(func,
11441 "socket_type",
11444 "Socket Type",
11445 "Socket type of the item");
11447 parm = RNA_def_string(func, "name", nullptr, MAX_NAME, "Name", "");
11449 /* return value */
11450 parm = RNA_def_pointer(func, "item", item_name, "Item", "New item");
11451 RNA_def_function_return(func, parm);
11452}
11453
11455{
11456 PropertyRNA *prop;
11457
11458 StructRNA *srna = RNA_def_struct(brna, "SimulationStateItem", nullptr);
11459 RNA_def_struct_ui_text(srna, "Simulation Item", "");
11460 RNA_def_struct_sdna(srna, "NodeSimulationItem");
11461
11462 rna_def_node_item_array_socket_item_common(srna, "SimulationItemsAccessor", true);
11463
11464 prop = RNA_def_property(srna, "attribute_domain", PROP_ENUM, PROP_NONE);
11467 prop, nullptr, nullptr, "rna_GeometryNodeAttributeDomain_attribute_domain_itemf");
11469 prop,
11470 "Attribute Domain",
11471 "Attribute domain where the attribute is stored in the simulation state");
11474 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<SimulationItemsAccessor>");
11475}
11476
11478{
11479 StructRNA *srna;
11480
11481 srna = RNA_def_struct(brna, "NodeGeometrySimulationOutputItems", nullptr);
11482 RNA_def_struct_sdna(srna, "bNode");
11483 RNA_def_struct_ui_text(srna, "Items", "Collection of simulation items");
11484
11486 srna, "SimulationStateItem", "SimulationItemsAccessor");
11487 rna_def_node_item_array_common_functions(srna, "SimulationStateItem", "SimulationItemsAccessor");
11488}
11489
11491{
11492 PropertyRNA *prop;
11493
11496
11497 RNA_def_struct_sdna_from(srna, "NodeGeometrySimulationOutput", "storage");
11498
11499 prop = RNA_def_property(srna, "state_items", PROP_COLLECTION, PROP_NONE);
11500 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
11501 RNA_def_property_struct_type(prop, "SimulationStateItem");
11502 RNA_def_property_ui_text(prop, "Items", "");
11503 RNA_def_property_srna(prop, "NodeGeometrySimulationOutputItems");
11504
11505 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
11506 RNA_def_property_int_sdna(prop, nullptr, "active_index");
11507 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11510 RNA_def_property_update(prop, NC_NODE, nullptr);
11511
11512 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
11513 RNA_def_property_struct_type(prop, "SimulationStateItem");
11515 "rna_Node_ItemArray_active_get<SimulationItemsAccessor>",
11516 "rna_Node_ItemArray_active_set<SimulationItemsAccessor>",
11517 nullptr,
11518 nullptr);
11520 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11521 RNA_def_property_update(prop, NC_NODE, nullptr);
11522}
11523
11525{
11526 StructRNA *srna = RNA_def_struct(brna, "RepeatItem", nullptr);
11527 RNA_def_struct_ui_text(srna, "Repeat Item", "");
11528 RNA_def_struct_sdna(srna, "NodeRepeatItem");
11529
11530 rna_def_node_item_array_socket_item_common(srna, "RepeatItemsAccessor", true);
11531}
11532
11534{
11535 StructRNA *srna;
11536
11537 srna = RNA_def_struct(brna, "NodeGeometryRepeatOutputItems", nullptr);
11538 RNA_def_struct_sdna(srna, "bNode");
11539 RNA_def_struct_ui_text(srna, "Items", "Collection of repeat items");
11540
11541 rna_def_node_item_array_new_with_socket_and_name(srna, "RepeatItem", "RepeatItemsAccessor");
11542 rna_def_node_item_array_common_functions(srna, "RepeatItem", "RepeatItemsAccessor");
11543}
11544
11546{
11547 PropertyRNA *prop;
11548
11551
11552 RNA_def_struct_sdna_from(srna, "NodeGeometryRepeatOutput", "storage");
11553
11554 prop = RNA_def_property(srna, "repeat_items", PROP_COLLECTION, PROP_NONE);
11555 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
11556 RNA_def_property_struct_type(prop, "RepeatItem");
11557 RNA_def_property_ui_text(prop, "Items", "");
11558 RNA_def_property_srna(prop, "NodeGeometryRepeatOutputItems");
11559
11560 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
11561 RNA_def_property_int_sdna(prop, nullptr, "active_index");
11562 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11565 RNA_def_property_update(prop, NC_NODE, nullptr);
11566
11567 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
11568 RNA_def_property_struct_type(prop, "RepeatItem");
11570 "rna_Node_ItemArray_active_get<RepeatItemsAccessor>",
11571 "rna_Node_ItemArray_active_set<RepeatItemsAccessor>",
11572 nullptr,
11573 nullptr);
11575 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11576 RNA_def_property_update(prop, NC_NODE, nullptr);
11577
11578 prop = RNA_def_property(srna, "inspection_index", PROP_INT, PROP_NONE);
11579 RNA_def_property_ui_range(prop, 0, INT32_MAX, 1, -1);
11581 "Inspection Index",
11582 "Iteration index that is used by inspection features like the viewer "
11583 "node or socket inspection");
11584 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
11585}
11586
11588{
11589 StructRNA *srna = RNA_def_struct(brna, "ForeachGeometryElementInputItem", nullptr);
11590 RNA_def_struct_ui_text(srna, "For Each Geometry Element Item", "");
11591 RNA_def_struct_sdna(srna, "NodeForeachGeometryElementInputItem");
11592
11594 srna, "ForeachGeometryElementInputItemsAccessor", true);
11595}
11596
11598{
11599 StructRNA *srna;
11600
11601 srna = RNA_def_struct(brna, "NodeGeometryForeachGeometryElementInputItems", nullptr);
11602 RNA_def_struct_sdna(srna, "bNode");
11603 RNA_def_struct_ui_text(srna, "Input Items", "Collection of input items");
11604
11606 srna, "ForeachGeometryElementInputItem", "ForeachGeometryElementInputItemsAccessor");
11608 srna, "ForeachGeometryElementInputItem", "ForeachGeometryElementInputItemsAccessor");
11609}
11610
11612{
11613 StructRNA *srna;
11614
11615 srna = RNA_def_struct(brna, "ForeachGeometryElementMainItem", nullptr);
11616 RNA_def_struct_ui_text(srna, "For Each Geometry Element Item", "");
11617 RNA_def_struct_sdna(srna, "NodeForeachGeometryElementMainItem");
11618
11620 srna, "ForeachGeometryElementMainItemsAccessor", true);
11621}
11622
11624{
11625 StructRNA *srna;
11626
11627 srna = RNA_def_struct(brna, "NodeGeometryForeachGeometryElementMainItems", nullptr);
11628 RNA_def_struct_sdna(srna, "bNode");
11629 RNA_def_struct_ui_text(srna, "Main Items", "Collection of main items");
11630
11632 srna, "ForeachGeometryElementMainItem", "ForeachGeometryElementMainItemsAccessor");
11634 srna, "ForeachGeometryElementMainItem", "ForeachGeometryElementMainItemsAccessor");
11635}
11636
11638{
11639 StructRNA *srna;
11640 PropertyRNA *prop;
11641
11642 srna = RNA_def_struct(brna, "ForeachGeometryElementGenerationItem", nullptr);
11643 RNA_def_struct_ui_text(srna, "For Each Geometry Element Item", "");
11644 RNA_def_struct_sdna(srna, "NodeForeachGeometryElementGenerationItem");
11645
11647 srna, "ForeachGeometryElementGenerationItemsAccessor", true);
11648
11649 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
11650 RNA_def_property_ui_text(prop, "Domain", "Domain that the field is evaluated on");
11653 prop,
11655 "rna_Node_ItemArray_item_update<ForeachGeometryElementGenerationItemsAccessor>");
11656}
11657
11659{
11660 StructRNA *srna;
11661
11662 srna = RNA_def_struct(brna, "NodeGeometryForeachGeometryElementGenerationItems", nullptr);
11663 RNA_def_struct_sdna(srna, "bNode");
11664 RNA_def_struct_ui_text(srna, "Generation Items", "Collection of generation items");
11665
11667 srna,
11668 "ForeachGeometryElementGenerationItem",
11669 "ForeachGeometryElementGenerationItemsAccessor");
11671 "ForeachGeometryElementGenerationItem",
11672 "ForeachGeometryElementGenerationItemsAccessor");
11673}
11674
11676{
11677 PropertyRNA *prop;
11678
11681
11684
11687
11688 RNA_def_struct_sdna_from(srna, "NodeGeometryForeachGeometryElementOutput", "storage");
11689
11690 prop = RNA_def_property(srna, "input_items", PROP_COLLECTION, PROP_NONE);
11691 RNA_def_property_collection_sdna(prop, nullptr, "input_items.items", "input_items.items_num");
11692 RNA_def_property_struct_type(prop, "ForeachGeometryElementInputItem");
11693 RNA_def_property_srna(prop, "NodeGeometryForeachGeometryElementInputItems");
11694
11695 prop = RNA_def_property(srna, "main_items", PROP_COLLECTION, PROP_NONE);
11696 RNA_def_property_collection_sdna(prop, nullptr, "main_items.items", "main_items.items_num");
11697 RNA_def_property_struct_type(prop, "ForeachGeometryElementMainItem");
11698 RNA_def_property_srna(prop, "NodeGeometryForeachGeometryElementMainItems");
11699
11700 prop = RNA_def_property(srna, "generation_items", PROP_COLLECTION, PROP_NONE);
11702 prop, nullptr, "generation_items.items", "generation_items.items_num");
11703 RNA_def_property_struct_type(prop, "ForeachGeometryElementGenerationItem");
11704 RNA_def_property_srna(prop, "NodeGeometryForeachGeometryElementGenerationItems");
11705
11706 prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_UNSIGNED);
11707 RNA_def_property_int_sdna(prop, nullptr, "input_items.active_index");
11708 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11711 RNA_def_property_update(prop, NC_NODE, nullptr);
11712
11713 prop = RNA_def_property(srna, "active_generation_index", PROP_INT, PROP_UNSIGNED);
11714 RNA_def_property_int_sdna(prop, nullptr, "generation_items.active_index");
11715 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11718 RNA_def_property_update(prop, NC_NODE, nullptr);
11719
11720 prop = RNA_def_property(srna, "active_main_index", PROP_INT, PROP_UNSIGNED);
11721 RNA_def_property_int_sdna(prop, nullptr, "main_items.active_index");
11722 RNA_def_property_ui_text(prop, "Active Main Item Index", "Index of the active item");
11725 RNA_def_property_update(prop, NC_NODE, nullptr);
11726
11727 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
11728 RNA_def_property_ui_text(prop, "Domain", "Geometry domain that is iterated over");
11730 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
11731
11732 prop = RNA_def_property(srna, "inspection_index", PROP_INT, PROP_NONE);
11733 RNA_def_property_ui_range(prop, 0, INT32_MAX, 1, -1);
11735 "Inspection Index",
11736 "Iteration index that is used by inspection features like the viewer "
11737 "node or socket inspection");
11738 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
11739}
11740
11742{
11743 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryClosureInputItem", nullptr);
11744 RNA_def_struct_ui_text(srna, "Closure Input Item", "");
11745 RNA_def_struct_sdna(srna, "NodeGeometryClosureInputItem");
11746
11747 rna_def_node_item_array_socket_item_common(srna, "ClosureInputItemsAccessor", true);
11748}
11749
11751{
11752 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryClosureInputItems", nullptr);
11753 RNA_def_struct_ui_text(srna, "Closure Input Items", "");
11754 RNA_def_struct_sdna(srna, "bNode");
11755
11757 srna, "NodeGeometryClosureInputItem", "ClosureInputItemsAccessor");
11759 srna, "NodeGeometryClosureInputItem", "ClosureInputItemsAccessor");
11760}
11761
11763{
11764 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryClosureOutputItem", nullptr);
11765 RNA_def_struct_ui_text(srna, "Closure Output Item", "");
11766 RNA_def_struct_sdna(srna, "NodeGeometryClosureOutputItem");
11767
11768 rna_def_node_item_array_socket_item_common(srna, "ClosureOutputItemsAccessor", true);
11769}
11770
11772{
11773 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryClosureOutputItems", nullptr);
11774 RNA_def_struct_ui_text(srna, "Closure Output Items", "");
11775 RNA_def_struct_sdna(srna, "bNode");
11776
11778 srna, "NodeGeometryClosureOutputItem", "ClosureOutputItemsAccessor");
11780 srna, "NodeGeometryClosureOutputItem", "ClosureOutputItemsAccessor");
11781}
11782
11784{
11785 PropertyRNA *prop;
11786
11789
11792
11793 RNA_def_struct_sdna_from(srna, "NodeGeometryClosureOutput", "storage");
11794
11795 prop = RNA_def_property(srna, "input_items", PROP_COLLECTION, PROP_NONE);
11796 RNA_def_property_collection_sdna(prop, nullptr, "input_items.items", "input_items.items_num");
11797 RNA_def_property_struct_type(prop, "NodeGeometryClosureInputItem");
11798 RNA_def_property_srna(prop, "NodeGeometryClosureInputItems");
11799
11800 prop = RNA_def_property(srna, "output_items", PROP_COLLECTION, PROP_NONE);
11801 RNA_def_property_collection_sdna(prop, nullptr, "output_items.items", "output_items.items_num");
11802 RNA_def_property_struct_type(prop, "NodeGeometryClosureOutputItem");
11803 RNA_def_property_srna(prop, "NodeGeometryClosureOutputItems");
11804
11805 prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_UNSIGNED);
11806 RNA_def_property_int_sdna(prop, nullptr, "input_items.active_index");
11807 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11810 RNA_def_property_update(prop, NC_NODE, nullptr);
11811
11812 prop = RNA_def_property(srna, "active_output_index", PROP_INT, PROP_UNSIGNED);
11813 RNA_def_property_int_sdna(prop, nullptr, "output_items.active_index");
11814 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11817 RNA_def_property_update(prop, NC_NODE, nullptr);
11818}
11819
11821{
11822 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryCaptureAttributeItem", nullptr);
11823 RNA_def_struct_ui_text(srna, "Capture Attribute Item", "");
11824 RNA_def_struct_sdna(srna, "NodeGeometryAttributeCaptureItem");
11825
11826 rna_def_node_item_array_socket_item_common(srna, "CaptureAttributeItemsAccessor", false);
11827 PropertyRNA *prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
11830 prop, nullptr, nullptr, "rna_NodeGeometryCaptureAttributeItem_data_type_itemf");
11831 RNA_def_property_ui_text(prop, "Data Type", "");
11834 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<CaptureAttributeItemsAccessor>");
11835}
11836
11838{
11839 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryCaptureAttributeItems", nullptr);
11840 RNA_def_struct_ui_text(srna, "Items", "Collection of capture attribute items");
11841 RNA_def_struct_sdna(srna, "bNode");
11842
11844 srna, "NodeGeometryCaptureAttributeItem", "CaptureAttributeItemsAccessor");
11846 srna, "NodeGeometryCaptureAttributeItem", "CaptureAttributeItemsAccessor");
11847}
11848
11850{
11851 PropertyRNA *prop;
11852
11855
11856 RNA_def_struct_sdna_from(srna, "NodeGeometryAttributeCapture", "storage");
11857
11858 prop = RNA_def_property(srna, "capture_items", PROP_COLLECTION, PROP_NONE);
11859 RNA_def_property_collection_sdna(prop, nullptr, "capture_items", "capture_items_num");
11860 RNA_def_property_struct_type(prop, "NodeGeometryCaptureAttributeItem");
11861 RNA_def_property_ui_text(prop, "Items", "");
11862 RNA_def_property_srna(prop, "NodeGeometryCaptureAttributeItems");
11863
11864 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
11865 RNA_def_property_int_sdna(prop, nullptr, "active_index");
11866 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11869 RNA_def_property_update(prop, NC_NODE, nullptr);
11870
11871 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
11872 RNA_def_property_struct_type(prop, "RepeatItem");
11874 "rna_Node_ItemArray_active_get<CaptureAttributeItemsAccessor>",
11875 "rna_Node_ItemArray_active_set<CaptureAttributeItemsAccessor>",
11876 nullptr,
11877 nullptr);
11879 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11880 RNA_def_property_update(prop, NC_NODE, nullptr);
11881
11882 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
11883 RNA_def_property_ui_text(prop, "Domain", "Which domain to store the data in");
11886 prop, nullptr, nullptr, "rna_GeometryNodeAttributeDomain_attribute_domain_itemf");
11887 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
11888}
11889
11891{
11892 StructRNA *srna;
11893
11894 srna = RNA_def_struct(brna, "NodeGeometryEvaluateClosureInputItem", nullptr);
11895 RNA_def_struct_ui_text(srna, "Input Item", "");
11896
11897 rna_def_node_item_array_socket_item_common(srna, "EvaluateClosureInputItemsAccessor", true);
11898}
11899
11901{
11902 StructRNA *srna;
11903
11904 srna = RNA_def_struct(brna, "NodeGeometryEvaluateClosureInputItems", nullptr);
11905 RNA_def_struct_ui_text(srna, "Input Items", "");
11906 RNA_def_struct_sdna(srna, "bNode");
11907
11909 srna, "NodeGeometryEvaluateClosureInputItem", "EvaluateClosureInputItemsAccessor");
11911 srna, "NodeGeometryEvaluateClosureInputItem", "EvaluateClosureInputItemsAccessor");
11912}
11913
11915{
11916 StructRNA *srna;
11917
11918 srna = RNA_def_struct(brna, "NodeGeometryEvaluateClosureOutputItem", nullptr);
11919 RNA_def_struct_ui_text(srna, "Output Item", "");
11920
11921 rna_def_node_item_array_socket_item_common(srna, "EvaluateClosureOutputItemsAccessor", true);
11922}
11923
11925{
11926 StructRNA *srna;
11927
11928 srna = RNA_def_struct(brna, "NodeGeometryEvaluateClosureOutputItems", nullptr);
11929 RNA_def_struct_ui_text(srna, "Output Items", "");
11930 RNA_def_struct_sdna(srna, "bNode");
11931
11933 srna, "NodeGeometryEvaluateClosureOutputItem", "EvaluateClosureOutputItemsAccessor");
11935 srna, "NodeGeometryEvaluateClosureOutputItem", "EvaluateClosureOutputItemsAccessor");
11936}
11937
11939{
11940 PropertyRNA *prop;
11941
11944
11947
11948 RNA_def_struct_sdna_from(srna, "NodeGeometryEvaluateClosure", "storage");
11949
11950 prop = RNA_def_property(srna, "input_items", PROP_COLLECTION, PROP_NONE);
11951 RNA_def_property_collection_sdna(prop, nullptr, "input_items.items", "input_items.items_num");
11952 RNA_def_property_struct_type(prop, "NodeGeometryEvaluateClosureInputItem");
11953 RNA_def_property_ui_text(prop, "Input Items", "");
11954 RNA_def_property_srna(prop, "NodeGeometryEvaluateClosureInputItems");
11955
11956 prop = RNA_def_property(srna, "output_items", PROP_COLLECTION, PROP_NONE);
11957 RNA_def_property_collection_sdna(prop, nullptr, "output_items.items", "output_items.items_num");
11958 RNA_def_property_struct_type(prop, "NodeGeometryEvaluateClosureOutputItem");
11959 RNA_def_property_ui_text(prop, "Output Items", "");
11960 RNA_def_property_srna(prop, "NodeGeometryEvaluateClosureOutputItems");
11961
11962 prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_UNSIGNED);
11963 RNA_def_property_int_sdna(prop, nullptr, "input_items.active_index");
11964 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11967 RNA_def_property_update(prop, NC_NODE, nullptr);
11968
11969 prop = RNA_def_property(srna, "active_output_index", PROP_INT, PROP_UNSIGNED);
11970 RNA_def_property_int_sdna(prop, nullptr, "output_items.active_index");
11971 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
11974 RNA_def_property_update(prop, NC_NODE, nullptr);
11975}
11976
11978{
11979 PropertyRNA *prop;
11980
11981 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryBakeItem", nullptr);
11982 RNA_def_struct_ui_text(srna, "Bake Item", "");
11983
11984 rna_def_node_item_array_socket_item_common(srna, "BakeItemsAccessor", true);
11985
11986 prop = RNA_def_property(srna, "attribute_domain", PROP_ENUM, PROP_NONE);
11989 prop, nullptr, nullptr, "rna_GeometryNodeAttributeDomain_attribute_domain_itemf");
11991 "Attribute Domain",
11992 "Attribute domain where the attribute is stored in the baked data");
11995 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<BakeItemsAccessor>");
11996
11997 prop = RNA_def_property(srna, "is_attribute", PROP_BOOLEAN, PROP_NONE);
11999 RNA_def_property_ui_text(prop, "Is Attribute", "Bake item is an attribute stored on a geometry");
12001 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<BakeItemsAccessor>");
12002}
12003
12005{
12006 StructRNA *srna;
12007
12008 srna = RNA_def_struct(brna, "NodeGeometryBakeItems", nullptr);
12009 RNA_def_struct_sdna(srna, "bNode");
12010 RNA_def_struct_ui_text(srna, "Items", "Collection of bake items");
12011
12013 srna, "NodeGeometryBakeItem", "BakeItemsAccessor");
12014 rna_def_node_item_array_common_functions(srna, "NodeGeometryBakeItem", "BakeItemsAccessor");
12015}
12016
12017static void rna_def_geo_bake(BlenderRNA *brna, StructRNA *srna)
12018{
12019 PropertyRNA *prop;
12020
12023
12024 RNA_def_struct_sdna_from(srna, "NodeGeometryBake", "storage");
12025
12026 prop = RNA_def_property(srna, "bake_items", PROP_COLLECTION, PROP_NONE);
12027 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
12028 RNA_def_property_struct_type(prop, "NodeGeometryBakeItem");
12029 RNA_def_property_ui_text(prop, "Items", "");
12030 RNA_def_property_srna(prop, "NodeGeometryBakeItems");
12031
12032 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
12033 RNA_def_property_int_sdna(prop, nullptr, "active_index");
12034 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
12037 RNA_def_property_update(prop, NC_NODE, nullptr);
12038
12039 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
12040 RNA_def_property_struct_type(prop, "RepeatItem");
12042 "rna_Node_ItemArray_active_get<BakeItemsAccessor>",
12043 "rna_Node_ItemArray_active_set<BakeItemsAccessor>",
12044 nullptr,
12045 nullptr);
12048 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
12049 RNA_def_property_update(prop, NC_NODE, nullptr);
12050}
12051
12053{
12054 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryCombineBundleItem", nullptr);
12055 RNA_def_struct_ui_text(srna, "Combine Bundle Item", "");
12056
12057 rna_def_node_item_array_socket_item_common(srna, "CombineBundleItemsAccessor", true);
12058}
12059
12061{
12062 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryCombineBundleItems", nullptr);
12063 RNA_def_struct_sdna(srna, "bNode");
12064 RNA_def_struct_ui_text(srna, "Items", "Collection of combine bundle items");
12065
12067 srna, "NodeGeometryCombineBundleItem", "CombineBundleItemsAccessor");
12069 srna, "NodeGeometryCombineBundleItem", "CombineBundleItemsAccessor");
12070}
12071
12073{
12074 PropertyRNA *prop;
12075
12078
12079 RNA_def_struct_sdna_from(srna, "NodeGeometryCombineBundle", "storage");
12080
12081 prop = RNA_def_property(srna, "bundle_items", PROP_COLLECTION, PROP_NONE);
12082 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
12083 RNA_def_property_struct_type(prop, "NodeGeometryCombineBundleItem");
12084 RNA_def_property_ui_text(prop, "Items", "");
12085 RNA_def_property_srna(prop, "NodeGeometryCombineBundleItems");
12086
12087 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
12088 RNA_def_property_int_sdna(prop, nullptr, "active_index");
12089 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
12092 RNA_def_property_update(prop, NC_NODE, nullptr);
12093}
12094
12096{
12097 StructRNA *srna = RNA_def_struct(brna, "NodeGeometrySeparateBundleItem", nullptr);
12098 RNA_def_struct_ui_text(srna, "Separate Bundle Item", "");
12099
12100 rna_def_node_item_array_socket_item_common(srna, "SeparateBundleItemsAccessor", true);
12101}
12102
12104{
12105 StructRNA *srna = RNA_def_struct(brna, "NodeGeometrySeparateBundleItems", nullptr);
12106 RNA_def_struct_sdna(srna, "bNode");
12107 RNA_def_struct_ui_text(srna, "Items", "Collection of separate bundle items");
12108
12110 srna, "NodeGeometrySeparateBundleItem", "SeparateBundleItemsAccessor");
12112 srna, "NodeGeometrySeparateBundleItem", "SeparateBundleItemsAccessor");
12113}
12114
12116{
12117 PropertyRNA *prop;
12118
12121
12122 RNA_def_struct_sdna_from(srna, "NodeGeometrySeparateBundle", "storage");
12123
12124 prop = RNA_def_property(srna, "bundle_items", PROP_COLLECTION, PROP_NONE);
12125 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
12126 RNA_def_property_struct_type(prop, "NodeGeometrySeparateBundleItem");
12127 RNA_def_property_ui_text(prop, "Items", "");
12128 RNA_def_property_srna(prop, "NodeGeometrySeparateBundleItems");
12129
12130 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
12131 RNA_def_property_int_sdna(prop, nullptr, "active_index");
12132 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
12135 RNA_def_property_update(prop, NC_NODE, nullptr);
12136}
12137
12139{
12140 PropertyRNA *prop;
12141
12142 StructRNA *srna = RNA_def_struct(brna, "IndexSwitchItem", nullptr);
12143 RNA_def_struct_ui_text(srna, "Index Switch Item", "");
12144 RNA_def_struct_sdna(srna, "IndexSwitchItem");
12145
12146 prop = RNA_def_property(srna, "identifier", PROP_INT, PROP_NONE);
12147 RNA_def_property_ui_range(prop, 0, INT32_MAX, 1, -1);
12148 RNA_def_property_ui_text(prop, "Identifier", "Consistent identifier used for the item");
12150 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
12151}
12152
12154{
12155 StructRNA *srna;
12156 FunctionRNA *func;
12157 PropertyRNA *parm;
12158
12159 srna = RNA_def_struct(brna, "NodeIndexSwitchItems", nullptr);
12160 RNA_def_struct_sdna(srna, "bNode");
12161 RNA_def_struct_ui_text(srna, "Items", "Collection of index_switch items");
12162
12163 func = RNA_def_function(srna, "new", "rna_NodeIndexSwitchItems_new");
12164 RNA_def_function_ui_description(func, "Add an item at the end");
12166 /* Return value. */
12167 parm = RNA_def_pointer(func, "item", "IndexSwitchItem", "Item", "New item");
12168 RNA_def_function_return(func, parm);
12169
12170 rna_def_node_item_array_common_functions(srna, "IndexSwitchItem", "IndexSwitchItemsAccessor");
12171}
12172
12174{
12175 PropertyRNA *prop;
12176
12179
12180 RNA_def_struct_sdna_from(srna, "NodeIndexSwitch", "storage");
12181
12182 prop = RNA_def_property(srna, "index_switch_items", PROP_COLLECTION, PROP_NONE);
12183 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
12184 RNA_def_property_struct_type(prop, "IndexSwitchItem");
12185 RNA_def_property_ui_text(prop, "Items", "");
12186 RNA_def_property_srna(prop, "NodeIndexSwitchItems");
12187}
12188
12190{
12191 StructRNA *srna;
12192
12193 srna = RNA_def_struct(brna, "NodeFunctionFormatStringItem", nullptr);
12194 RNA_def_struct_ui_text(srna, "Format String Item", "");
12195
12196 rna_def_node_item_array_socket_item_common(srna, "FormatStringItemsAccessor", true);
12197}
12198
12200{
12201 StructRNA *srna;
12202
12203 srna = RNA_def_struct(brna, "NodeFunctionFormatStringItems", nullptr);
12204 RNA_def_struct_sdna(srna, "bNode");
12205 RNA_def_struct_ui_text(srna, "Items", "Collection of format string items");
12206
12208 srna, "NodeFunctionFormatStringItem", "FormatStringItemsAccessor");
12210 srna, "NodeFunctionFormatStringItem", "FormatStringItemsAccessor");
12211}
12212
12214{
12215 PropertyRNA *prop;
12216
12219
12220 RNA_def_struct_sdna_from(srna, "NodeFunctionFormatString", "storage");
12221
12222 prop = RNA_def_property(srna, "format_items", PROP_COLLECTION, PROP_NONE);
12223 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
12224 RNA_def_property_struct_type(prop, "NodeFunctionFormatStringItem");
12225 RNA_def_property_ui_text(prop, "Items", "");
12226 RNA_def_property_srna(prop, "NodeFunctionFormatStringItems");
12227
12228 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
12229 RNA_def_property_int_sdna(prop, nullptr, "active_index");
12230 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
12233 RNA_def_property_update(prop, NC_NODE, nullptr);
12234}
12235
12237{
12238 PropertyRNA *prop;
12239
12240 RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSelectHandles", "storage");
12241
12242 prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
12243 RNA_def_property_enum_sdna(prop, nullptr, "handle_type");
12244 RNA_def_property_ui_text(prop, "Handle Type", "");
12246 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
12247
12248 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
12250 RNA_def_property_ui_text(prop, "Mode", "Whether to check the type of left and right handles");
12252 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
12253}
12254
12255static void def_fn_rotate_euler(BlenderRNA * /*brna*/, StructRNA *srna)
12256{
12257 static const EnumPropertyItem type_items[] = {
12259 "AXIS_ANGLE",
12260 ICON_NONE,
12261 "Axis Angle",
12262 "Rotate around an axis by an angle"},
12264 "EULER",
12265 ICON_NONE,
12266 "Euler",
12267 "Rotate around the X, Y, and Z axes"},
12268 {0, nullptr, 0, nullptr, nullptr},
12269 };
12270
12271 static const EnumPropertyItem space_items[] = {
12273 "OBJECT",
12274 ICON_NONE,
12275 "Object",
12276 "Rotate the input rotation in the local space of the object"},
12278 "LOCAL",
12279 ICON_NONE,
12280 "Local",
12281 "Rotate the input rotation in its local space"},
12282 {0, nullptr, 0, nullptr, nullptr},
12283 };
12284
12285 PropertyRNA *prop;
12286
12287 prop = RNA_def_property(srna, "rotation_type", PROP_ENUM, PROP_NONE);
12288 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
12289 RNA_def_property_enum_items(prop, type_items);
12290 RNA_def_property_ui_text(prop, "Type", "Method used to describe the rotation");
12291 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
12292
12293 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
12294 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
12296 RNA_def_property_ui_text(prop, "Space", "Base orientation for rotation");
12297 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12298}
12299
12300static void def_geo_sample_index(BlenderRNA * /*brna*/, StructRNA *srna)
12301{
12302 using namespace blender;
12303 PropertyRNA *prop;
12304
12305 RNA_def_struct_sdna_from(srna, "NodeGeometrySampleIndex", "storage");
12306
12307 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
12310 prop, nullptr, nullptr, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
12312 RNA_def_property_ui_text(prop, "Data Type", "");
12314 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
12315
12316 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
12319 prop, nullptr, nullptr, "rna_GeometryNodeAttributeDomain_attribute_domain_itemf");
12321 RNA_def_property_ui_text(prop, "Domain", "");
12322 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12323
12324 prop = RNA_def_property(srna, "clamp", PROP_BOOLEAN, PROP_NONE);
12326 "Clamp",
12327 "Clamp the indices to the size of the attribute domain instead of "
12328 "outputting a default value for invalid indices");
12329 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12330}
12331
12332static void def_geo_input_material(BlenderRNA * /*brna*/, StructRNA *srna)
12333{
12334 PropertyRNA *prop;
12335
12336 prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
12337 RNA_def_property_pointer_sdna(prop, nullptr, "id");
12338 RNA_def_property_struct_type(prop, "Material");
12341 RNA_def_property_ui_text(prop, "Material", "");
12342 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12343}
12344
12345static void def_geo_input_collection(BlenderRNA * /*brna*/, StructRNA *srna)
12346{
12347 PropertyRNA *prop;
12348
12349 prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
12350 RNA_def_property_pointer_sdna(prop, nullptr, "id");
12351 RNA_def_property_struct_type(prop, "Collection");
12354 RNA_def_property_ui_text(prop, "Collection", "");
12355 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12356}
12357
12358static void def_geo_input_normal(BlenderRNA * /*brna*/, StructRNA *srna)
12359{
12360 PropertyRNA *prop = RNA_def_property(srna, "legacy_corner_normals", PROP_BOOLEAN, PROP_NONE);
12361 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
12363 prop,
12364 "Flat Corner Normals",
12365 "Always use face normals for the face corner domain, matching old behavior of the node");
12366 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12367}
12368
12369static void def_geo_input_object(BlenderRNA * /*brna*/, StructRNA *srna)
12370{
12371 PropertyRNA *prop;
12372
12373 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
12374 RNA_def_property_pointer_sdna(prop, nullptr, "id");
12375 RNA_def_property_struct_type(prop, "Object");
12378 RNA_def_property_ui_text(prop, "Object", "");
12379 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12380}
12381
12382static void def_geo_image(BlenderRNA * /*brna*/, StructRNA *srna)
12383{
12384 PropertyRNA *prop;
12385
12386 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
12387 RNA_def_property_pointer_sdna(prop, nullptr, "id");
12388 RNA_def_property_struct_type(prop, "Image");
12390 RNA_def_property_ui_text(prop, "Image", "");
12391 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12392}
12393
12394static void def_geo_string_to_curves(BlenderRNA * /*brna*/, StructRNA *srna)
12395{
12396 static const EnumPropertyItem rna_node_geometry_string_to_curves_overflow_items[] = {
12398 "OVERFLOW",
12399 ICON_NONE,
12400 "Overflow",
12401 "Let the text use more space than the specified height"},
12403 "SCALE_TO_FIT",
12404 ICON_NONE,
12405 "Scale To Fit",
12406 "Scale the text size to fit inside the width and height"},
12408 "TRUNCATE",
12409 ICON_NONE,
12410 "Truncate",
12411 "Only output curves that fit within the width and height. Output the remainder to the "
12412 "\"Remainder\" output."},
12413 {0, nullptr, 0, nullptr, nullptr},
12414 };
12415
12416 static const EnumPropertyItem rna_node_geometry_string_to_curves_align_x_items[] = {
12418 "LEFT",
12419 ICON_ALIGN_LEFT,
12420 "Left",
12421 "Align text to the left"},
12423 "CENTER",
12424 ICON_ALIGN_CENTER,
12425 "Center",
12426 "Align text to the center"},
12428 "RIGHT",
12429 ICON_ALIGN_RIGHT,
12430 "Right",
12431 "Align text to the right"},
12433 "JUSTIFY",
12434 ICON_ALIGN_JUSTIFY,
12435 "Justify",
12436 "Align text to the left and the right"},
12438 "FLUSH",
12439 ICON_ALIGN_FLUSH,
12440 "Flush",
12441 "Align text to the left and the right, with equal character spacing"},
12442 {0, nullptr, 0, nullptr, nullptr},
12443 };
12444
12445 static const EnumPropertyItem rna_node_geometry_string_to_curves_align_y_items[] = {
12447 "TOP",
12448 ICON_ALIGN_TOP,
12449 "Top",
12450 "Align text to the top"},
12452 "TOP_BASELINE",
12453 ICON_ALIGN_TOP,
12454 "Top Baseline",
12455 "Align text to the top line's baseline"},
12457 "MIDDLE",
12458 ICON_ALIGN_MIDDLE,
12459 "Middle",
12460 "Align text to the middle"},
12462 "BOTTOM_BASELINE",
12463 ICON_ALIGN_BOTTOM,
12464 "Bottom Baseline",
12465 "Align text to the bottom line's baseline"},
12467 "BOTTOM",
12468 ICON_ALIGN_BOTTOM,
12469 "Bottom",
12470 "Align text to the bottom"},
12471 {0, nullptr, 0, nullptr, nullptr},
12472 };
12473
12474 static const EnumPropertyItem rna_node_geometry_string_to_curves_pivot_mode[] = {
12475 {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT, "MIDPOINT", 0, "Midpoint", "Midpoint"},
12476 {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT, "TOP_LEFT", 0, "Top Left", "Top Left"},
12478 "TOP_CENTER",
12479 0,
12480 "Top Center",
12481 "Top Center"},
12482 {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT, "TOP_RIGHT", 0, "Top Right", "Top Right"},
12484 "BOTTOM_LEFT",
12485 0,
12486 "Bottom Left",
12487 "Bottom Left"},
12489 "BOTTOM_CENTER",
12490 0,
12491 "Bottom Center",
12492 "Bottom Center"},
12494 "BOTTOM_RIGHT",
12495 0,
12496 "Bottom Right",
12497 "Bottom Right"},
12498 {0, nullptr, 0, nullptr, nullptr},
12499 };
12500
12501 PropertyRNA *prop;
12502
12503 prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
12504 RNA_def_property_pointer_sdna(prop, nullptr, "id");
12505 RNA_def_property_struct_type(prop, "VectorFont");
12507 prop, "Font", "Font of the text. Falls back to the UI font by default.");
12510 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12511
12512 RNA_def_struct_sdna_from(srna, "NodeGeometryStringToCurves", "storage");
12513
12514 prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
12515 RNA_def_property_enum_sdna(prop, nullptr, "overflow");
12516 RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_overflow_items);
12519 prop, "Textbox Overflow", "Handle the text behavior when it doesn't fit in the text boxes");
12520 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
12521
12522 prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
12523 RNA_def_property_enum_sdna(prop, nullptr, "align_x");
12524 RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_align_x_items);
12527 "Horizontal Alignment",
12528 "Text horizontal alignment from the object or text box center");
12529 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12530
12531 prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
12532 RNA_def_property_enum_sdna(prop, nullptr, "align_y");
12533 RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_align_y_items);
12536 prop, "Vertical Alignment", "Text vertical alignment from the object center");
12537 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12538
12539 prop = RNA_def_property(srna, "pivot_mode", PROP_ENUM, PROP_NONE);
12540 RNA_def_property_enum_sdna(prop, nullptr, "pivot_mode");
12541 RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_pivot_mode);
12543 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot point position relative to character");
12544 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12545}
12546
12548{
12549 PropertyRNA *prop;
12550
12551 StructRNA *srna = RNA_def_struct(brna, "NodeEnumItem", nullptr);
12552 RNA_def_struct_ui_text(srna, "Enum Item", "");
12553
12554 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
12556 prop, nullptr, nullptr, "rna_Node_ItemArray_item_name_set<MenuSwitchItemsAccessor>");
12557 RNA_def_property_ui_text(prop, "Name", "");
12558 RNA_def_struct_name_property(srna, prop);
12560 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<MenuSwitchItemsAccessor>");
12561
12562 prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
12563 RNA_def_property_string_sdna(prop, nullptr, "description");
12564 RNA_def_property_ui_text(prop, "Description", "");
12566 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<MenuSwitchItemsAccessor>");
12567}
12568
12570{
12571 StructRNA *srna;
12572 PropertyRNA *parm;
12573 FunctionRNA *func;
12574
12575 srna = RNA_def_struct(brna, "NodeMenuSwitchItems", nullptr);
12576 RNA_def_struct_sdna(srna, "bNode");
12578 srna, "Enum Definition Items", "Collection of items that make up an enum");
12579
12580 func = RNA_def_function(srna, "new", "rna_NodeMenuSwitchItems_new");
12581 RNA_def_function_ui_description(func, "Add an a new enum item");
12583 parm = RNA_def_string(func, "name", nullptr, MAX_NAME, "Name", "");
12585 /* return value */
12586 parm = RNA_def_pointer(func, "item", "NodeEnumItem", "Item", "New item");
12587 RNA_def_function_return(func, parm);
12588
12589 rna_def_node_item_array_common_functions(srna, "NodeEnumItem", "MenuSwitchItemsAccessor");
12590}
12591
12593{
12594 PropertyRNA *prop;
12595
12598
12599 RNA_def_struct_sdna_from(srna, "NodeMenuSwitch", "storage");
12600
12601 prop = RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE);
12603 prop, nullptr, "enum_definition.items_array", "enum_definition.items_num");
12604 RNA_def_property_struct_type(prop, "NodeEnumItem");
12605 RNA_def_property_ui_text(prop, "Items", "");
12606 RNA_def_property_srna(prop, "NodeMenuSwitchItems");
12607
12608 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
12609 RNA_def_property_int_sdna(prop, nullptr, "enum_definition.active_index");
12610 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
12612 RNA_def_property_update(prop, NC_NODE, nullptr);
12613
12614 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
12615 RNA_def_property_struct_type(prop, "NodeEnumItem");
12617 "rna_Node_ItemArray_active_get<MenuSwitchItemsAccessor>",
12618 "rna_Node_ItemArray_active_set<MenuSwitchItemsAccessor>",
12619 nullptr,
12620 nullptr);
12622 RNA_def_property_ui_text(prop, "Active Item", "Active item");
12623 RNA_def_property_update(prop, NC_NODE, nullptr);
12624
12625 /* This exists only for backward compatibility. */
12626 prop = RNA_def_property(srna, "enum_definition", PROP_POINTER, PROP_NONE);
12627 RNA_def_property_struct_type(prop, "Node");
12629 prop, "rna_NodeMenuSwitch_enum_definition_get", nullptr, nullptr, nullptr);
12632 "Enum Definition (deprecated)",
12633 "The enum definition can now be accessed directly on the node. This "
12634 "exists for backward compatibility.");
12635}
12636
12638{
12639 StructRNA *srna;
12640
12641 srna = RNA_def_struct(brna, "ShaderNode", "NodeInternal");
12642 RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node");
12643 RNA_def_struct_sdna(srna, "bNode");
12644 RNA_def_struct_register_funcs(srna, "rna_ShaderNode_register", "rna_Node_unregister", nullptr);
12645}
12646
12648{
12649 StructRNA *srna;
12650 FunctionRNA *func;
12651
12652 srna = RNA_def_struct(brna, "CompositorNode", "NodeInternal");
12653 RNA_def_struct_ui_text(srna, "Compositor Node", "");
12654 RNA_def_struct_sdna(srna, "bNode");
12656 srna, "rna_CompositorNode_register", "rna_Node_unregister", nullptr);
12657
12658 /* compositor node need_exec flag */
12659 func = RNA_def_function(srna, "tag_need_exec", "rna_CompositorNode_tag_need_exec");
12660 RNA_def_function_ui_description(func, "Tag the node for compositor update");
12661
12663}
12664
12666{
12667 StructRNA *srna;
12668
12669 srna = RNA_def_struct(brna, "TextureNode", "NodeInternal");
12670 RNA_def_struct_ui_text(srna, "Texture Node", "");
12671 RNA_def_struct_sdna(srna, "bNode");
12672 RNA_def_struct_register_funcs(srna, "rna_TextureNode_register", "rna_Node_unregister", nullptr);
12673}
12674
12676{
12677 StructRNA *srna;
12678
12679 srna = RNA_def_struct(brna, "GeometryNode", "NodeInternal");
12680 RNA_def_struct_ui_text(srna, "Geometry Node", "");
12681 RNA_def_struct_sdna(srna, "bNode");
12682 RNA_def_struct_register_funcs(srna, "rna_GeometryNode_register", "rna_Node_unregister", nullptr);
12683}
12684
12686{
12687 StructRNA *srna;
12688
12689 srna = RNA_def_struct(brna, "FunctionNode", "NodeInternal");
12690 RNA_def_struct_ui_text(srna, "Function Node", "");
12691 RNA_def_struct_sdna(srna, "bNode");
12692 RNA_def_struct_register_funcs(srna, "rna_FunctionNode_register", "rna_Node_unregister", nullptr);
12693}
12694
12695/* -------------------------------------------------------------------------- */
12696
12697static void def_reroute(BlenderRNA * /*brna*/, StructRNA *srna)
12698{
12699 RNA_def_struct_sdna_from(srna, "NodeReroute", "storage");
12700
12701 PropertyRNA *prop = RNA_def_property(srna, "socket_idname", PROP_STRING, PROP_NONE);
12702 RNA_def_property_string_sdna(prop, nullptr, "type_idname");
12703 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_reroute_node_socket_type_set");
12704 RNA_def_property_ui_text(prop, "Type of socket", "");
12705 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
12706}
12707
12709{
12710 StructRNA *srna;
12711 PropertyRNA *prop, *parm;
12712 FunctionRNA *func;
12713
12714 srna = RNA_def_struct(brna, "NodeInternalSocketTemplate", nullptr);
12715 RNA_def_struct_ui_text(srna, "Socket Template", "Type and default value of a node socket");
12716
12717 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
12719 "rna_NodeInternalSocketTemplate_name_get",
12720 "rna_NodeInternalSocketTemplate_name_length",
12721 nullptr);
12722 RNA_def_property_ui_text(prop, "Name", "Name of the socket");
12724
12725 prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
12727 "rna_NodeInternalSocketTemplate_identifier_get",
12728 "rna_NodeInternalSocketTemplate_identifier_length",
12729 nullptr);
12730 RNA_def_property_ui_text(prop, "Identifier", "Identifier of the socket");
12732
12733 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
12734 RNA_def_property_enum_funcs(prop, "rna_NodeInternalSocketTemplate_type_get", nullptr, nullptr);
12736 RNA_def_property_ui_text(prop, "Type", "Data type of the socket");
12738
12739 /* XXX Workaround: Registered functions are not exposed in python by bpy,
12740 * it expects them to be registered from python and use the native implementation.
12741 *
12742 * However, the standard node types are not registering these functions from python,
12743 * so in order to call them in py scripts we need to overload and
12744 * replace them with plain C callbacks.
12745 * This type provides a usable basis for node types defined in C.
12746 */
12747
12748 srna = RNA_def_struct(brna, "NodeInternal", "Node");
12749 RNA_def_struct_sdna(srna, "bNode");
12750
12751 /* poll */
12752 func = RNA_def_function(srna, "poll", "rna_NodeInternal_poll");
12754 func, "If non-null output is returned, the node type can be added to the tree");
12756 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
12757 parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
12759
12760 func = RNA_def_function(srna, "poll_instance", "rna_NodeInternal_poll_instance");
12762 func, "If non-null output is returned, the node can be added to the tree");
12763 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
12764 parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
12766
12767 /* update */
12768 func = RNA_def_function(srna, "update", "rna_NodeInternal_update");
12770 func, "Update on node graph topology changes (adding or removing nodes and links)");
12772
12773 /* draw buttons */
12774 func = RNA_def_function(srna, "draw_buttons", "rna_NodeInternal_draw_buttons");
12775 RNA_def_function_ui_description(func, "Draw node buttons");
12777 parm = RNA_def_pointer(func, "context", "Context", "", "");
12779 parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
12780 RNA_def_property_struct_type(parm, "UILayout");
12781 RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
12783
12784 /* draw buttons extended */
12785 func = RNA_def_function(srna, "draw_buttons_ext", "rna_NodeInternal_draw_buttons_ext");
12786 RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
12788 parm = RNA_def_pointer(func, "context", "Context", "", "");
12790 parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
12791 RNA_def_property_struct_type(parm, "UILayout");
12792 RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
12794}
12795
12796static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
12797{
12798 StructRNA *srna;
12799 PropertyRNA *parm;
12800 FunctionRNA *func;
12801 const char *structtype = (in_out == SOCK_IN ? "NodeInputs" : "NodeOutputs");
12802 const char *uiname = (in_out == SOCK_IN ? "Node Inputs" : "Node Outputs");
12803 const char *newfunc = (in_out == SOCK_IN ? "rna_Node_inputs_new" : "rna_Node_outputs_new");
12804 const char *clearfunc = (in_out == SOCK_IN ? "rna_Node_inputs_clear" : "rna_Node_outputs_clear");
12805 const char *movefunc = (in_out == SOCK_IN ? "rna_Node_inputs_move" : "rna_Node_outputs_move");
12806
12807 RNA_def_property_srna(cprop, structtype);
12808 srna = RNA_def_struct(brna, structtype, nullptr);
12809 RNA_def_struct_sdna(srna, "bNode");
12810 RNA_def_struct_ui_text(srna, uiname, "Collection of Node Sockets");
12811
12812 func = RNA_def_function(srna, "new", newfunc);
12813 RNA_def_function_ui_description(func, "Add a socket to this node");
12815 parm = RNA_def_string(func, "type", nullptr, MAX_NAME, "Type", "Data type");
12817 parm = RNA_def_string(func, "name", nullptr, MAX_NAME, "Name", "");
12819 RNA_def_string(func, "identifier", nullptr, MAX_NAME, "Identifier", "Unique socket identifier");
12821 func, "use_multi_input", false, "", "Make the socket multi-input (valid for inputs only)");
12822 /* return value */
12823 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
12824 RNA_def_function_return(func, parm);
12825
12826 func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
12827 RNA_def_function_ui_description(func, "Remove a socket from this node");
12829 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
12831
12832 func = RNA_def_function(srna, "clear", clearfunc);
12833 RNA_def_function_ui_description(func, "Remove all sockets from this node");
12835
12836 func = RNA_def_function(srna, "move", movefunc);
12837 RNA_def_function_ui_description(func, "Move a socket to another position");
12839 parm = RNA_def_int(
12840 func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
12842 parm = RNA_def_int(
12843 func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
12845}
12846
12847static void rna_def_node(BlenderRNA *brna)
12848{
12849 StructRNA *srna;
12850 PropertyRNA *prop;
12851 FunctionRNA *func;
12852 PropertyRNA *parm;
12853
12854 static const EnumPropertyItem warning_propagation_items[] = {
12855 {NODE_WARNING_PROPAGATION_ALL, "ALL", 0, "All", ""},
12856 {NODE_WARNING_PROPAGATION_NONE, "NONE", 0, "None", ""},
12857 {NODE_WARNING_PROPAGATION_ONLY_ERRORS, "ERRORS", 0, "Errors", ""},
12859 "ERRORS_AND_WARNINGS",
12860 0,
12861 "Errors and Warnings",
12862 ""},
12863 {0, nullptr, 0, nullptr, nullptr},
12864 };
12865
12866 srna = RNA_def_struct(brna, "Node", nullptr);
12867 RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
12868 RNA_def_struct_sdna(srna, "bNode");
12869 RNA_def_struct_ui_icon(srna, ICON_NODE);
12870 RNA_def_struct_refine_func(srna, "rna_Node_refine");
12871 RNA_def_struct_path_func(srna, "rna_Node_path");
12872 RNA_def_struct_register_funcs(srna, "rna_Node_register", "rna_Node_unregister", nullptr);
12873 RNA_def_struct_idprops_func(srna, "rna_Node_idprops");
12874
12875 prop = RNA_def_property(srna, "type", PROP_STRING, PROP_NONE);
12876 RNA_def_property_string_funcs(prop, "rna_node_type_get", "rna_node_type_length", nullptr);
12879 prop, "Type", "Legacy unique node type identifier, redundant with bl_idname property");
12880
12881 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
12882 RNA_def_property_array(prop, 2);
12883 RNA_def_property_float_funcs(prop, "rna_Node_location_get", "rna_Node_location_set", nullptr);
12884 RNA_def_property_range(prop, -1000000.0f, 1000000.0f);
12885 RNA_def_property_ui_text(prop, "Location", "Location of the node within its parent frame");
12886 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
12887
12888 prop = RNA_def_property(srna, "location_absolute", PROP_FLOAT, PROP_XYZ);
12889 RNA_def_property_float_sdna(prop, nullptr, "location");
12890 RNA_def_property_array(prop, 2);
12891 RNA_def_property_range(prop, -1000000.0f, 1000000.0f);
12892 RNA_def_property_ui_text(prop, "Absolute Location", "Location of the node in the entire canvas");
12893 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
12894
12895 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_XYZ);
12896 RNA_def_property_float_sdna(prop, nullptr, "width");
12897 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_Node_width_range");
12898 RNA_def_property_ui_text(prop, "Width", "Width of the node");
12899 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
12900
12901 prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_XYZ);
12902 RNA_def_property_float_sdna(prop, nullptr, "height");
12903 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_Node_height_range");
12904 RNA_def_property_ui_text(prop, "Height", "Height of the node");
12905 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
12906
12907 prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
12908 RNA_def_property_array(prop, 2);
12909 RNA_def_property_float_funcs(prop, "rna_Node_dimensions_get", nullptr, nullptr);
12910 RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the node");
12912
12913 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
12914 RNA_def_property_ui_text(prop, "Name", "Unique node identifier");
12915 RNA_def_struct_name_property(srna, prop);
12916 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Node_name_set");
12917 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12918
12919 prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
12920 RNA_def_property_string_sdna(prop, nullptr, "label");
12921 RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
12922 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
12923
12924 prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
12925 RNA_def_property_collection_sdna(prop, nullptr, "inputs", nullptr);
12927 nullptr,
12928 nullptr,
12929 nullptr,
12930 nullptr,
12931 nullptr,
12932 nullptr,
12933 "rna_NodeInputs_lookup_string",
12934 nullptr);
12935 RNA_def_property_struct_type(prop, "NodeSocket");
12937 RNA_def_property_ui_text(prop, "Inputs", "");
12938 rna_def_node_sockets_api(brna, prop, SOCK_IN);
12939
12940 prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
12941 RNA_def_property_collection_sdna(prop, nullptr, "outputs", nullptr);
12943 nullptr,
12944 nullptr,
12945 nullptr,
12946 nullptr,
12947 nullptr,
12948 nullptr,
12949 "rna_NodeOutputs_lookup_string",
12950 nullptr);
12951 RNA_def_property_struct_type(prop, "NodeSocket");
12953 RNA_def_property_ui_text(prop, "Outputs", "");
12955
12956 prop = RNA_def_property(srna, "internal_links", PROP_COLLECTION, PROP_NONE);
12958 "rna_Node_internal_links_begin",
12959 "rna_iterator_array_next",
12960 "rna_iterator_array_end",
12961 "rna_iterator_array_get",
12962 nullptr,
12963 nullptr,
12964 nullptr,
12965 nullptr);
12966 RNA_def_property_struct_type(prop, "NodeLink");
12968 prop, "Internal Links", "Internal input-to-output connections for muting");
12969
12970 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
12971 RNA_def_property_pointer_sdna(prop, nullptr, "parent");
12973 prop, nullptr, "rna_Node_parent_set", nullptr, "rna_Node_parent_poll");
12977 RNA_def_property_struct_type(prop, "Node");
12978 RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to");
12979
12980 prop = RNA_def_property(srna, "warning_propagation", PROP_ENUM, PROP_NONE);
12981 RNA_def_property_enum_items(prop, warning_propagation_items);
12983 prop,
12984 "Warning Propagation",
12985 "The kinds of messages that should be propagated from this node to the parent group node");
12986 RNA_def_property_update(prop, 0, "rna_Node_update");
12987
12988 prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
12989 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_CUSTOM_COLOR);
12991 RNA_def_property_ui_text(prop, "Custom Color", "Use custom color for the node");
12992 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
12993
12994 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
12995 RNA_def_property_array(prop, 3);
12996 RNA_def_property_range(prop, 0.0f, 1.0f);
12997 RNA_def_property_ui_text(prop, "Color", "Custom color of the node body");
12998 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
12999
13000 prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
13002 RNA_def_property_enum_funcs(prop, "rna_Node_color_tag_get", nullptr, nullptr);
13003 RNA_def_property_ui_text(prop, "Color Tag", "Node header color tag");
13005
13006 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
13007 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SELECT);
13008 RNA_def_property_boolean_funcs(prop, nullptr, "rna_Node_select_set");
13009 RNA_def_property_ui_text(prop, "Select", "Node selection state");
13011
13012 prop = RNA_def_property(srna, "show_options", PROP_BOOLEAN, PROP_NONE);
13013 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_OPTIONS);
13014 RNA_def_property_ui_text(prop, "Show Options", "");
13015 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
13016
13017 prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
13018 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_PREVIEW);
13019 RNA_def_property_ui_text(prop, "Show Preview", "");
13020 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
13021
13022 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
13023 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_HIDDEN);
13024 RNA_def_property_ui_text(prop, "Hide", "");
13025 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
13026
13027 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
13028 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_MUTED);
13030 RNA_def_property_ui_text(prop, "Mute", "");
13031 RNA_def_property_update(prop, 0, "rna_Node_update");
13032
13033 prop = RNA_def_property(srna, "show_texture", PROP_BOOLEAN, PROP_NONE);
13034 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_ACTIVE_TEXTURE);
13035 RNA_def_property_ui_text(prop, "Show Texture", "Display node in viewport textured shading mode");
13036 RNA_def_property_update(prop, 0, "rna_Node_update");
13037
13038 /* generic property update function */
13039 func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update");
13040 RNA_def_function_ui_description(func, "Update after property changes");
13042 parm = RNA_def_pointer(func, "context", "Context", "", "");
13044
13045 func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
13046 RNA_def_function_ui_description(func, "True if a registered node type");
13048 parm = RNA_def_boolean(func, "result", false, "Result", "");
13049 RNA_def_function_return(func, parm);
13050
13051 /* registration */
13052 prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
13054 prop, "rna_Node_bl_idname_get", "rna_Node_bl_idname_length", "rna_Node_bl_idname_set");
13056 RNA_def_property_ui_text(prop, "ID Name", "");
13057
13058 prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
13060 prop, "rna_Node_bl_label_get", "rna_Node_bl_label_length", "rna_Node_bl_label_set");
13062 RNA_def_property_ui_text(prop, "Label", "The node label");
13063
13064 prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
13066 "rna_Node_bl_description_get",
13067 "rna_Node_bl_description_length",
13068 "rna_Node_bl_description_set");
13070
13071 prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
13072 RNA_def_property_enum_sdna(prop, nullptr, "typeinfo->ui_icon");
13074 RNA_def_property_enum_default(prop, ICON_NODE);
13076 RNA_def_property_ui_text(prop, "Icon", "The node icon");
13077
13078 prop = RNA_def_property(srna, "bl_static_type", PROP_STRING, PROP_NONE);
13079 RNA_def_property_string_funcs(prop, "rna_node_type_get", "rna_node_type_length", nullptr);
13082 prop,
13083 "Static Type",
13084 "Legacy unique node type identifier, redundant with bl_idname property");
13085
13086 /* type-based size properties */
13087 prop = RNA_def_property(srna, "bl_width_default", PROP_FLOAT, PROP_UNSIGNED);
13088 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->width");
13090
13091 prop = RNA_def_property(srna, "bl_width_min", PROP_FLOAT, PROP_UNSIGNED);
13092 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->minwidth");
13094
13095 prop = RNA_def_property(srna, "bl_width_max", PROP_FLOAT, PROP_UNSIGNED);
13096 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->maxwidth");
13098
13099 prop = RNA_def_property(srna, "bl_height_default", PROP_FLOAT, PROP_UNSIGNED);
13100 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->height");
13102
13103 prop = RNA_def_property(srna, "bl_height_min", PROP_FLOAT, PROP_UNSIGNED);
13104 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->minheight");
13106
13107 prop = RNA_def_property(srna, "bl_height_max", PROP_FLOAT, PROP_UNSIGNED);
13108 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->minheight");
13110
13111 /* poll */
13112 func = RNA_def_function(srna, "poll", nullptr);
13114 func, "If non-null output is returned, the node type can be added to the tree");
13116 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
13117 parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
13119
13120 func = RNA_def_function(srna, "poll_instance", nullptr);
13122 func, "If non-null output is returned, the node can be added to the tree");
13124 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
13125 parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
13127
13128 /* update */
13129 func = RNA_def_function(srna, "update", nullptr);
13131 func, "Update on node graph topology changes (adding or removing nodes and links)");
13133
13134 /* insert_link */
13135 func = RNA_def_function(srna, "insert_link", nullptr);
13136 RNA_def_function_ui_description(func, "Handle creation of a link to or from the node");
13138 parm = RNA_def_pointer(func, "link", "NodeLink", "Link", "Node link that will be inserted");
13140
13141 /* init */
13142 func = RNA_def_function(srna, "init", nullptr);
13143 RNA_def_function_ui_description(func, "Initialize a new instance of this node");
13145 parm = RNA_def_pointer(func, "context", "Context", "", "");
13147
13148 /* copy */
13149 func = RNA_def_function(srna, "copy", nullptr);
13151 "Initialize a new instance of this node from an existing node");
13153 parm = RNA_def_pointer(func, "node", "Node", "Node", "Existing node to copy");
13155
13156 /* free */
13157 func = RNA_def_function(srna, "free", nullptr);
13158 RNA_def_function_ui_description(func, "Clean up node on removal");
13160
13161 /* draw buttons */
13162 func = RNA_def_function(srna, "draw_buttons", nullptr);
13163 RNA_def_function_ui_description(func, "Draw node buttons");
13165 parm = RNA_def_pointer(func, "context", "Context", "", "");
13167 parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
13168 RNA_def_property_struct_type(parm, "UILayout");
13169 RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
13171
13172 /* draw buttons extended */
13173 func = RNA_def_function(srna, "draw_buttons_ext", nullptr);
13174 RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
13176 parm = RNA_def_pointer(func, "context", "Context", "", "");
13178 parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
13179 RNA_def_property_struct_type(parm, "UILayout");
13180 RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
13182
13183 /* dynamic label */
13184 func = RNA_def_function(srna, "draw_label", nullptr);
13185 RNA_def_function_ui_description(func, "Returns a dynamic label string");
13187 parm = RNA_def_string(func, "label", nullptr, MAX_NAME, "Label", "");
13189 parm, PROP_THICK_WRAP, ParameterFlag(0)); /* needed for string return value */
13190 RNA_def_function_output(func, parm);
13191
13192 func = RNA_def_function(srna,
13193 "debug_zone_body_lazy_function_graph",
13194 "rna_NodeTree_debug_zone_body_lazy_function_graph");
13196 func, "Get the internal lazy-function graph for the body of this zone");
13198 parm = RNA_def_string(func, "dot_graph", nullptr, INT32_MAX, "Dot Graph", "Graph in dot format");
13201 RNA_def_function_output(func, parm);
13202
13203 func = RNA_def_function(
13204 srna, "debug_zone_lazy_function_graph", "rna_NodeTree_debug_zone_lazy_function_graph");
13205 RNA_def_function_ui_description(func, "Get the internal lazy-function graph for this zone");
13207 parm = RNA_def_string(func, "dot_graph", nullptr, INT32_MAX, "Dot Graph", "Graph in dot format");
13210 RNA_def_function_output(func, parm);
13211}
13212
13214{
13215 StructRNA *srna;
13216 PropertyRNA *prop;
13217 FunctionRNA *func;
13218 PropertyRNA *parm;
13219
13220 srna = RNA_def_struct(brna, "NodeLink", nullptr);
13221 RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree");
13222 RNA_def_struct_sdna(srna, "bNodeLink");
13223 RNA_def_struct_ui_icon(srna, ICON_NODE);
13224
13225 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
13226 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_LINK_VALID);
13227 RNA_def_property_ui_text(prop, "Valid", "Link is valid");
13228 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
13229
13230 prop = RNA_def_property(srna, "is_muted", PROP_BOOLEAN, PROP_NONE);
13231 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_LINK_MUTED);
13232 RNA_def_property_ui_text(prop, "Muted", "Link is muted and can be ignored");
13233 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
13234
13235 prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE);
13236 RNA_def_property_pointer_sdna(prop, nullptr, "fromnode");
13237 RNA_def_property_struct_type(prop, "Node");
13241 RNA_def_property_ui_text(prop, "From node", "");
13242
13243 prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE);
13244 RNA_def_property_pointer_sdna(prop, nullptr, "tonode");
13245 RNA_def_property_struct_type(prop, "Node");
13249 RNA_def_property_ui_text(prop, "To node", "");
13250
13251 prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE);
13252 RNA_def_property_pointer_sdna(prop, nullptr, "fromsock");
13253 RNA_def_property_struct_type(prop, "NodeSocket");
13257 RNA_def_property_ui_text(prop, "From socket", "");
13258
13259 prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE);
13260 RNA_def_property_pointer_sdna(prop, nullptr, "tosock");
13261 RNA_def_property_struct_type(prop, "NodeSocket");
13265 RNA_def_property_ui_text(prop, "To socket", "");
13266
13267 prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
13268 RNA_def_property_boolean_funcs(prop, "rna_NodeLink_is_hidden_get", nullptr);
13272 RNA_def_property_ui_text(prop, "Is Hidden", "Link is hidden due to invisible sockets");
13273
13274 prop = RNA_def_property(srna, "multi_input_sort_id", PROP_INT, PROP_UNSIGNED);
13277 prop,
13278 "Multi Input Sort ID",
13279 "Used to sort multiple links coming into the same input. The highest ID is at the top.");
13280
13281 func = RNA_def_function(
13282 srna, "swap_multi_input_sort_id", "rna_NodeLink_swap_multi_input_sort_id");
13284 func, "Swap the order of two links connected to the same multi-input socket");
13286 parm = RNA_def_pointer(func,
13287 "other",
13288 "NodeLink",
13289 "Other",
13290 "The other link. Must link to the same multi-input socket.");
13292}
13293
13295{
13296 StructRNA *srna;
13297 PropertyRNA *parm, *prop;
13298 FunctionRNA *func;
13299
13300 RNA_def_property_srna(cprop, "Nodes");
13301 srna = RNA_def_struct(brna, "Nodes", nullptr);
13302 RNA_def_struct_sdna(srna, "bNodeTree");
13303 RNA_def_struct_ui_text(srna, "Nodes", "Collection of Nodes");
13304
13305 func = RNA_def_function(srna, "new", "rna_NodeTree_node_new");
13306 RNA_def_function_ui_description(func, "Add a node to this node tree");
13308 /* XXX warning note should eventually be removed,
13309 * added this here to avoid frequent confusion with API changes from "type" to "bl_idname"
13310 */
13311 parm = RNA_def_string(
13312 func,
13313 "type",
13314 nullptr,
13315 MAX_NAME,
13316 "Type",
13317 "Type of node to add (Warning: should be same as node.bl_idname, not node.type!)");
13319 /* return value */
13320 parm = RNA_def_pointer(func, "node", "Node", "", "New node");
13321 RNA_def_function_return(func, parm);
13322
13323 func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
13324 RNA_def_function_ui_description(func, "Remove a node from this node tree");
13326 parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
13329
13330 func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
13331 RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
13333
13334 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
13335 RNA_def_property_struct_type(prop, "Node");
13337 prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", nullptr, nullptr);
13339 RNA_def_property_ui_text(prop, "Active Node", "Active node in this tree");
13340 RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, "rna_NodeTree_update");
13341}
13342
13344{
13345 StructRNA *srna;
13346 PropertyRNA *parm;
13347 FunctionRNA *func;
13348
13349 RNA_def_property_srna(cprop, "NodeLinks");
13350 srna = RNA_def_struct(brna, "NodeLinks", nullptr);
13351 RNA_def_struct_sdna(srna, "bNodeTree");
13352 RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links");
13353
13354 func = RNA_def_function(srna, "new", "rna_NodeTree_link_new");
13355 RNA_def_function_ui_description(func, "Add a node link to this node tree");
13357 parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
13359 parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
13361 RNA_def_boolean(func,
13362 "verify_limits",
13363 true,
13364 "Verify Limits",
13365 "Remove existing links if connection limit is exceeded");
13366 RNA_def_boolean(func,
13367 "handle_dynamic_sockets",
13368 false,
13369 "Handle Dynamic Sockets",
13370 "Handle node specific features like virtual sockets");
13371 /* return */
13372 parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link");
13373 RNA_def_function_return(func, parm);
13374
13375 func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
13376 RNA_def_function_ui_description(func, "remove a node link from the node tree");
13378 parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
13381
13382 func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
13383 RNA_def_function_ui_description(func, "remove all node links from the node tree");
13385}
13386
13388{
13389 StructRNA *srna;
13390 PropertyRNA *prop;
13391 FunctionRNA *func;
13392 PropertyRNA *parm;
13393
13394 static const EnumPropertyItem static_type_items[] = {
13396 "UNDEFINED",
13397 ICON_QUESTION,
13398 "Undefined",
13399 "Undefined type of nodes (can happen e.g. when a linked node tree goes missing)"},
13400 {NTREE_CUSTOM, "CUSTOM", ICON_NONE, "Custom", "Custom nodes"},
13401 {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
13402 {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
13403 {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
13404 {NTREE_GEOMETRY, "GEOMETRY", ICON_GEOMETRY_NODES, "Geometry", "Geometry nodes"},
13405 {0, nullptr, 0, nullptr, nullptr},
13406 };
13407
13408 srna = RNA_def_struct(brna, "NodeTree", "ID");
13410 srna,
13411 "Node Tree",
13412 "Node tree consisting of linked nodes used for shading, textures and compositing");
13413 RNA_def_struct_sdna(srna, "bNodeTree");
13414 RNA_def_struct_ui_icon(srna, ICON_NODETREE);
13415 RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
13416 RNA_def_struct_register_funcs(srna, "rna_NodeTree_register", "rna_NodeTree_unregister", nullptr);
13417
13418 prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
13420 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_NodeTree_color_tag_itemf");
13422 prop, "Color Tag", "Color tag of the node group which influences the header color");
13423 RNA_def_property_update(prop, NC_NODE, nullptr);
13424
13425 prop = RNA_def_property(srna, "default_group_node_width", PROP_INT, PROP_NONE);
13429 prop, "Default Group Node Width", "The width for newly created group nodes");
13430 RNA_def_property_update(prop, NC_NODE, nullptr);
13431
13432 prop = RNA_def_property(srna, "view_center", PROP_FLOAT, PROP_XYZ);
13433 RNA_def_property_array(prop, 2);
13434 RNA_def_property_float_sdna(prop, nullptr, "view_center");
13436 prop, "", "The current location (offset) of the view for this Node Tree");
13438
13439 prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
13440 RNA_def_property_ui_text(prop, "Description", "Description of the node tree");
13441
13442 /* AnimData */
13444
13445 /* Nodes Collection */
13446 prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
13447 RNA_def_property_collection_sdna(prop, nullptr, "nodes", nullptr);
13448 RNA_def_property_struct_type(prop, "Node");
13450 RNA_def_property_ui_text(prop, "Nodes", "");
13451 rna_def_nodetree_nodes_api(brna, prop);
13452
13453 /* NodeLinks Collection */
13454 prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE);
13455 RNA_def_property_collection_sdna(prop, nullptr, "links", nullptr);
13456 RNA_def_property_struct_type(prop, "NodeLink");
13457 RNA_def_property_ui_text(prop, "Links", "");
13458 rna_def_nodetree_link_api(brna, prop);
13459
13460 /* Grease Pencil */
13461 prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
13462 RNA_def_property_pointer_sdna(prop, nullptr, "gpd");
13463 RNA_def_property_struct_type(prop, "GreasePencil");
13465 prop, nullptr, nullptr, nullptr, "rna_GPencil_datablocks_annotations_poll");
13468 RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block");
13469 RNA_def_property_update(prop, NC_NODE, nullptr);
13470
13471 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
13473 RNA_def_property_enum_items(prop, static_type_items);
13475 prop,
13476 "Type",
13477 "Node Tree type (deprecated, bl_idname is the actual node tree type identifier)");
13478
13479 prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
13480 RNA_def_property_pointer_sdna(prop, nullptr, "tree_interface");
13481 RNA_def_property_struct_type(prop, "NodeTreeInterface");
13483 RNA_def_property_ui_text(prop, "Interface", "Interface declaration for this node tree");
13484 /* exposed as a function for runtime interface type properties */
13485 func = RNA_def_function(srna, "interface_update", "rna_NodeTree_interface_update");
13486 RNA_def_function_ui_description(func, "Updated node group interface");
13487 parm = RNA_def_pointer(func, "context", "Context", "", "");
13489
13490 func = RNA_def_function(srna, "contains_tree", "rna_NodeTree_contains_tree");
13492 func,
13493 "Check if the node tree contains another. Used to avoid creating recursive node groups.");
13494 parm = RNA_def_pointer(
13495 func, "sub_tree", "NodeTree", "Node Tree", "Node tree for recursive check");
13497 parm = RNA_def_property(func, "contained", PROP_BOOLEAN, PROP_NONE);
13498 RNA_def_function_return(func, parm);
13499
13500 /* registration */
13501 prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
13503 "rna_NodeTree_bl_idname_get",
13504 "rna_NodeTree_bl_idname_length",
13505 "rna_NodeTree_bl_idname_set");
13507 RNA_def_property_ui_text(prop, "ID Name", "");
13508
13509 prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
13511 "rna_NodeTree_bl_label_get",
13512 "rna_NodeTree_bl_label_length",
13513 "rna_NodeTree_bl_label_set");
13515 RNA_def_property_ui_text(prop, "Label", "The node tree label");
13516
13517 prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
13519 "rna_NodeTree_bl_description_get",
13520 "rna_NodeTree_bl_description_length",
13521 "rna_NodeTree_bl_description_set");
13523
13524 prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
13525 RNA_def_property_enum_sdna(prop, nullptr, "typeinfo->ui_icon");
13527 RNA_def_property_enum_default(prop, ICON_NODETREE);
13529 RNA_def_property_ui_text(prop, "Icon", "The node tree icon");
13530
13531 prop = RNA_def_property(srna, "bl_use_group_interface", PROP_BOOLEAN, PROP_NONE);
13532 RNA_def_property_boolean_negative_sdna(prop, nullptr, "typeinfo->no_group_interface", 1);
13536 "Use Group Interface",
13537 "Determines the visibility of some UI elements related to node groups");
13538
13539 /* poll */
13540 func = RNA_def_function(srna, "poll", nullptr);
13541 RNA_def_function_ui_description(func, "Check visibility in the editor");
13543 parm = RNA_def_pointer(func, "context", "Context", "", "");
13545 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
13546
13547 /* update */
13548 func = RNA_def_function(srna, "update", nullptr);
13549 RNA_def_function_ui_description(func, "Update on editor changes");
13551
13552 /* get a node tree from context */
13553 func = RNA_def_function(srna, "get_from_context", nullptr);
13554 RNA_def_function_ui_description(func, "Get a node tree from the context");
13556 parm = RNA_def_pointer(func, "context", "Context", "", "");
13558 parm = RNA_def_pointer(
13559 func, "result_1", "NodeTree", "Node Tree", "Active node tree from context");
13560 RNA_def_function_output(func, parm);
13561 parm = RNA_def_pointer(
13562 func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree");
13563 RNA_def_function_output(func, parm);
13564 parm = RNA_def_pointer(
13565 func, "result_3", "ID", "From ID", "Original ID data-block selected from the context");
13566 RNA_def_function_output(func, parm);
13567
13568 /* Check for support of a socket type with a type identifier. */
13569 func = RNA_def_function(srna, "valid_socket_type", nullptr);
13570 RNA_def_function_ui_description(func, "Check if the socket type is valid for the node tree");
13572 parm = RNA_def_string(
13573 func, "idname", "NodeSocket", MAX_NAME, "Socket Type", "Identifier of the socket type");
13575 RNA_def_function_return(func, RNA_def_boolean(func, "valid", false, "", ""));
13576
13577 func = RNA_def_function(
13578 srna, "debug_lazy_function_graph", "rna_NodeTree_debug_lazy_function_graph");
13579 RNA_def_function_ui_description(func, "Get the internal lazy-function graph for this node tree");
13581 parm = RNA_def_string(func, "dot_graph", nullptr, INT32_MAX, "Dot Graph", "Graph in dot format");
13584 RNA_def_function_output(func, parm);
13585}
13586
13588{
13589 StructRNA *srna;
13590 PropertyRNA *prop;
13591
13592 srna = RNA_def_struct(brna, "CompositorNodeTree", "NodeTree");
13594 srna, "Compositor Node Tree", "Node tree consisting of linked nodes used for compositing");
13595 RNA_def_struct_sdna(srna, "bNodeTree");
13596 RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
13597
13598 prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE);
13599 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NTREE_VIEWER_BORDER);
13601 prop, "Viewer Region", "Use boundaries for viewer nodes and composite backdrop");
13602 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update");
13603}
13604
13606{
13607 StructRNA *srna;
13608 FunctionRNA *func;
13609 PropertyRNA *parm;
13610
13611 srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
13613 srna,
13614 "Shader Node Tree",
13615 "Node tree consisting of linked nodes used for materials (and other shading data-blocks)");
13616 RNA_def_struct_sdna(srna, "bNodeTree");
13617 RNA_def_struct_ui_icon(srna, ICON_MATERIAL);
13618
13619 func = RNA_def_function(srna, "get_output_node", "ntreeShaderOutputNode");
13621 "Return active shader output node for the specified target");
13622 parm = RNA_def_enum(
13623 func, "target", prop_shader_output_target_items, SHD_OUTPUT_ALL, "Target", "");
13625 parm = RNA_def_pointer(func, "node", "ShaderNode", "Node", "");
13626 RNA_def_function_return(func, parm);
13627}
13628
13630{
13631 StructRNA *srna;
13632
13633 srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree");
13635 srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures");
13636 RNA_def_struct_sdna(srna, "bNodeTree");
13637 RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
13638}
13639
13641{
13642 StructRNA *srna;
13643 PropertyRNA *prop;
13644
13645 srna = RNA_def_struct(brna, "GeometryNodeTree", "NodeTree");
13647 srna, "Geometry Node Tree", "Node tree consisting of linked nodes used for geometries");
13648 RNA_def_struct_sdna(srna, "bNodeTree");
13649 RNA_def_struct_ui_icon(srna, ICON_NODETREE);
13650
13651 prop = RNA_def_property(srna, "is_tool", PROP_BOOLEAN, PROP_NONE);
13652 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GEO_NODE_ASSET_TOOL);
13654 RNA_def_property_ui_text(prop, "Tool", "The node group is used as a tool");
13656 prop, "rna_GeometryNodeTree_is_tool_get", "rna_GeometryNodeTree_is_tool_set");
13657 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13658
13659 prop = RNA_def_property(srna, "is_modifier", PROP_BOOLEAN, PROP_NONE);
13662 RNA_def_property_ui_text(prop, "Modifier", "The node group is used as a geometry modifier");
13664 prop, "rna_GeometryNodeTree_is_modifier_get", "rna_GeometryNodeTree_is_modifier_set");
13665 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13666
13667 prop = RNA_def_property(srna, "is_mode_object", PROP_BOOLEAN, PROP_NONE);
13668 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GEO_NODE_ASSET_EDIT);
13670 RNA_def_property_ui_text(prop, "Edit", "The node group is used in object mode");
13672 prop, "rna_GeometryNodeTree_is_mode_object_get", "rna_GeometryNodeTree_is_mode_object_set");
13673 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13674
13675 prop = RNA_def_property(srna, "is_mode_edit", PROP_BOOLEAN, PROP_NONE);
13676 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GEO_NODE_ASSET_EDIT);
13678 RNA_def_property_ui_text(prop, "Edit", "The node group is used in edit mode");
13680 prop, "rna_GeometryNodeTree_is_mode_edit_get", "rna_GeometryNodeTree_is_mode_edit_set");
13681 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13682
13683 prop = RNA_def_property(srna, "is_mode_sculpt", PROP_BOOLEAN, PROP_NONE);
13686 RNA_def_property_ui_text(prop, "Sculpt", "The node group is used in sculpt mode");
13688 prop, "rna_GeometryNodeTree_is_mode_sculpt_get", "rna_GeometryNodeTree_is_mode_sculpt_set");
13689 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13690
13691 prop = RNA_def_property(srna, "is_mode_paint", PROP_BOOLEAN, PROP_NONE);
13694 RNA_def_property_ui_text(prop, "Paint", "The node group is used in paint mode");
13696 prop, "rna_GeometryNodeTree_is_mode_paint_get", "rna_GeometryNodeTree_is_mode_paint_set");
13697 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13698
13699 prop = RNA_def_property(srna, "is_type_mesh", PROP_BOOLEAN, PROP_NONE);
13700 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GEO_NODE_ASSET_MESH);
13702 RNA_def_property_ui_text(prop, "Mesh", "The node group is used for meshes");
13704 prop, "rna_GeometryNodeTree_is_type_mesh_get", "rna_GeometryNodeTree_is_type_mesh_set");
13705 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13706
13707 prop = RNA_def_property(srna, "is_type_curve", PROP_BOOLEAN, PROP_NONE);
13710 RNA_def_property_ui_text(prop, "Curves", "The node group is used for curves");
13712 prop, "rna_GeometryNodeTree_is_type_curve_get", "rna_GeometryNodeTree_is_type_curve_set");
13713 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13714
13715 prop = RNA_def_property(srna, "is_type_pointcloud", PROP_BOOLEAN, PROP_NONE);
13718 RNA_def_property_ui_text(prop, "Point Cloud", "The node group is used for point clouds");
13720 "rna_GeometryNodeTree_is_type_pointcloud_get",
13721 "rna_GeometryNodeTree_is_type_pointcloud_set");
13722 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13723
13724 prop = RNA_def_property(srna, "use_wait_for_click", PROP_BOOLEAN, PROP_NONE);
13728 "Wait for Click",
13729 "Wait for mouse click input before running the operator from a menu");
13731 "rna_GeometryNodeTree_use_wait_for_click_get",
13732 "rna_GeometryNodeTree_use_wait_for_click_set");
13733 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13734
13735 prop = RNA_def_property(srna, "is_type_grease_pencil", PROP_BOOLEAN, PROP_NONE);
13738 RNA_def_property_ui_text(prop, "Grease Pencil", "The node group is used for Grease Pencil");
13740 "rna_GeometryNodeTree_is_type_grease_pencil_get",
13741 "rna_GeometryNodeTree_is_type_grease_pencil_set");
13742 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
13743}
13744
13746 const char *struct_name,
13747 const char *base_name)
13748{
13749 StructRNA *srna;
13750 FunctionRNA *func;
13751 PropertyRNA *parm;
13752
13753 srna = RNA_def_struct(brna, struct_name, base_name);
13754 RNA_def_struct_sdna(srna, "bNode");
13755
13756 func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
13757 RNA_def_function_ui_description(func, "True if a registered node type");
13759 parm = RNA_def_boolean(func, "result", false, "Result", "");
13760 RNA_def_function_return(func, parm);
13761
13762 /* Exposes the socket template type lists in RNA for use in scripts
13763 * Only used in the C nodes and not exposed in the base class to
13764 * keep the namespace clean for py-nodes. */
13765 func = RNA_def_function(srna, "input_template", "rna_NodeInternal_input_template");
13766 RNA_def_function_ui_description(func, "Input socket template");
13768 parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
13769 RNA_def_property_ui_text(parm, "Index", "");
13771 parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
13772 RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
13774 RNA_def_function_return(func, parm);
13775
13776 func = RNA_def_function(srna, "output_template", "rna_NodeInternal_output_template");
13777 RNA_def_function_ui_description(func, "Output socket template");
13779 parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
13780 RNA_def_property_ui_text(parm, "Index", "");
13782 parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
13783 RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
13785 RNA_def_function_return(func, parm);
13786
13787 return srna;
13788}
13789
13791{
13792 StructRNA *srna;
13793
13794 srna = RNA_def_struct(brna, "NodeInstanceHash", nullptr);
13795 RNA_def_struct_ui_text(srna, "Node Instance Hash", "Hash table containing node instance data");
13796
13797 /* XXX This type is a stub for now, only used to store instance hash in the context.
13798 * Eventually could use a StructRNA pointer to define a specific data type
13799 * and expose lookup functions.
13800 */
13801}
13802
13803static void rna_def_nodes(BlenderRNA *brna)
13804{
13805 const auto define = [&](const char *base_name,
13806 const char *struct_name,
13807 void (*func)(BlenderRNA *, StructRNA *) = nullptr) {
13808 StructRNA *srna = define_specific_node(brna, struct_name, base_name);
13809 if (func) {
13810 func(brna, srna);
13811 }
13812 };
13813
13814 /* Disabling clang-format because:
13815 * - It's more readable when the lines are aligned.
13816 * - It's easier to sort the lines alphabetically with automated tools. Keeping the lines sorted
13817 * avoids merge conflicts in many cases when multiple people add nodes at the same time.
13818 */
13819 /* clang-format off */
13820
13821 define("NodeInternal", "NodeFrame", def_frame);
13822 define("NodeInternal", "NodeGroup", def_group);
13823 define("NodeInternal", "NodeGroupInput", def_group_input);
13824 define("NodeInternal", "NodeGroupOutput", def_group_output);
13825 define("NodeInternal", "NodeReroute", def_reroute);
13826
13827 define("ShaderNode", "ShaderNodeAddShader");
13828 define("ShaderNode", "ShaderNodeAmbientOcclusion", def_sh_ambient_occlusion);
13829 define("ShaderNode", "ShaderNodeAttribute", def_sh_attribute);
13830 define("ShaderNode", "ShaderNodeBackground");
13831 define("ShaderNode", "ShaderNodeBevel", def_sh_bevel);
13832 define("ShaderNode", "ShaderNodeBlackbody");
13833 define("ShaderNode", "ShaderNodeBrightContrast");
13834 define("ShaderNode", "ShaderNodeBsdfAnisotropic", def_glossy);
13835 define("ShaderNode", "ShaderNodeBsdfDiffuse");
13836 define("ShaderNode", "ShaderNodeBsdfGlass", def_glass);
13837 define("ShaderNode", "ShaderNodeBsdfHair", def_hair);
13838 define("ShaderNode", "ShaderNodeBsdfHairPrincipled", def_hair_principled);
13839 define("ShaderNode", "ShaderNodeBsdfMetallic", def_metallic);
13840 define("ShaderNode", "ShaderNodeBsdfPrincipled", def_principled);
13841 define("ShaderNode", "ShaderNodeBsdfRayPortal");
13842 define("ShaderNode", "ShaderNodeBsdfRefraction", def_refraction);
13843 define("ShaderNode", "ShaderNodeBsdfSheen", def_sheen);
13844 define("ShaderNode", "ShaderNodeBsdfToon", def_toon);
13845 define("ShaderNode", "ShaderNodeBsdfTranslucent");
13846 define("ShaderNode", "ShaderNodeBsdfTransparent");
13847 define("ShaderNode", "ShaderNodeBump", def_sh_bump);
13848 define("ShaderNode", "ShaderNodeCameraData");
13849 define("ShaderNode", "ShaderNodeClamp", def_clamp);
13850 define("ShaderNode", "ShaderNodeCombineColor", def_sh_combsep_color);
13851 define("ShaderNode", "ShaderNodeCombineHSV");
13852 define("ShaderNode", "ShaderNodeCombineRGB");
13853 define("ShaderNode", "ShaderNodeCombineXYZ");
13854 define("ShaderNode", "ShaderNodeDisplacement", def_sh_displacement);
13855 define("ShaderNode", "ShaderNodeEeveeSpecular");
13856 define("ShaderNode", "ShaderNodeEmission");
13857 define("ShaderNode", "ShaderNodeFloatCurve", def_float_curve);
13858 define("ShaderNode", "ShaderNodeFresnel");
13859 define("ShaderNode", "ShaderNodeGamma");
13860 define("ShaderNode", "ShaderNodeHairInfo");
13861 define("ShaderNode", "ShaderNodeHoldout");
13862 define("ShaderNode", "ShaderNodeHueSaturation");
13863 define("ShaderNode", "ShaderNodeInvert");
13864 define("ShaderNode", "ShaderNodeLayerWeight");
13865 define("ShaderNode", "ShaderNodeLightFalloff");
13866 define("ShaderNode", "ShaderNodeLightPath");
13867 define("ShaderNode", "ShaderNodeMapping", def_sh_mapping);
13868 define("ShaderNode", "ShaderNodeMapRange", def_map_range);
13869 define("ShaderNode", "ShaderNodeMath", def_math);
13870 define("ShaderNode", "ShaderNodeMix", def_sh_mix);
13871 define("ShaderNode", "ShaderNodeMixRGB", def_mix_rgb);
13872 define("ShaderNode", "ShaderNodeMixShader");
13873 define("ShaderNode", "ShaderNodeNewGeometry");
13874 define("ShaderNode", "ShaderNodeNormal");
13875 define("ShaderNode", "ShaderNodeNormalMap", def_sh_normal_map);
13876 define("ShaderNode", "ShaderNodeObjectInfo");
13877 define("ShaderNode", "ShaderNodeOutputAOV", def_sh_output_aov);
13878 define("ShaderNode", "ShaderNodeOutputLight", def_sh_output);
13879 define("ShaderNode", "ShaderNodeOutputLineStyle", def_sh_output_linestyle);
13880 define("ShaderNode", "ShaderNodeOutputMaterial", def_sh_output);
13881 define("ShaderNode", "ShaderNodeOutputWorld", def_sh_output);
13882 define("ShaderNode", "ShaderNodeParticleInfo");
13883 define("ShaderNode", "ShaderNodePointInfo");
13884 define("ShaderNode", "ShaderNodeRGB");
13885 define("ShaderNode", "ShaderNodeRGBCurve", def_rgb_curve);
13886 define("ShaderNode", "ShaderNodeRGBToBW");
13887 define("ShaderNode", "ShaderNodeScript", def_sh_script);
13888 define("ShaderNode", "ShaderNodeSeparateColor", def_sh_combsep_color);
13889 define("ShaderNode", "ShaderNodeSeparateHSV");
13890 define("ShaderNode", "ShaderNodeSeparateRGB");
13891 define("ShaderNode", "ShaderNodeSeparateXYZ");
13892 define("ShaderNode", "ShaderNodeShaderToRGB");
13893 define("ShaderNode", "ShaderNodeSqueeze");
13894 define("ShaderNode", "ShaderNodeSubsurfaceScattering", def_sh_subsurface);
13895 define("ShaderNode", "ShaderNodeTangent", def_sh_tangent);
13896 define("ShaderNode", "ShaderNodeTexBrick", def_sh_tex_brick);
13897 define("ShaderNode", "ShaderNodeTexChecker", def_sh_tex_checker);
13898 define("ShaderNode", "ShaderNodeTexCoord", def_sh_tex_coord);
13899 define("ShaderNode", "ShaderNodeTexEnvironment", def_sh_tex_environment);
13900 define("ShaderNode", "ShaderNodeTexGabor", def_sh_tex_gabor);
13901 define("ShaderNode", "ShaderNodeTexGradient", def_sh_tex_gradient);
13902 define("ShaderNode", "ShaderNodeTexIES", def_sh_tex_ies);
13903 define("ShaderNode", "ShaderNodeTexImage", def_sh_tex_image);
13904 define("ShaderNode", "ShaderNodeTexMagic", def_sh_tex_magic);
13905 define("ShaderNode", "ShaderNodeTexNoise", def_sh_tex_noise);
13906 define("ShaderNode", "ShaderNodeTexPointDensity", def_sh_tex_pointdensity);
13907 define("ShaderNode", "ShaderNodeTexSky", def_sh_tex_sky);
13908 define("ShaderNode", "ShaderNodeTexVoronoi", def_sh_tex_voronoi);
13909 define("ShaderNode", "ShaderNodeTexWave", def_sh_tex_wave);
13910 define("ShaderNode", "ShaderNodeTexWhiteNoise", def_sh_tex_white_noise);
13911 define("ShaderNode", "ShaderNodeUVAlongStroke", def_sh_uvalongstroke);
13912 define("ShaderNode", "ShaderNodeUVMap", def_sh_uvmap);
13913 define("ShaderNode", "ShaderNodeValToRGB", def_colorramp);
13914 define("ShaderNode", "ShaderNodeValue");
13915 define("ShaderNode", "ShaderNodeVectorCurve", def_vector_curve);
13916 define("ShaderNode", "ShaderNodeVectorDisplacement", def_sh_vector_displacement);
13917 define("ShaderNode", "ShaderNodeVectorMath", def_vector_math);
13918 define("ShaderNode", "ShaderNodeVectorRotate", def_sh_vector_rotate);
13919 define("ShaderNode", "ShaderNodeVectorTransform", def_sh_vect_transform);
13920 define("ShaderNode", "ShaderNodeVertexColor", def_sh_vertex_color);
13921 define("ShaderNode", "ShaderNodeVolumeAbsorption");
13922 define("ShaderNode", "ShaderNodeVolumeInfo");
13923 define("ShaderNode", "ShaderNodeVolumePrincipled");
13924 define("ShaderNode", "ShaderNodeVolumeScatter", def_scatter);
13925 define("ShaderNode", "ShaderNodeVolumeCoefficients", def_volume_coefficients);
13926 define("ShaderNode", "ShaderNodeWavelength");
13927 define("ShaderNode", "ShaderNodeWireframe", def_sh_tex_wireframe);
13928
13929 define("CompositorNode", "CompositorNodeAlphaOver", def_cmp_alpha_over);
13930 define("CompositorNode", "CompositorNodeAntiAliasing", def_cmp_antialiasing);
13931 define("CompositorNode", "CompositorNodeBilateralblur", def_cmp_bilateral_blur);
13932 define("CompositorNode", "CompositorNodeBlur", def_cmp_blur);
13933 define("CompositorNode", "CompositorNodeBokehBlur", def_cmp_bokehblur);
13934 define("CompositorNode", "CompositorNodeBokehImage", def_cmp_bokehimage);
13935 define("CompositorNode", "CompositorNodeBoxMask", def_cmp_boxmask);
13936 define("CompositorNode", "CompositorNodeBrightContrast", def_cmp_brightcontrast);
13937 define("CompositorNode", "CompositorNodeChannelMatte", def_cmp_channel_matte);
13938 define("CompositorNode", "CompositorNodeChromaMatte", def_cmp_chroma_matte);
13939 define("CompositorNode", "CompositorNodeColorBalance", def_cmp_colorbalance);
13940 define("CompositorNode", "CompositorNodeColorCorrection", def_cmp_colorcorrection);
13941 define("CompositorNode", "CompositorNodeColorMatte", def_cmp_color_matte);
13942 define("CompositorNode", "CompositorNodeColorSpill", def_cmp_color_spill);
13943 define("CompositorNode", "CompositorNodeCombHSVA");
13944 define("CompositorNode", "CompositorNodeCombineColor", def_cmp_combsep_color);
13945 define("CompositorNode", "CompositorNodeCombineXYZ");
13946 define("CompositorNode", "CompositorNodeCombRGBA");
13947 define("CompositorNode", "CompositorNodeCombYCCA", def_cmp_ycc);
13948 define("CompositorNode", "CompositorNodeCombYUVA");
13949 define("CompositorNode", "CompositorNodeComposite", def_cmp_composite);
13950 define("CompositorNode", "CompositorNodeConvertColorSpace", def_cmp_convert_color_space);
13951 define("CompositorNode", "CompositorNodeCornerPin", def_cmp_cornerpin);
13952 define("CompositorNode", "CompositorNodeCrop", def_cmp_crop);
13953 define("CompositorNode", "CompositorNodeCryptomatte", def_cmp_cryptomatte_legacy);
13954 define("CompositorNode", "CompositorNodeCryptomatteV2", def_cmp_cryptomatte);
13955 define("CompositorNode", "CompositorNodeCurveRGB", def_rgb_curve);
13956 define("CompositorNode", "CompositorNodeCurveVec", def_vector_curve);
13957 define("CompositorNode", "CompositorNodeDBlur", def_cmp_dblur);
13958 define("CompositorNode", "CompositorNodeDefocus", def_cmp_defocus);
13959 define("CompositorNode", "CompositorNodeDenoise", def_cmp_denoise);
13960 define("CompositorNode", "CompositorNodeDespeckle", def_cmp_despeckle);
13961 define("CompositorNode", "CompositorNodeDiffMatte", def_cmp_diff_matte);
13962 define("CompositorNode", "CompositorNodeDilateErode", def_cmp_dilate_erode);
13963 define("CompositorNode", "CompositorNodeDisplace");
13964 define("CompositorNode", "CompositorNodeDistanceMatte", def_cmp_distance_matte);
13965 define("CompositorNode", "CompositorNodeDoubleEdgeMask", def_cmp_double_edge_mask);
13966 define("CompositorNode", "CompositorNodeEllipseMask", def_cmp_ellipsemask);
13967 define("CompositorNode", "CompositorNodeExposure");
13968 define("CompositorNode", "CompositorNodeFilter", def_cmp_filter);
13969 define("CompositorNode", "CompositorNodeFlip", def_cmp_flip);
13970 define("CompositorNode", "CompositorNodeGamma");
13971 define("CompositorNode", "CompositorNodeGlare", def_cmp_glare);
13972 define("CompositorNode", "CompositorNodeHueCorrect", def_cmp_huecorrect);
13973 define("CompositorNode", "CompositorNodeHueSat");
13974 define("CompositorNode", "CompositorNodeIDMask", def_cmp_id_mask);
13975 define("CompositorNode", "CompositorNodeImage", def_cmp_image);
13976 define("CompositorNode", "CompositorNodeImageCoordinates");
13977 define("CompositorNode", "CompositorNodeImageInfo");
13978 define("CompositorNode", "CompositorNodeInpaint", def_cmp_inpaint);
13979 define("CompositorNode", "CompositorNodeInvert", def_cmp_invert);
13980 define("CompositorNode", "CompositorNodeKeying", def_cmp_keying);
13981 define("CompositorNode", "CompositorNodeKeyingScreen", def_cmp_keyingscreen);
13982 define("CompositorNode", "CompositorNodeKuwahara", def_cmp_kuwahara);
13983 define("CompositorNode", "CompositorNodeLensdist", def_cmp_lensdist);
13984 define("CompositorNode", "CompositorNodeLevels", def_cmp_levels);
13985 define("CompositorNode", "CompositorNodeLumaMatte", def_cmp_luma_matte);
13986 define("CompositorNode", "CompositorNodeMapRange", def_cmp_map_range);
13987 define("CompositorNode", "CompositorNodeMapUV", def_cmp_map_uv);
13988 define("CompositorNode", "CompositorNodeMapValue", def_cmp_map_value);
13989 define("CompositorNode", "CompositorNodeMask", def_cmp_mask);
13990 define("CompositorNode", "CompositorNodeMath", def_math);
13991 define("CompositorNode", "CompositorNodeMixRGB", def_mix_rgb);
13992 define("CompositorNode", "CompositorNodeMovieClip", def_cmp_movieclip);
13993 define("CompositorNode", "CompositorNodeMovieDistortion", def_cmp_moviedistortion);
13994 define("CompositorNode", "CompositorNodeNormal");
13995 define("CompositorNode", "CompositorNodeNormalize");
13996 define("CompositorNode", "CompositorNodeOutputFile", def_cmp_output_file);
13997 define("CompositorNode", "CompositorNodePixelate", def_cmp_pixelate);
13998 define("CompositorNode", "CompositorNodePlaneTrackDeform", def_cmp_planetrackdeform);
13999 define("CompositorNode", "CompositorNodePosterize");
14000 define("CompositorNode", "CompositorNodePremulKey", def_cmp_premul_key);
14001 define("CompositorNode", "CompositorNodeRelativeToPixel");
14002 define("CompositorNode", "CompositorNodeRGB");
14003 define("CompositorNode", "CompositorNodeRGBToBW");
14004 define("CompositorNode", "CompositorNodeRLayers", def_cmp_render_layers);
14005 define("CompositorNode", "CompositorNodeRotate", def_cmp_rotate);
14006 define("CompositorNode", "CompositorNodeScale", def_cmp_scale);
14007 define("CompositorNode", "CompositorNodeSceneTime");
14008 define("CompositorNode", "CompositorNodeSeparateColor", def_cmp_combsep_color);
14009 define("CompositorNode", "CompositorNodeSeparateXYZ");
14010 define("CompositorNode", "CompositorNodeSepHSVA");
14011 define("CompositorNode", "CompositorNodeSepRGBA");
14012 define("CompositorNode", "CompositorNodeSepYCCA", def_cmp_ycc);
14013 define("CompositorNode", "CompositorNodeSepYUVA");
14014 define("CompositorNode", "CompositorNodeSetAlpha", def_cmp_set_alpha);
14015 define("CompositorNode", "CompositorNodeSplit", def_cmp_split);
14016 define("CompositorNode", "CompositorNodeStabilize", def_cmp_stabilize2d);
14017 define("CompositorNode", "CompositorNodeSunBeams", def_cmp_sunbeams);
14018 define("CompositorNode", "CompositorNodeSwitch", def_cmp_switch);
14019 define("CompositorNode", "CompositorNodeSwitchView", def_cmp_switch_view);
14020 define("CompositorNode", "CompositorNodeTexture", def_texture);
14021 define("CompositorNode", "CompositorNodeTime", def_time);
14022 define("CompositorNode", "CompositorNodeTonemap", def_cmp_tonemap);
14023 define("CompositorNode", "CompositorNodeTrackPos", def_cmp_trackpos);
14024 define("CompositorNode", "CompositorNodeTransform", dev_cmd_transform);
14025 define("CompositorNode", "CompositorNodeTranslate", def_cmp_translate);
14026 define("CompositorNode", "CompositorNodeValToRGB", def_colorramp);
14027 define("CompositorNode", "CompositorNodeValue");
14028 define("CompositorNode", "CompositorNodeVecBlur", def_cmp_vector_blur);
14029 define("CompositorNode", "CompositorNodeViewer", def_cmp_viewer);
14030 define("CompositorNode", "CompositorNodeZcombine", def_cmp_zcombine);
14031
14032 define("TextureNode", "TextureNodeAt");
14033 define("TextureNode", "TextureNodeBricks", def_tex_bricks);
14034 define("TextureNode", "TextureNodeChecker");
14035 define("TextureNode", "TextureNodeCombineColor", def_tex_combsep_color);
14036 define("TextureNode", "TextureNodeCompose");
14037 define("TextureNode", "TextureNodeCoordinates");
14038 define("TextureNode", "TextureNodeCurveRGB", def_rgb_curve);
14039 define("TextureNode", "TextureNodeCurveTime", def_time);
14040 define("TextureNode", "TextureNodeDecompose");
14041 define("TextureNode", "TextureNodeDistance");
14042 define("TextureNode", "TextureNodeHueSaturation");
14043 define("TextureNode", "TextureNodeImage", def_tex_image);
14044 define("TextureNode", "TextureNodeInvert");
14045 define("TextureNode", "TextureNodeMath", def_math);
14046 define("TextureNode", "TextureNodeMixRGB", def_mix_rgb);
14047 define("TextureNode", "TextureNodeOutput", def_tex_output);
14048 define("TextureNode", "TextureNodeRGBToBW");
14049 define("TextureNode", "TextureNodeRotate");
14050 define("TextureNode", "TextureNodeScale");
14051 define("TextureNode", "TextureNodeSeparateColor", def_tex_combsep_color);
14052 define("TextureNode", "TextureNodeTexBlend");
14053 define("TextureNode", "TextureNodeTexClouds");
14054 define("TextureNode", "TextureNodeTexDistNoise");
14055 define("TextureNode", "TextureNodeTexMagic");
14056 define("TextureNode", "TextureNodeTexMarble");
14057 define("TextureNode", "TextureNodeTexMusgrave");
14058 define("TextureNode", "TextureNodeTexNoise");
14059 define("TextureNode", "TextureNodeTexStucci");
14060 define("TextureNode", "TextureNodeTexture", def_texture);
14061 define("TextureNode", "TextureNodeTexVoronoi");
14062 define("TextureNode", "TextureNodeTexWood");
14063 define("TextureNode", "TextureNodeTranslate");
14064 define("TextureNode", "TextureNodeValToNor");
14065 define("TextureNode", "TextureNodeValToRGB", def_colorramp);
14066 define("TextureNode", "TextureNodeViewer");
14067
14068 define("FunctionNode", "FunctionNodeAlignEulerToVector");
14069 define("FunctionNode", "FunctionNodeAlignRotationToVector");
14070 define("FunctionNode", "FunctionNodeAxesToRotation");
14071 define("FunctionNode", "FunctionNodeAxisAngleToRotation");
14072 define("FunctionNode", "FunctionNodeBitMath");
14073 define("FunctionNode", "FunctionNodeBooleanMath");
14074 define("FunctionNode", "FunctionNodeCombineColor");
14075 define("FunctionNode", "FunctionNodeCombineMatrix");
14076 define("FunctionNode", "FunctionNodeCombineTransform");
14077 define("FunctionNode", "FunctionNodeCompare");
14078 define("FunctionNode", "FunctionNodeEulerToRotation");
14079 define("FunctionNode", "FunctionNodeFindInString");
14080 define("FunctionNode", "FunctionNodeFloatToInt", def_float_to_int);
14081 define("FunctionNode", "FunctionNodeFormatString", def_fn_format_string);
14082 define("FunctionNode", "FunctionNodeHashValue");
14083 define("FunctionNode", "FunctionNodeInputBool", def_fn_input_bool);
14084 define("FunctionNode", "FunctionNodeInputColor", def_fn_input_color);
14085 define("FunctionNode", "FunctionNodeInputInt", def_fn_input_int);
14086 define("FunctionNode", "FunctionNodeInputRotation", def_fn_input_rotation);
14087 define("FunctionNode", "FunctionNodeInputSpecialCharacters");
14088 define("FunctionNode", "FunctionNodeInputString", def_fn_input_string);
14089 define("FunctionNode", "FunctionNodeInputVector", def_fn_input_vector);
14090 define("FunctionNode", "FunctionNodeIntegerMath");
14091 define("FunctionNode", "FunctionNodeInvertMatrix");
14092 define("FunctionNode", "FunctionNodeInvertRotation");
14093 define("FunctionNode", "FunctionNodeMatchString");
14094 define("FunctionNode", "FunctionNodeMatrixDeterminant");
14095 define("FunctionNode", "FunctionNodeMatrixMultiply");
14096 define("FunctionNode", "FunctionNodeProjectPoint");
14097 define("FunctionNode", "FunctionNodeQuaternionToRotation");
14098 define("FunctionNode", "FunctionNodeRandomValue", def_fn_random_value);
14099 define("FunctionNode", "FunctionNodeReplaceString");
14100 define("FunctionNode", "FunctionNodeRotateEuler", def_fn_rotate_euler);
14101 define("FunctionNode", "FunctionNodeRotateRotation");
14102 define("FunctionNode", "FunctionNodeRotateVector");
14103 define("FunctionNode", "FunctionNodeRotationToAxisAngle");
14104 define("FunctionNode", "FunctionNodeRotationToEuler");
14105 define("FunctionNode", "FunctionNodeRotationToQuaternion");
14106 define("FunctionNode", "FunctionNodeSeparateColor");
14107 define("FunctionNode", "FunctionNodeSeparateMatrix");
14108 define("FunctionNode", "FunctionNodeSeparateTransform");
14109 define("FunctionNode", "FunctionNodeSliceString");
14110 define("FunctionNode", "FunctionNodeStringLength");
14111 define("FunctionNode", "FunctionNodeTransformDirection");
14112 define("FunctionNode", "FunctionNodeTransformPoint");
14113 define("FunctionNode", "FunctionNodeTransposeMatrix");
14114 define("FunctionNode", "FunctionNodeValueToString");
14115
14116 define("GeometryNode", "GeometryNodeAccumulateField");
14117 define("GeometryNode", "GeometryNodeAttributeDomainSize");
14118 define("GeometryNode", "GeometryNodeAttributeStatistic");
14119 define("GeometryNode", "GeometryNodeBake", rna_def_geo_bake);
14120 define("GeometryNode", "GeometryNodeBlurAttribute");
14121 define("GeometryNode", "GeometryNodeBoundBox");
14122 define("GeometryNode", "GeometryNodeCameraInfo");
14123 define("GeometryNode", "GeometryNodeCaptureAttribute", rna_def_geo_capture_attribute);
14124 define("GeometryNode", "GeometryNodeClosureInput", def_geo_closure_input);
14125 define("GeometryNode", "GeometryNodeClosureOutput", def_geo_closure_output);
14126 define("GeometryNode", "GeometryNodeCollectionInfo");
14127 define("GeometryNode", "GeometryNodeCombineBundle", rna_def_geo_combine_bundle);
14128 define("GeometryNode", "GeometryNodeConvexHull");
14129 define("GeometryNode", "GeometryNodeCornersOfEdge");
14130 define("GeometryNode", "GeometryNodeCornersOfFace");
14131 define("GeometryNode", "GeometryNodeCornersOfVertex");
14132 define("GeometryNode", "GeometryNodeCurveArc");
14133 define("GeometryNode", "GeometryNodeCurveEndpointSelection");
14134 define("GeometryNode", "GeometryNodeCurveHandleTypeSelection", def_geo_curve_handle_type_selection);
14135 define("GeometryNode", "GeometryNodeCurveLength");
14136 define("GeometryNode", "GeometryNodeCurveOfPoint");
14137 define("GeometryNode", "GeometryNodeCurvePrimitiveBezierSegment");
14138 define("GeometryNode", "GeometryNodeCurvePrimitiveCircle");
14139 define("GeometryNode", "GeometryNodeCurvePrimitiveLine");
14140 define("GeometryNode", "GeometryNodeCurvePrimitiveQuadrilateral");
14141 define("GeometryNode", "GeometryNodeCurveQuadraticBezier");
14142 define("GeometryNode", "GeometryNodeCurveSetHandles", def_geo_curve_set_handle_type);
14143 define("GeometryNode", "GeometryNodeCurveSpiral");
14144 define("GeometryNode", "GeometryNodeCurveSplineType");
14145 define("GeometryNode", "GeometryNodeCurveStar");
14146 define("GeometryNode", "GeometryNodeCurvesToGreasePencil");
14147 define("GeometryNode", "GeometryNodeCurveToMesh");
14148 define("GeometryNode", "GeometryNodeCurveToPoints");
14149 define("GeometryNode", "GeometryNodeDeformCurvesOnSurface");
14150 define("GeometryNode", "GeometryNodeDeleteGeometry");
14151 define("GeometryNode", "GeometryNodeDistributePointsInGrid");
14152 define("GeometryNode", "GeometryNodeDistributePointsInVolume");
14153 define("GeometryNode", "GeometryNodeDistributePointsOnFaces", def_geo_distribute_points_on_faces);
14154 define("GeometryNode", "GeometryNodeDualMesh");
14155 define("GeometryNode", "GeometryNodeDuplicateElements");
14156 define("GeometryNode", "GeometryNodeEdgePathsToCurves");
14157 define("GeometryNode", "GeometryNodeEdgePathsToSelection");
14158 define("GeometryNode", "GeometryNodeEdgesOfCorner");
14159 define("GeometryNode", "GeometryNodeEdgesOfVertex");
14160 define("GeometryNode", "GeometryNodeEdgesToFaceGroups");
14161 define("GeometryNode", "GeometryNodeEvaluateClosure", def_geo_evaluate_closure);
14162 define("GeometryNode", "GeometryNodeExtrudeMesh");
14163 define("GeometryNode", "GeometryNodeFaceOfCorner");
14164 define("GeometryNode", "GeometryNodeFieldAtIndex");
14165 define("GeometryNode", "GeometryNodeFieldAverage");
14166 define("GeometryNode", "GeometryNodeFieldMinAndMax");
14167 define("GeometryNode", "GeometryNodeFieldOnDomain");
14168 define("GeometryNode", "GeometryNodeFieldVariance");
14169 define("GeometryNode", "GeometryNodeFillCurve");
14170 define("GeometryNode", "GeometryNodeFilletCurve");
14171 define("GeometryNode", "GeometryNodeFlipFaces");
14172 define("GeometryNode", "GeometryNodeForeachGeometryElementInput", def_geo_foreach_geometry_element_input);
14173 define("GeometryNode", "GeometryNodeForeachGeometryElementOutput", def_geo_foreach_geometry_element_output);
14174 define("GeometryNode", "GeometryNodeGeometryToInstance");
14175 define("GeometryNode", "GeometryNodeGetNamedGrid");
14176 define("GeometryNode", "GeometryNodeGizmoDial");
14177 define("GeometryNode", "GeometryNodeGizmoLinear");
14178 define("GeometryNode", "GeometryNodeGizmoTransform", rna_def_geo_gizmo_transform);
14179 define("GeometryNode", "GeometryNodeGreasePencilToCurves");
14180 define("GeometryNode", "GeometryNodeGridInfo");
14181 define("GeometryNode", "GeometryNodeGridToMesh");
14182 define("GeometryNode", "GeometryNodeImageInfo");
14183 define("GeometryNode", "GeometryNodeImageTexture", def_geo_image_texture);
14184 define("GeometryNode", "GeometryNodeImportCSV");
14185 define("GeometryNode", "GeometryNodeImportOBJ");
14186 define("GeometryNode", "GeometryNodeImportPLY");
14187 define("GeometryNode", "GeometryNodeImportSTL");
14188 define("GeometryNode", "GeometryNodeImportText");
14189 define("GeometryNode", "GeometryNodeImportVDB");
14190 define("GeometryNode", "GeometryNodeIndexOfNearest");
14191 define("GeometryNode", "GeometryNodeIndexSwitch", def_geo_index_switch);
14192 define("GeometryNode", "GeometryNodeInputActiveCamera");
14193 define("GeometryNode", "GeometryNodeInputCollection", def_geo_input_collection);
14194 define("GeometryNode", "GeometryNodeInputCurveHandlePositions");
14195 define("GeometryNode", "GeometryNodeInputCurveTilt");
14196 define("GeometryNode", "GeometryNodeInputEdgeSmooth");
14197 define("GeometryNode", "GeometryNodeInputID");
14198 define("GeometryNode", "GeometryNodeInputImage", def_geo_image);
14199 define("GeometryNode", "GeometryNodeInputIndex");
14200 define("GeometryNode", "GeometryNodeInputInstanceBounds");
14201 define("GeometryNode", "GeometryNodeInputInstanceRotation");
14202 define("GeometryNode", "GeometryNodeInputInstanceScale");
14203 define("GeometryNode", "GeometryNodeInputMaterial", def_geo_input_material);
14204 define("GeometryNode", "GeometryNodeInputMaterialIndex");
14205 define("GeometryNode", "GeometryNodeInputMeshEdgeAngle");
14206 define("GeometryNode", "GeometryNodeInputMeshEdgeNeighbors");
14207 define("GeometryNode", "GeometryNodeInputMeshEdgeVertices");
14208 define("GeometryNode", "GeometryNodeInputMeshFaceArea");
14209 define("GeometryNode", "GeometryNodeInputMeshFaceIsPlanar");
14210 define("GeometryNode", "GeometryNodeInputMeshFaceNeighbors");
14211 define("GeometryNode", "GeometryNodeInputMeshIsland");
14212 define("GeometryNode", "GeometryNodeInputMeshVertexNeighbors");
14213 define("GeometryNode", "GeometryNodeInputNamedAttribute");
14214 define("GeometryNode", "GeometryNodeInputNamedLayerSelection");
14215 define("GeometryNode", "GeometryNodeInputNormal", def_geo_input_normal);
14216 define("GeometryNode", "GeometryNodeInputObject", def_geo_input_object);
14217 define("GeometryNode", "GeometryNodeInputPosition");
14218 define("GeometryNode", "GeometryNodeInputRadius");
14219 define("GeometryNode", "GeometryNodeInputSceneTime");
14220 define("GeometryNode", "GeometryNodeInputShadeSmooth");
14221 define("GeometryNode", "GeometryNodeInputShortestEdgePaths");
14222 define("GeometryNode", "GeometryNodeInputSplineCyclic");
14223 define("GeometryNode", "GeometryNodeInputSplineResolution");
14224 define("GeometryNode", "GeometryNodeInputTangent");
14225 define("GeometryNode", "GeometryNodeInstanceOnPoints");
14226 define("GeometryNode", "GeometryNodeInstancesToPoints");
14227 define("GeometryNode", "GeometryNodeInstanceTransform");
14228 define("GeometryNode", "GeometryNodeInterpolateCurves");
14229 define("GeometryNode", "GeometryNodeIsViewport");
14230 define("GeometryNode", "GeometryNodeJoinGeometry");
14231 define("GeometryNode", "GeometryNodeMaterialSelection");
14232 define("GeometryNode", "GeometryNodeMenuSwitch", def_geo_menu_switch);
14233 define("GeometryNode", "GeometryNodeMergeByDistance");
14234 define("GeometryNode", "GeometryNodeMergeLayers");
14235 define("GeometryNode", "GeometryNodeMeshBoolean");
14236 define("GeometryNode", "GeometryNodeMeshCircle");
14237 define("GeometryNode", "GeometryNodeMeshCone");
14238 define("GeometryNode", "GeometryNodeMeshCube");
14239 define("GeometryNode", "GeometryNodeMeshCylinder");
14240 define("GeometryNode", "GeometryNodeMeshFaceSetBoundaries");
14241 define("GeometryNode", "GeometryNodeMeshGrid");
14242 define("GeometryNode", "GeometryNodeMeshIcoSphere");
14243 define("GeometryNode", "GeometryNodeMeshLine");
14244 define("GeometryNode", "GeometryNodeMeshToCurve");
14245 define("GeometryNode", "GeometryNodeMeshToDensityGrid");
14246 define("GeometryNode", "GeometryNodeMeshToPoints");
14247 define("GeometryNode", "GeometryNodeMeshToSDFGrid");
14248 define("GeometryNode", "GeometryNodeMeshToVolume");
14249 define("GeometryNode", "GeometryNodeMeshUVSphere");
14250 define("GeometryNode", "GeometryNodeObjectInfo");
14251 define("GeometryNode", "GeometryNodeOffsetCornerInFace");
14252 define("GeometryNode", "GeometryNodeOffsetPointInCurve");
14253 define("GeometryNode", "GeometryNodePoints");
14254 define("GeometryNode", "GeometryNodePointsOfCurve");
14255 define("GeometryNode", "GeometryNodePointsToCurves");
14256 define("GeometryNode", "GeometryNodePointsToSDFGrid");
14257 define("GeometryNode", "GeometryNodePointsToVertices");
14258 define("GeometryNode", "GeometryNodePointsToVolume");
14259 define("GeometryNode", "GeometryNodeProximity");
14260 define("GeometryNode", "GeometryNodeRaycast");
14261 define("GeometryNode", "GeometryNodeRealizeInstances");
14262 define("GeometryNode", "GeometryNodeRemoveAttribute");
14263 define("GeometryNode", "GeometryNodeRepeatInput", def_geo_repeat_input);
14264 define("GeometryNode", "GeometryNodeRepeatOutput", def_geo_repeat_output);
14265 define("GeometryNode", "GeometryNodeReplaceMaterial");
14266 define("GeometryNode", "GeometryNodeResampleCurve");
14267 define("GeometryNode", "GeometryNodeReverseCurve");
14268 define("GeometryNode", "GeometryNodeRotateInstances");
14269 define("GeometryNode", "GeometryNodeSampleCurve", def_geo_curve_sample);
14270 define("GeometryNode", "GeometryNodeSampleGrid");
14271 define("GeometryNode", "GeometryNodeSampleGridIndex");
14272 define("GeometryNode", "GeometryNodeSampleIndex", def_geo_sample_index);
14273 define("GeometryNode", "GeometryNodeSampleNearest");
14274 define("GeometryNode", "GeometryNodeSampleNearestSurface");
14275 define("GeometryNode", "GeometryNodeSampleUVSurface");
14276 define("GeometryNode", "GeometryNodeScaleElements");
14277 define("GeometryNode", "GeometryNodeScaleInstances");
14278 define("GeometryNode", "GeometryNodeSDFGridBoolean");
14279 define("GeometryNode", "GeometryNodeSelfObject");
14280 define("GeometryNode", "GeometryNodeSeparateBundle", rna_def_geo_separate_bundle);
14281 define("GeometryNode", "GeometryNodeSeparateComponents");
14282 define("GeometryNode", "GeometryNodeSeparateGeometry");
14283 define("GeometryNode", "GeometryNodeSetCurveHandlePositions");
14284 define("GeometryNode", "GeometryNodeSetCurveNormal");
14285 define("GeometryNode", "GeometryNodeSetCurveRadius");
14286 define("GeometryNode", "GeometryNodeSetCurveTilt");
14287 define("GeometryNode", "GeometryNodeSetGeometryName");
14288 define("GeometryNode", "GeometryNodeSetGreasePencilColor");
14289 define("GeometryNode", "GeometryNodeSetGreasePencilDepth");
14290 define("GeometryNode", "GeometryNodeSetGreasePencilSoftness");
14291 define("GeometryNode", "GeometryNodeSetID");
14292 define("GeometryNode", "GeometryNodeSetInstanceTransform");
14293 define("GeometryNode", "GeometryNodeSetMaterial");
14294 define("GeometryNode", "GeometryNodeSetMaterialIndex");
14295 define("GeometryNode", "GeometryNodeSetMeshNormal");
14296 define("GeometryNode", "GeometryNodeSetPointRadius");
14297 define("GeometryNode", "GeometryNodeSetPosition");
14298 define("GeometryNode", "GeometryNodeSetShadeSmooth");
14299 define("GeometryNode", "GeometryNodeSetSplineCyclic");
14300 define("GeometryNode", "GeometryNodeSetSplineResolution");
14301 define("GeometryNode", "GeometryNodeSimulationInput", def_geo_simulation_input);
14302 define("GeometryNode", "GeometryNodeSimulationOutput", def_geo_simulation_output);
14303 define("GeometryNode", "GeometryNodeSortElements");
14304 define("GeometryNode", "GeometryNodeSplineLength");
14305 define("GeometryNode", "GeometryNodeSplineParameter");
14306 define("GeometryNode", "GeometryNodeSplitEdges");
14307 define("GeometryNode", "GeometryNodeSplitToInstances");
14308 define("GeometryNode", "GeometryNodeStoreNamedAttribute");
14309 define("GeometryNode", "GeometryNodeStoreNamedGrid");
14310 define("GeometryNode", "GeometryNodeStringJoin");
14311 define("GeometryNode", "GeometryNodeStringToCurves", def_geo_string_to_curves);
14312 define("GeometryNode", "GeometryNodeSubdivideCurve");
14313 define("GeometryNode", "GeometryNodeSubdivideMesh");
14314 define("GeometryNode", "GeometryNodeSubdivisionSurface");
14315 define("GeometryNode", "GeometryNodeSwitch");
14316 define("GeometryNode", "GeometryNodeTool3DCursor");
14317 define("GeometryNode", "GeometryNodeToolActiveElement");
14318 define("GeometryNode", "GeometryNodeToolFaceSet");
14319 define("GeometryNode", "GeometryNodeToolMousePosition");
14320 define("GeometryNode", "GeometryNodeToolSelection");
14321 define("GeometryNode", "GeometryNodeToolSetFaceSet");
14322 define("GeometryNode", "GeometryNodeToolSetSelection");
14323 define("GeometryNode", "GeometryNodeTransform");
14324 define("GeometryNode", "GeometryNodeTranslateInstances");
14325 define("GeometryNode", "GeometryNodeTriangulate");
14326 define("GeometryNode", "GeometryNodeTrimCurve");
14327 define("GeometryNode", "GeometryNodeUVPackIslands");
14328 define("GeometryNode", "GeometryNodeUVUnwrap");
14329 define("GeometryNode", "GeometryNodeVertexOfCorner");
14330 define("GeometryNode", "GeometryNodeViewer");
14331 define("GeometryNode", "GeometryNodeViewportTransform");
14332 define("GeometryNode", "GeometryNodeVolumeCube");
14333 define("GeometryNode", "GeometryNodeVolumeToMesh");
14334 define("GeometryNode", "GeometryNodeWarning");
14335
14336
14337 /* Node group types are currently defined for each tree type individually. */
14338 define("ShaderNode", "ShaderNodeGroup", def_group);
14339 define("CompositorNode", "CompositorNodeGroup", def_group);
14340 define("TextureNode", "TextureNodeGroup", def_group);
14341 define("GeometryNode", "GeometryNodeGroup", def_group);
14342
14343 /* clang-format on */
14344}
14345
14347{
14348 rna_def_node(brna);
14349 rna_def_node_link(brna);
14350
14352 rna_def_shader_node(brna);
14357
14358 rna_def_nodetree(brna);
14359
14364
14365 rna_def_nodes(brna);
14366
14367 def_custom_group(brna,
14368 "ShaderNodeCustomGroup",
14369 "ShaderNode",
14370 "Shader Custom Group",
14371 "Custom Shader Group Node for Python nodes",
14372 "rna_ShaderNodeCustomGroup_register");
14373 def_custom_group(brna,
14374 "CompositorNodeCustomGroup",
14375 "CompositorNode",
14376 "Compositor Custom Group",
14377 "Custom Compositor Group Node for Python nodes",
14378 "rna_CompositorNodeCustomGroup_register");
14379 def_custom_group(brna,
14380 "NodeCustomGroup",
14381 "Node",
14382 "Custom Group",
14383 "Base node type for custom registered node group types",
14384 "rna_NodeCustomGroup_register");
14385 def_custom_group(brna,
14386 "GeometryNodeCustomGroup",
14387 "GeometryNode",
14388 "Geometry Custom Group",
14389 "Custom Geometry Group Node for Python nodes",
14390 "rna_GeometryNodeCustomGroup_register");
14391
14393}
14394
14395/* clean up macro definition */
14396# undef NODE_DEFINE_SUBTYPES
14397
14398#endif
void BKE_animdata_fix_paths_rename_all(struct ID *ref_id, const char *prefix, const char *oldName, const char *newName)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
void BKE_cryptomatte_matte_id_to_entries(struct NodeCryptomatte *node_storage, const char *matte_id)
char * BKE_cryptomatte_entries_to_matte_id(struct NodeCryptomatte *node_storage)
RenderPass * BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
#define IMA_SIGNAL_SRC_CHANGE
Definition BKE_image.hh:164
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
void id_us_plus(ID *id)
Definition lib_id.cc:353
void id_us_min(ID *id)
Definition lib_id.cc:361
const char * BKE_main_blendfile_path_from_global()
Definition main.cc:877
void BKE_main_ensure_invariants(Main &bmain, std::optional< blender::Span< ID * > > modified_ids=std::nullopt)
#define NODE_CLASS_OUTPUT
Definition BKE_node.hh:434
#define NODE_UNDEFINED
Definition BKE_node.hh:794
constexpr int GROUP_NODE_MIN_WIDTH
Definition BKE_node.hh:1228
#define NODE_CLASS_INTERFACE
Definition BKE_node.hh:445
constexpr int GROUP_NODE_DEFAULT_WIDTH
Definition BKE_node.hh:1226
#define NODE_CUSTOM_GROUP
Definition BKE_node.hh:801
#define NODE_CLASS_MATTE
Definition BKE_node.hh:440
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:439
constexpr int GROUP_NODE_MAX_WIDTH
Definition BKE_node.hh:1227
#define NODE_CUSTOM
Definition BKE_node.hh:795
#define NODE_CLASS_PATTERN
Definition BKE_node.hh:442
#define NODE_CLASS_GEOMETRY
Definition BKE_node.hh:447
#define NODE_CLASS_DISTORT
Definition BKE_node.hh:441
#define NODE_CLASS_OP_VECTOR
Definition BKE_node.hh:436
#define NODE_CLASS_LAYOUT
Definition BKE_node.hh:449
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:435
#define NODE_CLASS_INPUT
Definition BKE_node.hh:433
#define NODE_CLASS_OP_FILTER
Definition BKE_node.hh:437
#define NODE_CLASS_GROUP
Definition BKE_node.hh:438
#define NODE_CLASS_ATTRIBUTE
Definition BKE_node.hh:448
#define NODE_CLASS_TEXTURE
Definition BKE_node.hh:443
#define NODE_CLASS_SHADER
Definition BKE_node.hh:446
#define NODE_CLASS_SCRIPT
Definition BKE_node.hh:444
#define SH_NODE_TEX_IMAGE
#define CMP_NODE_CRYPTOMATTE
#define FN_NODE_RANDOM_VALUE
#define SH_NODE_MAP_RANGE
#define SH_NODE_TEX_ENVIRONMENT
#define FN_NODE_COMPARE
#define CMP_NODE_OUTPUT_FILE
#define SH_NODE_MIX
#define SH_NODE_SCRIPT
void BKE_ntree_update_tag_active_output_changed(bNodeTree *ntree)
void BKE_ntree_update_tag_all(bNodeTree *ntree)
void BKE_ntree_update_tag_link_changed(bNodeTree *ntree)
void BKE_ntree_update_tag_node_property(bNodeTree *ntree, bNode *node)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain)
Definition scene.cc:2623
void BKE_texture_pointdensity_init_data(struct PointDensity *pd)
Definition texture.cc:591
void BKE_texture_pointdensity_free_data(struct PointDensity *pd)
Definition texture.cc:642
void BLF_cache_clear()
Definition blf.cc:98
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
void BLI_kdtree_nd_ free(KDTree *tree)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:534
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:332
int BLI_listbase_count_at_most(const ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:511
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:371
#define DEG2RADF(_deg)
#define M_PI_2
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void zero_v3(float r[3])
#define BLI_SCOPED_DEFER(function_to_defer)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Definition string.cc:41
#define SNPRINTF(dst, format,...)
Definition BLI_string.h:599
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:688
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
#define CLAMP(a, b, c)
#define STREQLEN(a, b, n)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
#define CTX_N_(context, msgid)
#define BLT_I18NCONTEXT_ID_NODETREE
#define BLT_I18NCONTEXT_ID_IMAGE
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define BLT_I18NCONTEXT_UNIT
#define BLT_I18NCONTEXT_ID_MOVIECLIP
#define BLT_I18NCONTEXT_ID_TEXTURE
#define BLT_I18NCONTEXT_EDITOR_FILEBROWSER
#define BLT_I18NCONTEXT_COLOR
void DEG_id_tag_update_for_side_effect_request(Depsgraph *depsgraph, ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
bool DEG_is_original(const T *id)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ ID_RECALC_NTREE_OUTPUT
Definition DNA_ID.h:1063
@ CD_PROP_BYTE_COLOR
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
@ CD_PROP_COLOR
@ CD_PROP_QUATERNION
@ CD_PROP_INT32
@ CD_PROP_FLOAT2
@ CD_PROP_FLOAT4X4
@ IMA_SRC_FILE
@ IMA_SRC_MOVIE
@ IMA_SRC_GENERATED
@ IMA_SRC_SEQUENCE
@ IMA_ANIM_ALWAYS
@ IMA_TYPE_MULTILAYER
@ NODE_OPTIONS
@ NODE_DO_OUTPUT
@ NODE_HIDDEN
@ NODE_ACTIVE_TEXTURE
@ NODE_CUSTOM_COLOR
@ NODE_MUTED
@ NODE_PREVIEW
@ NODE_VECTOR_MATH_NORMALIZE
@ NODE_VECTOR_MATH_LENGTH
@ NODE_VECTOR_MATH_SIGN
@ NODE_VECTOR_MATH_CROSS_PRODUCT
@ NODE_VECTOR_MATH_CEIL
@ NODE_VECTOR_MATH_MODULO
@ NODE_VECTOR_MATH_ADD
@ NODE_VECTOR_MATH_COSINE
@ NODE_VECTOR_MATH_REFLECT
@ NODE_VECTOR_MATH_WRAP
@ NODE_VECTOR_MATH_REFRACT
@ NODE_VECTOR_MATH_POWER
@ NODE_VECTOR_MATH_DOT_PRODUCT
@ NODE_VECTOR_MATH_ABSOLUTE
@ NODE_VECTOR_MATH_DIVIDE
@ NODE_VECTOR_MATH_TANGENT
@ NODE_VECTOR_MATH_DISTANCE
@ NODE_VECTOR_MATH_FLOOR
@ NODE_VECTOR_MATH_SNAP
@ NODE_VECTOR_MATH_SINE
@ NODE_VECTOR_MATH_FRACTION
@ NODE_VECTOR_MATH_PROJECT
@ NODE_VECTOR_MATH_MULTIPLY
@ NODE_VECTOR_MATH_SCALE
@ NODE_VECTOR_MATH_MAXIMUM
@ NODE_VECTOR_MATH_FACEFORWARD
@ NODE_VECTOR_MATH_SUBTRACT
@ NODE_VECTOR_MATH_MULTIPLY_ADD
@ NODE_VECTOR_MATH_MINIMUM
@ CMP_NODE_INTERPOLATION_NEAREST
@ CMP_NODE_INTERPOLATION_BILINEAR
@ CMP_NODE_INTERPOLATION_BICUBIC
@ GEO_NODE_MESH_CIRCLE_FILL_NGON
@ GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN
@ GEO_NODE_MESH_CIRCLE_FILL_NONE
@ SHD_WAVE_RINGS
@ SHD_WAVE_BANDS
@ CMP_NODE_COMBSEP_COLOR_YCC
@ CMP_NODE_COMBSEP_COLOR_YUV
@ CMP_NODE_COMBSEP_COLOR_RGB
@ CMP_NODE_COMBSEP_COLOR_HSV
@ CMP_NODE_COMBSEP_COLOR_HSL
@ SHD_MATH_CLAMP
@ NODE_VECTOR_ROTATE_TYPE_AXIS
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Z
@ NODE_VECTOR_ROTATE_TYPE_AXIS_X
@ NODE_VECTOR_ROTATE_TYPE_EULER_XYZ
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Y
#define SHD_SHEEN_ASHIKHMIN
@ SHD_VORONOI_EUCLIDEAN
@ SHD_VORONOI_CHEBYCHEV
@ SHD_VORONOI_MANHATTAN
@ SHD_VORONOI_MINKOWSKI
@ SHD_PRINCIPLED_HAIR_REFLECTANCE
@ SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION
@ SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION
@ SHD_SPACE_BLENDER_OBJECT
@ SHD_SPACE_OBJECT
@ SHD_SPACE_TANGENT
@ SHD_SPACE_WORLD
@ SHD_SPACE_BLENDER_WORLD
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_TEXTURE
@ NODE_MAPPING_TYPE_NORMAL
@ NTREE_TEXTURE
@ NTREE_CUSTOM
@ NTREE_SHADER
@ NTREE_GEOMETRY
@ NTREE_COMPOSIT
@ NTREE_UNDEFINED
@ GEO_NODE_STRING_TO_CURVES_ALIGN_X_CENTER
@ GEO_NODE_STRING_TO_CURVES_ALIGN_X_JUSTIFY
@ GEO_NODE_STRING_TO_CURVES_ALIGN_X_FLUSH
@ GEO_NODE_STRING_TO_CURVES_ALIGN_X_LEFT
@ GEO_NODE_STRING_TO_CURVES_ALIGN_X_RIGHT
@ NTREE_VIEWER_BORDER
@ NODE_MATH_SINH
@ NODE_MATH_SMOOTH_MIN
@ NODE_MATH_TRUNC
@ NODE_MATH_COSH
@ NODE_MATH_SIGN
@ NODE_MATH_DEGREES
@ NODE_MATH_MODULO
@ NODE_MATH_ABSOLUTE
@ NODE_MATH_DIVIDE
@ NODE_MATH_SINE
@ NODE_MATH_FLOORED_MODULO
@ NODE_MATH_ARCTAN2
@ NODE_MATH_ARCCOSINE
@ NODE_MATH_MULTIPLY_ADD
@ NODE_MATH_POWER
@ NODE_MATH_WRAP
@ NODE_MATH_ARCTANGENT
@ NODE_MATH_MINIMUM
@ NODE_MATH_SQRT
@ NODE_MATH_CEIL
@ NODE_MATH_TANH
@ NODE_MATH_GREATER_THAN
@ NODE_MATH_ADD
@ NODE_MATH_FRACTION
@ NODE_MATH_EXPONENT
@ NODE_MATH_LESS_THAN
@ NODE_MATH_ARCSINE
@ NODE_MATH_MAXIMUM
@ NODE_MATH_LOGARITHM
@ NODE_MATH_COMPARE
@ NODE_MATH_INV_SQRT
@ NODE_MATH_MULTIPLY
@ NODE_MATH_PINGPONG
@ NODE_MATH_ROUND
@ NODE_MATH_FLOOR
@ NODE_MATH_SUBTRACT
@ NODE_MATH_COSINE
@ NODE_MATH_SNAP
@ NODE_MATH_TANGENT
@ NODE_MATH_SMOOTH_MAX
@ NODE_MATH_RADIANS
GeometryNodeAssetTraitFlag
@ GEO_NODE_ASSET_MESH
@ GEO_NODE_ASSET_SCULPT
@ GEO_NODE_ASSET_WAIT_FOR_CURSOR
@ GEO_NODE_ASSET_PAINT
@ GEO_NODE_ASSET_GREASE_PENCIL
@ GEO_NODE_ASSET_CURVE
@ GEO_NODE_ASSET_POINTCLOUD
@ GEO_NODE_ASSET_EDIT
@ GEO_NODE_ASSET_MODIFIER
@ GEO_NODE_ASSET_TOOL
@ GEO_NODE_ASSET_OBJECT
@ SHD_TANGENT_UVMAP
@ SHD_TANGENT_RADIAL
@ SHD_INTERP_LINEAR
@ SHD_INTERP_SMART
@ SHD_INTERP_CUBIC
@ SHD_INTERP_CLOSEST
@ CMP_NODE_OUTPUT_IGNORE_ALPHA
@ NODE_LINK_MUTED
@ NODE_LINK_VALID
@ NODE_FRAME_SHRINK
@ SHD_OUTPUT_CYCLES
@ SHD_OUTPUT_ALL
@ SHD_OUTPUT_EEVEE
@ SHD_GABOR_TYPE_3D
@ SHD_GABOR_TYPE_2D
@ SHD_VORONOI_F2
@ SHD_VORONOI_SMOOTH_F1
@ SHD_VORONOI_DISTANCE_TO_EDGE
@ SHD_VORONOI_F1
@ SHD_VORONOI_N_SPHERE_RADIUS
@ NODE_CLAMP_RANGE
@ NODE_CLAMP_MINMAX
@ GEO_NODE_CURVE_HANDLE_RIGHT
@ GEO_NODE_CURVE_HANDLE_LEFT
@ SHD_POINTDENSITY_SPACE_WORLD
@ SHD_POINTDENSITY_SPACE_OBJECT
@ CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE
@ CMP_NODE_CRYPTOMATTE_SOURCE_RENDER
@ NODE_IES_EXTERNAL
@ NODE_IES_INTERNAL
@ SHD_CONDUCTOR_F82
@ SHD_PHYSICAL_CONDUCTOR
@ CMP_NODE_DILATE_ERODE_STEP
@ CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER
@ CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD
@ CMP_NODE_DILATE_ERODE_DISTANCE
@ CMP_NODE_SCALE_RENDER_SIZE_STRETCH
@ CMP_NODE_SCALE_RENDER_SIZE_FIT
@ CMP_NODE_SCALE_RENDER_SIZE_CROP
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_RIGHT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_CENTER
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_CENTER
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT
@ SHD_WAVE_RINGS_DIRECTION_Z
@ SHD_WAVE_RINGS_DIRECTION_Y
@ SHD_WAVE_RINGS_DIRECTION_X
@ SHD_WAVE_RINGS_DIRECTION_SPHERICAL
@ SHD_TOON_GLOSSY
@ SHD_TOON_DIFFUSE
@ CMP_NODE_DISTANCE_MATTE_COLOR_SPACE_YCCA
@ CMP_NODE_DISTANCE_MATTE_COLOR_SPACE_RGBA
@ CMP_NODE_CORNER_PIN_INTERPOLATION_BILINEAR
@ CMP_NODE_CORNER_PIN_INTERPOLATION_BICUBIC
@ CMP_NODE_CORNER_PIN_INTERPOLATION_ANISOTROPIC
@ CMP_NODE_CORNER_PIN_INTERPOLATION_NEAREST
@ SHD_WAVE_PROFILE_SIN
@ SHD_WAVE_PROFILE_TRI
@ SHD_WAVE_PROFILE_SAW
@ SHD_MIXRGB_USE_ALPHA
@ SHD_MIXRGB_CLAMP
@ FN_NODE_ROTATE_EULER_TYPE_EULER
@ FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE
@ SHD_TANGENT_AXIS_Y
@ SHD_TANGENT_AXIS_X
@ SHD_TANGENT_AXIS_Z
@ CMP_NODE_BLUR_ASPECT_NONE
@ CMP_NODE_BLUR_ASPECT_X
@ CMP_NODE_BLUR_ASPECT_Y
@ CMP_NODE_DENOISE_QUALITY_BALANCED
@ CMP_NODE_DENOISE_QUALITY_FAST
@ CMP_NODE_DENOISE_QUALITY_SCENE
@ CMP_NODE_DENOISE_QUALITY_HIGH
@ CMP_NODE_MAP_UV_FILTERING_NEAREST
@ CMP_NODE_MAP_UV_FILTERING_ANISOTROPIC
@ GEO_NODE_CURVE_SAMPLE_FACTOR
@ GEO_NODE_CURVE_SAMPLE_LENGTH
@ SHD_VECT_TRANSFORM_SPACE_WORLD
@ SHD_VECT_TRANSFORM_SPACE_OBJECT
@ SHD_VECT_TRANSFORM_SPACE_CAMERA
@ CMP_NODE_TRANSLATE_REPEAT_AXIS_XY
@ CMP_NODE_TRANSLATE_REPEAT_AXIS_Y
@ CMP_NODE_TRANSLATE_REPEAT_AXIS_NONE
@ CMP_NODE_TRANSLATE_REPEAT_AXIS_X
@ SHD_VECT_TRANSFORM_TYPE_VECTOR
@ SHD_VECT_TRANSFORM_TYPE_NORMAL
@ SHD_VECT_TRANSFORM_TYPE_POINT
@ GEO_NODE_BAKE_ITEM_IS_ATTRIBUTE
@ CMP_NODE_MASK_FLAG_SIZE_FIXED
@ CMP_NODE_MASK_FLAG_SIZE_FIXED_SCENE
@ GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_RANDOM
@ GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_POISSON
#define SHD_SHEEN_MICROFIBER
eNodeSocketInOut
@ SOCK_OUT
@ SOCK_IN
@ NODE_SCRIPT_AUTO_UPDATE
@ NODE_VIEWER_SHORTCUT_NONE
@ SHD_PROJ_MIRROR_BALL
@ SHD_PROJ_EQUIRECTANGULAR
@ CMP_NODE_SETALPHA_MODE_REPLACE_ALPHA
@ CMP_NODE_SETALPHA_MODE_APPLY
@ NODE_MIX_MODE_UNIFORM
@ NODE_MIX_MODE_NON_UNIFORM
@ GEO_NODE_GIZMO_COLOR_Z
@ GEO_NODE_GIZMO_COLOR_Y
@ GEO_NODE_GIZMO_COLOR_X
@ GEO_NODE_GIZMO_COLOR_PRIMARY
@ GEO_NODE_GIZMO_COLOR_SECONDARY
#define CMP_NODE_MASK_MBLUR_SAMPLES_MAX
@ SOCK_MULTI_INPUT
@ SOCK_HIDDEN
@ SHD_POINTDENSITY_COLOR_PARTSPEED
@ SHD_POINTDENSITY_COLOR_PARTVEL
@ SHD_POINTDENSITY_COLOR_PARTAGE
@ GEO_NODE_STRING_TO_CURVES_ALIGN_Y_BOTTOM_BASELINE
@ GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP_BASELINE
@ GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP
@ GEO_NODE_STRING_TO_CURVES_ALIGN_Y_BOTTOM
@ GEO_NODE_STRING_TO_CURVES_ALIGN_Y_MIDDLE
@ SHD_ATTRIBUTE_VIEW_LAYER
@ SHD_ATTRIBUTE_OBJECT
@ SHD_ATTRIBUTE_GEOMETRY
@ SHD_ATTRIBUTE_INSTANCER
eNodeSocketDatatype
@ SOCK_INT
@ SOCK_TEXTURE
@ SOCK_VECTOR
@ SOCK_CLOSURE
@ SOCK_BOOLEAN
@ SOCK_MATERIAL
@ SOCK_MATRIX
@ SOCK_FLOAT
@ SOCK_IMAGE
@ SOCK_COLLECTION
@ SOCK_CUSTOM
@ SOCK_BUNDLE
@ SOCK_GEOMETRY
@ SOCK_ROTATION
@ SOCK_OBJECT
@ SOCK_STRING
@ SOCK_RGBA
@ SOCK_MENU
@ SHD_PROJ_TUBE
@ SHD_PROJ_SPHERE
@ SHD_PROJ_BOX
@ SHD_PROJ_FLAT
@ CMP_NODE_CHANNEL_MATTE_CS_YUV
@ CMP_NODE_CHANNEL_MATTE_CS_RGB
@ CMP_NODE_CHANNEL_MATTE_CS_HSV
@ CMP_NODE_CHANNEL_MATTE_CS_YCC
@ NODE_COMBSEP_COLOR_RGB
@ NODE_COMBSEP_COLOR_HSV
@ NODE_COMBSEP_COLOR_HSL
@ SHD_WAVE_BANDS_DIRECTION_Y
@ SHD_WAVE_BANDS_DIRECTION_X
@ SHD_WAVE_BANDS_DIRECTION_Z
@ SHD_WAVE_BANDS_DIRECTION_DIAGONAL
@ NODE_MAP_RANGE_STEPPED
@ NODE_MAP_RANGE_SMOOTHERSTEP
@ NODE_MAP_RANGE_SMOOTHSTEP
@ NODE_MAP_RANGE_LINEAR
@ NODE_WARNING_PROPAGATION_NONE
@ NODE_WARNING_PROPAGATION_ONLY_ERRORS_AND_WARNINGS
@ NODE_WARNING_PROPAGATION_ONLY_ERRORS
@ NODE_WARNING_PROPAGATION_ALL
@ NODE_SCRIPT_INTERNAL
@ NODE_SCRIPT_EXTERNAL
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_CROSS
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_BOX
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_ARROW
@ CMP_NODE_COLOR_BALANCE_LGG
@ CMP_NODE_COLOR_BALANCE_ASC_CDL
@ CMP_NODE_COLOR_BALANCE_WHITEPOINT
@ SHD_PRINCIPLED_HAIR_HUANG
@ SHD_PRINCIPLED_HAIR_CHIANG
@ FN_NODE_ROTATE_EULER_SPACE_OBJECT
@ FN_NODE_ROTATE_EULER_SPACE_LOCAL
@ SHD_HAIR_REFLECTION
@ SHD_HAIR_TRANSMISSION
@ CMP_NODE_SCALE_RENDER_SIZE
@ CMP_NODE_SCALE_RELATIVE
@ CMP_NODE_SCALE_ABSOLUTE
@ CMP_NODE_SCALE_RENDER_PERCENT
@ CMP_NODE_TRACK_POSITION_RELATIVE_START
@ CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME
@ CMP_NODE_TRACK_POSITION_RELATIVE_FRAME
@ CMP_NODE_TRACK_POSITION_ABSOLUTE
@ SHD_POINTDENSITY_SOURCE_PSYS
@ SHD_POINTDENSITY_SOURCE_OBJECT
@ SHD_BLEND_DIAGONAL
@ SHD_BLEND_EASING
@ SHD_BLEND_LINEAR
@ SHD_BLEND_RADIAL
@ SHD_BLEND_QUADRATIC_SPHERE
@ SHD_BLEND_SPHERICAL
@ SHD_BLEND_QUADRATIC
@ GEO_NODE_STRING_TO_CURVES_MODE_TRUNCATE
@ GEO_NODE_STRING_TO_CURVES_MODE_SCALE_TO_FIT
@ GEO_NODE_STRING_TO_CURVES_MODE_OVERFLOW
@ CMP_NODE_LEVLES_LUMINANCE
@ CMP_NODE_LEVLES_GREEN
@ CMP_NODE_LEVLES_LUMINANCE_BT709
@ CMP_NODE_LEVLES_RED
@ CMP_NODE_LEVLES_BLUE
@ GEO_NODE_TRANSFORM_GIZMO_USE_ROTATION_Z
@ GEO_NODE_TRANSFORM_GIZMO_USE_SCALE_Z
@ GEO_NODE_TRANSFORM_GIZMO_USE_ROTATION_X
@ GEO_NODE_TRANSFORM_GIZMO_USE_ROTATION_Y
@ GEO_NODE_TRANSFORM_GIZMO_USE_TRANSLATION_Z
@ GEO_NODE_TRANSFORM_GIZMO_USE_TRANSLATION_Y
@ GEO_NODE_TRANSFORM_GIZMO_USE_SCALE_X
@ GEO_NODE_TRANSFORM_GIZMO_USE_SCALE_Y
@ GEO_NODE_TRANSFORM_GIZMO_USE_TRANSLATION_X
@ SHD_SUBSURFACE_BURLEY
@ SHD_SUBSURFACE_RANDOM_WALK_SKIN
@ SHD_SUBSURFACE_RANDOM_WALK
@ SHD_POINTDENSITY_COLOR_VERTNOR
@ SHD_POINTDENSITY_COLOR_VERTWEIGHT
@ SHD_POINTDENSITY_COLOR_VERTCOL
@ GEO_NODE_CURVE_HANDLE_ALIGN
@ GEO_NODE_CURVE_HANDLE_AUTO
@ GEO_NODE_CURVE_HANDLE_FREE
@ GEO_NODE_CURVE_HANDLE_VECTOR
@ SHD_NOISE_HYBRID_MULTIFRACTAL
@ SHD_NOISE_FBM
@ SHD_NOISE_MULTIFRACTAL
@ SHD_NOISE_RIDGED_MULTIFRACTAL
@ SHD_NOISE_HETERO_TERRAIN
@ CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT
@ NODE_BOOLEAN_MATH_IMPLY
@ NODE_BOOLEAN_MATH_AND
@ NODE_BOOLEAN_MATH_NAND
@ NODE_BOOLEAN_MATH_XOR
@ NODE_BOOLEAN_MATH_NOT
@ NODE_BOOLEAN_MATH_OR
@ NODE_BOOLEAN_MATH_NIMPLY
@ NODE_BOOLEAN_MATH_XNOR
@ NODE_BOOLEAN_MATH_NOR
@ FN_NODE_FLOAT_TO_INT_TRUNCATE
@ FN_NODE_FLOAT_TO_INT_CEIL
@ FN_NODE_FLOAT_TO_INT_ROUND
@ FN_NODE_FLOAT_TO_INT_FLOOR
@ SHD_SKY_PREETHAM
@ SHD_SKY_NISHITA
@ SHD_SKY_HOSEK
@ NODE_INTEGER_MATH_SIGN
@ NODE_INTEGER_MATH_ABSOLUTE
@ NODE_INTEGER_MATH_MODULO
@ NODE_INTEGER_MATH_POWER
@ NODE_INTEGER_MATH_MINIMUM
@ NODE_INTEGER_MATH_ADD
@ NODE_INTEGER_MATH_MULTIPLY_ADD
@ NODE_INTEGER_MATH_SUBTRACT
@ NODE_INTEGER_MATH_MULTIPLY
@ NODE_INTEGER_MATH_DIVIDE_FLOOR
@ NODE_INTEGER_MATH_DIVIDE_CEIL
@ NODE_INTEGER_MATH_NEGATE
@ NODE_INTEGER_MATH_MAXIMUM
@ NODE_INTEGER_MATH_GCD
@ NODE_INTEGER_MATH_LCM
@ NODE_INTEGER_MATH_FLOORED_MODULO
@ NODE_INTEGER_MATH_DIVIDE_ROUND
@ NODE_INTEGER_MATH_DIVIDE
@ SHD_AO_INSIDE
@ SHD_AO_LOCAL
@ CMP_NODE_LENS_DISTORTION_RADIAL
@ CMP_NODE_LENS_DISTORTION_HORIZONTAL
@ SHD_GLOSSY_BECKMANN
@ SHD_GLOSSY_GGX
@ SHD_GLOSSY_ASHIKHMIN_SHIRLEY
@ SHD_GLOSSY_MULTI_GGX
@ NODE_COMPARE_NOT_EQUAL
@ NODE_COMPARE_LESS_EQUAL
@ NODE_COMPARE_COLOR_BRIGHTER
@ NODE_COMPARE_EQUAL
@ NODE_COMPARE_GREATER_EQUAL
@ NODE_COMPARE_GREATER_THAN
@ NODE_COMPARE_COLOR_DARKER
@ NODE_COMPARE_LESS_THAN
@ SHD_IMAGE_EXTENSION_MIRROR
@ SHD_IMAGE_EXTENSION_CLIP
@ SHD_IMAGE_EXTENSION_REPEAT
@ SHD_IMAGE_EXTENSION_EXTEND
@ SHD_PHASE_DRAINE
@ SHD_PHASE_RAYLEIGH
@ SHD_PHASE_HENYEY_GREENSTEIN
@ SHD_PHASE_MIE
@ SHD_PHASE_FOURNIER_FORAND
@ CMP_NODE_GLARE_STREAKS
@ CMP_NODE_GLARE_BLOOM
@ CMP_NODE_GLARE_GHOST
@ CMP_NODE_GLARE_SIMPLE_STAR
@ CMP_NODE_GLARE_FOG_GLOW
@ CMP_NODE_DENOISE_PREFILTER_FAST
@ CMP_NODE_DENOISE_PREFILTER_NONE
@ CMP_NODE_DENOISE_PREFILTER_ACCURATE
Object is a sort of wrapper for general info.
@ R_FILTER_TENT
@ R_FILTER_GAUSS
@ R_FILTER_FAST_GAUSS
@ R_FILTER_CATROM
@ R_FILTER_MITCH
@ R_FILTER_BOX
@ R_FILTER_CUBIC
@ R_FILTER_QUAD
#define MAXFRAMEF
#define MINAFRAMEF
@ TEX_PD_OBJECT
@ TEX_PD_PSYS
@ TEXMAP_CLIP_MIN
@ TEXMAP_CLIP_MAX
@ TEX_PD_COLOR_VERTWEIGHT
@ TEX_PD_COLOR_VERTNOR
@ TEX_PD_COLOR_VERTCOL
@ TEX_PD_COLOR_PARTAGE
@ TEX_PD_COLOR_CONSTANT
@ TEX_PD_COLOR_PARTVEL
@ TEX_PD_COLOR_PARTSPEED
@ TEX_PD_OBJECTSPACE
@ RPT_ERROR_INVALID_INPUT
void ED_node_type_draw_color(const char *idname, float *r_color)
Definition drawnode.cc:1533
void ED_init_custom_node_type(blender::bke::bNodeType *ntype)
Definition drawnode.cc:962
void IMB_colormanagement_colorspace_items_add(EnumPropertyItem **items, int *totitem)
bool IMB_colormanagement_set_whitepoint(const float whitepoint[3], float &temperature, float &tint)
const char * IMB_colormanagement_colorspace_get_indexed_name(int index)
void IMB_colormanagement_get_whitepoint(const float temperature, const float tint, float whitepoint[3])
int IMB_colormanagement_colorspace_get_named_index(const char *name)
void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
int rna_Node_Viewer_shortcut_node_get(PointerRNA *ptr, PropertyRNA *prop)
void rna_Node_Viewer_shortcut_node_set(PointerRNA *ptr, PropertyRNA *prop, int value)
void rna_Node_update_relations(Main *bmain, Scene *scne, PointerRNA *ptr)
void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
void register_node_type_sh_custom_group(blender::bke::bNodeType *ntype)
void ntreeTexCheckCyclics(struct bNodeTree *ntree)
int rna_node_socket_idname_to_enum(const char *idname)
blender::bke::bNodeTreeType * rna_node_tree_type_from_enum(int value)
int rna_node_tree_idname_to_enum(const char *idname)
const EnumPropertyItem * rna_node_tree_type_itemf(void *data, bool(*poll)(void *data, blender::bke::bNodeTreeType *), bool *r_free)
blender::bke::bNodeSocketType * rna_node_socket_type_from_enum(int value)
const EnumPropertyItem * rna_node_socket_type_itemf(void *data, bool(*poll)(void *data, blender::bke::bNodeSocketType *), bool *r_free)
ParameterFlag
Definition RNA_types.hh:510
@ PARM_RNAPTR
Definition RNA_types.hh:513
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ FUNC_USE_SELF_TYPE
Definition RNA_types.hh:800
@ FUNC_NO_SELF
Definition RNA_types.hh:798
@ FUNC_REGISTER
Definition RNA_types.hh:812
@ FUNC_USE_MAIN
Definition RNA_types.hh:803
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:804
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:792
@ FUNC_REGISTER_OPTIONAL
Definition RNA_types.hh:814
@ FUNC_ALLOW_WRITE
Definition RNA_types.hh:820
int(*)(PointerRNA *ptr, void *data, bool *have_function) StructValidateFunc
Definition RNA_types.hh:871
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_BOOLEAN
Definition RNA_types.hh:150
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_INT
Definition RNA_types.hh:151
@ PROP_STRING
Definition RNA_types.hh:153
@ PROP_POINTER
Definition RNA_types.hh:155
@ PROP_COLLECTION
Definition RNA_types.hh:156
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:645
void(*)(void *data) StructFreeFunc
Definition RNA_types.hh:876
int(*)(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *list) StructCallbackFunc
Definition RNA_types.hh:872
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:469
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:477
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:489
@ PROP_VARIABLES_RENDER_OUTPUT
Definition RNA_types.hh:458
PropertyFlag
Definition RNA_types.hh:286
@ PROP_THICK_WRAP
Definition RNA_types.hh:397
@ PROP_PATH_OUTPUT
Definition RNA_types.hh:425
@ PROP_DYNAMIC
Definition RNA_types.hh:402
@ PROP_ANIMATABLE
Definition RNA_types.hh:305
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:430
@ PROP_NEVER_UNLINK
Definition RNA_types.hh:358
@ PROP_EDITABLE
Definition RNA_types.hh:292
@ PROP_ENUM_FLAG
Definition RNA_types.hh:378
@ PROP_REGISTER_OPTIONAL
Definition RNA_types.hh:386
@ PROP_ENUM_NO_CONTEXT
Definition RNA_types.hh:404
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_NO_DEG_UPDATE
Definition RNA_types.hh:413
@ PROP_ENUM_NO_TRANSLATE
Definition RNA_types.hh:406
@ PROP_PATH_SUPPORTS_TEMPLATES
Definition RNA_types.hh:443
@ PROP_REGISTER
Definition RNA_types.hh:385
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:369
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:338
#define RNA_ENUM_ITEM_HEADING(name, description)
Definition RNA_types.hh:639
@ PROP_DIRECTION
Definition RNA_types.hh:250
@ PROP_XYZ
Definition RNA_types.hh:257
@ PROP_DISTANCE
Definition RNA_types.hh:244
@ PROP_COLOR
Definition RNA_types.hh:248
@ PROP_ANGLE
Definition RNA_types.hh:240
@ PROP_EULER
Definition RNA_types.hh:254
@ PROP_COORDS
Definition RNA_types.hh:262
@ PROP_COLOR_TEMPERATURE
Definition RNA_types.hh:278
@ PROP_NONE
Definition RNA_types.hh:221
@ PROP_PERCENTAGE
Definition RNA_types.hh:238
@ PROP_FACTOR
Definition RNA_types.hh:239
@ PROP_COLOR_GAMMA
Definition RNA_types.hh:260
@ PROP_TRANSLATION
Definition RNA_types.hh:249
@ PROP_XYZ_LENGTH
Definition RNA_types.hh:258
@ PROP_UNSIGNED
Definition RNA_types.hh:237
@ PROP_FILEPATH
Definition RNA_types.hh:224
#define C
Definition RandGen.cpp:29
#define NC_WINDOW
Definition WM_types.hh:372
#define NC_NODE
Definition WM_types.hh:391
#define ND_OB_ACTIVE
Definition WM_types.hh:437
#define ND_DISPLAY
Definition WM_types.hh:488
#define NC_SCENE
Definition WM_types.hh:375
#define ND_NODES
Definition WM_types.hh:433
#define NA_EDITED
Definition WM_types.hh:581
ReportList * reports
Definition WM_types.hh:1025
#define NC_IMAGE
Definition WM_types.hh:381
#define ND_NODE_ASSET_DATA
Definition WM_types.hh:512
#define NA_SELECTED
Definition WM_types.hh:586
volatile int lock
iter begin(iter)
BMesh const char void * data
PyObject * self
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
StringRefNull copy_string(StringRef str)
void copy_unsafe(char *dst) const
constexpr const char * c_str() const
virtual const int & get_corresponding_output_id(const bNode &input_bnode) const =0
const bNode * get_corresponding_output(const bNodeTree &tree, const bNode &input_bnode) const
#define SELECT
KDTree_3d * tree
#define INT32_MAX
#define input
VecBase< float, 2 > float2
#define MAX_NAME
RenderEngineType * RE_engines_find(const char *idname)
RenderEngine * RE_engine_create(RenderEngineType *type)
void RE_engine_free(RenderEngine *engine)
static char ** types
Definition makesdna.cc:71
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:133
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
#define T
void node_tree_set_output(bNodeTree &ntree)
Definition node.cc:4742
const bNodeZoneType * zone_type_by_node_type(const int node_type)
StringRefNull node_type_find_alias(StringRefNull alias)
Definition node.cc:2720
bool node_is_parent_and_child(const bNode &parent, const bNode &child)
Definition node.cc:3662
void node_attach_node(bNodeTree &ntree, bNode &node, bNode &parent)
Definition node.cc:4255
bool node_tree_is_registered(const bNodeTree &ntree)
Definition node.cc:2701
bNodeTreeType * node_tree_type_find(StringRef idname)
Definition node.cc:2635
Span< bNodeSocketType * > node_socket_types_get()
Definition node.cc:2789
void node_tag_update_id(bNode &node)
Definition node.cc:5105
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
Definition node.cc:2864
void node_remove_node(Main *bmain, bNodeTree &ntree, bNode &node, bool do_id_user, bool remove_animation=true)
Definition node.cc:4649
bNode * node_add_node(const bContext *C, bNodeTree &ntree, StringRef idname)
Definition node.cc:3788
void node_internal_links(bNode &node, bNodeLink **r_links, int *r_len)
Definition node.cc:5110
bNode * node_get_active(bNodeTree &ntree)
Definition node.cc:4957
void node_remove_socket(bNodeTree &ntree, bNode &node, bNodeSocket &sock)
Definition node.cc:3575
void node_update_asset_metadata(bNodeTree &node_tree)
Definition node.cc:2289
bool node_group_poll(const bNodeTree *nodetree, const bNodeTree *grouptree, const char **r_disabled_hint)
void node_register_type(bNodeType &ntype)
Definition node.cc:2748
void node_remove_link(bNodeTree *ntree, bNodeLink &link)
Definition node.cc:4124
void node_tree_type_add(bNodeTreeType &nt)
Definition node.cc:2672
int node_count_socket_links(const bNodeTree &ntree, const bNodeSocket &sock)
Definition node.cc:4946
bNode * node_find_node_try(bNodeTree &ntree, bNodeSocket &socket)
Definition node.cc:3625
void node_tree_type_free_link(const bNodeTreeType &nt)
Definition node.cc:2695
bool node_set_selected(bNode &node, bool select)
Definition node.cc:4967
bNodeSocket * node_add_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, StringRefNull idname, StringRefNull identifier, StringRefNull name)
Definition node.cc:3136
bool node_tree_contains_tree(const bNodeTree &tree_to_search_in, const bNodeTree &tree_to_search_for)
Definition node.cc:4935
void node_detach_node(bNodeTree &ntree, bNode &node)
Definition node.cc:4263
bNodeSocketType * node_socket_type_find(StringRef idname)
Definition node.cc:2794
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
Definition node.cc:4087
bNodeSocketType * node_socket_type_find_static(int type, int subtype=0)
Definition node.cc:2803
StringRefNull node_socket_type_label(const bNodeSocketType &stype)
Definition node.cc:2846
Span< bNodeTreeType * > node_tree_types_get()
Definition node.cc:2706
void node_unregister_type(bNodeType &ntype)
Definition node.cc:2773
std::optional< StringRefNull > node_static_socket_type(int type, int subtype, std::optional< int > dimensions=std::nullopt)
Definition node.cc:3167
void node_remove_socket_links(bNodeTree &ntree, bNodeSocket &sock)
Definition node.cc:4150
void node_set_active(bNodeTree &ntree, bNode &node)
Definition node.cc:4996
float2 node_dimensions_get(const bNode &node)
Definition node.cc:5099
bNodeType * node_type_find(StringRef idname)
Definition node.cc:2711
int node_socket_link_limit(const bNodeSocket &sock)
Definition node.cc:5025
void node_clear_active(bNodeTree &ntree)
Definition node.cc:4989
void node_unique_name(bNodeTree &ntree, bNode &node)
Definition node.cc:3764
bool node_link_is_hidden(const bNodeLink &link)
Definition node.cc:4159
void node_type_base_custom(bNodeType &ntype, StringRefNull idname, StringRefNull name, StringRefNull enum_name, short nclass)
Definition node.cc:5340
void remove_index(T **items, int *items_num, int *active_index, const int index, void(*destruct_item)(T *))
void clear(T **items, int *items_num, int *active_index, void(*destruct_item)(T *))
void move_index(T *items, const int items_num, const int from_index, const int to_index)
T pow(const T &x, const T &power)
T clamp(const T &a, const T &min, const T &max)
T max(const T &a, const T &b)
bool generic_attribute_type_supported(const EnumPropertyItem &item)
void set_item_name_and_make_unique(bNode &node, typename Accessor::ItemT &item, const char *value)
Accessor::ItemT * add_item_with_name(bNode &node, const char *name)
Accessor::ItemT * add_item(bNode &node)
Accessor::ItemT * add_item_with_socket_type_and_name(bNode &node, const eNodeSocketDatatype socket_type, const char *name)
bNode * find_node_by_item(bNodeTree &ntree, const typename Accessor::ItemT &item)
VecBase< float, 2 > float2
void register_node_type_cmp_custom_group(blender::bke::bNodeType *ntype)
void ntreeCompositCryptomatteSyncFromRemove(bNode *node)
void ntreeCompositCryptomatteSyncFromAdd(bNode *node)
void ntreeCompositOutputFileSetPath(bNode *node, bNodeSocket *sock, const char *name)
void ntreeCompositOutputFileSetLayer(bNode *node, bNodeSocket *sock, const char *name)
bNodeSocket * ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, const char *name, const ImageFormatData *im_format)
void ntreeCompositTagNeedExec(bNode *node)
void ntreeCompositUpdateRLayers(bNodeTree *ntree)
void register_node_type_geo_custom_group(blender::bke::bNodeType *ntype)
return ret
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values)
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
const PointerRNA PointerRNA_NULL
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
void * RNA_struct_blender_type_get(StructRNA *srna)
void RNA_parameter_list_free(ParameterList *parms)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
int RNA_int_get(PointerRNA *ptr, const char *name)
int RNA_struct_ui_icon(const StructRNA *type)
float RNA_float_get(PointerRNA *ptr, const char *name)
const char * RNA_struct_ui_description(const StructRNA *type)
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void rna_pointer_create_with_ancestors(const PointerRNA &parent, StructRNA *type, void *data, PointerRNA &r_ptr)
ParameterList * RNA_parameter_list_create(ParameterList *parms, PointerRNA *, FunctionRNA *func)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void * rna_iterator_listbase_get(CollectionPropertyIterator *iter)
void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void **r_value)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
PointerRNA RNA_id_pointer_create(ID *id)
void rna_def_animdata_common(StructRNA *srna)
const EnumPropertyItem rna_enum_attribute_domain_items[]
const EnumPropertyItem rna_enum_attribute_type_items[]
const EnumPropertyItem rna_enum_color_space_convert_default_items[]
Definition rna_color.cc:23
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
FunctionRNA * RNA_def_function_runtime(StructRNA *srna, const char *identifier, CallFunc call)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_int_default(PropertyRNA *prop, int value)
void RNA_def_property_path_template_type(PropertyRNA *prop, PropertyPathTemplateType path_template_type)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
StructRNA * RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *rna_ext)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
BlenderRNA BLENDER_RNA
std::optional< std::string > rna_Node_ImageUser_path(const PointerRNA *ptr)
const EnumPropertyItem rna_enum_ramp_blend_items[]
const EnumPropertyItem rna_enum_axis_xy_items[]
const EnumPropertyItem rna_enum_node_socket_type_items[]
static const EnumPropertyItem sh_tex_prop_interpolation_items[]
static void def_sh_tex_sky(BlenderRNA *brna, StructRNA *srna)
static void def_custom_group(BlenderRNA *brna, const char *struct_name, const char *base_name, const char *ui_name, const char *ui_desc, const char *reg_func)
static const EnumPropertyItem node_glossy_items[]
static void def_cmp_flip(BlenderRNA *, StructRNA *srna)
static void def_geo_menu_switch(BlenderRNA *brna, StructRNA *srna)
static void def_geo_foreach_geometry_element_output(BlenderRNA *brna, StructRNA *srna)
static void def_vector_math(BlenderRNA *, StructRNA *srna)
static void def_cmp_bilateral_blur(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_magic(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_moviedistortion(BlenderRNA *, StructRNA *srna)
static void def_frame(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_subsurface_method_items[]
static const EnumPropertyItem node_script_mode_items[]
static const EnumPropertyItem prop_image_layer_items[]
static void def_sheen(BlenderRNA *, StructRNA *srna)
static void def_sh_tex(BlenderRNA *, StructRNA *srna)
static void def_cmp_mask(BlenderRNA *, StructRNA *srna)
static void def_scatter(BlenderRNA *, StructRNA *srna)
static EnumPropertyItem node_ies_mode_items[]
static void def_cmp_viewer(BlenderRNA *, StructRNA *srna)
static void def_cmp_map_uv(BlenderRNA *, StructRNA *srna)
static void def_sh_subsurface(BlenderRNA *, StructRNA *srna)
static void def_cmp_glare(BlenderRNA *, StructRNA *srna)
static void rna_def_texture_node(BlenderRNA *brna)
static void rna_def_geo_repeat_item(BlenderRNA *brna)
static void def_cmp_boxmask(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_node_color_tag_items[]
static void def_glossy(BlenderRNA *, StructRNA *srna)
static void def_group_output(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_separate_bundle_items(BlenderRNA *brna)
static const EnumPropertyItem prop_view_layer_items[]
static void rna_def_geo_evaluate_closure_input_items(BlenderRNA *brna)
static void def_cmp_sunbeams(BlenderRNA *, StructRNA *srna)
static void rna_def_cmp_output_file_slots_api(BlenderRNA *brna, PropertyRNA *cprop, const char *struct_name)
const EnumPropertyItem rna_enum_node_integer_math_items[]
static void def_cmp_color_spill(BlenderRNA *, StructRNA *srna)
static void rna_def_node_link(BlenderRNA *brna)
static const EnumPropertyItem rna_node_geometry_curve_handle_type_items[]
static const EnumPropertyItem prop_image_view_items[]
static void rna_def_geo_combine_bundle_items(BlenderRNA *brna)
static void rna_def_nodetree(BlenderRNA *brna)
static void def_fn_format_string(BlenderRNA *brna, StructRNA *srna)
static void def_geo_repeat_output(BlenderRNA *brna, StructRNA *srna)
static void rna_def_shader_node(BlenderRNA *brna)
static void rna_def_geo_repeat_items(BlenderRNA *brna)
static const EnumPropertyItem prop_shader_output_target_items[]
static void def_cmp_colorcorrection(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_metallic_distribution_items[]
static const EnumPropertyItem node_flip_items[]
static const EnumPropertyItem node_hair_items[]
static void def_cmp_ellipsemask(BlenderRNA *, StructRNA *srna)
static void def_cmp_map_range(BlenderRNA *, StructRNA *srna)
static void def_cmp_inpaint(BlenderRNA *, StructRNA *srna)
static void rna_def_compositor_node(BlenderRNA *brna)
static void def_geo_distribute_points_on_faces(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_simulation_state_item(BlenderRNA *brna)
static void def_sh_vect_transform(BlenderRNA *, StructRNA *srna)
static void def_fn_input_string(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_separate_bundle_item(BlenderRNA *brna)
static void def_texture(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_wave(BlenderRNA *brna, StructRNA *srna)
const EnumPropertyItem rna_enum_node_float_to_int_items[]
static void rna_def_geo_foreach_geometry_element_input_item(BlenderRNA *brna)
static void def_cmp_defocus(BlenderRNA *, StructRNA *srna)
static void def_sh_normal_map(BlenderRNA *, StructRNA *srna)
static void def_cmp_color_matte(BlenderRNA *, StructRNA *srna)
static void def_cmp_keying(BlenderRNA *, StructRNA *srna)
static void def_geo_index_switch(BlenderRNA *brna, StructRNA *srna)
static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
static void def_sh_attribute(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_voronoi(BlenderRNA *brna, StructRNA *srna)
static void rna_def_node(BlenderRNA *brna)
static void def_cmp_translate(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem rna_enum_node_tex_dimensions_items[]
static void def_sh_bevel(BlenderRNA *, StructRNA *srna)
static void def_group(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_masktype_items[]
static void rna_def_cmp_output_file_slot_layer(BlenderRNA *brna)
static void def_cmp_colorbalance(BlenderRNA *, StructRNA *srna)
static void def_sh_uvalongstroke(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_foreach_geometry_element_generation_item(BlenderRNA *brna)
static void def_float_to_int(BlenderRNA *, StructRNA *srna)
static void def_cmp_filter(BlenderRNA *, StructRNA *srna)
static void def_common_zone_input(BlenderRNA *, StructRNA *srna)
static void def_cmp_levels(BlenderRNA *, StructRNA *srna)
static void def_fn_input_int(BlenderRNA *, StructRNA *srna)
static void def_fn_input_rotation(BlenderRNA *, StructRNA *srna)
static void def_cmp_invert(BlenderRNA *, StructRNA *srna)
static void def_refraction(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_metallic_fresnel_type_items[]
static void rna_def_geo_gizmo_transform(BlenderRNA *, StructRNA *srna)
static void def_tex_image(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_checker(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_chroma_matte(BlenderRNA *, StructRNA *srna)
static void def_float_curve(BlenderRNA *, StructRNA *srna)
static void def_cmp_tonemap(BlenderRNA *, StructRNA *srna)
static void rna_def_internal_node(BlenderRNA *brna)
static void def_cmp_render_layers(BlenderRNA *, StructRNA *srna)
static void def_cmp_dilate_erode(BlenderRNA *, StructRNA *srna)
static void def_cmp_movieclip(BlenderRNA *, StructRNA *srna)
static void def_tex_output(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem cmp_interpolation_items[]
static void def_sh_output_linestyle(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_lensdist(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_mapping_type_items[]
static void rna_def_geo_closure_input_item(BlenderRNA *brna)
static const EnumPropertyItem node_scatter_phase_items[]
static void def_cmp_crop(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem rna_enum_vector_rotate_type_items[]
const EnumPropertyItem rna_enum_node_combsep_color_items[]
static void def_sh_tex_pointdensity(BlenderRNA *, StructRNA *srna)
static void def_geo_simulation_input(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_ycc(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_bake_item(BlenderRNA *brna)
static const EnumPropertyItem node_cryptomatte_layer_name_items[]
static const EnumPropertyItem node_ycc_items[]
static void def_reroute(BlenderRNA *, StructRNA *srna)
static void def_mix_rgb(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_evaluate_closure_output_items(BlenderRNA *brna)
static void def_metallic(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_separate_bundle(BlenderRNA *brna, StructRNA *srna)
static const EnumPropertyItem node_refraction_items[]
static void def_geo_input_collection(BlenderRNA *, StructRNA *srna)
static void rna_def_function_node(BlenderRNA *brna)
static void def_sh_output_aov(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_white_noise(BlenderRNA *, StructRNA *srna)
static void rna_def_node_instance_hash(BlenderRNA *brna)
static void def_vector_curve(BlenderRNA *, StructRNA *srna)
static void def_sh_output(BlenderRNA *, StructRNA *srna)
static void def_geo_input_normal(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_brick(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_bokehimage(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem prop_image_extension[]
static void def_geo_sample_index(BlenderRNA *, StructRNA *srna)
static void def_cmp_convert_color_space(BlenderRNA *, StructRNA *srna)
static void def_cmp_channel_matte(BlenderRNA *, StructRNA *srna)
static void def_hair_principled(BlenderRNA *, StructRNA *srna)
static void def_cmp_planetrackdeform(BlenderRNA *, StructRNA *srna)
static void def_fn_random_value(BlenderRNA *, StructRNA *srna)
static void def_cmp_cryptomatte(BlenderRNA *brna, StructRNA *srna)
static void rna_def_geo_foreach_geometry_element_generation_items(BlenderRNA *brna)
static void def_cmp_antialiasing(BlenderRNA *, StructRNA *srna)
static void def_tex_bricks(BlenderRNA *, StructRNA *srna)
static void dev_cmd_transform(BlenderRNA *, StructRNA *srna)
static void rna_def_fn_format_string_item(BlenderRNA *brna)
static void rna_def_geo_simulation_state_items(BlenderRNA *brna)
static void rna_def_cmp_output_file_slot_file(BlenderRNA *brna)
static void def_cmp_denoise(BlenderRNA *, StructRNA *srna)
static void def_sh_vector_displacement(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_capture_attribute(BlenderRNA *brna, StructRNA *srna)
static void def_geo_closure_input(BlenderRNA *brna, StructRNA *srna)
static void rna_def_texture_nodetree(BlenderRNA *brna)
static void def_sh_uvmap(BlenderRNA *, StructRNA *srna)
static void def_time(BlenderRNA *, StructRNA *srna)
static void def_cmp_trackpos(BlenderRNA *, StructRNA *srna)
static void def_cmp_premul_key(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_node_socket_in_out_items[]
void RNA_def_nodetree(BlenderRNA *brna)
static void def_sh_tex_coord(BlenderRNA *, StructRNA *srna)
static void def_fn_input_color(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_combine_bundle(BlenderRNA *brna, StructRNA *srna)
const EnumPropertyItem rna_enum_node_math_items[]
static void rna_def_shader_nodetree(BlenderRNA *brna)
static void rna_def_geo_foreach_geometry_element_input_items(BlenderRNA *brna)
static void rna_def_index_switch_item(BlenderRNA *brna)
static void def_cmp_brightcontrast(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_capture_attribute_item(BlenderRNA *brna)
static void rna_def_geo_closure_output_items(BlenderRNA *brna)
static void rna_def_geo_menu_switch_item(BlenderRNA *brna)
const EnumPropertyItem rna_enum_node_geometry_curve_handle_side_items[]
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
const EnumPropertyItem rna_enum_node_vec_math_items[]
const EnumPropertyItem rna_enum_geometry_nodes_linear_gizmo_draw_style_items[]
static void def_cmp_keyingscreen(BlenderRNA *, StructRNA *srna)
static void def_node_image_user(BlenderRNA *, StructRNA *srna)
static void def_sh_vector_rotate(BlenderRNA *, StructRNA *srna)
static void def_group_input(BlenderRNA *, StructRNA *)
static void rna_def_geo_capture_attribute_items(BlenderRNA *brna)
static void rna_def_geometry_nodetree(BlenderRNA *brna)
static void def_cmp_id_mask(BlenderRNA *, StructRNA *srna)
static void def_cmp_diff_matte(BlenderRNA *, StructRNA *srna)
static void rna_def_node_item_array_socket_item_common(StructRNA *srna, const char *accessor, const bool add_socket_type)
static void def_cmp_combsep_color(BlenderRNA *, StructRNA *srna)
static void def_volume_coefficients(BlenderRNA *, StructRNA *srna)
static void def_cmp_cornerpin(BlenderRNA *, StructRNA *srna)
static void def_cmp_map_value(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_ies(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_closure_input_items(BlenderRNA *brna)
static void def_sh_mapping(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_principled_hair_model_items[]
static void def_cmp_despeckle(BlenderRNA *, StructRNA *srna)
static void def_sh_script(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_principled_hair_parametrization_items[]
static const EnumPropertyItem prop_tri_channel_items[]
static void def_cmp_dblur(BlenderRNA *, StructRNA *srna)
static void def_cmp_pixelate(BlenderRNA *, StructRNA *srna)
static void def_cmp_rotate(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_node_geometry_mesh_circle_fill_type_items[]
static void def_cmp_cryptomatte_legacy(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_composite(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_glass_items[]
static void def_cmp_scale(BlenderRNA *, StructRNA *srna)
static void def_clamp(BlenderRNA *, StructRNA *srna)
static void def_cmp_luma_matte(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_node_boolean_math_items[]
static void def_geo_curve_sample(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_combine_bundle_item(BlenderRNA *brna)
static void rna_def_geo_bake_items(BlenderRNA *brna)
static void rna_def_geo_index_switch_items(BlenderRNA *brna)
const EnumPropertyItem rna_enum_geometry_nodes_gizmo_color_items[]
static void rna_def_node_item_array_common_functions(StructRNA *srna, const char *item_name, const char *accessor_name)
static void def_cmp_huecorrect(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_node_map_range_items[]
static void def_cmp_stabilize2d(BlenderRNA *, StructRNA *srna)
static void def_geo_simulation_output(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_bokehblur(BlenderRNA *, StructRNA *srna)
static void def_geo_input_material(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_evaluate_closure_input_item(BlenderRNA *brna)
const EnumPropertyItem rna_enum_node_float_compare_items[]
static void def_sh_mix(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_node_compare_operation_items[]
static void def_sh_combsep_color(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_evaluate_closure_output_item(BlenderRNA *brna)
static void def_hair(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_node_filter_items[]
static void def_toon(BlenderRNA *, StructRNA *srna)
static void def_map_range(BlenderRNA *, StructRNA *srna)
static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
static void def_cmp_vector_blur(BlenderRNA *, StructRNA *srna)
static void def_cmp_cryptomatte_common(BlenderRNA *, StructRNA *srna)
static void rna_def_nodes(BlenderRNA *brna)
static void def_principled(BlenderRNA *, StructRNA *srna)
static void def_geo_foreach_geometry_element_input(BlenderRNA *brna, StructRNA *srna)
static void rna_def_geo_closure_output_item(BlenderRNA *brna)
static void def_geo_input_object(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_noise(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_distance_matte(BlenderRNA *, StructRNA *srna)
static void def_cmp_set_alpha(BlenderRNA *, StructRNA *srna)
static void def_geo_curve_handle_type_selection(BlenderRNA *, StructRNA *srna)
static void def_rgb_curve(BlenderRNA *, StructRNA *srna)
static void def_cmp_blur(BlenderRNA *, StructRNA *srna)
static void def_glass(BlenderRNA *, StructRNA *srna)
static void def_sh_displacement(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem rna_enum_mix_data_type_items[]
static void def_sh_ambient_occlusion(BlenderRNA *, StructRNA *srna)
static void rna_def_composite_nodetree(BlenderRNA *brna)
static void rna_def_geometry_node(BlenderRNA *brna)
static void def_cmp_switch(BlenderRNA *, StructRNA *srna)
static void def_fn_input_vector(BlenderRNA *, StructRNA *srna)
static void def_colorramp(BlenderRNA *, StructRNA *srna)
const EnumPropertyItem rna_enum_node_clamp_items[]
static void def_tex_combsep_color(BlenderRNA *, StructRNA *srna)
static void def_geo_image_texture(BlenderRNA *, StructRNA *srna)
static void def_math(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_sheen_items[]
static void def_sh_bump(BlenderRNA *, StructRNA *srna)
static void def_sh_tangent(BlenderRNA *, StructRNA *srna)
static void def_geo_string_to_curves(BlenderRNA *, StructRNA *srna)
static void def_fn_rotate_euler(BlenderRNA *, StructRNA *srna)
static void def_geo_evaluate_closure(BlenderRNA *brna, StructRNA *srna)
static void rna_def_geo_bake(BlenderRNA *brna, StructRNA *srna)
static void def_fn_input_bool(BlenderRNA *, StructRNA *srna)
static void rna_def_node_item_array_new_with_socket_and_name(StructRNA *srna, const char *item_name, const char *accessor_name)
static void def_geo_repeat_input(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_cryptomatte_entry(BlenderRNA *brna)
static void def_sh_vertex_color(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_gabor(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_switch_view(BlenderRNA *, StructRNA *)
static void def_cmp_output_file(BlenderRNA *brna, StructRNA *srna)
static void rna_def_geo_foreach_geometry_element_main_items(BlenderRNA *brna)
static void def_cmp_double_edge_mask(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_gradient(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_image(BlenderRNA *brna, StructRNA *srna)
static void rna_def_geo_foreach_geometry_element_main_item(BlenderRNA *brna)
static const EnumPropertyItem node_principled_distribution_items[]
static void def_geo_curve_set_handle_type(BlenderRNA *, StructRNA *srna)
static void def_cmp_kuwahara(BlenderRNA *, StructRNA *srna)
static void rna_def_fn_format_string_items(BlenderRNA *brna)
static void rna_def_nodetree_nodes_api(BlenderRNA *brna, PropertyRNA *cprop)
static void def_sh_tex_wireframe(BlenderRNA *, StructRNA *srna)
static void def_cmp_zcombine(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem node_toon_items[]
static void def_geo_image(BlenderRNA *, StructRNA *srna)
static void def_sh_tex_image(BlenderRNA *brna, StructRNA *srna)
static StructRNA * define_specific_node(BlenderRNA *brna, const char *struct_name, const char *base_name)
static void def_cmp_alpha_over(BlenderRNA *, StructRNA *srna)
static void rna_def_geo_menu_switch_items(BlenderRNA *brna)
static void def_geo_closure_output(BlenderRNA *brna, StructRNA *srna)
static void def_sh_tex_environment(BlenderRNA *brna, StructRNA *srna)
static void def_cmp_split(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem space_items[]
const EnumPropertyItem rna_enum_dummy_NULL_items[]
Definition rna_rna.cc:26
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
Definition rna_scene.cc:112
static const EnumPropertyItem prop_noise_type[]
const EnumPropertyItem rna_enum_icon_items[]
Definition rna_ui_api.cc:25
#define min(a, b)
Definition sort.cc:36
bool RE_layers_have_name(RenderResult *result)
#define FLT_MAX
Definition stdcycles.h:14
const char * identifier
Definition RNA_types.hh:623
const char * name
Definition RNA_types.hh:627
const char * description
Definition RNA_types.hh:629
StructRNA * srna
Definition RNA_types.hh:909
StructCallbackFunc call
Definition RNA_types.hh:910
StructFreeFunc free
Definition RNA_types.hh:911
Definition DNA_ID.h:404
char name[66]
Definition DNA_ID.h:415
void * first
char type_idname[64]
ListBase particlesystem
struct Object * object
char vertex_attribute_name[68]
T * data_as() const
Definition RNA_types.hh:124
ID * owner_id
Definition RNA_types.hh:51
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
char engine[32]
struct ImageFormatData im_format
char name[RE_MAXNAME]
Definition RE_pipeline.h:81
struct RenderLayer * next
Definition RE_pipeline.h:78
struct RenderView * next
Definition RE_pipeline.h:38
char name[64]
Definition RE_pipeline.h:39
struct bNodeTree * nodetree
struct RenderData r
char * filepath
struct bNodeSocket * next
char identifier[64]
char idname[64]
struct GeometryNodeAssetTraits * geometry_node_asset_traits
bNodeTreeTypeHandle * typeinfo
bNodeTreeInterface tree_interface
ListBase nodes
ListBase links
float location[2]
bNodeTypeHandle * typeinfo
int16_t custom1
IDProperty * prop
ListBase inputs
struct ID * id
struct bNode * parent
char name[64]
int16_t type_legacy
struct bNode * next
void * storage
char idname[64]
ListBase outputs
int32_t identifier
Compact definition of a node socket.
Definition BKE_node.hh:98
Defines a socket type.
Definition BKE_node.hh:152
eNodeSocketDatatype type
Definition BKE_node.hh:187
void(* update)(bNodeTree *ntree)
Definition BKE_node.hh:508
bool(* poll)(const bContext *C, bNodeTreeType *ntreetype)
Definition BKE_node.hh:495
void(* get_from_context)(const bContext *C, bNodeTreeType *ntreetype, bNodeTree **r_ntree, ID **r_id, ID **r_from)
Definition BKE_node.hh:497
bool(* valid_socket_type)(bNodeTreeType *ntreetype, bNodeSocketType *socket_type)
Definition BKE_node.hh:515
Defines a node type.
Definition BKE_node.hh:226
void(* freefunc_api)(PointerRNA *ptr)
Definition BKE_node.hh:291
std::string ui_description
Definition BKE_node.hh:232
bool(* poll_instance)(const bNode *node, const bNodeTree *nodetree, const char **r_disabled_hint)
Definition BKE_node.hh:316
bNodeSocketTemplate * inputs
Definition BKE_node.hh:242
void(* labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
Definition BKE_node.hh:258
void(* draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:249
bNodeSocketTemplate * outputs
Definition BKE_node.hh:242
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:247
bool(* poll)(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint)
Definition BKE_node.hh:309
bool(* insert_link)(bNodeTree *ntree, bNode *node, bNodeLink *link)
Definition BKE_node.hh:321
void(* copyfunc_api)(PointerRNA *ptr, const bNode *src_node)
Definition BKE_node.hh:292
void(* free_self)(bNodeType *ntype)
Definition BKE_node.hh:323
void(* updatefunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:269
void(* initfunc_api)(const bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:290
float x
float y
i
Definition text_draw.cc:230
max
Definition text_draw.cc:251
void RE_point_density_free(PointDensity *pd)
void RE_point_density_minmax(Depsgraph *depsgraph, PointDensity *pd, float r_min[3], float r_max[3])
void RE_point_density_sample(Depsgraph *depsgraph, PointDensity *pd, const int resolution, float *values)
void RE_point_density_cache(Depsgraph *depsgraph, PointDensity *pd)
uint len
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4226
uint8_t flag
Definition wm_window.cc:139