Blender V4.3
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
9#include <climits>
10#include <cstdlib>
11#include <cstring>
12
13#include <utility>
14
15#include "BLI_function_ref.hh"
17#include "BLI_math_rotation.h"
18#include "BLI_string.h"
20#include "BLI_utildefines.h"
21
22#include "BLF_api.hh"
23
24#include "BLT_translation.hh"
25
26#include "DNA_curves_types.h"
27#include "DNA_material_types.h"
28#include "DNA_mesh_types.h"
29#include "DNA_modifier_types.h"
30#include "DNA_node_types.h"
31#include "DNA_object_types.h"
32#include "DNA_particle_types.h"
33#include "DNA_text_types.h"
34#include "DNA_texture_types.h"
35
36#include "BKE_animsys.h"
37#include "BKE_attribute.hh"
38#include "BKE_context.hh"
39#include "BKE_cryptomatte.h"
40#include "BKE_geometry_set.hh"
41#include "BKE_image.hh"
42#include "BKE_node.hh"
43#include "BKE_node_runtime.hh"
45#include "BKE_scene.hh"
46#include "BKE_texture.h"
47
48#include "RNA_access.hh"
49#include "RNA_define.hh"
50#include "RNA_enum_types.hh"
51
52#include "rna_internal.hh"
53#include "rna_internal_types.hh"
54
56#include "IMB_imbuf.hh"
57#include "IMB_imbuf_types.hh"
58
59#include "WM_types.hh"
60
61#include "MEM_guardedalloc.h"
62
63#include "RE_texture.h"
64
65#include "NOD_composite.hh"
66#include "NOD_geometry.hh"
68#include "NOD_socket.hh"
69
70#include "DEG_depsgraph.hh"
72
73#include "BLI_string_utils.hh"
74
76 {SOCK_OUT, "OUT", 0, "Output", ""},
77 {0, nullptr, 0, nullptr, nullptr}};
78
80 {SOCK_FLOAT, "FLOAT", 0, "Float", ""},
81 {SOCK_INT, "INT", 0, "Integer", ""},
82 {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
83 {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
84 {SOCK_ROTATION, "ROTATION", 0, "Rotation", ""},
85 {SOCK_MATRIX, "MATRIX", 0, "Matrix", ""},
86 {SOCK_STRING, "STRING", 0, "String", ""},
87 {SOCK_MENU, "MENU", 0, "Menu", ""},
88 {SOCK_RGBA, "RGBA", 0, "Color", ""},
89 {SOCK_OBJECT, "OBJECT", 0, "Object", ""},
90 {SOCK_IMAGE, "IMAGE", 0, "Image", ""},
91 {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""},
92 {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""},
93 {SOCK_TEXTURE, "TEXTURE", 0, "Texture", ""},
94 {SOCK_MATERIAL, "MATERIAL", 0, "Material", ""},
95 {0, nullptr, 0, nullptr, nullptr},
96};
97
100 "NONE",
101 0,
102 "None",
103 "Default tag for new node groups"},
104 {int(blender::bke::NodeGroupColorTag::Attribute), "ATTRIBUTE", 0, "Attribute", ""},
105 {int(blender::bke::NodeGroupColorTag::Color), "COLOR", 0, "Color", ""},
106 {int(blender::bke::NodeGroupColorTag::Converter), "CONVERTER", 0, "Converter", ""},
107 {int(blender::bke::NodeGroupColorTag::Distort), "DISTORT", 0, "Distort", ""},
108 {int(blender::bke::NodeGroupColorTag::Filter), "FILTER", 0, "Filter", ""},
109 {int(blender::bke::NodeGroupColorTag::Geometry), "GEOMETRY", 0, "Geometry", ""},
110 {int(blender::bke::NodeGroupColorTag::Input), "INPUT", 0, "Input", ""},
111 {int(blender::bke::NodeGroupColorTag::Matte), "MATTE", 0, "Matte", ""},
112 {int(blender::bke::NodeGroupColorTag::Output), "OUTPUT", 0, "Output", ""},
113 {int(blender::bke::NodeGroupColorTag::Script), "SCRIPT", 0, "Script", ""},
114 {int(blender::bke::NodeGroupColorTag::Shader), "SHADER", 0, "Shader", ""},
115 {int(blender::bke::NodeGroupColorTag::Texture), "TEXTURE", 0, "Texture", ""},
116 {int(blender::bke::NodeGroupColorTag::Vector), "VECTOR", 0, "Vector", ""},
117 {0, nullptr, 0, nullptr, nullptr},
118};
119
121 {NODE_MAPPING_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
123 "TEXTURE",
124 0,
125 "Texture",
126 "Transform a texture by inverse mapping the texture coordinate"},
128 "VECTOR",
129 0,
130 "Vector",
131 "Transform a direction vector (Location is ignored)"},
133 "NORMAL",
134 0,
135 "Normal",
136 "Transform a unit normal vector (Location is ignored)"},
137 {0, nullptr, 0, nullptr, nullptr},
138};
139
142 "AXIS_ANGLE",
143 0,
144 "Axis Angle",
145 "Rotate a point using axis angle"},
146 {NODE_VECTOR_ROTATE_TYPE_AXIS_X, "X_AXIS", 0, "X Axis", "Rotate a point using X axis"},
147 {NODE_VECTOR_ROTATE_TYPE_AXIS_Y, "Y_AXIS", 0, "Y Axis", "Rotate a point using Y axis"},
148 {NODE_VECTOR_ROTATE_TYPE_AXIS_Z, "Z_AXIS", 0, "Z Axis", "Rotate a point using Z axis"},
149 {NODE_VECTOR_ROTATE_TYPE_EULER_XYZ, "EULER_XYZ", 0, "Euler", "Rotate a point using XYZ order"},
150 {0, nullptr, 0, nullptr, nullptr},
151};
152
155 {NODE_MATH_ADD, "ADD", 0, "Add", "A + B"},
156 {NODE_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
157 {NODE_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "A * B"},
158 {NODE_MATH_DIVIDE, "DIVIDE", 0, "Divide", "A / B"},
159 {NODE_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
161 {NODE_MATH_POWER, "POWER", 0, "Power", "A power B"},
162 {NODE_MATH_LOGARITHM, "LOGARITHM", 0, "Logarithm", "Logarithm A base B"},
163 {NODE_MATH_SQRT, "SQRT", 0, "Square Root", "Square root of A"},
164 {NODE_MATH_INV_SQRT, "INVERSE_SQRT", 0, "Inverse Square Root", "1 / Square root of A"},
165 {NODE_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Magnitude of A"},
166 {NODE_MATH_EXPONENT, "EXPONENT", 0, "Exponent", "exp(A)"},
168 {NODE_MATH_MINIMUM, "MINIMUM", 0, "Minimum", "The minimum from A and B"},
169 {NODE_MATH_MAXIMUM, "MAXIMUM", 0, "Maximum", "The maximum from A and B"},
170 {NODE_MATH_LESS_THAN, "LESS_THAN", 0, "Less Than", "1 if A < B else 0"},
171 {NODE_MATH_GREATER_THAN, "GREATER_THAN", 0, "Greater Than", "1 if A > B else 0"},
172 {NODE_MATH_SIGN, "SIGN", 0, "Sign", "Returns the sign of A"},
173 {NODE_MATH_COMPARE, "COMPARE", 0, "Compare", "1 if (A == B) within tolerance C else 0"},
175 "SMOOTH_MIN",
176 0,
177 "Smooth Minimum",
178 "The minimum from A and B with smoothing C"},
180 "SMOOTH_MAX",
181 0,
182 "Smooth Maximum",
183 "The maximum from A and B with smoothing C"},
186 "ROUND",
187 0,
188 "Round",
189 "Round A to the nearest integer. Round upward if the fraction part is 0.5"},
190 {NODE_MATH_FLOOR, "FLOOR", 0, "Floor", "The largest integer smaller than or equal A"},
191 {NODE_MATH_CEIL, "CEIL", 0, "Ceil", "The smallest integer greater than or equal A"},
192 {NODE_MATH_TRUNC, "TRUNC", 0, "Truncate", "The integer part of A, removing fractional digits"},
194 {NODE_MATH_FRACTION, "FRACT", 0, "Fraction", "The fraction part of A"},
196 "MODULO",
197 0,
198 "Truncated Modulo",
199 "The remainder of truncated division using fmod(A,B)"},
201 "FLOORED_MODULO",
202 0,
203 "Floored Modulo",
204 "The remainder of floored division"},
205 {NODE_MATH_WRAP, "WRAP", 0, "Wrap", "Wrap value to range, wrap(A,B)"},
206 {NODE_MATH_SNAP, "SNAP", 0, "Snap", "Snap to increment, snap(A,B)"},
208 "PINGPONG",
209 0,
210 "Ping-Pong",
211 "Wraps a value and reverses every other cycle (A,B)"},
212 RNA_ENUM_ITEM_HEADING(CTX_N_(BLT_I18NCONTEXT_ID_NODETREE, "Trigonometric"), nullptr),
213 {NODE_MATH_SINE, "SINE", 0, "Sine", "sin(A)"},
214 {NODE_MATH_COSINE, "COSINE", 0, "Cosine", "cos(A)"},
215 {NODE_MATH_TANGENT, "TANGENT", 0, "Tangent", "tan(A)"},
217 {NODE_MATH_ARCSINE, "ARCSINE", 0, "Arcsine", "arcsin(A)"},
218 {NODE_MATH_ARCCOSINE, "ARCCOSINE", 0, "Arccosine", "arccos(A)"},
219 {NODE_MATH_ARCTANGENT, "ARCTANGENT", 0, "Arctangent", "arctan(A)"},
220 {NODE_MATH_ARCTAN2, "ARCTAN2", 0, "Arctan2", "The signed angle arctan(A / B)"},
222 {NODE_MATH_SINH, "SINH", 0, "Hyperbolic Sine", "sinh(A)"},
223 {NODE_MATH_COSH, "COSH", 0, "Hyperbolic Cosine", "cosh(A)"},
224 {NODE_MATH_TANH, "TANH", 0, "Hyperbolic Tangent", "tanh(A)"},
226 {NODE_MATH_RADIANS, "RADIANS", 0, "To Radians", "Convert from degrees to radians"},
227 {NODE_MATH_DEGREES, "DEGREES", 0, "To Degrees", "Convert from radians to degrees"},
228 {0, nullptr, 0, nullptr, nullptr},
229};
230
232 {NODE_VECTOR_MATH_ADD, "ADD", 0, "Add", "A + B"},
233 {NODE_VECTOR_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
234 {NODE_VECTOR_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "Entry-wise multiply"},
235 {NODE_VECTOR_MATH_DIVIDE, "DIVIDE", 0, "Divide", "Entry-wise divide"},
236 {NODE_VECTOR_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
238 {NODE_VECTOR_MATH_CROSS_PRODUCT, "CROSS_PRODUCT", 0, "Cross Product", "A cross B"},
239 {NODE_VECTOR_MATH_PROJECT, "PROJECT", 0, "Project", "Project A onto B"},
241 "REFLECT",
242 0,
243 "Reflect",
244 "Reflect A around the normal B. B doesn't need to be normalized."},
246 "REFRACT",
247 0,
248 "Refract",
249 "For a given incident vector A, surface normal B and ratio of indices of refraction, Ior, "
250 "refract returns the refraction vector, R"},
252 "FACEFORWARD",
253 0,
254 "Faceforward",
255 "Orients a vector A to point away from a surface B as defined by its normal C. "
256 "Returns (dot(B, C) < 0) ? A : -A"},
257 {NODE_VECTOR_MATH_DOT_PRODUCT, "DOT_PRODUCT", 0, "Dot Product", "A dot B"},
259 {NODE_VECTOR_MATH_DISTANCE, "DISTANCE", 0, "Distance", "Distance between A and B"},
260 {NODE_VECTOR_MATH_LENGTH, "LENGTH", 0, "Length", "Length of A"},
261 {NODE_VECTOR_MATH_SCALE, "SCALE", 0, "Scale", "A multiplied by Scale"},
262 {NODE_VECTOR_MATH_NORMALIZE, "NORMALIZE", 0, "Normalize", "Normalize A"},
264 {NODE_VECTOR_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Entry-wise absolute"},
265 {NODE_VECTOR_MATH_MINIMUM, "MINIMUM", 0, "Minimum", "Entry-wise minimum"},
266 {NODE_VECTOR_MATH_MAXIMUM, "MAXIMUM", 0, "Maximum", "Entry-wise maximum"},
267 {NODE_VECTOR_MATH_FLOOR, "FLOOR", 0, "Floor", "Entry-wise floor"},
268 {NODE_VECTOR_MATH_CEIL, "CEIL", 0, "Ceil", "Entry-wise ceil"},
269 {NODE_VECTOR_MATH_FRACTION, "FRACTION", 0, "Fraction", "The fraction part of A entry-wise"},
270 {NODE_VECTOR_MATH_MODULO, "MODULO", 0, "Modulo", "Entry-wise modulo using fmod(A,B)"},
271 {NODE_VECTOR_MATH_WRAP, "WRAP", 0, "Wrap", "Entry-wise wrap(A,B)"},
273 "SNAP",
274 0,
275 "Snap",
276 "Round A to the largest integer multiple of B less than or equal A"},
278 {NODE_VECTOR_MATH_SINE, "SINE", 0, "Sine", "Entry-wise sin(A)"},
279 {NODE_VECTOR_MATH_COSINE, "COSINE", 0, "Cosine", "Entry-wise cos(A)"},
280 {NODE_VECTOR_MATH_TANGENT, "TANGENT", 0, "Tangent", "Entry-wise tan(A)"},
281 {0, nullptr, 0, nullptr, nullptr},
282};
283
285 {NODE_BOOLEAN_MATH_AND, "AND", 0, "And", "True when both inputs are true"},
286 {NODE_BOOLEAN_MATH_OR, "OR", 0, "Or", "True when at least one input is true"},
287 {NODE_BOOLEAN_MATH_NOT, "NOT", 0, "Not", "Opposite of the input"},
289 {NODE_BOOLEAN_MATH_NAND, "NAND", 0, "Not And", "True when at least one input is false"},
290 {NODE_BOOLEAN_MATH_NOR, "NOR", 0, "Nor", "True when both inputs are false"},
292 "XNOR",
293 0,
294 "Equal",
295 "True when both inputs are equal (exclusive nor)"},
297 "XOR",
298 0,
299 "Not Equal",
300 "True when both inputs are different (exclusive or)"},
303 "IMPLY",
304 0,
305 "Imply",
306 "True unless the first input is true and the second is false"},
308 "NIMPLY",
309 0,
310 "Subtract",
311 "True when the first input is true and the second is false (not imply)"},
312 {0, nullptr, 0, nullptr, nullptr},
313};
314
317 "LESS_THAN",
318 0,
319 "Less Than",
320 "True when the first input is smaller than second input"},
322 "LESS_EQUAL",
323 0,
324 "Less Than or Equal",
325 "True when the first input is smaller than the second input or equal"},
327 "GREATER_THAN",
328 0,
329 "Greater Than",
330 "True when the first input is greater than the second input"},
332 "GREATER_EQUAL",
333 0,
334 "Greater Than or Equal",
335 "True when the first input is greater than the second input or equal"},
336 {NODE_COMPARE_EQUAL, "EQUAL", 0, "Equal", "True when both inputs are approximately equal"},
338 "NOT_EQUAL",
339 0,
340 "Not Equal",
341 "True when both inputs are not approximately equal"},
342 {0, nullptr, 0, nullptr, nullptr},
343};
344
347 {NODE_INTEGER_MATH_ADD, "ADD", 0, "Add", "A + B"},
348 {NODE_INTEGER_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
349 {NODE_INTEGER_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "A * B"},
350 {NODE_INTEGER_MATH_DIVIDE, "DIVIDE", 0, "Divide", "A / B"},
351 {NODE_INTEGER_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
353 {NODE_INTEGER_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Non-negative value of A, abs(A)"},
354 {NODE_INTEGER_MATH_NEGATE, "NEGATE", 0, "Negate", "-A"},
355 {NODE_INTEGER_MATH_POWER, "POWER", 0, "Power", "A power B, pow(A,B)"},
358 "MINIMUM",
359 0,
360 "Minimum",
361 "The minimum value from A and B, min(A,B)"},
363 "MAXIMUM",
364 0,
365 "Maximum",
366 "The maximum value from A and B, max(A,B)"},
367 {NODE_INTEGER_MATH_SIGN, "SIGN", 0, "Sign", "Return the sign of A, sign(A)"},
370 "DIVIDE_ROUND",
371 0,
372 "Divide Round",
373 "Divide and round result toward zero"},
375 "DIVIDE_FLOOR",
376 0,
377 "Divide Floor",
378 "Divide and floor result, the largest integer smaller than or equal A"},
380 "DIVIDE_CEIL",
381 0,
382 "Divide Ceiling",
383 "Divide and ceil result, the smallest integer greater than or equal A"},
386 "FLOORED_MODULO",
387 0,
388 "Floored Modulo",
389 "Modulo that is periodic for both negative and positive operands"},
390 {NODE_INTEGER_MATH_MODULO, "MODULO", 0, "Modulo", "Modulo which is the remainder of A / B"},
393 "GCD",
394 0,
395 "Greatest Common Divisor",
396 "The largest positive integer that divides into each of the values A and B, "
397 "e.g. GCD(8,12) = 4"},
399 "LCM",
400 0,
401 "Least Common Multiple",
402 "The smallest positive integer that is divisible by both A and B, e.g. LCM(6,10) = 30"},
403 {0, nullptr, 0, nullptr, nullptr},
404};
405
408 "LESS_THAN",
409 0,
410 "Less Than",
411 "True when the first input is smaller than second input"},
413 "LESS_EQUAL",
414 0,
415 "Less Than or Equal",
416 "True when the first input is smaller than the second input or equal"},
418 "GREATER_THAN",
419 0,
420 "Greater Than",
421 "True when the first input is greater than the second input"},
423 "GREATER_EQUAL",
424 0,
425 "Greater Than or Equal",
426 "True when the first input is greater than the second input or equal"},
427 {NODE_COMPARE_EQUAL, "EQUAL", 0, "Equal", "True when both inputs are approximately equal"},
429 "NOT_EQUAL",
430 0,
431 "Not Equal",
432 "True when both inputs are not approximately equal"},
434 "BRIGHTER",
435 0,
436 "Brighter",
437 "True when the first input is brighter"},
438 {NODE_COMPARE_COLOR_DARKER, "DARKER", 0, "Darker", "True when the first input is darker"},
439 {0, nullptr, 0, nullptr, nullptr},
440};
441
444 "ROUND",
445 0,
446 "Round",
447 "Round the float up or down to the nearest integer"},
449 "FLOOR",
450 0,
451 "Floor",
452 "Round the float down to the next smallest integer"},
454 "CEILING",
455 0,
456 "Ceiling",
457 "Round the float up to the next largest integer"},
459 "TRUNCATE",
460 0,
461 "Truncate",
462 "Round the float to the closest integer in the direction of zero (floor if positive; ceiling "
463 "if negative)"},
464 {0, nullptr, 0, nullptr, nullptr},
465};
466
469 "LINEAR",
470 0,
471 "Linear",
472 "Linear interpolation between From Min and From Max values"},
474 "STEPPED",
475 0,
476 "Stepped Linear",
477 "Stepped linear interpolation between From Min and From Max values"},
479 "SMOOTHSTEP",
480 0,
481 "Smooth Step",
482 "Smooth Hermite edge interpolation between From Min and From Max values"},
484 "SMOOTHERSTEP",
485 0,
486 "Smoother Step",
487 "Smoother Hermite edge interpolation between From Min and From Max values"},
488 {0, nullptr, 0, nullptr, nullptr},
489};
490
492 {NODE_CLAMP_MINMAX, "MINMAX", 0, "Min Max", "Constrain value between min and max"},
494 "RANGE",
495 0,
496 "Range",
497 "Constrain value between min and max, swapping arguments when min > max"},
498 {0, nullptr, 0, nullptr, nullptr},
499};
500
502 {1, "1D", 0, "1D", "Use the scalar value W as input"},
503 {2, "2D", 0, "2D", "Use the 2D vector (X, Y) as input. The Z component is ignored."},
504 {3, "3D", 0, "3D", "Use the 3D vector (X, Y, Z) as input"},
505 {4, "4D", 0, "4D", "Use the 4D vector (X, Y, Z, W) as input"},
506 {0, nullptr, 0, nullptr, nullptr},
507};
508
510 {0, "SOFTEN", 0, "Soften", ""},
511 {1, "SHARPEN", 0, "Box Sharpen", "An aggressive sharpening filter"},
512 {7, "SHARPEN_DIAMOND", 0, "Diamond Sharpen", "A moderate sharpening filter"},
513 {2, "LAPLACE", 0, "Laplace", ""},
514 {3, "SOBEL", 0, "Sobel", ""},
515 {4, "PREWITT", 0, "Prewitt", ""},
516 {5, "KIRSCH", 0, "Kirsch", ""},
517 {6, "SHADOW", 0, "Shadow", ""},
518 {0, nullptr, 0, nullptr, nullptr},
519};
520
523 "FREE",
524 ICON_HANDLE_FREE,
525 "Free",
526 "The handle can be moved anywhere, and doesn't influence the point's other handle"},
528 "AUTO",
529 ICON_HANDLE_AUTO,
530 "Auto",
531 "The location is automatically calculated to be smooth"},
533 "VECTOR",
534 ICON_HANDLE_VECTOR,
535 "Vector",
536 "The location is calculated to point to the next/previous control point"},
538 "ALIGN",
539 ICON_HANDLE_ALIGNED,
540 "Align",
541 "The location is constrained to point in the opposite direction as the other handle"},
542 {0, nullptr, 0, nullptr, nullptr}};
543
545 {GEO_NODE_CURVE_HANDLE_LEFT, "LEFT", ICON_NONE, "Left", "Use the left handles"},
546 {GEO_NODE_CURVE_HANDLE_RIGHT, "RIGHT", ICON_NONE, "Right", "Use the right handles"},
547 {0, nullptr, 0, nullptr, nullptr}};
548
550 {NODE_COMBSEP_COLOR_RGB, "RGB", ICON_NONE, "RGB", "Use RGB color processing"},
551 {NODE_COMBSEP_COLOR_HSV, "HSV", ICON_NONE, "HSV", "Use HSV color processing"},
552 {NODE_COMBSEP_COLOR_HSL, "HSL", ICON_NONE, "HSL", "Use HSL color processing"},
553 {0, nullptr, 0, nullptr, nullptr},
554};
555
557 {SOCK_FLOAT, "FLOAT", 0, "Float", ""},
558 {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
559 {SOCK_RGBA, "RGBA", 0, "Color", ""},
560 {SOCK_ROTATION, "ROTATION", 0, "Rotation", ""},
561 {0, nullptr, 0, nullptr, nullptr},
562};
563
565 {GEO_NODE_MESH_CIRCLE_FILL_NONE, "NONE", 0, "None", ""},
566 {GEO_NODE_MESH_CIRCLE_FILL_NGON, "NGON", 0, "N-Gon", ""},
567 {GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN, "TRIANGLE_FAN", 0, "Triangles", ""},
568 {0, nullptr, 0, nullptr, nullptr},
569};
570
572 {GEO_NODE_GIZMO_COLOR_PRIMARY, "PRIMARY", 0, "Primary", ""},
573 {GEO_NODE_GIZMO_COLOR_SECONDARY, "SECONDARY", 0, "Secondary", ""},
574 {GEO_NODE_GIZMO_COLOR_X, "X", 0, "X", ""},
575 {GEO_NODE_GIZMO_COLOR_Y, "Y", 0, "Y", ""},
576 {GEO_NODE_GIZMO_COLOR_Z, "Z", 0, "Z", ""},
577 {0, nullptr, 0, nullptr, nullptr},
578};
579
581 {GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_ARROW, "ARROW", 0, "Arrow", ""},
582 {GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_CROSS, "CROSS", 0, "Cross", ""},
583 {GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_BOX, "BOX", 0, "Box", ""},
584 {0, nullptr, 0, nullptr, nullptr},
585};
586
587#ifndef RNA_RUNTIME
589 {0, "NEAREST", 0, "Nearest", ""},
590 {1, "BILINEAR", 0, "Bilinear", ""},
591 {2, "BICUBIC", 0, "Bicubic", ""},
592 {0, nullptr, 0, nullptr, nullptr},
593};
594
597 "ALL",
598 0,
599 "All",
600 "Use shaders for all renderers and viewports, unless there exists a more specific output"},
601 {SHD_OUTPUT_EEVEE, "EEVEE", 0, "EEVEE", "Use shaders for EEVEE renderer"},
602 {SHD_OUTPUT_CYCLES, "CYCLES", 0, "Cycles", "Use shaders for Cycles renderer"},
603 {0, nullptr, 0, nullptr, nullptr},
604};
605
607 {0, "CryptoObject", 0, "Object", "Use Object layer"},
608 {1, "CryptoMaterial", 0, "Material", "Use Material layer"},
609 {2, "CryptoAsset", 0, "Asset", "Use Asset layer"},
610 {0, nullptr, 0, nullptr, nullptr},
611};
612
613#endif /* !RNA_RUNTIME */
614
615#undef ITEM_ATTRIBUTE
616#undef ITEM_FLOAT
617#undef ITEM_VECTOR
618#undef ITEM_COLOR
619#undef ITEM_BOOLEAN
620
621#ifdef RNA_RUNTIME
622
623# include <fmt/format.h>
624
625# include "BLI_linklist.h"
626# include "BLI_string.h"
627
628# include "BKE_context.hh"
629# include "BKE_idprop.hh"
630
631# include "BKE_global.hh"
632
633# include "ED_node.hh"
634# include "ED_render.hh"
635
636# include "GPU_material.hh"
637
638# include "NOD_common.h"
639# include "NOD_composite.hh"
640# include "NOD_geo_bake.hh"
643# include "NOD_geo_index_switch.hh"
644# include "NOD_geo_menu_switch.hh"
645# include "NOD_geo_repeat.hh"
646# include "NOD_geo_simulation.hh"
647# include "NOD_geometry.hh"
648# include "NOD_shader.h"
649# include "NOD_socket.hh"
650# include "NOD_socket_items.hh"
651# include "NOD_texture.h"
652
653# include "RE_engine.h"
654# include "RE_pipeline.h"
655
656# include "DNA_scene_types.h"
657# include "WM_api.hh"
658
668
669extern FunctionRNA rna_NodeTree_poll_func;
670extern FunctionRNA rna_NodeTree_update_func;
671extern FunctionRNA rna_NodeTree_get_from_context_func;
672extern FunctionRNA rna_NodeTree_valid_socket_type_func;
673extern FunctionRNA rna_Node_poll_func;
674extern FunctionRNA rna_Node_poll_instance_func;
675extern FunctionRNA rna_Node_update_func;
676extern FunctionRNA rna_Node_insert_link_func;
677extern FunctionRNA rna_Node_init_func;
678extern FunctionRNA rna_Node_copy_func;
679extern FunctionRNA rna_Node_free_func;
680extern FunctionRNA rna_Node_draw_buttons_func;
681extern FunctionRNA rna_Node_draw_buttons_ext_func;
682extern FunctionRNA rna_Node_draw_label_func;
683
684void rna_Node_socket_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr);
685
686int rna_node_tree_idname_to_enum(const char *idname)
687{
688 int i = 0, result = -1;
690 if (STREQ(nt->idname, idname)) {
691 result = i;
692 break;
693 }
694 i++;
695 }
697 return result;
698}
699
701{
702 int i = 0;
703 blender::bke::bNodeTreeType *result = nullptr;
705 if (i == value) {
706 result = nt;
707 break;
708 }
709 i++;
710 }
712 return result;
713}
714
716 void *data, bool (*poll)(void *data, blender::bke::bNodeTreeType *), bool *r_free)
717{
718 EnumPropertyItem tmp = {0};
719 EnumPropertyItem *item = nullptr;
720 int totitem = 0, i = 0;
721
723 if (poll && !poll(data, nt)) {
724 i++;
725 continue;
726 }
727
728 tmp.value = i;
729 tmp.identifier = nt->idname;
730 tmp.icon = nt->ui_icon;
731 tmp.name = nt->ui_name;
732 tmp.description = nt->ui_description;
733
734 RNA_enum_item_add(&item, &totitem, &tmp);
735
736 i++;
737 }
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 int i = 0, result = -1;
755 if (STREQ(stype->idname, idname)) {
756 result = i;
757 break;
758 }
759 i++;
760 }
762 return result;
763}
764
766{
767 int i = 0;
768 blender::bke::bNodeSocketType *result = nullptr;
770 if (i == value) {
771 result = stype;
772 break;
773 }
774 i++;
775 }
777 return result;
778}
779
781 void *data, bool (*poll)(void *data, blender::bke::bNodeSocketType *), bool *r_free)
782{
783 EnumPropertyItem *item = nullptr;
784 EnumPropertyItem tmp = {0};
785 int totitem = 0, i = 0;
786 StructRNA *srna;
787
789 if (poll && !poll(data, stype)) {
790 i++;
791 continue;
792 }
793
794 srna = stype->ext_socket.srna;
795 tmp.value = i;
796 tmp.identifier = stype->idname;
797 tmp.icon = RNA_struct_ui_icon(srna);
800
801 RNA_enum_item_add(&item, &totitem, &tmp);
802
803 i++;
804 }
806
807 if (totitem == 0) {
808 *r_free = false;
810 }
811
812 RNA_enum_item_end(&item, &totitem);
813 *r_free = true;
814
815 return item;
816}
817
818static const EnumPropertyItem *rna_node_static_type_itemf(bContext * /*C*/,
820 PropertyRNA * /*prop*/,
821 bool *r_free)
822{
823 EnumPropertyItem *item = nullptr;
825 int totitem = 0;
826
827 /* hack, don't want to add include path to RNA just for this, since in the future RNA types
828 * for nodes should be defined locally at runtime anyway ...
829 */
830
831 tmp.value = NODE_CUSTOM;
832 tmp.identifier = "CUSTOM";
833 tmp.name = N_("Custom");
834 tmp.description = N_("Custom Node");
835 tmp.icon = ICON_NONE;
836 RNA_enum_item_add(&item, &totitem, &tmp);
837
839 tmp.identifier = "CUSTOM GROUP";
840 tmp.name = N_("CustomGroup");
841 tmp.description = N_("Custom Group Node");
842 tmp.icon = ICON_NONE;
843 RNA_enum_item_add(&item, &totitem, &tmp);
844
845 tmp.value = NODE_UNDEFINED;
846 tmp.identifier = "UNDEFINED";
847 tmp.name = N_("UNDEFINED");
848 tmp.description = "";
849 tmp.icon = ICON_NONE;
850 RNA_enum_item_add(&item, &totitem, &tmp);
851
852 const char *category = "";
853 if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) {
854 category = "ShaderNode";
855 }
856 else if (RNA_struct_is_a(ptr->type, &RNA_CompositorNode)) {
857 category = "CompositorNode";
858 }
859 else if (RNA_struct_is_a(ptr->type, &RNA_TextureNode)) {
860 category = "TextureNode";
861 }
862 else if (RNA_struct_is_a(ptr->type, &RNA_GeometryNode)) {
863 category = "GeometryNode";
864 }
865 else if (RNA_struct_is_a(ptr->type, &RNA_FunctionNode)) {
866 category = "FunctionNode";
867 }
868
869 NODE_TYPES_BEGIN (ntype) {
870 if (ntype->enum_name_legacy &&
871 (BLI_str_startswith(ntype->idname, "Node") || BLI_str_startswith(ntype->idname, category)))
872 {
873 tmp.value = ntype->type;
874 tmp.identifier = ntype->enum_name_legacy;
875 tmp.name = ntype->ui_name;
876 tmp.description = ntype->ui_description;
877 tmp.icon = ICON_NONE;
878 RNA_enum_item_add(&item, &totitem, &tmp);
879 }
880 }
882
883 RNA_enum_item_end(&item, &totitem);
884 *r_free = true;
885
886 return item;
887}
888
889/* ******** Node Tree ******** */
890
891static StructRNA *rna_NodeTree_refine(PointerRNA *ptr)
892{
893 bNodeTree *ntree = static_cast<bNodeTree *>(ptr->data);
894
895 if (ntree->typeinfo->rna_ext.srna) {
896 return ntree->typeinfo->rna_ext.srna;
897 }
898 else {
899 return &RNA_NodeTree;
900 }
901}
902
903static bool rna_NodeTree_poll(const bContext *C, blender::bke::bNodeTreeType *ntreetype)
904{
905 ParameterList list;
906 FunctionRNA *func;
907 void *ret;
908 bool visible;
909
910 PointerRNA ptr = RNA_pointer_create(nullptr, ntreetype->rna_ext.srna, nullptr); /* dummy */
911 func = &rna_NodeTree_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
912
913 RNA_parameter_list_create(&list, &ptr, func);
914 RNA_parameter_set_lookup(&list, "context", &C);
915 ntreetype->rna_ext.call(const_cast<bContext *>(C), &ptr, func, &list);
916
917 RNA_parameter_get_lookup(&list, "visible", &ret);
918 visible = *static_cast<bool *>(ret);
919
921
922 return visible;
923}
924
925static void rna_NodeTree_update_reg(bNodeTree *ntree)
926{
927 ParameterList list;
928 FunctionRNA *func;
929
931 func = &rna_NodeTree_update_func; /* RNA_struct_find_function(&ptr, "update"); */
932
933 RNA_parameter_list_create(&list, &ptr, func);
934 ntree->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
935
937}
938
939static void rna_NodeTree_get_from_context(const bContext *C,
941 bNodeTree **r_ntree,
942 ID **r_id,
943 ID **r_from)
944{
945 ParameterList list;
946 FunctionRNA *func;
947 void *ret1, *ret2, *ret3;
948
949 PointerRNA ptr = RNA_pointer_create(nullptr, ntreetype->rna_ext.srna, nullptr); /* dummy */
950 // RNA_struct_find_function(&ptr, "get_from_context");
951 func = &rna_NodeTree_get_from_context_func;
952
953 RNA_parameter_list_create(&list, &ptr, func);
954 RNA_parameter_set_lookup(&list, "context", &C);
955 ntreetype->rna_ext.call(const_cast<bContext *>(C), &ptr, func, &list);
956
957 RNA_parameter_get_lookup(&list, "result_1", &ret1);
958 RNA_parameter_get_lookup(&list, "result_2", &ret2);
959 RNA_parameter_get_lookup(&list, "result_3", &ret3);
960 *r_ntree = *(bNodeTree **)ret1;
961 *r_id = *(ID **)ret2;
962 *r_from = *(ID **)ret3;
963
965}
966
967static bool rna_NodeTree_valid_socket_type(blender::bke::bNodeTreeType *ntreetype,
969{
970 ParameterList list;
971 FunctionRNA *func;
972 void *ret;
973 bool valid;
974
975 PointerRNA ptr = RNA_pointer_create(nullptr, ntreetype->rna_ext.srna, nullptr); /* dummy */
976 func = &rna_NodeTree_valid_socket_type_func;
977
978 RNA_parameter_list_create(&list, &ptr, func);
979 RNA_parameter_set_lookup(&list, "idname", &socket_type->idname);
980 ntreetype->rna_ext.call(nullptr, &ptr, func, &list);
981
982 RNA_parameter_get_lookup(&list, "valid", &ret);
983 valid = *static_cast<bool *>(ret);
984
986
987 return valid;
988}
989
990static bool rna_NodeTree_unregister(Main * /*bmain*/, StructRNA *type)
991{
994
995 if (!nt) {
996 return false;
997 }
998
1001
1003
1004 /* update while blender is running */
1006 return true;
1007}
1008
1009static StructRNA *rna_NodeTree_register(Main *bmain,
1010 ReportList *reports,
1011 void *data,
1012 const char *identifier,
1013 StructValidateFunc validate,
1014 StructCallbackFunc call,
1016{
1017 blender::bke::bNodeTreeType *nt, dummy_nt;
1018 bNodeTree dummy_ntree;
1019 bool have_function[4];
1020
1021 /* setup dummy tree & tree type to store static properties in */
1022 memset(&dummy_nt, 0, sizeof(blender::bke::bNodeTreeType));
1023 memset(&dummy_ntree, 0, sizeof(bNodeTree));
1024 dummy_ntree.typeinfo = &dummy_nt;
1025 PointerRNA dummy_ntree_ptr = RNA_pointer_create(nullptr, &RNA_NodeTree, &dummy_ntree);
1026
1027 /* validate the python class */
1028 if (validate(&dummy_ntree_ptr, data, have_function) != 0) {
1029 return nullptr;
1030 }
1031
1032 if (strlen(identifier) >= sizeof(dummy_nt.idname)) {
1033 BKE_reportf(reports,
1034 RPT_ERROR,
1035 "Registering node tree class: '%s' is too long, maximum length is %d",
1036 identifier,
1037 int(sizeof(dummy_nt.idname)));
1038 return nullptr;
1039 }
1040
1041 /* check if we have registered this tree type before, and remove it */
1043 if (nt) {
1044 BKE_reportf(reports,
1045 RPT_INFO,
1046 "Registering node tree class: '%s', bl_idname '%s' has been registered before, "
1047 "unregistering previous",
1048 identifier,
1049 dummy_nt.idname);
1050
1051 /* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for nullptr. */
1052 if (!rna_NodeTree_unregister(bmain, nt->rna_ext.srna)) {
1053 BKE_reportf(reports,
1054 RPT_ERROR,
1055 "Registering node tree class: '%s', bl_idname '%s' could not be unregistered",
1056 identifier,
1057 dummy_nt.idname);
1058 return nullptr;
1059 }
1060 }
1061
1062 /* create a new node tree type */
1063 nt = static_cast<blender::bke::bNodeTreeType *>(
1064 MEM_mallocN(sizeof(blender::bke::bNodeTreeType), "node tree type"));
1065 memcpy(nt, &dummy_nt, sizeof(dummy_nt));
1066
1067 nt->type = NTREE_CUSTOM;
1068
1069 nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, &RNA_NodeTree);
1070 nt->rna_ext.data = data;
1071 nt->rna_ext.call = call;
1072 nt->rna_ext.free = free;
1074
1077
1078 nt->poll = (have_function[0]) ? rna_NodeTree_poll : nullptr;
1079 nt->update = (have_function[1]) ? rna_NodeTree_update_reg : nullptr;
1080 nt->get_from_context = (have_function[2]) ? rna_NodeTree_get_from_context : nullptr;
1081 nt->valid_socket_type = (have_function[3]) ? rna_NodeTree_valid_socket_type : nullptr;
1082
1084
1085 /* update while blender is running */
1087
1088 return nt->rna_ext.srna;
1089}
1090
1091static bool rna_NodeTree_check(bNodeTree *ntree, ReportList *reports)
1092{
1094 if (reports) {
1095 BKE_reportf(reports,
1096 RPT_ERROR,
1097 "Node tree '%s' has undefined type %s",
1098 ntree->id.name + 2,
1099 ntree->idname);
1100 }
1101 return false;
1102 }
1103 else {
1104 return true;
1105 }
1106}
1107
1108static void rna_NodeTree_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
1109{
1110 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
1111
1114
1115 ED_node_tree_propagate_change(nullptr, bmain, ntree);
1116}
1117
1118static void rna_NodeTree_update_asset(Main *bmain, Scene *scene, PointerRNA *ptr)
1119{
1120 rna_NodeTree_update(bmain, scene, ptr);
1123}
1124
1125static const EnumPropertyItem *rna_NodeTree_color_tag_itemf(bContext * /*C*/,
1126 PointerRNA *ptr,
1127 PropertyRNA * /*prop*/,
1128 bool *r_free)
1129{
1130 const bNodeTree &ntree = *reinterpret_cast<const bNodeTree *>(ptr->owner_id);
1131
1132 EnumPropertyItem *items = nullptr;
1133 int items_num = 0;
1134
1136 item++)
1137 {
1138 switch (blender::bke::NodeGroupColorTag(item->value)) {
1141 if (ntree.type == NTREE_GEOMETRY) {
1142 RNA_enum_item_add(&items, &items_num, item);
1143 }
1144 break;
1145 }
1148 if (ntree.type == NTREE_SHADER) {
1149 RNA_enum_item_add(&items, &items_num, item);
1150 }
1151 break;
1152 }
1156 if (ntree.type == NTREE_COMPOSIT) {
1157 RNA_enum_item_add(&items, &items_num, item);
1158 }
1159 break;
1160 }
1161 default: {
1162 RNA_enum_item_add(&items, &items_num, item);
1163 break;
1164 }
1165 }
1166 }
1167
1168 RNA_enum_item_end(&items, &items_num);
1169
1170 *r_free = true;
1171 return items;
1172}
1173
1174static bNode *rna_NodeTree_node_new(bNodeTree *ntree,
1175 bContext *C,
1176 ReportList *reports,
1177 const char *type)
1178{
1180 bNode *node;
1181
1182 if (!rna_NodeTree_check(ntree, reports)) {
1183 return nullptr;
1184 }
1185
1186 /* If the given idname is an alias, translate it to the proper idname. */
1188
1189 ntype = blender::bke::node_type_find(type);
1190 if (!ntype) {
1191 BKE_reportf(reports, RPT_ERROR, "Node type %s undefined", type);
1192 return nullptr;
1193 }
1194
1195 const char *disabled_hint = nullptr;
1196 if (ntype->poll && !ntype->poll(ntype, ntree, &disabled_hint)) {
1197 if (disabled_hint) {
1198 BKE_reportf(reports,
1199 RPT_ERROR,
1200 "Cannot add node of type %s to node tree '%s'\n %s",
1201 type,
1202 ntree->id.name + 2,
1203 disabled_hint);
1204 return nullptr;
1205 }
1206 else {
1207 BKE_reportf(reports,
1208 RPT_ERROR,
1209 "Cannot add node of type %s to node tree '%s'",
1210 type,
1211 ntree->id.name + 2);
1212 return nullptr;
1213 }
1214 }
1215
1216 node = blender::bke::node_add_node(C, ntree, type);
1217 BLI_assert(node && node->typeinfo);
1218
1219 if (ntree->type == NTREE_TEXTURE) {
1220 ntreeTexCheckCyclics(ntree);
1221 }
1222
1223 Main *bmain = CTX_data_main(C);
1224 ED_node_tree_propagate_change(C, bmain, ntree);
1226
1227 return node;
1228}
1229
1230static void rna_NodeTree_node_remove(bNodeTree *ntree,
1231 Main *bmain,
1232 ReportList *reports,
1233 PointerRNA *node_ptr)
1234{
1235 bNode *node = static_cast<bNode *>(node_ptr->data);
1236
1237 if (!rna_NodeTree_check(ntree, reports)) {
1238 return;
1239 }
1240
1241 if (BLI_findindex(&ntree->nodes, node) == -1) {
1242 BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name);
1243 return;
1244 }
1245
1246 blender::bke::node_remove_node(bmain, ntree, node, true);
1247
1248 RNA_POINTER_INVALIDATE(node_ptr);
1249
1250 ED_node_tree_propagate_change(nullptr, bmain, ntree);
1252}
1253
1254static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1255{
1256 bNode *node = static_cast<bNode *>(ntree->nodes.first);
1257
1258 if (!rna_NodeTree_check(ntree, reports)) {
1259 return;
1260 }
1261
1262 while (node) {
1263 bNode *next_node = node->next;
1264
1265 blender::bke::node_remove_node(bmain, ntree, node, true);
1266
1267 node = next_node;
1268 }
1269
1270 ED_node_tree_propagate_change(nullptr, bmain, ntree);
1272}
1273
1274static PointerRNA rna_NodeTree_active_node_get(PointerRNA *ptr)
1275{
1276 bNodeTree *ntree = static_cast<bNodeTree *>(ptr->data);
1277 bNode *node = blender::bke::node_get_active(ntree);
1278 return rna_pointer_inherit_refine(ptr, &RNA_Node, node);
1279}
1280
1281static void rna_NodeTree_active_node_set(PointerRNA *ptr,
1282 const PointerRNA value,
1283 ReportList * /*reports*/)
1284{
1285 bNodeTree *ntree = static_cast<bNodeTree *>(ptr->data);
1286 bNode *node = static_cast<bNode *>(value.data);
1287
1288 if (node && BLI_findindex(&ntree->nodes, node) != -1) {
1289 blender::bke::node_set_active(ntree, node);
1290
1291 /* Handle NODE_DO_OUTPUT as well. */
1292 if (node->typeinfo->nclass == NODE_CLASS_OUTPUT && node->type != CMP_NODE_OUTPUT_FILE) {
1293 /* If this node becomes the active output, the others of the same type can't be the active
1294 * output anymore. */
1295 LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
1296 if (other_node->type == node->type) {
1297 other_node->flag &= ~NODE_DO_OUTPUT;
1298 }
1299 }
1300 node->flag |= NODE_DO_OUTPUT;
1303 }
1304 }
1305 else {
1307 }
1308}
1309
1310static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree,
1311 Main *bmain,
1312 ReportList *reports,
1313 bNodeSocket *fromsock,
1314 bNodeSocket *tosock,
1315 bool verify_limits,
1316 bool handle_dynamic_sockets)
1317{
1318 bNodeLink *ret;
1319 bNode *fromnode = nullptr, *tonode = nullptr;
1320
1321 if (!rna_NodeTree_check(ntree, reports)) {
1322 return nullptr;
1323 }
1324
1325 blender::bke::node_find_node_try(ntree, fromsock, &fromnode, nullptr);
1326 blender::bke::node_find_node_try(ntree, tosock, &tonode, nullptr);
1327 /* check validity of the sockets:
1328 * if sockets from different trees are passed in this will fail!
1329 */
1330 if (!fromnode || !tonode) {
1331 return nullptr;
1332 }
1333
1334 if (fromsock->in_out == tosock->in_out) {
1335 BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets");
1336 return nullptr;
1337 }
1338
1339 if (fromsock->in_out == SOCK_IN) {
1340 std::swap(fromsock, tosock);
1341 std::swap(fromnode, tonode);
1342 }
1343
1344 if (handle_dynamic_sockets) {
1345 bNodeLink new_link{};
1346 new_link.fromnode = fromnode;
1347 new_link.fromsock = fromsock;
1348 new_link.tonode = tonode;
1349 new_link.tosock = tosock;
1350
1351 if (fromnode->typeinfo->insert_link) {
1352 if (!fromnode->typeinfo->insert_link(ntree, fromnode, &new_link)) {
1353 return nullptr;
1354 }
1355 }
1356 if (tonode->typeinfo->insert_link) {
1357 if (!tonode->typeinfo->insert_link(ntree, tonode, &new_link)) {
1358 return nullptr;
1359 }
1360 }
1361
1362 fromsock = new_link.fromsock;
1363 tosock = new_link.tosock;
1364 }
1365
1366 if (verify_limits) {
1367 /* remove other socket links if limit is exceeded */
1368 if (blender::bke::node_count_socket_links(ntree, fromsock) + 1 >
1370 {
1372 }
1373 if (blender::bke::node_count_socket_links(ntree, tosock) + 1 >
1375 {
1377 }
1378 if (tosock->flag & SOCK_MULTI_INPUT) {
1379 LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
1380 if (link->fromsock == fromsock && link->tosock == tosock) {
1381 blender::bke::node_remove_link(ntree, link);
1382 }
1383 }
1384 }
1385 }
1386
1387 ret = blender::bke::node_add_link(ntree, fromnode, fromsock, tonode, tosock);
1388
1389 if (ret) {
1390
1391 /* not an issue from the UI, clear hidden from API to keep valid state. */
1392 fromsock->flag &= ~SOCK_HIDDEN;
1393 tosock->flag &= ~SOCK_HIDDEN;
1394
1395 ED_node_tree_propagate_change(nullptr, bmain, ntree);
1397 }
1398 return ret;
1399}
1400
1401static void rna_NodeTree_link_remove(bNodeTree *ntree,
1402 Main *bmain,
1403 ReportList *reports,
1404 PointerRNA *link_ptr)
1405{
1406 bNodeLink *link = static_cast<bNodeLink *>(link_ptr->data);
1407
1408 if (!rna_NodeTree_check(ntree, reports)) {
1409 return;
1410 }
1411
1412 if (BLI_findindex(&ntree->links, link) == -1) {
1413 BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree");
1414 return;
1415 }
1416
1417 blender::bke::node_remove_link(ntree, link);
1418 RNA_POINTER_INVALIDATE(link_ptr);
1419
1420 ED_node_tree_propagate_change(nullptr, bmain, ntree);
1422}
1423
1424static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1425{
1426 bNodeLink *link = static_cast<bNodeLink *>(ntree->links.first);
1427
1428 if (!rna_NodeTree_check(ntree, reports)) {
1429 return;
1430 }
1431
1432 while (link) {
1433 bNodeLink *next_link = link->next;
1434
1435 blender::bke::node_remove_link(ntree, link);
1436
1437 link = next_link;
1438 }
1439 ED_node_tree_propagate_change(nullptr, bmain, ntree);
1441}
1442
1443static bool rna_NodeTree_contains_tree(bNodeTree *tree, bNodeTree *sub_tree)
1444{
1446}
1447
1448static void rna_NodeTree_debug_lazy_function_graph(bNodeTree *tree,
1449 bContext *C,
1450 const char **r_str,
1451 int *r_len)
1452{
1453 *r_len = 0;
1454 *r_str = nullptr;
1455 if (DEG_is_original_id(&tree->id)) {
1456 /* The graph is only stored on the evaluated data. */
1458 tree = reinterpret_cast<bNodeTree *>(DEG_get_evaluated_id(depsgraph, &tree->id));
1459 }
1460 std::lock_guard lock{tree->runtime->geometry_nodes_lazy_function_graph_info_mutex};
1461 if (!tree->runtime->geometry_nodes_lazy_function_graph_info) {
1462 return;
1463 }
1464 std::string dot_str = tree->runtime->geometry_nodes_lazy_function_graph_info->graph.to_dot();
1465 *r_str = BLI_strdup(dot_str.c_str());
1466 *r_len = dot_str.size();
1467}
1468
1469static void rna_NodeTree_debug_zone_body_lazy_function_graph(
1470 ID *tree_id, bNode *node, bContext *C, const char **r_str, int *r_len)
1471{
1472 *r_len = 0;
1473 *r_str = nullptr;
1474 bNodeTree *tree = reinterpret_cast<bNodeTree *>(tree_id);
1475 if (DEG_is_original_id(&tree->id)) {
1476 /* The graph is only stored on the evaluated data. */
1478 tree = reinterpret_cast<bNodeTree *>(DEG_get_evaluated_id(depsgraph, &tree->id));
1479 }
1480 std::lock_guard lock{tree->runtime->geometry_nodes_lazy_function_graph_info_mutex};
1481 if (!tree->runtime->geometry_nodes_lazy_function_graph_info) {
1482 return;
1483 }
1484 const auto *graph = tree->runtime->geometry_nodes_lazy_function_graph_info
1485 ->debug_zone_body_graphs.lookup_default(node->identifier, nullptr);
1486 if (!graph) {
1487 return;
1488 }
1489 std::string dot_str = graph->to_dot();
1490 *r_str = BLI_strdup(dot_str.c_str());
1491 *r_len = dot_str.size();
1492}
1493
1494static void rna_NodeTree_debug_zone_lazy_function_graph(
1495 ID *tree_id, bNode *node, bContext *C, const char **r_str, int *r_len)
1496{
1497 *r_len = 0;
1498 *r_str = nullptr;
1499 Main *bmain = CTX_data_main(C);
1501 bNodeTree *tree = reinterpret_cast<bNodeTree *>(tree_id);
1502
1503 if (tree->type != NTREE_GEOMETRY) {
1504 return;
1505 }
1506 /* By creating this data we tell the evaluation that we want to log it. */
1507 tree->runtime->logged_zone_graphs = std::make_unique<blender::bke::LoggedZoneGraphs>();
1508 BLI_SCOPED_DEFER([&]() { tree->runtime->logged_zone_graphs.reset(); })
1509
1510 /* Make sure that dependencies of this tree will be evaluated. */
1512 /* Actually do evaluation. */
1514
1515 /* Get logged graph if it was evaluated. */
1516 std::optional<std::string> dot_str = tree->runtime->logged_zone_graphs->graph_by_zone_id.pop_try(
1517 node->identifier);
1518 if (!dot_str) {
1519 return;
1520 }
1521 *r_str = BLI_strdup(dot_str->c_str());
1522 *r_len = dot_str->size();
1523}
1524
1525static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C)
1526{
1527 Main *bmain = CTX_data_main(C);
1528 ntree->tree_interface.tag_items_changed();
1529 ED_node_tree_propagate_change(nullptr, bmain, ntree);
1530}
1531
1532/* ******** NodeLink ******** */
1533
1534static bool rna_NodeLink_is_hidden_get(PointerRNA *ptr)
1535{
1536 bNodeLink *link = static_cast<bNodeLink *>(ptr->data);
1538}
1539
1540static void rna_NodeLink_swap_multi_input_sort_id(
1541 ID *id, bNodeLink *self, Main *bmain, ReportList *reports, bNodeLink *other)
1542{
1543 if (self->tosock != other->tosock) {
1544 BKE_report(reports, RPT_ERROR_INVALID_INPUT, "The links must be siblings");
1545 return;
1546 }
1547
1548 std::swap(self->multi_input_sort_id, other->multi_input_sort_id);
1549
1550 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
1552 ED_node_tree_propagate_change(nullptr, bmain, ntree);
1554}
1555
1556/* ******** Node ******** */
1557
1558static StructRNA *rna_Node_refine(PointerRNA *ptr)
1559{
1560 bNode *node = static_cast<bNode *>(ptr->data);
1561
1562 if (node->typeinfo->rna_ext.srna) {
1563 return node->typeinfo->rna_ext.srna;
1564 }
1565 else {
1566 return ptr->type;
1567 }
1568}
1569
1570static std::optional<std::string> rna_Node_path(const PointerRNA *ptr)
1571{
1572 const bNode *node = static_cast<bNode *>(ptr->data);
1573 char name_esc[sizeof(node->name) * 2];
1574
1575 BLI_str_escape(name_esc, node->name, sizeof(name_esc));
1576 return fmt::format("nodes[\"{}\"]", name_esc);
1577}
1578
1579std::optional<std::string> rna_Node_ImageUser_path(const PointerRNA *ptr)
1580{
1581 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
1582 if (!ELEM(ntree->type, NTREE_SHADER, NTREE_CUSTOM)) {
1583 return std::nullopt;
1584 }
1585
1586 for (bNode *node = static_cast<bNode *>(ntree->nodes.first); node; node = node->next) {
1587 switch (node->type) {
1589 NodeTexEnvironment *data = static_cast<NodeTexEnvironment *>(node->storage);
1590 if (&data->iuser != ptr->data) {
1591 continue;
1592 }
1593 break;
1594 }
1595 case SH_NODE_TEX_IMAGE: {
1596 NodeTexImage *data = static_cast<NodeTexImage *>(node->storage);
1597 if (&data->iuser != ptr->data) {
1598 continue;
1599 }
1600 break;
1601 }
1602 default:
1603 continue;
1604 }
1605
1606 char name_esc[sizeof(node->name) * 2];
1607 BLI_str_escape(name_esc, node->name, sizeof(name_esc));
1608 return fmt::format("nodes[\"{}\"].image_user", name_esc);
1609 }
1610
1611 return std::nullopt;
1612}
1613
1614static bool rna_Node_poll(const blender::bke::bNodeType *ntype,
1615 const bNodeTree *ntree,
1616 const char ** /*r_disabled_hint*/)
1617{
1618 ParameterList list;
1619 FunctionRNA *func;
1620 void *ret;
1621 bool visible;
1622
1623 PointerRNA ptr = RNA_pointer_create(nullptr, ntype->rna_ext.srna, nullptr); /* dummy */
1624 func = &rna_Node_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
1625
1626 RNA_parameter_list_create(&list, &ptr, func);
1627 RNA_parameter_set_lookup(&list, "node_tree", &ntree);
1628 ntype->rna_ext.call(nullptr, &ptr, func, &list);
1629
1630 RNA_parameter_get_lookup(&list, "visible", &ret);
1631 visible = *static_cast<bool *>(ret);
1632
1634
1635 return visible;
1636}
1637
1638static bool rna_Node_poll_instance(const bNode *node,
1639 const bNodeTree *ntree,
1640 const char ** /*disabled_info*/)
1641{
1642 ParameterList list;
1643 FunctionRNA *func;
1644 void *ret;
1645 bool visible;
1646
1648 nullptr, node->typeinfo->rna_ext.srna, const_cast<bNode *>(node)); /* dummy */
1649 func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */
1650
1651 RNA_parameter_list_create(&list, &ptr, func);
1652 RNA_parameter_set_lookup(&list, "node_tree", &ntree);
1653 node->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
1654
1655 RNA_parameter_get_lookup(&list, "visible", &ret);
1656 visible = *static_cast<bool *>(ret);
1657
1659
1660 return visible;
1661}
1662
1663static bool rna_Node_poll_instance_default(const bNode *node,
1664 const bNodeTree *ntree,
1665 const char **disabled_info)
1666{
1667 /* use the basic poll function */
1668 return rna_Node_poll(node->typeinfo, ntree, disabled_info);
1669}
1670
1671static void rna_Node_update_reg(bNodeTree *ntree, bNode *node)
1672{
1673 ParameterList list;
1674 FunctionRNA *func;
1675
1677 reinterpret_cast<ID *>(ntree), node->typeinfo->rna_ext.srna, node);
1678 func = &rna_Node_update_func; /* RNA_struct_find_function(&ptr, "update"); */
1679
1680 RNA_parameter_list_create(&list, &ptr, func);
1681 node->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
1682
1684}
1685
1686static bool rna_Node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
1687{
1688 ParameterList list;
1689 FunctionRNA *func;
1690
1692 reinterpret_cast<ID *>(ntree), node->typeinfo->rna_ext.srna, node);
1693 func = &rna_Node_insert_link_func;
1694
1695 RNA_parameter_list_create(&list, &ptr, func);
1696 RNA_parameter_set_lookup(&list, "link", &link);
1697 node->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
1698
1700 return true;
1701}
1702
1703static void rna_Node_init(const bContext *C, PointerRNA *ptr)
1704{
1705 bNode *node = static_cast<bNode *>(ptr->data);
1706 ParameterList list;
1707 FunctionRNA *func;
1708
1709 func = &rna_Node_init_func; /* RNA_struct_find_function(&ptr, "init"); */
1710
1711 RNA_parameter_list_create(&list, ptr, func);
1712 node->typeinfo->rna_ext.call(const_cast<bContext *>(C), ptr, func, &list);
1713
1715}
1716
1717static void rna_Node_copy(PointerRNA *ptr, const bNode *copynode)
1718{
1719 bNode *node = static_cast<bNode *>(ptr->data);
1720 ParameterList list;
1721 FunctionRNA *func;
1722
1723 func = &rna_Node_copy_func; /* RNA_struct_find_function(&ptr, "copy"); */
1724
1725 RNA_parameter_list_create(&list, ptr, func);
1726 RNA_parameter_set_lookup(&list, "node", &copynode);
1727 node->typeinfo->rna_ext.call(nullptr, ptr, func, &list);
1728
1730}
1731
1732static void rna_Node_free(PointerRNA *ptr)
1733{
1734 bNode *node = static_cast<bNode *>(ptr->data);
1735 ParameterList list;
1736 FunctionRNA *func;
1737
1738 func = &rna_Node_free_func; /* RNA_struct_find_function(&ptr, "free"); */
1739
1740 RNA_parameter_list_create(&list, ptr, func);
1741 node->typeinfo->rna_ext.call(nullptr, ptr, func, &list);
1742
1744}
1745
1746static void rna_Node_draw_buttons(uiLayout *layout, bContext *C, PointerRNA *ptr)
1747{
1748 bNode *node = static_cast<bNode *>(ptr->data);
1749 ParameterList list;
1750 FunctionRNA *func;
1751
1752 func = &rna_Node_draw_buttons_func; /* RNA_struct_find_function(&ptr, "draw_buttons"); */
1753
1754 RNA_parameter_list_create(&list, ptr, func);
1755 RNA_parameter_set_lookup(&list, "context", &C);
1756 RNA_parameter_set_lookup(&list, "layout", &layout);
1757 node->typeinfo->rna_ext.call(C, ptr, func, &list);
1758
1760}
1761
1762static void rna_Node_draw_buttons_ext(uiLayout *layout, bContext *C, PointerRNA *ptr)
1763{
1764 bNode *node = static_cast<bNode *>(ptr->data);
1765 ParameterList list;
1766 FunctionRNA *func;
1767
1768 func = &rna_Node_draw_buttons_ext_func; /* RNA_struct_find_function(&ptr, "draw_buttons_ext"); */
1769
1770 RNA_parameter_list_create(&list, ptr, func);
1771 RNA_parameter_set_lookup(&list, "context", &C);
1772 RNA_parameter_set_lookup(&list, "layout", &layout);
1773 node->typeinfo->rna_ext.call(C, ptr, func, &list);
1774
1776}
1777
1778static void rna_Node_draw_label(const bNodeTree *ntree,
1779 const bNode *node,
1780 char *label,
1781 int label_maxncpy)
1782{
1783 ParameterList list;
1784 FunctionRNA *func;
1785 void *ret;
1786 char *rlabel;
1787
1788 func = &rna_Node_draw_label_func; /* RNA_struct_find_function(&ptr, "draw_label"); */
1789
1791 const_cast<ID *>(&ntree->id), &RNA_Node, const_cast<bNode *>(node));
1792 RNA_parameter_list_create(&list, &ptr, func);
1793 node->typeinfo->rna_ext.call(nullptr, &ptr, func, &list);
1794
1795 RNA_parameter_get_lookup(&list, "label", &ret);
1796 rlabel = static_cast<char *>(ret);
1797 BLI_strncpy(label, rlabel != nullptr ? rlabel : "", label_maxncpy);
1798
1800}
1801
1802static bool rna_Node_is_registered_node_type(StructRNA *type)
1803{
1804 return (RNA_struct_blender_type_get(type) != nullptr);
1805}
1806
1807static bool rna_Node_is_builtin(blender::bke::bNodeType *nt)
1808{
1809 BLI_assert(nt);
1810
1811 /* `nt->rna_ext.data` is the python object. If it's nullptr then it's a
1812 * builtin node. */
1813 return nt->rna_ext.data == nullptr;
1814}
1815
1816static void rna_Node_is_registered_node_type_runtime(bContext * /*C*/,
1817 ReportList * /*reports*/,
1818 PointerRNA *ptr,
1819 ParameterList *parms)
1820{
1821 int result = (RNA_struct_blender_type_get(ptr->type) != nullptr);
1822 RNA_parameter_set_lookup(parms, "result", &result);
1823}
1824
1825static bool rna_Node_unregister(Main * /*bmain*/, StructRNA *type)
1826{
1829
1830 if (!nt || rna_Node_is_builtin(nt)) {
1831 return false;
1832 }
1833
1836
1837 /* this also frees the allocated nt pointer, no MEM_free call needed! */
1839
1840 /* update while blender is running */
1842 return true;
1843}
1844
1845/* Generic internal registration function.
1846 * Can be used to implement callbacks for registerable RNA node sub-types.
1847 */
1848static blender::bke::bNodeType *rna_Node_register_base(Main *bmain,
1849 ReportList *reports,
1850 StructRNA *basetype,
1851 void *data,
1852 const char *identifier,
1853 StructValidateFunc validate,
1854 StructCallbackFunc call,
1856{
1857 blender::bke::bNodeType *nt, dummy_nt;
1858 bNode dummy_node;
1859 FunctionRNA *func;
1860 PropertyRNA *parm;
1861 bool have_function[10];
1862
1863 /* setup dummy node & node type to store static properties in */
1864 memset(&dummy_nt, 0, sizeof(blender::bke::bNodeType));
1865 /* this does some additional initialization of default values */
1866 blender::bke::node_type_base_custom(&dummy_nt, identifier, "", "CUSTOM", 0);
1867
1868 memset(&dummy_node, 0, sizeof(bNode));
1869 dummy_node.typeinfo = &dummy_nt;
1870 PointerRNA dummy_node_ptr = RNA_pointer_create(nullptr, basetype, &dummy_node);
1871
1872 /* validate the python class */
1873 if (validate(&dummy_node_ptr, data, have_function) != 0) {
1874 return nullptr;
1875 }
1876
1877 if (strlen(identifier) >= sizeof(dummy_nt.idname)) {
1878 BKE_reportf(reports,
1879 RPT_ERROR,
1880 "Registering node class: '%s' is too long, maximum length is %d",
1881 identifier,
1882 int(sizeof(dummy_nt.idname)));
1883 return nullptr;
1884 }
1885
1886 /* check if we have registered this node type before, and remove it */
1887 nt = blender::bke::node_type_find(dummy_nt.idname);
1888 if (nt) {
1889 /* If it's an internal node, we cannot proceed. */
1890 if (rna_Node_is_builtin(nt)) {
1891 BKE_reportf(reports,
1892 RPT_ERROR,
1893 "Registering node class: '%s', bl_idname '%s' is a builtin node",
1894 identifier,
1895 dummy_nt.idname);
1896 return nullptr;
1897 }
1898
1899 BKE_reportf(reports,
1900 RPT_INFO,
1901 "Registering node class: '%s', bl_idname '%s' has been registered before, "
1902 "unregistering previous",
1903 identifier,
1904 dummy_nt.idname);
1905
1906 /* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for nullptr. */
1907 if (!rna_Node_unregister(bmain, nt->rna_ext.srna)) {
1908 BKE_reportf(reports,
1909 RPT_ERROR,
1910 "Registering node class: '%s', bl_idname '%s' could not be unregistered",
1911 identifier,
1912 dummy_nt.idname);
1913 return nullptr;
1914 }
1915 }
1916
1917 /* create a new node type */
1918 nt = static_cast<blender::bke::bNodeType *>(
1919 MEM_mallocN(sizeof(blender::bke::bNodeType), "node type"));
1920 memcpy(nt, &dummy_nt, sizeof(dummy_nt));
1921 nt->free_self = reinterpret_cast<void (*)(blender::bke::bNodeType *)>(MEM_freeN);
1922
1923 nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, basetype);
1924 nt->rna_ext.data = data;
1925 nt->rna_ext.call = call;
1926 nt->rna_ext.free = free;
1928
1931
1933 nt->rna_ext.srna, "is_registered_node_type", rna_Node_is_registered_node_type_runtime);
1934 RNA_def_function_ui_description(func, "True if a registered node type");
1936 parm = RNA_def_boolean(func, "result", false, "Result", "");
1937 RNA_def_function_return(func, parm);
1938
1939 /* XXX bad level call! needed to initialize the basic draw functions ... */
1941
1942 nt->poll = (have_function[0]) ? rna_Node_poll : nullptr;
1943 nt->poll_instance = (have_function[1]) ? rna_Node_poll_instance : rna_Node_poll_instance_default;
1944 nt->updatefunc = (have_function[2]) ? rna_Node_update_reg : nullptr;
1945 nt->insert_link = (have_function[3]) ? rna_Node_insert_link : nullptr;
1946 nt->initfunc_api = (have_function[4]) ? rna_Node_init : nullptr;
1947 nt->copyfunc_api = (have_function[5]) ? rna_Node_copy : nullptr;
1948 nt->freefunc_api = (have_function[6]) ? rna_Node_free : nullptr;
1949 nt->draw_buttons = (have_function[7]) ? rna_Node_draw_buttons : nullptr;
1950 nt->draw_buttons_ex = (have_function[8]) ? rna_Node_draw_buttons_ext : nullptr;
1951 nt->labelfunc = (have_function[9]) ? rna_Node_draw_label : nullptr;
1952
1953 /* sanitize size values in case not all have been registered */
1954 if (nt->maxwidth < nt->minwidth) {
1955 nt->maxwidth = nt->minwidth;
1956 }
1957 if (nt->maxheight < nt->minheight) {
1958 nt->maxheight = nt->minheight;
1959 }
1960 CLAMP(nt->width, nt->minwidth, nt->maxwidth);
1961 CLAMP(nt->height, nt->minheight, nt->maxheight);
1962
1963 return nt;
1964}
1965
1966static StructRNA *rna_Node_register(Main *bmain,
1967 ReportList *reports,
1968 void *data,
1969 const char *identifier,
1970 StructValidateFunc validate,
1971 StructCallbackFunc call,
1973{
1974 blender::bke::bNodeType *nt = rna_Node_register_base(
1975 bmain, reports, &RNA_Node, data, identifier, validate, call, free);
1976 if (!nt) {
1977 return nullptr;
1978 }
1979
1981
1982 /* update while blender is running */
1984
1985 return nt->rna_ext.srna;
1986}
1987
1988static const EnumPropertyItem *itemf_function_check(
1989 const EnumPropertyItem *original_item_array,
1990 blender::FunctionRef<bool(const EnumPropertyItem *item)> value_supported)
1991{
1992 EnumPropertyItem *item_array = nullptr;
1993 int items_len = 0;
1994
1995 for (const EnumPropertyItem *item = original_item_array; item->identifier != nullptr; item++) {
1996 if (value_supported(item)) {
1997 RNA_enum_item_add(&item_array, &items_len, item);
1998 }
1999 }
2000
2001 RNA_enum_item_end(&item_array, &items_len);
2002 return item_array;
2003}
2004
2005static bool geometry_node_asset_trait_flag_get(PointerRNA *ptr,
2007{
2008 const bNodeTree *ntree = static_cast<const bNodeTree *>(ptr->data);
2009 if (!ntree->geometry_node_asset_traits) {
2010 return false;
2011 }
2012 return ntree->geometry_node_asset_traits->flag & flag;
2013}
2014
2015static void geometry_node_asset_trait_flag_set(PointerRNA *ptr,
2017 const bool value)
2018{
2019 bNodeTree *ntree = static_cast<bNodeTree *>(ptr->data);
2020 if (!ntree->geometry_node_asset_traits) {
2021 ntree->geometry_node_asset_traits = MEM_cnew<GeometryNodeAssetTraits>(__func__);
2022 }
2024}
2025
2026static bool rna_GeometryNodeTree_is_tool_get(PointerRNA *ptr)
2027{
2028 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_TOOL);
2029}
2030static void rna_GeometryNodeTree_is_tool_set(PointerRNA *ptr, bool value)
2031{
2032 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_TOOL, value);
2033}
2034
2035static bool rna_GeometryNodeTree_is_modifier_get(PointerRNA *ptr)
2036{
2037 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_MODIFIER);
2038}
2039static void rna_GeometryNodeTree_is_modifier_set(PointerRNA *ptr, bool value)
2040{
2041 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_MODIFIER, value);
2042}
2043
2044static bool rna_GeometryNodeTree_is_mode_object_get(PointerRNA *ptr)
2045{
2046 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_OBJECT);
2047}
2048static void rna_GeometryNodeTree_is_mode_object_set(PointerRNA *ptr, bool value)
2049{
2050 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_OBJECT, value);
2051}
2052
2053static bool rna_GeometryNodeTree_is_mode_edit_get(PointerRNA *ptr)
2054{
2055 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_EDIT);
2056}
2057static void rna_GeometryNodeTree_is_mode_edit_set(PointerRNA *ptr, bool value)
2058{
2059 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_EDIT, value);
2060}
2061
2062static bool rna_GeometryNodeTree_is_mode_sculpt_get(PointerRNA *ptr)
2063{
2064 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_SCULPT);
2065}
2066static void rna_GeometryNodeTree_is_mode_sculpt_set(PointerRNA *ptr, bool value)
2067{
2068 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_SCULPT, value);
2069}
2070
2071static bool rna_GeometryNodeTree_is_type_mesh_get(PointerRNA *ptr)
2072{
2073 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_MESH);
2074}
2075static void rna_GeometryNodeTree_is_type_mesh_set(PointerRNA *ptr, bool value)
2076{
2077 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_MESH, value);
2078}
2079
2080static bool rna_GeometryNodeTree_is_type_curve_get(PointerRNA *ptr)
2081{
2082 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_CURVE);
2083}
2084static void rna_GeometryNodeTree_is_type_curve_set(PointerRNA *ptr, bool value)
2085{
2086 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_CURVE, value);
2087}
2088
2089static bool rna_GeometryNodeTree_is_type_point_cloud_get(PointerRNA *ptr)
2090{
2091 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_POINT_CLOUD);
2092}
2093static void rna_GeometryNodeTree_is_type_point_cloud_set(PointerRNA *ptr, bool value)
2094{
2095 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_POINT_CLOUD, value);
2096}
2097
2098static bool rna_GeometryNodeTree_use_wait_for_click_get(PointerRNA *ptr)
2099{
2100 return geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_WAIT_FOR_CURSOR);
2101}
2102static void rna_GeometryNodeTree_use_wait_for_click_set(PointerRNA *ptr, bool value)
2103{
2104 geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_WAIT_FOR_CURSOR, value);
2105}
2106
2107static bool random_value_type_supported(const EnumPropertyItem *item)
2108{
2110}
2111static const EnumPropertyItem *rna_FunctionNodeRandomValue_type_itemf(bContext * /*C*/,
2112 PointerRNA * /*ptr*/,
2113 PropertyRNA * /*prop*/,
2114 bool *r_free)
2115{
2116 *r_free = true;
2117 return itemf_function_check(rna_enum_attribute_type_items, random_value_type_supported);
2118}
2119
2121{
2122 return ELEM(item->value,
2132}
2133
2134static bool generic_attribute_type_supported_with_socket(const EnumPropertyItem *item)
2135{
2136 return generic_attribute_type_supported(item) &&
2138}
2139
2140static const EnumPropertyItem *rna_GeometryNodeAttributeType_type_with_socket_itemf(
2141 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
2142{
2143 *r_free = true;
2144 return itemf_function_check(rna_enum_attribute_type_items,
2145 generic_attribute_type_supported_with_socket);
2146}
2147
2148static const EnumPropertyItem *rna_GeometryNodeAttributeDomain_attribute_domain_itemf(
2149 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
2150{
2151 using namespace blender;
2152 EnumPropertyItem *item_array = nullptr;
2153 int items_len = 0;
2154
2155 for (const EnumPropertyItem *item = rna_enum_attribute_domain_items; item->identifier != nullptr;
2156 item++)
2157 {
2158 RNA_enum_item_add(&item_array, &items_len, item);
2159 }
2160 RNA_enum_item_end(&item_array, &items_len);
2161
2162 *r_free = true;
2163 return item_array;
2164}
2165
2166static StructRNA *rna_ShaderNode_register(Main *bmain,
2167 ReportList *reports,
2168 void *data,
2169 const char *identifier,
2170 StructValidateFunc validate,
2171 StructCallbackFunc call,
2173{
2174 blender::bke::bNodeType *nt = rna_Node_register_base(
2175 bmain, reports, &RNA_ShaderNode, data, identifier, validate, call, free);
2176 if (!nt) {
2177 return nullptr;
2178 }
2179
2181
2182 /* update while blender is running */
2184
2185 return nt->rna_ext.srna;
2186}
2187
2188static StructRNA *rna_CompositorNode_register(Main *bmain,
2189 ReportList *reports,
2190 void *data,
2191 const char *identifier,
2192 StructValidateFunc validate,
2193 StructCallbackFunc call,
2195{
2196 blender::bke::bNodeType *nt = rna_Node_register_base(
2197 bmain, reports, &RNA_CompositorNode, data, identifier, validate, call, free);
2198 if (!nt) {
2199 return nullptr;
2200 }
2201
2203
2204 /* update while blender is running */
2206
2207 return nt->rna_ext.srna;
2208}
2209
2210static StructRNA *rna_TextureNode_register(Main *bmain,
2211 ReportList *reports,
2212 void *data,
2213 const char *identifier,
2214 StructValidateFunc validate,
2215 StructCallbackFunc call,
2217{
2218 blender::bke::bNodeType *nt = rna_Node_register_base(
2219 bmain, reports, &RNA_TextureNode, data, identifier, validate, call, free);
2220 if (!nt) {
2221 return nullptr;
2222 }
2223
2225
2226 /* update while blender is running */
2228
2229 return nt->rna_ext.srna;
2230}
2231
2232static StructRNA *rna_GeometryNode_register(Main *bmain,
2233 ReportList *reports,
2234 void *data,
2235 const char *identifier,
2236 StructValidateFunc validate,
2237 StructCallbackFunc call,
2239{
2240 blender::bke::bNodeType *nt = rna_Node_register_base(
2241 bmain, reports, &RNA_GeometryNode, data, identifier, validate, call, free);
2242 if (!nt) {
2243 return nullptr;
2244 }
2245
2247
2248 /* update while blender is running */
2250
2251 return nt->rna_ext.srna;
2252}
2253
2254static StructRNA *rna_FunctionNode_register(Main *bmain,
2255 ReportList *reports,
2256 void *data,
2257 const char *identifier,
2258 StructValidateFunc validate,
2259 StructCallbackFunc call,
2261{
2262 blender::bke::bNodeType *nt = rna_Node_register_base(
2263 bmain, reports, &RNA_FunctionNode, data, identifier, validate, call, free);
2264 if (!nt) {
2265 return nullptr;
2266 }
2267
2269
2270 /* update while blender is running */
2272
2273 return nt->rna_ext.srna;
2274}
2275
2276static IDProperty **rna_Node_idprops(PointerRNA *ptr)
2277{
2278 bNode *node = static_cast<bNode *>(ptr->data);
2279 return &node->prop;
2280}
2281
2282static void rna_Node_parent_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
2283{
2284 bNode *node = static_cast<bNode *>(ptr->data);
2285 bNode *parent = static_cast<bNode *>(value.data);
2286 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2287
2288 if (!parent) {
2289 blender::bke::node_detach_node(ntree, node);
2290 return;
2291 }
2292
2293 /* XXX only Frame node allowed for now,
2294 * in the future should have a poll function or so to test possible attachment.
2295 */
2296 if (parent->type != NODE_FRAME) {
2297 return;
2298 }
2299
2300 if (blender::bke::node_is_parent_and_child(node, parent)) {
2301 return;
2302 }
2303
2304 blender::bke::node_detach_node(ntree, node);
2305 blender::bke::node_attach_node(ntree, node, parent);
2306}
2307
2308static void rna_Node_internal_links_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
2309{
2310 bNode *node = static_cast<bNode *>(ptr->data);
2311 bNodeLink *begin;
2312 int len;
2313 blender::bke::node_internal_links(node, &begin, &len);
2314 rna_iterator_array_begin(iter, begin, sizeof(bNodeLink), len, false, nullptr);
2315}
2316
2321static bool allow_identifier_lookup(const bNode &node)
2322{
2323 switch (node.type) {
2325 case SH_NODE_MIX:
2326 case FN_NODE_COMPARE:
2327 case SH_NODE_MAP_RANGE:
2328 return false;
2329 default:
2330 return true;
2331 }
2332}
2333
2334static bNodeSocket *find_socket_by_key(bNode &node,
2335 const eNodeSocketInOut in_out,
2336 const blender::StringRef key)
2337{
2338 ListBase *sockets = in_out == SOCK_IN ? &node.inputs : &node.outputs;
2339 if (allow_identifier_lookup(node)) {
2340 LISTBASE_FOREACH (bNodeSocket *, socket, sockets) {
2341 if (socket->is_available()) {
2342 if (socket->identifier == key) {
2343 return socket;
2344 }
2345 }
2346 }
2347 }
2348 LISTBASE_FOREACH (bNodeSocket *, socket, sockets) {
2349 if (socket->is_available()) {
2350 if (socket->name == key) {
2351 return socket;
2352 }
2353 }
2354 }
2355 return nullptr;
2356}
2357
2358static bool rna_NodeInputs_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
2359{
2360 bNode *node = static_cast<bNode *>(ptr->data);
2361 if (bNodeSocket *socket = find_socket_by_key(*node, SOCK_IN, key)) {
2362 *r_ptr = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, socket);
2363 return true;
2364 }
2365 return false;
2366}
2367
2368static bool rna_NodeOutputs_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
2369{
2370 bNode *node = static_cast<bNode *>(ptr->data);
2371 if (bNodeSocket *socket = find_socket_by_key(*node, SOCK_OUT, key)) {
2372 *r_ptr = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, socket);
2373 return true;
2374 }
2375 return false;
2376}
2377
2378static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value)
2379{
2380 bNode *node = static_cast<bNode *>(ptr->data);
2381 bNode *parent = static_cast<bNode *>(value.data);
2382
2383 /* XXX only Frame node allowed for now,
2384 * in the future should have a poll function or so to test possible attachment.
2385 */
2386 if (parent->type != NODE_FRAME) {
2387 return false;
2388 }
2389
2390 if (node->type == NODE_FRAME && blender::bke::node_is_parent_and_child(node, parent)) {
2391 return false;
2392 }
2393
2394 return true;
2395}
2396
2397void rna_Node_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
2398{
2399 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2400 bNode *node = static_cast<bNode *>(ptr->data);
2402 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2403}
2404
2405void rna_Node_update_relations(Main *bmain, Scene *scene, PointerRNA *ptr)
2406{
2407 rna_Node_update(bmain, scene, ptr);
2409}
2410
2411static void rna_Node_socket_value_update(ID *id, bNode * /*node*/, bContext *C)
2412{
2413 BKE_ntree_update_tag_all(reinterpret_cast<bNodeTree *>(id));
2414 ED_node_tree_propagate_change(C, CTX_data_main(C), reinterpret_cast<bNodeTree *>(id));
2415}
2416
2417static void rna_Node_select_set(PointerRNA *ptr, bool value)
2418{
2419 bNode *node = static_cast<bNode *>(ptr->data);
2421}
2422
2423static void rna_Node_name_set(PointerRNA *ptr, const char *value)
2424{
2425 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2426 bNode *node = static_cast<bNode *>(ptr->data);
2427 char oldname[sizeof(node->name)];
2428
2429 /* make a copy of the old name first */
2430 STRNCPY(oldname, node->name);
2431 /* set new name */
2432 STRNCPY_UTF8(node->name, value);
2433
2434 blender::bke::node_unique_name(ntree, node);
2435
2436 /* fix all the animation data which may link to this */
2437 BKE_animdata_fix_paths_rename_all(nullptr, "nodes", oldname, node->name);
2438}
2439
2440static bool allow_changing_sockets(bNode *node)
2441{
2442 return ELEM(node->type, NODE_CUSTOM, SH_NODE_SCRIPT, CMP_NODE_OUTPUT_FILE);
2443}
2444
2445static bNodeSocket *rna_Node_inputs_new(ID *id,
2446 bNode *node,
2447 Main *bmain,
2448 ReportList *reports,
2449 const char *type,
2450 const char *name,
2451 const char *identifier,
2452 const bool use_multi_input)
2453{
2454 if (!allow_changing_sockets(node)) {
2455 BKE_report(reports, RPT_ERROR, "Cannot add socket to built-in node");
2456 return nullptr;
2457 }
2458
2459 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2460 bNodeSocket *sock = blender::bke::node_add_socket(ntree, node, SOCK_IN, type, identifier, name);
2461
2462 if (sock == nullptr) {
2463 BKE_report(reports, RPT_ERROR, "Unable to create socket");
2464 }
2465 else {
2466 if (use_multi_input) {
2467 sock->flag |= SOCK_MULTI_INPUT;
2468 }
2469 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2471 }
2472
2473 return sock;
2474}
2475
2476static bNodeSocket *rna_Node_outputs_new(ID *id,
2477 bNode *node,
2478 Main *bmain,
2479 ReportList *reports,
2480 const char *type,
2481 const char *name,
2482 const char *identifier,
2483 const bool use_multi_input)
2484{
2485 if (!allow_changing_sockets(node)) {
2486 BKE_report(reports, RPT_ERROR, "Cannot add socket to built-in node");
2487 return nullptr;
2488 }
2489
2490 if (use_multi_input) {
2491 BKE_report(reports, RPT_ERROR, "Output sockets cannot be multi-input");
2492 return nullptr;
2493 }
2494
2495 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2496 bNodeSocket *sock = blender::bke::node_add_socket(ntree, node, SOCK_OUT, type, identifier, name);
2497
2498 if (sock == nullptr) {
2499 BKE_report(reports, RPT_ERROR, "Unable to create socket");
2500 }
2501 else {
2502 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2504 }
2505
2506 return sock;
2507}
2508
2509static void rna_Node_socket_remove(
2510 ID *id, bNode *node, Main *bmain, ReportList *reports, bNodeSocket *sock)
2511{
2512 if (!allow_changing_sockets(node)) {
2513 BKE_report(reports, RPT_ERROR, "Unable to remove socket from built-in node");
2514 return;
2515 }
2516
2517 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2518
2519 if (BLI_findindex(&node->inputs, sock) == -1 && BLI_findindex(&node->outputs, sock) == -1) {
2520 BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
2521 }
2522 else {
2523 blender::bke::node_remove_socket(ntree, node, sock);
2524
2525 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2527 }
2528}
2529
2530static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain, ReportList *reports)
2531{
2532 if (!allow_changing_sockets(node)) {
2533 BKE_report(reports, RPT_ERROR, "Unable to remove sockets from built-in node");
2534 return;
2535 }
2536
2537 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2538 bNodeSocket *sock, *nextsock;
2539
2540 for (sock = static_cast<bNodeSocket *>(node->inputs.first); sock; sock = nextsock) {
2541 nextsock = sock->next;
2542 blender::bke::node_remove_socket(ntree, node, sock);
2543 }
2544
2545 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2547}
2548
2549static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain, ReportList *reports)
2550{
2551 if (!allow_changing_sockets(node)) {
2552 BKE_report(reports, RPT_ERROR, "Unable to remove socket from built-in node");
2553 return;
2554 }
2555
2556 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2557 bNodeSocket *sock, *nextsock;
2558
2559 for (sock = static_cast<bNodeSocket *>(node->outputs.first); sock; sock = nextsock) {
2560 nextsock = sock->next;
2561 blender::bke::node_remove_socket(ntree, node, sock);
2562 }
2563
2564 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2566}
2567
2568static void rna_Node_inputs_move(
2569 ID *id, bNode *node, Main *bmain, ReportList *reports, int from_index, int to_index)
2570{
2571 if (!allow_changing_sockets(node)) {
2572 BKE_report(reports, RPT_ERROR, "Unable to move sockets in built-in node");
2573 return;
2574 }
2575
2576 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2577 bNodeSocket *sock;
2578
2579 if (from_index == to_index) {
2580 return;
2581 }
2582 if (from_index < 0 || to_index < 0) {
2583 return;
2584 }
2585
2586 sock = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, from_index));
2587 if (to_index < from_index) {
2588 bNodeSocket *nextsock = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, to_index));
2589 if (nextsock) {
2590 BLI_remlink(&node->inputs, sock);
2591 BLI_insertlinkbefore(&node->inputs, nextsock, sock);
2592 }
2593 }
2594 else {
2595 bNodeSocket *prevsock = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, to_index));
2596 if (prevsock) {
2597 BLI_remlink(&node->inputs, sock);
2598 BLI_insertlinkafter(&node->inputs, prevsock, sock);
2599 }
2600 }
2601
2603 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2605}
2606
2607static void rna_Node_outputs_move(
2608 ID *id, bNode *node, Main *bmain, ReportList *reports, int from_index, int to_index)
2609{
2610 if (!allow_changing_sockets(node)) {
2611 BKE_report(reports, RPT_ERROR, "Unable to move sockets in built-in node");
2612 return;
2613 }
2614
2615 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2616 bNodeSocket *sock;
2617
2618 if (from_index == to_index) {
2619 return;
2620 }
2621 if (from_index < 0 || to_index < 0) {
2622 return;
2623 }
2624
2625 sock = static_cast<bNodeSocket *>(BLI_findlink(&node->outputs, from_index));
2626 if (to_index < from_index) {
2627 bNodeSocket *nextsock = static_cast<bNodeSocket *>(BLI_findlink(&node->outputs, to_index));
2628 if (nextsock) {
2629 BLI_remlink(&node->outputs, sock);
2630 BLI_insertlinkbefore(&node->outputs, nextsock, sock);
2631 }
2632 }
2633 else {
2634 bNodeSocket *prevsock = static_cast<bNodeSocket *>(BLI_findlink(&node->outputs, to_index));
2635 if (prevsock) {
2636 BLI_remlink(&node->outputs, sock);
2637 BLI_insertlinkafter(&node->outputs, prevsock, sock);
2638 }
2639 }
2640
2642 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2644}
2645
2646static void rna_Node_width_range(
2647 PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
2648{
2649 bNode *node = static_cast<bNode *>(ptr->data);
2650 *min = *softmin = node->typeinfo->minwidth;
2651 *max = *softmax = node->typeinfo->maxwidth;
2652}
2653
2654static void rna_Node_height_range(
2655 PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
2656{
2657 bNode *node = static_cast<bNode *>(ptr->data);
2658 *min = *softmin = node->typeinfo->minheight;
2659 *max = *softmax = node->typeinfo->maxheight;
2660}
2661
2662static void rna_Node_dimensions_get(PointerRNA *ptr, float *value)
2663{
2664 bNode *node = static_cast<bNode *>(ptr->data);
2665 blender::bke::node_dimensions_get(node, &value[0], &value[1]);
2666}
2667
2668/* ******** Node Types ******** */
2669
2670static void rna_NodeInternalSocketTemplate_name_get(PointerRNA *ptr, char *value)
2671{
2673 ptr->data);
2674 strcpy(value, stemp->name);
2675}
2676
2677static int rna_NodeInternalSocketTemplate_name_length(PointerRNA *ptr)
2678{
2680 ptr->data);
2681 return strlen(stemp->name);
2682}
2683
2684static void rna_NodeInternalSocketTemplate_identifier_get(PointerRNA *ptr, char *value)
2685{
2687 ptr->data);
2688 strcpy(value, stemp->identifier);
2689}
2690
2691static int rna_NodeInternalSocketTemplate_identifier_length(PointerRNA *ptr)
2692{
2694 ptr->data);
2695 return strlen(stemp->identifier);
2696}
2697
2698static int rna_NodeInternalSocketTemplate_type_get(PointerRNA *ptr)
2699{
2701 ptr->data);
2702 return stemp->type;
2703}
2704
2705static PointerRNA rna_NodeInternal_input_template(StructRNA *srna, int index)
2706{
2707 blender::bke::bNodeType *ntype = static_cast<blender::bke::bNodeType *>(
2709 if (ntype && ntype->inputs) {
2711 int i = 0;
2712 while (i < index && stemp->type >= 0) {
2713 i++;
2714 stemp++;
2715 }
2716 if (i == index && stemp->type >= 0) {
2717 PointerRNA ptr = RNA_pointer_create(nullptr, &RNA_NodeInternalSocketTemplate, stemp);
2718 return ptr;
2719 }
2720 }
2721 return PointerRNA_NULL;
2722}
2723
2724static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index)
2725{
2726 blender::bke::bNodeType *ntype = static_cast<blender::bke::bNodeType *>(
2728 if (ntype && ntype->outputs) {
2730 int i = 0;
2731 while (i < index && stemp->type >= 0) {
2732 i++;
2733 stemp++;
2734 }
2735 if (i == index && stemp->type >= 0) {
2736 PointerRNA ptr = RNA_pointer_create(nullptr, &RNA_NodeInternalSocketTemplate, stemp);
2737 return ptr;
2738 }
2739 }
2740 return PointerRNA_NULL;
2741}
2742
2743static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree)
2744{
2745 blender::bke::bNodeType *ntype = static_cast<blender::bke::bNodeType *>(
2747 const char *disabled_hint;
2748 return ntype && (!ntype->poll || ntype->poll(ntype, ntree, &disabled_hint));
2749}
2750
2751static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree)
2752{
2753 blender::bke::bNodeType *ntype = node->typeinfo;
2754 const char *disabled_hint;
2755 if (ntype->poll_instance) {
2756 return ntype->poll_instance(node, ntree, &disabled_hint);
2757 }
2758 else {
2759 /* fall back to basic poll function */
2760 return !ntype->poll || ntype->poll(ntype, ntree, &disabled_hint);
2761 }
2762}
2763
2764static void rna_NodeInternal_update(ID *id, bNode *node, Main *bmain)
2765{
2766 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
2768 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2769}
2770
2771static void rna_NodeInternal_draw_buttons(ID *id, bNode *node, bContext *C, uiLayout *layout)
2772{
2773 if (node->typeinfo->draw_buttons) {
2774 PointerRNA ptr = RNA_pointer_create(id, &RNA_Node, node);
2775 node->typeinfo->draw_buttons(layout, C, &ptr);
2776 }
2777}
2778
2779static void rna_NodeInternal_draw_buttons_ext(ID *id, bNode *node, bContext *C, uiLayout *layout)
2780{
2781 if (node->typeinfo->draw_buttons_ex) {
2782 PointerRNA ptr = RNA_pointer_create(id, &RNA_Node, node);
2783 node->typeinfo->draw_buttons_ex(layout, C, &ptr);
2784 }
2785 else if (node->typeinfo->draw_buttons) {
2786 PointerRNA ptr = RNA_pointer_create(id, &RNA_Node, node);
2787 node->typeinfo->draw_buttons(layout, C, &ptr);
2788 }
2789}
2790
2791static StructRNA *rna_NodeCustomGroup_register(Main *bmain,
2792 ReportList *reports,
2793 void *data,
2794 const char *identifier,
2795 StructValidateFunc validate,
2796 StructCallbackFunc call,
2798{
2799 blender::bke::bNodeType *nt = rna_Node_register_base(
2800 bmain, reports, &RNA_NodeCustomGroup, data, identifier, validate, call, free);
2801 if (!nt) {
2802 return nullptr;
2803 }
2804
2806
2807 /* update while blender is running */
2809
2810 return nt->rna_ext.srna;
2811}
2812
2813static StructRNA *rna_GeometryNodeCustomGroup_register(Main *bmain,
2814 ReportList *reports,
2815 void *data,
2816 const char *identifier,
2817 StructValidateFunc validate,
2818 StructCallbackFunc call,
2820{
2821 blender::bke::bNodeType *nt = rna_Node_register_base(
2822 bmain, reports, &RNA_GeometryNodeCustomGroup, data, identifier, validate, call, free);
2823
2824 if (!nt) {
2825 return nullptr;
2826 }
2827
2828 nt->type = NODE_CUSTOM_GROUP;
2829
2831
2833
2835
2836 return nt->rna_ext.srna;
2837}
2838
2840
2841static StructRNA *rna_ShaderNodeCustomGroup_register(Main *bmain,
2842 ReportList *reports,
2843 void *data,
2844 const char *identifier,
2845 StructValidateFunc validate,
2846 StructCallbackFunc call,
2848{
2849 blender::bke::bNodeType *nt = rna_Node_register_base(
2850 bmain, reports, &RNA_ShaderNodeCustomGroup, data, identifier, validate, call, free);
2851
2852 if (!nt) {
2853 return nullptr;
2854 }
2855
2856 nt->type = NODE_CUSTOM_GROUP;
2857
2859
2861
2863
2864 return nt->rna_ext.srna;
2865}
2866
2867static StructRNA *rna_CompositorNodeCustomGroup_register(Main *bmain,
2868 ReportList *reports,
2869 void *data,
2870 const char *identifier,
2871 StructValidateFunc validate,
2872 StructCallbackFunc call,
2874{
2875 blender::bke::bNodeType *nt = rna_Node_register_base(
2876 bmain, reports, &RNA_CompositorNodeCustomGroup, data, identifier, validate, call, free);
2877 if (!nt) {
2878 return nullptr;
2879 }
2880
2881 nt->type = NODE_CUSTOM_GROUP;
2882
2884
2886
2888
2889 return nt->rna_ext.srna;
2890}
2891
2892static void rna_CompositorNode_tag_need_exec(bNode *node)
2893{
2895}
2896
2897static void rna_Node_tex_image_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
2898{
2899 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2900 bNode *node = static_cast<bNode *>(ptr->data);
2901
2903 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2905}
2906
2907static void rna_NodeGroup_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
2908{
2909 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2910 bNode *node = static_cast<bNode *>(ptr->data);
2911
2913 ED_node_tree_propagate_change(nullptr, bmain, ntree);
2915}
2916
2917static void rna_NodeGroup_node_tree_set(PointerRNA *ptr,
2918 const PointerRNA value,
2919 ReportList * /*reports*/)
2920{
2921 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2922 bNode *node = static_cast<bNode *>(ptr->data);
2923 bNodeTree *ngroup = static_cast<bNodeTree *>(value.data);
2924
2925 const char *disabled_hint = nullptr;
2926 if (blender::bke::node_group_poll(ntree, ngroup, &disabled_hint)) {
2927 if (node->id) {
2928 id_us_min(node->id);
2929 }
2930 if (ngroup) {
2931 id_us_plus(&ngroup->id);
2932 }
2933
2934 node->id = &ngroup->id;
2935 }
2936}
2937
2938static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
2939{
2940 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
2941 bNodeTree *ngroup = static_cast<bNodeTree *>(value.data);
2942
2943 /* only allow node trees of the same type as the group node's tree */
2944 if (ngroup->type != ntree->type) {
2945 return false;
2946 }
2947
2948 const char *disabled_hint = nullptr;
2949 return blender::bke::node_group_poll(ntree, ngroup, &disabled_hint);
2950}
2951
2952static void rna_distance_matte_t1_set(PointerRNA *ptr, float value)
2953{
2954 bNode *node = static_cast<bNode *>(ptr->data);
2955 NodeChroma *chroma = static_cast<NodeChroma *>(node->storage);
2956
2957 chroma->t1 = value;
2958}
2959
2960static void rna_distance_matte_t2_set(PointerRNA *ptr, float value)
2961{
2962 bNode *node = static_cast<bNode *>(ptr->data);
2963 NodeChroma *chroma = static_cast<NodeChroma *>(node->storage);
2964
2965 chroma->t2 = value;
2966}
2967
2968static void rna_difference_matte_t1_set(PointerRNA *ptr, float value)
2969{
2970 bNode *node = static_cast<bNode *>(ptr->data);
2971 NodeChroma *chroma = static_cast<NodeChroma *>(node->storage);
2972
2973 chroma->t1 = value;
2974}
2975
2976static void rna_difference_matte_t2_set(PointerRNA *ptr, float value)
2977{
2978 bNode *node = static_cast<bNode *>(ptr->data);
2979 NodeChroma *chroma = static_cast<NodeChroma *>(node->storage);
2980
2981 chroma->t2 = value;
2982}
2983
2984/* Button Set Functions for Matte Nodes */
2985static void rna_Matte_t1_set(PointerRNA *ptr, float value)
2986{
2987 bNode *node = static_cast<bNode *>(ptr->data);
2988 NodeChroma *chroma = static_cast<NodeChroma *>(node->storage);
2989
2990 chroma->t1 = value;
2991
2992 if (value < chroma->t2) {
2993 chroma->t2 = value;
2994 }
2995}
2996
2997static void rna_Matte_t2_set(PointerRNA *ptr, float value)
2998{
2999 bNode *node = static_cast<bNode *>(ptr->data);
3000 NodeChroma *chroma = static_cast<NodeChroma *>(node->storage);
3001
3002 if (value > chroma->t1) {
3003 value = chroma->t1;
3004 }
3005
3006 chroma->t2 = value;
3007}
3008
3009static void rna_Node_scene_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
3010{
3011 bNode *node = static_cast<bNode *>(ptr->data);
3012
3013 if (node->id) {
3014 id_us_min(node->id);
3015 node->id = nullptr;
3016 }
3017
3018 node->id = static_cast<ID *>(value.data);
3019
3020 id_us_plus(node->id);
3021}
3022
3023static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3024{
3025 bNode *node = static_cast<bNode *>(ptr->data);
3026 Image *ima = reinterpret_cast<Image *>(node->id);
3027 ImageUser *iuser = static_cast<ImageUser *>(node->storage);
3028
3029 if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
3030 return;
3031 }
3032
3033 BKE_image_multilayer_index(ima->rr, iuser);
3034 BKE_image_signal(bmain, ima, iuser, IMA_SIGNAL_SRC_CHANGE);
3035
3036 rna_Node_update(bmain, scene, ptr);
3037
3038 if (scene != nullptr && scene->nodetree != nullptr) {
3039 ntreeCompositUpdateRLayers(scene->nodetree);
3040 }
3041}
3042
3043static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
3044{
3045 EnumPropertyItem *item = nullptr;
3046 EnumPropertyItem tmp = {0};
3047 int i = 0, totitem = 0;
3048
3049 while (rl) {
3050 tmp.identifier = rl->name;
3051 /* Little trick: using space char instead empty string
3052 * makes the item selectable in the drop-down. */
3053 if (rl->name[0] == '\0') {
3054 tmp.name = " ";
3055 }
3056 else {
3057 tmp.name = rl->name;
3058 }
3059 tmp.value = i++;
3060 RNA_enum_item_add(&item, &totitem, &tmp);
3061 rl = rl->next;
3062 }
3063
3064 RNA_enum_item_end(&item, &totitem);
3065
3066 return item;
3067}
3068
3069static const EnumPropertyItem *rna_ShaderNodeMix_data_type_itemf(bContext * /*C*/,
3070 PointerRNA *ptr,
3071 PropertyRNA * /*prop*/,
3072 bool *r_free)
3073{
3074 *r_free = true;
3075
3076 const auto rotation_supported_mix = [&](const EnumPropertyItem *item) -> bool {
3077 const eNodeSocketDatatype data_type = eNodeSocketDatatype(item->value);
3078 if (data_type == SOCK_ROTATION) {
3079 const bNodeTree *tree = reinterpret_cast<const bNodeTree *>(ptr->owner_id);
3080 if (tree->type == NTREE_GEOMETRY) {
3081 return true;
3082 }
3083 }
3084 return ELEM(data_type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA);
3085 };
3086
3087 return itemf_function_check(rna_enum_mix_data_type_items, rotation_supported_mix);
3088}
3089
3090static const EnumPropertyItem *rna_Node_image_layer_itemf(bContext * /*C*/,
3091 PointerRNA *ptr,
3092 PropertyRNA * /*prop*/,
3093 bool *r_free)
3094{
3095 bNode *node = static_cast<bNode *>(ptr->data);
3096 Image *ima = reinterpret_cast<Image *>(node->id);
3097 const EnumPropertyItem *item = nullptr;
3098 RenderLayer *rl;
3099
3100 if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
3102 }
3103
3104 if (ima == nullptr || ima->rr == nullptr) {
3105 *r_free = false;
3107 }
3108
3109 rl = static_cast<RenderLayer *>(ima->rr->layers.first);
3110 item = renderresult_layers_add_enum(rl);
3111
3112 *r_free = true;
3113
3114 return item;
3115}
3116
3117static bool rna_Node_image_has_layers_get(PointerRNA *ptr)
3118{
3119 bNode *node = static_cast<bNode *>(ptr->data);
3120 Image *ima = reinterpret_cast<Image *>(node->id);
3121
3122 if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
3123 return false;
3124 }
3125
3126 if (!ima || !(ima->rr)) {
3127 return false;
3128 }
3129
3130 return RE_layers_have_name(ima->rr);
3131}
3132
3133static bool rna_Node_image_has_views_get(PointerRNA *ptr)
3134{
3135 bNode *node = static_cast<bNode *>(ptr->data);
3136 Image *ima = reinterpret_cast<Image *>(node->id);
3137
3138 if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
3139 return false;
3140 }
3141
3142 if (!ima || !(ima->rr)) {
3143 return false;
3144 }
3145
3146 return BLI_listbase_count_at_most(&ima->rr->views, 2) > 1;
3147}
3148
3149static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv)
3150{
3151 EnumPropertyItem *item = nullptr;
3152 EnumPropertyItem tmp = {0, "ALL", 0, "All", ""};
3153 int i = 1, totitem = 0;
3154
3155 /* option to use all views */
3156 RNA_enum_item_add(&item, &totitem, &tmp);
3157
3158 while (rv) {
3159 tmp.identifier = rv->name;
3160 /* Little trick: using space char instead empty string
3161 * makes the item selectable in the drop-down. */
3162 if (rv->name[0] == '\0') {
3163 tmp.name = " ";
3164 }
3165 else {
3166 tmp.name = rv->name;
3167 }
3168 tmp.value = i++;
3169 RNA_enum_item_add(&item, &totitem, &tmp);
3170 rv = rv->next;
3171 }
3172
3173 RNA_enum_item_end(&item, &totitem);
3174
3175 return item;
3176}
3177
3178static const EnumPropertyItem *rna_Node_image_view_itemf(bContext * /*C*/,
3179 PointerRNA *ptr,
3180 PropertyRNA * /*prop*/,
3181 bool *r_free)
3182{
3183 bNode *node = static_cast<bNode *>(ptr->data);
3184 Image *ima = reinterpret_cast<Image *>(node->id);
3185 const EnumPropertyItem *item = nullptr;
3186 RenderView *rv;
3187
3188 if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
3190 }
3191
3192 if (ima == nullptr || ima->rr == nullptr) {
3193 *r_free = false;
3195 }
3196
3197 rv = static_cast<RenderView *>(ima->rr->views.first);
3198 item = renderresult_views_add_enum(rv);
3199
3200 *r_free = true;
3201
3202 return item;
3203}
3204
3205static const EnumPropertyItem *rna_Node_view_layer_itemf(bContext * /*C*/,
3206 PointerRNA *ptr,
3207 PropertyRNA * /*prop*/,
3208 bool *r_free)
3209{
3210 bNode *node = static_cast<bNode *>(ptr->data);
3211 Scene *sce = reinterpret_cast<Scene *>(node->id);
3212 const EnumPropertyItem *item = nullptr;
3213 RenderLayer *rl;
3214
3215 if (sce == nullptr) {
3216 *r_free = false;
3218 }
3219
3220 rl = static_cast<RenderLayer *>(sce->view_layers.first);
3221 item = renderresult_layers_add_enum(rl);
3222
3223 *r_free = true;
3224
3225 return item;
3226}
3227
3228static void rna_Node_view_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3229{
3230 rna_Node_update_relations(bmain, scene, ptr);
3231 if (scene != nullptr && scene->nodetree != nullptr) {
3232 ntreeCompositUpdateRLayers(scene->nodetree);
3233 }
3234}
3235
3236static const EnumPropertyItem *rna_Node_channel_itemf(bContext * /*C*/,
3237 PointerRNA *ptr,
3238 PropertyRNA * /*prop*/,
3239 bool *r_free)
3240{
3241 bNode *node = static_cast<bNode *>(ptr->data);
3242 EnumPropertyItem *item = nullptr;
3243 EnumPropertyItem tmp = {0};
3244 int totitem = 0;
3245
3246 switch (node->custom1) {
3248 tmp.identifier = "R";
3249 tmp.name = "R";
3250 tmp.value = 1;
3251 RNA_enum_item_add(&item, &totitem, &tmp);
3252 tmp.identifier = "G";
3253 tmp.name = "G";
3254 tmp.value = 2;
3255 RNA_enum_item_add(&item, &totitem, &tmp);
3256 tmp.identifier = "B";
3257 tmp.name = "B";
3258 tmp.value = 3;
3259 RNA_enum_item_add(&item, &totitem, &tmp);
3260 break;
3262 tmp.identifier = "H";
3263 tmp.name = "H";
3264 tmp.value = 1;
3265 RNA_enum_item_add(&item, &totitem, &tmp);
3266 tmp.identifier = "S";
3267 tmp.name = "S";
3268 tmp.value = 2;
3269 RNA_enum_item_add(&item, &totitem, &tmp);
3270 tmp.identifier = "V";
3271 tmp.name = "V";
3272 tmp.value = 3;
3273 RNA_enum_item_add(&item, &totitem, &tmp);
3274 break;
3276 tmp.identifier = "Y";
3277 tmp.name = "Y";
3278 tmp.value = 1;
3279 RNA_enum_item_add(&item, &totitem, &tmp);
3280 tmp.identifier = "G";
3281 tmp.name = "U";
3282 tmp.value = 2;
3283 RNA_enum_item_add(&item, &totitem, &tmp);
3284 tmp.identifier = "V";
3285 tmp.name = "V";
3286 tmp.value = 3;
3287 RNA_enum_item_add(&item, &totitem, &tmp);
3288 break;
3290 tmp.identifier = "Y";
3291 tmp.name = "Y";
3292 tmp.value = 1;
3293 RNA_enum_item_add(&item, &totitem, &tmp);
3294 tmp.identifier = "CB";
3295 tmp.name = "Cr";
3296 tmp.value = 2;
3297 RNA_enum_item_add(&item, &totitem, &tmp);
3298 tmp.identifier = "CR";
3299 tmp.name = "Cb";
3300 tmp.value = 3;
3301 RNA_enum_item_add(&item, &totitem, &tmp);
3302 break;
3303 default:
3305 }
3306
3307 RNA_enum_item_end(&item, &totitem);
3308 *r_free = true;
3309
3310 return item;
3311}
3312
3313static void rna_Image_Node_update_id(Main *bmain, Scene *scene, PointerRNA *ptr)
3314{
3315 bNode *node = static_cast<bNode *>(ptr->data);
3316
3318 rna_Node_update_relations(bmain, scene, ptr);
3319}
3320
3321static void rna_NodeOutputFile_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
3322{
3323 bNode *node = static_cast<bNode *>(ptr->data);
3324 rna_iterator_listbase_begin(iter, &node->inputs, nullptr);
3325}
3326
3327static PointerRNA rna_NodeOutputFile_slot_file_get(CollectionPropertyIterator *iter)
3328{
3329 bNodeSocket *sock = static_cast<bNodeSocket *>(rna_iterator_listbase_get(iter));
3331 iter->parent.owner_id, &RNA_NodeOutputFileSlotFile, sock->storage);
3332 return ptr;
3333}
3334
3335static void rna_NodeColorBalance_update_lgg(Main *bmain, Scene *scene, PointerRNA *ptr)
3336{
3338 static_cast<bNode *>(ptr->data));
3339 rna_Node_update(bmain, scene, ptr);
3340}
3341
3342static void rna_NodeColorBalance_update_cdl(Main *bmain, Scene *scene, PointerRNA *ptr)
3343{
3345 static_cast<bNode *>(ptr->data));
3346 rna_Node_update(bmain, scene, ptr);
3347}
3348
3349static void rna_NodeColorBalance_input_whitepoint_get(PointerRNA *ptr, float value[3])
3350{
3351 bNode *node = static_cast<bNode *>(ptr->data);
3352 NodeColorBalance *n = static_cast<NodeColorBalance *>(node->storage);
3354}
3355
3356static void rna_NodeColorBalance_input_whitepoint_set(PointerRNA *ptr, const float value[3])
3357{
3358 bNode *node = static_cast<bNode *>(ptr->data);
3359 NodeColorBalance *n = static_cast<NodeColorBalance *>(node->storage);
3361}
3362
3363static void rna_NodeColorBalance_output_whitepoint_get(PointerRNA *ptr, float value[3])
3364{
3365 bNode *node = static_cast<bNode *>(ptr->data);
3366 NodeColorBalance *n = static_cast<NodeColorBalance *>(node->storage);
3368}
3369
3370static void rna_NodeColorBalance_output_whitepoint_set(PointerRNA *ptr, const float value[3])
3371{
3372 bNode *node = static_cast<bNode *>(ptr->data);
3373 NodeColorBalance *n = static_cast<NodeColorBalance *>(node->storage);
3375}
3376
3377static void rna_NodeCryptomatte_source_set(PointerRNA *ptr, int value)
3378{
3379 bNode *node = static_cast<bNode *>(ptr->data);
3380 if (node->id && node->custom1 != value) {
3381 id_us_min(node->id);
3382 node->id = nullptr;
3383 }
3384 node->custom1 = value;
3385}
3386
3387static int rna_NodeCryptomatte_layer_name_get(PointerRNA *ptr)
3388{
3389 int index = 0;
3390 bNode *node = static_cast<bNode *>(ptr->data);
3391 NodeCryptomatte *storage = static_cast<NodeCryptomatte *>(node->storage);
3392 LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, index) {
3393 if (STREQLEN(storage->layer_name, layer->name, sizeof(storage->layer_name))) {
3394 return index;
3395 }
3396 }
3397 return 0;
3398}
3399
3400static void rna_NodeCryptomatte_layer_name_set(PointerRNA *ptr, int new_value)
3401{
3402 bNode *node = static_cast<bNode *>(ptr->data);
3403 NodeCryptomatte *storage = static_cast<NodeCryptomatte *>(node->storage);
3404
3405 CryptomatteLayer *layer = static_cast<CryptomatteLayer *>(
3406 BLI_findlink(&storage->runtime.layers, new_value));
3407 if (layer) {
3408 STRNCPY(storage->layer_name, layer->name);
3409 }
3410}
3411
3412static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext * /*C*/,
3413 PointerRNA *ptr,
3414 PropertyRNA * /*prop*/,
3415 bool *r_free)
3416{
3417 bNode *node = static_cast<bNode *>(ptr->data);
3418 NodeCryptomatte *storage = static_cast<NodeCryptomatte *>(node->storage);
3419 EnumPropertyItem *item = nullptr;
3420 EnumPropertyItem temp = {0, "", 0, "", ""};
3421 int totitem = 0;
3422
3423 int layer_index;
3424 LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, layer_index) {
3425 temp.value = layer_index;
3426 temp.identifier = layer->name;
3427 temp.name = layer->name;
3428 RNA_enum_item_add(&item, &totitem, &temp);
3429 }
3430
3431 RNA_enum_item_end(&item, &totitem);
3432 *r_free = true;
3433
3434 return item;
3435}
3436
3437static PointerRNA rna_NodeCryptomatte_scene_get(PointerRNA *ptr)
3438{
3439 bNode *node = static_cast<bNode *>(ptr->data);
3440
3441 Scene *scene = (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER) ?
3442 reinterpret_cast<Scene *>(node->id) :
3443 nullptr;
3444 return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene);
3445}
3446
3447static void rna_NodeCryptomatte_scene_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
3448{
3449 bNode *node = static_cast<bNode *>(ptr->data);
3450
3451 if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER) {
3452 rna_Node_scene_set(ptr, value, reports);
3453 }
3454}
3455
3456static PointerRNA rna_NodeCryptomatte_image_get(PointerRNA *ptr)
3457{
3458 bNode *node = static_cast<bNode *>(ptr->data);
3459
3460 Image *image = (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) ?
3461 reinterpret_cast<Image *>(node->id) :
3462 nullptr;
3463 return rna_pointer_inherit_refine(ptr, &RNA_Image, image);
3464}
3465
3466static void rna_NodeCryptomatte_image_set(PointerRNA *ptr,
3467 PointerRNA value,
3468 ReportList * /*reports*/)
3469{
3470 bNode *node = static_cast<bNode *>(ptr->data);
3471
3472 if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
3473 if (node->id)
3474 id_us_min(node->id);
3475 if (value.data)
3476 id_us_plus(static_cast<ID *>(value.data));
3477
3478 node->id = static_cast<ID *>(value.data);
3479 }
3480}
3481
3482static bool rna_NodeCryptomatte_image_poll(PointerRNA * /*ptr*/, PointerRNA value)
3483{
3484 Image *image = reinterpret_cast<Image *>(value.owner_id);
3485 return image->type == IMA_TYPE_MULTILAYER;
3486}
3487
3488static void rna_NodeCryptomatte_matte_get(PointerRNA *ptr, char *value)
3489{
3490 bNode *node = static_cast<bNode *>(ptr->data);
3491 NodeCryptomatte *nc = static_cast<NodeCryptomatte *>(node->storage);
3492 char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
3493 strcpy(value, matte_id);
3494 MEM_freeN(matte_id);
3495}
3496
3497static int rna_NodeCryptomatte_matte_length(PointerRNA *ptr)
3498{
3499 bNode *node = static_cast<bNode *>(ptr->data);
3500 NodeCryptomatte *nc = static_cast<NodeCryptomatte *>(node->storage);
3501 char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
3502 int result = strlen(matte_id);
3503 MEM_freeN(matte_id);
3504 return result;
3505}
3506
3507static void rna_NodeCryptomatte_matte_set(PointerRNA *ptr, const char *value)
3508{
3509 bNode *node = static_cast<bNode *>(ptr->data);
3510 NodeCryptomatte *nc = static_cast<NodeCryptomatte *>(node->storage);
3512}
3513
3514static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr)
3515{
3517 rna_Node_update(bmain, scene, ptr);
3518}
3519
3520static void rna_NodeCryptomatte_update_remove(Main *bmain, Scene *scene, PointerRNA *ptr)
3521{
3523 rna_Node_update(bmain, scene, ptr);
3524}
3525
3526static PointerRNA rna_Node_paired_output_get(PointerRNA *ptr)
3527{
3528 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3529 bNode *node = static_cast<bNode *>(ptr->data);
3531 bNode *output_node = zone_type.get_corresponding_output(*ntree, *node);
3532 PointerRNA r_ptr = RNA_pointer_create(&ntree->id, &RNA_Node, output_node);
3533 return r_ptr;
3534}
3535
3536static bool rna_Node_pair_with_output(
3537 ID *id, bNode *node, bContext *C, ReportList *reports, bNode *output_node)
3538{
3539 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
3541 if (output_node->type != zone_type.output_type) {
3543 reports,
3544 RPT_ERROR,
3545 "Can't pair zone input node %s with %s because it does not have the same zone type",
3546 node->name,
3547 output_node->name);
3548 return false;
3549 }
3550 for (const bNode *other_input_node : ntree->nodes_by_type(zone_type.input_idname)) {
3551 if (other_input_node != node) {
3552 if (zone_type.get_corresponding_output(*ntree, *other_input_node) == output_node) {
3553 BKE_reportf(reports,
3554 RPT_ERROR,
3555 "The output node %s is already paired with %s",
3556 output_node->name,
3557 other_input_node->name);
3558 return false;
3559 }
3560 }
3561 }
3562 int &output_node_id = zone_type.get_corresponding_output_id(*node);
3563 output_node_id = output_node->identifier;
3564
3568 return true;
3569}
3570
3571template<typename Accessor>
3572static void rna_Node_ItemArray_remove(ID *id,
3573 bNode *node,
3574 Main *bmain,
3575 ReportList *reports,
3576 typename Accessor::ItemT *item_to_remove)
3577{
3578 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
3579 if (item_to_remove < *ref.items || item_to_remove >= *ref.items + *ref.items_num) {
3580 if constexpr (Accessor::has_name) {
3581 char **name_ptr = Accessor::get_name(*item_to_remove);
3582 if (name_ptr && *name_ptr) {
3583 BKE_reportf(reports, RPT_ERROR, "Unable to locate item '%s' in node", *name_ptr);
3584 return;
3585 }
3586 }
3587 else {
3588 BKE_report(reports, RPT_ERROR, "Unable to locate item in node");
3589 }
3590 return;
3591 }
3592 const int remove_index = item_to_remove - *ref.items;
3594 ref.items, ref.items_num, ref.active_index, remove_index, Accessor::destruct_item);
3595
3596 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
3598 ED_node_tree_propagate_change(nullptr, bmain, ntree);
3600}
3601
3602template<typename Accessor> static void rna_Node_ItemArray_clear(ID *id, bNode *node, Main *bmain)
3603{
3604 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
3605 blender::dna::array::clear(ref.items, ref.items_num, ref.active_index, Accessor::destruct_item);
3606
3607 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
3609 ED_node_tree_propagate_change(nullptr, bmain, ntree);
3611}
3612
3613template<typename Accessor>
3614static void rna_Node_ItemArray_move(
3615 ID *id, bNode *node, Main *bmain, const int from_index, const int to_index)
3616{
3617 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
3618 const int items_num = *ref.items_num;
3619 if (from_index < 0 || to_index < 0 || from_index >= items_num || to_index >= items_num) {
3620 return;
3621 }
3622 blender::dna::array::move_index(*ref.items, items_num, from_index, to_index);
3623
3624 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
3626 ED_node_tree_propagate_change(nullptr, bmain, ntree);
3628}
3629
3630template<typename Accessor> static PointerRNA rna_Node_ItemArray_active_get(PointerRNA *ptr)
3631{
3632 bNode *node = static_cast<bNode *>(ptr->data);
3633 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
3634 typename Accessor::ItemT *active_item = nullptr;
3635 const int active_index = *ref.active_index;
3636 const int items_num = *ref.items_num;
3637 if (active_index >= 0 && active_index < items_num) {
3638 active_item = &(*ref.items)[active_index];
3639 }
3640 return RNA_pointer_create(ptr->owner_id, Accessor::item_srna, active_item);
3641}
3642template<typename Accessor>
3643static void rna_Node_ItemArray_active_set(PointerRNA *ptr,
3644 PointerRNA value,
3645 ReportList * /*reports*/)
3646{
3647 using ItemT = typename Accessor::ItemT;
3648 bNode *node = static_cast<bNode *>(ptr->data);
3649 ItemT *item = static_cast<ItemT *>(value.data);
3650
3651 blender::nodes::socket_items::SocketItemsRef ref = Accessor::get_items_from_node(*node);
3652 if (item >= *ref.items && item < *ref.items + *ref.items_num) {
3653 *ref.active_index = item - *ref.items;
3654 }
3655}
3656
3657template<typename Accessor>
3658static void rna_Node_ItemArray_item_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
3659{
3660 using ItemT = typename Accessor::ItemT;
3661 bNodeTree &ntree = *reinterpret_cast<bNodeTree *>(ptr->owner_id);
3662 ItemT &item = *static_cast<ItemT *>(ptr->data);
3664 BLI_assert(node != nullptr);
3665
3667 ED_node_tree_propagate_change(nullptr, bmain, &ntree);
3668}
3669
3670template<typename Accessor>
3671static const EnumPropertyItem *rna_Node_ItemArray_socket_type_itemf(bContext * /*C*/,
3672 PointerRNA * /*ptr*/,
3673 PropertyRNA * /*prop*/,
3674 bool *r_free)
3675{
3676 *r_free = true;
3677 return itemf_function_check(
3679 return Accessor::supports_socket_type(eNodeSocketDatatype(item->value));
3680 });
3681}
3682
3683template<typename Accessor>
3684static void rna_Node_ItemArray_item_name_set(PointerRNA *ptr, const char *value)
3685{
3686 using ItemT = typename Accessor::ItemT;
3687 bNodeTree &ntree = *reinterpret_cast<bNodeTree *>(ptr->owner_id);
3688 ItemT &item = *static_cast<ItemT *>(ptr->data);
3690 BLI_assert(node != nullptr);
3692}
3693
3694template<typename Accessors>
3695static void rna_Node_ItemArray_item_color_get(PointerRNA *ptr, float *values)
3696{
3697 using ItemT = typename Accessors::ItemT;
3698 ItemT &item = *static_cast<ItemT *>(ptr->data);
3699 const char *socket_type_idname = blender::bke::node_static_socket_type(
3700 Accessors::get_socket_type(item), 0);
3701 ED_node_type_draw_color(socket_type_idname, values);
3702}
3703
3704template<typename Accessor>
3705typename Accessor::ItemT *rna_Node_ItemArray_new_with_socket_and_name(
3706 ID *id, bNode *node, Main *bmain, ReportList *reports, int socket_type, const char *name)
3707{
3708 using ItemT = typename Accessor::ItemT;
3709 if (!Accessor::supports_socket_type(eNodeSocketDatatype(socket_type))) {
3710 BKE_report(reports, RPT_ERROR, "Unable to create item with this socket type");
3711 return nullptr;
3712 }
3714 *node, eNodeSocketDatatype(socket_type), name);
3715
3716 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
3718 ED_node_tree_propagate_change(nullptr, bmain, ntree);
3720
3721 return new_item;
3722}
3723
3724static IndexSwitchItem *rna_NodeIndexSwitchItems_new(ID *id, bNode *node, Main *bmain)
3725{
3727 *node);
3728
3729 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
3731 ED_node_tree_propagate_change(nullptr, bmain, ntree);
3733
3734 return new_item;
3735}
3736
3737static const EnumPropertyItem *rna_NodeGeometryCaptureAttributeItem_data_type_itemf(
3738 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
3739{
3740 *r_free = true;
3741 /* See #attribute_type_type_with_socket_fn. */
3742 return itemf_function_check(rna_enum_attribute_type_items, [](const EnumPropertyItem *item) {
3743 return ELEM(item->value,
3751 });
3752}
3753
3754/* ******** Node Socket Types ******** */
3755
3756static PointerRNA rna_NodeOutputFile_slot_layer_get(CollectionPropertyIterator *iter)
3757{
3758 bNodeSocket *sock = static_cast<bNodeSocket *>(rna_iterator_listbase_get(iter));
3760 iter->parent.owner_id, &RNA_NodeOutputFileSlotLayer, sock->storage);
3761 return ptr;
3762}
3763
3764static int rna_NodeOutputFileSocket_find_node(bNodeTree *ntree,
3766 bNode **nodep,
3767 bNodeSocket **sockp)
3768{
3769 bNode *node;
3770 bNodeSocket *sock;
3771
3772 for (node = static_cast<bNode *>(ntree->nodes.first); node; node = node->next) {
3773 for (sock = static_cast<bNodeSocket *>(node->inputs.first); sock; sock = sock->next) {
3774 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(sock->storage);
3775 if (sockdata == data) {
3776 *nodep = node;
3777 *sockp = sock;
3778 return 1;
3779 }
3780 }
3781 }
3782
3783 *nodep = nullptr;
3784 *sockp = nullptr;
3785 return 0;
3786}
3787
3788static void rna_NodeOutputFileSlotFile_path_set(PointerRNA *ptr, const char *value)
3789{
3790 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3791 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(ptr->data);
3792 bNode *node;
3793 bNodeSocket *sock;
3794
3795 if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
3796 ntreeCompositOutputFileSetPath(node, sock, value);
3797 }
3798}
3799
3800static void rna_NodeOutputFileSlotLayer_name_set(PointerRNA *ptr, const char *value)
3801{
3802 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3803 NodeImageMultiFileSocket *sockdata = static_cast<NodeImageMultiFileSocket *>(ptr->data);
3804 bNode *node;
3805 bNodeSocket *sock;
3806
3807 if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
3808 ntreeCompositOutputFileSetLayer(node, sock, value);
3809 }
3810}
3811
3812static bNodeSocket *rna_NodeOutputFile_slots_new(
3813 ID *id, bNode *node, bContext *C, ReportList * /*reports*/, const char *name)
3814{
3815 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
3816 Scene *scene = CTX_data_scene(C);
3817 ImageFormatData *im_format = nullptr;
3818 bNodeSocket *sock;
3819 if (scene) {
3820 im_format = &scene->r.im_format;
3821 }
3822
3823 sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format);
3824
3827
3828 return sock;
3829}
3830
3831static void rna_FrameNode_label_size_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3832{
3834 rna_Node_update(bmain, scene, ptr);
3835}
3836
3837static void rna_ShaderNodeTexIES_mode_set(PointerRNA *ptr, int value)
3838{
3839 bNode *node = static_cast<bNode *>(ptr->data);
3840 NodeShaderTexIES *nss = static_cast<NodeShaderTexIES *>(node->storage);
3841
3842 if (nss->mode != value) {
3843 nss->mode = value;
3844 nss->filepath[0] = '\0';
3845
3846 /* replace text datablock by filepath */
3847 if (node->id) {
3848 Text *text = reinterpret_cast<Text *>(node->id);
3849
3850 if (value == NODE_IES_EXTERNAL && text->filepath) {
3851 STRNCPY(nss->filepath, text->filepath);
3853 }
3854
3855 id_us_min(node->id);
3856 node->id = nullptr;
3857 }
3858 }
3859}
3860
3861static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value)
3862{
3863 bNode *node = static_cast<bNode *>(ptr->data);
3864 NodeShaderScript *nss = static_cast<NodeShaderScript *>(node->storage);
3865
3866 if (nss->mode != value) {
3867 nss->mode = value;
3868 nss->filepath[0] = '\0';
3869 nss->flag &= ~NODE_SCRIPT_AUTO_UPDATE;
3870
3871 /* replace text data-block by filepath */
3872 if (node->id) {
3873 Text *text = reinterpret_cast<Text *>(node->id);
3874
3875 if (value == NODE_SCRIPT_EXTERNAL && text->filepath) {
3876 STRNCPY(nss->filepath, text->filepath);
3878 }
3879
3880 id_us_min(node->id);
3881 node->id = nullptr;
3882 }
3883
3884 /* remove any bytecode */
3885 if (nss->bytecode) {
3886 MEM_freeN(nss->bytecode);
3887 nss->bytecode = nullptr;
3888 }
3889
3890 nss->bytecode_hash[0] = '\0';
3891 }
3892}
3893
3894static void rna_ShaderNodeScript_bytecode_get(PointerRNA *ptr, char *value)
3895{
3896 bNode *node = static_cast<bNode *>(ptr->data);
3897 NodeShaderScript *nss = static_cast<NodeShaderScript *>(node->storage);
3898
3899 strcpy(value, (nss->bytecode) ? nss->bytecode : "");
3900}
3901
3902static int rna_ShaderNodeScript_bytecode_length(PointerRNA *ptr)
3903{
3904 bNode *node = static_cast<bNode *>(ptr->data);
3905 NodeShaderScript *nss = static_cast<NodeShaderScript *>(node->storage);
3906
3907 return (nss->bytecode) ? strlen(nss->bytecode) : 0;
3908}
3909
3910static void rna_ShaderNodeScript_bytecode_set(PointerRNA *ptr, const char *value)
3911{
3912 bNode *node = static_cast<bNode *>(ptr->data);
3913 NodeShaderScript *nss = static_cast<NodeShaderScript *>(node->storage);
3914
3915 if (nss->bytecode) {
3916 MEM_freeN(nss->bytecode);
3917 }
3918
3919 if (value && value[0]) {
3920 nss->bytecode = BLI_strdup(value);
3921 }
3922 else {
3923 nss->bytecode = nullptr;
3924 }
3925}
3926
3927static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3928{
3929 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3930 bNode *node = static_cast<bNode *>(ptr->data);
3931 RenderEngineType *engine_type = (scene != nullptr) ? RE_engines_find(scene->r.engine) : nullptr;
3932
3933 if (engine_type && engine_type->update_script_node) {
3934 /* auto update node */
3935 RenderEngine *engine = RE_engine_create(engine_type);
3936 engine_type->update_script_node(engine, ntree, node);
3937 RE_engine_free(engine);
3938 }
3939
3941 ED_node_tree_propagate_change(nullptr, bmain, ntree);
3942}
3943
3944static void rna_ShaderNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3945{
3946 rna_Node_update(bmain, scene, ptr);
3947}
3948
3949void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3950{
3951 rna_Node_update(bmain, scene, ptr);
3952}
3953
3954static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3955{
3956 rna_Node_update(bmain, scene, ptr);
3957}
3958
3959static void rna_ShaderNode_is_active_output_set(PointerRNA *ptr, bool value)
3960{
3961 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3962 bNode *node = static_cast<bNode *>(ptr->data);
3963 if (value) {
3964 /* If this node becomes the active output, the others of the same type can't be the active
3965 * output anymore. */
3966 LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
3967 if (other_node->type == node->type) {
3968 other_node->flag &= ~NODE_DO_OUTPUT;
3969 }
3970 }
3971 node->flag |= NODE_DO_OUTPUT;
3972 }
3973 else {
3974 node->flag &= ~NODE_DO_OUTPUT;
3975 }
3976}
3977
3978static void rna_GroupOutput_is_active_output_set(PointerRNA *ptr, bool value)
3979{
3980 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
3981 bNode *node = static_cast<bNode *>(ptr->data);
3982 if (value) {
3983 /* Make sure that no other group output is active at the same time. */
3984 LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
3985 if (other_node->type == NODE_GROUP_OUTPUT) {
3986 other_node->flag &= ~NODE_DO_OUTPUT;
3987 }
3988 }
3989 node->flag |= NODE_DO_OUTPUT;
3990 }
3991 else {
3992 node->flag &= ~NODE_DO_OUTPUT;
3993 }
3994}
3995
3996static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr)
3997{
3998 bNode *node = static_cast<bNode *>(ptr->data);
3999 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
4000 node->storage);
4001 Object *ob = reinterpret_cast<Object *>(node->id);
4002 ParticleSystem *psys = nullptr;
4003
4004 if (ob && shader_point_density->particle_system) {
4005 psys = static_cast<ParticleSystem *>(
4006 BLI_findlink(&ob->particlesystem, shader_point_density->particle_system - 1));
4007 }
4008
4009 PointerRNA value = RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys);
4010 return value;
4011}
4012
4013static void rna_ShaderNodePointDensity_psys_set(PointerRNA *ptr,
4014 PointerRNA value,
4015 ReportList * /*reports*/)
4016{
4017 bNode *node = static_cast<bNode *>(ptr->data);
4018 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
4019 node->storage);
4020 Object *ob = reinterpret_cast<Object *>(node->id);
4021
4022 if (ob && value.owner_id == &ob->id) {
4023 shader_point_density->particle_system = BLI_findindex(&ob->particlesystem, value.data) + 1;
4024 }
4025 else {
4026 shader_point_density->particle_system = 0;
4027 }
4028}
4029
4030static int point_density_particle_color_source_from_shader(
4031 NodeShaderTexPointDensity *shader_point_density)
4032{
4033 switch (shader_point_density->color_source) {
4035 return TEX_PD_COLOR_PARTAGE;
4039 return TEX_PD_COLOR_PARTVEL;
4040 default:
4041 BLI_assert_msg(0, "Unknown color source");
4042 return TEX_PD_COLOR_CONSTANT;
4043 }
4044}
4045
4046static int point_density_vertex_color_source_from_shader(
4047 NodeShaderTexPointDensity *shader_point_density)
4048{
4049 switch (shader_point_density->ob_color_source) {
4051 return TEX_PD_COLOR_VERTCOL;
4055 return TEX_PD_COLOR_VERTNOR;
4056 default:
4057 BLI_assert_msg(0, "Unknown color source");
4058 return TEX_PD_COLOR_CONSTANT;
4059 }
4060}
4061
4062void rna_ShaderNodePointDensity_density_cache(bNode *self, Depsgraph *depsgraph)
4063{
4064 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
4065 self->storage);
4066 PointDensity *pd = &shader_point_density->pd;
4067
4068 if (depsgraph == nullptr) {
4069 return;
4070 }
4071
4072 /* Make sure there's no cached data. */
4075
4076 /* Create PointDensity structure from node for sampling. */
4078 pd->object = reinterpret_cast<Object *>(self->id);
4079 pd->radius = shader_point_density->radius;
4080 if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
4081 pd->source = TEX_PD_PSYS;
4082 pd->psys = shader_point_density->particle_system;
4084 pd->color_source = point_density_particle_color_source_from_shader(shader_point_density);
4085 }
4086 else {
4087 BLI_assert(shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_OBJECT);
4088 pd->source = TEX_PD_OBJECT;
4090 pd->ob_color_source = point_density_vertex_color_source_from_shader(shader_point_density);
4091 STRNCPY(pd->vertex_attribute_name, shader_point_density->vertex_attribute_name);
4092 }
4093
4094 /* Store resolution, so it can be changed in the UI. */
4095 shader_point_density->cached_resolution = shader_point_density->resolution;
4096
4097 /* Single-threaded sampling of the voxel domain. */
4099}
4100
4101void rna_ShaderNodePointDensity_density_calc(bNode *self,
4102 Depsgraph *depsgraph,
4103 float **values,
4104 int *values_num)
4105{
4106 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
4107 self->storage);
4108 PointDensity *pd = &shader_point_density->pd;
4109 const int resolution = shader_point_density->cached_resolution;
4110
4111 if (depsgraph == nullptr) {
4112 *values_num = 0;
4113 return;
4114 }
4115
4116 /* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */
4117 *values_num = 4 * resolution * resolution * resolution;
4118
4119 if (*values == nullptr) {
4120 *values = static_cast<float *>(
4121 MEM_mallocN(sizeof(float) * (*values_num), "point density dynamic array"));
4122 }
4123
4124 /* Single-threaded sampling of the voxel domain. */
4125 RE_point_density_sample(depsgraph, pd, resolution, *values);
4126
4127 /* We're done, time to clean up. */
4129 *pd = blender::dna::shallow_zero_initialize();
4130
4131 shader_point_density->cached_resolution = 0.0f;
4132}
4133
4134void rna_ShaderNodePointDensity_density_minmax(bNode *self,
4135 Depsgraph *depsgraph,
4136 float r_min[3],
4137 float r_max[3])
4138{
4139 NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
4140 self->storage);
4141 PointDensity *pd = &shader_point_density->pd;
4142
4143 if (depsgraph == nullptr) {
4144 zero_v3(r_min);
4145 zero_v3(r_max);
4146 return;
4147 }
4148
4149 RE_point_density_minmax(depsgraph, pd, r_min, r_max);
4150}
4151
4152static int rna_NodeConvertColorSpace_from_color_space_get(PointerRNA *ptr)
4153{
4154 bNode *node = static_cast<bNode *>(ptr->data);
4155 NodeConvertColorSpace *node_storage = static_cast<NodeConvertColorSpace *>(node->storage);
4157}
4158
4159static void rna_NodeConvertColorSpace_from_color_space_set(PointerRNA *ptr, int value)
4160{
4161 bNode *node = static_cast<bNode *>(ptr->data);
4162 NodeConvertColorSpace *node_storage = static_cast<NodeConvertColorSpace *>(node->storage);
4163 const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
4164
4165 if (name && name[0]) {
4166 STRNCPY(node_storage->from_color_space, name);
4167 }
4168}
4169static int rna_NodeConvertColorSpace_to_color_space_get(PointerRNA *ptr)
4170{
4171 bNode *node = static_cast<bNode *>(ptr->data);
4172 NodeConvertColorSpace *node_storage = static_cast<NodeConvertColorSpace *>(node->storage);
4174}
4175
4176static void rna_NodeConvertColorSpace_to_color_space_set(PointerRNA *ptr, int value)
4177{
4178 bNode *node = static_cast<bNode *>(ptr->data);
4179 NodeConvertColorSpace *node_storage = static_cast<NodeConvertColorSpace *>(node->storage);
4180 const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
4181
4182 if (name && name[0]) {
4183 STRNCPY(node_storage->to_color_space, name);
4184 }
4185}
4186
4187static void rna_reroute_node_socket_type_set(PointerRNA *ptr, const char *value)
4188{
4189 const bNodeTree &ntree = *reinterpret_cast<bNodeTree *>(ptr->owner_id);
4190 blender::bke::bNodeTreeType *ntree_type = ntree.typeinfo;
4191
4192 bNode &node = *static_cast<bNode *>(ptr->data);
4193
4195 if (socket_type == nullptr) {
4196 return;
4197 }
4198 if (socket_type->subtype != PROP_NONE) {
4199 return;
4200 }
4201 if (ntree_type->valid_socket_type && !ntree_type->valid_socket_type(ntree_type, socket_type)) {
4202 return;
4203 }
4204 NodeReroute *storage = static_cast<NodeReroute *>(node.storage);
4205 STRNCPY(storage->type_idname, value);
4206}
4207
4208static const EnumPropertyItem *rna_NodeConvertColorSpace_color_space_itemf(bContext * /*C*/,
4209 PointerRNA * /*ptr*/,
4210 PropertyRNA * /*prop*/,
4211 bool *r_free)
4212{
4213 EnumPropertyItem *items = nullptr;
4214 int totitem = 0;
4215
4217 RNA_enum_item_end(&items, &totitem);
4218
4219 *r_free = true;
4220
4221 return items;
4222}
4223
4224static NodeEnumItem *rna_NodeMenuSwitchItems_new(ID *id,
4225 bNode *node,
4226 Main *bmain,
4227 const char *name)
4228{
4229 NodeEnumItem *new_item =
4231
4232 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
4234 ED_node_tree_propagate_change(nullptr, bmain, ntree);
4236
4237 return new_item;
4238}
4239
4240static PointerRNA rna_NodeMenuSwitch_enum_definition_get(PointerRNA *ptr)
4241{
4242 /* Return node itself. The data is now directly available on the node and does not have to be
4243 * accessed through "enum_definition". */
4244 return *ptr;
4245}
4246
4247#else
4248
4250 {0, "PLACEHOLDER", 0, "Placeholder", ""},
4251 {0, nullptr, 0, nullptr, nullptr},
4252};
4253
4255 {0, "ALL", 0, "All", ""},
4256 {0, nullptr, 0, nullptr, nullptr},
4257};
4258
4260 {0, "PLACEHOLDER", 0, "Placeholder", ""},
4261 {0, nullptr, 0, nullptr, nullptr},
4262};
4263
4265 {1, "R", 0, "R", "Red"},
4266 {2, "G", 0, "G", "Green"},
4267 {3, "B", 0, "B", "Blue"},
4268 {0, nullptr, 0, nullptr, nullptr},
4269};
4270
4272 {0, "X", 0, "Flip X", ""},
4273 {1, "Y", 0, "Flip Y", ""},
4274 {2, "XY", 0, "Flip X & Y", ""},
4275 {0, nullptr, 0, nullptr, nullptr},
4276};
4277
4279 {0, "ITUBT601", 0, "ITU 601", ""},
4280 {1, "ITUBT709", 0, "ITU 709", ""},
4281 {2, "JFIF", 0, "JPEG", ""},
4282 {0, nullptr, 0, nullptr, nullptr},
4283};
4284
4286 {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4287 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4289 "MULTI_GGX",
4290 0,
4291 "Multiscatter GGX",
4292 "GGX with additional correction to account for multiple scattering, preserve energy and "
4293 "prevent unexpected darkening at high roughness"},
4294 {0, nullptr, 0, nullptr, nullptr},
4295};
4296
4299 "PHYSICAL_CONDUCTOR",
4300 0,
4301 "Physical Conductor",
4302 "Fresnel conductor based on the complex refractive index per color channel"},
4304 "F82",
4305 0,
4306 "F82 Tint",
4307 "An approximation of the Fresnel conductor curve based on the colors at perpendicular and "
4308 "near-grazing (roughly 82°) angles"},
4309 {0, nullptr, 0, nullptr, nullptr},
4310};
4311
4313 {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4314 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4315 {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
4317 "MULTI_GGX",
4318 0,
4319 "Multiscatter GGX",
4320 "GGX with additional correction to account for multiple scattering, preserve energy and "
4321 "prevent unexpected darkening at high roughness"},
4322 {0, nullptr, 0, nullptr, nullptr},
4323};
4324
4326 {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4327 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4329 "MULTI_GGX",
4330 0,
4331 "Multiscatter GGX",
4332 "GGX with additional correction to account for multiple scattering, preserve energy and "
4333 "prevent unexpected darkening at high roughness"},
4334 {0, nullptr, 0, nullptr, nullptr},
4335};
4336
4338 {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4339 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4340 {0, nullptr, 0, nullptr, nullptr},
4341};
4342
4344 {SHD_SHEEN_ASHIKHMIN, "ASHIKHMIN", 0, "Ashikhmin", "Classic Ashikhmin velvet (legacy model)"},
4346 "MICROFIBER",
4347 0,
4348 "Microfiber",
4349 "Microflake-based model of multiple scattering between normal-oriented fibers"},
4350 {0, nullptr, 0, nullptr, nullptr},
4351};
4352
4354 {SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", "Use diffuse BSDF"},
4355 {SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", "Use glossy BSDF"},
4356 {0, nullptr, 0, nullptr, nullptr},
4357};
4358
4361 "Reflection",
4362 0,
4363 "Reflection",
4364 "The light that bounces off the surface of the hair"},
4366 "Transmission",
4367 0,
4368 "Transmission",
4369 "The light that passes through the hair and exits on the other side"},
4370 {0, nullptr, 0, nullptr, nullptr},
4371};
4372
4375 "CHIANG",
4376 0,
4377 "Chiang",
4378 "Near-field hair scattering model by Chiang et al. 2016, suitable for close-up looks, but is "
4379 "more noisy when viewing from a distance."},
4381 "HUANG",
4382 0,
4383 "Huang",
4384 "Multi-scale hair scattering model by Huang et al. 2022, suitable for viewing both up close "
4385 "and from a distance, supports elliptical cross-sections and has more precise highlight in "
4386 "forward scattering directions."},
4387 {0, nullptr, 0, nullptr, nullptr},
4388};
4389
4392 "ABSORPTION",
4393 0,
4394 "Absorption Coefficient",
4395 "Directly set the absorption coefficient \"sigma_a\" (this is not the most intuitive way to "
4396 "color hair)"},
4398 "MELANIN",
4399 0,
4400 "Melanin Concentration",
4401 "Define the melanin concentrations below to get the most realistic-looking hair (you can get "
4402 "the concentrations for different types of hair online)"},
4404 "COLOR",
4405 0,
4406 "Direct Coloring",
4407 "Choose the color of your preference, and the shader will approximate the absorption "
4408 "coefficient to render lookalike hair"},
4409 {0, nullptr, 0, nullptr, nullptr},
4410};
4411
4413 {NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
4414 {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
4415 {0, nullptr, 0, nullptr, nullptr},
4416};
4417
4419 {NODE_IES_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
4420 {NODE_IES_EXTERNAL, "EXTERNAL", 0, "External", "Use external .ies file"},
4421 {0, nullptr, 0, nullptr, nullptr},
4422};
4423
4425 {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4427 "MULTI_GGX",
4428 0,
4429 "Multiscatter GGX",
4430 "GGX with additional correction to account for multiple scattering, preserve energy and "
4431 "prevent unexpected darkening at high roughness"},
4432 {0, nullptr, 0, nullptr, nullptr},
4433};
4434
4437 "BURLEY",
4438 0,
4439 "Christensen-Burley",
4440 "Approximation to physically based volume scattering"},
4442 "RANDOM_WALK",
4443 0,
4444 "Random Walk",
4445 "Volumetric approximation to physically based volume scattering, using the scattering radius "
4446 "as specified"},
4448 "RANDOM_WALK_SKIN",
4449 0,
4450 "Random Walk (Skin)",
4451 "Volumetric approximation to physically based volume scattering, with scattering radius "
4452 "automatically adjusted to match color textures. Designed for skin shading."},
4453 {0, nullptr, 0, nullptr, nullptr}};
4454
4457 "REPEAT",
4458 0,
4459 "Repeat",
4460 "Cause the image to repeat horizontally and vertically"},
4462 "EXTEND",
4463 0,
4464 "Extend",
4465 "Extend by repeating edge pixels of the image"},
4467 "CLIP",
4468 0,
4469 "Clip",
4470 "Clip to image size and set exterior pixels as transparent"},
4472 "MIRROR",
4473 0,
4474 "Mirror",
4475 "Repeatedly flip the image horizontally and vertically"},
4476 {0, nullptr, 0, nullptr, nullptr},
4477};
4478
4481 "HENYEY_GREENSTEIN",
4482 0,
4483 "Henyey-Greenstein",
4484 "Henyey-Greenstein, default phase function for the scattering of light"},
4486 "FOURNIER_FORAND",
4487 0,
4488 "Fournier-Forand",
4489 "Fournier-Forand phase function, used for the scattering of light in underwater "
4490 "environments"},
4492 "DRAINE",
4493 0,
4494 "Draine",
4495 "Draine phase functions, mostly used for the scattering of light in interstellar dust"},
4497 "RAYLEIGH",
4498 0,
4499 "Rayleigh",
4500 "Rayleigh phase function, mostly used for particles smaller than the wavelength of light, "
4501 "such as scattering of sunlight in earth's atmosphere"},
4503 "MIE",
4504 0,
4505 "Mie",
4506 "Approximation of Mie scattering in water droplets, used for scattering in clouds and fog"},
4507 {0, nullptr, 0, nullptr, nullptr},
4508};
4509
4510/* -- Common nodes ---------------------------------------------------------- */
4511
4512static void def_group_input(StructRNA * /*srna*/) {}
4513
4514static void def_group_output(StructRNA *srna)
4515{
4516 PropertyRNA *prop;
4517
4518 prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
4519 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_DO_OUTPUT);
4521 prop, "Active Output", "True if this node is used as the active group output");
4522 RNA_def_property_boolean_funcs(prop, nullptr, "rna_GroupOutput_is_active_output_set");
4523 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4524}
4525
4526static void def_group(StructRNA *srna)
4527{
4528 PropertyRNA *prop;
4529
4530 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
4531 RNA_def_property_pointer_sdna(prop, nullptr, "id");
4532 RNA_def_property_struct_type(prop, "NodeTree");
4534 prop, nullptr, "rna_NodeGroup_node_tree_set", nullptr, "rna_NodeGroup_node_tree_poll");
4537 RNA_def_property_ui_text(prop, "Node Tree", "");
4538 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
4539}
4540
4542 const char *struct_name,
4543 const char *base_name,
4544 const char *ui_name,
4545 const char *ui_desc,
4546 const char *reg_func)
4547{
4548 StructRNA *srna;
4549
4550 srna = RNA_def_struct(brna, struct_name, base_name);
4551 RNA_def_struct_ui_text(srna, ui_name, ui_desc);
4552 RNA_def_struct_sdna(srna, "bNode");
4553
4554 RNA_def_struct_register_funcs(srna, reg_func, "rna_Node_unregister", nullptr);
4555
4556 def_group(srna);
4557}
4558
4559static void def_frame(StructRNA *srna)
4560{
4561 PropertyRNA *prop;
4562
4563 prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
4564 RNA_def_property_pointer_sdna(prop, nullptr, "id");
4565 RNA_def_property_struct_type(prop, "Text");
4568 RNA_def_property_ui_text(prop, "Text", "");
4569 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4570
4571 RNA_def_struct_sdna_from(srna, "NodeFrame", "storage");
4573
4574 prop = RNA_def_property(srna, "shrink", PROP_BOOLEAN, PROP_NONE);
4575 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_FRAME_SHRINK);
4576 RNA_def_property_ui_text(prop, "Shrink", "Shrink the frame to minimal bounding box");
4577 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
4578
4579 prop = RNA_def_property(srna, "label_size", PROP_INT, PROP_NONE);
4580 RNA_def_property_int_sdna(prop, nullptr, "label_size");
4581 RNA_def_property_range(prop, 8, 64);
4582 RNA_def_property_ui_text(prop, "Label Font Size", "Font size to use for displaying the label");
4583 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_FrameNode_label_size_update");
4584}
4585
4586static void def_clamp(StructRNA *srna)
4587{
4588 PropertyRNA *prop;
4589
4590 prop = RNA_def_property(srna, "clamp_type", PROP_ENUM, PROP_NONE);
4591 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
4593 RNA_def_property_ui_text(prop, "Clamp Type", "");
4594 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4595}
4596
4597static void def_map_range(StructRNA *srna)
4598{
4599 static const EnumPropertyItem rna_enum_data_type_items[] = {
4600 {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
4601 {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
4602 {0, nullptr, 0, nullptr, nullptr},
4603 };
4604
4605 RNA_def_struct_sdna_from(srna, "NodeMapRange", "storage");
4606
4607 PropertyRNA *prop;
4608
4609 prop = RNA_def_property(srna, "clamp", PROP_BOOLEAN, PROP_NONE);
4610 RNA_def_property_boolean_sdna(prop, nullptr, "clamp", 1);
4611 RNA_def_property_ui_text(prop, "Clamp", "Clamp the result to the target range [To Min, To Max]");
4612 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4613
4614 prop = RNA_def_property(srna, "interpolation_type", PROP_ENUM, PROP_NONE);
4615 RNA_def_property_enum_sdna(prop, nullptr, "interpolation_type");
4617 RNA_def_property_ui_text(prop, "Interpolation Type", "");
4618 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4619
4620 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
4621 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "data_type");
4622 RNA_def_property_enum_items(prop, rna_enum_data_type_items);
4623 RNA_def_property_ui_text(prop, "Data Type", "");
4624 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4625}
4626
4627static void def_math(StructRNA *srna)
4628{
4629 PropertyRNA *prop;
4630
4631 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4632 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
4634 RNA_def_property_ui_text(prop, "Operation", "");
4636 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4637
4638 prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
4639 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_MATH_CLAMP);
4640 RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
4641 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4642}
4643
4644static void def_sh_mix(StructRNA *srna)
4645{
4646 static const EnumPropertyItem rna_enum_mix_mode_items[] = {
4647 {NODE_MIX_MODE_UNIFORM, "UNIFORM", 0, "Uniform", "Use a single factor for all components"},
4648 {NODE_MIX_MODE_NON_UNIFORM, "NON_UNIFORM", 0, "Non-Uniform", "Per component factor"},
4649 {0, nullptr, 0, nullptr, nullptr},
4650 };
4651
4652 PropertyRNA *prop;
4653
4654 RNA_def_struct_sdna_from(srna, "NodeShaderMix", "storage");
4655
4656 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
4657 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_ShaderNodeMix_data_type_itemf");
4660 RNA_def_property_ui_text(prop, "Data Type", "");
4661 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
4662
4663 prop = RNA_def_property(srna, "factor_mode", PROP_ENUM, PROP_NONE);
4664 RNA_def_property_enum_items(prop, rna_enum_mix_mode_items);
4666 RNA_def_property_ui_text(prop, "Factor Mode", "");
4667 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
4668
4669 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
4670 RNA_def_property_enum_sdna(prop, nullptr, "blend_type");
4672 RNA_def_property_ui_text(prop, "Blending Mode", "");
4673 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4674
4675 prop = RNA_def_property(srna, "clamp_factor", PROP_BOOLEAN, PROP_NONE);
4676 RNA_def_property_boolean_sdna(prop, nullptr, "clamp_factor", 1);
4677 RNA_def_property_ui_text(prop, "Clamp Factor", "Clamp the factor to [0,1] range");
4678 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4679
4680 prop = RNA_def_property(srna, "clamp_result", PROP_BOOLEAN, PROP_NONE);
4681 RNA_def_property_boolean_sdna(prop, nullptr, "clamp_result", 1);
4682 RNA_def_property_ui_text(prop, "Clamp Result", "Clamp the result to [0,1] range");
4683 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4684}
4685
4686static void def_float_to_int(StructRNA *srna)
4687{
4688 PropertyRNA *prop;
4689
4690 prop = RNA_def_property(srna, "rounding_mode", PROP_ENUM, PROP_NONE);
4691 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
4694 prop, "Rounding Mode", "Method used to convert the float to an integer");
4696 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4697}
4698
4699static void def_vector_math(StructRNA *srna)
4700{
4701 PropertyRNA *prop;
4702
4703 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4704 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
4706 RNA_def_property_ui_text(prop, "Operation", "");
4708 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4709}
4710
4711static void def_rgb_curve(StructRNA *srna)
4712{
4713 PropertyRNA *prop;
4714
4715 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
4716 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
4717 RNA_def_property_struct_type(prop, "CurveMapping");
4718 RNA_def_property_ui_text(prop, "Mapping", "");
4719 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4720}
4721
4722static void def_vector_curve(StructRNA *srna)
4723{
4724 PropertyRNA *prop;
4725
4726 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
4727 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
4728 RNA_def_property_struct_type(prop, "CurveMapping");
4729 RNA_def_property_ui_text(prop, "Mapping", "");
4730 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4731}
4732
4733static void def_float_curve(StructRNA *srna)
4734{
4735 PropertyRNA *prop;
4736
4737 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
4738 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
4739 RNA_def_property_struct_type(prop, "CurveMapping");
4740 RNA_def_property_ui_text(prop, "Mapping", "");
4741 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4742}
4743
4744static void def_time(StructRNA *srna)
4745{
4746 PropertyRNA *prop;
4747
4748 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
4749 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
4750 RNA_def_property_struct_type(prop, "CurveMapping");
4751 RNA_def_property_ui_text(prop, "Curve", "");
4752 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4753
4754 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
4755 RNA_def_property_int_sdna(prop, nullptr, "custom1");
4756 RNA_def_property_ui_text(prop, "Start Frame", "");
4757 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4758
4759 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
4760 RNA_def_property_int_sdna(prop, nullptr, "custom2");
4761 RNA_def_property_ui_text(prop, "End Frame", "");
4762 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4763}
4764
4765static void def_colorramp(StructRNA *srna)
4766{
4767 PropertyRNA *prop;
4768
4769 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
4770 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
4771 RNA_def_property_struct_type(prop, "ColorRamp");
4772 RNA_def_property_ui_text(prop, "Color Ramp", "");
4773 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4774}
4775
4776static void def_mix_rgb(StructRNA *srna)
4777{
4778 PropertyRNA *prop;
4779
4780 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
4781 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
4783 RNA_def_property_ui_text(prop, "Blending Mode", "");
4784 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4785
4786 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
4787 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_MIXRGB_USE_ALPHA);
4788 RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
4789 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4790
4791 prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
4792 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_MIXRGB_CLAMP);
4793 RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
4794 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4795}
4796
4797static void def_texture(StructRNA *srna)
4798{
4799 PropertyRNA *prop;
4800
4801 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
4802 RNA_def_property_pointer_sdna(prop, nullptr, "id");
4803 RNA_def_property_struct_type(prop, "Texture");
4806 RNA_def_property_ui_text(prop, "Texture", "");
4807 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
4808
4809 prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
4810 RNA_def_property_int_sdna(prop, nullptr, "custom1");
4812 prop, "Node Output", "For node-based textures, which output node to use");
4813 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4814}
4815
4817{
4818 PropertyRNA *prop;
4819
4820 RNA_def_struct_sdna_from(srna, "NodeInputColor", "storage");
4821
4822 prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_COLOR);
4823 RNA_def_property_array(prop, 4);
4824 RNA_def_property_float_sdna(prop, nullptr, "color");
4825 RNA_def_property_ui_text(prop, "Color", "");
4826 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4827}
4828
4830{
4831 PropertyRNA *prop;
4832
4833 RNA_def_struct_sdna_from(srna, "NodeInputBool", "storage");
4834
4835 prop = RNA_def_property(srna, "boolean", PROP_BOOLEAN, PROP_NONE);
4836 RNA_def_property_boolean_sdna(prop, nullptr, "boolean", 1);
4837 RNA_def_property_ui_text(prop, "Boolean", "Input value used for unconnected socket");
4838 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4839}
4840
4841static void def_fn_input_int(StructRNA *srna)
4842{
4843 PropertyRNA *prop;
4844
4845 RNA_def_struct_sdna_from(srna, "NodeInputInt", "storage");
4846
4847 prop = RNA_def_property(srna, "integer", PROP_INT, PROP_NONE);
4848 RNA_def_property_int_sdna(prop, nullptr, "integer");
4850 RNA_def_property_ui_text(prop, "Integer", "Input value used for unconnected socket");
4851 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4852}
4853
4855{
4856 PropertyRNA *prop;
4857
4858 RNA_def_struct_sdna_from(srna, "NodeInputRotation", "storage");
4859
4860 prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
4861 RNA_def_property_float_sdna(prop, nullptr, "rotation_euler");
4862 RNA_def_property_ui_text(prop, "Rotation", "Input value used for unconnected socket");
4863 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4864}
4865
4867{
4868 PropertyRNA *prop;
4869
4870 RNA_def_struct_sdna_from(srna, "NodeInputVector", "storage");
4871
4872 prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_XYZ);
4873 RNA_def_property_array(prop, 3);
4874 RNA_def_property_float_sdna(prop, nullptr, "vector");
4875 RNA_def_property_ui_text(prop, "Vector", "");
4876 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4877}
4878
4880{
4881 PropertyRNA *prop;
4882
4883 RNA_def_struct_sdna_from(srna, "NodeInputString", "storage");
4884
4885 prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
4886 RNA_def_property_ui_text(prop, "String", "");
4887 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4888}
4889
4890/* -- Shader Nodes ---------------------------------------------------------- */
4891
4892static void def_sh_output(StructRNA *srna)
4893{
4894 PropertyRNA *prop;
4895
4896 prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
4897 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_DO_OUTPUT);
4899 prop, "Active Output", "True if this node is used as the active output");
4900 RNA_def_property_boolean_funcs(prop, nullptr, "rna_ShaderNode_is_active_output_set");
4901 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4902
4903 prop = RNA_def_property(srna, "target", PROP_ENUM, PROP_NONE);
4904 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
4907 prop, "Target", "Which renderer and viewport shading types to use the shaders for");
4908 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4909}
4910
4912{
4913 def_sh_output(srna);
4914 def_mix_rgb(srna);
4915}
4916
4917static void def_sh_mapping(StructRNA *srna)
4918{
4919 PropertyRNA *prop;
4920
4921 prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
4922 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
4924 RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
4925 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4926}
4927
4929{
4930 PropertyRNA *prop;
4931
4932 prop = RNA_def_property(srna, "rotation_type", PROP_ENUM, PROP_NONE);
4933 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
4935 RNA_def_property_ui_text(prop, "Type", "Type of angle input");
4936 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4937
4938 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
4939 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", 0);
4940 RNA_def_property_ui_text(prop, "Invert", "Invert the rotation angle");
4941 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4942}
4943
4944static void def_sh_attribute(StructRNA *srna)
4945{
4946 static const EnumPropertyItem prop_attribute_type[] = {
4948 "GEOMETRY",
4949 0,
4950 "Geometry",
4951 "The attribute is associated with the object geometry, and its value "
4952 "varies from vertex to vertex, or within the object volume"},
4954 "OBJECT",
4955 0,
4956 "Object",
4957 "The attribute is associated with the object or mesh data-block itself, "
4958 "and its value is uniform"},
4960 "INSTANCER",
4961 0,
4962 "Instancer",
4963 "The attribute is associated with the instancer particle system or object, "
4964 "falling back to the Object mode if the attribute isn't found, or the object "
4965 "is not instanced"},
4967 "VIEW_LAYER",
4968 0,
4969 "View Layer",
4970 "The attribute is associated with the View Layer, Scene or World that is being rendered"},
4971 {0, nullptr, 0, nullptr, nullptr},
4972 };
4973 PropertyRNA *prop;
4974
4975 RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage");
4976
4977 prop = RNA_def_property(srna, "attribute_type", PROP_ENUM, PROP_NONE);
4978 RNA_def_property_enum_sdna(prop, nullptr, "type");
4979 RNA_def_property_enum_items(prop, prop_attribute_type);
4980 RNA_def_property_ui_text(prop, "Attribute Type", "General type of the attribute");
4981 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4982
4983 prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
4984 RNA_def_property_string_sdna(prop, nullptr, "name");
4985 RNA_def_property_ui_text(prop, "Attribute Name", "");
4986 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4987}
4988
4989static void def_sh_tex(StructRNA *srna)
4990{
4991 PropertyRNA *prop;
4992
4993 prop = RNA_def_property(srna, "texture_mapping", PROP_POINTER, PROP_NONE);
4994 RNA_def_property_pointer_sdna(prop, nullptr, "base.tex_mapping");
4996 RNA_def_property_ui_text(prop, "Texture Mapping", "Texture coordinate mapping settings");
4997
4998 prop = RNA_def_property(srna, "color_mapping", PROP_POINTER, PROP_NONE);
4999 RNA_def_property_pointer_sdna(prop, nullptr, "base.color_mapping");
5001 RNA_def_property_ui_text(prop, "Color Mapping", "Color mapping settings");
5002}
5003
5004static void def_sh_tex_sky(StructRNA *srna)
5005{
5006 static const EnumPropertyItem prop_sky_type[] = {
5007 {SHD_SKY_PREETHAM, "PREETHAM", 0, "Preetham", "Preetham 1999"},
5008 {SHD_SKY_HOSEK, "HOSEK_WILKIE", 0, "Hosek / Wilkie", "Hosek / Wilkie 2012"},
5009 {SHD_SKY_NISHITA, "NISHITA", 0, "Nishita", "Nishita 1993 improved"},
5010 {0, nullptr, 0, nullptr, nullptr},
5011 };
5012 static float default_dir[3] = {0.0f, 0.0f, 1.0f};
5013
5014 PropertyRNA *prop;
5015
5016 RNA_def_struct_sdna_from(srna, "NodeTexSky", "storage");
5017 def_sh_tex(srna);
5018
5019 prop = RNA_def_property(srna, "sky_type", PROP_ENUM, PROP_NONE);
5020 RNA_def_property_enum_sdna(prop, nullptr, "sky_model");
5021 RNA_def_property_enum_items(prop, prop_sky_type);
5022 RNA_def_property_ui_text(prop, "Sky Type", "Which sky model should be used");
5023 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5024
5025 prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION);
5026 RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining");
5027 RNA_def_property_array(prop, 3);
5028 RNA_def_property_float_array_default(prop, default_dir);
5029 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5030
5031 prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE);
5032 RNA_def_property_range(prop, 1.0f, 10.0f);
5033 RNA_def_property_ui_range(prop, 1.0f, 10.0f, 10, 3);
5034 RNA_def_property_ui_text(prop, "Turbidity", "Atmospheric turbidity");
5035 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5036
5037 prop = RNA_def_property(srna, "ground_albedo", PROP_FLOAT, PROP_FACTOR);
5038 RNA_def_property_range(prop, 0.0f, 1.0f);
5040 prop, "Ground Albedo", "Ground color that is subtly reflected in the sky");
5041 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5042
5043 prop = RNA_def_property(srna, "sun_disc", PROP_BOOLEAN, PROP_NONE);
5044 RNA_def_property_ui_text(prop, "Sun Disc", "Include the sun itself in the output");
5045 RNA_def_property_boolean_sdna(prop, nullptr, "sun_disc", 1);
5047 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5048
5049 prop = RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_ANGLE);
5050 RNA_def_property_ui_text(prop, "Sun Size", "Size of sun disc");
5051 RNA_def_property_range(prop, 0.0f, M_PI_2);
5053 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5054
5055 prop = RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
5056 RNA_def_property_ui_text(prop, "Sun Intensity", "Strength of sun");
5057 RNA_def_property_range(prop, 0.0f, 1000.0f);
5059 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5060
5061 prop = RNA_def_property(srna, "sun_elevation", PROP_FLOAT, PROP_ANGLE);
5062 RNA_def_property_ui_text(prop, "Sun Elevation", "Sun angle from horizon");
5064 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5065
5066 prop = RNA_def_property(srna, "sun_rotation", PROP_FLOAT, PROP_ANGLE);
5067 RNA_def_property_ui_text(prop, "Sun Rotation", "Rotation of sun around zenith");
5069 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5070
5071 prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_DISTANCE);
5072 RNA_def_property_ui_text(prop, "Altitude", "Height from sea level");
5073 RNA_def_property_range(prop, 0.0f, 60000.0f);
5074 RNA_def_property_ui_range(prop, 0.0f, 60000.0f, 10, 1);
5076 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5077
5078 prop = RNA_def_property(srna, "air_density", PROP_FLOAT, PROP_FACTOR);
5080 "Air",
5081 "Density of air molecules.\n"
5082 "\u2022 0 - No air.\n"
5083 "\u2022 1 - Clear day atmosphere.\n"
5084 "\u2022 2 - Highly polluted day");
5085 RNA_def_property_range(prop, 0.0f, 10.0f);
5087 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5088
5089 prop = RNA_def_property(srna, "dust_density", PROP_FLOAT, PROP_FACTOR);
5091 "Dust",
5092 "Density of dust molecules and water droplets.\n"
5093 "\u2022 0 - No dust.\n"
5094 "\u2022 1 - Clear day atmosphere.\n"
5095 "\u2022 5 - City like atmosphere.\n"
5096 "\u2022 10 - Hazy day");
5097 RNA_def_property_range(prop, 0.0f, 10.0f);
5099 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5100
5101 prop = RNA_def_property(srna, "ozone_density", PROP_FLOAT, PROP_FACTOR);
5103 "Ozone",
5104 "Density of ozone layer.\n"
5105 "\u2022 0 - No ozone.\n"
5106 "\u2022 1 - Clear day atmosphere.\n"
5107 "\u2022 2 - City like atmosphere");
5108 RNA_def_property_range(prop, 0.0f, 10.0f);
5110 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5111}
5112
5114 {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
5115 {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
5116 {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
5117 {SHD_INTERP_SMART, "Smart", 0, "Smart", "Bicubic when magnifying, else bilinear (OSL only)"},
5118 {0, nullptr, 0, nullptr, nullptr},
5119};
5120
5122{
5123 static const EnumPropertyItem prop_projection_items[] = {
5125 "EQUIRECTANGULAR",
5126 0,
5127 "Equirectangular",
5128 "Equirectangular or latitude-longitude projection"},
5130 "MIRROR_BALL",
5131 0,
5132 "Mirror Ball",
5133 "Projection from an orthographic photo of a mirror ball"},
5134 {0, nullptr, 0, nullptr, nullptr},
5135 };
5136
5137 PropertyRNA *prop;
5138
5139 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
5140 RNA_def_property_pointer_sdna(prop, nullptr, "id");
5141 RNA_def_property_struct_type(prop, "Image");
5144 RNA_def_property_ui_text(prop, "Image", "");
5145 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
5146
5147 RNA_def_struct_sdna_from(srna, "NodeTexEnvironment", "storage");
5148 def_sh_tex(srna);
5149
5150 prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
5151 RNA_def_property_enum_items(prop, prop_projection_items);
5152 RNA_def_property_ui_text(prop, "Projection", "Projection of the input image");
5153 RNA_def_property_update(prop, 0, "rna_Node_update");
5154
5155 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5157 RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
5158 RNA_def_property_update(prop, 0, "rna_Node_update");
5159
5160 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
5162 RNA_def_property_pointer_sdna(prop, nullptr, "iuser");
5164 prop,
5165 "Image User",
5166 "Parameters defining which layer, pass and frame of the image is displayed");
5167 RNA_def_property_update(prop, 0, "rna_Node_update");
5168}
5169
5170static void def_sh_tex_gabor(StructRNA *srna)
5171{
5172 static const EnumPropertyItem prop_gabor_types[] = {
5174 "2D",
5175 0,
5176 "2D",
5177 "Use the 2D vector (X, Y) as input. The Z component is ignored."},
5178 {SHD_GABOR_TYPE_3D, "3D", 0, "3D", "Use the 3D vector (X, Y, Z) as input"},
5179 {0, nullptr, 0, nullptr, nullptr},
5180 };
5181
5182 RNA_def_struct_sdna_from(srna, "NodeTexGabor", "storage");
5183 def_sh_tex(srna);
5184
5185 PropertyRNA *prop;
5186 prop = RNA_def_property(srna, "gabor_type", PROP_ENUM, PROP_NONE);
5187 RNA_def_property_enum_sdna(prop, nullptr, "type");
5188 RNA_def_property_enum_items(prop, prop_gabor_types);
5189 RNA_def_property_ui_text(prop, "Type", "The type of Gabor noise to evaluate");
5190 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5191}
5192
5193static void def_sh_tex_image(StructRNA *srna)
5194{
5195 static const EnumPropertyItem prop_projection_items[] = {
5197 "FLAT",
5198 0,
5199 "Flat",
5200 "Image is projected flat using the X and Y coordinates of the texture vector"},
5201 {SHD_PROJ_BOX,
5202 "BOX",
5203 0,
5204 "Box",
5205 "Image is projected using different components for each side of the object space bounding "
5206 "box"},
5208 "SPHERE",
5209 0,
5210 "Sphere",
5211 "Image is projected spherically using the Z axis as central"},
5213 "TUBE",
5214 0,
5215 "Tube",
5216 "Image is projected from the tube using the Z axis as central"},
5217 {0, nullptr, 0, nullptr, nullptr},
5218 };
5219
5220 PropertyRNA *prop;
5221
5222 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
5223 RNA_def_property_pointer_sdna(prop, nullptr, "id");
5224 RNA_def_property_struct_type(prop, "Image");
5227 RNA_def_property_ui_text(prop, "Image", "");
5228 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
5229
5230 RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
5231 def_sh_tex(srna);
5232
5233 prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
5234 RNA_def_property_enum_items(prop, prop_projection_items);
5236 prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
5238 RNA_def_property_update(prop, 0, "rna_Node_update");
5239
5240 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5242 RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
5243 RNA_def_property_update(prop, 0, "rna_Node_update");
5244
5245 prop = RNA_def_property(srna, "projection_blend", PROP_FLOAT, PROP_FACTOR);
5247 prop, "Projection Blend", "For box projection, amount of blend to use between sides");
5248 RNA_def_property_update(prop, 0, "rna_Node_update");
5249
5250 prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
5253 prop, "Extension", "How the image is extrapolated past its original bounds");
5255 RNA_def_property_update(prop, 0, "rna_Node_update");
5256
5257 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
5259 RNA_def_property_pointer_sdna(prop, nullptr, "iuser");
5261 prop,
5262 "Image User",
5263 "Parameters defining which layer, pass and frame of the image is displayed");
5264 RNA_def_property_update(prop, 0, "rna_Node_update");
5265}
5266
5268{
5269 PropertyRNA *prop;
5270
5271 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
5272 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5274 RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
5275 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
5276}
5277
5279{
5280 static const EnumPropertyItem fn_tex_prop_interpolation_items[] = {
5281 {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
5282 {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
5283 {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
5284 {0, nullptr, 0, nullptr, nullptr},
5285 };
5286
5287 PropertyRNA *prop;
5288
5289 RNA_def_struct_sdna_from(srna, "NodeGeometryImageTexture", "storage");
5290
5291 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5292 RNA_def_property_enum_items(prop, fn_tex_prop_interpolation_items);
5293 RNA_def_property_ui_text(prop, "Interpolation", "Method for smoothing values between pixels");
5294 RNA_def_property_update(prop, 0, "rna_Node_update");
5295
5296 prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
5299 prop, "Extension", "How the image is extrapolated past its original bounds");
5301 RNA_def_property_update(prop, 0, "rna_Node_update");
5302}
5303
5305{
5306 PropertyRNA *prop;
5307
5308 RNA_def_struct_sdna_from(srna, "NodeGeometryTransformGizmo", "storage");
5309
5310 prop = RNA_def_property(srna, "use_translation_x", PROP_BOOLEAN, PROP_NONE);
5312 RNA_def_property_ui_text(prop, "Use Translation X", nullptr);
5313 RNA_def_property_update(prop, 0, "rna_Node_update");
5314
5315 prop = RNA_def_property(srna, "use_translation_y", PROP_BOOLEAN, PROP_NONE);
5317 RNA_def_property_ui_text(prop, "Use Translation Y", nullptr);
5318 RNA_def_property_update(prop, 0, "rna_Node_update");
5319
5320 prop = RNA_def_property(srna, "use_translation_z", PROP_BOOLEAN, PROP_NONE);
5322 RNA_def_property_ui_text(prop, "Use Translation Z", nullptr);
5323 RNA_def_property_update(prop, 0, "rna_Node_update");
5324
5325 prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
5327 RNA_def_property_ui_text(prop, "Use Rotation X", nullptr);
5328 RNA_def_property_update(prop, 0, "rna_Node_update");
5329
5330 prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
5332 RNA_def_property_ui_text(prop, "Use Rotation Y", nullptr);
5333 RNA_def_property_update(prop, 0, "rna_Node_update");
5334
5335 prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
5337 RNA_def_property_ui_text(prop, "Use Rotation Z", nullptr);
5338 RNA_def_property_update(prop, 0, "rna_Node_update");
5339
5340 prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
5342 RNA_def_property_ui_text(prop, "Use Scale X", nullptr);
5343 RNA_def_property_update(prop, 0, "rna_Node_update");
5344
5345 prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
5347 RNA_def_property_ui_text(prop, "Use Scale Y", nullptr);
5348 RNA_def_property_update(prop, 0, "rna_Node_update");
5349
5350 prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
5352 RNA_def_property_ui_text(prop, "Use Scale Z", nullptr);
5353 RNA_def_property_update(prop, 0, "rna_Node_update");
5354}
5355
5357{
5358 static const EnumPropertyItem prop_gradient_type[] = {
5359 {SHD_BLEND_LINEAR, "LINEAR", 0, "Linear", "Create a linear progression"},
5360 {SHD_BLEND_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
5362 "EASING",
5363 0,
5364 "Easing",
5365 "Create a progression easing from one step to the next"},
5366 {SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
5367 {SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
5369 "QUADRATIC_SPHERE",
5370 0,
5371 "Quadratic Sphere",
5372 "Create a quadratic progression in the shape of a sphere"},
5373 {SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Create a radial progression"},
5374 {0, nullptr, 0, nullptr, nullptr},
5375 };
5376
5377 PropertyRNA *prop;
5378
5379 RNA_def_struct_sdna_from(srna, "NodeTexGradient", "storage");
5380 def_sh_tex(srna);
5381
5382 prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
5383 RNA_def_property_enum_items(prop, prop_gradient_type);
5384 RNA_def_property_ui_text(prop, "Gradient Type", "Style of the color blending");
5385 RNA_def_property_update(prop, 0, "rna_Node_update");
5386}
5387
5388static void def_sh_tex_noise(StructRNA *srna)
5389{
5390 static const EnumPropertyItem prop_noise_type[] = {
5392 "MULTIFRACTAL",
5393 0,
5394 "Multifractal",
5395 "More uneven result (varies with location), more similar to a real terrain"},
5397 "RIDGED_MULTIFRACTAL",
5398 0,
5399 "Ridged Multifractal",
5400 "Create sharp peaks"},
5402 "HYBRID_MULTIFRACTAL",
5403 0,
5404 "Hybrid Multifractal",
5405 "Create peaks and valleys with different roughness values"},
5406 {SHD_NOISE_FBM, "FBM", 0, "fBM", "The standard fractal Perlin noise"},
5408 "HETERO_TERRAIN",
5409 0,
5410 "Hetero Terrain",
5411 "Similar to Hybrid Multifractal creates a heterogeneous terrain, but with the likeness of "
5412 "river channels"},
5413 {0, nullptr, 0, nullptr, nullptr},
5414 };
5415
5416 PropertyRNA *prop;
5417
5418 RNA_def_struct_sdna_from(srna, "NodeTexNoise", "storage");
5419 def_sh_tex(srna);
5420
5421 prop = RNA_def_property(srna, "noise_dimensions", PROP_ENUM, PROP_NONE);
5422 RNA_def_property_enum_sdna(prop, nullptr, "dimensions");
5424 RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
5426 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5427
5428 prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
5429 RNA_def_property_enum_sdna(prop, nullptr, "type");
5431 RNA_def_property_ui_text(prop, "Type", "Type of the Noise texture");
5432 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5433
5434 prop = RNA_def_property(srna, "normalize", PROP_BOOLEAN, PROP_NONE);
5435 RNA_def_property_boolean_sdna(prop, nullptr, "normalize", 0);
5436 RNA_def_property_ui_text(prop, "Normalize", "Normalize outputs to 0.0 to 1.0 range");
5437 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5438}
5439
5441{
5442 RNA_def_struct_sdna_from(srna, "NodeTexChecker", "storage");
5443 def_sh_tex(srna);
5444}
5445
5446static void def_sh_tex_brick(StructRNA *srna)
5447{
5448 PropertyRNA *prop;
5449
5450 RNA_def_struct_sdna_from(srna, "NodeTexBrick", "storage");
5451 def_sh_tex(srna);
5452
5453 prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
5454 RNA_def_property_int_sdna(prop, nullptr, "offset_freq");
5456 RNA_def_property_range(prop, 1, 99);
5458 prop,
5459 "Offset Frequency",
5460 "How often rows are offset. A value of 2 gives an even/uneven pattern of rows.");
5461 RNA_def_property_update(prop, 0, "rna_Node_update");
5462
5463 prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
5464 RNA_def_property_int_sdna(prop, nullptr, "squash_freq");
5466 RNA_def_property_range(prop, 1, 99);
5468 prop, "Squash Frequency", "How often rows consist of \"squished\" bricks");
5469 RNA_def_property_update(prop, 0, "rna_Node_update");
5470
5471 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
5472 RNA_def_property_float_sdna(prop, nullptr, "offset");
5474 RNA_def_property_range(prop, 0.0f, 1.0f);
5476 prop, "Offset Amount", "Determines the brick offset of the various rows");
5477 RNA_def_property_update(prop, 0, "rna_Node_update");
5478
5479 prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
5480 RNA_def_property_float_sdna(prop, nullptr, "squash");
5482 RNA_def_property_range(prop, 0.0f, 99.0f);
5484 prop,
5485 "Squash Amount",
5486 "Factor to adjust the brick's width for particular rows determined by the Offset Frequency");
5487 RNA_def_property_update(prop, 0, "rna_Node_update");
5488}
5489
5490static void def_sh_tex_magic(StructRNA *srna)
5491{
5492 PropertyRNA *prop;
5493
5494 RNA_def_struct_sdna_from(srna, "NodeTexMagic", "storage");
5495 def_sh_tex(srna);
5496
5497 prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
5498 RNA_def_property_int_sdna(prop, nullptr, "depth");
5499 RNA_def_property_range(prop, 0, 10);
5500 RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
5501 RNA_def_property_update(prop, 0, "rna_Node_update");
5502}
5503
5505{
5506 static EnumPropertyItem prop_distance_items[] = {
5507 {SHD_VORONOI_EUCLIDEAN, "EUCLIDEAN", 0, "Euclidean", "Euclidean distance"},
5508 {SHD_VORONOI_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Manhattan distance"},
5509 {SHD_VORONOI_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Chebychev distance"},
5510 {SHD_VORONOI_MINKOWSKI, "MINKOWSKI", 0, "Minkowski", "Minkowski distance"},
5511 {0, nullptr, 0, nullptr, nullptr}};
5512
5513 static EnumPropertyItem prop_feature_items[] = {
5515 "F1",
5516 0,
5517 "F1",
5518 "Computes the distance to the closest point as well as its position and color"},
5520 "F2",
5521 0,
5522 "F2",
5523 "Computes the distance to the second closest point as well as its position and color"},
5525 "SMOOTH_F1",
5526 0,
5527 "Smooth F1",
5528 "Smoothed version of F1. Weighted sum of neighbor voronoi cells."},
5530 "DISTANCE_TO_EDGE",
5531 0,
5532 "Distance to Edge",
5533 "Computes the distance to the edge of the voronoi cell"},
5535 "N_SPHERE_RADIUS",
5536 0,
5537 "N-Sphere Radius",
5538 "Computes the radius of the n-sphere inscribed in the voronoi cell"},
5539 {0, nullptr, 0, nullptr, nullptr}};
5540
5541 PropertyRNA *prop;
5542
5543 RNA_def_struct_sdna_from(srna, "NodeTexVoronoi", "storage");
5544 def_sh_tex(srna);
5545
5546 prop = RNA_def_property(srna, "voronoi_dimensions", PROP_ENUM, PROP_NONE);
5547 RNA_def_property_enum_sdna(prop, nullptr, "dimensions");
5549 RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
5551 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5552
5553 prop = RNA_def_property(srna, "distance", PROP_ENUM, PROP_NONE);
5554 RNA_def_property_enum_sdna(prop, nullptr, "distance");
5555 RNA_def_property_enum_items(prop, prop_distance_items);
5557 prop, "Distance Metric", "The distance metric used to compute the texture");
5558 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5559
5560 prop = RNA_def_property(srna, "feature", PROP_ENUM, PROP_NONE);
5561 RNA_def_property_enum_sdna(prop, nullptr, "feature");
5562 RNA_def_property_enum_items(prop, prop_feature_items);
5564 prop, "Feature Output", "The Voronoi feature that the node will compute");
5565 RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5566
5567 prop = RNA_def_property(srna, "normalize", PROP_BOOLEAN, PROP_NONE);
5568 RNA_def_property_boolean_sdna(prop, nullptr, "normalize", 0);
5569 RNA_def_property_ui_text(prop, "Normalize", "Normalize output Distance to 0.0 to 1.0 range");
5570 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5571}
5572
5573static void def_sh_tex_wave(StructRNA *srna)
5574{
5575 static const EnumPropertyItem prop_wave_type_items[] = {
5576 {SHD_WAVE_BANDS, "BANDS", 0, "Bands", "Use standard wave texture in bands"},
5577 {SHD_WAVE_RINGS, "RINGS", 0, "Rings", "Use wave texture in rings"},
5578 {0, nullptr, 0, nullptr, nullptr},
5579 };
5580
5581 static EnumPropertyItem prop_wave_bands_direction_items[] = {
5582 {SHD_WAVE_BANDS_DIRECTION_X, "X", 0, "X", "Bands across X axis"},
5583 {SHD_WAVE_BANDS_DIRECTION_Y, "Y", 0, "Y", "Bands across Y axis"},
5584 {SHD_WAVE_BANDS_DIRECTION_Z, "Z", 0, "Z", "Bands across Z axis"},
5585 {SHD_WAVE_BANDS_DIRECTION_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Bands across diagonal axis"},
5586 {0, nullptr, 0, nullptr, nullptr},
5587 };
5588
5589 static EnumPropertyItem prop_wave_rings_direction_items[] = {
5590 {SHD_WAVE_RINGS_DIRECTION_X, "X", 0, "X", "Rings along X axis"},
5591 {SHD_WAVE_RINGS_DIRECTION_Y, "Y", 0, "Y", "Rings along Y axis"},
5592 {SHD_WAVE_RINGS_DIRECTION_Z, "Z", 0, "Z", "Rings along Z axis"},
5594 "SPHERICAL",
5595 0,
5596 "Spherical",
5597 "Rings along spherical distance"},
5598 {0, nullptr, 0, nullptr, nullptr},
5599 };
5600
5601 static const EnumPropertyItem prop_wave_profile_items[] = {
5602 {SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"},
5603 {SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"},
5604 {SHD_WAVE_PROFILE_TRI, "TRI", 0, "Triangle", "Use a triangle profile"},
5605 {0, nullptr, 0, nullptr, nullptr},
5606 };
5607
5608 PropertyRNA *prop;
5609
5610 RNA_def_struct_sdna_from(srna, "NodeTexWave", "storage");
5611 def_sh_tex(srna);
5612
5613 prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
5614 RNA_def_property_enum_sdna(prop, nullptr, "wave_type");
5615 RNA_def_property_enum_items(prop, prop_wave_type_items);
5616 RNA_def_property_ui_text(prop, "Wave Type", "");
5617 RNA_def_property_update(prop, 0, "rna_Node_update");
5618
5619 prop = RNA_def_property(srna, "bands_direction", PROP_ENUM, PROP_NONE);
5620 RNA_def_property_enum_sdna(prop, nullptr, "bands_direction");
5621 RNA_def_property_enum_items(prop, prop_wave_bands_direction_items);
5622 RNA_def_property_ui_text(prop, "Bands Direction", "");
5623 RNA_def_property_update(prop, 0, "rna_Node_update");
5624
5625 prop = RNA_def_property(srna, "rings_direction", PROP_ENUM, PROP_NONE);
5626 RNA_def_property_enum_sdna(prop, nullptr, "rings_direction");
5627 RNA_def_property_enum_items(prop, prop_wave_rings_direction_items);
5628 RNA_def_property_ui_text(prop, "Rings Direction", "");
5629 RNA_def_property_update(prop, 0, "rna_Node_update");
5630
5631 prop = RNA_def_property(srna, "wave_profile", PROP_ENUM, PROP_NONE);
5632 RNA_def_property_enum_sdna(prop, nullptr, "wave_profile");
5633 RNA_def_property_enum_items(prop, prop_wave_profile_items);
5634 RNA_def_property_ui_text(prop, "Wave Profile", "");
5635 RNA_def_property_update(prop, 0, "rna_Node_update");
5636}
5637
5639{
5640 PropertyRNA *prop;
5641
5642 prop = RNA_def_property(srna, "noise_dimensions", PROP_ENUM, PROP_NONE);
5643 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5645 RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
5647 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5648}
5649
5650static void def_sh_tex_coord(StructRNA *srna)
5651{
5652 PropertyRNA *prop;
5653
5654 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
5655 RNA_def_property_pointer_sdna(prop, nullptr, "id");
5656 RNA_def_property_struct_type(prop, "Object");
5660 prop, "Object", "Use coordinates from this object (for object texture coordinates output)");
5661 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
5662
5663 prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
5664 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
5666 prop, "From Instancer", "Use the parent of the instance object if possible");
5667 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5668}
5669
5671{
5672 static const EnumPropertyItem prop_vect_type_items[] = {
5673 {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
5674 {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
5676 "NORMAL",
5677 0,
5678 "Normal",
5679 "Transform a normal vector with unit length"},
5680 {0, nullptr, 0, nullptr, nullptr},
5681 };
5682
5683 static const EnumPropertyItem prop_vect_space_items[] = {
5684 {SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""},
5685 {SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""},
5686 {SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""},
5687 {0, nullptr, 0, nullptr, nullptr},
5688 };
5689
5690 PropertyRNA *prop;
5691
5692 RNA_def_struct_sdna_from(srna, "NodeShaderVectTransform", "storage");
5693
5694 prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
5695 RNA_def_property_enum_sdna(prop, nullptr, "type");
5696 RNA_def_property_enum_items(prop, prop_vect_type_items);
5697 RNA_def_property_ui_text(prop, "Type", "");
5698 RNA_def_property_update(prop, 0, "rna_Node_update");
5699
5700 prop = RNA_def_property(srna, "convert_from", PROP_ENUM, PROP_NONE);
5701 RNA_def_property_enum_items(prop, prop_vect_space_items);
5702 RNA_def_property_ui_text(prop, "Convert From", "Space to convert from");
5703 RNA_def_property_update(prop, 0, "rna_Node_update");
5704
5705 prop = RNA_def_property(srna, "convert_to", PROP_ENUM, PROP_NONE);
5706 RNA_def_property_enum_items(prop, prop_vect_space_items);
5707 RNA_def_property_ui_text(prop, "Convert To", "Space to convert to");
5708 RNA_def_property_update(prop, 0, "rna_Node_update");
5709}
5710
5712{
5713 PropertyRNA *prop;
5714
5715 prop = RNA_def_property(srna, "use_pixel_size", PROP_BOOLEAN, PROP_NONE);
5716 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
5717 RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units");
5719 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5720}
5721
5723{
5724 PropertyRNA *prop;
5725
5726 FunctionRNA *func;
5727 PropertyRNA *parm;
5728
5729 static const EnumPropertyItem point_source_items[] = {
5731 "PARTICLE_SYSTEM",
5732 0,
5733 "Particle System",
5734 "Generate point density from a particle system"},
5736 "OBJECT",
5737 0,
5738 "Object Vertices",
5739 "Generate point density from an object's vertices"},
5740 {0, nullptr, 0, nullptr, nullptr},
5741 };
5742
5743 static const EnumPropertyItem prop_interpolation_items[] = {
5744 {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
5745 {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
5746 {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
5747 {0, nullptr, 0, nullptr, nullptr},
5748 };
5749
5750 static const EnumPropertyItem space_items[] = {
5751 {SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""},
5752 {SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""},
5753 {0, nullptr, 0, nullptr, nullptr},
5754 };
5755
5756 static const EnumPropertyItem particle_color_source_items[] = {
5758 "PARTICLE_AGE",
5759 0,
5760 "Particle Age",
5761 "Lifetime mapped as 0.0 to 1.0 intensity"},
5763 "PARTICLE_SPEED",
5764 0,
5765 "Particle Speed",
5766 "Particle speed (absolute magnitude of velocity) mapped as 0.0 to 1.0 intensity"},
5768 "PARTICLE_VELOCITY",
5769 0,
5770 "Particle Velocity",
5771 "XYZ velocity mapped to RGB colors"},
5772 {0, nullptr, 0, nullptr, nullptr},
5773 };
5774
5775 static const EnumPropertyItem vertex_color_source_items[] = {
5776 {SHD_POINTDENSITY_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"},
5778 "VERTEX_WEIGHT",
5779 0,
5780 "Vertex Weight",
5781 "Vertex group weight"},
5783 "VERTEX_NORMAL",
5784 0,
5785 "Vertex Normal",
5786 "XYZ normal vector mapped to RGB colors"},
5787 {0, nullptr, 0, nullptr, nullptr},
5788 };
5789
5790 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
5791 RNA_def_property_pointer_sdna(prop, nullptr, "id");
5792 RNA_def_property_struct_type(prop, "Object");
5795 RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
5796 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5797
5798 RNA_def_struct_sdna_from(srna, "NodeShaderTexPointDensity", "storage");
5799
5800 prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
5801 RNA_def_property_enum_items(prop, point_source_items);
5802 RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
5803 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5804
5805 prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
5806 RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
5807 RNA_def_property_struct_type(prop, "ParticleSystem");
5809 "rna_ShaderNodePointDensity_psys_get",
5810 "rna_ShaderNodePointDensity_psys_set",
5811 nullptr,
5812 nullptr);
5815 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5816
5817 prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
5818 RNA_def_property_range(prop, 1, 32768);
5820 prop, "Resolution", "Resolution used by the texture holding the point density");
5821 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5822
5823 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
5824 RNA_def_property_float_sdna(prop, nullptr, "radius");
5825 RNA_def_property_range(prop, 0.001, FLT_MAX);
5827 prop, "Radius", "Radius from the shaded sample to look for points within");
5828 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5829
5830 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
5832 RNA_def_property_ui_text(prop, "Space", "Coordinate system to calculate voxels in");
5833 RNA_def_property_update(prop, 0, "rna_Node_update");
5834
5835 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5836 RNA_def_property_enum_items(prop, prop_interpolation_items);
5837 RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
5838 RNA_def_property_update(prop, 0, "rna_Node_update");
5839
5840 prop = RNA_def_property(srna, "particle_color_source", PROP_ENUM, PROP_NONE);
5841 RNA_def_property_enum_sdna(prop, nullptr, "color_source");
5842 RNA_def_property_enum_items(prop, particle_color_source_items);
5843 RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
5844 RNA_def_property_update(prop, 0, "rna_Node_update");
5845
5846 prop = RNA_def_property(srna, "vertex_color_source", PROP_ENUM, PROP_NONE);
5847 RNA_def_property_enum_sdna(prop, nullptr, "ob_color_source");
5848 RNA_def_property_enum_items(prop, vertex_color_source_items);
5849 RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
5850 RNA_def_property_update(prop, 0, "rna_Node_update");
5851
5852 prop = RNA_def_property(srna, "vertex_attribute_name", PROP_STRING, PROP_NONE);
5853 RNA_def_property_ui_text(prop, "Vertex Attribute Name", "Vertex attribute to use for color");
5854 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5855
5856 func = RNA_def_function(srna, "cache_point_density", "rna_ShaderNodePointDensity_density_cache");
5857 RNA_def_function_ui_description(func, "Cache point density data for later calculation");
5858 RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
5859
5860 func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc");
5861 RNA_def_function_ui_description(func, "Calculate point density");
5862 RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
5863 /* TODO: See how array size of 0 works, this shouldn't be used. */
5864 parm = RNA_def_float_array(func, "rgba_values", 1, nullptr, 0, 0, "", "RGBA Values", 0, 0);
5866 RNA_def_function_output(func, parm);
5867
5868 func = RNA_def_function(
5869 srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax");
5870 RNA_def_function_ui_description(func, "Calculate point density");
5871 RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
5872 parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS);
5873 RNA_def_property_array(parm, 3);
5875 RNA_def_function_output(func, parm);
5876 parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_COORDS);
5877 RNA_def_property_array(parm, 3);
5879 RNA_def_function_output(func, parm);
5880}
5881
5882static void def_metallic(StructRNA *srna)
5883{
5884 PropertyRNA *prop;
5885
5886 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5887 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5889 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
5890 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5891
5892 prop = RNA_def_property(srna, "fresnel_type", PROP_ENUM, PROP_NONE);
5893 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
5895 RNA_def_property_ui_text(prop, "Fresnel Type", "Fresnel method used to tint the metal");
5896 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5897}
5898
5899static void def_glossy(StructRNA *srna)
5900{
5901 PropertyRNA *prop;
5902
5903 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5904 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5906 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
5907 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5908}
5909
5910static void def_glass(StructRNA *srna)
5911{
5912 PropertyRNA *prop;
5913
5914 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5915 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5917 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
5918 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5919}
5920
5921static void def_sheen(StructRNA *srna)
5922{
5923 PropertyRNA *prop;
5924
5925 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5926 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5928 RNA_def_property_ui_text(prop, "Distribution", "Sheen shading model");
5929 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5930}
5931
5932static void def_principled(StructRNA *srna)
5933{
5934 PropertyRNA *prop;
5935
5936 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5937 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5939 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
5940 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5941
5942 prop = RNA_def_property(srna, "subsurface_method", PROP_ENUM, PROP_NONE);
5943 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
5946 prop, "Subsurface Method", "Method for rendering subsurface scattering");
5947 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5948}
5949
5950static void def_refraction(StructRNA *srna)
5951{
5952 PropertyRNA *prop;
5953
5954 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5955 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5957 RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
5958 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5959}
5960
5961static void def_scatter(StructRNA *srna)
5962{
5963 PropertyRNA *prop;
5964
5965 prop = RNA_def_property(srna, "phase", PROP_ENUM, PROP_NONE);
5966 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5968 RNA_def_property_ui_text(prop, "Phase", "Phase function for the scattered light");
5969 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5970}
5971
5972static void def_toon(StructRNA *srna)
5973{
5974 PropertyRNA *prop;
5975
5976 prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
5977 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
5979 RNA_def_property_ui_text(prop, "Component", "Toon BSDF component to use");
5980 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5981}
5982
5983static void def_sh_bump(StructRNA *srna)
5984{
5985 PropertyRNA *prop;
5986
5987 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
5988 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
5990 prop, "Invert", "Invert the bump mapping direction to push into the surface instead of out");
5991 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5992}
5993
5994static void def_hair(StructRNA *srna)
5995{
5996 PropertyRNA *prop;
5997
5998 prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
5999 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6001 RNA_def_property_ui_text(prop, "Component", "Hair BSDF component to use");
6002 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6003}
6004
6005/* RNA initialization for the custom properties. */
6007{
6008 PropertyRNA *prop;
6009
6010 RNA_def_struct_sdna_from(srna, "NodeShaderHairPrincipled", "storage");
6011
6012 prop = RNA_def_property(srna, "model", PROP_ENUM, PROP_NONE);
6013 RNA_def_property_enum_sdna(prop, nullptr, "model");
6014 RNA_def_property_ui_text(prop, "Scattering model", "Select from Chiang or Huang model");
6017 /* Upon editing, update both the node data AND the UI representation */
6018 /* (This effectively shows/hides the relevant sockets) */
6019 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6020
6021 prop = RNA_def_property(srna, "parametrization", PROP_ENUM, PROP_NONE);
6022 RNA_def_property_enum_sdna(prop, nullptr, "parametrization");
6024 prop, "Color Parametrization", "Select the shader's color parametrization");
6027 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6028}
6029
6030static void def_sh_uvmap(StructRNA *srna)
6031{
6032 PropertyRNA *prop;
6033
6034 prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
6035 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
6037 prop, "From Instancer", "Use the parent of the instance object if possible");
6038 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6039
6040 RNA_def_struct_sdna_from(srna, "NodeShaderUVMap", "storage");
6041
6042 prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
6043 RNA_def_property_ui_text(prop, "UV Map", "UV coordinates to be used for mapping");
6044 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6045
6046 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6047}
6048
6050{
6051 PropertyRNA *prop;
6052
6053 RNA_def_struct_sdna_from(srna, "NodeShaderVertexColor", "storage");
6054
6055 prop = RNA_def_property(srna, "layer_name", PROP_STRING, PROP_NONE);
6056 RNA_def_property_ui_text(prop, "Color Attribute", "Color Attribute");
6057 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6058
6059 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6060}
6061
6063{
6064 PropertyRNA *prop;
6065
6066 prop = RNA_def_property(srna, "use_tips", PROP_BOOLEAN, PROP_NONE);
6067 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
6069 prop, "Use Tips", "Lower half of the texture is for tips of the stroke");
6070 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6071}
6072
6074{
6075 static const EnumPropertyItem prop_space_items[] = {
6076 {SHD_SPACE_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"},
6077 {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"},
6078 {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
6080 "BLENDER_OBJECT",
6081 0,
6082 "Blender Object Space",
6083 "Object space normal mapping, compatible with Blender render baking"},
6085 "BLENDER_WORLD",
6086 0,
6087 "Blender World Space",
6088 "World space normal mapping, compatible with Blender render baking"},
6089 {0, nullptr, 0, nullptr, nullptr},
6090 };
6091
6092 PropertyRNA *prop;
6093
6094 RNA_def_struct_sdna_from(srna, "NodeShaderNormalMap", "storage");
6095
6096 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6097 RNA_def_property_enum_items(prop, prop_space_items);
6098 RNA_def_property_ui_text(prop, "Space", "Space of the input normal");
6099 RNA_def_property_update(prop, 0, "rna_Node_update");
6100
6101 prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
6102 RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent space maps");
6103 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6104
6105 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6106}
6107
6109{
6110 static const EnumPropertyItem prop_space_items[] = {
6112 "OBJECT",
6113 0,
6114 "Object Space",
6115 "Displacement is in object space, affected by object scale"},
6117 "WORLD",
6118 0,
6119 "World Space",
6120 "Displacement is in world space, not affected by object scale"},
6121 {0, nullptr, 0, nullptr, nullptr},
6122 };
6123
6124 PropertyRNA *prop;
6125
6126 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6127 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6128 RNA_def_property_enum_items(prop, prop_space_items);
6129 RNA_def_property_ui_text(prop, "Space", "Space of the input height");
6130 RNA_def_property_update(prop, 0, "rna_Node_update");
6131
6132 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6133}
6134
6136{
6137 static const EnumPropertyItem prop_space_items[] = {
6139 "TANGENT",
6140 0,
6141 "Tangent Space",
6142 "Tangent space vector displacement mapping"},
6143 {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space vector displacement mapping"},
6144 {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space vector displacement mapping"},
6145 {0, nullptr, 0, nullptr, nullptr},
6146 };
6147
6148 PropertyRNA *prop;
6149
6150 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6151 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6152 RNA_def_property_enum_items(prop, prop_space_items);
6153 RNA_def_property_ui_text(prop, "Space", "Space of the input height");
6154 RNA_def_property_update(prop, 0, "rna_Node_update");
6155
6156 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6157}
6158
6159static void def_sh_tangent(StructRNA *srna)
6160{
6161 static const EnumPropertyItem prop_direction_type_items[] = {
6162 {SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
6163 {SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
6164 {0, nullptr, 0, nullptr, nullptr},
6165 };
6166
6167 static const EnumPropertyItem prop_axis_items[] = {
6168 {SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
6169 {SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
6170 {SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
6171 {0, nullptr, 0, nullptr, nullptr},
6172 };
6173
6174 PropertyRNA *prop;
6175
6176 RNA_def_struct_sdna_from(srna, "NodeShaderTangent", "storage");
6177
6178 prop = RNA_def_property(srna, "direction_type", PROP_ENUM, PROP_NONE);
6179 RNA_def_property_enum_items(prop, prop_direction_type_items);
6180 RNA_def_property_ui_text(prop, "Direction", "Method to use for the tangent");
6181 RNA_def_property_update(prop, 0, "rna_Node_update");
6182
6183 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
6184 RNA_def_property_enum_items(prop, prop_axis_items);
6185 RNA_def_property_ui_text(prop, "Axis", "Axis for radial tangents");
6186 RNA_def_property_update(prop, 0, "rna_Node_update");
6187
6188 prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
6189 RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent generated from UV");
6190 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6191
6192 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6193}
6194
6195static void def_sh_bevel(StructRNA *srna)
6196{
6197 PropertyRNA *prop;
6198
6199 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
6200 RNA_def_property_int_sdna(prop, nullptr, "custom1");
6201 RNA_def_property_range(prop, 2, 128);
6202 RNA_def_property_ui_range(prop, 2, 16, 1, 1);
6203 RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
6204 RNA_def_property_update(prop, 0, "rna_Node_update");
6205}
6206
6208{
6209 PropertyRNA *prop;
6210
6211 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
6212 RNA_def_property_int_sdna(prop, nullptr, "custom1");
6213 RNA_def_property_range(prop, 1, 128);
6214 RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
6215 RNA_def_property_update(prop, 0, "rna_Node_update");
6216
6217 prop = RNA_def_property(srna, "inside", PROP_BOOLEAN, PROP_NONE);
6218 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_AO_INSIDE);
6219 RNA_def_property_ui_text(prop, "Inside", "Trace rays towards the inside of the object");
6220 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6221
6222 prop = RNA_def_property(srna, "only_local", PROP_BOOLEAN, PROP_NONE);
6223 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", SHD_AO_LOCAL);
6225 prop, "Only Local", "Only consider the object itself when computing AO");
6226 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6227}
6228
6230{
6231 PropertyRNA *prop;
6232
6233 prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
6234 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6236 RNA_def_property_ui_text(prop, "Method", "Method for rendering subsurface scattering");
6237 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6238}
6239
6240static void def_sh_tex_ies(StructRNA *srna)
6241{
6242 PropertyRNA *prop;
6243
6244 prop = RNA_def_property(srna, "ies", PROP_POINTER, PROP_NONE);
6245 RNA_def_property_pointer_sdna(prop, nullptr, "id");
6246 RNA_def_property_struct_type(prop, "Text");
6249 RNA_def_property_ui_text(prop, "IES Text", "Internal IES file");
6250 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6251
6252 RNA_def_struct_sdna_from(srna, "NodeShaderTexIES", "storage");
6253
6254 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
6255 RNA_def_property_ui_text(prop, "File Path", "IES light path");
6256 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6257
6258 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6259 RNA_def_property_enum_funcs(prop, nullptr, "rna_ShaderNodeTexIES_mode_set", nullptr);
6262 prop, "Source", "Whether the IES file is loaded from disk or from a text data-block");
6263 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6264
6265 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6266}
6267
6269{
6270 PropertyRNA *prop;
6271
6272 RNA_def_struct_sdna_from(srna, "NodeShaderOutputAOV", "storage");
6273
6274 prop = RNA_def_property(srna, "aov_name", PROP_STRING, PROP_NONE);
6275 RNA_def_property_string_sdna(prop, nullptr, "name");
6276 RNA_def_property_ui_text(prop, "Name", "Name of the AOV that this output writes to");
6277 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6278
6279 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6280}
6281
6283{
6284 static const EnumPropertyItem type_items[] = {
6285 {NODE_COMBSEP_COLOR_RGB, "RGB", ICON_NONE, "RGB", "Use RGB color processing"},
6286 {NODE_COMBSEP_COLOR_HSV, "HSV", ICON_NONE, "HSV", "Use HSV color processing"},
6287 {NODE_COMBSEP_COLOR_HSL, "HSL", ICON_NONE, "HSL", "Use HSL color processing"},
6288 {0, nullptr, 0, nullptr, nullptr},
6289 };
6290
6291 PropertyRNA *prop;
6292
6293 RNA_def_struct_sdna_from(srna, "NodeCombSepColor", "storage");
6294
6295 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6296 RNA_def_property_enum_items(prop, type_items);
6297 RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
6298 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
6299}
6300
6301static void def_sh_script(StructRNA *srna)
6302{
6303 PropertyRNA *prop;
6304
6305 prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
6306 RNA_def_property_pointer_sdna(prop, nullptr, "id");
6307 RNA_def_property_struct_type(prop, "Text");
6310 RNA_def_property_ui_text(prop, "Script", "Internal shader script to define the shader");
6311 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
6312
6313 RNA_def_struct_sdna_from(srna, "NodeShaderScript", "storage");
6314
6315 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
6316 RNA_def_property_ui_text(prop, "File Path", "Shader script path");
6317 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
6318
6319 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6320 RNA_def_property_enum_funcs(prop, nullptr, "rna_ShaderNodeScript_mode_set", nullptr);
6322 RNA_def_property_ui_text(prop, "Script Source", "");
6323 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6324
6325 prop = RNA_def_property(srna, "use_auto_update", PROP_BOOLEAN, PROP_NONE);
6328 prop,
6329 "Auto Update",
6330 "Automatically update the shader when the .osl file changes (external scripts only)");
6331
6332 prop = RNA_def_property(srna, "bytecode", PROP_STRING, PROP_NONE);
6334 "rna_ShaderNodeScript_bytecode_get",
6335 "rna_ShaderNodeScript_bytecode_length",
6336 "rna_ShaderNodeScript_bytecode_set");
6337 RNA_def_property_ui_text(prop, "Bytecode", "Compile bytecode for shader script node");
6338 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6339
6340 prop = RNA_def_property(srna, "bytecode_hash", PROP_STRING, PROP_NONE);
6342 prop, "Bytecode Hash", "Hash of compile bytecode, for quick equality checking");
6343 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6344
6345 /* needs to be reset to avoid bad pointer type in API functions below */
6346 RNA_def_struct_sdna_from(srna, "bNode", nullptr);
6347
6348 /* API functions */
6349
6350# if 0 /* XXX TODO: use general node api for this. */
6351 func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket");
6352 RNA_def_function_ui_description(func, "Find a socket by name");
6353 parm = RNA_def_string(func, "name", nullptr, 0, "Socket name", "");
6355 /*parm =*/RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
6356 parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
6357 RNA_def_function_return(func, parm);
6358
6359 func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket");
6360 RNA_def_function_ui_description(func, "Add a socket");
6362 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "");
6364 parm = RNA_def_enum(func, "type", rna_enum_node_socket_type_items, SOCK_FLOAT, "Type", "");
6366 /*parm =*/RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
6367 parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
6368 RNA_def_function_return(func, parm);
6369
6370 func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket");
6371 RNA_def_function_ui_description(func, "Remove a socket");
6373 parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "");
6375# endif
6376}
6377
6378/* -- Compositor Nodes ------------------------------------------------------ */
6379
6381{
6382 PropertyRNA *prop;
6383
6384 /* XXX: Tooltip */
6385 prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
6386 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
6387 RNA_def_property_ui_text(prop, "Convert Premultiplied", "");
6388 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6389
6390 RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
6391
6392 prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_FACTOR);
6393 RNA_def_property_float_sdna(prop, nullptr, "x");
6394 RNA_def_property_range(prop, 0.0f, 1.0f);
6395 RNA_def_property_ui_text(prop, "Premultiplied", "Mix Factor");
6396 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6397}
6398
6399static void def_cmp_blur(StructRNA *srna)
6400{
6401 PropertyRNA *prop;
6402
6403 static const EnumPropertyItem filter_type_items[] = {
6404 {R_FILTER_BOX, "FLAT", 0, "Flat", ""},
6405 {R_FILTER_TENT, "TENT", 0, "Tent", ""},
6406 {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
6407 {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
6408 {R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
6409 {R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
6410 {R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
6411 {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
6412 {0, nullptr, 0, nullptr, nullptr},
6413 };
6414
6415 static const EnumPropertyItem aspect_correction_type_items[] = {
6416 {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
6417 {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
6418 {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
6419 {0, nullptr, 0, nullptr, nullptr},
6420 };
6421
6422 /* duplicated in def_cmp_bokehblur */
6423 prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
6426 prop, "Variable Size", "Support variable blur per pixel when using an image for size input");
6427 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6428
6429 prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
6432 prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
6433 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6434
6435 RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
6436
6437 prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
6438 RNA_def_property_int_sdna(prop, nullptr, "sizex");
6439 RNA_def_property_range(prop, 0, 2048);
6440 RNA_def_property_ui_text(prop, "Size X", "");
6441 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6442
6443 prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
6444 RNA_def_property_int_sdna(prop, nullptr, "sizey");
6445 RNA_def_property_range(prop, 0, 2048);
6446 RNA_def_property_ui_text(prop, "Size Y", "");
6447 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6448
6449 prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
6450 RNA_def_property_boolean_sdna(prop, nullptr, "relative", 1);
6452 prop, "Relative", "Use relative (percent) values to define blur radius");
6453 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6454
6455 prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE);
6456 RNA_def_property_enum_sdna(prop, nullptr, "aspect");
6457 RNA_def_property_enum_items(prop, aspect_correction_type_items);
6458 RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use");
6459 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6460
6461 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
6462 RNA_def_property_float_sdna(prop, nullptr, "fac");
6463 RNA_def_property_range(prop, 0.0f, 2.0f);
6464 RNA_def_property_ui_text(prop, "Factor", "");
6465 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6466
6467 prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE);
6468 RNA_def_property_float_sdna(prop, nullptr, "percentx");
6469 RNA_def_property_range(prop, 0.0f, 100.0f);
6470 RNA_def_property_ui_text(prop, "Relative Size X", "");
6471 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6472
6473 prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE);
6474 RNA_def_property_float_sdna(prop, nullptr, "percenty");
6475 RNA_def_property_range(prop, 0.0f, 100.0f);
6476 RNA_def_property_ui_text(prop, "Relative Size Y", "");
6477 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6478
6479 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
6480 RNA_def_property_enum_sdna(prop, nullptr, "filtertype");
6481 RNA_def_property_enum_items(prop, filter_type_items);
6482 RNA_def_property_ui_text(prop, "Filter Type", "");
6484 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6485
6486 prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE);
6487 RNA_def_property_boolean_sdna(prop, nullptr, "bokeh", 1);
6488 RNA_def_property_ui_text(prop, "Bokeh", "Use circular filter (slower)");
6489 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6490
6491 prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
6492 RNA_def_property_boolean_sdna(prop, nullptr, "gamma", 1);
6493 RNA_def_property_ui_text(prop, "Gamma", "Apply filter on gamma corrected values");
6494 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6495}
6496
6497static void def_cmp_filter(StructRNA *srna)
6498{
6499 PropertyRNA *prop;
6500
6501 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
6502 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6504 RNA_def_property_ui_text(prop, "Filter Type", "");
6505 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6506}
6507
6509{
6510 PropertyRNA *prop;
6511
6512 RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
6513
6514 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
6515 RNA_def_property_float_sdna(prop, nullptr, "loc");
6516 RNA_def_property_array(prop, 1);
6517 RNA_def_property_range(prop, -1000.0f, 1000.0f);
6518 RNA_def_property_ui_text(prop, "Offset", "");
6519 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6520
6521 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
6522 RNA_def_property_float_sdna(prop, nullptr, "size");
6523 RNA_def_property_array(prop, 1);
6524 RNA_def_property_range(prop, -1000.0f, 1000.0f);
6525 RNA_def_property_ui_text(prop, "Size", "");
6526 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6527
6528 prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
6529 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEXMAP_CLIP_MIN);
6530 RNA_def_property_ui_text(prop, "Use Minimum", "");
6531 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6532
6533 prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
6534 RNA_def_property_boolean_sdna(prop, nullptr, "flag", TEXMAP_CLIP_MAX);
6535 RNA_def_property_ui_text(prop, "Use Maximum", "");
6536 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6537
6538 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
6539 RNA_def_property_float_sdna(prop, nullptr, "min");
6540 RNA_def_property_array(prop, 1);
6541 RNA_def_property_range(prop, -1000.0f, 1000.0f);
6542 RNA_def_property_ui_text(prop, "Minimum", "");
6543 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6544
6545 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
6546 RNA_def_property_float_sdna(prop, nullptr, "max");
6547 RNA_def_property_array(prop, 1);
6548 RNA_def_property_range(prop, -1000.0f, 1000.0f);
6549 RNA_def_property_ui_text(prop, "Maximum", "");
6550 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6551}
6552
6554{
6555 PropertyRNA *prop;
6556
6557 prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
6558 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
6559 RNA_def_property_ui_text(prop, "Clamp", "Clamp the result of the node to the target range");
6560 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6561}
6562
6564{
6565 PropertyRNA *prop;
6566
6567 RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
6568
6569 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
6570 RNA_def_property_int_sdna(prop, nullptr, "samples");
6571 RNA_def_property_range(prop, 1, 256);
6572 RNA_def_property_ui_text(prop, "Samples", "");
6573 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6574
6575 prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
6576 RNA_def_property_int_sdna(prop, nullptr, "minspeed");
6577 RNA_def_property_range(prop, 0, 1024);
6579 prop,
6580 "Min Speed",
6581 "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
6582 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6583
6584 prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
6585 RNA_def_property_int_sdna(prop, nullptr, "maxspeed");
6586 RNA_def_property_range(prop, 0, 1024);
6587 RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none");
6588 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6589
6590 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
6591 RNA_def_property_float_sdna(prop, nullptr, "fac");
6592 RNA_def_property_range(prop, 0.0, 20.0);
6593 RNA_def_property_ui_range(prop, 0.0, 2.0, 1.0, 2);
6595 prop,
6596 "Blur Factor",
6597 "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
6598 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6599
6600 prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
6601 RNA_def_property_boolean_sdna(prop, nullptr, "curved", 1);
6603 prop, "Curved", "Interpolate between frames in a Bézier curve, rather than linearly");
6604 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6605}
6606
6608{
6609 PropertyRNA *prop;
6610
6611 static const EnumPropertyItem mode_items[] = {
6613 "APPLY",
6614 0,
6615 "Apply Mask",
6616 "Multiply the input image's RGBA channels by the alpha input value"},
6618 "REPLACE_ALPHA",
6619 0,
6620 "Replace Alpha",
6621 "Replace the input image's alpha channel by the alpha input value"},
6622 {0, nullptr, 0, nullptr, nullptr},
6623 };
6624
6625 RNA_def_struct_sdna_from(srna, "NodeSetAlpha", "storage");
6626
6627 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6628 RNA_def_property_enum_items(prop, mode_items);
6629 RNA_def_property_ui_text(prop, "Mode", "");
6630 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6631}
6632
6633static void def_cmp_levels(StructRNA *srna)
6634{
6635 PropertyRNA *prop;
6636
6637 static const EnumPropertyItem channel_items[] = {
6638 {CMP_NODE_LEVLES_LUMINANCE, "COMBINED_RGB", 0, "Combined", "Combined RGB"},
6639 {CMP_NODE_LEVLES_RED, "RED", 0, "Red", "Red Channel"},
6640 {CMP_NODE_LEVLES_GREEN, "GREEN", 0, "Green", "Green Channel"},
6641 {CMP_NODE_LEVLES_BLUE, "BLUE", 0, "Blue", "Blue Channel"},
6642 {CMP_NODE_LEVLES_LUMINANCE_BT709, "LUMINANCE", 0, "Luminance", "Luminance Channel"},
6643 {0, nullptr, 0, nullptr, nullptr},
6644 };
6645
6646 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
6647 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6648 RNA_def_property_enum_items(prop, channel_items);
6649 RNA_def_property_ui_text(prop, "Channel", "");
6650 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6651}
6652
6654{
6655 PropertyRNA *prop;
6656
6657 prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
6658 RNA_def_property_int_sdna(prop, nullptr, "frames");
6661 prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.cc */
6662 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6663
6664 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
6665 RNA_def_property_int_sdna(prop, nullptr, "sfra");
6667 /* copied from the rna_image.cc */
6669 prop,
6670 "Start Frame",
6671 "Global starting frame of the movie/sequence, assuming first picture has a #1");
6672 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6673
6674 prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
6675 RNA_def_property_int_sdna(prop, nullptr, "offset");
6677 /* copied from the rna_image.cc */
6679 prop, "Offset", "Offset the number of the frame to use in the animation");
6680 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6681
6682 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
6683 RNA_def_property_boolean_sdna(prop, nullptr, "cycl", 1);
6685 prop, "Cyclic", "Cycle the images in the movie"); /* copied from the rna_image.cc */
6686 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6687
6688 prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
6689 RNA_def_property_boolean_sdna(prop, nullptr, "flag", IMA_ANIM_ALWAYS);
6690 /* copied from the rna_image.cc */
6691 RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes");
6692 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6693
6694 prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
6695 RNA_def_property_enum_sdna(prop, nullptr, "layer");
6697 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_image_layer_itemf");
6699 RNA_def_property_ui_text(prop, "Layer", "");
6700 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_image_layer_update");
6701
6702 prop = RNA_def_property(srna, "has_layers", PROP_BOOLEAN, PROP_NONE);
6703 RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_layers_get", nullptr);
6705 RNA_def_property_ui_text(prop, "Has Layers", "True if this image has any named layer");
6706
6707 prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
6708 RNA_def_property_enum_sdna(prop, nullptr, "view");
6710 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_image_view_itemf");
6712 RNA_def_property_ui_text(prop, "View", "");
6713 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6714
6715 prop = RNA_def_property(srna, "has_views", PROP_BOOLEAN, PROP_NONE);
6716 RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_views_get", nullptr);
6718 RNA_def_property_ui_text(prop, "Has View", "True if this image has multiple views");
6719}
6720
6721static void def_cmp_image(StructRNA *srna)
6722{
6723 PropertyRNA *prop;
6724
6725# if 0
6726 static const EnumPropertyItem type_items[] = {
6727 {IMA_SRC_FILE, "IMAGE", 0, "Image", ""},
6728 {IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
6729 {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
6730 {IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
6731 {0, nullptr, 0, nullptr, nullptr},
6732 };
6733# endif
6734
6735 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
6736 RNA_def_property_pointer_sdna(prop, nullptr, "id");
6737 RNA_def_property_struct_type(prop, "Image");
6740 RNA_def_property_ui_text(prop, "Image", "");
6741 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Image_Node_update_id");
6742
6743 prop = RNA_def_property(srna, "use_straight_alpha_output", PROP_BOOLEAN, PROP_NONE);
6746 "Straight Alpha Output",
6747 "Put node output buffer to straight alpha instead of premultiplied");
6748 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6749
6750 /* NOTE: Image user properties used in the UI are redefined in def_node_image_user,
6751 * to trigger correct updates of the node editor. RNA design problem that prevents
6752 * updates from nested structs. */
6753 RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
6754 def_node_image_user(srna);
6755}
6756
6758{
6759 PropertyRNA *prop;
6760
6761 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
6762 RNA_def_property_pointer_sdna(prop, nullptr, "id");
6763 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Node_scene_set", nullptr, nullptr);
6764 RNA_def_property_struct_type(prop, "Scene");
6767 RNA_def_property_ui_text(prop, "Scene", "");
6768 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
6769
6770 prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
6771 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6773 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_view_layer_itemf");
6775 RNA_def_property_ui_text(prop, "Layer", "");
6776 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
6777}
6778
6780{
6781 StructRNA *srna;
6782 PropertyRNA *prop;
6783
6784 srna = RNA_def_struct(brna, "NodeOutputFileSlotFile", nullptr);
6785 RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
6787 srna, "Output File Slot", "Single layer file slot of the file output node");
6788
6789 prop = RNA_def_property(srna, "use_node_format", PROP_BOOLEAN, PROP_NONE);
6790 RNA_def_property_boolean_sdna(prop, nullptr, "use_node_format", 1);
6791 RNA_def_property_ui_text(prop, "Use Node Format", "");
6792 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
6793
6794 prop = RNA_def_property(srna, "save_as_render", PROP_BOOLEAN, PROP_NONE);
6795 RNA_def_property_boolean_sdna(prop, nullptr, "save_as_render", 1);
6797 prop, "Save as Render", "Apply render part of display transform when saving byte image");
6798 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
6799
6800 prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
6801 RNA_def_property_struct_type(prop, "ImageFormatSettings");
6802
6803 prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
6804 RNA_def_property_string_sdna(prop, nullptr, "path");
6805 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_NodeOutputFileSlotFile_path_set");
6806 RNA_def_struct_name_property(srna, prop);
6807 RNA_def_property_ui_text(prop, "Path", "Subpath used for this slot");
6809 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
6810}
6812{
6813 StructRNA *srna;
6814 PropertyRNA *prop;
6815
6816 srna = RNA_def_struct(brna, "NodeOutputFileSlotLayer", nullptr);
6817 RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
6819 srna, "Output File Layer Slot", "Multilayer slot of the file output node");
6820
6821 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
6822 RNA_def_property_string_sdna(prop, nullptr, "layer");
6823 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_NodeOutputFileSlotLayer_name_set");
6824 RNA_def_struct_name_property(srna, prop);
6825 RNA_def_property_ui_text(prop, "Name", "OpenEXR layer name used for this slot");
6826 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
6827}
6829 PropertyRNA *cprop,
6830 const char *struct_name)
6831{
6832 StructRNA *srna;
6833 PropertyRNA *parm;
6834 FunctionRNA *func;
6835
6836 RNA_def_property_srna(cprop, struct_name);
6837 srna = RNA_def_struct(brna, struct_name, nullptr);
6838 RNA_def_struct_sdna(srna, "bNode");
6839 RNA_def_struct_ui_text(srna, "File Output Slots", "Collection of File Output node slots");
6840
6841 func = RNA_def_function(srna, "new", "rna_NodeOutputFile_slots_new");
6842 RNA_def_function_ui_description(func, "Add a file slot to this node");
6844 parm = RNA_def_string(func, "name", nullptr, MAX_NAME, "Name", "");
6846 /* return value */
6847 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
6848 RNA_def_function_return(func, parm);
6849
6850 /* NOTE: methods below can use the standard node socket API functions,
6851 * included here for completeness. */
6852
6853 func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
6854 RNA_def_function_ui_description(func, "Remove a file slot from this node");
6856 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
6858
6859 func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear");
6860 RNA_def_function_ui_description(func, "Remove all file slots from this node");
6862
6863 func = RNA_def_function(srna, "move", "rna_Node_inputs_move");
6864 RNA_def_function_ui_description(func, "Move a file slot to another position");
6866 parm = RNA_def_int(
6867 func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
6869 parm = RNA_def_int(
6870 func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
6872}
6874{
6875 PropertyRNA *prop;
6876
6877 RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage");
6878
6879 prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH);
6880 RNA_def_property_string_sdna(prop, nullptr, "base_path");
6881 RNA_def_property_ui_text(prop, "Base Path", "Base output path for the image");
6883 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6884
6885 prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_NONE);
6886 RNA_def_property_int_sdna(prop, nullptr, "active_input");
6887 RNA_def_property_ui_text(prop, "Active Input Index", "Active input index in details view list");
6888 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6889
6890 prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
6891 RNA_def_property_struct_type(prop, "ImageFormatSettings");
6892
6893 prop = RNA_def_property(srna, "save_as_render", PROP_BOOLEAN, PROP_NONE);
6894 RNA_def_property_boolean_sdna(prop, nullptr, "save_as_render", 1);
6896 prop, "Save as Render", "Apply render part of display transform when saving byte image");
6897 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
6898
6899 /* XXX using two different collections here for the same basic DNA list!
6900 * Details of the output slots depend on whether the node is in Multilayer EXR mode.
6901 */
6902
6903 prop = RNA_def_property(srna, "file_slots", PROP_COLLECTION, PROP_NONE);
6905 "rna_NodeOutputFile_slots_begin",
6906 "rna_iterator_listbase_next",
6907 "rna_iterator_listbase_end",
6908 "rna_NodeOutputFile_slot_file_get",
6909 nullptr,
6910 nullptr,
6911 nullptr,
6912 nullptr);
6913 RNA_def_property_struct_type(prop, "NodeOutputFileSlotFile");
6914 RNA_def_property_ui_text(prop, "File Slots", "");
6915 rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileFileSlots");
6916
6917 prop = RNA_def_property(srna, "layer_slots", PROP_COLLECTION, PROP_NONE);
6919 "rna_NodeOutputFile_slots_begin",
6920 "rna_iterator_listbase_next",
6921 "rna_iterator_listbase_end",
6922 "rna_NodeOutputFile_slot_layer_get",
6923 nullptr,
6924 nullptr,
6925 nullptr,
6926 nullptr);
6927 RNA_def_property_struct_type(prop, "NodeOutputFileSlotLayer");
6928 RNA_def_property_ui_text(prop, "EXR Layer Slots", "");
6929 rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileLayerSlots");
6930}
6931
6933{
6934 PropertyRNA *prop;
6935
6936 static const EnumPropertyItem mode_items[] = {
6937 {CMP_NODE_DILATE_ERODE_STEP, "STEP", 0, "Steps", ""},
6938 {CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD, "THRESHOLD", 0, "Threshold", ""},
6939 {CMP_NODE_DILATE_ERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
6940 {CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
6941 {0, nullptr, 0, nullptr, nullptr},
6942 };
6943
6944 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6945 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6946 RNA_def_property_enum_items(prop, mode_items);
6947 RNA_def_property_ui_text(prop, "Mode", "Growing/shrinking mode");
6948 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6949
6950 prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
6951 RNA_def_property_int_sdna(prop, nullptr, "custom2");
6952 RNA_def_property_range(prop, -5000, 5000);
6953 RNA_def_property_ui_range(prop, -100, 100, 1, -1);
6954 RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
6955 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6956
6957 /* CMP_NODE_DILATE_ERODE_DISTANCE_THRESH only */
6958 prop = RNA_def_property(srna, "edge", PROP_FLOAT, PROP_NONE);
6959 RNA_def_property_float_sdna(prop, nullptr, "custom3");
6960 RNA_def_property_range(prop, -100, 100);
6961 RNA_def_property_ui_text(prop, "Edge", "Edge to inset");
6963 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6964
6965 RNA_def_struct_sdna_from(srna, "NodeDilateErode", "storage");
6966
6967 /* CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER only */
6968 prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
6969 RNA_def_property_enum_sdna(prop, nullptr, "falloff");
6971 RNA_def_property_ui_text(prop, "Falloff", "Falloff type of the feather");
6973 BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
6974 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6975}
6976
6977static void def_cmp_inpaint(StructRNA *srna)
6978{
6979 PropertyRNA *prop;
6980
6981# if 0
6982 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
6983
6984 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
6985 RNA_def_property_enum_items(prop, type_items);
6986 RNA_def_property_ui_text(prop, "Type", "Type of inpaint algorithm");
6987 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6988# endif
6989
6990 prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
6991 RNA_def_property_int_sdna(prop, nullptr, "custom2");
6992 RNA_def_property_range(prop, 0, 10000);
6993 RNA_def_property_ui_text(prop, "Distance", "Distance to inpaint (number of iterations)");
6994 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6995}
6996
6998{
6999 PropertyRNA *prop;
7000
7001 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
7002 RNA_def_property_float_sdna(prop, nullptr, "custom3");
7003 RNA_def_property_range(prop, 0.0, 1.0f);
7004 RNA_def_property_ui_text(prop, "Threshold", "Threshold for detecting pixels to despeckle");
7005 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7006
7007 prop = RNA_def_property(srna, "threshold_neighbor", PROP_FLOAT, PROP_NONE);
7008 RNA_def_property_float_sdna(prop, nullptr, "custom4");
7009 RNA_def_property_range(prop, 0.0, 1.0f);
7011 prop, "Neighbor", "Threshold for the number of neighbor pixels that must match");
7012 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7013}
7014
7015static void def_cmp_scale(StructRNA *srna)
7016{
7017 PropertyRNA *prop;
7018
7019 static const EnumPropertyItem space_items[] = {
7020 {CMP_NODE_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""},
7021 {CMP_NODE_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
7022 {CMP_NODE_SCALE_RENDER_PERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
7023 {CMP_NODE_SCALE_RENDER_SIZE, "RENDER_SIZE", 0, "Render Size", ""},
7024 {0, nullptr, 0, nullptr, nullptr},
7025 };
7026
7027 /* matching bgpic_camera_frame_items[] */
7028 static const EnumPropertyItem space_frame_items[] = {
7029 {CMP_NODE_SCALE_RENDER_SIZE_STRETCH, "STRETCH", 0, "Stretch", ""},
7030 {CMP_NODE_SCALE_RENDER_SIZE_FIT, "FIT", 0, "Fit", ""},
7031 {CMP_NODE_SCALE_RENDER_SIZE_CROP, "CROP", 0, "Crop", ""},
7032 {0, nullptr, 0, nullptr, nullptr},
7033 };
7034
7035 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
7036 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7038 RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
7039 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_CompositorNodeScale_update");
7040
7041 /* expose 2 flags as a enum of 3 items */
7042 prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
7043 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "custom2");
7044 RNA_def_property_enum_items(prop, space_frame_items);
7045 RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
7046 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7047
7048 prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
7049 RNA_def_property_float_sdna(prop, nullptr, "custom3");
7050 RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally (factor of image size)");
7051 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7052
7053 prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
7054 RNA_def_property_float_sdna(prop, nullptr, "custom4");
7055 RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically (factor of image size)");
7056 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7057}
7058
7059static void def_cmp_rotate(StructRNA *srna)
7060{
7061 PropertyRNA *prop;
7062
7063 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
7064 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7066 RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
7067 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7068}
7069
7071{
7072 PropertyRNA *prop;
7073
7074 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7075
7076 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
7077 RNA_def_property_float_sdna(prop, nullptr, "t1");
7078 RNA_def_property_float_funcs(prop, nullptr, "rna_difference_matte_t1_set", nullptr);
7079 RNA_def_property_range(prop, 0.0f, 1.0f);
7080 RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
7081 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7082
7083 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
7084 RNA_def_property_float_sdna(prop, nullptr, "t2");
7085 RNA_def_property_float_funcs(prop, nullptr, "rna_difference_matte_t2_set", nullptr);
7086 RNA_def_property_range(prop, 0.0f, 1.0f);
7088 prop, "Falloff", "Color distances below this additional threshold are partially keyed");
7089 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7090}
7091
7093{
7094 PropertyRNA *prop;
7095
7096 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7097
7098 prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE);
7099 RNA_def_property_float_sdna(prop, nullptr, "t1");
7100 RNA_def_property_range(prop, 0.0f, 1.0f);
7101 RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color");
7102 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7103
7104 prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE);
7105 RNA_def_property_float_sdna(prop, nullptr, "t2");
7106 RNA_def_property_range(prop, 0.0f, 1.0f);
7107 RNA_def_property_ui_text(prop, "S", "Saturation tolerance for the color");
7108 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7109
7110 prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE);
7111 RNA_def_property_float_sdna(prop, nullptr, "t3");
7112 RNA_def_property_range(prop, 0.0f, 1.0f);
7113 RNA_def_property_ui_text(prop, "V", "Value tolerance for the color");
7114 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7115}
7116
7118{
7119 PropertyRNA *prop;
7120
7121 static const EnumPropertyItem color_space_items[] = {
7122 {1, "RGB", 0, "RGB", "RGB color space"},
7123 {2, "YCC", 0, "YCC", "YCbCr suppression"},
7124 {0, nullptr, 0, nullptr, nullptr},
7125 };
7126
7127 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7128
7129 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
7130 RNA_def_property_enum_sdna(prop, nullptr, "channel");
7131 RNA_def_property_enum_items(prop, color_space_items);
7132 RNA_def_property_ui_text(prop, "Channel", "");
7133 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7134
7135 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
7136 RNA_def_property_float_sdna(prop, nullptr, "t1");
7137 RNA_def_property_float_funcs(prop, nullptr, "rna_distance_matte_t1_set", nullptr);
7138 RNA_def_property_range(prop, 0.0f, 1.0f);
7139 RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
7140 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7141
7142 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
7143 RNA_def_property_float_sdna(prop, nullptr, "t2");
7144 RNA_def_property_float_funcs(prop, nullptr, "rna_distance_matte_t2_set", nullptr);
7145 RNA_def_property_range(prop, 0.0f, 1.0f);
7147 prop, "Falloff", "Color distances below this additional threshold are partially keyed");
7148 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7149}
7150
7152{
7153 PropertyRNA *prop;
7154 RNA_def_struct_sdna_from(srna, "NodeConvertColorSpace", "storage");
7155
7156 prop = RNA_def_property(srna, "from_color_space", PROP_ENUM, PROP_NONE);
7160 "rna_NodeConvertColorSpace_from_color_space_get",
7161 "rna_NodeConvertColorSpace_from_color_space_set",
7162 "rna_NodeConvertColorSpace_color_space_itemf");
7163 RNA_def_property_ui_text(prop, "From", "Color space of the input image");
7164 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7165
7166 prop = RNA_def_property(srna, "to_color_space", PROP_ENUM, PROP_NONE);
7170 "rna_NodeConvertColorSpace_to_color_space_get",
7171 "rna_NodeConvertColorSpace_to_color_space_set",
7172 "rna_NodeConvertColorSpace_color_space_itemf");
7173 RNA_def_property_ui_text(prop, "To", "Color space of the output image");
7174 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7175}
7176
7178{
7179 PropertyRNA *prop;
7180
7181 static const EnumPropertyItem channel_items[] = {
7182 {1, "R", 0, "R", "Red spill suppression"},
7183 {2, "G", 0, "G", "Green spill suppression"},
7184 {3, "B", 0, "B", "Blue spill suppression"},
7185 {0, nullptr, 0, nullptr, nullptr},
7186 };
7187
7188 static const EnumPropertyItem limit_channel_items[] = {
7189 {0, "R", 0, "R", "Limit by red"},
7190 {1, "G", 0, "G", "Limit by green"},
7191 {2, "B", 0, "B", "Limit by blue"},
7192 {0, nullptr, 0, nullptr, nullptr},
7193 };
7194
7195 static const EnumPropertyItem algorithm_items[] = {
7196 {0, "SIMPLE", 0, "Simple", "Simple limit algorithm"},
7197 {1, "AVERAGE", 0, "Average", "Average limit algorithm"},
7198 {0, nullptr, 0, nullptr, nullptr},
7199 };
7200
7201 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
7202 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7203 RNA_def_property_enum_items(prop, channel_items);
7204 RNA_def_property_ui_text(prop, "Channel", "");
7206 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7207
7208 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
7209 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
7210 RNA_def_property_enum_items(prop, algorithm_items);
7211 RNA_def_property_ui_text(prop, "Algorithm", "");
7212 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7213
7214 RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage");
7215
7216 prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
7217 RNA_def_property_enum_sdna(prop, nullptr, "limchan");
7218 RNA_def_property_enum_items(prop, limit_channel_items);
7219 RNA_def_property_ui_text(prop, "Limit Channel", "");
7221 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7222
7223 prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
7224 RNA_def_property_float_sdna(prop, nullptr, "limscale");
7225 RNA_def_property_range(prop, 0.5f, 1.5f);
7226 RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value");
7227 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7228
7229 prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE);
7230 RNA_def_property_boolean_sdna(prop, nullptr, "unspill", 0);
7231 RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (differently) by hand");
7232 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7233
7234 prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE);
7235 RNA_def_property_float_sdna(prop, nullptr, "uspillr");
7236 RNA_def_property_range(prop, 0.0f, 1.5f);
7237 RNA_def_property_ui_text(prop, "R", "Red spillmap scale");
7239 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7240
7241 prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE);
7242 RNA_def_property_float_sdna(prop, nullptr, "uspillg");
7243 RNA_def_property_range(prop, 0.0f, 1.5f);
7244 RNA_def_property_ui_text(prop, "G", "Green spillmap scale");
7246 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7247
7248 prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE);
7249 RNA_def_property_float_sdna(prop, nullptr, "uspillb");
7250 RNA_def_property_range(prop, 0.0f, 1.5f);
7251 RNA_def_property_ui_text(prop, "B", "Blue spillmap scale");
7253 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7254}
7255
7257{
7258 PropertyRNA *prop;
7259
7260 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7261
7262 prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
7263 RNA_def_property_float_sdna(prop, nullptr, "t1");
7264 RNA_def_property_float_funcs(prop, nullptr, "rna_Matte_t1_set", nullptr);
7265 RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7266 RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
7267 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7268
7269 prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
7270 RNA_def_property_float_sdna(prop, nullptr, "t2");
7271 RNA_def_property_float_funcs(prop, nullptr, "rna_Matte_t2_set", nullptr);
7272 RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7273 RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
7274 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7275}
7276
7278{
7279 PropertyRNA *prop;
7280
7281 prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
7282 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
7283 RNA_def_property_ui_text(prop, "Convert Premultiplied", "Keep output image premultiplied alpha");
7284 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7285}
7286
7288{
7289 PropertyRNA *prop;
7290
7291 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7292
7293 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_ANGLE);
7294 RNA_def_property_float_sdna(prop, nullptr, "t1");
7295 RNA_def_property_float_funcs(prop, nullptr, "rna_Matte_t1_set", nullptr);
7296 RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(80.0f));
7298 prop, "Acceptance", "Tolerance for a color to be considered a keying color");
7299 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7300
7301 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_ANGLE);
7302 RNA_def_property_float_sdna(prop, nullptr, "t2");
7303 RNA_def_property_float_funcs(prop, nullptr, "rna_Matte_t2_set", nullptr);
7304 RNA_def_property_range(prop, 0.0f, DEG2RADF(30.0f));
7306 prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
7307 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7308
7309 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
7310 RNA_def_property_float_sdna(prop, nullptr, "fsize");
7311 RNA_def_property_range(prop, 0.0f, 1.0f);
7312 RNA_def_property_ui_text(prop, "Lift", "Alpha lift");
7313 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7314
7315 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
7316 RNA_def_property_float_sdna(prop, nullptr, "fstrength");
7317 RNA_def_property_range(prop, 0.0f, 1.0f);
7318 RNA_def_property_ui_text(prop, "Falloff", "Alpha falloff");
7319 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7320
7321 prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
7322 RNA_def_property_float_sdna(prop, nullptr, "t3");
7323 RNA_def_property_range(prop, 0.0f, 1.0f);
7325 prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
7326 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7327}
7328
7330{
7331 PropertyRNA *prop;
7332
7333 static const EnumPropertyItem color_space_items[] = {
7334 {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB color space"},
7335 {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV color space"},
7336 {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV color space"},
7337 {CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr color space"},
7338 {0, nullptr, 0, nullptr, nullptr},
7339 };
7340
7341 static const EnumPropertyItem algorithm_items[] = {
7342 {0, "SINGLE", 0, "Single", "Limit by single channel"},
7343 {1, "MAX", 0, "Max", "Limit by maximum of other channels"},
7344 {0, nullptr, 0, nullptr, nullptr},
7345 };
7346
7347 prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
7348 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7349 RNA_def_property_enum_items(prop, color_space_items);
7350 RNA_def_property_ui_text(prop, "Color Space", "");
7351 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7352
7353 prop = RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
7354 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
7356 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_channel_itemf");
7357 RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte");
7359 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7360
7361 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7362
7363 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
7364 RNA_def_property_enum_sdna(prop, nullptr, "algorithm");
7365 RNA_def_property_enum_items(prop, algorithm_items);
7366 RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel");
7367 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7368
7369 prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
7370 RNA_def_property_enum_sdna(prop, nullptr, "channel");
7372 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Node_channel_itemf");
7373 RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channel's value");
7375 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7376
7377 prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
7378 RNA_def_property_float_sdna(prop, nullptr, "t1");
7379 RNA_def_property_float_funcs(prop, nullptr, "rna_Matte_t1_set", nullptr);
7380 RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7381 RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
7382 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7383
7384 prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
7385 RNA_def_property_float_sdna(prop, nullptr, "t2");
7386 RNA_def_property_float_funcs(prop, nullptr, "rna_Matte_t2_set", nullptr);
7387 RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7388 RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
7389 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7390}
7391
7392static void def_cmp_flip(StructRNA *srna)
7393{
7394 PropertyRNA *prop;
7395
7396 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
7397 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7399 RNA_def_property_ui_text(prop, "Axis", "");
7400 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7401}
7402
7403static void def_cmp_split(StructRNA *srna)
7404{
7405 PropertyRNA *prop;
7406
7407 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
7408 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
7410 RNA_def_property_ui_text(prop, "Axis", "");
7411 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7412
7413 prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR);
7414 RNA_def_property_int_sdna(prop, nullptr, "custom1");
7415 RNA_def_property_range(prop, 0, 100);
7416 RNA_def_property_ui_text(prop, "Factor", "");
7417 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7418}
7419
7420static void def_cmp_id_mask(StructRNA *srna)
7421{
7422 PropertyRNA *prop;
7423
7424 prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
7425 RNA_def_property_int_sdna(prop, nullptr, "custom1");
7426 RNA_def_property_range(prop, 0, 32767);
7427 RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
7428 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7429
7430 prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
7431 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", 0);
7432 RNA_def_property_ui_text(prop, "Anti-Aliasing", "Apply an anti-aliasing filter to the mask");
7433 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7434}
7435
7437{
7438 PropertyRNA *prop;
7439
7440 static const EnumPropertyItem BufEdgeMode_items[] = {
7441 {0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to bleed along edges"},
7442 {1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from touching edges"},
7443 {0, nullptr, 0, nullptr, nullptr},
7444 };
7445
7446 static const EnumPropertyItem InnerEdgeMode_items[] = {
7447 {0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"},
7448 {1,
7449 "ADJACENT_ONLY",
7450 0,
7451 "Adjacent Only",
7452 "Only inner mask pixels adjacent to outer mask pixels are considered during mask "
7453 "calculation"},
7454 {0, nullptr, 0, nullptr, nullptr},
7455 };
7456
7457 prop = RNA_def_property(srna, "inner_mode", PROP_ENUM, PROP_NONE);
7458 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7459 RNA_def_property_enum_items(prop, InnerEdgeMode_items);
7460 RNA_def_property_ui_text(prop, "Inner Edge Mode", "");
7461 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7462
7463 prop = RNA_def_property(srna, "edge_mode", PROP_ENUM, PROP_NONE);
7464 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
7465 RNA_def_property_enum_items(prop, BufEdgeMode_items);
7466 RNA_def_property_ui_text(prop, "Buffer Edge Mode", "");
7467 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7468}
7469
7470static void def_cmp_map_uv(StructRNA *srna)
7471{
7472 PropertyRNA *prop;
7473
7474 static const EnumPropertyItem filter_type_items[] = {
7475 {CMP_NODE_MAP_UV_FILTERING_NEAREST, "NEAREST", 0, "Nearest", ""},
7476 {CMP_NODE_MAP_UV_FILTERING_ANISOTROPIC, "ANISOTROPIC", 0, "Anisotropic", ""},
7477 {0, nullptr, 0, nullptr, nullptr},
7478 };
7479
7480 prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_FACTOR);
7481 RNA_def_property_int_sdna(prop, nullptr, "custom1");
7482 RNA_def_property_range(prop, 0, 100);
7483 RNA_def_property_ui_text(prop, "Alpha", "");
7484 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7485
7486 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
7487 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
7488 RNA_def_property_enum_items(prop, filter_type_items);
7489 RNA_def_property_ui_text(prop, "Filter Type", "");
7491 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7492}
7493
7494static void def_cmp_defocus(StructRNA *srna)
7495{
7496 PropertyRNA *prop;
7497
7498 static const EnumPropertyItem bokeh_items[] = {
7499 {8, "OCTAGON", 0, "Octagonal", "8 sides"},
7500 {7, "HEPTAGON", 0, "Heptagonal", "7 sides"},
7501 {6, "HEXAGON", 0, "Hexagonal", "6 sides"},
7502 {5, "PENTAGON", 0, "Pentagonal", "5 sides"},
7503 {4, "SQUARE", 0, "Square", "4 sides"},
7504 {3, "TRIANGLE", 0, "Triangular", "3 sides"},
7505 {0, "CIRCLE", 0, "Circular", ""},
7506 {0, nullptr, 0, nullptr, nullptr},
7507 };
7508
7509 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
7510 RNA_def_property_pointer_sdna(prop, nullptr, "id");
7511 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Node_scene_set", nullptr, nullptr);
7512 RNA_def_property_struct_type(prop, "Scene");
7516 prop, "Scene", "Scene from which to select the active camera (render scene if undefined)");
7517 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
7518
7519 RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage");
7520
7521 prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE);
7522 RNA_def_property_enum_sdna(prop, nullptr, "bktype");
7523 RNA_def_property_enum_items(prop, bokeh_items);
7524 RNA_def_property_ui_text(prop, "Bokeh Type", "");
7525 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7526
7527 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
7528 RNA_def_property_float_sdna(prop, nullptr, "rotation");
7529 RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
7530 RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset");
7531 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7532
7533 prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
7534 RNA_def_property_boolean_sdna(prop, nullptr, "gamco", 1);
7536 prop, "Gamma Correction", "Enable gamma correction before and after main process");
7537 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7538
7539 /* TODO */
7540 prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
7541 RNA_def_property_float_sdna(prop, nullptr, "fstop");
7542 RNA_def_property_range(prop, 0.0f, 128.0f);
7544 prop,
7545 "F-Stop",
7546 "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles "
7547 "the blur radius");
7548 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7549
7550 prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
7551 RNA_def_property_float_sdna(prop, nullptr, "maxblur");
7552 RNA_def_property_range(prop, 0.0f, 10000.0f);
7553 RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
7554 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7555
7556 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
7557 RNA_def_property_float_sdna(prop, nullptr, "bthresh");
7558 RNA_def_property_range(prop, 0.0f, 100.0f);
7560 prop,
7561 "Threshold",
7562 "CoC radius threshold, prevents background bleed on in-focus midground, 0 is disabled");
7563 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7564
7565 prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
7566 RNA_def_property_boolean_sdna(prop, nullptr, "preview", 1);
7567 RNA_def_property_ui_text(prop, "Preview", "Enable low quality mode, useful for preview");
7568 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7569
7570 prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
7571 RNA_def_property_boolean_negative_sdna(prop, nullptr, "no_zbuf", 1);
7573 "Use Z-Buffer",
7574 "Disable when using an image as input instead of actual z-buffer "
7575 "(auto enabled if node not image based, eg. time node)");
7576 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7577
7578 prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
7579 RNA_def_property_float_sdna(prop, nullptr, "scale");
7580 RNA_def_property_range(prop, 0.0f, 1000.0f);
7582 prop,
7583 "Z-Scale",
7584 "Scale the Z input when not using a z-buffer, controls maximum blur designated "
7585 "by the color white or input value 1");
7586 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7587}
7588
7589static void def_cmp_invert(StructRNA *srna)
7590{
7591 PropertyRNA *prop;
7592
7593 prop = RNA_def_property(srna, "invert_rgb", PROP_BOOLEAN, PROP_NONE);
7594 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", CMP_CHAN_RGB);
7595 RNA_def_property_ui_text(prop, "RGB", "");
7596 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7597
7598 prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
7599 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", CMP_CHAN_A);
7600 RNA_def_property_ui_text(prop, "Alpha", "");
7601 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7602}
7603
7604static void def_cmp_crop(StructRNA *srna)
7605{
7606 PropertyRNA *prop;
7607
7608 prop = RNA_def_property(srna, "use_crop_size", PROP_BOOLEAN, PROP_NONE);
7609 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
7610 RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
7611 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7612
7613 prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
7614 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", 1);
7615 RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
7616 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7617
7618 RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
7619
7620 prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
7621 RNA_def_property_int_sdna(prop, nullptr, "x1");
7622 RNA_def_property_range(prop, 0, 10000);
7623 RNA_def_property_ui_text(prop, "X1", "");
7624 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7625
7626 prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE);
7627 RNA_def_property_int_sdna(prop, nullptr, "x2");
7628 RNA_def_property_range(prop, 0, 10000);
7629 RNA_def_property_ui_text(prop, "X2", "");
7630 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7631
7632 prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE);
7633 RNA_def_property_int_sdna(prop, nullptr, "y1");
7634 RNA_def_property_range(prop, 0, 10000);
7635 RNA_def_property_ui_text(prop, "Y1", "");
7636 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7637
7638 prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE);
7639 RNA_def_property_int_sdna(prop, nullptr, "y2");
7640 RNA_def_property_range(prop, 0, 10000);
7641 RNA_def_property_ui_text(prop, "Y2", "");
7642 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7643
7644 prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
7645 RNA_def_property_float_sdna(prop, nullptr, "fac_x1");
7646 RNA_def_property_range(prop, 0.0, 1.0);
7647 RNA_def_property_ui_text(prop, "X1", "");
7648 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7649
7650 prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
7651 RNA_def_property_float_sdna(prop, nullptr, "fac_x2");
7652 RNA_def_property_range(prop, 0.0, 1.0);
7653 RNA_def_property_ui_text(prop, "X2", "");
7654 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7655
7656 prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
7657 RNA_def_property_float_sdna(prop, nullptr, "fac_y1");
7658 RNA_def_property_range(prop, 0.0, 1.0);
7659 RNA_def_property_ui_text(prop, "Y1", "");
7660 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7661
7662 prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
7663 RNA_def_property_float_sdna(prop, nullptr, "fac_y2");
7664 RNA_def_property_range(prop, 0.0, 1.0);
7665 RNA_def_property_ui_text(prop, "Y2", "");
7666 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7667}
7668
7669static void def_cmp_dblur(StructRNA *srna)
7670{
7671 PropertyRNA *prop;
7672
7673 RNA_def_struct_sdna_from(srna, "NodeDBlurData", "storage");
7674
7675 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7676 RNA_def_property_int_sdna(prop, nullptr, "iter");
7677 RNA_def_property_range(prop, 1, 32);
7678 RNA_def_property_ui_text(prop, "Iterations", "");
7679 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7680
7681 prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
7682 RNA_def_property_float_sdna(prop, nullptr, "center_x");
7683 RNA_def_property_range(prop, 0.0f, 1.0f);
7684 RNA_def_property_ui_text(prop, "Center X", "");
7685 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7686
7687 prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
7688 RNA_def_property_float_sdna(prop, nullptr, "center_y");
7689 RNA_def_property_range(prop, 0.0f, 1.0f);
7690 RNA_def_property_ui_text(prop, "Center Y", "");
7691 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7692
7693 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
7694 RNA_def_property_float_sdna(prop, nullptr, "distance");
7695 RNA_def_property_range(prop, -1.0f, 1.0f);
7696 RNA_def_property_ui_text(prop, "Distance", "");
7697 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7698
7699 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
7700 RNA_def_property_float_sdna(prop, nullptr, "angle");
7701 RNA_def_property_range(prop, 0.0f, DEG2RADF(360.0f));
7702 RNA_def_property_ui_text(prop, "Angle", "");
7703 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7704
7705 prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_ANGLE);
7706 RNA_def_property_float_sdna(prop, nullptr, "spin");
7707 RNA_def_property_range(prop, DEG2RADF(-360.0f), DEG2RADF(360.0f));
7708 RNA_def_property_ui_text(prop, "Spin", "");
7709 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7710
7711 prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
7712 RNA_def_property_float_sdna(prop, nullptr, "zoom");
7713 RNA_def_property_range(prop, 0.0f, 100.0f);
7714 RNA_def_property_ui_text(prop, "Zoom", "");
7715 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7716}
7717
7719{
7720 PropertyRNA *prop;
7721
7722 RNA_def_struct_sdna_from(srna, "NodeBilateralBlurData", "storage");
7723
7724 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7725 RNA_def_property_int_sdna(prop, nullptr, "iter");
7726 RNA_def_property_range(prop, 1, 128);
7727 RNA_def_property_ui_text(prop, "Iterations", "");
7728 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7729
7730 prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
7731 RNA_def_property_float_sdna(prop, nullptr, "sigma_color");
7732 RNA_def_property_range(prop, 0.01f, 3.0f);
7733 RNA_def_property_ui_text(prop, "Color Sigma", "");
7734 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7735
7736 prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
7737 RNA_def_property_float_sdna(prop, nullptr, "sigma_space");
7738 RNA_def_property_range(prop, 0.01f, 30.0f);
7739 RNA_def_property_ui_text(prop, "Space Sigma", "");
7740 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7741}
7742
7744{
7745 PropertyRNA *prop;
7746
7747 static const EnumPropertyItem type_items[] = {
7748 {0, "STRAIGHT_TO_PREMUL", 0, "To Premultiplied", "Convert straight to premultiplied"},
7749 {1, "PREMUL_TO_STRAIGHT", 0, "To Straight", "Convert premultiplied to straight"},
7750 {0, nullptr, 0, nullptr, nullptr},
7751 };
7752
7753 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
7754 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7755 RNA_def_property_enum_items(prop, type_items);
7757 prop, "Mapping", "Conversion between premultiplied alpha and key alpha");
7758 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7759}
7760
7761static void def_cmp_glare(StructRNA *srna)
7762{
7763 PropertyRNA *prop;
7764
7765 static const EnumPropertyItem type_items[] = {
7766 {CMP_NODE_GLARE_BLOOM, "BLOOM", 0, "Bloom", ""},
7767 {CMP_NODE_GLARE_GHOST, "GHOSTS", 0, "Ghosts", ""},
7768 {CMP_NODE_GLARE_STREAKS, "STREAKS", 0, "Streaks", ""},
7769 {CMP_NODE_GLARE_FOG_GLOW, "FOG_GLOW", 0, "Fog Glow", ""},
7770 {CMP_NODE_GLARE_SIMPLE_STAR, "SIMPLE_STAR", 0, "Simple Star", ""},
7771 {0, nullptr, 0, nullptr, nullptr},
7772 };
7773
7774 static const EnumPropertyItem quality_items[] = {
7775 {0, "HIGH", 0, "High", ""},
7776 {1, "MEDIUM", 0, "Medium", ""},
7777 {2, "LOW", 0, "Low", ""},
7778 {0, nullptr, 0, nullptr, nullptr},
7779 };
7780
7781 RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
7782
7783 prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE);
7784 RNA_def_property_enum_sdna(prop, nullptr, "type");
7785 RNA_def_property_enum_items(prop, type_items);
7786 RNA_def_property_ui_text(prop, "Glare Type", "");
7787 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7788
7789 prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
7790 RNA_def_property_enum_sdna(prop, nullptr, "quality");
7791 RNA_def_property_enum_items(prop, quality_items);
7793 prop,
7794 "Quality",
7795 "If not set to high quality, the effect will be applied to a low-res copy "
7796 "of the source image");
7797 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7798
7799 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7800 RNA_def_property_int_sdna(prop, nullptr, "iter");
7801 RNA_def_property_range(prop, 2, 5);
7802 RNA_def_property_ui_text(prop, "Iterations", "");
7803 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7804
7805 prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
7806 RNA_def_property_float_sdna(prop, nullptr, "colmod");
7807 RNA_def_property_range(prop, 0.0f, 1.0f);
7809 prop,
7810 "Color Modulation",
7811 "Amount of Color Modulation, modulates colors of streaks and ghosts for "
7812 "a spectral dispersion effect");
7813 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7814
7815 prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
7816 RNA_def_property_float_sdna(prop, nullptr, "mix");
7817 RNA_def_property_range(prop, -1.0f, 1.0f);
7819 prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
7820 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7821
7822 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
7823 RNA_def_property_float_sdna(prop, nullptr, "threshold");
7824 RNA_def_property_range(prop, 0.0f, 1000.0f);
7826 prop,
7827 "Threshold",
7828 "The glare filter will only be applied to pixels brighter than this value");
7829 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7830
7831 prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
7832 RNA_def_property_int_sdna(prop, nullptr, "streaks");
7833 RNA_def_property_range(prop, 1, 16);
7834 RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
7835 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7836
7837 prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE);
7838 RNA_def_property_float_sdna(prop, nullptr, "angle_ofs");
7839 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
7840 RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset");
7841 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7842
7843 prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
7844 RNA_def_property_float_sdna(prop, nullptr, "fade");
7845 RNA_def_property_range(prop, 0.75f, 1.0f);
7846 RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor");
7847 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7848
7849 prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE);
7850 RNA_def_property_boolean_sdna(prop, nullptr, "star_45", 0);
7851 RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset");
7852 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7853
7854 prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
7855 RNA_def_property_int_sdna(prop, nullptr, "size");
7856 RNA_def_property_range(prop, 1, 9);
7858 prop,
7859 "Size",
7860 "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
7861 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7862
7863 /* TODO */
7864}
7865
7866static void def_cmp_tonemap(StructRNA *srna)
7867{
7868 PropertyRNA *prop;
7869
7870 static const EnumPropertyItem type_items[] = {
7871 {1,
7872 "RD_PHOTORECEPTOR",
7873 0,
7874 "R/D Photoreceptor",
7875 "More advanced algorithm based on eye physiology, by Reinhard and Devlin"},
7876 {0, "RH_SIMPLE", 0, "Rh Simple", "Simpler photographic algorithm by Reinhard"},
7877 {0, nullptr, 0, nullptr, nullptr},
7878 };
7879
7880 RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
7881
7882 prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
7883 RNA_def_property_enum_sdna(prop, nullptr, "type");
7884 RNA_def_property_enum_items(prop, type_items);
7885 RNA_def_property_ui_text(prop, "Tonemap Type", "");
7886 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7887
7888 prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE);
7889 RNA_def_property_float_sdna(prop, nullptr, "key");
7890 RNA_def_property_range(prop, 0.0f, 1.0f);
7891 RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
7892 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7893
7894 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
7895 RNA_def_property_float_sdna(prop, nullptr, "offset");
7896 RNA_def_property_range(prop, 0.001f, 10.0f);
7898 prop,
7899 "Offset",
7900 "Normally always 1, but can be used as an extra control to alter the brightness curve");
7901 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7902
7903 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
7904 RNA_def_property_float_sdna(prop, nullptr, "gamma");
7905 RNA_def_property_range(prop, 0.001f, 3.0f);
7906 RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
7907 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7908
7909 prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
7910 RNA_def_property_float_sdna(prop, nullptr, "f");
7911 RNA_def_property_range(prop, -8.0f, 8.0f);
7913 prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
7914 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7915
7916 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
7917 RNA_def_property_float_sdna(prop, nullptr, "m");
7918 RNA_def_property_range(prop, 0.0f, 1.0f);
7919 RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
7920 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7921
7922 prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
7923 RNA_def_property_float_sdna(prop, nullptr, "a");
7924 RNA_def_property_range(prop, 0.0f, 1.0f);
7925 RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
7926 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7927
7928 prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
7929 RNA_def_property_float_sdna(prop, nullptr, "c");
7930 RNA_def_property_range(prop, 0.0f, 1.0f);
7932 prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
7933 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7934}
7935
7936static void def_cmp_lensdist(StructRNA *srna)
7937{
7938 PropertyRNA *prop;
7939
7940 RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
7941
7942 prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
7943 RNA_def_property_boolean_sdna(prop, nullptr, "proj", 1);
7945 prop,
7946 "Projector",
7947 "Enable/disable projector mode (the effect is applied in horizontal direction only)");
7948 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7949
7950 prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
7951 RNA_def_property_boolean_sdna(prop, nullptr, "jit", 1);
7952 RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering (faster, but also noisier)");
7954 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7955
7956 prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
7957 RNA_def_property_boolean_sdna(prop, nullptr, "fit", 1);
7959 prop,
7960 "Fit",
7961 "For positive distortion factor only: scale image such that black areas are not visible");
7962 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7963}
7964
7966{
7967 PropertyRNA *prop;
7968 static float default_1[3] = {1.0f, 1.0f, 1.0f};
7969
7970 static const EnumPropertyItem type_items[] = {
7971 {CMP_NODE_COLOR_BALANCE_LGG, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
7973 "OFFSET_POWER_SLOPE",
7974 0,
7975 "Offset/Power/Slope (ASC-CDL)",
7976 "ASC-CDL standard color correction"},
7978 "WHITEPOINT",
7979 0,
7980 "White Point",
7981 "Chromatic adaption from a different white point"},
7982 {0, nullptr, 0, nullptr, nullptr},
7983 };
7984
7985 prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
7986 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
7987 RNA_def_property_enum_items(prop, type_items);
7988 RNA_def_property_ui_text(prop, "Correction Formula", "");
7989 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7990
7991 RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage");
7992
7993 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
7994 RNA_def_property_float_sdna(prop, nullptr, "lift");
7995 RNA_def_property_array(prop, 3);
7996 RNA_def_property_float_array_default(prop, default_1);
7997 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
7998 RNA_def_property_ui_text(prop, "Lift", "Correction for shadows");
7999 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
8000
8001 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
8002 RNA_def_property_float_sdna(prop, nullptr, "gamma");
8003 RNA_def_property_array(prop, 3);
8004 RNA_def_property_float_array_default(prop, default_1);
8005 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8006 RNA_def_property_ui_text(prop, "Gamma", "Correction for midtones");
8007 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
8008
8009 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
8010 RNA_def_property_float_sdna(prop, nullptr, "gain");
8011 RNA_def_property_array(prop, 3);
8012 RNA_def_property_float_array_default(prop, default_1);
8013 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8014 RNA_def_property_ui_text(prop, "Gain", "Correction for highlights");
8015 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
8016
8017 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
8018 RNA_def_property_float_sdna(prop, nullptr, "offset");
8019 RNA_def_property_array(prop, 3);
8020 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
8021 RNA_def_property_ui_text(prop, "Offset", "Correction for entire tonal range");
8022 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
8023
8024 prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
8025 RNA_def_property_float_sdna(prop, nullptr, "power");
8026 RNA_def_property_array(prop, 3);
8027 RNA_def_property_float_array_default(prop, default_1);
8028 RNA_def_property_range(prop, 0.0f, FLT_MAX);
8029 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8030 RNA_def_property_ui_text(prop, "Power", "Correction for midtones");
8031 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
8032
8033 prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
8034 RNA_def_property_float_sdna(prop, nullptr, "slope");
8035 RNA_def_property_array(prop, 3);
8036 RNA_def_property_float_array_default(prop, default_1);
8037 RNA_def_property_range(prop, 0.0f, FLT_MAX);
8038 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8039 RNA_def_property_ui_text(prop, "Slope", "Correction for highlights");
8040 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
8041
8042 prop = RNA_def_property(srna, "offset_basis", PROP_FLOAT, PROP_NONE);
8044 RNA_def_property_ui_range(prop, -1.0, 1.0, 1.0, 2);
8045 RNA_def_property_ui_text(prop, "Basis", "Support negative color by using this as the RGB basis");
8046 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
8047
8048 prop = RNA_def_property(srna, "input_temperature", PROP_FLOAT, PROP_COLOR_TEMPERATURE);
8049 RNA_def_property_float_sdna(prop, nullptr, "input_temperature");
8050 RNA_def_property_float_default(prop, 6500.0f);
8051 RNA_def_property_range(prop, 1800.0f, 100000.0f);
8052 RNA_def_property_ui_range(prop, 2000.0f, 11000.0f, 100, 0);
8054 prop, "Input Temperature", "Color temperature of the input's white point");
8055 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8056
8057 prop = RNA_def_property(srna, "input_tint", PROP_FLOAT, PROP_FACTOR);
8058 RNA_def_property_float_sdna(prop, nullptr, "input_tint");
8059 RNA_def_property_float_default(prop, 10.0f);
8060 RNA_def_property_range(prop, -500.0f, 500.0f);
8061 RNA_def_property_ui_range(prop, -150.0f, 150.0f, 1, 1);
8063 prop,
8064 "Input Tint",
8065 "Color tint of the input's white point (the default of 10 matches daylight)");
8066 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8067
8068 prop = RNA_def_property(srna, "input_whitepoint", PROP_FLOAT, PROP_COLOR);
8069 RNA_def_property_array(prop, 3);
8071 "rna_NodeColorBalance_input_whitepoint_get",
8072 "rna_NodeColorBalance_input_whitepoint_set",
8073 nullptr);
8075 "Input White Point",
8076 "The color which gets mapped to white "
8077 "(automatically converted to/from temperature and tint)");
8078 RNA_def_property_update(prop, NC_WINDOW, "rna_Node_update");
8079
8080 prop = RNA_def_property(srna, "output_temperature", PROP_FLOAT, PROP_COLOR_TEMPERATURE);
8081 RNA_def_property_float_sdna(prop, nullptr, "output_temperature");
8082 RNA_def_property_float_default(prop, 6500.0f);
8083 RNA_def_property_range(prop, 1800.0f, 100000.0f);
8084 RNA_def_property_ui_range(prop, 2000.0f, 11000.0f, 100, 0);
8086 prop, "Output Temperature", "Color temperature of the output's white point");
8087 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8088
8089 prop = RNA_def_property(srna, "output_tint", PROP_FLOAT, PROP_FACTOR);
8090 RNA_def_property_float_sdna(prop, nullptr, "output_tint");
8091 RNA_def_property_float_default(prop, 10.0f);
8092 RNA_def_property_range(prop, -500.0f, 500.0f);
8093 RNA_def_property_ui_range(prop, -150.0f, 150.0f, 1, 1);
8095 prop,
8096 "Output Tint",
8097 "Color tint of the output's white point (the default of 10 matches daylight)");
8098 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8099
8100 prop = RNA_def_property(srna, "output_whitepoint", PROP_FLOAT, PROP_COLOR);
8101 RNA_def_property_array(prop, 3);
8103 "rna_NodeColorBalance_output_whitepoint_get",
8104 "rna_NodeColorBalance_output_whitepoint_set",
8105 nullptr);
8107 "Output White Point",
8108 "The color which gets white gets mapped to "
8109 "(automatically converted to/from temperature and tint)");
8110 RNA_def_property_update(prop, NC_WINDOW, "rna_Node_update");
8111}
8112
8114{
8115 PropertyRNA *prop;
8116
8117 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
8118 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
8119 RNA_def_property_struct_type(prop, "CurveMapping");
8120 RNA_def_property_ui_text(prop, "Mapping", "");
8121 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8122}
8123
8124static void def_cmp_zcombine(StructRNA *srna)
8125{
8126 PropertyRNA *prop;
8127
8128 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
8129 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 0);
8131 prop, "Use Alpha", "Take alpha channel into account when doing the Z operation");
8132 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8133
8134 prop = RNA_def_property(srna, "use_antialias_z", PROP_BOOLEAN, PROP_NONE);
8135 RNA_def_property_boolean_negative_sdna(prop, nullptr, "custom2", 0);
8137 prop,
8138 "Anti-Alias Z",
8139 "Anti-alias the z-buffer to try to avoid artifacts, mostly useful for Blender renders");
8140 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8141}
8142
8143static void def_cmp_ycc(StructRNA *srna)
8144{
8145 PropertyRNA *prop;
8146
8147 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
8148 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8150 RNA_def_property_ui_text(prop, "Mode", "");
8151 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8152}
8153
8155{
8156 static const EnumPropertyItem mode_items[] = {
8157 {CMP_NODE_COMBSEP_COLOR_RGB, "RGB", ICON_NONE, "RGB", "Use RGB color processing"},
8158 {CMP_NODE_COMBSEP_COLOR_HSV, "HSV", ICON_NONE, "HSV", "Use HSV color processing"},
8159 {CMP_NODE_COMBSEP_COLOR_HSL, "HSL", ICON_NONE, "HSL", "Use HSL color processing"},
8160 {CMP_NODE_COMBSEP_COLOR_YCC, "YCC", ICON_NONE, "YCbCr", "Use YCbCr color processing"},
8161 {CMP_NODE_COMBSEP_COLOR_YUV, "YUV", ICON_NONE, "YUV", "Use YUV color processing"},
8162 {0, nullptr, 0, nullptr, nullptr},
8163 };
8164
8165 PropertyRNA *prop;
8166
8167 RNA_def_struct_sdna_from(srna, "NodeCMPCombSepColor", "storage");
8168
8169 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
8170 RNA_def_property_enum_items(prop, mode_items);
8171 RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
8172 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
8173
8174 prop = RNA_def_property(srna, "ycc_mode", PROP_ENUM, PROP_NONE);
8176 RNA_def_property_ui_text(prop, "Color Space", "Color space used for YCbCrA processing");
8177 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8178}
8179
8181{
8182 PropertyRNA *prop;
8183
8184 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8185 RNA_def_property_pointer_sdna(prop, nullptr, "id");
8186 RNA_def_property_struct_type(prop, "MovieClip");
8189 RNA_def_property_ui_text(prop, "Movie Clip", "");
8190 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
8191
8192 RNA_def_struct_sdna_from(srna, "MovieClipUser", "storage");
8193}
8194
8196{
8197 PropertyRNA *prop;
8198
8199 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8200 RNA_def_property_pointer_sdna(prop, nullptr, "id");
8201 RNA_def_property_struct_type(prop, "MovieClip");
8204 RNA_def_property_ui_text(prop, "Movie Clip", "");
8205 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
8206
8207 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
8208 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8210 RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
8211 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8212
8213 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
8216 prop, "Invert", "Invert stabilization to re-introduce motion to the frame");
8217 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8218}
8219
8221{
8222 PropertyRNA *prop;
8223
8224 static const EnumPropertyItem distortion_type_items[] = {
8225 {0, "UNDISTORT", 0, "Undistort", ""},
8226 {1, "DISTORT", 0, "Distort", ""},
8227 {0, nullptr, 0, nullptr, nullptr},
8228 };
8229
8230 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8231 RNA_def_property_pointer_sdna(prop, nullptr, "id");
8232 RNA_def_property_struct_type(prop, "MovieClip");
8235 RNA_def_property_ui_text(prop, "Movie Clip", "");
8236 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
8237
8238 prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
8239 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8240 RNA_def_property_enum_items(prop, distortion_type_items);
8241 RNA_def_property_ui_text(prop, "Distortion", "Distortion to use to filter image");
8242 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8243}
8244
8245static void def_cmp_mask(StructRNA *srna)
8246{
8247 PropertyRNA *prop;
8248
8249 static const EnumPropertyItem aspect_type_items[] = {
8250 {0, "SCENE", 0, "Scene Size", ""},
8251 {CMP_NODE_MASK_FLAG_SIZE_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
8253 "FIXED_SCENE",
8254 0,
8255 "Fixed/Scene",
8256 "Pixel size scaled by scene percentage"},
8257 {0, nullptr, 0, nullptr, nullptr},
8258 };
8259
8260 prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
8261 RNA_def_property_pointer_sdna(prop, nullptr, "id");
8262 RNA_def_property_struct_type(prop, "Mask");
8265 RNA_def_property_ui_text(prop, "Mask", "");
8266 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
8267
8268 prop = RNA_def_property(srna, "use_feather", PROP_BOOLEAN, PROP_NONE);
8270 RNA_def_property_ui_text(prop, "Feather", "Use feather information from the mask");
8271 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8272
8273 prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
8275 RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
8276 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8277
8278 prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
8279 RNA_def_property_int_sdna(prop, nullptr, "custom2");
8281 RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
8282 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8283
8284 prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
8285 RNA_def_property_float_sdna(prop, nullptr, "custom3");
8286 RNA_def_property_range(prop, 0.0, 1.0f);
8287 RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
8288 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8289
8290 prop = RNA_def_property(srna, "size_source", PROP_ENUM, PROP_NONE);
8291 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "custom1");
8292 RNA_def_property_enum_items(prop, aspect_type_items);
8294 prop, "Size Source", "Where to get the mask size from for aspect/size information");
8295 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8296
8297 RNA_def_struct_sdna_from(srna, "NodeMask", "storage");
8298
8299 prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
8300 RNA_def_property_range(prop, 1.0f, 10000.0f);
8301 RNA_def_property_ui_text(prop, "X", "");
8302 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8303
8304 prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
8305 RNA_def_property_range(prop, 1.0f, 10000.0f);
8306 RNA_def_property_ui_text(prop, "Y", "");
8307 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8308}
8309
8311{
8312 PropertyRNA *prop;
8313
8314 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
8315 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8317 RNA_def_property_ui_text(prop, "Filter", "Method to use to filter transform");
8318 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8319}
8320
8321/* -- Compositor Nodes ------------------------------------------------------ */
8322
8324 {0, "ADD", 0, "Add", ""},
8325 {1, "SUBTRACT", 0, "Subtract", ""},
8326 {2, "MULTIPLY", 0, "Multiply", ""},
8327 {3, "NOT", 0, "Not", ""},
8328 {0, nullptr, 0, nullptr, nullptr},
8329};
8330
8331static void def_cmp_boxmask(StructRNA *srna)
8332{
8333 PropertyRNA *prop;
8334
8335 prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
8336 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8338 RNA_def_property_ui_text(prop, "Mask Type", "");
8339 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8340
8341 RNA_def_struct_sdna_from(srna, "NodeBoxMask", "storage");
8342
8343 prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
8344 RNA_def_property_float_sdna(prop, nullptr, "x");
8346 RNA_def_property_range(prop, -1.0f, 2.0f);
8347 RNA_def_property_ui_text(prop, "X", "X position of the middle of the box");
8348 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8349
8350 prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
8351 RNA_def_property_float_sdna(prop, nullptr, "y");
8353 RNA_def_property_range(prop, -1.0f, 2.0f);
8354 RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the box");
8355 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8356
8357 prop = RNA_def_property(srna, "mask_width", PROP_FLOAT, PROP_NONE);
8358 RNA_def_property_float_sdna(prop, nullptr, "width");
8360 RNA_def_property_range(prop, 0.0f, 2.0f);
8361 RNA_def_property_ui_text(prop, "Width", "Width of the box");
8362 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8363
8364 prop = RNA_def_property(srna, "mask_height", PROP_FLOAT, PROP_NONE);
8365 RNA_def_property_float_sdna(prop, nullptr, "height");
8367 RNA_def_property_range(prop, 0.0f, 2.0f);
8368 RNA_def_property_ui_text(prop, "Height", "Height of the box");
8369 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8370
8371 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
8372 RNA_def_property_float_sdna(prop, nullptr, "rotation");
8374 RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
8375 RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the box");
8376 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8377}
8378
8380{
8381 PropertyRNA *prop;
8382 prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
8383 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8385 RNA_def_property_ui_text(prop, "Mask Type", "");
8386 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8387
8388 RNA_def_struct_sdna_from(srna, "NodeEllipseMask", "storage");
8389
8390 prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
8391 RNA_def_property_float_sdna(prop, nullptr, "x");
8393 RNA_def_property_range(prop, -1.0f, 2.0f);
8394 RNA_def_property_ui_text(prop, "X", "X position of the middle of the ellipse");
8395 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8396
8397 prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
8398 RNA_def_property_float_sdna(prop, nullptr, "y");
8400 RNA_def_property_range(prop, -1.0f, 2.0f);
8401 RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the ellipse");
8402 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8403
8404 prop = RNA_def_property(srna, "mask_width", PROP_FLOAT, PROP_NONE);
8405 RNA_def_property_float_sdna(prop, nullptr, "width");
8407 RNA_def_property_range(prop, 0.0f, 2.0f);
8408 RNA_def_property_ui_text(prop, "Width", "Width of the ellipse");
8409 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8410
8411 prop = RNA_def_property(srna, "mask_height", PROP_FLOAT, PROP_NONE);
8412 RNA_def_property_float_sdna(prop, nullptr, "height");
8414 RNA_def_property_range(prop, 0.0f, 2.0f);
8415 RNA_def_property_ui_text(prop, "Height", "Height of the ellipse");
8416 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8417
8418 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
8419 RNA_def_property_float_sdna(prop, nullptr, "rotation");
8421 RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
8422 RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the ellipse");
8423 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8424}
8425
8427{
8428 PropertyRNA *prop;
8429
8430 /* duplicated in def_cmp_blur */
8431 prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
8434 prop, "Variable Size", "Support variable blur per pixel when using an image for size input");
8435 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8436
8437 prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
8440 prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
8441 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8442
8443# if 0
8444 prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
8445 RNA_def_property_float_sdna(prop, nullptr, "custom3");
8446 RNA_def_property_range(prop, 0.0f, 128.0f);
8448 prop,
8449 "F-Stop",
8450 "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles "
8451 "the blur radius");
8452 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8453# endif
8454
8455 prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
8456 RNA_def_property_float_sdna(prop, nullptr, "custom4");
8457 RNA_def_property_range(prop, 0.0f, 10000.0f);
8458 RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
8459 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8460}
8461
8463{
8464 PropertyRNA *prop;
8465
8466 RNA_def_struct_sdna_from(srna, "NodeBokehImage", "storage");
8467
8468 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
8469 RNA_def_property_float_sdna(prop, nullptr, "angle");
8471 RNA_def_property_range(prop, DEG2RADF(-720.0f), DEG2RADF(720.0f));
8472 RNA_def_property_ui_text(prop, "Angle", "Angle of the bokeh");
8473 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8474
8475 prop = RNA_def_property(srna, "flaps", PROP_INT, PROP_NONE);
8476 RNA_def_property_int_sdna(prop, nullptr, "flaps");
8478 RNA_def_property_range(prop, 3, 24);
8479 RNA_def_property_ui_text(prop, "Flaps", "Number of flaps");
8480 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8481
8482 prop = RNA_def_property(srna, "rounding", PROP_FLOAT, PROP_NONE);
8483 RNA_def_property_float_sdna(prop, nullptr, "rounding");
8485 RNA_def_property_range(prop, -0.0f, 1.0f);
8486 RNA_def_property_ui_text(prop, "Rounding", "Level of rounding of the bokeh");
8487 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8488
8489 prop = RNA_def_property(srna, "catadioptric", PROP_FLOAT, PROP_NONE);
8490 RNA_def_property_float_sdna(prop, nullptr, "catadioptric");
8492 RNA_def_property_range(prop, -0.0f, 1.0f);
8493 RNA_def_property_ui_text(prop, "Catadioptric", "Level of catadioptric of the bokeh");
8494 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8495
8496 prop = RNA_def_property(srna, "shift", PROP_FLOAT, PROP_NONE);
8497 RNA_def_property_float_sdna(prop, nullptr, "lensshift");
8499 RNA_def_property_range(prop, -1.0f, 1.0f);
8500 RNA_def_property_ui_text(prop, "Lens Shift", "Shift of the lens components");
8501 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8502}
8503
8504static void def_cmp_switch(StructRNA *srna)
8505{
8506 PropertyRNA *prop;
8507
8508 prop = RNA_def_property(srna, "check", PROP_BOOLEAN, PROP_NONE);
8509 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 0);
8510 RNA_def_property_ui_text(prop, "Switch", "Off: first socket, On: second socket");
8511 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8512}
8513
8514static void def_cmp_switch_view(StructRNA * /*srna*/) {}
8515
8517{
8518 PropertyRNA *prop;
8519 prop = RNA_def_property(srna, "red", PROP_BOOLEAN, PROP_NONE);
8520 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 1);
8522 RNA_def_property_ui_text(prop, "Red", "Red channel active");
8523 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8524
8525 prop = RNA_def_property(srna, "green", PROP_BOOLEAN, PROP_NONE);
8526 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 2);
8528 RNA_def_property_ui_text(prop, "Green", "Green channel active");
8529 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8530
8531 prop = RNA_def_property(srna, "blue", PROP_BOOLEAN, PROP_NONE);
8532 RNA_def_property_boolean_sdna(prop, nullptr, "custom1", 4);
8534 RNA_def_property_ui_text(prop, "Blue", "Blue channel active");
8535 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8536
8537 RNA_def_struct_sdna_from(srna, "NodeColorCorrection", "storage");
8538
8539 prop = RNA_def_property(srna, "midtones_start", PROP_FLOAT, PROP_NONE);
8540 RNA_def_property_float_sdna(prop, nullptr, "startmidtones");
8542 RNA_def_property_range(prop, 0, 1);
8543 RNA_def_property_ui_text(prop, "Midtones Start", "Start of midtones");
8544 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8545
8546 prop = RNA_def_property(srna, "midtones_end", PROP_FLOAT, PROP_NONE);
8547 RNA_def_property_float_sdna(prop, nullptr, "endmidtones");
8549 RNA_def_property_range(prop, 0, 1);
8550 RNA_def_property_ui_text(prop, "Midtones End", "End of midtones");
8551 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8552
8553 prop = RNA_def_property(srna, "master_saturation", PROP_FLOAT, PROP_NONE);
8554 RNA_def_property_float_sdna(prop, nullptr, "master.saturation");
8556 RNA_def_property_range(prop, 0, 4);
8557 RNA_def_property_ui_text(prop, "Master Saturation", "Master saturation");
8558 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8559
8560 prop = RNA_def_property(srna, "master_contrast", PROP_FLOAT, PROP_NONE);
8561 RNA_def_property_float_sdna(prop, nullptr, "master.contrast");
8563 RNA_def_property_range(prop, 0, 4);
8564 RNA_def_property_ui_text(prop, "Master Contrast", "Master contrast");
8565 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8566
8567 prop = RNA_def_property(srna, "master_gamma", PROP_FLOAT, PROP_NONE);
8568 RNA_def_property_float_sdna(prop, nullptr, "master.gamma");
8570 RNA_def_property_range(prop, 0, 4);
8571 RNA_def_property_ui_text(prop, "Master Gamma", "Master gamma");
8572 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8573
8574 prop = RNA_def_property(srna, "master_gain", PROP_FLOAT, PROP_NONE);
8575 RNA_def_property_float_sdna(prop, nullptr, "master.gain");
8577 RNA_def_property_range(prop, 0, 4);
8578 RNA_def_property_ui_text(prop, "Master Gain", "Master gain");
8579 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8580
8581 prop = RNA_def_property(srna, "master_lift", PROP_FLOAT, PROP_NONE);
8582 RNA_def_property_float_sdna(prop, nullptr, "master.lift");
8584 RNA_def_property_range(prop, -1, 1);
8585 RNA_def_property_ui_text(prop, "Master Lift", "Master lift");
8586 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8587
8588 //
8589 prop = RNA_def_property(srna, "shadows_saturation", PROP_FLOAT, PROP_NONE);
8590 RNA_def_property_float_sdna(prop, nullptr, "shadows.saturation");
8592 RNA_def_property_range(prop, 0, 4);
8593 RNA_def_property_ui_text(prop, "Shadows Saturation", "Shadows saturation");
8594 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8595
8596 prop = RNA_def_property(srna, "shadows_contrast", PROP_FLOAT, PROP_NONE);
8597 RNA_def_property_float_sdna(prop, nullptr, "shadows.contrast");
8599 RNA_def_property_range(prop, 0, 4);
8600 RNA_def_property_ui_text(prop, "Shadows Contrast", "Shadows contrast");
8601 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8602
8603 prop = RNA_def_property(srna, "shadows_gamma", PROP_FLOAT, PROP_NONE);
8604 RNA_def_property_float_sdna(prop, nullptr, "shadows.gamma");
8606 RNA_def_property_range(prop, 0, 4);
8607 RNA_def_property_ui_text(prop, "Shadows Gamma", "Shadows gamma");
8608 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8609
8610 prop = RNA_def_property(srna, "shadows_gain", PROP_FLOAT, PROP_NONE);
8611 RNA_def_property_float_sdna(prop, nullptr, "shadows.gain");
8613 RNA_def_property_range(prop, 0, 4);
8614 RNA_def_property_ui_text(prop, "Shadows Gain", "Shadows gain");
8615 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8616
8617 prop = RNA_def_property(srna, "shadows_lift", PROP_FLOAT, PROP_NONE);
8618 RNA_def_property_float_sdna(prop, nullptr, "shadows.lift");
8620 RNA_def_property_range(prop, -1, 1);
8621 RNA_def_property_ui_text(prop, "Shadows Lift", "Shadows lift");
8622 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8623 //
8624 prop = RNA_def_property(srna, "midtones_saturation", PROP_FLOAT, PROP_NONE);
8625 RNA_def_property_float_sdna(prop, nullptr, "midtones.saturation");
8627 RNA_def_property_range(prop, 0, 4);
8628 RNA_def_property_ui_text(prop, "Midtones Saturation", "Midtones saturation");
8629 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8630
8631 prop = RNA_def_property(srna, "midtones_contrast", PROP_FLOAT, PROP_NONE);
8632 RNA_def_property_float_sdna(prop, nullptr, "midtones.contrast");
8634 RNA_def_property_range(prop, 0, 4);
8635 RNA_def_property_ui_text(prop, "Midtones Contrast", "Midtones contrast");
8636 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8637
8638 prop = RNA_def_property(srna, "midtones_gamma", PROP_FLOAT, PROP_NONE);
8639 RNA_def_property_float_sdna(prop, nullptr, "midtones.gamma");
8641 RNA_def_property_range(prop, 0, 4);
8642 RNA_def_property_ui_text(prop, "Midtones Gamma", "Midtones gamma");
8643 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8644
8645 prop = RNA_def_property(srna, "midtones_gain", PROP_FLOAT, PROP_NONE);
8646 RNA_def_property_float_sdna(prop, nullptr, "midtones.gain");
8648 RNA_def_property_range(prop, 0, 4);
8649 RNA_def_property_ui_text(prop, "Midtones Gain", "Midtones gain");
8650 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8651
8652 prop = RNA_def_property(srna, "midtones_lift", PROP_FLOAT, PROP_NONE);
8653 RNA_def_property_float_sdna(prop, nullptr, "midtones.lift");
8655 RNA_def_property_range(prop, -1, 1);
8656 RNA_def_property_ui_text(prop, "Midtones Lift", "Midtones lift");
8657 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8658 //
8659 prop = RNA_def_property(srna, "highlights_saturation", PROP_FLOAT, PROP_NONE);
8660 RNA_def_property_float_sdna(prop, nullptr, "highlights.saturation");
8662 RNA_def_property_range(prop, 0, 4);
8663 RNA_def_property_ui_text(prop, "Highlights Saturation", "Highlights saturation");
8664 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8665
8666 prop = RNA_def_property(srna, "highlights_contrast", PROP_FLOAT, PROP_NONE);
8667 RNA_def_property_float_sdna(prop, nullptr, "highlights.contrast");
8669 RNA_def_property_range(prop, 0, 4);
8670 RNA_def_property_ui_text(prop, "Highlights Contrast", "Highlights contrast");
8671 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8672
8673 prop = RNA_def_property(srna, "highlights_gamma", PROP_FLOAT, PROP_NONE);
8674 RNA_def_property_float_sdna(prop, nullptr, "highlights.gamma");
8676 RNA_def_property_range(prop, 0, 4);
8677 RNA_def_property_ui_text(prop, "Highlights Gamma", "Highlights gamma");
8678 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8679
8680 prop = RNA_def_property(srna, "highlights_gain", PROP_FLOAT, PROP_NONE);
8681 RNA_def_property_float_sdna(prop, nullptr, "highlights.gain");
8683 RNA_def_property_range(prop, 0, 4);
8684 RNA_def_property_ui_text(prop, "Highlights Gain", "Highlights gain");
8685 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8686
8687 prop = RNA_def_property(srna, "highlights_lift", PROP_FLOAT, PROP_NONE);
8688 RNA_def_property_float_sdna(prop, nullptr, "highlights.lift");
8690 RNA_def_property_range(prop, -1, 1);
8691 RNA_def_property_ui_text(prop, "Highlights Lift", "Highlights lift");
8692 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8693}
8694
8695static void def_cmp_viewer(StructRNA *srna)
8696{
8697 PropertyRNA *prop;
8698
8699 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
8702 prop,
8703 "Use Alpha",
8704 "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
8705 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8706}
8707
8709{
8710 PropertyRNA *prop;
8711
8712 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
8715 prop,
8716 "Use Alpha",
8717 "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
8718 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8719}
8720
8722{
8723 PropertyRNA *prop;
8724
8725 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8726 RNA_def_property_pointer_sdna(prop, nullptr, "id");
8727 RNA_def_property_struct_type(prop, "MovieClip");
8730 RNA_def_property_ui_text(prop, "Movie Clip", "");
8731 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
8732
8733 RNA_def_struct_sdna_from(srna, "NodeKeyingScreenData", "storage");
8734
8735 prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
8736 RNA_def_property_string_sdna(prop, nullptr, "tracking_object");
8737 RNA_def_property_ui_text(prop, "Tracking Object", "");
8738 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8739
8740 prop = RNA_def_property(srna, "smoothness", PROP_FLOAT, PROP_FACTOR);
8741 RNA_def_property_float_sdna(prop, nullptr, "smoothness");
8742 RNA_def_property_range(prop, 0.0f, 1.0f);
8743 RNA_def_property_ui_text(prop, "Smoothness", "");
8744 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8745}
8746
8747static void def_cmp_keying(StructRNA *srna)
8748{
8749 PropertyRNA *prop;
8750
8751 RNA_def_struct_sdna_from(srna, "NodeKeyingData", "storage");
8752
8753 prop = RNA_def_property(srna, "screen_balance", PROP_FLOAT, PROP_FACTOR);
8754 RNA_def_property_float_sdna(prop, nullptr, "screen_balance");
8755 RNA_def_property_range(prop, 0.0f, 1.0f);
8757 prop,
8758 "Screen Balance",
8759 "Balance between two non-primary channels primary channel is comparing against");
8760 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8761
8762 prop = RNA_def_property(srna, "despill_factor", PROP_FLOAT, PROP_FACTOR);
8763 RNA_def_property_float_sdna(prop, nullptr, "despill_factor");
8764 RNA_def_property_range(prop, 0.0f, 1.0f);
8765 RNA_def_property_ui_text(prop, "Despill Factor", "Factor of despilling screen color from image");
8766 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8767
8768 prop = RNA_def_property(srna, "despill_balance", PROP_FLOAT, PROP_FACTOR);
8769 RNA_def_property_float_sdna(prop, nullptr, "despill_balance");
8770 RNA_def_property_range(prop, 0.0f, 1.0f);
8772 prop,
8773 "Despill Balance",
8774 "Balance between non-key colors used to detect amount of key color to be removed");
8775 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8776
8777 prop = RNA_def_property(srna, "clip_black", PROP_FLOAT, PROP_FACTOR);
8778 RNA_def_property_float_sdna(prop, nullptr, "clip_black");
8779 RNA_def_property_range(prop, 0.0f, 1.0f);
8781 prop,
8782 "Clip Black",
8783 "Value of non-scaled matte pixel which considers as fully background pixel");
8784 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8785
8786 prop = RNA_def_property(srna, "clip_white", PROP_FLOAT, PROP_FACTOR);
8787 RNA_def_property_float_sdna(prop, nullptr, "clip_white");
8788 RNA_def_property_range(prop, 0.0f, 1.0f);
8790 prop,
8791 "Clip White",
8792 "Value of non-scaled matte pixel which considers as fully foreground pixel");
8793 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8794
8795 prop = RNA_def_property(srna, "blur_pre", PROP_INT, PROP_NONE);
8796 RNA_def_property_int_sdna(prop, nullptr, "blur_pre");
8797 RNA_def_property_range(prop, 0, 2048);
8799 prop, "Pre Blur", "Chroma pre-blur size which applies before running keyer");
8800 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8801
8802 prop = RNA_def_property(srna, "blur_post", PROP_INT, PROP_NONE);
8803 RNA_def_property_int_sdna(prop, nullptr, "blur_post");
8804 RNA_def_property_range(prop, 0, 2048);
8806 prop, "Post Blur", "Matte blur size which applies after clipping and dilate/eroding");
8807 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8808
8809 prop = RNA_def_property(srna, "dilate_distance", PROP_INT, PROP_NONE);
8810 RNA_def_property_int_sdna(prop, nullptr, "dilate_distance");
8811 RNA_def_property_range(prop, -100, 100);
8812 RNA_def_property_ui_text(prop, "Dilate/Erode", "Distance to grow/shrink the matte");
8813 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8814
8815 prop = RNA_def_property(srna, "edge_kernel_radius", PROP_INT, PROP_NONE);
8816 RNA_def_property_int_sdna(prop, nullptr, "edge_kernel_radius");
8817 RNA_def_property_range(prop, 0, 100);
8819 prop, "Edge Kernel Radius", "Radius of kernel used to detect whether pixel belongs to edge");
8820 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8821
8822 prop = RNA_def_property(srna, "edge_kernel_tolerance", PROP_FLOAT, PROP_FACTOR);
8823 RNA_def_property_float_sdna(prop, nullptr, "edge_kernel_tolerance");
8824 RNA_def_property_range(prop, 0.0f, 1.0f);
8826 prop,
8827 "Edge Kernel Tolerance",
8828 "Tolerance to pixels inside kernel which are treating as belonging to the same plane");
8829 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8830
8831 prop = RNA_def_property(srna, "feather_falloff", PROP_ENUM, PROP_NONE);
8832 RNA_def_property_enum_sdna(prop, nullptr, "feather_falloff");
8834 RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type of the feather");
8836 BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
8837 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8838
8839 prop = RNA_def_property(srna, "feather_distance", PROP_INT, PROP_NONE);
8840 RNA_def_property_int_sdna(prop, nullptr, "feather_distance");
8841 RNA_def_property_range(prop, -100, 100);
8842 RNA_def_property_ui_text(prop, "Feather Distance", "Distance to grow/shrink the feather");
8843 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8844}
8845
8846static void def_cmp_trackpos(StructRNA *srna)
8847{
8848 PropertyRNA *prop;
8849
8850 static const EnumPropertyItem position_items[] = {
8852 "ABSOLUTE",
8853 0,
8854 "Absolute",
8855 "Output absolute position of a marker"},
8857 "RELATIVE_START",
8858 0,
8859 "Relative Start",
8860 "Output position of a marker relative to first marker of a track"},
8862 "RELATIVE_FRAME",
8863 0,
8864 "Relative Frame",
8865 "Output position of a marker relative to marker at given frame number"},
8867 "ABSOLUTE_FRAME",
8868 0,
8869 "Absolute Frame",
8870 "Output absolute position of a marker at given frame number"},
8871 {0, nullptr, 0, nullptr, nullptr},
8872 };
8873
8874 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8875 RNA_def_property_pointer_sdna(prop, nullptr, "id");
8876 RNA_def_property_struct_type(prop, "MovieClip");
8879 RNA_def_property_ui_text(prop, "Movie Clip", "");
8880 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
8881
8882 prop = RNA_def_property(srna, "position", PROP_ENUM, PROP_NONE);
8883 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
8884 RNA_def_property_enum_items(prop, position_items);
8885 RNA_def_property_ui_text(prop, "Position", "Which marker position to use for output");
8886 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8887
8888 prop = RNA_def_property(srna, "frame_relative", PROP_INT, PROP_NONE);
8889 RNA_def_property_int_sdna(prop, nullptr, "custom2");
8890 RNA_def_property_ui_text(prop, "Frame", "Frame to be used for relative position");
8891 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8892
8893 RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
8894
8895 prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
8896 RNA_def_property_string_sdna(prop, nullptr, "tracking_object");
8897 RNA_def_property_ui_text(prop, "Tracking Object", "");
8898 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8899
8900 prop = RNA_def_property(srna, "track_name", PROP_STRING, PROP_NONE);
8901 RNA_def_property_string_sdna(prop, nullptr, "track_name");
8902 RNA_def_property_ui_text(prop, "Track", "");
8904 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8905}
8906
8907static void def_cmp_pixelate(StructRNA *srna)
8908{
8909 PropertyRNA *prop;
8910
8911 /* The range of the pixel size is chosen so that it is positive and above zero, and also does not
8912 * exceed the underlying int16_t type. The size limit matches the maximum size used by blur
8913 * nodes. */
8914 prop = RNA_def_property(srna, "pixel_size", PROP_INT, PROP_NONE);
8915 RNA_def_property_int_sdna(prop, nullptr, "custom1");
8916 RNA_def_property_range(prop, 1, 2048);
8918 RNA_def_property_ui_text(prop, "Pixel Size", "Pixel size of the output image");
8919 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8920}
8921
8923{
8924 static const EnumPropertyItem translate_items[] = {
8925 {CMP_NODE_WRAP_NONE, "NONE", 0, "None", "No wrapping on X and Y"},
8926 {CMP_NODE_WRAP_X, "XAXIS", 0, "X Axis", "Wrap all pixels on the X axis"},
8927 {CMP_NODE_WRAP_Y, "YAXIS", 0, "Y Axis", "Wrap all pixels on the Y axis"},
8928 {CMP_NODE_WRAP_XY, "BOTH", 0, "Both Axes", "Wrap all pixels on both axes"},
8929 {0, nullptr, 0, nullptr, nullptr},
8930 };
8931
8932 static const EnumPropertyItem interpolation_items[] = {
8933 {CMP_NODE_INTERPOLATION_NEAREST, "Nearest", 0, "Nearest", "Use nearest interpolation"},
8934 {CMP_NODE_INTERPOLATION_BILINEAR, "Bilinear", 0, "Bilinear", "Use bilinear interpolation"},
8935 {CMP_NODE_INTERPOLATION_BICUBIC, "Bicubic", 0, "Bicubic", "Use bicubic interpolation"},
8936 {0, nullptr, 0, nullptr, nullptr},
8937 };
8938
8939 PropertyRNA *prop;
8940
8941 RNA_def_struct_sdna_from(srna, "NodeTranslateData", "storage");
8942
8943 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
8944 RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
8945 RNA_def_property_enum_items(prop, interpolation_items);
8946 RNA_def_property_ui_text(prop, "", "");
8947 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8948
8949 prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
8950 RNA_def_property_boolean_sdna(prop, nullptr, "relative", 1);
8952 prop,
8953 "Relative",
8954 "Use relative (fraction of input image size) values to define translation");
8955 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8956
8957 prop = RNA_def_property(srna, "wrap_axis", PROP_ENUM, PROP_NONE);
8958 RNA_def_property_enum_sdna(prop, nullptr, "wrap_axis");
8959 RNA_def_property_enum_items(prop, translate_items);
8960 RNA_def_property_ui_text(prop, "Wrapping", "Wrap image on a specific axis");
8961 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8962}
8963
8965{
8966 PropertyRNA *prop;
8967
8968 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8969 RNA_def_property_pointer_sdna(prop, nullptr, "id");
8970 RNA_def_property_struct_type(prop, "MovieClip");
8973 RNA_def_property_ui_text(prop, "Movie Clip", "");
8974 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
8975
8976 RNA_def_struct_sdna_from(srna, "NodePlaneTrackDeformData", "storage");
8977
8978 prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
8979 RNA_def_property_string_sdna(prop, nullptr, "tracking_object");
8980 RNA_def_property_ui_text(prop, "Tracking Object", "");
8981 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8982
8983 prop = RNA_def_property(srna, "plane_track_name", PROP_STRING, PROP_NONE);
8984 RNA_def_property_string_sdna(prop, nullptr, "plane_track_name");
8985 RNA_def_property_ui_text(prop, "Plane Track", "");
8986 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8987
8988 prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
8990 prop, nullptr, "flag", CMP_NODE_PLANE_TRACK_DEFORM_FLAG_MOTION_BLUR);
8991 RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
8992 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8993
8994 prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
8996 RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
8997 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8998
8999 prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
9000 RNA_def_property_range(prop, 0.0, 1.0f);
9001 RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
9002 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9003}
9004
9005static void def_cmp_sunbeams(StructRNA *srna)
9006{
9007 PropertyRNA *prop;
9008
9009 RNA_def_struct_sdna_from(srna, "NodeSunBeams", "storage");
9010
9011 prop = RNA_def_property(srna, "source", PROP_FLOAT, PROP_NONE);
9012 RNA_def_property_float_sdna(prop, nullptr, "source");
9013 RNA_def_property_range(prop, -100.0f, 100.0f);
9014 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
9016 prop, "Source", "Source point of rays as a factor of the image width and height");
9017 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9018
9019 prop = RNA_def_property(srna, "ray_length", PROP_FLOAT, PROP_UNSIGNED);
9020 RNA_def_property_float_sdna(prop, nullptr, "ray_length");
9021 RNA_def_property_range(prop, 0.0f, 100.0f);
9022 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 3);
9023 RNA_def_property_ui_text(prop, "Ray Length", "Length of rays as a factor of the image size");
9024 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9025}
9026
9028{
9029 StructRNA *srna;
9030 PropertyRNA *prop;
9031
9032 srna = RNA_def_struct(brna, "CryptomatteEntry", nullptr);
9033 RNA_def_struct_sdna(srna, "CryptomatteEntry");
9034
9035 prop = RNA_def_property(srna, "encoded_hash", PROP_FLOAT, PROP_NONE);
9037 RNA_def_property_float_sdna(prop, nullptr, "encoded_hash");
9038
9039 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
9041 RNA_def_property_ui_text(prop, "Name", "");
9042 RNA_def_struct_name_property(srna, prop);
9043}
9044
9046{
9047 PropertyRNA *prop;
9048 static float default_1[3] = {1.0f, 1.0f, 1.0f};
9049
9050 prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE);
9052 "rna_NodeCryptomatte_matte_get",
9053 "rna_NodeCryptomatte_matte_length",
9054 "rna_NodeCryptomatte_matte_set");
9056 prop, "Matte Objects", "List of object and material crypto IDs to include in matte");
9057 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9058
9059 prop = RNA_def_property(srna, "add", PROP_FLOAT, PROP_COLOR);
9060 RNA_def_property_float_sdna(prop, nullptr, "runtime.add");
9061 RNA_def_property_float_array_default(prop, default_1);
9064 prop, "Add", "Add object or material to matte, by picking a color from the Pick output");
9066 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_add");
9067
9068 prop = RNA_def_property(srna, "remove", PROP_FLOAT, PROP_COLOR);
9069 RNA_def_property_float_sdna(prop, nullptr, "runtime.remove");
9070 RNA_def_property_float_array_default(prop, default_1);
9073 prop,
9074 "Remove",
9075 "Remove object or material from matte, by picking a color from the Pick output");
9077 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_remove");
9078}
9079
9081{
9082 RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
9084}
9085
9087{
9088 PropertyRNA *prop;
9089
9090 static const EnumPropertyItem cryptomatte_source_items[] = {
9092 "RENDER",
9093 0,
9094 "Render",
9095 "Use Cryptomatte passes from a render"},
9097 "IMAGE",
9098 0,
9099 "Image",
9100 "Use Cryptomatte passes from an image"},
9101 {0, nullptr, 0, nullptr, nullptr}};
9102
9103 prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
9104 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9105 RNA_def_property_enum_items(prop, cryptomatte_source_items);
9106 RNA_def_property_enum_funcs(prop, nullptr, "rna_NodeCryptomatte_source_set", nullptr);
9107 RNA_def_property_ui_text(prop, "Source", "Where the Cryptomatte passes are loaded from");
9108 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9109
9110 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
9112 prop, "rna_NodeCryptomatte_scene_get", "rna_NodeCryptomatte_scene_set", nullptr, nullptr);
9113 RNA_def_property_struct_type(prop, "Scene");
9116 RNA_def_property_ui_text(prop, "Scene", "");
9117 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9118
9119 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
9121 "rna_NodeCryptomatte_image_get",
9122 "rna_NodeCryptomatte_image_set",
9123 nullptr,
9124 "rna_NodeCryptomatte_image_poll");
9125 RNA_def_property_struct_type(prop, "Image");
9128 RNA_def_property_ui_text(prop, "Image", "");
9129 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9130
9131 RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
9133
9134 prop = RNA_def_property(srna, "layer_name", PROP_ENUM, PROP_NONE);
9137 "rna_NodeCryptomatte_layer_name_get",
9138 "rna_NodeCryptomatte_layer_name_set",
9139 "rna_NodeCryptomatte_layer_name_itemf");
9140 RNA_def_property_ui_text(prop, "Cryptomatte Layer", "What Cryptomatte layer is used");
9141 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9142
9143 prop = RNA_def_property(srna, "entries", PROP_COLLECTION, PROP_NONE);
9144 RNA_def_property_collection_sdna(prop, nullptr, "entries", nullptr);
9145 RNA_def_property_struct_type(prop, "CryptomatteEntry");
9146 RNA_def_property_ui_text(prop, "Mattes", "");
9148
9149 /* Included here instead of defining image_user as a property of the node,
9150 * see def_cmp_image for details.
9151 * As mentioned in DNA_node_types.h, iuser is the first member of the Cryptomatte
9152 * storage type, so we can cast node->storage to ImageUser.
9153 * That is required since we can't define the properties from storage->iuser directly... */
9154 RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
9155 def_node_image_user(srna);
9156}
9157
9158static void def_cmp_denoise(StructRNA *srna)
9159{
9160 PropertyRNA *prop;
9161
9162 static const EnumPropertyItem prefilter_items[] = {
9164 "NONE",
9165 0,
9166 "None",
9167 "No prefiltering, use when guiding passes are noise-free"},
9169 "FAST",
9170 0,
9171 "Fast",
9172 "Denoise image and guiding passes together. Improves quality when guiding passes are noisy "
9173 "using least amount of extra processing time."},
9175 "ACCURATE",
9176 0,
9177 "Accurate",
9178 "Prefilter noisy guiding passes before denoising image. Improves quality when guiding "
9179 "passes are noisy using extra processing time."},
9180 {0, nullptr, 0, nullptr, nullptr}};
9181
9182 RNA_def_struct_sdna_from(srna, "NodeDenoise", "storage");
9183
9184 prop = RNA_def_property(srna, "use_hdr", PROP_BOOLEAN, PROP_NONE);
9185 RNA_def_property_boolean_sdna(prop, nullptr, "hdr", 0);
9187 RNA_def_property_ui_text(prop, "HDR", "Process HDR images");
9188 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9189
9190 prop = RNA_def_property(srna, "prefilter", PROP_ENUM, PROP_NONE);
9191 RNA_def_property_enum_items(prop, prefilter_items);
9193 RNA_def_property_ui_text(prop, "", "Denoising prefilter");
9194 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9195}
9196
9197static void def_cmp_kuwahara(StructRNA *srna)
9198{
9199 PropertyRNA *prop;
9200
9201 RNA_def_struct_sdna_from(srna, "NodeKuwaharaData", "storage");
9202
9203 static const EnumPropertyItem variation_items[] = {
9204 {0, "CLASSIC", 0, "Classic", "Fast but less accurate variation"},
9205 {1, "ANISOTROPIC", 0, "Anisotropic", "Accurate but slower variation"},
9206 {0, nullptr, 0, nullptr, nullptr},
9207 };
9208
9209 prop = RNA_def_property(srna, "variation", PROP_ENUM, PROP_NONE);
9210 RNA_def_property_enum_sdna(prop, nullptr, "variation");
9211 RNA_def_property_enum_items(prop, variation_items);
9212 RNA_def_property_ui_text(prop, "", "Variation of Kuwahara filter to use");
9213 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9214
9215 prop = RNA_def_property(srna, "use_high_precision", PROP_BOOLEAN, PROP_NONE);
9216 RNA_def_property_boolean_sdna(prop, nullptr, "high_precision", 1);
9218 prop,
9219 "High Precision",
9220 "Uses a more precise but slower method. Use if the output contains undesirable noise.");
9221 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9222
9223 prop = RNA_def_property(srna, "uniformity", PROP_INT, PROP_NONE);
9224 RNA_def_property_int_sdna(prop, nullptr, "uniformity");
9225 RNA_def_property_range(prop, 0.0, 50.0);
9226 RNA_def_property_ui_range(prop, 0, 50, 1, -1);
9228 "Uniformity",
9229 "Controls the uniformity of the direction of the filter. Higher values "
9230 "produces more uniform directions.");
9231 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9232
9233 prop = RNA_def_property(srna, "sharpness", PROP_FLOAT, PROP_FACTOR);
9234 RNA_def_property_float_sdna(prop, nullptr, "sharpness");
9235 RNA_def_property_range(prop, 0.0f, 1.0f);
9236 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
9238 "Sharpness",
9239 "Controls the sharpness of the filter. 0 means completely smooth while "
9240 "1 means completely sharp.");
9241 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9242
9243 prop = RNA_def_property(srna, "eccentricity", PROP_FLOAT, PROP_FACTOR);
9244 RNA_def_property_float_sdna(prop, nullptr, "eccentricity");
9245 RNA_def_property_range(prop, 0.0f, 2.0f);
9246 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.1, 3);
9248 prop,
9249 "Eccentricity",
9250 "Controls how directional the filter is. 0 means the filter is completely omnidirectional "
9251 "while 2 means it is maximally directed along the edges of the image.");
9252 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9253}
9254
9256{
9257 PropertyRNA *prop;
9258
9259 RNA_def_struct_sdna_from(srna, "NodeAntiAliasingData", "storage");
9260
9261 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
9262 RNA_def_property_float_sdna(prop, nullptr, "threshold");
9263 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
9265 prop,
9266 "Threshold",
9267 "Threshold to detect edges (smaller threshold makes more sensitive detection)");
9268 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9269
9270 prop = RNA_def_property(srna, "contrast_limit", PROP_FLOAT, PROP_FACTOR);
9271 RNA_def_property_float_sdna(prop, nullptr, "contrast_limit");
9272 RNA_def_property_range(prop, 0.0f, 1.0f);
9273 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
9275 prop,
9276 "Contrast Limit",
9277 "How much to eliminate spurious edges to avoid artifacts (the larger value makes less "
9278 "active; the value 2.0, for example, means discard a detected edge if there is a "
9279 "neighboring edge that has 2.0 times bigger contrast than the current one)");
9280 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9281
9282 prop = RNA_def_property(srna, "corner_rounding", PROP_FLOAT, PROP_FACTOR);
9283 RNA_def_property_float_sdna(prop, nullptr, "corner_rounding");
9284 RNA_def_property_range(prop, 0.0f, 1.0f);
9285 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
9286 RNA_def_property_ui_text(prop, "Corner Rounding", "How much sharp corners will be rounded");
9287 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9288}
9289
9290/* -- Texture Nodes --------------------------------------------------------- */
9291
9292static void def_tex_output(StructRNA *srna)
9293{
9294 PropertyRNA *prop;
9295
9296 RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage");
9297
9298 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
9299 RNA_def_property_string_sdna(prop, nullptr, "name");
9300 RNA_def_property_ui_text(prop, "Output Name", "");
9301 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9302}
9303
9304static void def_tex_image(StructRNA *srna)
9305{
9306 PropertyRNA *prop;
9307
9308 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
9309 RNA_def_property_pointer_sdna(prop, nullptr, "id");
9310 RNA_def_property_struct_type(prop, "Image");
9313 RNA_def_property_ui_text(prop, "Image", "");
9314 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9315
9316 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
9317 RNA_def_property_pointer_sdna(prop, nullptr, "storage");
9318 RNA_def_property_struct_type(prop, "ImageUser");
9320 prop, "Image User", "Parameters defining the image duration, offset and related settings");
9321 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9322}
9323
9324static void def_tex_bricks(StructRNA *srna)
9325{
9326 PropertyRNA *prop;
9327
9328 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
9329 RNA_def_property_float_sdna(prop, nullptr, "custom3");
9330 RNA_def_property_range(prop, 0.0f, 1.0f);
9332 prop, "Offset Amount", "Determines the brick offset of the various rows");
9333 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9334
9335 prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
9336 RNA_def_property_int_sdna(prop, nullptr, "custom1");
9337 RNA_def_property_range(prop, 2, 99);
9338 RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
9339 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9340
9341 prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
9342 RNA_def_property_float_sdna(prop, nullptr, "custom4");
9343 RNA_def_property_range(prop, 0.0f, 99.0f);
9345 prop,
9346 "Squash Amount",
9347 "Factor to adjust the brick's width for particular rows determined by the Offset Frequency");
9348
9349 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9350
9351 prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
9352 RNA_def_property_int_sdna(prop, nullptr, "custom2");
9353 RNA_def_property_range(prop, 2, 99);
9354 RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
9355 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9356}
9357
9358/* -- Geometry Nodes --------------------------------------------------------- */
9359
9361{
9362 static EnumPropertyItem mode_items[] = {
9364 "FACTOR",
9365 0,
9366 "Factor",
9367 "Find sample positions on the curve using a factor of its total length"},
9369 "LENGTH",
9370 0,
9371 "Length",
9372 "Find sample positions on the curve using a distance from its beginning"},
9373 {0, nullptr, 0, nullptr, nullptr},
9374 };
9375
9376 RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSample", "storage");
9377
9378 PropertyRNA *prop;
9379 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9380 RNA_def_property_enum_items(prop, mode_items);
9381 RNA_def_property_ui_text(prop, "Mode", "Method for sampling input");
9383 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9384
9385 prop = RNA_def_property(srna, "use_all_curves", PROP_BOOLEAN, PROP_NONE);
9387 "All Curves",
9388 "Sample lengths based on the total length of all curves, rather than "
9389 "using a length inside each selected curve");
9391 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9392
9393 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
9396 prop, nullptr, nullptr, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
9398 RNA_def_property_ui_text(prop, "Data Type", "");
9400 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9401}
9402
9404{
9405 PropertyRNA *prop;
9406
9407 RNA_def_struct_sdna_from(srna, "NodeRandomValue", "storage");
9408
9409 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
9410 RNA_def_property_enum_sdna(prop, nullptr, "data_type");
9412 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_FunctionNodeRandomValue_type_itemf");
9414 RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
9415 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9416}
9417
9419{
9420 PropertyRNA *prop;
9421
9422 static const EnumPropertyItem rna_node_geometry_distribute_points_on_faces_mode_items[] = {
9424 "RANDOM",
9425 0,
9426 "Random",
9427 "Distribute points randomly on the surface"},
9429 "POISSON",
9430 0,
9431 "Poisson Disk",
9432 "Distribute the points randomly on the surface while taking a minimum distance between "
9433 "points into account"},
9434 {0, nullptr, 0, nullptr, nullptr},
9435 };
9436
9437 prop = RNA_def_property(srna, "distribute_method", PROP_ENUM, PROP_NONE);
9438 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
9439 RNA_def_property_enum_items(prop, rna_node_geometry_distribute_points_on_faces_mode_items);
9441 RNA_def_property_ui_text(prop, "Distribution Method", "Method to use for scattering points");
9443 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9444
9445 prop = RNA_def_property(srna, "use_legacy_normal", PROP_BOOLEAN, PROP_NONE);
9446 RNA_def_property_boolean_sdna(prop, nullptr, "custom2", 1);
9448 "Legacy Normal",
9449 "Output the normal and rotation values that have been output "
9450 "before the node started taking smooth normals into account");
9452 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9453}
9454
9456{
9457 PropertyRNA *prop;
9458
9459 RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSetHandles", "storage");
9460
9461 prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
9462 RNA_def_property_enum_sdna(prop, nullptr, "handle_type");
9463 RNA_def_property_ui_text(prop, "Handle Type", "");
9466 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9467
9468 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9470 RNA_def_property_ui_text(prop, "Mode", "Whether to update left and right handles");
9473 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9474}
9475
9477{
9478 PropertyRNA *prop;
9479 FunctionRNA *func;
9480 PropertyRNA *parm;
9481
9482 prop = RNA_def_property(srna, "paired_output", PROP_POINTER, PROP_NONE);
9483 RNA_def_property_struct_type(prop, "Node");
9485 RNA_def_property_pointer_funcs(prop, "rna_Node_paired_output_get", nullptr, nullptr, nullptr);
9487 prop, "Paired Output", "Zone output node that this input node is paired with");
9488
9489 func = RNA_def_function(srna, "pair_with_output", "rna_Node_pair_with_output");
9490 RNA_def_function_ui_description(func, "Pair a zone input node with an output node.");
9492 parm = RNA_def_pointer(
9493 func, "output_node", "GeometryNode", "Output Node", "Zone output node to pair with");
9495 /* return value */
9496 parm = RNA_def_boolean(
9497 func, "result", false, "Result", "True if pairing the node was successful");
9498 RNA_def_function_return(func, parm);
9499}
9500
9502{
9503 RNA_def_struct_sdna_from(srna, "NodeGeometrySimulationInput", "storage");
9504
9506}
9507
9509{
9510 RNA_def_struct_sdna_from(srna, "NodeGeometryRepeatInput", "storage");
9511
9513}
9514
9516{
9517 RNA_def_struct_sdna_from(srna, "NodeGeometryForeachGeometryElementInput", "storage");
9518
9520}
9521
9523 const char *accessor,
9524 const bool add_socket_type)
9525{
9526 static blender::LinearAllocator<> allocator;
9527 PropertyRNA *prop;
9528
9529 char name_set_func[128];
9530 SNPRINTF(name_set_func, "rna_Node_ItemArray_item_name_set<%s>", accessor);
9531
9532 char item_update_func[128];
9533 SNPRINTF(item_update_func, "rna_Node_ItemArray_item_update<%s>", accessor);
9534 const char *item_update_func_ptr = allocator.copy_string(item_update_func).c_str();
9535
9536 char socket_type_itemf[128];
9537 SNPRINTF(socket_type_itemf, "rna_Node_ItemArray_socket_type_itemf<%s>", accessor);
9538
9539 char color_get_func[128];
9540 SNPRINTF(color_get_func, "rna_Node_ItemArray_item_color_get<%s>", accessor);
9541
9542 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
9544 prop, nullptr, nullptr, allocator.copy_string(name_set_func).c_str());
9545 RNA_def_property_ui_text(prop, "Name", "");
9546 RNA_def_struct_name_property(srna, prop);
9547 RNA_def_property_update(prop, NC_NODE | NA_EDITED, item_update_func_ptr);
9548
9549 if (add_socket_type) {
9550 prop = RNA_def_property(srna, "socket_type", PROP_ENUM, PROP_NONE);
9553 prop, nullptr, nullptr, allocator.copy_string(socket_type_itemf).c_str());
9554 RNA_def_property_ui_text(prop, "Socket Type", "");
9556 RNA_def_property_update(prop, NC_NODE | NA_EDITED, item_update_func_ptr);
9557 }
9558
9559 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
9560 RNA_def_property_array(prop, 4);
9562 prop, allocator.copy_string(color_get_func).c_str(), nullptr, nullptr);
9565 prop, "Color", "Color of the corresponding socket type in the node editor");
9566}
9567
9569 const char *item_name,
9570 const char *accessor_name)
9571{
9572 static blender::LinearAllocator<> allocator;
9573 PropertyRNA *parm;
9574 FunctionRNA *func;
9575
9576 char remove_call[128];
9577 SNPRINTF(remove_call, "rna_Node_ItemArray_remove<%s>", accessor_name);
9578 char clear_call[128];
9579 SNPRINTF(clear_call, "rna_Node_ItemArray_clear<%s>", accessor_name);
9580 char move_call[128];
9581 SNPRINTF(move_call, "rna_Node_ItemArray_move<%s>", accessor_name);
9582
9583 func = RNA_def_function(srna, "remove", allocator.copy_string(remove_call).c_str());
9584 RNA_def_function_ui_description(func, "Remove an item");
9586 parm = RNA_def_pointer(func, "item", item_name, "Item", "The item to remove");
9588
9589 func = RNA_def_function(srna, "clear", allocator.copy_string(clear_call).c_str());
9590 RNA_def_function_ui_description(func, "Remove all items");
9592
9593 func = RNA_def_function(srna, "move", allocator.copy_string(move_call).c_str());
9594 RNA_def_function_ui_description(func, "Move an item to another position");
9596 parm = RNA_def_int(
9597 func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the item to move", 0, 10000);
9599 parm = RNA_def_int(
9600 func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the item", 0, 10000);
9602}
9603
9605 const char *item_name,
9606 const char *accessor_name)
9607{
9608 static blender::LinearAllocator<> allocator;
9609 PropertyRNA *parm;
9610 FunctionRNA *func;
9611
9612 char name[128];
9613 SNPRINTF(name, "rna_Node_ItemArray_new_with_socket_and_name<%s>", accessor_name);
9614
9615 func = RNA_def_function(srna, "new", allocator.copy_string(name).c_str());
9616 RNA_def_function_ui_description(func, "Add an item at the end");
9618 parm = RNA_def_enum(func,
9619 "socket_type",
9622 "Socket Type",
9623 "Socket type of the item");
9625 parm = RNA_def_string(func, "name", nullptr, MAX_NAME, "Name", "");
9627 /* return value */
9628 parm = RNA_def_pointer(func, "item", item_name, "Item", "New item");
9629 RNA_def_function_return(func, parm);
9630}
9631
9633{
9634 PropertyRNA *prop;
9635
9636 StructRNA *srna = RNA_def_struct(brna, "SimulationStateItem", nullptr);
9637 RNA_def_struct_ui_text(srna, "Simulation Item", "");
9638 RNA_def_struct_sdna(srna, "NodeSimulationItem");
9639
9640 rna_def_node_item_array_socket_item_common(srna, "SimulationItemsAccessor", true);
9641
9642 prop = RNA_def_property(srna, "attribute_domain", PROP_ENUM, PROP_NONE);
9645 prop, nullptr, nullptr, "rna_GeometryNodeAttributeDomain_attribute_domain_itemf");
9647 prop,
9648 "Attribute Domain",
9649 "Attribute domain where the attribute is stored in the simulation state");
9652 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<SimulationItemsAccessor>");
9653}
9654
9656{
9657 StructRNA *srna;
9658
9659 srna = RNA_def_struct(brna, "NodeGeometrySimulationOutputItems", nullptr);
9660 RNA_def_struct_sdna(srna, "bNode");
9661 RNA_def_struct_ui_text(srna, "Items", "Collection of simulation items");
9662
9664 srna, "SimulationStateItem", "SimulationItemsAccessor");
9665 rna_def_node_item_array_common_functions(srna, "SimulationStateItem", "SimulationItemsAccessor");
9666}
9667
9669{
9670 PropertyRNA *prop;
9671
9672 RNA_def_struct_sdna_from(srna, "NodeGeometrySimulationOutput", "storage");
9673
9674 prop = RNA_def_property(srna, "state_items", PROP_COLLECTION, PROP_NONE);
9675 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
9676 RNA_def_property_struct_type(prop, "SimulationStateItem");
9677 RNA_def_property_ui_text(prop, "Items", "");
9678 RNA_def_property_srna(prop, "NodeGeometrySimulationOutputItems");
9679
9680 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
9681 RNA_def_property_int_sdna(prop, nullptr, "active_index");
9682 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
9685 RNA_def_property_update(prop, NC_NODE, nullptr);
9686
9687 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
9688 RNA_def_property_struct_type(prop, "SimulationStateItem");
9690 "rna_Node_ItemArray_active_get<SimulationItemsAccessor>",
9691 "rna_Node_ItemArray_active_set<SimulationItemsAccessor>",
9692 nullptr,
9693 nullptr);
9695 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
9696 RNA_def_property_update(prop, NC_NODE, nullptr);
9697}
9698
9700{
9701 StructRNA *srna = RNA_def_struct(brna, "RepeatItem", nullptr);
9702 RNA_def_struct_ui_text(srna, "Repeat Item", "");
9703 RNA_def_struct_sdna(srna, "NodeRepeatItem");
9704
9705 rna_def_node_item_array_socket_item_common(srna, "RepeatItemsAccessor", true);
9706}
9707
9709{
9710 StructRNA *srna;
9711
9712 srna = RNA_def_struct(brna, "NodeGeometryRepeatOutputItems", nullptr);
9713 RNA_def_struct_sdna(srna, "bNode");
9714 RNA_def_struct_ui_text(srna, "Items", "Collection of repeat items");
9715
9716 rna_def_node_item_array_new_with_socket_and_name(srna, "RepeatItem", "RepeatItemsAccessor");
9717 rna_def_node_item_array_common_functions(srna, "RepeatItem", "RepeatItemsAccessor");
9718}
9719
9721{
9722 PropertyRNA *prop;
9723
9724 RNA_def_struct_sdna_from(srna, "NodeGeometryRepeatOutput", "storage");
9725
9726 prop = RNA_def_property(srna, "repeat_items", PROP_COLLECTION, PROP_NONE);
9727 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
9728 RNA_def_property_struct_type(prop, "RepeatItem");
9729 RNA_def_property_ui_text(prop, "Items", "");
9730 RNA_def_property_srna(prop, "NodeGeometryRepeatOutputItems");
9731
9732 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
9733 RNA_def_property_int_sdna(prop, nullptr, "active_index");
9734 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
9737 RNA_def_property_update(prop, NC_NODE, nullptr);
9738
9739 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
9740 RNA_def_property_struct_type(prop, "RepeatItem");
9742 "rna_Node_ItemArray_active_get<RepeatItemsAccessor>",
9743 "rna_Node_ItemArray_active_set<RepeatItemsAccessor>",
9744 nullptr,
9745 nullptr);
9747 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
9748 RNA_def_property_update(prop, NC_NODE, nullptr);
9749
9750 prop = RNA_def_property(srna, "inspection_index", PROP_INT, PROP_NONE);
9751 RNA_def_property_ui_range(prop, 0, INT32_MAX, 1, -1);
9753 "Inspection Index",
9754 "Iteration index that is used by inspection features like the viewer "
9755 "node or socket inspection");
9756 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
9757}
9758
9760{
9761 StructRNA *srna = RNA_def_struct(brna, "ForeachGeometryElementInputItem", nullptr);
9762 RNA_def_struct_ui_text(srna, "For Each Geometry Element Item", "");
9763 RNA_def_struct_sdna(srna, "NodeForeachGeometryElementInputItem");
9764
9766 srna, "ForeachGeometryElementInputItemsAccessor", true);
9767}
9768
9770{
9771 StructRNA *srna;
9772
9773 srna = RNA_def_struct(brna, "NodeGeometryForeachGeometryElementInputItems", nullptr);
9774 RNA_def_struct_sdna(srna, "bNode");
9775 RNA_def_struct_ui_text(srna, "Input Items", "Collection of input items");
9776
9778 srna, "ForeachGeometryElementInputItem", "ForeachGeometryElementInputItemsAccessor");
9780 srna, "ForeachGeometryElementInputItem", "ForeachGeometryElementInputItemsAccessor");
9781}
9782
9784{
9785 StructRNA *srna;
9786
9787 srna = RNA_def_struct(brna, "ForeachGeometryElementMainItem", nullptr);
9788 RNA_def_struct_ui_text(srna, "For Each Geometry Element Item", "");
9789 RNA_def_struct_sdna(srna, "NodeForeachGeometryElementMainItem");
9790
9792 srna, "ForeachGeometryElementMainItemsAccessor", true);
9793}
9794
9796{
9797 StructRNA *srna;
9798
9799 srna = RNA_def_struct(brna, "NodeGeometryForeachGeometryElementMainItems", nullptr);
9800 RNA_def_struct_sdna(srna, "bNode");
9801 RNA_def_struct_ui_text(srna, "Main Items", "Collection of main items");
9802
9804 srna, "ForeachGeometryElementMainItem", "ForeachGeometryElementMainItemsAccessor");
9806 srna, "ForeachGeometryElementMainItem", "ForeachGeometryElementMainItemsAccessor");
9807}
9808
9810{
9811 StructRNA *srna;
9812 PropertyRNA *prop;
9813
9814 srna = RNA_def_struct(brna, "ForeachGeometryElementGenerationItem", nullptr);
9815 RNA_def_struct_ui_text(srna, "For Each Geometry Element Item", "");
9816 RNA_def_struct_sdna(srna, "NodeForeachGeometryElementGenerationItem");
9817
9819 srna, "ForeachGeometryElementGenerationItemsAccessor", true);
9820
9821 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
9822 RNA_def_property_ui_text(prop, "Domain", "Domain that the field is evaluated on");
9825 prop,
9827 "rna_Node_ItemArray_item_update<ForeachGeometryElementGenerationItemsAccessor>");
9828}
9829
9831{
9832 StructRNA *srna;
9833
9834 srna = RNA_def_struct(brna, "NodeGeometryForeachGeometryElementGenerationItems", nullptr);
9835 RNA_def_struct_sdna(srna, "bNode");
9836 RNA_def_struct_ui_text(srna, "Generation Items", "Collection of generation items");
9837
9839 srna,
9840 "ForeachGeometryElementGenerationItem",
9841 "ForeachGeometryElementGenerationItemsAccessor");
9843 "ForeachGeometryElementGenerationItem",
9844 "ForeachGeometryElementGenerationItemsAccessor");
9845}
9846
9848{
9849 PropertyRNA *prop;
9850
9851 RNA_def_struct_sdna_from(srna, "NodeGeometryForeachGeometryElementOutput", "storage");
9852
9853 prop = RNA_def_property(srna, "input_items", PROP_COLLECTION, PROP_NONE);
9854 RNA_def_property_collection_sdna(prop, nullptr, "input_items.items", "input_items.items_num");
9855 RNA_def_property_struct_type(prop, "ForeachGeometryElementInputItem");
9856 RNA_def_property_srna(prop, "NodeGeometryForeachGeometryElementInputItems");
9857
9858 prop = RNA_def_property(srna, "main_items", PROP_COLLECTION, PROP_NONE);
9859 RNA_def_property_collection_sdna(prop, nullptr, "main_items.items", "main_items.items_num");
9860 RNA_def_property_struct_type(prop, "ForeachGeometryElementMainItem");
9861 RNA_def_property_srna(prop, "NodeGeometryForeachGeometryElementMainItems");
9862
9863 prop = RNA_def_property(srna, "generation_items", PROP_COLLECTION, PROP_NONE);
9865 prop, nullptr, "generation_items.items", "generation_items.items_num");
9866 RNA_def_property_struct_type(prop, "ForeachGeometryElementGenerationItem");
9867 RNA_def_property_srna(prop, "NodeGeometryForeachGeometryElementGenerationItems");
9868
9869 prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_UNSIGNED);
9870 RNA_def_property_int_sdna(prop, nullptr, "input_items.active_index");
9871 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
9874 RNA_def_property_update(prop, NC_NODE, nullptr);
9875
9876 prop = RNA_def_property(srna, "active_generation_index", PROP_INT, PROP_UNSIGNED);
9877 RNA_def_property_int_sdna(prop, nullptr, "generation_items.active_index");
9878 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
9881 RNA_def_property_update(prop, NC_NODE, nullptr);
9882
9883 prop = RNA_def_property(srna, "active_main_index", PROP_INT, PROP_UNSIGNED);
9884 RNA_def_property_int_sdna(prop, nullptr, "main_items.active_index");
9885 RNA_def_property_ui_text(prop, "Active Main Item Index", "Index of the active item");
9888 RNA_def_property_update(prop, NC_NODE, nullptr);
9889
9890 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
9891 RNA_def_property_ui_text(prop, "Domain", "Geometry domain that is iterated over");
9893 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9894
9895 prop = RNA_def_property(srna, "inspection_index", PROP_INT, PROP_NONE);
9896 RNA_def_property_ui_range(prop, 0, INT32_MAX, 1, -1);
9898 "Inspection Index",
9899 "Iteration index that is used by inspection features like the viewer "
9900 "node or socket inspection");
9901 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
9902}
9903
9905{
9906 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryCaptureAttributeItem", nullptr);
9907 RNA_def_struct_ui_text(srna, "Capture Attribute Item", "");
9908 RNA_def_struct_sdna(srna, "NodeGeometryAttributeCaptureItem");
9909
9910 rna_def_node_item_array_socket_item_common(srna, "CaptureAttributeItemsAccessor", false);
9911 PropertyRNA *prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
9914 prop, nullptr, nullptr, "rna_NodeGeometryCaptureAttributeItem_data_type_itemf");
9915 RNA_def_property_ui_text(prop, "Data Type", "");
9918 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<CaptureAttributeItemsAccessor>");
9919}
9920
9922{
9923 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryCaptureAttributeItems", nullptr);
9924 RNA_def_struct_ui_text(srna, "Items", "Collection of capture attribute items");
9925 RNA_def_struct_sdna(srna, "bNode");
9926
9928 srna, "NodeGeometryCaptureAttributeItem", "CaptureAttributeItemsAccessor");
9930 srna, "NodeGeometryCaptureAttributeItem", "CaptureAttributeItemsAccessor");
9931}
9932
9934{
9935 PropertyRNA *prop;
9936
9937 RNA_def_struct_sdna_from(srna, "NodeGeometryAttributeCapture", "storage");
9938
9939 prop = RNA_def_property(srna, "capture_items", PROP_COLLECTION, PROP_NONE);
9940 RNA_def_property_collection_sdna(prop, nullptr, "capture_items", "capture_items_num");
9941 RNA_def_property_struct_type(prop, "NodeGeometryCaptureAttributeItem");
9942 RNA_def_property_ui_text(prop, "Items", "");
9943 RNA_def_property_srna(prop, "NodeGeometryCaptureAttributeItems");
9944
9945 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
9946 RNA_def_property_int_sdna(prop, nullptr, "active_index");
9947 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
9950 RNA_def_property_update(prop, NC_NODE, nullptr);
9951
9952 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
9953 RNA_def_property_struct_type(prop, "RepeatItem");
9955 "rna_Node_ItemArray_active_get<CaptureAttributeItemsAccessor>",
9956 "rna_Node_ItemArray_active_set<CaptureAttributeItemsAccessor>",
9957 nullptr,
9958 nullptr);
9960 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
9961 RNA_def_property_update(prop, NC_NODE, nullptr);
9962
9963 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
9964 RNA_def_property_ui_text(prop, "Domain", "Which domain to store the data in");
9967 prop, nullptr, nullptr, "rna_GeometryNodeAttributeDomain_attribute_domain_itemf");
9968 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
9969}
9970
9972{
9973 PropertyRNA *prop;
9974
9975 StructRNA *srna = RNA_def_struct(brna, "NodeGeometryBakeItem", nullptr);
9976 RNA_def_struct_ui_text(srna, "Bake Item", "");
9977
9978 rna_def_node_item_array_socket_item_common(srna, "BakeItemsAccessor", true);
9979
9980 prop = RNA_def_property(srna, "attribute_domain", PROP_ENUM, PROP_NONE);
9983 prop, nullptr, nullptr, "rna_GeometryNodeAttributeDomain_attribute_domain_itemf");
9985 "Attribute Domain",
9986 "Attribute domain where the attribute is stored in the baked data");
9989 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<BakeItemsAccessor>");
9990
9991 prop = RNA_def_property(srna, "is_attribute", PROP_BOOLEAN, PROP_NONE);
9993 RNA_def_property_ui_text(prop, "Is Attribute", "Bake item is an attribute stored on a geometry");
9995 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<BakeItemsAccessor>");
9996}
9997
9999{
10000 StructRNA *srna;
10001
10002 srna = RNA_def_struct(brna, "NodeGeometryBakeItems", nullptr);
10003 RNA_def_struct_sdna(srna, "bNode");
10004 RNA_def_struct_ui_text(srna, "Items", "Collection of bake items");
10005
10007 srna, "NodeGeometryBakeItem", "BakeItemsAccessor");
10008 rna_def_node_item_array_common_functions(srna, "NodeGeometryBakeItem", "BakeItemsAccessor");
10009}
10010
10011static void rna_def_geo_bake(StructRNA *srna)
10012{
10013 PropertyRNA *prop;
10014
10015 RNA_def_struct_sdna_from(srna, "NodeGeometryBake", "storage");
10016
10017 prop = RNA_def_property(srna, "bake_items", PROP_COLLECTION, PROP_NONE);
10018 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
10019 RNA_def_property_struct_type(prop, "NodeGeometryBakeItem");
10020 RNA_def_property_ui_text(prop, "Items", "");
10021 RNA_def_property_srna(prop, "NodeGeometryBakeItems");
10022
10023 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
10024 RNA_def_property_int_sdna(prop, nullptr, "active_index");
10025 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
10028 RNA_def_property_update(prop, NC_NODE, nullptr);
10029
10030 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
10031 RNA_def_property_struct_type(prop, "RepeatItem");
10033 "rna_Node_ItemArray_active_get<BakeItemsAccessor>",
10034 "rna_Node_ItemArray_active_set<BakeItemsAccessor>",
10035 nullptr,
10036 nullptr);
10039 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
10040 RNA_def_property_update(prop, NC_NODE, nullptr);
10041}
10042
10044{
10045 PropertyRNA *prop;
10046
10047 StructRNA *srna = RNA_def_struct(brna, "IndexSwitchItem", nullptr);
10048 RNA_def_struct_ui_text(srna, "Index Switch Item", "");
10049 RNA_def_struct_sdna(srna, "IndexSwitchItem");
10050
10051 prop = RNA_def_property(srna, "identifier", PROP_INT, PROP_NONE);
10052 RNA_def_property_ui_range(prop, 0, INT32_MAX, 1, -1);
10053 RNA_def_property_ui_text(prop, "Identifier", "Consistent identifier used for the item");
10055 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
10056}
10057
10059{
10060 StructRNA *srna;
10061 FunctionRNA *func;
10062 PropertyRNA *parm;
10063
10064 srna = RNA_def_struct(brna, "NodeIndexSwitchItems", nullptr);
10065 RNA_def_struct_sdna(srna, "bNode");
10066 RNA_def_struct_ui_text(srna, "Items", "Collection of index_switch items");
10067
10068 func = RNA_def_function(srna, "new", "rna_NodeIndexSwitchItems_new");
10069 RNA_def_function_ui_description(func, "Add an item at the end");
10071 /* Return value. */
10072 parm = RNA_def_pointer(func, "item", "IndexSwitchItem", "Item", "New item");
10073 RNA_def_function_return(func, parm);
10074
10075 rna_def_node_item_array_common_functions(srna, "IndexSwitchItem", "IndexSwitchItemsAccessor");
10076}
10077
10079{
10080 PropertyRNA *prop;
10081
10082 RNA_def_struct_sdna_from(srna, "NodeIndexSwitch", "storage");
10083
10084 prop = RNA_def_property(srna, "index_switch_items", PROP_COLLECTION, PROP_NONE);
10085 RNA_def_property_collection_sdna(prop, nullptr, "items", "items_num");
10086 RNA_def_property_struct_type(prop, "IndexSwitchItem");
10087 RNA_def_property_ui_text(prop, "Items", "");
10088 RNA_def_property_srna(prop, "NodeIndexSwitchItems");
10089}
10090
10092{
10093 PropertyRNA *prop;
10094
10095 RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSelectHandles", "storage");
10096
10097 prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
10098 RNA_def_property_enum_sdna(prop, nullptr, "handle_type");
10099 RNA_def_property_ui_text(prop, "Handle Type", "");
10101 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10102
10103 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10105 RNA_def_property_ui_text(prop, "Mode", "Whether to check the type of left and right handles");
10107 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10108}
10109
10111{
10112 static const EnumPropertyItem type_items[] = {
10114 "AXIS_ANGLE",
10115 ICON_NONE,
10116 "Axis Angle",
10117 "Rotate around an axis by an angle"},
10119 "EULER",
10120 ICON_NONE,
10121 "Euler",
10122 "Rotate around the X, Y, and Z axes"},
10123 {0, nullptr, 0, nullptr, nullptr},
10124 };
10125
10126 static const EnumPropertyItem space_items[] = {
10128 "OBJECT",
10129 ICON_NONE,
10130 "Object",
10131 "Rotate the input rotation in the local space of the object"},
10133 "LOCAL",
10134 ICON_NONE,
10135 "Local",
10136 "Rotate the input rotation in its local space"},
10137 {0, nullptr, 0, nullptr, nullptr},
10138 };
10139
10140 PropertyRNA *prop;
10141
10142 prop = RNA_def_property(srna, "rotation_type", PROP_ENUM, PROP_NONE);
10143 RNA_def_property_enum_sdna(prop, nullptr, "custom1");
10144 RNA_def_property_enum_items(prop, type_items);
10145 RNA_def_property_ui_text(prop, "Type", "Method used to describe the rotation");
10146 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10147
10148 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
10149 RNA_def_property_enum_sdna(prop, nullptr, "custom2");
10151 RNA_def_property_ui_text(prop, "Space", "Base orientation for rotation");
10152 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10153}
10154
10156{
10157 using namespace blender;
10158 PropertyRNA *prop;
10159
10160 RNA_def_struct_sdna_from(srna, "NodeGeometrySampleIndex", "storage");
10161
10162 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10165 prop, nullptr, nullptr, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
10167 RNA_def_property_ui_text(prop, "Data Type", "");
10169 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10170
10171 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10174 prop, nullptr, nullptr, "rna_GeometryNodeAttributeDomain_attribute_domain_itemf");
10175 RNA_def_property_enum_default(prop, int(bke::AttrDomain::Point));
10176 RNA_def_property_ui_text(prop, "Domain", "");
10177 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10178
10179 prop = RNA_def_property(srna, "clamp", PROP_BOOLEAN, PROP_NONE);
10181 "Clamp",
10182 "Clamp the indices to the size of the attribute domain instead of "
10183 "outputting a default value for invalid indices");
10184 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10185}
10186
10188{
10189 PropertyRNA *prop;
10190
10191 prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
10192 RNA_def_property_pointer_sdna(prop, nullptr, "id");
10193 RNA_def_property_struct_type(prop, "Material");
10196 RNA_def_property_ui_text(prop, "Material", "");
10197 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10198}
10199
10200static void def_geo_image(StructRNA *srna)
10201{
10202 PropertyRNA *prop;
10203
10204 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
10205 RNA_def_property_pointer_sdna(prop, nullptr, "id");
10206 RNA_def_property_struct_type(prop, "Image");
10208 RNA_def_property_ui_text(prop, "Image", "");
10209 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10210}
10211
10213{
10214 static const EnumPropertyItem rna_node_geometry_string_to_curves_overflow_items[] = {
10216 "OVERFLOW",
10217 ICON_NONE,
10218 "Overflow",
10219 "Let the text use more space than the specified height"},
10221 "SCALE_TO_FIT",
10222 ICON_NONE,
10223 "Scale To Fit",
10224 "Scale the text size to fit inside the width and height"},
10226 "TRUNCATE",
10227 ICON_NONE,
10228 "Truncate",
10229 "Only output curves that fit within the width and height. Output the remainder to the "
10230 "\"Remainder\" output."},
10231 {0, nullptr, 0, nullptr, nullptr},
10232 };
10233
10234 static const EnumPropertyItem rna_node_geometry_string_to_curves_align_x_items[] = {
10236 "LEFT",
10237 ICON_ALIGN_LEFT,
10238 "Left",
10239 "Align text to the left"},
10241 "CENTER",
10242 ICON_ALIGN_CENTER,
10243 "Center",
10244 "Align text to the center"},
10246 "RIGHT",
10247 ICON_ALIGN_RIGHT,
10248 "Right",
10249 "Align text to the right"},
10251 "JUSTIFY",
10252 ICON_ALIGN_JUSTIFY,
10253 "Justify",
10254 "Align text to the left and the right"},
10256 "FLUSH",
10257 ICON_ALIGN_FLUSH,
10258 "Flush",
10259 "Align text to the left and the right, with equal character spacing"},
10260 {0, nullptr, 0, nullptr, nullptr},
10261 };
10262
10263 static const EnumPropertyItem rna_node_geometry_string_to_curves_align_y_items[] = {
10265 "TOP",
10266 ICON_ALIGN_TOP,
10267 "Top",
10268 "Align text to the top"},
10270 "TOP_BASELINE",
10271 ICON_ALIGN_TOP,
10272 "Top Baseline",
10273 "Align text to the top line's baseline"},
10275 "MIDDLE",
10276 ICON_ALIGN_MIDDLE,
10277 "Middle",
10278 "Align text to the middle"},
10280 "BOTTOM_BASELINE",
10281 ICON_ALIGN_BOTTOM,
10282 "Bottom Baseline",
10283 "Align text to the bottom line's baseline"},
10285 "BOTTOM",
10286 ICON_ALIGN_BOTTOM,
10287 "Bottom",
10288 "Align text to the bottom"},
10289 {0, nullptr, 0, nullptr, nullptr},
10290 };
10291
10292 static const EnumPropertyItem rna_node_geometry_string_to_curves_pivot_mode[] = {
10293 {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT, "MIDPOINT", 0, "Midpoint", "Midpoint"},
10294 {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT, "TOP_LEFT", 0, "Top Left", "Top Left"},
10296 "TOP_CENTER",
10297 0,
10298 "Top Center",
10299 "Top Center"},
10300 {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT, "TOP_RIGHT", 0, "Top Right", "Top Right"},
10302 "BOTTOM_LEFT",
10303 0,
10304 "Bottom Left",
10305 "Bottom Left"},
10307 "BOTTOM_CENTER",
10308 0,
10309 "Bottom Center",
10310 "Bottom Center"},
10312 "BOTTOM_RIGHT",
10313 0,
10314 "Bottom Right",
10315 "Bottom Right"},
10316 {0, nullptr, 0, nullptr, nullptr},
10317 };
10318
10319 PropertyRNA *prop;
10320
10321 prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
10322 RNA_def_property_pointer_sdna(prop, nullptr, "id");
10323 RNA_def_property_struct_type(prop, "VectorFont");
10325 prop, "Font", "Font of the text. Falls back to the UI font by default.");
10328 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10329
10330 RNA_def_struct_sdna_from(srna, "NodeGeometryStringToCurves", "storage");
10331
10332 prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
10333 RNA_def_property_enum_sdna(prop, nullptr, "overflow");
10334 RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_overflow_items);
10337 prop, "Textbox Overflow", "Handle the text behavior when it doesn't fit in the text boxes");
10338 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10339
10340 prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
10341 RNA_def_property_enum_sdna(prop, nullptr, "align_x");
10342 RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_align_x_items);
10345 prop, "Horizontal Alignment", "Text horizontal alignment from the object center");
10346 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10347
10348 prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
10349 RNA_def_property_enum_sdna(prop, nullptr, "align_y");
10350 RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_align_y_items);
10353 prop, "Vertical Alignment", "Text vertical alignment from the object center");
10354 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10355
10356 prop = RNA_def_property(srna, "pivot_mode", PROP_ENUM, PROP_NONE);
10357 RNA_def_property_enum_sdna(prop, nullptr, "pivot_mode");
10358 RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_pivot_mode);
10360 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot point position relative to character");
10361 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10362}
10363
10365{
10366 PropertyRNA *prop;
10367
10368 StructRNA *srna = RNA_def_struct(brna, "NodeEnumItem", nullptr);
10369 RNA_def_struct_ui_text(srna, "Enum Item", "");
10370
10371 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
10373 prop, nullptr, nullptr, "rna_Node_ItemArray_item_name_set<MenuSwitchItemsAccessor>");
10374 RNA_def_property_ui_text(prop, "Name", "");
10375 RNA_def_struct_name_property(srna, prop);
10377 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<MenuSwitchItemsAccessor>");
10378
10379 prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
10380 RNA_def_property_string_sdna(prop, nullptr, "description");
10381 RNA_def_property_ui_text(prop, "Description", "");
10383 prop, NC_NODE | NA_EDITED, "rna_Node_ItemArray_item_update<MenuSwitchItemsAccessor>");
10384}
10385
10387{
10388 StructRNA *srna;
10389 PropertyRNA *parm;
10390 FunctionRNA *func;
10391
10392 srna = RNA_def_struct(brna, "NodeMenuSwitchItems", nullptr);
10393 RNA_def_struct_sdna(srna, "bNode");
10395 srna, "Enum Definition Items", "Collection of items that make up an enum");
10396
10397 func = RNA_def_function(srna, "new", "rna_NodeMenuSwitchItems_new");
10398 RNA_def_function_ui_description(func, "Add an a new enum item");
10400 parm = RNA_def_string(func, "name", nullptr, MAX_NAME, "Name", "");
10402 /* return value */
10403 parm = RNA_def_pointer(func, "item", "NodeEnumItem", "Item", "New item");
10404 RNA_def_function_return(func, parm);
10405
10406 rna_def_node_item_array_common_functions(srna, "NodeEnumItem", "MenuSwitchItemsAccessor");
10407}
10408
10410{
10411 PropertyRNA *prop;
10412
10413 RNA_def_struct_sdna_from(srna, "NodeMenuSwitch", "storage");
10414
10415 prop = RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE);
10417 prop, nullptr, "enum_definition.items_array", "enum_definition.items_num");
10418 RNA_def_property_struct_type(prop, "NodeEnumItem");
10419 RNA_def_property_ui_text(prop, "Items", "");
10420 RNA_def_property_srna(prop, "NodeMenuSwitchItems");
10421
10422 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
10423 RNA_def_property_int_sdna(prop, nullptr, "enum_definition.active_index");
10424 RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
10426 RNA_def_property_update(prop, NC_NODE, nullptr);
10427
10428 prop = RNA_def_property(srna, "active_item", PROP_POINTER, PROP_NONE);
10429 RNA_def_property_struct_type(prop, "NodeEnumItem");
10431 "rna_Node_ItemArray_active_get<MenuSwitchItemsAccessor>",
10432 "rna_Node_ItemArray_active_set<MenuSwitchItemsAccessor>",
10433 nullptr,
10434 nullptr);
10436 RNA_def_property_ui_text(prop, "Active Item", "Active item");
10437 RNA_def_property_update(prop, NC_NODE, nullptr);
10438
10439 /* This exists only for backward compatibility. */
10440 prop = RNA_def_property(srna, "enum_definition", PROP_POINTER, PROP_NONE);
10441 RNA_def_property_struct_type(prop, "Node");
10443 prop, "rna_NodeMenuSwitch_enum_definition_get", nullptr, nullptr, nullptr);
10446 "Enum Definition (deprecated)",
10447 "The enum definition can now be accessed directly on the node. This "
10448 "exists for backward compatibility.");
10449}
10450
10452{
10453 StructRNA *srna;
10454
10455 srna = RNA_def_struct(brna, "ShaderNode", "NodeInternal");
10456 RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node");
10457 RNA_def_struct_sdna(srna, "bNode");
10458 RNA_def_struct_register_funcs(srna, "rna_ShaderNode_register", "rna_Node_unregister", nullptr);
10459}
10460
10462{
10463 StructRNA *srna;
10464 FunctionRNA *func;
10465
10466 srna = RNA_def_struct(brna, "CompositorNode", "NodeInternal");
10467 RNA_def_struct_ui_text(srna, "Compositor Node", "");
10468 RNA_def_struct_sdna(srna, "bNode");
10470 srna, "rna_CompositorNode_register", "rna_Node_unregister", nullptr);
10471
10472 /* compositor node need_exec flag */
10473 func = RNA_def_function(srna, "tag_need_exec", "rna_CompositorNode_tag_need_exec");
10474 RNA_def_function_ui_description(func, "Tag the node for compositor update");
10475
10477}
10478
10480{
10481 StructRNA *srna;
10482
10483 srna = RNA_def_struct(brna, "TextureNode", "NodeInternal");
10484 RNA_def_struct_ui_text(srna, "Texture Node", "");
10485 RNA_def_struct_sdna(srna, "bNode");
10486 RNA_def_struct_register_funcs(srna, "rna_TextureNode_register", "rna_Node_unregister", nullptr);
10487}
10488
10490{
10491 StructRNA *srna;
10492
10493 srna = RNA_def_struct(brna, "GeometryNode", "NodeInternal");
10494 RNA_def_struct_ui_text(srna, "Geometry Node", "");
10495 RNA_def_struct_sdna(srna, "bNode");
10496 RNA_def_struct_register_funcs(srna, "rna_GeometryNode_register", "rna_Node_unregister", nullptr);
10497}
10498
10500{
10501 StructRNA *srna;
10502
10503 srna = RNA_def_struct(brna, "FunctionNode", "NodeInternal");
10504 RNA_def_struct_ui_text(srna, "Function Node", "");
10505 RNA_def_struct_sdna(srna, "bNode");
10506 RNA_def_struct_register_funcs(srna, "rna_FunctionNode_register", "rna_Node_unregister", nullptr);
10507}
10508
10509/* -------------------------------------------------------------------------- */
10510
10511static void def_reroute(StructRNA *srna)
10512{
10513 RNA_def_struct_sdna_from(srna, "NodeReroute", "storage");
10514
10515 PropertyRNA *prop = RNA_def_property(srna, "socket_idname", PROP_STRING, PROP_NONE);
10516 RNA_def_property_string_sdna(prop, nullptr, "type_idname");
10517 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_reroute_node_socket_type_set");
10518 RNA_def_property_ui_text(prop, "Type of socket", "");
10519 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10520}
10521
10523{
10524 StructRNA *srna;
10525 PropertyRNA *prop, *parm;
10526 FunctionRNA *func;
10527
10528 srna = RNA_def_struct(brna, "NodeInternalSocketTemplate", nullptr);
10529 RNA_def_struct_ui_text(srna, "Socket Template", "Type and default value of a node socket");
10530
10531 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
10533 "rna_NodeInternalSocketTemplate_name_get",
10534 "rna_NodeInternalSocketTemplate_name_length",
10535 nullptr);
10536 RNA_def_property_ui_text(prop, "Name", "Name of the socket");
10538
10539 prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
10541 "rna_NodeInternalSocketTemplate_identifier_get",
10542 "rna_NodeInternalSocketTemplate_identifier_length",
10543 nullptr);
10544 RNA_def_property_ui_text(prop, "Identifier", "Identifier of the socket");
10546
10547 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
10548 RNA_def_property_enum_funcs(prop, "rna_NodeInternalSocketTemplate_type_get", nullptr, nullptr);
10550 RNA_def_property_ui_text(prop, "Type", "Data type of the socket");
10552
10553 /* XXX Workaround: Registered functions are not exposed in python by bpy,
10554 * it expects them to be registered from python and use the native implementation.
10555 *
10556 * However, the standard node types are not registering these functions from python,
10557 * so in order to call them in py scripts we need to overload and
10558 * replace them with plain C callbacks.
10559 * This type provides a usable basis for node types defined in C.
10560 */
10561
10562 srna = RNA_def_struct(brna, "NodeInternal", "Node");
10563 RNA_def_struct_sdna(srna, "bNode");
10564
10565 /* poll */
10566 func = RNA_def_function(srna, "poll", "rna_NodeInternal_poll");
10568 func, "If non-null output is returned, the node type can be added to the tree");
10570 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
10571 parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
10573
10574 func = RNA_def_function(srna, "poll_instance", "rna_NodeInternal_poll_instance");
10576 func, "If non-null output is returned, the node can be added to the tree");
10577 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
10578 parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
10580
10581 /* update */
10582 func = RNA_def_function(srna, "update", "rna_NodeInternal_update");
10584 func, "Update on node graph topology changes (adding or removing nodes and links)");
10586
10587 /* draw buttons */
10588 func = RNA_def_function(srna, "draw_buttons", "rna_NodeInternal_draw_buttons");
10589 RNA_def_function_ui_description(func, "Draw node buttons");
10591 parm = RNA_def_pointer(func, "context", "Context", "", "");
10593 parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10594 RNA_def_property_struct_type(parm, "UILayout");
10595 RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10597
10598 /* draw buttons extended */
10599 func = RNA_def_function(srna, "draw_buttons_ext", "rna_NodeInternal_draw_buttons_ext");
10600 RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
10602 parm = RNA_def_pointer(func, "context", "Context", "", "");
10604 parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10605 RNA_def_property_struct_type(parm, "UILayout");
10606 RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10608}
10609
10610static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
10611{
10612 StructRNA *srna;
10613 PropertyRNA *parm;
10614 FunctionRNA *func;
10615 const char *structtype = (in_out == SOCK_IN ? "NodeInputs" : "NodeOutputs");
10616 const char *uiname = (in_out == SOCK_IN ? "Node Inputs" : "Node Outputs");
10617 const char *newfunc = (in_out == SOCK_IN ? "rna_Node_inputs_new" : "rna_Node_outputs_new");
10618 const char *clearfunc = (in_out == SOCK_IN ? "rna_Node_inputs_clear" : "rna_Node_outputs_clear");
10619 const char *movefunc = (in_out == SOCK_IN ? "rna_Node_inputs_move" : "rna_Node_outputs_move");
10620
10621 RNA_def_property_srna(cprop, structtype);
10622 srna = RNA_def_struct(brna, structtype, nullptr);
10623 RNA_def_struct_sdna(srna, "bNode");
10624 RNA_def_struct_ui_text(srna, uiname, "Collection of Node Sockets");
10625
10626 func = RNA_def_function(srna, "new", newfunc);
10627 RNA_def_function_ui_description(func, "Add a socket to this node");
10629 parm = RNA_def_string(func, "type", nullptr, MAX_NAME, "Type", "Data type");
10631 parm = RNA_def_string(func, "name", nullptr, MAX_NAME, "Name", "");
10633 RNA_def_string(func, "identifier", nullptr, MAX_NAME, "Identifier", "Unique socket identifier");
10635 func, "use_multi_input", false, "", "Make the socket multi-input (valid for inputs only)");
10636 /* return value */
10637 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
10638 RNA_def_function_return(func, parm);
10639
10640 func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
10641 RNA_def_function_ui_description(func, "Remove a socket from this node");
10643 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
10645
10646 func = RNA_def_function(srna, "clear", clearfunc);
10647 RNA_def_function_ui_description(func, "Remove all sockets from this node");
10649
10650 func = RNA_def_function(srna, "move", movefunc);
10651 RNA_def_function_ui_description(func, "Move a socket to another position");
10653 parm = RNA_def_int(
10654 func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
10656 parm = RNA_def_int(
10657 func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
10659}
10660
10661static void rna_def_node(BlenderRNA *brna)
10662{
10663 StructRNA *srna;
10664 PropertyRNA *prop;
10665 FunctionRNA *func;
10666 PropertyRNA *parm;
10667
10668 static const EnumPropertyItem dummy_static_type_items[] = {
10669 {NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"},
10670 {0, nullptr, 0, nullptr, nullptr},
10671 };
10672
10673 static const EnumPropertyItem warning_propagation_items[] = {
10674 {NODE_WARNING_PROPAGATION_ALL, "ALL", 0, "All", ""},
10675 {NODE_WARNING_PROPAGATION_NONE, "NONE", 0, "None", ""},
10676 {NODE_WARNING_PROPAGATION_ONLY_ERRORS, "ERRORS", 0, "Errors", ""},
10678 "ERRORS_AND_WARNINGS",
10679 0,
10680 "Errors and Warnings",
10681 ""},
10682 {0, nullptr, 0, nullptr, nullptr},
10683 };
10684
10685 srna = RNA_def_struct(brna, "Node", nullptr);
10686 RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
10687 RNA_def_struct_sdna(srna, "bNode");
10688 RNA_def_struct_ui_icon(srna, ICON_NODE);
10689 RNA_def_struct_refine_func(srna, "rna_Node_refine");
10690 RNA_def_struct_path_func(srna, "rna_Node_path");
10691 RNA_def_struct_register_funcs(srna, "rna_Node_register", "rna_Node_unregister", nullptr);
10692 RNA_def_struct_idprops_func(srna, "rna_Node_idprops");
10693
10694 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
10695 RNA_def_property_enum_sdna(prop, nullptr, "type");
10696 RNA_def_property_enum_items(prop, dummy_static_type_items);
10697 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_node_static_type_itemf");
10701 prop,
10702 "Type",
10703 "Node type (deprecated, use bl_static_type or bl_idname for the actual identifier string)");
10704
10705 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
10706 RNA_def_property_float_sdna(prop, nullptr, "locx");
10707 RNA_def_property_array(prop, 2);
10708 RNA_def_property_range(prop, -100000.0f, 100000.0f);
10709 RNA_def_property_ui_text(prop, "Location", "");
10710 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
10711
10712 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_XYZ);
10713 RNA_def_property_float_sdna(prop, nullptr, "width");
10714 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_Node_width_range");
10715 RNA_def_property_ui_text(prop, "Width", "Width of the node");
10716 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10717
10718 prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_XYZ);
10719 RNA_def_property_float_sdna(prop, nullptr, "height");
10720 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_Node_height_range");
10721 RNA_def_property_ui_text(prop, "Height", "Height of the node");
10722 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10723
10724 prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
10725 RNA_def_property_array(prop, 2);
10726 RNA_def_property_float_funcs(prop, "rna_Node_dimensions_get", nullptr, nullptr);
10727 RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the node");
10729
10730 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
10731 RNA_def_property_ui_text(prop, "Name", "Unique node identifier");
10732 RNA_def_struct_name_property(srna, prop);
10733 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Node_name_set");
10734 RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10735
10736 prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
10737 RNA_def_property_string_sdna(prop, nullptr, "label");
10738 RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
10739 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10740
10741 prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
10742 RNA_def_property_collection_sdna(prop, nullptr, "inputs", nullptr);
10744 nullptr,
10745 nullptr,
10746 nullptr,
10747 nullptr,
10748 nullptr,
10749 nullptr,
10750 "rna_NodeInputs_lookup_string",
10751 nullptr);
10752 RNA_def_property_struct_type(prop, "NodeSocket");
10754 RNA_def_property_ui_text(prop, "Inputs", "");
10755 rna_def_node_sockets_api(brna, prop, SOCK_IN);
10756
10757 prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
10758 RNA_def_property_collection_sdna(prop, nullptr, "outputs", nullptr);
10760 nullptr,
10761 nullptr,
10762 nullptr,
10763 nullptr,
10764 nullptr,
10765 nullptr,
10766 "rna_NodeOutputs_lookup_string",
10767 nullptr);
10768 RNA_def_property_struct_type(prop, "NodeSocket");
10770 RNA_def_property_ui_text(prop, "Outputs", "");
10772
10773 prop = RNA_def_property(srna, "internal_links", PROP_COLLECTION, PROP_NONE);
10775 "rna_Node_internal_links_begin",
10776 "rna_iterator_array_next",
10777 "rna_iterator_array_end",
10778 "rna_iterator_array_get",
10779 nullptr,
10780 nullptr,
10781 nullptr,
10782 nullptr);
10783 RNA_def_property_struct_type(prop, "NodeLink");
10785 prop, "Internal Links", "Internal input-to-output connections for muting");
10786
10787 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
10788 RNA_def_property_pointer_sdna(prop, nullptr, "parent");
10790 prop, nullptr, "rna_Node_parent_set", nullptr, "rna_Node_parent_poll");
10794 RNA_def_property_struct_type(prop, "Node");
10795 RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to");
10796
10797 prop = RNA_def_property(srna, "warning_propagation", PROP_ENUM, PROP_NONE);
10798 RNA_def_property_enum_items(prop, warning_propagation_items);
10800 prop,
10801 "Warning Propagation",
10802 "The kinds of messages that should be propagated from this node to the parent group node");
10803 RNA_def_property_update(prop, 0, "rna_Node_update");
10804
10805 prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
10806 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_CUSTOM_COLOR);
10808 RNA_def_property_ui_text(prop, "Custom Color", "Use custom color for the node");
10809 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10810
10811 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
10812 RNA_def_property_array(prop, 3);
10813 RNA_def_property_range(prop, 0.0f, 1.0f);
10814 RNA_def_property_ui_text(prop, "Color", "Custom color of the node body");
10815 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10816
10817 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
10818 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SELECT);
10819 RNA_def_property_boolean_funcs(prop, nullptr, "rna_Node_select_set");
10820 RNA_def_property_ui_text(prop, "Select", "Node selection state");
10822
10823 prop = RNA_def_property(srna, "show_options", PROP_BOOLEAN, PROP_NONE);
10824 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_OPTIONS);
10825 RNA_def_property_ui_text(prop, "Show Options", "");
10826 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10827
10828 prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
10829 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_PREVIEW);
10830 RNA_def_property_ui_text(prop, "Show Preview", "");
10831 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10832
10833 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
10834 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_HIDDEN);
10835 RNA_def_property_ui_text(prop, "Hide", "");
10836 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
10837
10838 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
10839 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_MUTED);
10841 RNA_def_property_ui_text(prop, "Mute", "");
10842 RNA_def_property_update(prop, 0, "rna_Node_update");
10843
10844 prop = RNA_def_property(srna, "show_texture", PROP_BOOLEAN, PROP_NONE);
10845 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_ACTIVE_TEXTURE);
10846 RNA_def_property_ui_text(prop, "Show Texture", "Display node in viewport textured shading mode");
10847 RNA_def_property_update(prop, 0, "rna_Node_update");
10848
10849 /* generic property update function */
10850 func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update");
10851 RNA_def_function_ui_description(func, "Update after property changes");
10853 parm = RNA_def_pointer(func, "context", "Context", "", "");
10855
10856 func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
10857 RNA_def_function_ui_description(func, "True if a registered node type");
10859 parm = RNA_def_boolean(func, "result", false, "Result", "");
10860 RNA_def_function_return(func, parm);
10861
10862 /* registration */
10863 prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
10864 RNA_def_property_string_sdna(prop, nullptr, "typeinfo->idname");
10866 RNA_def_property_ui_text(prop, "ID Name", "");
10867
10868 prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
10869 RNA_def_property_string_sdna(prop, nullptr, "typeinfo->ui_name");
10871 RNA_def_property_ui_text(prop, "Label", "The node label");
10872
10873 prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
10874 RNA_def_property_string_sdna(prop, nullptr, "typeinfo->ui_description");
10876
10877 prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
10878 RNA_def_property_enum_sdna(prop, nullptr, "typeinfo->ui_icon");
10880 RNA_def_property_enum_default(prop, ICON_NODE);
10882 RNA_def_property_ui_text(prop, "Icon", "The node icon");
10883
10884 prop = RNA_def_property(srna, "bl_static_type", PROP_ENUM, PROP_NONE);
10885 RNA_def_property_enum_sdna(prop, nullptr, "typeinfo->type");
10886 RNA_def_property_enum_items(prop, dummy_static_type_items);
10887 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_node_static_type_itemf");
10890 RNA_def_property_ui_text(prop, "Static Type", "Node type (deprecated, use with care)");
10891
10892 /* type-based size properties */
10893 prop = RNA_def_property(srna, "bl_width_default", PROP_FLOAT, PROP_UNSIGNED);
10894 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->width");
10896
10897 prop = RNA_def_property(srna, "bl_width_min", PROP_FLOAT, PROP_UNSIGNED);
10898 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->minwidth");
10900
10901 prop = RNA_def_property(srna, "bl_width_max", PROP_FLOAT, PROP_UNSIGNED);
10902 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->maxwidth");
10904
10905 prop = RNA_def_property(srna, "bl_height_default", PROP_FLOAT, PROP_UNSIGNED);
10906 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->height");
10908
10909 prop = RNA_def_property(srna, "bl_height_min", PROP_FLOAT, PROP_UNSIGNED);
10910 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->minheight");
10912
10913 prop = RNA_def_property(srna, "bl_height_max", PROP_FLOAT, PROP_UNSIGNED);
10914 RNA_def_property_float_sdna(prop, nullptr, "typeinfo->minheight");
10916
10917 /* poll */
10918 func = RNA_def_function(srna, "poll", nullptr);
10920 func, "If non-null output is returned, the node type can be added to the tree");
10922 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
10923 parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
10925
10926 func = RNA_def_function(srna, "poll_instance", nullptr);
10928 func, "If non-null output is returned, the node can be added to the tree");
10930 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
10931 parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
10933
10934 /* update */
10935 func = RNA_def_function(srna, "update", nullptr);
10937 func, "Update on node graph topology changes (adding or removing nodes and links)");
10939
10940 /* insert_link */
10941 func = RNA_def_function(srna, "insert_link", nullptr);
10942 RNA_def_function_ui_description(func, "Handle creation of a link to or from the node");
10944 parm = RNA_def_pointer(func, "link", "NodeLink", "Link", "Node link that will be inserted");
10946
10947 /* init */
10948 func = RNA_def_function(srna, "init", nullptr);
10949 RNA_def_function_ui_description(func, "Initialize a new instance of this node");
10951 parm = RNA_def_pointer(func, "context", "Context", "", "");
10953
10954 /* copy */
10955 func = RNA_def_function(srna, "copy", nullptr);
10957 "Initialize a new instance of this node from an existing node");
10959 parm = RNA_def_pointer(func, "node", "Node", "Node", "Existing node to copy");
10961
10962 /* free */
10963 func = RNA_def_function(srna, "free", nullptr);
10964 RNA_def_function_ui_description(func, "Clean up node on removal");
10966
10967 /* draw buttons */
10968 func = RNA_def_function(srna, "draw_buttons", nullptr);
10969 RNA_def_function_ui_description(func, "Draw node buttons");
10971 parm = RNA_def_pointer(func, "context", "Context", "", "");
10973 parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10974 RNA_def_property_struct_type(parm, "UILayout");
10975 RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10977
10978 /* draw buttons extended */
10979 func = RNA_def_function(srna, "draw_buttons_ext", nullptr);
10980 RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
10982 parm = RNA_def_pointer(func, "context", "Context", "", "");
10984 parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10985 RNA_def_property_struct_type(parm, "UILayout");
10986 RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10988
10989 /* dynamic label */
10990 func = RNA_def_function(srna, "draw_label", nullptr);
10991 RNA_def_function_ui_description(func, "Returns a dynamic label string");
10993 parm = RNA_def_string(func, "label", nullptr, MAX_NAME, "Label", "");
10995 parm, PROP_THICK_WRAP, ParameterFlag(0)); /* needed for string return value */
10996 RNA_def_function_output(func, parm);
10997
10998 func = RNA_def_function(srna,
10999 "debug_zone_body_lazy_function_graph",
11000 "rna_NodeTree_debug_zone_body_lazy_function_graph");
11002 func, "Get the internal lazy-function graph for the body of this zone");
11004 parm = RNA_def_string(func, "dot_graph", nullptr, INT32_MAX, "Dot Graph", "Graph in dot format");
11007 RNA_def_function_output(func, parm);
11008
11009 func = RNA_def_function(
11010 srna, "debug_zone_lazy_function_graph", "rna_NodeTree_debug_zone_lazy_function_graph");
11011 RNA_def_function_ui_description(func, "Get the internal lazy-function graph for this zone");
11013 parm = RNA_def_string(func, "dot_graph", nullptr, INT32_MAX, "Dot Graph", "Graph in dot format");
11016 RNA_def_function_output(func, parm);
11017}
11018
11020{
11021 StructRNA *srna;
11022 PropertyRNA *prop;
11023 FunctionRNA *func;
11024 PropertyRNA *parm;
11025
11026 srna = RNA_def_struct(brna, "NodeLink", nullptr);
11027 RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree");
11028 RNA_def_struct_sdna(srna, "bNodeLink");
11029 RNA_def_struct_ui_icon(srna, ICON_NODE);
11030
11031 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
11032 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_LINK_VALID);
11033 RNA_def_property_ui_text(prop, "Valid", "Link is valid");
11034 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
11035
11036 prop = RNA_def_property(srna, "is_muted", PROP_BOOLEAN, PROP_NONE);
11037 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_LINK_MUTED);
11038 RNA_def_property_ui_text(prop, "Muted", "Link is muted and can be ignored");
11039 RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
11040
11041 prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE);
11042 RNA_def_property_pointer_sdna(prop, nullptr, "fromnode");
11043 RNA_def_property_struct_type(prop, "Node");
11047 RNA_def_property_ui_text(prop, "From node", "");
11048
11049 prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE);
11050 RNA_def_property_pointer_sdna(prop, nullptr, "tonode");
11051 RNA_def_property_struct_type(prop, "Node");
11055 RNA_def_property_ui_text(prop, "To node", "");
11056
11057 prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE);
11058 RNA_def_property_pointer_sdna(prop, nullptr, "fromsock");
11059 RNA_def_property_struct_type(prop, "NodeSocket");
11063 RNA_def_property_ui_text(prop, "From socket", "");
11064
11065 prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE);
11066 RNA_def_property_pointer_sdna(prop, nullptr, "tosock");
11067 RNA_def_property_struct_type(prop, "NodeSocket");
11071 RNA_def_property_ui_text(prop, "To socket", "");
11072
11073 prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
11074 RNA_def_property_boolean_funcs(prop, "rna_NodeLink_is_hidden_get", nullptr);
11078 RNA_def_property_ui_text(prop, "Is Hidden", "Link is hidden due to invisible sockets");
11079
11080 prop = RNA_def_property(srna, "multi_input_sort_id", PROP_INT, PROP_UNSIGNED);
11083 prop,
11084 "Multi Input Sort ID",
11085 "Used to sort multiple links coming into the same input. The highest ID is at the top.");
11086
11087 func = RNA_def_function(
11088 srna, "swap_multi_input_sort_id", "rna_NodeLink_swap_multi_input_sort_id");
11090 func, "Swap the order of two links connected to the same multi-input socket");
11092 parm = RNA_def_pointer(func,
11093 "other",
11094 "NodeLink",
11095 "Other",
11096 "The other link. Must link to the same multi-input socket.");
11098}
11099
11101{
11102 StructRNA *srna;
11103 PropertyRNA *parm, *prop;
11104 FunctionRNA *func;
11105
11106 RNA_def_property_srna(cprop, "Nodes");
11107 srna = RNA_def_struct(brna, "Nodes", nullptr);
11108 RNA_def_struct_sdna(srna, "bNodeTree");
11109 RNA_def_struct_ui_text(srna, "Nodes", "Collection of Nodes");
11110
11111 func = RNA_def_function(srna, "new", "rna_NodeTree_node_new");
11112 RNA_def_function_ui_description(func, "Add a node to this node tree");
11114 /* XXX warning note should eventually be removed,
11115 * added this here to avoid frequent confusion with API changes from "type" to "bl_idname"
11116 */
11117 parm = RNA_def_string(
11118 func,
11119 "type",
11120 nullptr,
11121 MAX_NAME,
11122 "Type",
11123 "Type of node to add (Warning: should be same as node.bl_idname, not node.type!)");
11125 /* return value */
11126 parm = RNA_def_pointer(func, "node", "Node", "", "New node");
11127 RNA_def_function_return(func, parm);
11128
11129 func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
11130 RNA_def_function_ui_description(func, "Remove a node from this node tree");
11132 parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
11135
11136 func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
11137 RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
11139
11140 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
11141 RNA_def_property_struct_type(prop, "Node");
11143 prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", nullptr, nullptr);
11145 RNA_def_property_ui_text(prop, "Active Node", "Active node in this tree");
11146 RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, "rna_NodeTree_update");
11147}
11148
11150{
11151 StructRNA *srna;
11152 PropertyRNA *parm;
11153 FunctionRNA *func;
11154
11155 RNA_def_property_srna(cprop, "NodeLinks");
11156 srna = RNA_def_struct(brna, "NodeLinks", nullptr);
11157 RNA_def_struct_sdna(srna, "bNodeTree");
11158 RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links");
11159
11160 func = RNA_def_function(srna, "new", "rna_NodeTree_link_new");
11161 RNA_def_function_ui_description(func, "Add a node link to this node tree");
11163 parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
11165 parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
11167 RNA_def_boolean(func,
11168 "verify_limits",
11169 true,
11170 "Verify Limits",
11171 "Remove existing links if connection limit is exceeded");
11172 RNA_def_boolean(func,
11173 "handle_dynamic_sockets",
11174 false,
11175 "Handle Dynamic Sockets",
11176 "Handle node specific features like virtual sockets");
11177 /* return */
11178 parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link");
11179 RNA_def_function_return(func, parm);
11180
11181 func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
11182 RNA_def_function_ui_description(func, "remove a node link from the node tree");
11184 parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
11187
11188 func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
11189 RNA_def_function_ui_description(func, "remove all node links from the node tree");
11191}
11192
11194{
11195 StructRNA *srna;
11196 PropertyRNA *prop;
11197 FunctionRNA *func;
11198 PropertyRNA *parm;
11199
11200 static const EnumPropertyItem static_type_items[] = {
11202 "UNDEFINED",
11203 ICON_QUESTION,
11204 "Undefined",
11205 "Undefined type of nodes (can happen e.g. when a linked node tree goes missing)"},
11206 {NTREE_CUSTOM, "CUSTOM", ICON_NONE, "Custom", "Custom nodes"},
11207 {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
11208 {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
11209 {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
11210 {NTREE_GEOMETRY, "GEOMETRY", ICON_GEOMETRY_NODES, "Geometry", "Geometry nodes"},
11211 {0, nullptr, 0, nullptr, nullptr},
11212 };
11213
11214 srna = RNA_def_struct(brna, "NodeTree", "ID");
11216 srna,
11217 "Node Tree",
11218 "Node tree consisting of linked nodes used for shading, textures and compositing");
11219 RNA_def_struct_sdna(srna, "bNodeTree");
11220 RNA_def_struct_ui_icon(srna, ICON_NODETREE);
11221 RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
11222 RNA_def_struct_register_funcs(srna, "rna_NodeTree_register", "rna_NodeTree_unregister", nullptr);
11223
11224 prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
11226 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_NodeTree_color_tag_itemf");
11228 prop, "Color Tag", "Color tag of the node group which influences the header color");
11229 RNA_def_property_update(prop, NC_NODE, nullptr);
11230
11231 prop = RNA_def_property(srna, "default_group_node_width", PROP_INT, PROP_NONE);
11235 prop, "Default Group Node Width", "The width for newly created group nodes");
11236 RNA_def_property_update(prop, NC_NODE, nullptr);
11237
11238 prop = RNA_def_property(srna, "view_center", PROP_FLOAT, PROP_XYZ);
11239 RNA_def_property_array(prop, 2);
11240 RNA_def_property_float_sdna(prop, nullptr, "view_center");
11242 prop, "", "The current location (offset) of the view for this Node Tree");
11244
11245 prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
11246 RNA_def_property_ui_text(prop, "Description", "Description of the node tree");
11247
11248 /* AnimData */
11250
11251 /* Nodes Collection */
11252 prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
11253 RNA_def_property_collection_sdna(prop, nullptr, "nodes", nullptr);
11254 RNA_def_property_struct_type(prop, "Node");
11256 RNA_def_property_ui_text(prop, "Nodes", "");
11257 rna_def_nodetree_nodes_api(brna, prop);
11258
11259 /* NodeLinks Collection */
11260 prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE);
11261 RNA_def_property_collection_sdna(prop, nullptr, "links", nullptr);
11262 RNA_def_property_struct_type(prop, "NodeLink");
11263 RNA_def_property_ui_text(prop, "Links", "");
11264 rna_def_nodetree_link_api(brna, prop);
11265
11266 /* Grease Pencil */
11267 prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
11268 RNA_def_property_pointer_sdna(prop, nullptr, "gpd");
11269 RNA_def_property_struct_type(prop, "GreasePencil");
11271 prop, nullptr, nullptr, nullptr, "rna_GPencil_datablocks_annotations_poll");
11274 RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block");
11275 RNA_def_property_update(prop, NC_NODE, nullptr);
11276
11277 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
11279 RNA_def_property_enum_items(prop, static_type_items);
11281 prop,
11282 "Type",
11283 "Node Tree type (deprecated, bl_idname is the actual node tree type identifier)");
11284
11285 prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
11286 RNA_def_property_pointer_sdna(prop, nullptr, "tree_interface");
11287 RNA_def_property_struct_type(prop, "NodeTreeInterface");
11289 RNA_def_property_ui_text(prop, "Interface", "Interface declaration for this node tree");
11290 /* exposed as a function for runtime interface type properties */
11291 func = RNA_def_function(srna, "interface_update", "rna_NodeTree_interface_update");
11292 RNA_def_function_ui_description(func, "Updated node group interface");
11293 parm = RNA_def_pointer(func, "context", "Context", "", "");
11295
11296 func = RNA_def_function(srna, "contains_tree", "rna_NodeTree_contains_tree");
11298 func,
11299 "Check if the node tree contains another. Used to avoid creating recursive node groups.");
11300 parm = RNA_def_pointer(
11301 func, "sub_tree", "NodeTree", "Node Tree", "Node tree for recursive check");
11303 parm = RNA_def_property(func, "contained", PROP_BOOLEAN, PROP_NONE);
11304 RNA_def_function_return(func, parm);
11305
11306 /* registration */
11307 prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
11308 RNA_def_property_string_sdna(prop, nullptr, "typeinfo->idname");
11310 RNA_def_property_ui_text(prop, "ID Name", "");
11311
11312 prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
11313 RNA_def_property_string_sdna(prop, nullptr, "typeinfo->ui_name");
11315 RNA_def_property_ui_text(prop, "Label", "The node tree label");
11316
11317 prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
11318 RNA_def_property_string_sdna(prop, nullptr, "typeinfo->ui_description");
11320
11321 prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
11322 RNA_def_property_enum_sdna(prop, nullptr, "typeinfo->ui_icon");
11324 RNA_def_property_enum_default(prop, ICON_NODETREE);
11326 RNA_def_property_ui_text(prop, "Icon", "The node tree icon");
11327
11328 /* poll */
11329 func = RNA_def_function(srna, "poll", nullptr);
11330 RNA_def_function_ui_description(func, "Check visibility in the editor");
11332 parm = RNA_def_pointer(func, "context", "Context", "", "");
11334 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
11335
11336 /* update */
11337 func = RNA_def_function(srna, "update", nullptr);
11338 RNA_def_function_ui_description(func, "Update on editor changes");
11340
11341 /* get a node tree from context */
11342 func = RNA_def_function(srna, "get_from_context", nullptr);
11343 RNA_def_function_ui_description(func, "Get a node tree from the context");
11345 parm = RNA_def_pointer(func, "context", "Context", "", "");
11347 parm = RNA_def_pointer(
11348 func, "result_1", "NodeTree", "Node Tree", "Active node tree from context");
11349 RNA_def_function_output(func, parm);
11350 parm = RNA_def_pointer(
11351 func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree");
11352 RNA_def_function_output(func, parm);
11353 parm = RNA_def_pointer(
11354 func, "result_3", "ID", "From ID", "Original ID data-block selected from the context");
11355 RNA_def_function_output(func, parm);
11356
11357 /* Check for support of a socket type with a type identifier. */
11358 func = RNA_def_function(srna, "valid_socket_type", nullptr);
11359 RNA_def_function_ui_description(func, "Check if the socket type is valid for the node tree");
11361 parm = RNA_def_string(
11362 func, "idname", "NodeSocket", MAX_NAME, "Socket Type", "Identifier of the socket type");
11364 RNA_def_function_return(func, RNA_def_boolean(func, "valid", false, "", ""));
11365
11366 func = RNA_def_function(
11367 srna, "debug_lazy_function_graph", "rna_NodeTree_debug_lazy_function_graph");
11368 RNA_def_function_ui_description(func, "Get the internal lazy-function graph for this node tree");
11370 parm = RNA_def_string(func, "dot_graph", nullptr, INT32_MAX, "Dot Graph", "Graph in dot format");
11373 RNA_def_function_output(func, parm);
11374}
11375
11377{
11378 StructRNA *srna;
11379 PropertyRNA *prop;
11380
11381 srna = RNA_def_struct(brna, "CompositorNodeTree", "NodeTree");
11383 srna, "Compositor Node Tree", "Node tree consisting of linked nodes used for compositing");
11384 RNA_def_struct_sdna(srna, "bNodeTree");
11385 RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
11386
11387 prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE);
11388 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NTREE_VIEWER_BORDER);
11390 prop, "Viewer Region", "Use boundaries for viewer nodes and composite backdrop");
11391 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update");
11392}
11393
11395{
11396 StructRNA *srna;
11397 FunctionRNA *func;
11398 PropertyRNA *parm;
11399
11400 srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
11402 srna,
11403 "Shader Node Tree",
11404 "Node tree consisting of linked nodes used for materials (and other shading data-blocks)");
11405 RNA_def_struct_sdna(srna, "bNodeTree");
11406 RNA_def_struct_ui_icon(srna, ICON_MATERIAL);
11407
11408 func = RNA_def_function(srna, "get_output_node", "ntreeShaderOutputNode");
11410 "Return active shader output node for the specified target");
11411 parm = RNA_def_enum(
11412 func, "target", prop_shader_output_target_items, SHD_OUTPUT_ALL, "Target", "");
11414 parm = RNA_def_pointer(func, "node", "ShaderNode", "Node", "");
11415 RNA_def_function_return(func, parm);
11416}
11417
11419{
11420 StructRNA *srna;
11421
11422 srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree");
11424 srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures");
11425 RNA_def_struct_sdna(srna, "bNodeTree");
11426 RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
11427}
11428
11430{
11431 StructRNA *srna;
11432 PropertyRNA *prop;
11433
11434 srna = RNA_def_struct(brna, "GeometryNodeTree", "NodeTree");
11436 srna, "Geometry Node Tree", "Node tree consisting of linked nodes used for geometries");
11437 RNA_def_struct_sdna(srna, "bNodeTree");
11438 RNA_def_struct_ui_icon(srna, ICON_NODETREE);
11439
11440 prop = RNA_def_property(srna, "is_tool", PROP_BOOLEAN, PROP_NONE);
11441 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GEO_NODE_ASSET_TOOL);
11443 RNA_def_property_ui_text(prop, "Tool", "The node group is used as a tool");
11445 prop, "rna_GeometryNodeTree_is_tool_get", "rna_GeometryNodeTree_is_tool_set");
11446 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11447
11448 prop = RNA_def_property(srna, "is_modifier", PROP_BOOLEAN, PROP_NONE);
11451 RNA_def_property_ui_text(prop, "Modifier", "The node group is used as a geometry modifier");
11453 prop, "rna_GeometryNodeTree_is_modifier_get", "rna_GeometryNodeTree_is_modifier_set");
11454 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11455
11456 prop = RNA_def_property(srna, "is_mode_object", PROP_BOOLEAN, PROP_NONE);
11457 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GEO_NODE_ASSET_EDIT);
11459 RNA_def_property_ui_text(prop, "Edit", "The node group is used in object mode");
11461 prop, "rna_GeometryNodeTree_is_mode_object_get", "rna_GeometryNodeTree_is_mode_object_set");
11462 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11463
11464 prop = RNA_def_property(srna, "is_mode_edit", PROP_BOOLEAN, PROP_NONE);
11465 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GEO_NODE_ASSET_EDIT);
11467 RNA_def_property_ui_text(prop, "Edit", "The node group is used in edit mode");
11469 prop, "rna_GeometryNodeTree_is_mode_edit_get", "rna_GeometryNodeTree_is_mode_edit_set");
11470 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11471
11472 prop = RNA_def_property(srna, "is_mode_sculpt", PROP_BOOLEAN, PROP_NONE);
11475 RNA_def_property_ui_text(prop, "Sculpt", "The node group is used in sculpt mode");
11477 prop, "rna_GeometryNodeTree_is_mode_sculpt_get", "rna_GeometryNodeTree_is_mode_sculpt_set");
11478 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11479
11480 prop = RNA_def_property(srna, "is_type_mesh", PROP_BOOLEAN, PROP_NONE);
11481 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GEO_NODE_ASSET_MESH);
11483 RNA_def_property_ui_text(prop, "Mesh", "The node group is used for meshes");
11485 prop, "rna_GeometryNodeTree_is_type_mesh_get", "rna_GeometryNodeTree_is_type_mesh_set");
11486 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11487
11488 prop = RNA_def_property(srna, "is_type_curve", PROP_BOOLEAN, PROP_NONE);
11491 RNA_def_property_ui_text(prop, "Curves", "The node group is used for curves");
11493 prop, "rna_GeometryNodeTree_is_type_curve_get", "rna_GeometryNodeTree_is_type_curve_set");
11494 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11495
11496 prop = RNA_def_property(srna, "is_type_point_cloud", PROP_BOOLEAN, PROP_NONE);
11499 RNA_def_property_ui_text(prop, "Point Cloud", "The node group is used for point clouds");
11501 "rna_GeometryNodeTree_is_type_point_cloud_get",
11502 "rna_GeometryNodeTree_is_type_point_cloud_set");
11503 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11504
11505 prop = RNA_def_property(srna, "use_wait_for_click", PROP_BOOLEAN, PROP_NONE);
11509 "Wait for Click",
11510 "Wait for mouse click input before running the operator from a menu");
11512 "rna_GeometryNodeTree_use_wait_for_click_get",
11513 "rna_GeometryNodeTree_use_wait_for_click_set");
11514 RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
11515}
11516
11518 const char *struct_name,
11519 const char *base_name,
11520 void (*def_func)(StructRNA *))
11521{
11522 StructRNA *srna;
11523 FunctionRNA *func;
11524 PropertyRNA *parm;
11525
11526 /* XXX hack, want to avoid "NodeInternal" prefix,
11527 * so use "Node" in NOD_static_types.h and replace here */
11528 if (STREQ(base_name, "Node")) {
11529 base_name = "NodeInternal";
11530 }
11531
11532 srna = RNA_def_struct(brna, struct_name, base_name);
11533 RNA_def_struct_sdna(srna, "bNode");
11534
11535 func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
11536 RNA_def_function_ui_description(func, "True if a registered node type");
11538 parm = RNA_def_boolean(func, "result", false, "Result", "");
11539 RNA_def_function_return(func, parm);
11540
11541 /* Exposes the socket template type lists in RNA for use in scripts
11542 * Only used in the C nodes and not exposed in the base class to
11543 * keep the namespace clean for py-nodes. */
11544 func = RNA_def_function(srna, "input_template", "rna_NodeInternal_input_template");
11545 RNA_def_function_ui_description(func, "Input socket template");
11547 parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
11548 RNA_def_property_ui_text(parm, "Index", "");
11550 parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
11551 RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
11553 RNA_def_function_return(func, parm);
11554
11555 func = RNA_def_function(srna, "output_template", "rna_NodeInternal_output_template");
11556 RNA_def_function_ui_description(func, "Output socket template");
11558 parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
11559 RNA_def_property_ui_text(parm, "Index", "");
11561 parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
11562 RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
11564 RNA_def_function_return(func, parm);
11565
11566 if (def_func) {
11567 def_func(srna);
11568 }
11569
11570 return srna;
11571}
11572
11574{
11575 StructRNA *srna;
11576
11577 srna = RNA_def_struct(brna, "NodeInstanceHash", nullptr);
11578 RNA_def_struct_ui_text(srna, "Node Instance Hash", "Hash table containing node instance data");
11579
11580 /* XXX This type is a stub for now, only used to store instance hash in the context.
11581 * Eventually could use a StructRNA pointer to define a specific data type
11582 * and expose lookup functions.
11583 */
11584}
11585
11587{
11588 StructRNA *srna;
11589
11590 rna_def_node(brna);
11591 rna_def_node_link(brna);
11592
11594 rna_def_shader_node(brna);
11599
11600 rna_def_nodetree(brna);
11601
11606
11608 rna_def_repeat_item(brna);
11616
11617# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
11618 { \
11619 srna = define_specific_node(brna, #Category #StructName, #Category, DefFunc); \
11620 if (ID == CMP_NODE_OUTPUT_FILE) { \
11621 /* needs brna argument, can't use NOD_static_types.h */ \
11622 def_cmp_output_file(brna, srna); \
11623 } \
11624 }
11625
11626 /* hack, don't want to add include path to RNA just for this, since in the future RNA types
11627 * for nodes should be defined locally at runtime anyway ...
11628 */
11630
11631 /* Node group types need to be defined for shader, compositor, texture, geometry nodes
11632 * individually. Cannot use the static types header for this, since they share the same int id.
11633 */
11634 define_specific_node(brna, "ShaderNodeGroup", "ShaderNode", def_group);
11635 define_specific_node(brna, "CompositorNodeGroup", "CompositorNode", def_group);
11636 define_specific_node(brna, "TextureNodeGroup", "TextureNode", def_group);
11637 define_specific_node(brna, "GeometryNodeGroup", "GeometryNode", def_group);
11638 def_custom_group(brna,
11639 "ShaderNodeCustomGroup",
11640 "ShaderNode",
11641 "Shader Custom Group",
11642 "Custom Shader Group Node for Python nodes",
11643 "rna_ShaderNodeCustomGroup_register");
11644 def_custom_group(brna,
11645 "CompositorNodeCustomGroup",
11646 "CompositorNode",
11647 "Compositor Custom Group",
11648 "Custom Compositor Group Node for Python nodes",
11649 "rna_CompositorNodeCustomGroup_register");
11650 def_custom_group(brna,
11651 "NodeCustomGroup",
11652 "Node",
11653 "Custom Group",
11654 "Base node type for custom registered node group types",
11655 "rna_NodeCustomGroup_register");
11656 def_custom_group(brna,
11657 "GeometryNodeCustomGroup",
11658 "GeometryNode",
11659 "Geometry Custom Group",
11660 "Custom Geometry Group Node for Python nodes",
11661 "rna_GeometryNodeCustomGroup_register");
11662
11663 /* special socket types */
11673 rna_def_bake_items(brna);
11675
11677}
11678
11679/* clean up macro definition */
11680# undef NODE_DEFINE_SUBTYPES
11681
11682#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:140
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
void id_us_plus(ID *id)
Definition lib_id.cc:351
void id_us_min(ID *id)
Definition lib_id.cc:359
const char * BKE_main_blendfile_path_from_global()
Definition main.cc:837
#define NODE_TYPES_BEGIN(ntype)
Definition BKE_node.hh:597
#define NODE_CLASS_OUTPUT
Definition BKE_node.hh:405
#define NODE_UNDEFINED
Definition BKE_node.hh:798
constexpr int GROUP_NODE_MIN_WIDTH
Definition BKE_node.hh:1812
#define CMP_CHAN_RGB
Definition BKE_node.hh:1121
constexpr int GROUP_NODE_DEFAULT_WIDTH
Definition BKE_node.hh:1810
#define SH_NODE_TEX_IMAGE
Definition BKE_node.hh:930
#define NODE_CUSTOM_GROUP
Definition BKE_node.hh:807
#define FN_NODE_RANDOM_VALUE
Definition BKE_node.hh:1398
constexpr int GROUP_NODE_MAX_WIDTH
Definition BKE_node.hh:1811
#define SH_NODE_MAP_RANGE
Definition BKE_node.hh:985
#define SH_NODE_TEX_ENVIRONMENT
Definition BKE_node.hh:940
#define NODE_CUSTOM
Definition BKE_node.hh:799
#define NODE_GROUP_OUTPUT
Definition BKE_node.hh:806
#define FN_NODE_COMPARE
Definition BKE_node.hh:1389
#define NODE_TREE_TYPES_BEGIN(ntype)
Definition BKE_node.hh:499
#define NODE_SOCKET_TYPES_BEGIN(stype)
Definition BKE_node.hh:623
#define SH_NODE_MIX
Definition BKE_node.hh:996
#define NODE_TREE_TYPES_END
Definition BKE_node.hh:508
#define NODE_FRAME
Definition BKE_node.hh:803
#define NODE_SOCKET_TYPES_END
Definition BKE_node.hh:632
#define NODE_TYPES_END
Definition BKE_node.hh:605
#define SH_NODE_SCRIPT
Definition BKE_node.hh:954
#define CMP_CHAN_A
Definition BKE_node.hh:1122
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:125
void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain)
Definition scene.cc:2573
void BKE_texture_pointdensity_init_data(struct PointDensity *pd)
Definition texture.cc:600
void BKE_texture_pointdensity_free_data(struct PointDensity *pd)
Definition texture.cc:652
void BLF_cache_clear()
Definition blf.cc:99
#define BLI_assert(a)
Definition BLI_assert.h:50
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:57
void BLI_kdtree_nd_ free(KDTree *tree)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:331
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
int BLI_listbase_count_at_most(const struct ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:130
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:370
#define M_PI_2
#define DEG2RADF(_deg)
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.c:40
int bool BLI_str_startswith(const char *__restrict str, const char *__restrict start) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
#define STRNCPY(dst, src)
Definition BLI_string.h:593
#define SNPRINTF(dst, format,...)
Definition BLI_string.h:597
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 STREQ(a, b)
#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_id(const ID *id)
ID * DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
@ ID_RECALC_NTREE_OUTPUT
Definition DNA_ID.h:1122
@ 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
#define MAX_NAME
Definition DNA_defs.h:50
@ IMA_ANIM_ALWAYS
@ IMA_SRC_FILE
@ IMA_SRC_MOVIE
@ IMA_SRC_GENERATED
@ IMA_SRC_SEQUENCE
@ IMA_TYPE_MULTILAYER
@ NTREE_TEXTURE
@ NTREE_CUSTOM
@ NTREE_SHADER
@ NTREE_GEOMETRY
@ NTREE_COMPOSIT
@ NTREE_UNDEFINED
@ NODE_VECTOR_MATH_NORMALIZE
@ NODE_VECTOR_MATH_LENGTH
@ 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_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
@ SHD_ATTRIBUTE_VIEW_LAYER
@ SHD_ATTRIBUTE_OBJECT
@ SHD_ATTRIBUTE_GEOMETRY
@ SHD_ATTRIBUTE_INSTANCER
@ GEO_NODE_MESH_CIRCLE_FILL_NGON
@ GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN
@ GEO_NODE_MESH_CIRCLE_FILL_NONE
@ 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
#define SHD_SHEEN_ASHIKHMIN
@ 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
@ SHD_POINTDENSITY_COLOR_PARTSPEED
@ SHD_POINTDENSITY_COLOR_PARTVEL
@ SHD_POINTDENSITY_COLOR_PARTAGE
@ CMP_NODE_BLUR_ASPECT_NONE
@ CMP_NODE_BLUR_ASPECT_X
@ CMP_NODE_BLUR_ASPECT_Y
@ NODE_OPTIONS
@ NODE_DO_OUTPUT
@ NODE_HIDDEN
@ NODE_ACTIVE_TEXTURE
@ NODE_CUSTOM_COLOR
@ NODE_MUTED
@ NODE_PREVIEW
@ SHD_WAVE_RINGS_DIRECTION_Z
@ SHD_WAVE_RINGS_DIRECTION_Y
@ SHD_WAVE_RINGS_DIRECTION_X
@ SHD_WAVE_RINGS_DIRECTION_SPHERICAL
@ 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
@ 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_POINT_CLOUD
@ GEO_NODE_ASSET_SCULPT
@ GEO_NODE_ASSET_WAIT_FOR_CURSOR
@ GEO_NODE_ASSET_CURVE
@ GEO_NODE_ASSET_EDIT
@ GEO_NODE_ASSET_MODIFIER
@ GEO_NODE_ASSET_TOOL
@ GEO_NODE_ASSET_OBJECT
@ SHD_CONDUCTOR_F82
@ SHD_PHYSICAL_CONDUCTOR
@ SHD_OUTPUT_CYCLES
@ SHD_OUTPUT_ALL
@ SHD_OUTPUT_EEVEE
@ SHD_GABOR_TYPE_3D
@ SHD_GABOR_TYPE_2D
@ SHD_PHASE_DRAINE
@ SHD_PHASE_RAYLEIGH
@ SHD_PHASE_HENYEY_GREENSTEIN
@ SHD_PHASE_MIE
@ SHD_PHASE_FOURNIER_FORAND
@ NODE_LINK_MUTED
@ NODE_LINK_VALID
@ GEO_NODE_CURVE_HANDLE_RIGHT
@ GEO_NODE_CURVE_HANDLE_LEFT
@ NODE_CLAMP_RANGE
@ NODE_CLAMP_MINMAX
@ SHD_TANGENT_UVMAP
@ SHD_TANGENT_RADIAL
@ CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE
@ CMP_NODE_CRYPTOMATTE_SOURCE_RENDER
@ SHD_TOON_GLOSSY
@ SHD_TOON_DIFFUSE
@ 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
@ NTREE_VIEWER_BORDER
@ SHD_MATH_CLAMP
@ SHD_SUBSURFACE_BURLEY
@ SHD_SUBSURFACE_RANDOM_WALK_SKIN
@ SHD_SUBSURFACE_RANDOM_WALK
@ SHD_INTERP_LINEAR
@ SHD_INTERP_SMART
@ SHD_INTERP_CUBIC
@ SHD_INTERP_CLOSEST
@ NODE_SCRIPT_AUTO_UPDATE
@ SHD_SPACE_BLENDER_OBJECT
@ SHD_SPACE_OBJECT
@ SHD_SPACE_TANGENT
@ SHD_SPACE_WORLD
@ SHD_SPACE_BLENDER_WORLD
@ NODE_SCRIPT_INTERNAL
@ NODE_SCRIPT_EXTERNAL
@ SHD_PRINCIPLED_HAIR_HUANG
@ SHD_PRINCIPLED_HAIR_CHIANG
@ SHD_VECT_TRANSFORM_SPACE_WORLD
@ SHD_VECT_TRANSFORM_SPACE_OBJECT
@ SHD_VECT_TRANSFORM_SPACE_CAMERA
@ FN_NODE_ROTATE_EULER_TYPE_EULER
@ FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE
@ SHD_PRINCIPLED_HAIR_REFLECTANCE
@ SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION
@ SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION
@ SHD_SKY_PREETHAM
@ SHD_SKY_NISHITA
@ SHD_SKY_HOSEK
@ SHD_TANGENT_AXIS_Y
@ SHD_TANGENT_AXIS_X
@ SHD_TANGENT_AXIS_Z
@ CMP_NODE_MAP_UV_FILTERING_NEAREST
@ CMP_NODE_MAP_UV_FILTERING_ANISOTROPIC
@ SHD_GLOSSY_BECKMANN
@ SHD_GLOSSY_GGX
@ SHD_GLOSSY_ASHIKHMIN_SHIRLEY
@ SHD_GLOSSY_MULTI_GGX
@ CMP_NODE_CHANNEL_MATTE_CS_YUV
@ CMP_NODE_CHANNEL_MATTE_CS_RGB
@ CMP_NODE_CHANNEL_MATTE_CS_HSV
@ CMP_NODE_CHANNEL_MATTE_CS_YCC
@ CMP_NODE_WRAP_X
@ CMP_NODE_WRAP_NONE
@ CMP_NODE_WRAP_Y
@ CMP_NODE_WRAP_XY
@ SHD_AO_INSIDE
@ SHD_AO_LOCAL
@ SHD_POINTDENSITY_COLOR_VERTNOR
@ SHD_POINTDENSITY_COLOR_VERTWEIGHT
@ SHD_POINTDENSITY_COLOR_VERTCOL
@ GEO_NODE_CURVE_SAMPLE_FACTOR
@ GEO_NODE_CURVE_SAMPLE_LENGTH
@ SHD_PROJ_TUBE
@ SHD_PROJ_SPHERE
@ SHD_PROJ_BOX
@ SHD_PROJ_FLAT
@ CMP_NODE_PLANE_TRACK_DEFORM_FLAG_MOTION_BLUR
@ NODE_MAP_RANGE_STEPPED
@ NODE_MAP_RANGE_SMOOTHERSTEP
@ NODE_MAP_RANGE_SMOOTHSTEP
@ NODE_MAP_RANGE_LINEAR
@ SHD_VORONOI_EUCLIDEAN
@ SHD_VORONOI_CHEBYCHEV
@ SHD_VORONOI_MANHATTAN
@ SHD_VORONOI_MINKOWSKI
@ GEO_NODE_BAKE_ITEM_IS_ATTRIBUTE
@ SHD_POINTDENSITY_SOURCE_PSYS
@ SHD_POINTDENSITY_SOURCE_OBJECT
@ CMP_NODE_MASK_FLAG_SIZE_FIXED
@ CMP_NODE_MASK_FLAG_NO_FEATHER
@ CMP_NODE_MASK_FLAG_SIZE_FIXED_SCENE
@ CMP_NODE_MASK_FLAG_MOTION_BLUR
#define CMP_NODE_PLANE_TRACK_DEFORM_MOTION_BLUR_SAMPLES_MAX
@ 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
@ CMP_NODEFLAG_BLUR_VARIABLE_SIZE
@ CMP_NODEFLAG_BLUR_EXTEND_BOUNDS
@ CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT
@ CMP_NODE_SETALPHA_MODE_REPLACE_ALPHA
@ CMP_NODE_SETALPHA_MODE_APPLY
@ NODE_MIX_MODE_UNIFORM
@ NODE_MIX_MODE_NON_UNIFORM
@ SHD_PROJ_MIRROR_BALL
@ SHD_PROJ_EQUIRECTANGULAR
@ 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
@ CMP_NODE_OUTPUT_IGNORE_ALPHA
@ SOCK_MULTI_INPUT
@ 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_POINTDENSITY_SPACE_WORLD
@ SHD_POINTDENSITY_SPACE_OBJECT
@ SHD_MIXRGB_USE_ALPHA
@ SHD_MIXRGB_CLAMP
@ SHD_NOISE_HYBRID_MULTIFRACTAL
@ SHD_NOISE_FBM
@ SHD_NOISE_MULTIFRACTAL
@ SHD_NOISE_RIDGED_MULTIFRACTAL
@ SHD_NOISE_HETERO_TERRAIN
@ SHD_VORONOI_F2
@ SHD_VORONOI_SMOOTH_F1
@ SHD_VORONOI_DISTANCE_TO_EDGE
@ SHD_VORONOI_F1
@ SHD_VORONOI_N_SPHERE_RADIUS
eNodeSocketDatatype
@ SOCK_INT
@ SOCK_TEXTURE
@ SOCK_VECTOR
@ SOCK_BOOLEAN
@ SOCK_MATERIAL
@ SOCK_MATRIX
@ SOCK_FLOAT
@ SOCK_IMAGE
@ SOCK_COLLECTION
@ SOCK_GEOMETRY
@ SOCK_ROTATION
@ SOCK_OBJECT
@ SOCK_STRING
@ SOCK_RGBA
@ SOCK_MENU
@ NODE_COMBSEP_COLOR_RGB
@ NODE_COMBSEP_COLOR_HSV
@ NODE_COMBSEP_COLOR_HSL
@ SHD_VECT_TRANSFORM_TYPE_VECTOR
@ SHD_VECT_TRANSFORM_TYPE_NORMAL
@ SHD_VECT_TRANSFORM_TYPE_POINT
@ NODE_WARNING_PROPAGATION_NONE
@ NODE_WARNING_PROPAGATION_ONLY_ERRORS_AND_WARNINGS
@ NODE_WARNING_PROPAGATION_ONLY_ERRORS
@ NODE_WARNING_PROPAGATION_ALL
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_CROSS
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_BOX
@ GEO_NODE_LINEAR_GIZMO_DRAW_STYLE_ARROW
@ NODE_FRAME_SHRINK
@ CMP_NODE_COLOR_BALANCE_LGG
@ CMP_NODE_COLOR_BALANCE_ASC_CDL
@ CMP_NODE_COLOR_BALANCE_WHITEPOINT
@ SHD_BLEND_DIAGONAL
@ SHD_BLEND_EASING
@ SHD_BLEND_LINEAR
@ SHD_BLEND_RADIAL
@ SHD_BLEND_QUADRATIC_SPHERE
@ SHD_BLEND_SPHERICAL
@ SHD_BLEND_QUADRATIC
@ 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
@ SHD_WAVE_BANDS_DIRECTION_Y
@ SHD_WAVE_BANDS_DIRECTION_X
@ SHD_WAVE_BANDS_DIRECTION_Z
@ SHD_WAVE_BANDS_DIRECTION_DIAGONAL
@ CMP_NODE_TRACK_POSITION_RELATIVE_START
@ CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME
@ CMP_NODE_TRACK_POSITION_RELATIVE_FRAME
@ CMP_NODE_TRACK_POSITION_ABSOLUTE
@ 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
@ GEO_NODE_CURVE_HANDLE_ALIGN
@ GEO_NODE_CURVE_HANDLE_AUTO
@ GEO_NODE_CURVE_HANDLE_FREE
@ GEO_NODE_CURVE_HANDLE_VECTOR
@ 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_WAVE_PROFILE_SIN
@ SHD_WAVE_PROFILE_TRI
@ SHD_WAVE_PROFILE_SAW
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_TEXTURE
@ NODE_MAPPING_TYPE_NORMAL
@ 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
@ NODE_IES_EXTERNAL
@ NODE_IES_INTERNAL
@ CMP_NODE_STABILIZE_FLAG_INVERSE
@ SHD_IMAGE_EXTENSION_MIRROR
@ SHD_IMAGE_EXTENSION_CLIP
@ SHD_IMAGE_EXTENSION_REPEAT
@ SHD_IMAGE_EXTENSION_EXTEND
@ SHD_WAVE_RINGS
@ SHD_WAVE_BANDS
@ 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
@ 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
@ TEXMAP_CLIP_MIN
@ TEXMAP_CLIP_MAX
@ TEX_PD_OBJECTSPACE
@ 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_OBJECT
@ TEX_PD_PSYS
@ RPT_ERROR_INVALID_INPUT
void ED_node_tree_propagate_change(const bContext *C, Main *bmain, bNodeTree *ntree)
Definition node_edit.cc:492
void ED_node_type_draw_color(const char *idname, float *r_color)
Definition drawnode.cc:1620
void ED_init_custom_node_type(blender::bke::bNodeType *ntype)
Definition drawnode.cc:1100
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)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
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)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders Vector Displace the surface along an arbitrary direction White Noise Return a random value or color based on an input seed Float Map an input float to a curve and outputs a float value def_sh_combsep_color
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position def_clamp
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels def_sh_vertex_color
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color def_vector_curve
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum def_vector_math
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise def_sh_tex_gradient
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces def_sh_script
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders def_sh_vector_displacement
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders Vector Displace the surface along an arbitrary direction White Noise Return a random value or color based on an input seed def_float_curve
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks def_sh_tex_coord
def_group
def_group_output
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value def_sh_normal_map
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its and blue Hue Saturation Apply a color transformation in the HSV color model Specular Similar to the Principled BSDF node but uses the specular workflow instead of which functions by specifying the so the result may not be physically accurate def_sh_output
Group Output data from inside of a node group A color picker def_mix_rgb
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture def_sh_tex_gabor
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud def_sh_tex_wireframe
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector def_sh_tex_magic
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells def_sh_tex_brick
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components def_sh_bevel
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes def_sh_vect_transform
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture def_sh_tex_voronoi
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block def_sh_tex_image
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders Vector Displace the surface along an arbitrary direction def_sh_tex_white_noise
void ntreeTexCheckCyclics(struct bNodeTree *ntree)
#define RNA_POINTER_INVALIDATE(ptr)
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:396
@ PARM_RNAPTR
Definition RNA_types.hh:399
@ PARM_REQUIRED
Definition RNA_types.hh:397
@ FUNC_USE_REPORTS
Definition RNA_types.hh:680
@ FUNC_USE_SELF_TYPE
Definition RNA_types.hh:675
@ FUNC_NO_SELF
Definition RNA_types.hh:673
@ FUNC_REGISTER
Definition RNA_types.hh:687
@ FUNC_USE_MAIN
Definition RNA_types.hh:678
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:679
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:667
@ FUNC_REGISTER_OPTIONAL
Definition RNA_types.hh:689
@ FUNC_ALLOW_WRITE
Definition RNA_types.hh:695
int(*)(PointerRNA *ptr, void *data, bool *have_function) StructValidateFunc
Definition RNA_types.hh:746
@ PROP_FLOAT
Definition RNA_types.hh:67
@ PROP_BOOLEAN
Definition RNA_types.hh:65
@ PROP_ENUM
Definition RNA_types.hh:69
@ PROP_INT
Definition RNA_types.hh:66
@ PROP_STRING
Definition RNA_types.hh:68
@ PROP_POINTER
Definition RNA_types.hh:70
@ PROP_COLLECTION
Definition RNA_types.hh:71
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:528
void(*)(void *data) StructFreeFunc
Definition RNA_types.hh:751
int(*)(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *list) StructCallbackFunc
Definition RNA_types.hh:747
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:355
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:363
PropertyFlag
Definition RNA_types.hh:201
@ PROP_THICK_WRAP
Definition RNA_types.hh:312
@ PROP_PATH_OUTPUT
Definition RNA_types.hh:340
@ PROP_DYNAMIC
Definition RNA_types.hh:317
@ PROP_ANIMATABLE
Definition RNA_types.hh:220
@ PROP_NEVER_UNLINK
Definition RNA_types.hh:273
@ PROP_EDITABLE
Definition RNA_types.hh:207
@ PROP_ENUM_FLAG
Definition RNA_types.hh:293
@ PROP_REGISTER_OPTIONAL
Definition RNA_types.hh:301
@ PROP_ENUM_NO_CONTEXT
Definition RNA_types.hh:319
@ PROP_NEVER_NULL
Definition RNA_types.hh:266
@ PROP_NO_DEG_UPDATE
Definition RNA_types.hh:328
@ PROP_ENUM_NO_TRANSLATE
Definition RNA_types.hh:321
@ PROP_REGISTER
Definition RNA_types.hh:300
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:284
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:253
#define RNA_ENUM_ITEM_HEADING(name, description)
Definition RNA_types.hh:522
@ PROP_DIRECTION
Definition RNA_types.hh:165
@ PROP_XYZ
Definition RNA_types.hh:172
@ PROP_DISTANCE
Definition RNA_types.hh:159
@ PROP_COLOR
Definition RNA_types.hh:163
@ PROP_ANGLE
Definition RNA_types.hh:155
@ PROP_EULER
Definition RNA_types.hh:169
@ PROP_COORDS
Definition RNA_types.hh:177
@ PROP_COLOR_TEMPERATURE
Definition RNA_types.hh:193
@ PROP_NONE
Definition RNA_types.hh:136
@ PROP_PERCENTAGE
Definition RNA_types.hh:153
@ PROP_FACTOR
Definition RNA_types.hh:154
@ PROP_COLOR_GAMMA
Definition RNA_types.hh:175
@ PROP_TRANSLATION
Definition RNA_types.hh:164
@ PROP_XYZ_LENGTH
Definition RNA_types.hh:173
@ PROP_UNSIGNED
Definition RNA_types.hh:152
@ PROP_FILEPATH
Definition RNA_types.hh:139
constexpr PointerRNA PointerRNA_NULL
Definition RNA_types.hh:45
#define NC_WINDOW
Definition WM_types.hh:342
#define NC_NODE
Definition WM_types.hh:361
#define ND_OB_ACTIVE
Definition WM_types.hh:407
#define ND_DISPLAY
Definition WM_types.hh:458
#define NC_SCENE
Definition WM_types.hh:345
#define ND_NODES
Definition WM_types.hh:403
#define NA_EDITED
Definition WM_types.hh:550
#define NC_IMAGE
Definition WM_types.hh:351
#define ND_NODE_ASSET_DATA
Definition WM_types.hh:481
#define NA_SELECTED
Definition WM_types.hh:555
volatile int lock
PyObject * self
StringRefNull copy_string(StringRef str)
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
OperationNode * node
const char * label
const Depsgraph * depsgraph
int len
KDTree_3d * tree
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
RenderEngineType * RE_engines_find(const char *idname)
RenderEngine * RE_engine_create(RenderEngineType *type)
void RE_engine_free(RenderEngine *engine)
void *(* MEM_mallocN)(size_t len, const char *str)
Definition mallocn.cc:44
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
void node_tree_set_output(bNodeTree *ntree)
Definition node.cc:3650
bool node_is_parent_and_child(const bNode *parent, const bNode *child)
Definition node.cc:2491
const bNodeZoneType * zone_type_by_node_type(const int node_type)
void node_attach_node(bNodeTree *ntree, bNode *node, bNode *parent)
Definition node.cc:3107
void node_set_active(bNodeTree *ntree, bNode *node)
Definition node.cc:3896
void node_detach_node(bNodeTree *ntree, bNode *node)
Definition node.cc:3122
const char * node_type_find_alias(const char *idname)
Definition node.cc:1679
bool node_link_is_hidden(const bNodeLink *link)
Definition node.cc:2993
void node_remove_socket_links(bNodeTree *ntree, bNodeSocket *sock)
Definition node.cc:2984
void node_remove_node(Main *bmain, bNodeTree *ntree, bNode *node, bool do_id_user)
Definition node.cc:3545
void node_update_asset_metadata(bNodeTree &node_tree)
Definition node.cc:1305
bool node_group_poll(const bNodeTree *nodetree, const bNodeTree *grouptree, const char **r_disabled_hint)
bNodeLink * node_add_link(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock)
Definition node.cc:2912
bool node_find_node_try(bNodeTree *ntree, bNodeSocket *sock, bNode **r_node, int *r_sockindex)
Definition node.cc:2459
void node_tree_type_free_link(const bNodeTreeType *nt)
Definition node.cc:1652
bNode * node_get_active(bNodeTree *ntree)
Definition node.cc:3849
bNodeType * node_type_find(const char *idname)
Definition node.cc:1667
bNode * node_add_node(const bContext *C, bNodeTree *ntree, const char *idname)
Definition node.cc:2617
bNodeSocketType * node_socket_type_find(const char *idname)
Definition node.cc:1763
const char * node_socket_type_label(const bNodeSocketType *stype)
Definition node.cc:1811
void node_tree_type_add(bNodeTreeType *nt)
Definition node.cc:1633
void node_remove_socket(bNodeTree *ntree, bNode *node, bNodeSocket *sock)
Definition node.cc:2405
void node_remove_link(bNodeTree *ntree, bNodeLink *link)
Definition node.cc:2958
const char * node_static_socket_type(int type, int subtype)
Definition node.cc:2126
bNodeSocket * node_add_socket(bNodeTree *ntree, bNode *node, eNodeSocketInOut in_out, const char *idname, const char *identifier, const char *name)
Definition node.cc:2095
bool node_set_selected(bNode *node, bool select)
Definition node.cc:3863
void node_internal_links(bNode *node, bNodeLink **r_links, int *r_len)
Definition node.cc:4012
void node_clear_active(bNodeTree *ntree)
Definition node.cc:3885
void node_unregister_type(bNodeType *ntype)
Definition node.cc:1726
void node_tag_update_id(bNode *node)
Definition node.cc:4007
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
bool node_tree_contains_tree(const bNodeTree *tree_to_search_in, const bNodeTree *tree_to_search_for)
Definition node.cc:3827
int node_socket_link_limit(const bNodeSocket *sock)
Definition node.cc:3925
bNodeTreeType * node_tree_type_find(const char *idname)
Definition node.cc:1621
int node_count_socket_links(const bNodeTree *ntree, const bNodeSocket *sock)
Definition node.cc:3838
void node_type_base_custom(bNodeType *ntype, const char *idname, const char *name, const char *enum_name, short nclass)
Definition node.cc:4364
void node_dimensions_get(const bNode *node, float *r_width, float *r_height)
Definition node.cc:4001
bool node_tree_is_registered(const bNodeTree *ntree)
Definition node.cc:1657
void node_unique_name(bNodeTree *ntree, bNode *node)
Definition node.cc:2593
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)
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)
void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *, bNode *node)
void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *, bNode *node)
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
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
void * RNA_struct_blender_type_get(StructRNA *srna)
void RNA_parameter_list_free(ParameterList *parms)
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
int RNA_struct_ui_icon(const StructRNA *type)
const char * RNA_struct_ui_description(const StructRNA *type)
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value)
PointerRNA rna_pointer_inherit_refine(const PointerRNA *ptr, StructRNA *type, void *data)
ParameterList * RNA_parameter_list_create(ParameterList *parms, PointerRNA *, FunctionRNA *func)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
void * rna_iterator_listbase_get(CollectionPropertyIterator *iter)
void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void **r_value)
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:28
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)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
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_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_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 void def_geo_string_to_curves(StructRNA *srna)
static const EnumPropertyItem sh_tex_prop_interpolation_items[]
static void def_tex_output(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_filter(StructRNA *srna)
static void def_principled(StructRNA *srna)
static StructRNA * define_specific_node(BlenderRNA *brna, const char *struct_name, const char *base_name, void(*def_func)(StructRNA *))
static void def_refraction(StructRNA *srna)
static const EnumPropertyItem node_subsurface_method_items[]
static const EnumPropertyItem node_script_mode_items[]
static void def_cmp_dblur(StructRNA *srna)
static const EnumPropertyItem prop_image_layer_items[]
static void def_node_image_user(StructRNA *srna)
static void def_cmp_double_edge_mask(StructRNA *srna)
static void def_sh_mix(StructRNA *srna)
static void def_cmp_flip(StructRNA *srna)
static EnumPropertyItem node_ies_mode_items[]
static void rna_def_texture_node(BlenderRNA *brna)
static void def_fn_input_int(StructRNA *srna)
static void def_rgb_curve(StructRNA *srna)
static void def_scatter(StructRNA *srna)
static const EnumPropertyItem prop_view_layer_items[]
static void rna_def_cmp_output_file_slots_api(BlenderRNA *brna, PropertyRNA *cprop, const char *struct_name)
static void def_cmp_rotate(StructRNA *srna)
const EnumPropertyItem rna_enum_node_integer_math_items[]
static void rna_def_node_link(BlenderRNA *brna)
static const EnumPropertyItem rna_node_geometry_curve_handle_type_items[]
static void def_sh_tex_checker(StructRNA *srna)
static const EnumPropertyItem prop_image_view_items[]
static void rna_def_nodetree(BlenderRNA *brna)
static void def_cmp_alpha_over(StructRNA *srna)
static void rna_def_shader_node(BlenderRNA *brna)
static const EnumPropertyItem node_sampler_type_items[]
static void def_geo_curve_set_handle_type(StructRNA *srna)
static void def_cmp_switch_view(StructRNA *)
static void def_sh_uvalongstroke(StructRNA *srna)
static const EnumPropertyItem prop_shader_output_target_items[]
static const EnumPropertyItem node_metallic_distribution_items[]
static const EnumPropertyItem node_flip_items[]
static void def_cmp_bilateral_blur(StructRNA *srna)
static const EnumPropertyItem node_hair_items[]
static void def_cmp_zcombine(StructRNA *srna)
static void rna_def_compositor_node(BlenderRNA *brna)
static void def_cmp_boxmask(StructRNA *srna)
static void def_cmp_ycc(StructRNA *srna)
static void def_geo_curve_handle_type_selection(StructRNA *srna)
static void def_geo_image(StructRNA *srna)
static void def_time(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_brightcontrast(StructRNA *srna)
static void dev_cmd_transform(StructRNA *srna)
static void def_cmp_id_mask(StructRNA *srna)
static void def_cmp_denoise(StructRNA *srna)
static void def_fn_input_color(StructRNA *srna)
static void def_cmp_viewer(StructRNA *srna)
static void def_sh_tex(StructRNA *srna)
static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_node(BlenderRNA *brna)
static void def_cmp_map_uv(StructRNA *srna)
static void def_geo_foreach_geometry_element_input(StructRNA *srna)
static const EnumPropertyItem rna_enum_node_tex_dimensions_items[]
static const EnumPropertyItem node_masktype_items[]
static void rna_def_cmp_output_file_slot_layer(BlenderRNA *brna)
static void def_cmp_premul_key(StructRNA *srna)
static void rna_def_geo_foreach_geometry_element_generation_item(BlenderRNA *brna)
static void def_sh_bump(StructRNA *srna)
static void def_sh_uvmap(StructRNA *srna)
static void def_math(StructRNA *srna)
static void def_sh_tangent(StructRNA *srna)
static const EnumPropertyItem node_metallic_fresnel_type_items[]
static void def_geo_distribute_points_on_faces(StructRNA *srna)
static void rna_def_simulation_state_item(BlenderRNA *brna)
static void def_cmp_set_alpha(StructRNA *srna)
static void def_fn_input_vector(StructRNA *srna)
const EnumPropertyItem rna_enum_node_group_color_tag_items[]
static void rna_def_internal_node(BlenderRNA *brna)
static void def_cmp_colorcorrection(StructRNA *srna)
static void def_geo_sample_index(StructRNA *srna)
static void def_cmp_sunbeams(StructRNA *srna)
static void def_cmp_levels(StructRNA *srna)
static void def_frame(StructRNA *srna)
const EnumPropertyItem rna_enum_mapping_type_items[]
static void def_sh_attribute(StructRNA *srna)
static const EnumPropertyItem node_scatter_phase_items[]
static void def_fn_input_rotation(StructRNA *srna)
static const EnumPropertyItem rna_enum_vector_rotate_type_items[]
const EnumPropertyItem rna_enum_node_combsep_color_items[]
static void def_cmp_blur(StructRNA *srna)
static void def_geo_index_switch(StructRNA *srna)
static void def_geo_menu_switch(StructRNA *srna)
static void def_cmp_composite(StructRNA *srna)
static void def_geo_curve_sample(StructRNA *srna)
static void def_fn_input_string(StructRNA *srna)
static void rna_def_geo_bake_item(BlenderRNA *brna)
static void def_geo_simulation_input(StructRNA *srna)
static const EnumPropertyItem node_cryptomatte_layer_name_items[]
static void def_common_zone_input(StructRNA *srna)
static void def_cmp_combsep_color(StructRNA *srna)
static const EnumPropertyItem node_ycc_items[]
static void rna_def_repeat_item(BlenderRNA *brna)
static void rna_def_geo_bake(StructRNA *srna)
static void def_cmp_lensdist(StructRNA *srna)
static void def_cmp_color_matte(StructRNA *srna)
static void def_geo_foreach_geometry_element_output(StructRNA *srna)
static void def_toon(StructRNA *srna)
static void def_sh_subsurface(StructRNA *srna)
static const EnumPropertyItem node_refraction_items[]
static void def_cmp_map_range(StructRNA *srna)
static void def_cmp_cryptomatte(StructRNA *srna)
static void def_texture(StructRNA *srna)
static void rna_def_function_node(BlenderRNA *brna)
static void def_cmp_defocus(StructRNA *srna)
static void def_cmp_invert(StructRNA *srna)
static void rna_def_node_instance_hash(BlenderRNA *brna)
static void def_cmp_scale(StructRNA *srna)
static void def_colorramp(StructRNA *srna)
static void def_sh_tex_noise(StructRNA *srna)
static const EnumPropertyItem prop_image_extension[]
static void def_cmp_split(StructRNA *srna)
static void def_sh_ambient_occlusion(StructRNA *srna)
static void def_fn_random_value(StructRNA *srna)
static void rna_def_geo_foreach_geometry_element_generation_items(BlenderRNA *brna)
static void def_geo_repeat_output(StructRNA *srna)
static void rna_def_menu_switch_item(BlenderRNA *brna)
static void def_cmp_render_layers(StructRNA *srna)
static void def_glossy(StructRNA *srna)
static void rna_def_cmp_output_file_slot_file(BlenderRNA *brna)
static void def_cmp_inpaint(StructRNA *srna)
static void def_sh_tex_ies(StructRNA *srna)
static void def_cmp_image(StructRNA *srna)
static void def_group_input(StructRNA *)
static void rna_def_texture_nodetree(BlenderRNA *brna)
static void def_cmp_keying(StructRNA *srna)
const EnumPropertyItem rna_enum_node_socket_in_out_items[]
static void def_sh_output_aov(StructRNA *srna)
void RNA_def_nodetree(BlenderRNA *brna)
static void def_sh_output_linestyle(StructRNA *srna)
static void def_tex_combsep_color(StructRNA *srna)
static void def_cmp_vector_blur(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 def_geo_image_texture(StructRNA *srna)
static void rna_def_index_switch_item(BlenderRNA *brna)
static void rna_def_geo_capture_attribute_item(BlenderRNA *brna)
static void def_cmp_pixelate(StructRNA *srna)
static void def_cmp_huecorrect(StructRNA *srna)
static void def_geo_simulation_output(StructRNA *srna)
static void rna_def_geo_repeat_output_items(BlenderRNA *brna)
static void def_sheen(StructRNA *srna)
const EnumPropertyItem rna_enum_node_geometry_curve_handle_side_items[]
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
static void def_cmp_channel_matte(StructRNA *srna)
static void def_cmp_convert_color_space(StructRNA *srna)
static void def_reroute(StructRNA *srna)
const EnumPropertyItem rna_enum_node_vec_math_items[]
static void def_sh_displacement(StructRNA *srna)
const EnumPropertyItem rna_enum_geometry_nodes_linear_gizmo_draw_style_items[]
static void def_cmp_glare(StructRNA *srna)
static void def_sh_tex_sky(StructRNA *srna)
static void def_cmp_kuwahara(StructRNA *srna)
static void def_cmp_crop(StructRNA *srna)
static void def_map_range(StructRNA *srna)
static void def_float_to_int(StructRNA *srna)
static void def_hair(StructRNA *srna)
static void rna_def_geo_capture_attribute_items(BlenderRNA *brna)
static void rna_def_geometry_nodetree(BlenderRNA *brna)
static void rna_def_node_item_array_socket_item_common(StructRNA *srna, const char *accessor, const bool add_socket_type)
static void def_cmp_distance_matte(StructRNA *srna)
static void def_cmp_antialiasing(StructRNA *srna)
static void def_sh_vector_rotate(StructRNA *srna)
static void def_cmp_stabilize2d(StructRNA *srna)
static const EnumPropertyItem node_principled_hair_model_items[]
static void def_cmp_tonemap(StructRNA *srna)
static void def_cmp_trackpos(StructRNA *srna)
static void def_cmp_switch(StructRNA *srna)
static void def_cmp_luma_matte(StructRNA *srna)
static const EnumPropertyItem node_principled_hair_parametrization_items[]
static const EnumPropertyItem prop_tri_channel_items[]
const EnumPropertyItem rna_enum_node_geometry_mesh_circle_fill_type_items[]
static void def_sh_mapping(StructRNA *srna)
static void def_fn_rotate_euler(StructRNA *srna)
static const EnumPropertyItem node_glass_items[]
static void def_geo_input_material(StructRNA *srna)
static void def_cmp_bokehimage(StructRNA *srna)
static void def_cmp_moviedistortion(StructRNA *srna)
static void rna_def_geo_simulation_output_items(BlenderRNA *brna)
const EnumPropertyItem rna_enum_node_boolean_math_items[]
static void def_cmp_dilate_erode(StructRNA *srna)
static void def_cmp_planetrackdeform(StructRNA *srna)
static void rna_def_geo_index_switch_items(BlenderRNA *brna)
static void def_cmp_movieclip(StructRNA *srna)
static void def_hair_principled(StructRNA *srna)
const EnumPropertyItem rna_enum_geometry_nodes_gizmo_color_items[]
static void def_cmp_despeckle(StructRNA *srna)
static void rna_def_node_item_array_common_functions(StructRNA *srna, const char *item_name, const char *accessor_name)
const EnumPropertyItem rna_enum_node_map_range_items[]
const EnumPropertyItem rna_enum_node_float_compare_items[]
static void rna_def_geo_gizmo_transform(StructRNA *srna)
const EnumPropertyItem rna_enum_node_compare_operation_items[]
const EnumPropertyItem rna_enum_node_filter_items[]
static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
static void def_cmp_ellipsemask(StructRNA *srna)
static void def_cmp_bokehblur(StructRNA *srna)
static void def_cmp_map_value(StructRNA *srna)
static void def_tex_bricks(StructRNA *srna)
static void def_cmp_diff_matte(StructRNA *srna)
static void def_cmp_keyingscreen(StructRNA *srna)
static void rna_def_geo_capture_attribute(StructRNA *srna)
static const EnumPropertyItem rna_enum_mix_data_type_items[]
static void def_cmp_cryptomatte_legacy(StructRNA *srna)
static void def_cmp_colorbalance(StructRNA *srna)
static void def_cmp_mask(StructRNA *srna)
static void rna_def_composite_nodetree(BlenderRNA *brna)
static void def_fn_input_bool(StructRNA *srna)
static void rna_def_geometry_node(BlenderRNA *brna)
static void def_tex_image(StructRNA *srna)
const EnumPropertyItem rna_enum_node_clamp_items[]
static const EnumPropertyItem node_sheen_items[]
static void def_metallic(StructRNA *srna)
static void rna_def_bake_items(BlenderRNA *brna)
static void def_cmp_chroma_matte(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_cmp_color_spill(StructRNA *srna)
static void def_cmp_cryptomatte_entry(BlenderRNA *brna)
static void def_sh_tex_wave(StructRNA *srna)
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_sh_tex_pointdensity(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_repeat_input(StructRNA *srna)
static void rna_def_nodetree_nodes_api(BlenderRNA *brna, PropertyRNA *cprop)
static const EnumPropertyItem node_toon_items[]
static void def_glass(StructRNA *srna)
static void def_cmp_cryptomatte_common(StructRNA *srna)
static void rna_def_geo_menu_switch_items(BlenderRNA *brna)
static void def_cmp_translate(StructRNA *srna)
static void def_sh_tex_environment(StructRNA *srna)
static const EnumPropertyItem space_items[]
const EnumPropertyItem rna_enum_dummy_NULL_items[]
Definition rna_rna.cc:29
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
Definition rna_scene.cc:114
static const EnumPropertyItem prop_noise_type[]
const EnumPropertyItem rna_enum_icon_items[]
Definition rna_ui_api.cc:31
#define min(a, b)
Definition sort.c:32
bool RE_layers_have_name(RenderResult *result)
#define FLT_MAX
Definition stdcycles.h:14
#define INT32_MAX
Definition stdint.h:137
const char * identifier
Definition RNA_types.hh:506
const char * name
Definition RNA_types.hh:510
const char * description
Definition RNA_types.hh:512
StructRNA * srna
Definition RNA_types.hh:780
StructCallbackFunc call
Definition RNA_types.hh:781
StructFreeFunc free
Definition RNA_types.hh:782
Definition DNA_ID.h:413
char name[66]
Definition DNA_ID.h:425
struct RenderResult * rr
void * first
NodeCryptomatte_Runtime runtime
char type_idname[64]
ListBase particlesystem
struct Object * object
char vertex_attribute_name[68]
ID * owner_id
Definition RNA_types.hh:40
StructRNA * type
Definition RNA_types.hh:41
void * data
Definition RNA_types.hh:42
void(* update_script_node)(struct RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node)
Definition RE_engine.h:112
char name[RE_MAXNAME]
Definition RE_pipeline.h:89
struct RenderLayer * next
Definition RE_pipeline.h:86
ListBase views
ListBase layers
struct RenderView * next
Definition RE_pipeline.h:46
char name[64]
Definition RE_pipeline.h:47
ListBase view_layers
struct bNodeSocket * next
char identifier[64]
bNodeTreeRuntimeHandle * runtime
char idname[64]
struct GeometryNodeAssetTraits * geometry_node_asset_traits
bNodeTreeTypeHandle * typeinfo
bNodeTreeInterface tree_interface
ListBase nodes
ListBase links
bNodeTypeHandle * typeinfo
IDProperty * prop
char name[64]
struct bNode * next
int32_t identifier
int16_t type
Compact definition of a node socket.
Definition BKE_node.hh:103
Defines a socket type.
Definition BKE_node.hh:151
void(* update)(bNodeTree *ntree)
Definition BKE_node.hh:473
bool(* poll)(const bContext *C, bNodeTreeType *ntreetype)
Definition BKE_node.hh:463
void(* get_from_context)(const bContext *C, bNodeTreeType *ntreetype, bNodeTree **r_ntree, ID **r_id, ID **r_from)
Definition BKE_node.hh:465
bool(* valid_socket_type)(bNodeTreeType *ntreetype, bNodeSocketType *socket_type)
Definition BKE_node.hh:480
Defines a node type.
Definition BKE_node.hh:218
void(* freefunc_api)(PointerRNA *ptr)
Definition BKE_node.hh:281
bool(* poll_instance)(const bNode *node, const bNodeTree *nodetree, const char **r_disabled_hint)
Definition BKE_node.hh:304
bNodeSocketTemplate * inputs
Definition BKE_node.hh:233
void(* labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
Definition BKE_node.hh:249
void(* draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:240
bNodeSocketTemplate * outputs
Definition BKE_node.hh:233
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:238
bool(* poll)(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint)
Definition BKE_node.hh:299
bool(* insert_link)(bNodeTree *ntree, bNode *node, bNodeLink *link)
Definition BKE_node.hh:309
void(* copyfunc_api)(PointerRNA *ptr, const bNode *src_node)
Definition BKE_node.hh:282
void(* free_self)(bNodeType *ntype)
Definition BKE_node.hh:311
void(* updatefunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:257
void(* initfunc_api)(const bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:280
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)
#define N_(msgid)
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4126
uint8_t flag
Definition wm_window.cc:138