Blender  V3.3
rna_nodetree.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <limits.h>
8 #include <stdlib.h>
9 #include <string.h>
10 
11 #include "BLI_math.h"
12 #include "BLI_utildefines.h"
13 
14 #include "BLT_translation.h"
15 
16 #include "DNA_material_types.h"
17 #include "DNA_mesh_types.h"
18 #include "DNA_modifier_types.h"
19 #include "DNA_node_types.h"
20 #include "DNA_object_types.h"
21 #include "DNA_particle_types.h"
22 #include "DNA_text_types.h"
23 #include "DNA_texture_types.h"
24 
25 #include "BKE_animsys.h"
26 #include "BKE_attribute.h"
27 #include "BKE_cryptomatte.h"
28 #include "BKE_geometry_set.h"
29 #include "BKE_image.h"
30 #include "BKE_node.h"
31 #include "BKE_node_tree_update.h"
32 #include "BKE_texture.h"
33 
34 #include "RNA_access.h"
35 #include "RNA_define.h"
36 #include "RNA_enum_types.h"
37 
38 #include "rna_internal.h"
39 #include "rna_internal_types.h"
40 
41 #include "IMB_colormanagement.h"
42 #include "IMB_imbuf.h"
43 #include "IMB_imbuf_types.h"
44 
45 #include "WM_types.h"
46 
47 #include "MEM_guardedalloc.h"
48 
49 #include "RE_texture.h"
50 
51 #include "DEG_depsgraph.h"
52 #include "DEG_depsgraph_query.h"
53 
55  {SOCK_IN, "IN", 0, "Input", ""}, {SOCK_OUT, "OUT", 0, "Output", ""}, {0, NULL, 0, NULL, NULL}};
56 
58  {SOCK_FLOAT, "FLOAT", 0, "Float", ""},
59  {SOCK_INT, "INT", 0, "Integer", ""},
60  {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
61  {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
62  {SOCK_STRING, "STRING", 0, "String", ""},
63  {SOCK_RGBA, "RGBA", 0, "Color", ""},
64  {SOCK_OBJECT, "OBJECT", 0, "Object", ""},
65  {SOCK_IMAGE, "IMAGE", 0, "Image", ""},
66  {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""},
67  {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""},
68  {SOCK_TEXTURE, "TEXTURE", 0, "Texture", ""},
69  {SOCK_MATERIAL, "MATERIAL", 0, "Material", ""},
70  {0, NULL, 0, NULL, NULL},
71 };
72 
73 #ifndef RNA_RUNTIME
75  {SOCK_DISPLAY_SHAPE_CIRCLE, "CIRCLE", 0, "Circle", ""},
76  {SOCK_DISPLAY_SHAPE_SQUARE, "SQUARE", 0, "Square", ""},
77  {SOCK_DISPLAY_SHAPE_DIAMOND, "DIAMOND", 0, "Diamond", ""},
78  {SOCK_DISPLAY_SHAPE_CIRCLE_DOT, "CIRCLE_DOT", 0, "Circle with inner dot", ""},
79  {SOCK_DISPLAY_SHAPE_SQUARE_DOT, "SQUARE_DOT", 0, "Square with inner dot", ""},
80  {SOCK_DISPLAY_SHAPE_DIAMOND_DOT, "DIAMOND_DOT", 0, "Diamond with inner dot", ""},
81  {0, NULL, 0, NULL, NULL}};
82 
84  {SOCK_CUSTOM, "CUSTOM", 0, "Custom", ""},
85  {SOCK_FLOAT, "VALUE", 0, "Value", ""},
86  {SOCK_INT, "INT", 0, "Integer", ""},
87  {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
88  {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
89  {SOCK_STRING, "STRING", 0, "String", ""},
90  {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
91  {SOCK_SHADER, "SHADER", 0, "Shader", ""},
92  {SOCK_OBJECT, "OBJECT", 0, "Object", ""},
93  {SOCK_IMAGE, "IMAGE", 0, "Image", ""},
94  {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""},
95  {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""},
96  {SOCK_TEXTURE, "TEXTURE", 0, "Texture", ""},
97  {SOCK_MATERIAL, "MATERIAL", 0, "Material", ""},
98  {0, NULL, 0, NULL, NULL},
99 };
100 
102  {NTREE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"},
103  {NTREE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", "Medium quality"},
104  {NTREE_QUALITY_LOW, "LOW", 0, "Low", "Low quality"},
105  {0, NULL, 0, NULL, NULL},
106 };
107 
109  {NTREE_CHUNKSIZE_32, "32", 0, "32x32", "Chunksize of 32x32"},
110  {NTREE_CHUNKSIZE_64, "64", 0, "64x64", "Chunksize of 64x64"},
111  {NTREE_CHUNKSIZE_128, "128", 0, "128x128", "Chunksize of 128x128"},
112  {NTREE_CHUNKSIZE_256, "256", 0, "256x256", "Chunksize of 256x256"},
113  {NTREE_CHUNKSIZE_512, "512", 0, "512x512", "Chunksize of 512x512"},
114  {NTREE_CHUNKSIZE_1024, "1024", 0, "1024x1024", "Chunksize of 1024x1024"},
115  {0, NULL, 0, NULL, NULL},
116 };
117 #endif
118 
121  "TILED",
122  0,
123  "Tiled",
124  "Compositing is tiled, having as priority to display first tiles as fast as possible"},
126  "FULL_FRAME",
127  0,
128  "Full Frame",
129  "Composites full image result as fast as possible"},
130  {0, NULL, 0, NULL, NULL},
131 };
132 
134  {NODE_MAPPING_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
136  "TEXTURE",
137  0,
138  "Texture",
139  "Transform a texture by inverse mapping the texture coordinate"},
141  "VECTOR",
142  0,
143  "Vector",
144  "Transform a direction vector. Location is ignored"},
146  "NORMAL",
147  0,
148  "Normal",
149  "Transform a unit normal vector. Location is ignored"},
150  {0, NULL, 0, NULL, NULL},
151 };
152 
155  "AXIS_ANGLE",
156  0,
157  "Axis Angle",
158  "Rotate a point using axis angle"},
159  {NODE_VECTOR_ROTATE_TYPE_AXIS_X, "X_AXIS", 0, "X Axis", "Rotate a point using X axis"},
160  {NODE_VECTOR_ROTATE_TYPE_AXIS_Y, "Y_AXIS", 0, "Y Axis", "Rotate a point using Y axis"},
161  {NODE_VECTOR_ROTATE_TYPE_AXIS_Z, "Z_AXIS", 0, "Z Axis", "Rotate a point using Z axis"},
162  {NODE_VECTOR_ROTATE_TYPE_EULER_XYZ, "EULER_XYZ", 0, "Euler", "Rotate a point using XYZ order"},
163  {0, NULL, 0, NULL, NULL},
164 };
165 
167  RNA_ENUM_ITEM_HEADING(N_("Functions"), NULL),
168  {NODE_MATH_ADD, "ADD", 0, "Add", "A + B"},
169  {NODE_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
170  {NODE_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "A * B"},
171  {NODE_MATH_DIVIDE, "DIVIDE", 0, "Divide", "A / B"},
172  {NODE_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
174  {NODE_MATH_POWER, "POWER", 0, "Power", "A power B"},
175  {NODE_MATH_LOGARITHM, "LOGARITHM", 0, "Logarithm", "Logarithm A base B"},
176  {NODE_MATH_SQRT, "SQRT", 0, "Square Root", "Square root of A"},
177  {NODE_MATH_INV_SQRT, "INVERSE_SQRT", 0, "Inverse Square Root", "1 / Square root of A"},
178  {NODE_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Magnitude of A"},
179  {NODE_MATH_EXPONENT, "EXPONENT", 0, "Exponent", "exp(A)"},
180  RNA_ENUM_ITEM_HEADING(N_("Comparison"), NULL),
181  {NODE_MATH_MINIMUM, "MINIMUM", 0, "Minimum", "The minimum from A and B"},
182  {NODE_MATH_MAXIMUM, "MAXIMUM", 0, "Maximum", "The maximum from A and B"},
183  {NODE_MATH_LESS_THAN, "LESS_THAN", 0, "Less Than", "1 if A < B else 0"},
184  {NODE_MATH_GREATER_THAN, "GREATER_THAN", 0, "Greater Than", "1 if A > B else 0"},
185  {NODE_MATH_SIGN, "SIGN", 0, "Sign", "Returns the sign of A"},
186  {NODE_MATH_COMPARE, "COMPARE", 0, "Compare", "1 if (A == B) within tolerance C else 0"},
188  "SMOOTH_MIN",
189  0,
190  "Smooth Minimum",
191  "The minimum from A and B with smoothing C"},
193  "SMOOTH_MAX",
194  0,
195  "Smooth Maximum",
196  "The maximum from A and B with smoothing C"},
197  RNA_ENUM_ITEM_HEADING(N_("Rounding"), NULL),
199  "ROUND",
200  0,
201  "Round",
202  "Round A to the nearest integer. Round upward if the fraction part is 0.5"},
203  {NODE_MATH_FLOOR, "FLOOR", 0, "Floor", "The largest integer smaller than or equal A"},
204  {NODE_MATH_CEIL, "CEIL", 0, "Ceil", "The smallest integer greater than or equal A"},
205  {NODE_MATH_TRUNC, "TRUNC", 0, "Truncate", "The integer part of A, removing fractional digits"},
207  {NODE_MATH_FRACTION, "FRACT", 0, "Fraction", "The fraction part of A"},
208  {NODE_MATH_MODULO, "MODULO", 0, "Modulo", "Modulo using fmod(A,B)"},
209  {NODE_MATH_WRAP, "WRAP", 0, "Wrap", "Wrap value to range, wrap(A,B)"},
210  {NODE_MATH_SNAP, "SNAP", 0, "Snap", "Snap to increment, snap(A,B)"},
212  "PINGPONG",
213  0,
214  "Ping-Pong",
215  "Wraps a value and reverses every other cycle (A,B)"},
216  RNA_ENUM_ITEM_HEADING(N_("Trigonometric"), NULL),
217  {NODE_MATH_SINE, "SINE", 0, "Sine", "sin(A)"},
218  {NODE_MATH_COSINE, "COSINE", 0, "Cosine", "cos(A)"},
219  {NODE_MATH_TANGENT, "TANGENT", 0, "Tangent", "tan(A)"},
221  {NODE_MATH_ARCSINE, "ARCSINE", 0, "Arcsine", "arcsin(A)"},
222  {NODE_MATH_ARCCOSINE, "ARCCOSINE", 0, "Arccosine", "arccos(A)"},
223  {NODE_MATH_ARCTANGENT, "ARCTANGENT", 0, "Arctangent", "arctan(A)"},
224  {NODE_MATH_ARCTAN2, "ARCTAN2", 0, "Arctan2", "The signed angle arctan(A / B)"},
226  {NODE_MATH_SINH, "SINH", 0, "Hyperbolic Sine", "sinh(A)"},
227  {NODE_MATH_COSH, "COSH", 0, "Hyperbolic Cosine", "cosh(A)"},
228  {NODE_MATH_TANH, "TANH", 0, "Hyperbolic Tangent", "tanh(A)"},
229  RNA_ENUM_ITEM_HEADING(N_("Conversion"), NULL),
230  {NODE_MATH_RADIANS, "RADIANS", 0, "To Radians", "Convert from degrees to radians"},
231  {NODE_MATH_DEGREES, "DEGREES", 0, "To Degrees", "Convert from radians to degrees"},
232  {0, NULL, 0, NULL, NULL},
233 };
234 
236  {NODE_VECTOR_MATH_ADD, "ADD", 0, "Add", "A + B"},
237  {NODE_VECTOR_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
238  {NODE_VECTOR_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "Entry-wise multiply"},
239  {NODE_VECTOR_MATH_DIVIDE, "DIVIDE", 0, "Divide", "Entry-wise divide"},
240  {NODE_VECTOR_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
242  {NODE_VECTOR_MATH_CROSS_PRODUCT, "CROSS_PRODUCT", 0, "Cross Product", "A cross B"},
243  {NODE_VECTOR_MATH_PROJECT, "PROJECT", 0, "Project", "Project A onto B"},
245  "REFLECT",
246  0,
247  "Reflect",
248  "Reflect A around the normal B. B doesn't need to be normalized"},
250  "REFRACT",
251  0,
252  "Refract",
253  "For a given incident vector A, surface normal B and ratio of indices of refraction, Ior, "
254  "refract returns the refraction vector, R"},
256  "FACEFORWARD",
257  0,
258  "Faceforward",
259  "Orients a vector A to point away from a surface B as defined by its normal C. "
260  "Returns (dot(B, C) < 0) ? A : -A"},
261  {NODE_VECTOR_MATH_DOT_PRODUCT, "DOT_PRODUCT", 0, "Dot Product", "A dot B"},
263  {NODE_VECTOR_MATH_DISTANCE, "DISTANCE", 0, "Distance", "Distance between A and B"},
264  {NODE_VECTOR_MATH_LENGTH, "LENGTH", 0, "Length", "Length of A"},
265  {NODE_VECTOR_MATH_SCALE, "SCALE", 0, "Scale", "A multiplied by Scale"},
266  {NODE_VECTOR_MATH_NORMALIZE, "NORMALIZE", 0, "Normalize", "Normalize A"},
268  {NODE_VECTOR_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Entry-wise absolute"},
269  {NODE_VECTOR_MATH_MINIMUM, "MINIMUM", 0, "Minimum", "Entry-wise minimum"},
270  {NODE_VECTOR_MATH_MAXIMUM, "MAXIMUM", 0, "Maximum", "Entry-wise maximum"},
271  {NODE_VECTOR_MATH_FLOOR, "FLOOR", 0, "Floor", "Entry-wise floor"},
272  {NODE_VECTOR_MATH_CEIL, "CEIL", 0, "Ceil", "Entry-wise ceil"},
273  {NODE_VECTOR_MATH_FRACTION, "FRACTION", 0, "Fraction", "The fraction part of A entry-wise"},
274  {NODE_VECTOR_MATH_MODULO, "MODULO", 0, "Modulo", "Entry-wise modulo using fmod(A,B)"},
275  {NODE_VECTOR_MATH_WRAP, "WRAP", 0, "Wrap", "Entry-wise wrap(A,B)"},
277  "SNAP",
278  0,
279  "Snap",
280  "Round A to the largest integer multiple of B less than or equal A"},
282  {NODE_VECTOR_MATH_SINE, "SINE", 0, "Sine", "Entry-wise sin(A)"},
283  {NODE_VECTOR_MATH_COSINE, "COSINE", 0, "Cosine", "Entry-wise cos(A)"},
284  {NODE_VECTOR_MATH_TANGENT, "TANGENT", 0, "Tangent", "Entry-wise tan(A)"},
285  {0, NULL, 0, NULL, NULL},
286 };
287 
289  {NODE_BOOLEAN_MATH_AND, "AND", 0, "And", "True when both inputs are true"},
290  {NODE_BOOLEAN_MATH_OR, "OR", 0, "Or", "True when at least one input is true"},
291  {NODE_BOOLEAN_MATH_NOT, "NOT", 0, "Not", "Opposite of the input"},
293  {NODE_BOOLEAN_MATH_NAND, "NAND", 0, "Not And", "True when at least one input is false"},
294  {NODE_BOOLEAN_MATH_NOR, "NOR", 0, "Nor", "True when both inputs are false"},
296  "XNOR",
297  0,
298  "Equal",
299  "True when both inputs are equal (exclusive nor)"},
301  "XOR",
302  0,
303  "Not Equal",
304  "True when both inputs are different (exclusive or)"},
307  "IMPLY",
308  0,
309  "Imply",
310  "True unless the first input is true and the second is false"},
312  "NIMPLY",
313  0,
314  "Subtract",
315  "True when the first input is true and the second is false (not imply)"},
316  {0, NULL, 0, NULL, NULL},
317 };
318 
321  "LESS_THAN",
322  0,
323  "Less Than",
324  "True when the first input is smaller than second input"},
326  "LESS_EQUAL",
327  0,
328  "Less Than or Equal",
329  "True when the first input is smaller than the second input or equal"},
331  "GREATER_THAN",
332  0,
333  "Greater Than",
334  "True when the first input is greater than the second input"},
336  "GREATER_EQUAL",
337  0,
338  "Greater Than or Equal",
339  "True when the first input is greater than the second input or equal"},
340  {NODE_COMPARE_EQUAL, "EQUAL", 0, "Equal", "True when both inputs are approximately equal"},
342  "NOT_EQUAL",
343  0,
344  "Not Equal",
345  "True when both inputs are not approximately equal"},
346  {0, NULL, 0, NULL, NULL},
347 };
348 
351  "LESS_THAN",
352  0,
353  "Less Than",
354  "True when the first input is smaller than second input"},
356  "LESS_EQUAL",
357  0,
358  "Less Than or Equal",
359  "True when the first input is smaller than the second input or equal"},
361  "GREATER_THAN",
362  0,
363  "Greater Than",
364  "True when the first input is greater than the second input"},
366  "GREATER_EQUAL",
367  0,
368  "Greater Than or Equal",
369  "True when the first input is greater than the second input or equal"},
370  {NODE_COMPARE_EQUAL, "EQUAL", 0, "Equal", "True when both inputs are approximately equal"},
372  "NOT_EQUAL",
373  0,
374  "Not Equal",
375  "True when both inputs are not approximately equal"},
377  "BRIGHTER",
378  0,
379  "Brighter",
380  "True when the first input is brighter"},
381  {NODE_COMPARE_COLOR_DARKER, "DARKER", 0, "Darker", "True when the first input is darker"},
382  {0, NULL, 0, NULL, NULL},
383 };
384 
387  "ROUND",
388  0,
389  "Round",
390  "Round the float up or down to the nearest integer"},
392  "FLOOR",
393  0,
394  "Floor",
395  "Round the float down to the next smallest integer"},
397  "CEILING",
398  0,
399  "Ceiling",
400  "Round the float up to the next largest integer"},
402  "TRUNCATE",
403  0,
404  "Truncate",
405  "Round the float to the closest integer in the direction of zero (floor if positive; ceiling "
406  "if negative)"},
407  {0, NULL, 0, NULL, NULL},
408 };
409 
412  "LINEAR",
413  0,
414  "Linear",
415  "Linear interpolation between From Min and From Max values"},
417  "STEPPED",
418  0,
419  "Stepped Linear",
420  "Stepped linear interpolation between From Min and From Max values"},
422  "SMOOTHSTEP",
423  0,
424  "Smooth Step",
425  "Smooth Hermite edge interpolation between From Min and From Max values"},
427  "SMOOTHERSTEP",
428  0,
429  "Smoother Step",
430  "Smoother Hermite edge interpolation between From Min and From Max values"},
431  {0, NULL, 0, NULL, NULL},
432 };
433 
435  {NODE_CLAMP_MINMAX, "MINMAX", 0, "Min Max", "Constrain value between min and max"},
437  "RANGE",
438  0,
439  "Range",
440  "Constrain value between min and max, swapping arguments when min > max"},
441  {0, NULL, 0, NULL, NULL},
442 };
443 
445  {1, "1D", 0, "1D", "Use the scalar value W as input"},
446  {2, "2D", 0, "2D", "Use the 2D vector (X, Y) as input. The Z component is ignored"},
447  {3, "3D", 0, "3D", "Use the 3D vector (X, Y, Z) as input"},
448  {4, "4D", 0, "4D", "Use the 4D vector (X, Y, Z, W) as input"},
449  {0, NULL, 0, NULL, NULL},
450 };
451 
453  {0, "SOFTEN", 0, "Soften", ""},
454  {1, "SHARPEN", 0, "Box Sharpen", "An aggressive sharpening filter"},
455  {7, "SHARPEN_DIAMOND", 0, "Diamond Sharpen", "A moderate sharpening filter"},
456  {2, "LAPLACE", 0, "Laplace", ""},
457  {3, "SOBEL", 0, "Sobel", ""},
458  {4, "PREWITT", 0, "Prewitt", ""},
459  {5, "KIRSCH", 0, "Kirsch", ""},
460  {6, "SHADOW", 0, "Shadow", ""},
461  {0, NULL, 0, NULL, NULL},
462 };
463 
466  "FREE",
467  ICON_HANDLE_FREE,
468  "Free",
469  "The handle can be moved anywhere, and doesn't influence the point's other handle"},
471  "AUTO",
472  ICON_HANDLE_AUTO,
473  "Auto",
474  "The location is automatically calculated to be smooth"},
476  "VECTOR",
477  ICON_HANDLE_VECTOR,
478  "Vector",
479  "The location is calculated to point to the next/previous control point"},
481  "ALIGN",
482  ICON_HANDLE_ALIGNED,
483  "Align",
484  "The location is constrained to point in the opposite direction as the other handle"},
485  {0, NULL, 0, NULL, NULL}};
486 
488  {GEO_NODE_CURVE_HANDLE_LEFT, "LEFT", ICON_NONE, "Left", "Use the left handles"},
489  {GEO_NODE_CURVE_HANDLE_RIGHT, "RIGHT", ICON_NONE, "Right", "Use the right handles"},
490  {0, NULL, 0, NULL, NULL}};
491 
493  {NODE_COMBSEP_COLOR_RGB, "RGB", ICON_NONE, "RGB", "Use RGB color processing"},
494  {NODE_COMBSEP_COLOR_HSV, "HSV", ICON_NONE, "HSV", "Use HSV color processing"},
495  {NODE_COMBSEP_COLOR_HSL, "HSL", ICON_NONE, "HSL", "Use HSL color processing"},
496  {0, NULL, 0, NULL, NULL},
497 };
498 
499 #ifndef RNA_RUNTIME
501  {0, "NEAREST", 0, "Nearest", ""},
502  {1, "BILINEAR", 0, "Bilinear", ""},
503  {2, "BICUBIC", 0, "Bicubic", ""},
504  {0, NULL, 0, NULL, NULL},
505 };
506 
509  "ALL",
510  0,
511  "All",
512  "Use shaders for all renderers and viewports, unless there exists a more specific output"},
513  {SHD_OUTPUT_EEVEE, "EEVEE", 0, "Eevee", "Use shaders for Eevee renderer"},
514  {SHD_OUTPUT_CYCLES, "CYCLES", 0, "Cycles", "Use shaders for Cycles renderer"},
515  {0, NULL, 0, NULL, NULL},
516 };
517 
519  {0, "CryptoObject", 0, "Object", "Use Object layer"},
520  {1, "CryptoMaterial", 0, "Material", "Use Material layer"},
521  {2, "CryptoAsset", 0, "Asset", "Use Asset layer"},
522  {0, NULL, 0, NULL, NULL},
523 };
524 
526  {GEO_NODE_MESH_CIRCLE_FILL_NONE, "NONE", 0, "None", ""},
527  {GEO_NODE_MESH_CIRCLE_FILL_NGON, "NGON", 0, "N-Gon", ""},
528  {GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN, "TRIANGLE_FAN", 0, "Triangles", ""},
529  {0, NULL, 0, NULL, NULL},
530 };
531 #endif
532 
533 #ifndef RNA_RUNTIME
534 
535 #endif
536 
537 #undef ITEM_ATTRIBUTE
538 #undef ITEM_FLOAT
539 #undef ITEM_VECTOR
540 #undef ITEM_COLOR
541 #undef ITEM_BOOLEAN
542 
543 #ifdef RNA_RUNTIME
544 
545 # include "BLI_linklist.h"
546 # include "BLI_string.h"
547 
548 # include "BKE_context.h"
549 # include "BKE_idprop.h"
550 
551 # include "BKE_global.h"
552 
553 # include "ED_node.h"
554 # include "ED_render.h"
555 
556 # include "GPU_material.h"
557 
558 # include "NOD_common.h"
559 # include "NOD_composite.h"
560 # include "NOD_geometry.h"
561 # include "NOD_shader.h"
562 # include "NOD_socket.h"
563 # include "NOD_texture.h"
564 
565 # include "RE_engine.h"
566 # include "RE_pipeline.h"
567 
568 # include "DNA_scene_types.h"
569 # include "WM_api.h"
570 
571 static void rna_Node_socket_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr);
572 
574 {
575  int i = 0, result = -1;
576  NODE_TREE_TYPES_BEGIN (nt) {
577  if (nt == typeinfo) {
578  result = i;
579  break;
580  }
581  i++;
582  }
584  return result;
585 }
586 
587 int rna_node_tree_idname_to_enum(const char *idname)
588 {
589  int i = 0, result = -1;
590  NODE_TREE_TYPES_BEGIN (nt) {
591  if (STREQ(nt->idname, idname)) {
592  result = i;
593  break;
594  }
595  i++;
596  }
598  return result;
599 }
600 
602 {
603  int i = 0;
605  NODE_TREE_TYPES_BEGIN (nt) {
606  if (i == value) {
607  result = nt;
608  break;
609  }
610  i++;
611  }
613  return result;
614 }
615 
617  bool (*poll)(void *data, bNodeTreeType *),
618  bool *r_free)
619 {
620  EnumPropertyItem tmp = {0};
621  EnumPropertyItem *item = NULL;
622  int totitem = 0, i = 0;
623 
624  NODE_TREE_TYPES_BEGIN (nt) {
625  if (poll && !poll(data, nt)) {
626  i++;
627  continue;
628  }
629 
630  tmp.value = i;
631  tmp.identifier = nt->idname;
632  tmp.icon = nt->ui_icon;
633  tmp.name = nt->ui_name;
634  tmp.description = nt->ui_description;
635 
636  RNA_enum_item_add(&item, &totitem, &tmp);
637 
638  i++;
639  }
641 
642  if (totitem == 0) {
643  *r_free = false;
644  return DummyRNA_NULL_items;
645  }
646 
647  RNA_enum_item_end(&item, &totitem);
648  *r_free = true;
649 
650  return item;
651 }
652 
653 int rna_node_type_to_enum(bNodeType *typeinfo)
654 {
655  int i = 0, result = -1;
656  NODE_TYPES_BEGIN (ntype) {
657  if (ntype == typeinfo) {
658  result = i;
659  break;
660  }
661  i++;
662  }
664  return result;
665 }
666 
667 int rna_node_idname_to_enum(const char *idname)
668 {
669  int i = 0, result = -1;
670  NODE_TYPES_BEGIN (ntype) {
671  if (STREQ(ntype->idname, idname)) {
672  result = i;
673  break;
674  }
675  i++;
676  }
678  return result;
679 }
680 
682 {
683  int i = 0;
684  bNodeType *result = NULL;
685  NODE_TYPES_BEGIN (ntype) {
686  if (i == value) {
687  result = ntype;
688  break;
689  }
690  i++;
691  }
693  return result;
694 }
695 
697  bool (*poll)(void *data, bNodeType *),
698  bool *r_free)
699 {
700  EnumPropertyItem *item = NULL;
701  EnumPropertyItem tmp = {0};
702  int totitem = 0, i = 0;
703 
704  NODE_TYPES_BEGIN (ntype) {
705  if (poll && !poll(data, ntype)) {
706  i++;
707  continue;
708  }
709 
710  tmp.value = i;
711  tmp.identifier = ntype->idname;
712  tmp.icon = ntype->ui_icon;
713  tmp.name = ntype->ui_name;
714  tmp.description = ntype->ui_description;
715 
716  RNA_enum_item_add(&item, &totitem, &tmp);
717 
718  i++;
719  }
721 
722  if (totitem == 0) {
723  *r_free = false;
724  return DummyRNA_NULL_items;
725  }
726 
727  RNA_enum_item_end(&item, &totitem);
728  *r_free = true;
729 
730  return item;
731 }
732 
734 {
735  int i = 0, result = -1;
736  NODE_SOCKET_TYPES_BEGIN (stype) {
737  if (stype == typeinfo) {
738  result = i;
739  break;
740  }
741  i++;
742  }
744  return result;
745 }
746 
747 int rna_node_socket_idname_to_enum(const char *idname)
748 {
749  int i = 0, result = -1;
750  NODE_SOCKET_TYPES_BEGIN (stype) {
751  if (STREQ(stype->idname, idname)) {
752  result = i;
753  break;
754  }
755  i++;
756  }
758  return result;
759 }
760 
762 {
763  int i = 0;
765  NODE_SOCKET_TYPES_BEGIN (stype) {
766  if (i == value) {
767  result = stype;
768  break;
769  }
770  i++;
771  }
773  return result;
774 }
775 
777  bool (*poll)(void *data, bNodeSocketType *),
778  bool *r_free)
779 {
780  EnumPropertyItem *item = NULL;
781  EnumPropertyItem tmp = {0};
782  int totitem = 0, i = 0;
783  StructRNA *srna;
784 
785  NODE_SOCKET_TYPES_BEGIN (stype) {
786  if (poll && !poll(data, stype)) {
787  i++;
788  continue;
789  }
790 
791  srna = stype->ext_socket.srna;
792  tmp.value = i;
793  tmp.identifier = stype->idname;
794  tmp.icon = RNA_struct_ui_icon(srna);
795  tmp.name = nodeSocketTypeLabel(stype);
797 
798  RNA_enum_item_add(&item, &totitem, &tmp);
799 
800  i++;
801  }
803 
804  if (totitem == 0) {
805  *r_free = false;
806  return DummyRNA_NULL_items;
807  }
808 
809  RNA_enum_item_end(&item, &totitem);
810  *r_free = true;
811 
812  return item;
813 }
814 
815 static const EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C),
816  PointerRNA *ptr,
817  PropertyRNA *UNUSED(prop),
818  bool *r_free)
819 {
820  EnumPropertyItem *item = NULL;
821  EnumPropertyItem tmp;
822  int totitem = 0;
823 
824  /* hack, don't want to add include path to RNA just for this, since in the future RNA types
825  * for nodes should be defined locally at runtime anyway ...
826  */
827 
828  tmp.value = NODE_CUSTOM;
829  tmp.identifier = "CUSTOM";
830  tmp.name = "Custom";
831  tmp.description = "Custom Node";
832  tmp.icon = ICON_NONE;
833  RNA_enum_item_add(&item, &totitem, &tmp);
834 
835  tmp.value = NODE_CUSTOM_GROUP;
836  tmp.identifier = "CUSTOM GROUP";
837  tmp.name = "CustomGroup";
838  tmp.description = "Custom Group Node";
839  tmp.icon = ICON_NONE;
840  RNA_enum_item_add(&item, &totitem, &tmp);
841 
842  tmp.value = NODE_UNDEFINED;
843  tmp.identifier = "UNDEFINED";
844  tmp.name = "UNDEFINED";
845  tmp.description = "";
846  tmp.icon = ICON_NONE;
847  RNA_enum_item_add(&item, &totitem, &tmp);
848 
849 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
850  if (STREQ(#Category, "Node")) { \
851  tmp.value = ID; \
852  tmp.identifier = EnumName; \
853  tmp.name = UIName; \
854  tmp.description = UIDesc; \
855  tmp.icon = ICON_NONE; \
856  RNA_enum_item_add(&item, &totitem, &tmp); \
857  }
858 # include "../../nodes/NOD_static_types.h"
859 # undef DefNode
860 
861  if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) {
862 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
863  if (STREQ(#Category, "ShaderNode")) { \
864  tmp.value = ID; \
865  tmp.identifier = EnumName; \
866  tmp.name = UIName; \
867  tmp.description = UIDesc; \
868  tmp.icon = ICON_NONE; \
869  RNA_enum_item_add(&item, &totitem, &tmp); \
870  }
871 # include "../../nodes/NOD_static_types.h"
872 # undef DefNode
873  }
874 
875  if (RNA_struct_is_a(ptr->type, &RNA_CompositorNode)) {
876 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
877  if (STREQ(#Category, "CompositorNode")) { \
878  tmp.value = ID; \
879  tmp.identifier = EnumName; \
880  tmp.name = UIName; \
881  tmp.description = UIDesc; \
882  tmp.icon = ICON_NONE; \
883  RNA_enum_item_add(&item, &totitem, &tmp); \
884  }
885 # include "../../nodes/NOD_static_types.h"
886 # undef DefNode
887  }
888 
889  if (RNA_struct_is_a(ptr->type, &RNA_TextureNode)) {
890 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
891  if (STREQ(#Category, "TextureNode")) { \
892  tmp.value = ID; \
893  tmp.identifier = EnumName; \
894  tmp.name = UIName; \
895  tmp.description = UIDesc; \
896  tmp.icon = ICON_NONE; \
897  RNA_enum_item_add(&item, &totitem, &tmp); \
898  }
899 # include "../../nodes/NOD_static_types.h"
900 # undef DefNode
901  }
902 
903  if (RNA_struct_is_a(ptr->type, &RNA_GeometryNode)) {
904 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
905  if (STREQ(#Category, "GeometryNode")) { \
906  tmp.value = ID; \
907  tmp.identifier = EnumName; \
908  tmp.name = UIName; \
909  tmp.description = UIDesc; \
910  tmp.icon = ICON_NONE; \
911  RNA_enum_item_add(&item, &totitem, &tmp); \
912  }
913 # include "../../nodes/NOD_static_types.h"
914 # undef DefNode
915  }
916 
917  if (RNA_struct_is_a(ptr->type, &RNA_FunctionNode)) {
918 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
919  if (STREQ(#Category, "FunctionNode")) { \
920  tmp.value = ID; \
921  tmp.identifier = EnumName; \
922  tmp.name = UIName; \
923  tmp.description = UIDesc; \
924  tmp.icon = ICON_NONE; \
925  RNA_enum_item_add(&item, &totitem, &tmp); \
926  }
927 # include "../../nodes/NOD_static_types.h"
928 # undef DefNode
929  }
930 
931  RNA_enum_item_end(&item, &totitem);
932  *r_free = true;
933 
934  return item;
935 }
936 
937 /* ******** Node Tree ******** */
938 
939 static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr)
940 {
942 
944  return ntree->typeinfo->rna_ext.srna;
945  }
946  else {
947  return &RNA_NodeTree;
948  }
949 }
950 
951 static bool rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype)
952 {
953  extern FunctionRNA rna_NodeTree_poll_func;
954 
955  PointerRNA ptr;
956  ParameterList list;
957  FunctionRNA *func;
958  void *ret;
959  bool visible;
960 
961  RNA_pointer_create(NULL, ntreetype->rna_ext.srna, NULL, &ptr); /* dummy */
962  func = &rna_NodeTree_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
963 
964  RNA_parameter_list_create(&list, &ptr, func);
965  RNA_parameter_set_lookup(&list, "context", &C);
966  ntreetype->rna_ext.call((bContext *)C, &ptr, func, &list);
967 
968  RNA_parameter_get_lookup(&list, "visible", &ret);
969  visible = *(bool *)ret;
970 
972 
973  return visible;
974 }
975 
976 static void rna_NodeTree_update_reg(bNodeTree *ntree)
977 {
978  extern FunctionRNA rna_NodeTree_update_func;
979 
980  PointerRNA ptr;
981  ParameterList list;
982  FunctionRNA *func;
983 
985  func = &rna_NodeTree_update_func; /* RNA_struct_find_function(&ptr, "update"); */
986 
987  RNA_parameter_list_create(&list, &ptr, func);
988  ntree->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
989 
991 }
992 
993 static void rna_NodeTree_get_from_context(
994  const bContext *C, bNodeTreeType *ntreetype, bNodeTree **r_ntree, ID **r_id, ID **r_from)
995 {
996  extern FunctionRNA rna_NodeTree_get_from_context_func;
997 
998  PointerRNA ptr;
999  ParameterList list;
1000  FunctionRNA *func;
1001  void *ret1, *ret2, *ret3;
1002 
1003  RNA_pointer_create(NULL, ntreetype->rna_ext.srna, NULL, &ptr); /* dummy */
1004  // RNA_struct_find_function(&ptr, "get_from_context");
1005  func = &rna_NodeTree_get_from_context_func;
1006 
1007  RNA_parameter_list_create(&list, &ptr, func);
1008  RNA_parameter_set_lookup(&list, "context", &C);
1009  ntreetype->rna_ext.call((bContext *)C, &ptr, func, &list);
1010 
1011  RNA_parameter_get_lookup(&list, "result_1", &ret1);
1012  RNA_parameter_get_lookup(&list, "result_2", &ret2);
1013  RNA_parameter_get_lookup(&list, "result_3", &ret3);
1014  *r_ntree = *(bNodeTree **)ret1;
1015  *r_id = *(ID **)ret2;
1016  *r_from = *(ID **)ret3;
1017 
1018  RNA_parameter_list_free(&list);
1019 }
1020 
1021 static bool rna_NodeTree_valid_socket_type(bNodeTreeType *ntreetype, bNodeSocketType *socket_type)
1022 {
1023  extern FunctionRNA rna_NodeTree_valid_socket_type_func;
1024 
1025  PointerRNA ptr;
1026  ParameterList list;
1027  FunctionRNA *func;
1028  void *ret;
1029  bool valid;
1030 
1031  RNA_pointer_create(NULL, ntreetype->rna_ext.srna, NULL, &ptr); /* dummy */
1032  func = &rna_NodeTree_valid_socket_type_func;
1033 
1034  RNA_parameter_list_create(&list, &ptr, func);
1035  RNA_parameter_set_lookup(&list, "idname", &socket_type->idname);
1036  ntreetype->rna_ext.call(NULL, &ptr, func, &list);
1037 
1038  RNA_parameter_get_lookup(&list, "valid", &ret);
1039  valid = *(bool *)ret;
1040 
1041  RNA_parameter_list_free(&list);
1042 
1043  return valid;
1044 }
1045 
1046 static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type)
1047 {
1049 
1050  if (!nt) {
1051  return;
1052  }
1053 
1056 
1057  ntreeTypeFreeLink(nt);
1058 
1059  /* update while blender is running */
1061 }
1062 
1063 static StructRNA *rna_NodeTree_register(Main *bmain,
1064  ReportList *reports,
1065  void *data,
1066  const char *identifier,
1067  StructValidateFunc validate,
1068  StructCallbackFunc call,
1070 {
1071  bNodeTreeType *nt, dummynt;
1072  bNodeTree dummyntree;
1073  PointerRNA dummyptr;
1074  int have_function[4];
1075 
1076  /* setup dummy tree & tree type to store static properties in */
1077  memset(&dummynt, 0, sizeof(bNodeTreeType));
1078  memset(&dummyntree, 0, sizeof(bNodeTree));
1079  dummyntree.typeinfo = &dummynt;
1080  RNA_pointer_create(NULL, &RNA_NodeTree, &dummyntree, &dummyptr);
1081 
1082  /* validate the python class */
1083  if (validate(&dummyptr, data, have_function) != 0) {
1084  return NULL;
1085  }
1086 
1087  if (strlen(identifier) >= sizeof(dummynt.idname)) {
1088  BKE_reportf(reports,
1089  RPT_ERROR,
1090  "Registering node tree class: '%s' is too long, maximum length is %d",
1091  identifier,
1092  (int)sizeof(dummynt.idname));
1093  return NULL;
1094  }
1095 
1096  /* check if we have registered this tree type before, and remove it */
1097  nt = ntreeTypeFind(dummynt.idname);
1098  if (nt) {
1099  rna_NodeTree_unregister(bmain, nt->rna_ext.srna);
1100  }
1101 
1102  /* create a new node tree type */
1103  nt = MEM_mallocN(sizeof(bNodeTreeType), "node tree type");
1104  memcpy(nt, &dummynt, sizeof(dummynt));
1105 
1106  nt->type = NTREE_CUSTOM;
1107 
1108  nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, &RNA_NodeTree);
1109  nt->rna_ext.data = data;
1110  nt->rna_ext.call = call;
1111  nt->rna_ext.free = free;
1113 
1116 
1117  nt->poll = (have_function[0]) ? rna_NodeTree_poll : NULL;
1118  nt->update = (have_function[1]) ? rna_NodeTree_update_reg : NULL;
1119  nt->get_from_context = (have_function[2]) ? rna_NodeTree_get_from_context : NULL;
1120  nt->valid_socket_type = (have_function[3]) ? rna_NodeTree_valid_socket_type : NULL;
1121 
1122  ntreeTypeAdd(nt);
1123 
1124  /* update while blender is running */
1126 
1127  return nt->rna_ext.srna;
1128 }
1129 
1130 static bool rna_NodeTree_check(bNodeTree *ntree, ReportList *reports)
1131 {
1132  if (!ntreeIsRegistered(ntree)) {
1133  if (reports) {
1134  BKE_reportf(reports,
1135  RPT_ERROR,
1136  "Node tree '%s' has undefined type %s",
1137  ntree->id.name + 2,
1138  ntree->idname);
1139  }
1140  return false;
1141  }
1142  else {
1143  return true;
1144  }
1145 }
1146 
1147 static void rna_NodeTree_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1148 {
1150 
1153 
1155 }
1156 
1157 static bNode *rna_NodeTree_node_new(bNodeTree *ntree,
1158  bContext *C,
1159  ReportList *reports,
1160  const char *type)
1161 {
1162  bNodeType *ntype;
1163  bNode *node;
1164 
1165  if (!rna_NodeTree_check(ntree, reports)) {
1166  return NULL;
1167  }
1168 
1169  ntype = nodeTypeFind(type);
1170  if (!ntype) {
1171  BKE_reportf(reports, RPT_ERROR, "Node type %s undefined", type);
1172  return NULL;
1173  }
1174 
1175  const char *disabled_hint = NULL;
1176  if (ntype->poll && !ntype->poll(ntype, ntree, &disabled_hint)) {
1177  if (disabled_hint) {
1178  BKE_reportf(reports,
1179  RPT_ERROR,
1180  "Cannot add node of type %s to node tree '%s'\n %s",
1181  type,
1182  ntree->id.name + 2,
1183  disabled_hint);
1184  return NULL;
1185  }
1186  else {
1187  BKE_reportf(reports,
1188  RPT_ERROR,
1189  "Cannot add node of type %s to node tree '%s'",
1190  type,
1191  ntree->id.name + 2);
1192  return NULL;
1193  }
1194  }
1195 
1196  node = nodeAddNode(C, ntree, type);
1197  BLI_assert(node && node->typeinfo);
1198 
1199  if (ntree->type == NTREE_TEXTURE) {
1201  }
1202 
1203  Main *bmain = CTX_data_main(C);
1206 
1207  return node;
1208 }
1209 
1210 static void rna_NodeTree_node_remove(bNodeTree *ntree,
1211  Main *bmain,
1212  ReportList *reports,
1213  PointerRNA *node_ptr)
1214 {
1215  bNode *node = node_ptr->data;
1216 
1217  if (!rna_NodeTree_check(ntree, reports)) {
1218  return;
1219  }
1220 
1221  if (BLI_findindex(&ntree->nodes, node) == -1) {
1222  BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name);
1223  return;
1224  }
1225 
1226  nodeRemoveNode(bmain, ntree, node, true);
1227 
1228  RNA_POINTER_INVALIDATE(node_ptr);
1229 
1232 }
1233 
1234 static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1235 {
1236  bNode *node = ntree->nodes.first;
1237 
1238  if (!rna_NodeTree_check(ntree, reports)) {
1239  return;
1240  }
1241 
1242  while (node) {
1243  bNode *next_node = node->next;
1244 
1245  nodeRemoveNode(bmain, ntree, node, true);
1246 
1247  node = next_node;
1248  }
1249 
1252 }
1253 
1254 static PointerRNA rna_NodeTree_active_node_get(PointerRNA *ptr)
1255 {
1256  bNodeTree *ntree = (bNodeTree *)ptr->data;
1258  return rna_pointer_inherit_refine(ptr, &RNA_Node, node);
1259 }
1260 
1261 static void rna_NodeTree_active_node_set(PointerRNA *ptr,
1262  const PointerRNA value,
1263  struct ReportList *UNUSED(reports))
1264 {
1265  bNodeTree *ntree = (bNodeTree *)ptr->data;
1266  bNode *node = (bNode *)value.data;
1267 
1268  if (node && BLI_findindex(&ntree->nodes, node) != -1) {
1270 
1271  /* Handle NODE_DO_OUTPUT as well. */
1272  if (node->typeinfo->nclass == NODE_CLASS_OUTPUT && node->type != CMP_NODE_OUTPUT_FILE) {
1273  /* If this node becomes the active output, the others of the same type can't be the active
1274  * output anymore. */
1275  LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
1276  if (other_node->type == node->type) {
1277  other_node->flag &= ~NODE_DO_OUTPUT;
1278  }
1279  }
1280  node->flag |= NODE_DO_OUTPUT;
1283  }
1284  }
1285  else {
1287  }
1288 }
1289 
1290 static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree,
1291  Main *bmain,
1292  ReportList *reports,
1293  bNodeSocket *fromsock,
1294  bNodeSocket *tosock,
1295  bool verify_limits)
1296 {
1297  bNodeLink *ret;
1298  bNode *fromnode = NULL, *tonode = NULL;
1299 
1300  if (!rna_NodeTree_check(ntree, reports)) {
1301  return NULL;
1302  }
1303 
1304  nodeFindNode(ntree, fromsock, &fromnode, NULL);
1305  nodeFindNode(ntree, tosock, &tonode, NULL);
1306  /* check validity of the sockets:
1307  * if sockets from different trees are passed in this will fail!
1308  */
1309  if (!fromnode || !tonode) {
1310  return NULL;
1311  }
1312 
1313  if (&fromsock->in_out == &tosock->in_out) {
1314  BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets");
1315  return NULL;
1316  }
1317 
1318  if (verify_limits) {
1319  /* remove other socket links if limit is exceeded */
1320  if (nodeCountSocketLinks(ntree, fromsock) + 1 > nodeSocketLinkLimit(fromsock)) {
1321  nodeRemSocketLinks(ntree, fromsock);
1322  }
1323  if (nodeCountSocketLinks(ntree, tosock) + 1 > nodeSocketLinkLimit(tosock)) {
1324  nodeRemSocketLinks(ntree, tosock);
1325  }
1326  if (tosock->flag & SOCK_MULTI_INPUT) {
1328  if (link->fromsock == fromsock && link->tosock == tosock) {
1329  nodeRemLink(ntree, link);
1330  }
1331  }
1332  }
1333  }
1334 
1335  ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock);
1336 
1337  if (ret) {
1338 
1339  /* not an issue from the UI, clear hidden from API to keep valid state. */
1340  fromsock->flag &= ~SOCK_HIDDEN;
1341  tosock->flag &= ~SOCK_HIDDEN;
1342 
1345  }
1346  return ret;
1347 }
1348 
1349 static void rna_NodeTree_link_remove(bNodeTree *ntree,
1350  Main *bmain,
1351  ReportList *reports,
1352  PointerRNA *link_ptr)
1353 {
1354  bNodeLink *link = link_ptr->data;
1355 
1356  if (!rna_NodeTree_check(ntree, reports)) {
1357  return;
1358  }
1359 
1360  if (BLI_findindex(&ntree->links, link) == -1) {
1361  BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree");
1362  return;
1363  }
1364 
1365  nodeRemLink(ntree, link);
1366  RNA_POINTER_INVALIDATE(link_ptr);
1367 
1370 }
1371 
1372 static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1373 {
1374  bNodeLink *link = ntree->links.first;
1375 
1376  if (!rna_NodeTree_check(ntree, reports)) {
1377  return;
1378  }
1379 
1380  while (link) {
1381  bNodeLink *next_link = link->next;
1382 
1383  nodeRemLink(ntree, link);
1384 
1385  link = next_link;
1386  }
1389 }
1390 
1391 static int rna_NodeTree_active_input_get(PointerRNA *ptr)
1392 {
1393  bNodeTree *ntree = (bNodeTree *)ptr->data;
1394  int index = 0;
1395  LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->inputs, index) {
1396  if (socket->flag & SELECT) {
1397  return index;
1398  }
1399  }
1400  return -1;
1401 }
1402 
1403 static void rna_NodeTree_active_input_set(PointerRNA *ptr, int value)
1404 {
1405  bNodeTree *ntree = (bNodeTree *)ptr->data;
1406 
1407  int index = 0;
1408  LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->inputs, index) {
1409  SET_FLAG_FROM_TEST(socket->flag, index == value, SELECT);
1410  }
1411 }
1412 
1413 static int rna_NodeTree_active_output_get(PointerRNA *ptr)
1414 {
1415  bNodeTree *ntree = (bNodeTree *)ptr->data;
1416  int index = 0;
1417  LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->outputs, index) {
1418  if (socket->flag & SELECT) {
1419  return index;
1420  }
1421  }
1422  return -1;
1423 }
1424 
1425 static void rna_NodeTree_active_output_set(PointerRNA *ptr, int value)
1426 {
1427  bNodeTree *ntree = (bNodeTree *)ptr->data;
1428 
1429  int index = 0;
1430  LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->outputs, index) {
1431  SET_FLAG_FROM_TEST(socket->flag, index == value, SELECT);
1432  }
1433 }
1434 
1435 static bNodeSocket *rna_NodeTree_inputs_new(
1436  bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
1437 {
1438  if (!rna_NodeTree_check(ntree, reports)) {
1439  return NULL;
1440  }
1441 
1443 
1444  if (sock == NULL) {
1445  BKE_report(reports, RPT_ERROR, "Unable to create socket");
1446  }
1447  else {
1450  }
1451 
1452  return sock;
1453 }
1454 
1455 static bNodeSocket *rna_NodeTree_outputs_new(
1456  bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
1457 {
1458  if (!rna_NodeTree_check(ntree, reports)) {
1459  return NULL;
1460  }
1461 
1463 
1464  if (sock == NULL) {
1465  BKE_report(reports, RPT_ERROR, "Unable to create socket");
1466  }
1467  else {
1470  }
1471 
1472  return sock;
1473 }
1474 
1475 static void rna_NodeTree_socket_remove(bNodeTree *ntree,
1476  Main *bmain,
1477  ReportList *reports,
1478  bNodeSocket *sock)
1479 {
1480  if (!rna_NodeTree_check(ntree, reports)) {
1481  return;
1482  }
1483 
1484  if (BLI_findindex(&ntree->inputs, sock) == -1 && BLI_findindex(&ntree->outputs, sock) == -1) {
1485  BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
1486  }
1487  else {
1489 
1492  }
1493 }
1494 
1495 static void rna_NodeTree_inputs_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1496 {
1497  if (!rna_NodeTree_check(ntree, reports)) {
1498  return;
1499  }
1500 
1503  }
1504 
1507 }
1508 
1509 static void rna_NodeTree_outputs_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1510 {
1511  if (!rna_NodeTree_check(ntree, reports)) {
1512  return;
1513  }
1514 
1517  }
1518 
1521 }
1522 
1523 static void rna_NodeTree_inputs_move(bNodeTree *ntree, Main *bmain, int from_index, int to_index)
1524 {
1525  if (from_index == to_index) {
1526  return;
1527  }
1528  if (from_index < 0 || to_index < 0) {
1529  return;
1530  }
1531 
1532  bNodeSocket *sock = BLI_findlink(&ntree->inputs, from_index);
1533  if (to_index < from_index) {
1534  bNodeSocket *nextsock = BLI_findlink(&ntree->inputs, to_index);
1535  if (nextsock) {
1536  BLI_remlink(&ntree->inputs, sock);
1537  BLI_insertlinkbefore(&ntree->inputs, nextsock, sock);
1538  }
1539  }
1540  else {
1541  bNodeSocket *prevsock = BLI_findlink(&ntree->inputs, to_index);
1542  if (prevsock) {
1543  BLI_remlink(&ntree->inputs, sock);
1544  BLI_insertlinkafter(&ntree->inputs, prevsock, sock);
1545  }
1546  }
1547 
1549 
1552 }
1553 
1554 static void rna_NodeTree_outputs_move(bNodeTree *ntree, Main *bmain, int from_index, int to_index)
1555 {
1556  if (from_index == to_index) {
1557  return;
1558  }
1559  if (from_index < 0 || to_index < 0) {
1560  return;
1561  }
1562 
1563  bNodeSocket *sock = BLI_findlink(&ntree->outputs, from_index);
1564  if (to_index < from_index) {
1565  bNodeSocket *nextsock = BLI_findlink(&ntree->outputs, to_index);
1566  if (nextsock) {
1567  BLI_remlink(&ntree->outputs, sock);
1568  BLI_insertlinkbefore(&ntree->outputs, nextsock, sock);
1569  }
1570  }
1571  else {
1572  bNodeSocket *prevsock = BLI_findlink(&ntree->outputs, to_index);
1573  if (prevsock) {
1574  BLI_remlink(&ntree->outputs, sock);
1575  BLI_insertlinkafter(&ntree->outputs, prevsock, sock);
1576  }
1577  }
1578 
1580 
1583 }
1584 
1585 static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C)
1586 {
1587  Main *bmain = CTX_data_main(C);
1588 
1591 }
1592 
1593 /* ******** NodeLink ******** */
1594 
1595 static bool rna_NodeLink_is_hidden_get(PointerRNA *ptr)
1596 {
1597  bNodeLink *link = ptr->data;
1598  return nodeLinkIsHidden(link);
1599 }
1600 
1601 /* ******** Node ******** */
1602 
1603 static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
1604 {
1605  bNode *node = (bNode *)ptr->data;
1606 
1607  if (node->typeinfo->rna_ext.srna) {
1608  return node->typeinfo->rna_ext.srna;
1609  }
1610  else {
1611  return ptr->type;
1612  }
1613 }
1614 
1615 static char *rna_Node_path(const PointerRNA *ptr)
1616 {
1617  const bNode *node = (bNode *)ptr->data;
1618  char name_esc[sizeof(node->name) * 2];
1619 
1620  BLI_str_escape(name_esc, node->name, sizeof(name_esc));
1621  return BLI_sprintfN("nodes[\"%s\"]", name_esc);
1622 }
1623 
1625 {
1628  return NULL;
1629  }
1630 
1631  for (bNode *node = ntree->nodes.first; node; node = node->next) {
1632  switch (node->type) {
1633  case SH_NODE_TEX_ENVIRONMENT: {
1634  NodeTexEnvironment *data = node->storage;
1635  if (&data->iuser != ptr->data) {
1636  continue;
1637  }
1638  break;
1639  }
1640  case SH_NODE_TEX_IMAGE: {
1641  NodeTexImage *data = node->storage;
1642  if (&data->iuser != ptr->data) {
1643  continue;
1644  }
1645  break;
1646  }
1647  default:
1648  continue;
1649  }
1650 
1651  char name_esc[sizeof(node->name) * 2];
1652  BLI_str_escape(name_esc, node->name, sizeof(name_esc));
1653  return BLI_sprintfN("nodes[\"%s\"].image_user", name_esc);
1654  }
1655 
1656  return NULL;
1657 }
1658 
1659 static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree, const char **UNUSED(r_disabled_hint))
1660 {
1661  extern FunctionRNA rna_Node_poll_func;
1662 
1663  PointerRNA ptr;
1664  ParameterList list;
1665  FunctionRNA *func;
1666  void *ret;
1667  bool visible;
1668 
1669  RNA_pointer_create(NULL, ntype->rna_ext.srna, NULL, &ptr); /* dummy */
1670  func = &rna_Node_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
1671 
1672  RNA_parameter_list_create(&list, &ptr, func);
1673  RNA_parameter_set_lookup(&list, "node_tree", &ntree);
1674  ntype->rna_ext.call(NULL, &ptr, func, &list);
1675 
1676  RNA_parameter_get_lookup(&list, "visible", &ret);
1677  visible = *(bool *)ret;
1678 
1679  RNA_parameter_list_free(&list);
1680 
1681  return visible;
1682 }
1683 
1684 static bool rna_Node_poll_instance(bNode *node,
1685  bNodeTree *ntree,
1686  const char **UNUSED(disabled_info))
1687 {
1688  extern FunctionRNA rna_Node_poll_instance_func;
1689 
1690  PointerRNA ptr;
1691  ParameterList list;
1692  FunctionRNA *func;
1693  void *ret;
1694  bool visible;
1695 
1696  RNA_pointer_create(NULL, node->typeinfo->rna_ext.srna, node, &ptr); /* dummy */
1697  func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */
1698 
1699  RNA_parameter_list_create(&list, &ptr, func);
1700  RNA_parameter_set_lookup(&list, "node_tree", &ntree);
1701  node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
1702 
1703  RNA_parameter_get_lookup(&list, "visible", &ret);
1704  visible = *(bool *)ret;
1705 
1706  RNA_parameter_list_free(&list);
1707 
1708  return visible;
1709 }
1710 
1711 static bool rna_Node_poll_instance_default(bNode *node,
1712  bNodeTree *ntree,
1713  const char **disabled_info)
1714 {
1715  /* use the basic poll function */
1716  return rna_Node_poll(node->typeinfo, ntree, disabled_info);
1717 }
1718 
1719 static void rna_Node_update_reg(bNodeTree *ntree, bNode *node)
1720 {
1721  extern FunctionRNA rna_Node_update_func;
1722 
1723  PointerRNA ptr;
1724  ParameterList list;
1725  FunctionRNA *func;
1726 
1727  RNA_pointer_create((ID *)ntree, node->typeinfo->rna_ext.srna, node, &ptr);
1728  func = &rna_Node_update_func; /* RNA_struct_find_function(&ptr, "update"); */
1729 
1730  RNA_parameter_list_create(&list, &ptr, func);
1731  node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
1732 
1733  RNA_parameter_list_free(&list);
1734 }
1735 
1736 static void rna_Node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
1737 {
1738  extern FunctionRNA rna_Node_insert_link_func;
1739 
1740  PointerRNA ptr;
1741  ParameterList list;
1742  FunctionRNA *func;
1743 
1744  RNA_pointer_create((ID *)ntree, node->typeinfo->rna_ext.srna, node, &ptr);
1745  func = &rna_Node_insert_link_func;
1746 
1747  RNA_parameter_list_create(&list, &ptr, func);
1748  RNA_parameter_set_lookup(&list, "link", &link);
1749  node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
1750 
1751  RNA_parameter_list_free(&list);
1752 }
1753 
1754 static void rna_Node_init(const bContext *C, PointerRNA *ptr)
1755 {
1756  extern FunctionRNA rna_Node_init_func;
1757 
1758  bNode *node = (bNode *)ptr->data;
1759  ParameterList list;
1760  FunctionRNA *func;
1761 
1762  func = &rna_Node_init_func; /* RNA_struct_find_function(&ptr, "init"); */
1763 
1764  RNA_parameter_list_create(&list, ptr, func);
1765  node->typeinfo->rna_ext.call((bContext *)C, ptr, func, &list);
1766 
1767  RNA_parameter_list_free(&list);
1768 }
1769 
1770 static void rna_Node_copy(PointerRNA *ptr, const struct bNode *copynode)
1771 {
1772  extern FunctionRNA rna_Node_copy_func;
1773 
1774  bNode *node = (bNode *)ptr->data;
1775  ParameterList list;
1776  FunctionRNA *func;
1777 
1778  func = &rna_Node_copy_func; /* RNA_struct_find_function(&ptr, "copy"); */
1779 
1780  RNA_parameter_list_create(&list, ptr, func);
1781  RNA_parameter_set_lookup(&list, "node", &copynode);
1782  node->typeinfo->rna_ext.call(NULL, ptr, func, &list);
1783 
1784  RNA_parameter_list_free(&list);
1785 }
1786 
1787 static void rna_Node_free(PointerRNA *ptr)
1788 {
1789  extern FunctionRNA rna_Node_free_func;
1790 
1791  bNode *node = (bNode *)ptr->data;
1792  ParameterList list;
1793  FunctionRNA *func;
1794 
1795  func = &rna_Node_free_func; /* RNA_struct_find_function(&ptr, "free"); */
1796 
1797  RNA_parameter_list_create(&list, ptr, func);
1798  node->typeinfo->rna_ext.call(NULL, ptr, func, &list);
1799 
1800  RNA_parameter_list_free(&list);
1801 }
1802 
1803 static void rna_Node_draw_buttons(struct uiLayout *layout, bContext *C, PointerRNA *ptr)
1804 {
1805  extern FunctionRNA rna_Node_draw_buttons_func;
1806 
1807  bNode *node = (bNode *)ptr->data;
1808  ParameterList list;
1809  FunctionRNA *func;
1810 
1811  func = &rna_Node_draw_buttons_func; /* RNA_struct_find_function(&ptr, "draw_buttons"); */
1812 
1813  RNA_parameter_list_create(&list, ptr, func);
1814  RNA_parameter_set_lookup(&list, "context", &C);
1815  RNA_parameter_set_lookup(&list, "layout", &layout);
1816  node->typeinfo->rna_ext.call(C, ptr, func, &list);
1817 
1818  RNA_parameter_list_free(&list);
1819 }
1820 
1821 static void rna_Node_draw_buttons_ext(struct uiLayout *layout, bContext *C, PointerRNA *ptr)
1822 {
1823  extern FunctionRNA rna_Node_draw_buttons_ext_func;
1824 
1825  bNode *node = (bNode *)ptr->data;
1826  ParameterList list;
1827  FunctionRNA *func;
1828 
1829  func = &rna_Node_draw_buttons_ext_func; /* RNA_struct_find_function(&ptr, "draw_buttons_ext"); */
1830 
1831  RNA_parameter_list_create(&list, ptr, func);
1832  RNA_parameter_set_lookup(&list, "context", &C);
1833  RNA_parameter_set_lookup(&list, "layout", &layout);
1834  node->typeinfo->rna_ext.call(C, ptr, func, &list);
1835 
1836  RNA_parameter_list_free(&list);
1837 }
1838 
1839 static void rna_Node_draw_label(const bNodeTree *ntree, const bNode *node, char *label, int maxlen)
1840 {
1841  extern FunctionRNA rna_Node_draw_label_func;
1842 
1843  PointerRNA ptr;
1844  ParameterList list;
1845  FunctionRNA *func;
1846  void *ret;
1847  char *rlabel;
1848 
1849  func = &rna_Node_draw_label_func; /* RNA_struct_find_function(&ptr, "draw_label"); */
1850 
1851  RNA_pointer_create((ID *)&ntree->id, &RNA_Node, (bNode *)node, &ptr);
1852  RNA_parameter_list_create(&list, &ptr, func);
1853  node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
1854 
1855  RNA_parameter_get_lookup(&list, "label", &ret);
1856  rlabel = (char *)ret;
1857  BLI_strncpy(label, rlabel != NULL ? rlabel : "", maxlen);
1858 
1859  RNA_parameter_list_free(&list);
1860 }
1861 
1862 static bool rna_Node_is_registered_node_type(StructRNA *type)
1863 {
1864  return (RNA_struct_blender_type_get(type) != NULL);
1865 }
1866 
1867 static void rna_Node_is_registered_node_type_runtime(bContext *UNUSED(C),
1868  ReportList *UNUSED(reports),
1869  PointerRNA *ptr,
1870  ParameterList *parms)
1871 {
1873  RNA_parameter_set_lookup(parms, "result", &result);
1874 }
1875 
1876 static void rna_Node_unregister(Main *UNUSED(bmain), StructRNA *type)
1877 {
1879 
1880  if (!nt) {
1881  return;
1882  }
1883 
1886 
1887  /* this also frees the allocated nt pointer, no MEM_free call needed! */
1888  nodeUnregisterType(nt);
1889 
1890  /* update while blender is running */
1892 }
1893 
1894 /* Generic internal registration function.
1895  * Can be used to implement callbacks for registerable RNA node subtypes.
1896  */
1897 static bNodeType *rna_Node_register_base(Main *bmain,
1898  ReportList *reports,
1899  StructRNA *basetype,
1900  void *data,
1901  const char *identifier,
1902  StructValidateFunc validate,
1903  StructCallbackFunc call,
1905 {
1906  bNodeType *nt, dummynt;
1907  bNode dummynode;
1908  PointerRNA dummyptr;
1909  FunctionRNA *func;
1910  PropertyRNA *parm;
1911  int have_function[10];
1912 
1913  /* setup dummy node & node type to store static properties in */
1914  memset(&dummynt, 0, sizeof(bNodeType));
1915  /* this does some additional initialization of default values */
1916  node_type_base_custom(&dummynt, identifier, "", 0);
1917 
1918  memset(&dummynode, 0, sizeof(bNode));
1919  dummynode.typeinfo = &dummynt;
1920  RNA_pointer_create(NULL, basetype, &dummynode, &dummyptr);
1921 
1922  /* validate the python class */
1923  if (validate(&dummyptr, data, have_function) != 0) {
1924  return NULL;
1925  }
1926 
1927  if (strlen(identifier) >= sizeof(dummynt.idname)) {
1928  BKE_reportf(reports,
1929  RPT_ERROR,
1930  "Registering node class: '%s' is too long, maximum length is %d",
1931  identifier,
1932  (int)sizeof(dummynt.idname));
1933  return NULL;
1934  }
1935 
1936  /* check if we have registered this node type before, and remove it */
1937  nt = nodeTypeFind(dummynt.idname);
1938  if (nt) {
1939  rna_Node_unregister(bmain, nt->rna_ext.srna);
1940  }
1941 
1942  /* create a new node type */
1943  nt = MEM_mallocN(sizeof(bNodeType), "node type");
1944  memcpy(nt, &dummynt, sizeof(dummynt));
1945  nt->free_self = (void (*)(bNodeType *))MEM_freeN;
1946 
1947  nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, basetype);
1948  nt->rna_ext.data = data;
1949  nt->rna_ext.call = call;
1950  nt->rna_ext.free = free;
1952 
1955 
1956  func = RNA_def_function_runtime(
1957  nt->rna_ext.srna, "is_registered_node_type", rna_Node_is_registered_node_type_runtime);
1958  RNA_def_function_ui_description(func, "True if a registered node type");
1960  parm = RNA_def_boolean(func, "result", false, "Result", "");
1961  RNA_def_function_return(func, parm);
1962 
1963  /* XXX bad level call! needed to initialize the basic draw functions ... */
1965 
1966  nt->poll = (have_function[0]) ? rna_Node_poll : NULL;
1967  nt->poll_instance = (have_function[1]) ? rna_Node_poll_instance : rna_Node_poll_instance_default;
1968  nt->updatefunc = (have_function[2]) ? rna_Node_update_reg : NULL;
1969  nt->insert_link = (have_function[3]) ? rna_Node_insert_link : NULL;
1970  nt->initfunc_api = (have_function[4]) ? rna_Node_init : NULL;
1971  nt->copyfunc_api = (have_function[5]) ? rna_Node_copy : NULL;
1972  nt->freefunc_api = (have_function[6]) ? rna_Node_free : NULL;
1973  nt->draw_buttons = (have_function[7]) ? rna_Node_draw_buttons : NULL;
1974  nt->draw_buttons_ex = (have_function[8]) ? rna_Node_draw_buttons_ext : NULL;
1975  nt->labelfunc = (have_function[9]) ? rna_Node_draw_label : NULL;
1976 
1977  /* sanitize size values in case not all have been registered */
1978  if (nt->maxwidth < nt->minwidth) {
1979  nt->maxwidth = nt->minwidth;
1980  }
1981  if (nt->maxheight < nt->minheight) {
1982  nt->maxheight = nt->minheight;
1983  }
1984  CLAMP(nt->width, nt->minwidth, nt->maxwidth);
1985  CLAMP(nt->height, nt->minheight, nt->maxheight);
1986 
1987  return nt;
1988 }
1989 
1990 static StructRNA *rna_Node_register(Main *bmain,
1991  ReportList *reports,
1992  void *data,
1993  const char *identifier,
1994  StructValidateFunc validate,
1995  StructCallbackFunc call,
1997 {
1998  bNodeType *nt = rna_Node_register_base(
1999  bmain, reports, &RNA_Node, data, identifier, validate, call, free);
2000  if (!nt) {
2001  return NULL;
2002  }
2003 
2004  nodeRegisterType(nt);
2005 
2006  /* update while blender is running */
2008 
2009  return nt->rna_ext.srna;
2010 }
2011 
2012 static const EnumPropertyItem *itemf_function_check(
2013  const EnumPropertyItem *original_item_array,
2014  bool (*value_supported)(const EnumPropertyItem *item))
2015 {
2016  EnumPropertyItem *item_array = NULL;
2017  int items_len = 0;
2018 
2019  for (const EnumPropertyItem *item = original_item_array; item->identifier != NULL; item++) {
2020  if (value_supported(item)) {
2021  RNA_enum_item_add(&item_array, &items_len, item);
2022  }
2023  }
2024 
2025  RNA_enum_item_end(&item_array, &items_len);
2026  return item_array;
2027 }
2028 
2029 static bool switch_type_supported(const EnumPropertyItem *item)
2030 {
2031  return ELEM(item->value,
2032  SOCK_FLOAT,
2033  SOCK_INT,
2034  SOCK_BOOLEAN,
2035  SOCK_VECTOR,
2036  SOCK_STRING,
2037  SOCK_RGBA,
2038  SOCK_GEOMETRY,
2039  SOCK_OBJECT,
2041  SOCK_TEXTURE,
2042  SOCK_MATERIAL,
2043  SOCK_IMAGE);
2044 }
2045 
2046 static const EnumPropertyItem *rna_GeometryNodeSwitch_type_itemf(bContext *UNUSED(C),
2047  PointerRNA *UNUSED(ptr),
2048  PropertyRNA *UNUSED(prop),
2049  bool *r_free)
2050 {
2051  *r_free = true;
2052  return itemf_function_check(node_socket_data_type_items, switch_type_supported);
2053 }
2054 
2055 static bool compare_type_supported(const EnumPropertyItem *item)
2056 {
2058 }
2059 
2060 static bool compare_main_operation_supported(const EnumPropertyItem *item)
2061 {
2063 }
2064 
2065 static bool compare_rgba_operation_supported(const EnumPropertyItem *item)
2066 {
2067  return ELEM(item->value,
2072 }
2073 
2074 static bool compare_string_operation_supported(const EnumPropertyItem *item)
2075 {
2077 }
2078 
2079 static bool compare_other_operation_supported(const EnumPropertyItem *UNUSED(item))
2080 {
2081  return false;
2082 }
2083 
2084 static const EnumPropertyItem *rna_FunctionNodeCompare_type_itemf(bContext *UNUSED(C),
2085  PointerRNA *UNUSED(ptr),
2086  PropertyRNA *UNUSED(prop),
2087  bool *r_free)
2088 {
2089  *r_free = true;
2090  return itemf_function_check(node_socket_data_type_items, compare_type_supported);
2091 }
2092 
2093 static const EnumPropertyItem *rna_FunctionNodeCompare_operation_itemf(bContext *UNUSED(C),
2094  PointerRNA *ptr,
2095  PropertyRNA *UNUSED(prop),
2096  bool *r_free)
2097 {
2098  *r_free = true;
2099  bNode *node = ptr->data;
2101 
2102  if (ELEM(data->data_type, SOCK_FLOAT, SOCK_INT, SOCK_VECTOR)) {
2103  return itemf_function_check(rna_enum_node_compare_operation_items,
2104  compare_main_operation_supported);
2105  }
2106  else if (data->data_type == SOCK_STRING) {
2107  return itemf_function_check(rna_enum_node_compare_operation_items,
2108  compare_string_operation_supported);
2109  }
2110  else if (data->data_type == SOCK_RGBA) {
2111  return itemf_function_check(rna_enum_node_compare_operation_items,
2112  compare_rgba_operation_supported);
2113  }
2114  else {
2115  return itemf_function_check(rna_enum_node_compare_operation_items,
2116  compare_other_operation_supported);
2117  }
2118 }
2119 
2120 static bool random_value_type_supported(const EnumPropertyItem *item)
2121 {
2123 }
2124 static const EnumPropertyItem *rna_FunctionNodeRandomValue_type_itemf(bContext *UNUSED(C),
2125  PointerRNA *UNUSED(ptr),
2126  PropertyRNA *UNUSED(prop),
2127  bool *r_free)
2128 {
2129  *r_free = true;
2130  return itemf_function_check(rna_enum_attribute_type_items, random_value_type_supported);
2131 }
2132 
2133 static bool accumulate_field_type_supported(const EnumPropertyItem *item)
2134 {
2136 }
2137 
2138 static const EnumPropertyItem *rna_GeoNodeAccumulateField_type_itemf(bContext *UNUSED(C),
2139  PointerRNA *UNUSED(ptr),
2140  PropertyRNA *UNUSED(prop),
2141  bool *r_free)
2142 {
2143  *r_free = true;
2144  return itemf_function_check(rna_enum_attribute_type_items, accumulate_field_type_supported);
2145 }
2146 
2147 static void rna_GeometryNodeCompare_data_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
2148 {
2149  bNode *node = ptr->data;
2150  NodeFunctionCompare *node_storage = (NodeFunctionCompare *)node->storage;
2151 
2152  if (node_storage->data_type == SOCK_RGBA && !ELEM(node_storage->operation,
2157  node_storage->operation = NODE_COMPARE_EQUAL;
2158  }
2159  else if (node_storage->data_type == SOCK_STRING &&
2161  node_storage->operation = NODE_COMPARE_EQUAL;
2162  }
2163  else if (node_storage->data_type != SOCK_RGBA &&
2165  node_storage->operation = NODE_COMPARE_EQUAL;
2166  }
2167 
2168  rna_Node_socket_update(bmain, scene, ptr);
2169 }
2170 
2171 static bool generic_attribute_type_supported(const EnumPropertyItem *item)
2172 {
2173  return ELEM(item->value,
2174  CD_PROP_FLOAT,
2176  CD_PROP_COLOR,
2177  CD_PROP_BOOL,
2178  CD_PROP_INT32,
2180 }
2181 static const EnumPropertyItem *rna_GeometryNodeAttributeType_type_itemf(bContext *UNUSED(C),
2182  PointerRNA *UNUSED(ptr),
2183  PropertyRNA *UNUSED(prop),
2184  bool *r_free)
2185 {
2186  *r_free = true;
2187  return itemf_function_check(rna_enum_attribute_type_items, generic_attribute_type_supported);
2188 }
2189 
2190 static bool generic_attribute_type_supported_with_socket(const EnumPropertyItem *item)
2191 {
2192  return generic_attribute_type_supported(item) && !ELEM(item->value, CD_PROP_BYTE_COLOR);
2193 }
2194 static const EnumPropertyItem *rna_GeometryNodeAttributeType_type_with_socket_itemf(
2195  bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
2196 {
2197  *r_free = true;
2198  return itemf_function_check(rna_enum_attribute_type_items,
2199  generic_attribute_type_supported_with_socket);
2200 }
2201 
2202 static bool transfer_attribute_type_supported(const EnumPropertyItem *item)
2203 {
2204  return ELEM(
2206 }
2207 static const EnumPropertyItem *rna_NodeGeometryTransferAttribute_type_itemf(
2208  bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
2209 {
2210  *r_free = true;
2211  return itemf_function_check(rna_enum_attribute_type_items, transfer_attribute_type_supported);
2212 }
2213 
2214 static bool attribute_statistic_type_supported(const EnumPropertyItem *item)
2215 {
2216  return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3);
2217 }
2218 static const EnumPropertyItem *rna_GeometryNodeAttributeStatistic_type_itemf(
2219  bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
2220 {
2221  *r_free = true;
2222  return itemf_function_check(rna_enum_attribute_type_items, attribute_statistic_type_supported);
2223 }
2224 
2225 static StructRNA *rna_ShaderNode_register(Main *bmain,
2226  ReportList *reports,
2227  void *data,
2228  const char *identifier,
2229  StructValidateFunc validate,
2230  StructCallbackFunc call,
2232 {
2233  bNodeType *nt = rna_Node_register_base(
2234  bmain, reports, &RNA_ShaderNode, data, identifier, validate, call, free);
2235  if (!nt) {
2236  return NULL;
2237  }
2238 
2239  nodeRegisterType(nt);
2240 
2241  /* update while blender is running */
2243 
2244  return nt->rna_ext.srna;
2245 }
2246 
2247 static StructRNA *rna_CompositorNode_register(Main *bmain,
2248  ReportList *reports,
2249  void *data,
2250  const char *identifier,
2251  StructValidateFunc validate,
2252  StructCallbackFunc call,
2254 {
2255  bNodeType *nt = rna_Node_register_base(
2256  bmain, reports, &RNA_CompositorNode, data, identifier, validate, call, free);
2257  if (!nt) {
2258  return NULL;
2259  }
2260 
2261  nodeRegisterType(nt);
2262 
2263  /* update while blender is running */
2265 
2266  return nt->rna_ext.srna;
2267 }
2268 
2269 static StructRNA *rna_TextureNode_register(Main *bmain,
2270  ReportList *reports,
2271  void *data,
2272  const char *identifier,
2273  StructValidateFunc validate,
2274  StructCallbackFunc call,
2276 {
2277  bNodeType *nt = rna_Node_register_base(
2278  bmain, reports, &RNA_TextureNode, data, identifier, validate, call, free);
2279  if (!nt) {
2280  return NULL;
2281  }
2282 
2283  nodeRegisterType(nt);
2284 
2285  /* update while blender is running */
2287 
2288  return nt->rna_ext.srna;
2289 }
2290 
2291 static StructRNA *rna_GeometryNode_register(Main *bmain,
2292  ReportList *reports,
2293  void *data,
2294  const char *identifier,
2295  StructValidateFunc validate,
2296  StructCallbackFunc call,
2298 {
2299  bNodeType *nt = rna_Node_register_base(
2300  bmain, reports, &RNA_GeometryNode, data, identifier, validate, call, free);
2301  if (!nt) {
2302  return NULL;
2303  }
2304 
2305  nodeRegisterType(nt);
2306 
2307  /* update while blender is running */
2309 
2310  return nt->rna_ext.srna;
2311 }
2312 
2313 static StructRNA *rna_FunctionNode_register(Main *bmain,
2314  ReportList *reports,
2315  void *data,
2316  const char *identifier,
2317  StructValidateFunc validate,
2318  StructCallbackFunc call,
2320 {
2321  bNodeType *nt = rna_Node_register_base(
2322  bmain, reports, &RNA_FunctionNode, data, identifier, validate, call, free);
2323  if (!nt) {
2324  return NULL;
2325  }
2326 
2327  nodeRegisterType(nt);
2328 
2329  /* update while blender is running */
2331 
2332  return nt->rna_ext.srna;
2333 }
2334 
2335 static IDProperty **rna_Node_idprops(PointerRNA *ptr)
2336 {
2337  bNode *node = ptr->data;
2338  return &node->prop;
2339 }
2340 
2341 static void rna_Node_parent_set(PointerRNA *ptr,
2342  PointerRNA value,
2343  struct ReportList *UNUSED(reports))
2344 {
2345  bNode *node = ptr->data;
2346  bNode *parent = value.data;
2347 
2348  if (parent) {
2349  /* XXX only Frame node allowed for now,
2350  * in the future should have a poll function or so to test possible attachment.
2351  */
2352  if (parent->type != NODE_FRAME) {
2353  return;
2354  }
2355 
2356  /* make sure parent is not attached to the node */
2357  if (nodeAttachNodeCheck(parent, node)) {
2358  return;
2359  }
2360  }
2361 
2363  if (parent) {
2364  nodeAttachNode(node, parent);
2365  }
2366 }
2367 
2368 static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value)
2369 {
2370  bNode *node = ptr->data;
2371  bNode *parent = value.data;
2372 
2373  /* XXX only Frame node allowed for now,
2374  * in the future should have a poll function or so to test possible attachment.
2375  */
2376  if (parent->type != NODE_FRAME) {
2377  return false;
2378  }
2379 
2380  /* make sure parent is not attached to the node */
2381  if (nodeAttachNodeCheck(parent, node)) {
2382  return false;
2383  }
2384 
2385  return true;
2386 }
2387 
2388 static void rna_Node_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
2389 {
2391  bNode *node = (bNode *)ptr->data;
2394 }
2395 
2396 static void rna_Node_update_relations(Main *bmain, Scene *scene, PointerRNA *ptr)
2397 {
2398  rna_Node_update(bmain, scene, ptr);
2399  DEG_relations_tag_update(bmain);
2400 }
2401 
2402 static void rna_Node_socket_value_update(ID *id, bNode *UNUSED(node), bContext *C)
2403 {
2406 }
2407 
2408 static void rna_Node_select_set(PointerRNA *ptr, bool value)
2409 {
2410  bNode *node = (bNode *)ptr->data;
2411  nodeSetSelected(node, value);
2412 }
2413 
2414 static void rna_Node_name_set(PointerRNA *ptr, const char *value)
2415 {
2417  bNode *node = (bNode *)ptr->data;
2418  char oldname[sizeof(node->name)];
2419 
2420  /* make a copy of the old name first */
2421  BLI_strncpy(oldname, node->name, sizeof(node->name));
2422  /* set new name */
2423  BLI_strncpy_utf8(node->name, value, sizeof(node->name));
2424 
2426 
2427  /* fix all the animation data which may link to this */
2428  BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name);
2429 }
2430 
2431 static bNodeSocket *rna_Node_inputs_new(ID *id,
2432  bNode *node,
2433  Main *bmain,
2434  ReportList *reports,
2435  const char *type,
2436  const char *name,
2437  const char *identifier)
2438 {
2439 
2440  if (ELEM(node->type, NODE_GROUP_INPUT, NODE_FRAME)) {
2441  BKE_report(reports, RPT_ERROR, "Unable to create socket");
2442  return NULL;
2443  }
2444  /* Adding an input to a group node is not working,
2445  * simpler to add it to its underlying nodetree. */
2446  if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
2447  return rna_NodeTree_inputs_new((bNodeTree *)node->id, bmain, reports, type, name);
2448  }
2449 
2450  bNodeTree *ntree = (bNodeTree *)id;
2451  bNodeSocket *sock;
2452 
2453  sock = nodeAddSocket(ntree, node, SOCK_IN, type, identifier, name);
2454 
2455  if (sock == NULL) {
2456  BKE_report(reports, RPT_ERROR, "Unable to create socket");
2457  }
2458  else {
2461  }
2462 
2463  return sock;
2464 }
2465 
2466 static bNodeSocket *rna_Node_outputs_new(ID *id,
2467  bNode *node,
2468  Main *bmain,
2469  ReportList *reports,
2470  const char *type,
2471  const char *name,
2472  const char *identifier)
2473 {
2474  if (ELEM(node->type, NODE_GROUP_OUTPUT, NODE_FRAME)) {
2475  BKE_report(reports, RPT_ERROR, "Unable to create socket");
2476  return NULL;
2477  }
2478  /* Adding an output to a group node is not working,
2479  * simpler to add it to its underlying nodetree. */
2480  if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
2481  return rna_NodeTree_outputs_new((bNodeTree *)node->id, bmain, reports, type, name);
2482  }
2483 
2484  bNodeTree *ntree = (bNodeTree *)id;
2485  bNodeSocket *sock;
2486 
2487  sock = nodeAddSocket(ntree, node, SOCK_OUT, type, identifier, name);
2488 
2489  if (sock == NULL) {
2490  BKE_report(reports, RPT_ERROR, "Unable to create socket");
2491  }
2492  else {
2495  }
2496 
2497  return sock;
2498 }
2499 
2500 static void rna_Node_socket_remove(
2501  ID *id, bNode *node, Main *bmain, ReportList *reports, bNodeSocket *sock)
2502 {
2503  bNodeTree *ntree = (bNodeTree *)id;
2504 
2505  if (BLI_findindex(&node->inputs, sock) == -1 && BLI_findindex(&node->outputs, sock) == -1) {
2506  BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
2507  }
2508  else {
2509  nodeRemoveSocket(ntree, node, sock);
2510 
2513  }
2514 }
2515 
2516 static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain)
2517 {
2518  bNodeTree *ntree = (bNodeTree *)id;
2519  bNodeSocket *sock, *nextsock;
2520 
2521  for (sock = node->inputs.first; sock; sock = nextsock) {
2522  nextsock = sock->next;
2523  nodeRemoveSocket(ntree, node, sock);
2524  }
2525 
2528 }
2529 
2530 static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain)
2531 {
2532  bNodeTree *ntree = (bNodeTree *)id;
2533  bNodeSocket *sock, *nextsock;
2534 
2535  for (sock = node->outputs.first; sock; sock = nextsock) {
2536  nextsock = sock->next;
2537  nodeRemoveSocket(ntree, node, sock);
2538  }
2539 
2542 }
2543 
2544 static void rna_Node_inputs_move(ID *id, bNode *node, Main *bmain, int from_index, int to_index)
2545 {
2546  bNodeTree *ntree = (bNodeTree *)id;
2547  bNodeSocket *sock;
2548 
2549  if (from_index == to_index) {
2550  return;
2551  }
2552  if (from_index < 0 || to_index < 0) {
2553  return;
2554  }
2555 
2556  sock = BLI_findlink(&node->inputs, from_index);
2557  if (to_index < from_index) {
2558  bNodeSocket *nextsock = BLI_findlink(&node->inputs, to_index);
2559  if (nextsock) {
2560  BLI_remlink(&node->inputs, sock);
2561  BLI_insertlinkbefore(&node->inputs, nextsock, sock);
2562  }
2563  }
2564  else {
2565  bNodeSocket *prevsock = BLI_findlink(&node->inputs, to_index);
2566  if (prevsock) {
2567  BLI_remlink(&node->inputs, sock);
2568  BLI_insertlinkafter(&node->inputs, prevsock, sock);
2569  }
2570  }
2571 
2574 }
2575 
2576 static void rna_Node_outputs_move(ID *id, bNode *node, Main *bmain, int from_index, int to_index)
2577 {
2578  bNodeTree *ntree = (bNodeTree *)id;
2579  bNodeSocket *sock;
2580 
2581  if (from_index == to_index) {
2582  return;
2583  }
2584  if (from_index < 0 || to_index < 0) {
2585  return;
2586  }
2587 
2588  sock = BLI_findlink(&node->outputs, from_index);
2589  if (to_index < from_index) {
2590  bNodeSocket *nextsock = BLI_findlink(&node->outputs, to_index);
2591  if (nextsock) {
2592  BLI_remlink(&node->outputs, sock);
2593  BLI_insertlinkbefore(&node->outputs, nextsock, sock);
2594  }
2595  }
2596  else {
2597  bNodeSocket *prevsock = BLI_findlink(&node->outputs, to_index);
2598  if (prevsock) {
2599  BLI_remlink(&node->outputs, sock);
2600  BLI_insertlinkafter(&node->outputs, prevsock, sock);
2601  }
2602  }
2603 
2606 }
2607 
2608 static void rna_Node_width_range(
2609  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
2610 {
2611  bNode *node = ptr->data;
2612  *min = *softmin = node->typeinfo->minwidth;
2613  *max = *softmax = node->typeinfo->maxwidth;
2614 }
2615 
2616 static void rna_Node_height_range(
2617  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
2618 {
2619  bNode *node = ptr->data;
2620  *min = *softmin = node->typeinfo->minheight;
2621  *max = *softmax = node->typeinfo->maxheight;
2622 }
2623 
2624 static void rna_Node_dimensions_get(PointerRNA *ptr, float *value)
2625 {
2626  bNode *node = ptr->data;
2627  value[0] = node->totr.xmax - node->totr.xmin;
2628  value[1] = node->totr.ymax - node->totr.ymin;
2629 }
2630 
2631 /* ******** Node Socket ******** */
2632 
2633 static void rna_NodeSocket_draw(
2634  bContext *C, struct uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text)
2635 {
2636  extern FunctionRNA rna_NodeSocket_draw_func;
2637 
2638  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2639  ParameterList list;
2640  FunctionRNA *func;
2641 
2642  func = &rna_NodeSocket_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
2643 
2644  RNA_parameter_list_create(&list, ptr, func);
2645  RNA_parameter_set_lookup(&list, "context", &C);
2646  RNA_parameter_set_lookup(&list, "layout", &layout);
2647  RNA_parameter_set_lookup(&list, "node", node_ptr);
2648  RNA_parameter_set_lookup(&list, "text", &text);
2649  sock->typeinfo->ext_socket.call(C, ptr, func, &list);
2650 
2651  RNA_parameter_list_free(&list);
2652 }
2653 
2654 static void rna_NodeSocket_draw_color(bContext *C,
2655  PointerRNA *ptr,
2656  PointerRNA *node_ptr,
2657  float *r_color)
2658 {
2659  extern FunctionRNA rna_NodeSocket_draw_color_func;
2660 
2661  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2662  ParameterList list;
2663  FunctionRNA *func;
2664  void *ret;
2665 
2666  func = &rna_NodeSocket_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */
2667 
2668  RNA_parameter_list_create(&list, ptr, func);
2669  RNA_parameter_set_lookup(&list, "context", &C);
2670  RNA_parameter_set_lookup(&list, "node", node_ptr);
2671  sock->typeinfo->ext_socket.call(C, ptr, func, &list);
2672 
2673  RNA_parameter_get_lookup(&list, "color", &ret);
2674  copy_v4_v4(r_color, (float *)ret);
2675 
2676  RNA_parameter_list_free(&list);
2677 }
2678 
2679 static void rna_NodeSocket_unregister(Main *UNUSED(bmain), StructRNA *type)
2680 {
2682  if (!st) {
2683  return;
2684  }
2685 
2686  RNA_struct_free_extension(type, &st->ext_socket);
2688 
2690 
2691  /* update while blender is running */
2693 }
2694 
2695 static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain),
2696  ReportList *reports,
2697  void *data,
2698  const char *identifier,
2699  StructValidateFunc validate,
2700  StructCallbackFunc call,
2702 {
2703  bNodeSocketType *st, dummyst;
2704  bNodeSocket dummysock;
2705  PointerRNA dummyptr;
2706  int have_function[2];
2707 
2708  /* setup dummy socket & socket type to store static properties in */
2709  memset(&dummyst, 0, sizeof(bNodeSocketType));
2710  dummyst.type = SOCK_CUSTOM;
2711 
2712  memset(&dummysock, 0, sizeof(bNodeSocket));
2713  dummysock.typeinfo = &dummyst;
2714  RNA_pointer_create(NULL, &RNA_NodeSocket, &dummysock, &dummyptr);
2715 
2716  /* validate the python class */
2717  if (validate(&dummyptr, data, have_function) != 0) {
2718  return NULL;
2719  }
2720 
2721  if (strlen(identifier) >= sizeof(dummyst.idname)) {
2722  BKE_reportf(reports,
2723  RPT_ERROR,
2724  "Registering node socket class: '%s' is too long, maximum length is %d",
2725  identifier,
2726  (int)sizeof(dummyst.idname));
2727  return NULL;
2728  }
2729 
2730  /* check if we have registered this socket type before */
2731  st = nodeSocketTypeFind(dummyst.idname);
2732  if (!st) {
2733  /* create a new node socket type */
2734  st = MEM_mallocN(sizeof(bNodeSocketType), "node socket type");
2735  memcpy(st, &dummyst, sizeof(dummyst));
2736 
2738  }
2739 
2740  st->free_self = (void (*)(bNodeSocketType * stype)) MEM_freeN;
2741 
2742  /* if RNA type is already registered, unregister first */
2743  if (st->ext_socket.srna) {
2744  StructRNA *srna = st->ext_socket.srna;
2745  RNA_struct_free_extension(srna, &st->ext_socket);
2746  RNA_struct_free(&BLENDER_RNA, srna);
2747  }
2748  st->ext_socket.srna = RNA_def_struct_ptr(&BLENDER_RNA, st->idname, &RNA_NodeSocket);
2749  st->ext_socket.data = data;
2750  st->ext_socket.call = call;
2751  st->ext_socket.free = free;
2752  RNA_struct_blender_type_set(st->ext_socket.srna, st);
2753 
2754  /* XXX bad level call! needed to initialize the basic draw functions ... */
2756 
2757  st->draw = (have_function[0]) ? rna_NodeSocket_draw : NULL;
2758  st->draw_color = (have_function[1]) ? rna_NodeSocket_draw_color : NULL;
2759 
2760  /* update while blender is running */
2762 
2763  return st->ext_socket.srna;
2764 }
2765 
2766 static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
2767 {
2768  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2769 
2770  if (sock->typeinfo->ext_socket.srna) {
2771  return sock->typeinfo->ext_socket.srna;
2772  }
2773  else {
2774  return &RNA_NodeSocket;
2775  }
2776 }
2777 
2778 static char *rna_NodeSocket_path(const PointerRNA *ptr)
2779 {
2781  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2782  bNode *node;
2783  int socketindex;
2784  char name_esc[sizeof(node->name) * 2];
2785 
2786  if (!nodeFindNode(ntree, sock, &node, &socketindex)) {
2787  return NULL;
2788  }
2789 
2790  BLI_str_escape(name_esc, node->name, sizeof(name_esc));
2791 
2792  if (sock->in_out == SOCK_IN) {
2793  return BLI_sprintfN("nodes[\"%s\"].inputs[%d]", name_esc, socketindex);
2794  }
2795  else {
2796  return BLI_sprintfN("nodes[\"%s\"].outputs[%d]", name_esc, socketindex);
2797  }
2798 }
2799 
2800 static IDProperty **rna_NodeSocket_idprops(PointerRNA *ptr)
2801 {
2802  bNodeSocket *sock = ptr->data;
2803  return &sock->prop;
2804 }
2805 
2806 static PointerRNA rna_NodeSocket_node_get(PointerRNA *ptr)
2807 {
2809  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2810  bNode *node;
2811  PointerRNA r_ptr;
2812 
2813  nodeFindNode(ntree, sock, &node, NULL);
2814 
2815  RNA_pointer_create((ID *)ntree, &RNA_Node, node, &r_ptr);
2816  return r_ptr;
2817 }
2818 
2819 static void rna_NodeSocket_type_set(PointerRNA *ptr, int value)
2820 {
2822  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2823  bNode *node;
2824  nodeFindNode(ntree, sock, &node, NULL);
2825  nodeModifySocketTypeStatic(ntree, node, sock, value, 0);
2826 }
2827 
2828 static void rna_NodeSocket_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
2829 {
2831  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2832 
2835 }
2836 
2837 static bool rna_NodeSocket_is_output_get(PointerRNA *ptr)
2838 {
2839  bNodeSocket *sock = ptr->data;
2840  return sock->in_out == SOCK_OUT;
2841 }
2842 
2843 static void rna_NodeSocket_link_limit_set(PointerRNA *ptr, int value)
2844 {
2845  bNodeSocket *sock = ptr->data;
2846  sock->limit = (value == 0 ? 0xFFF : value);
2847 }
2848 
2849 static void rna_NodeSocket_hide_set(PointerRNA *ptr, bool value)
2850 {
2851  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2852 
2853  /* don't hide linked sockets */
2854  if (sock->flag & SOCK_IN_USE) {
2855  return;
2856  }
2857 
2858  if (value) {
2859  sock->flag |= SOCK_HIDDEN;
2860  }
2861  else {
2862  sock->flag &= ~SOCK_HIDDEN;
2863  }
2864 }
2865 
2866 static void rna_NodeSocketInterface_draw(bContext *C, struct uiLayout *layout, PointerRNA *ptr)
2867 {
2868  extern FunctionRNA rna_NodeSocketInterface_draw_func;
2869 
2870  bNodeSocket *stemp = (bNodeSocket *)ptr->data;
2871  ParameterList list;
2872  FunctionRNA *func;
2873 
2874  if (!stemp->typeinfo) {
2875  return;
2876  }
2877 
2878  func = &rna_NodeSocketInterface_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
2879 
2880  RNA_parameter_list_create(&list, ptr, func);
2881  RNA_parameter_set_lookup(&list, "context", &C);
2882  RNA_parameter_set_lookup(&list, "layout", &layout);
2883  stemp->typeinfo->ext_interface.call(C, ptr, func, &list);
2884 
2885  RNA_parameter_list_free(&list);
2886 }
2887 
2888 static void rna_NodeSocketInterface_draw_color(bContext *C, PointerRNA *ptr, float *r_color)
2889 {
2890  extern FunctionRNA rna_NodeSocketInterface_draw_color_func;
2891 
2892  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2893  ParameterList list;
2894  FunctionRNA *func;
2895  void *ret;
2896 
2897  if (!sock->typeinfo) {
2898  return;
2899  }
2900 
2901  func =
2902  &rna_NodeSocketInterface_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */
2903 
2904  RNA_parameter_list_create(&list, ptr, func);
2905  RNA_parameter_set_lookup(&list, "context", &C);
2906  sock->typeinfo->ext_interface.call(C, ptr, func, &list);
2907 
2908  RNA_parameter_get_lookup(&list, "color", &ret);
2909  copy_v4_v4(r_color, (float *)ret);
2910 
2911  RNA_parameter_list_free(&list);
2912 }
2913 
2914 static void rna_NodeSocketInterface_register_properties(bNodeTree *ntree,
2915  bNodeSocket *stemp,
2916  StructRNA *data_srna)
2917 {
2918  extern FunctionRNA rna_NodeSocketInterface_register_properties_func;
2919 
2920  PointerRNA ptr;
2921  ParameterList list;
2922  FunctionRNA *func;
2923 
2924  if (!stemp->typeinfo) {
2925  return;
2926  }
2927 
2928  RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr);
2929  // RNA_struct_find_function(&ptr, "register_properties");
2930  func = &rna_NodeSocketInterface_register_properties_func;
2931 
2932  RNA_parameter_list_create(&list, &ptr, func);
2933  RNA_parameter_set_lookup(&list, "data_rna_type", &data_srna);
2934  stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
2935 
2936  RNA_parameter_list_free(&list);
2937 }
2938 
2939 static void rna_NodeSocketInterface_init_socket(bNodeTree *ntree,
2940  const bNodeSocket *interface_socket,
2941  bNode *node,
2942  bNodeSocket *sock,
2943  const char *data_path)
2944 {
2945  extern FunctionRNA rna_NodeSocketInterface_init_socket_func;
2946 
2947  PointerRNA ptr, node_ptr, sock_ptr;
2948  ParameterList list;
2949  FunctionRNA *func;
2950 
2951  if (!interface_socket->typeinfo) {
2952  return;
2953  }
2954 
2955  RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, (bNodeSocket *)interface_socket, &ptr);
2956  RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
2957  RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sock_ptr);
2958  // RNA_struct_find_function(&ptr, "init_socket");
2959  func = &rna_NodeSocketInterface_init_socket_func;
2960 
2961  RNA_parameter_list_create(&list, &ptr, func);
2962  RNA_parameter_set_lookup(&list, "node", &node_ptr);
2963  RNA_parameter_set_lookup(&list, "socket", &sock_ptr);
2964  RNA_parameter_set_lookup(&list, "data_path", &data_path);
2965  interface_socket->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
2966 
2967  RNA_parameter_list_free(&list);
2968 }
2969 
2970 static void rna_NodeSocketInterface_from_socket(bNodeTree *ntree,
2971  bNodeSocket *interface_socket,
2972  bNode *node,
2973  bNodeSocket *sock)
2974 {
2975  extern FunctionRNA rna_NodeSocketInterface_from_socket_func;
2976 
2977  PointerRNA ptr, node_ptr, sock_ptr;
2978  ParameterList list;
2979  FunctionRNA *func;
2980 
2981  if (!interface_socket->typeinfo) {
2982  return;
2983  }
2984 
2985  RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, interface_socket, &ptr);
2986  RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
2987  RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sock_ptr);
2988  // RNA_struct_find_function(&ptr, "from_socket");
2989  func = &rna_NodeSocketInterface_from_socket_func;
2990 
2991  RNA_parameter_list_create(&list, &ptr, func);
2992  RNA_parameter_set_lookup(&list, "node", &node_ptr);
2993  RNA_parameter_set_lookup(&list, "socket", &sock_ptr);
2994  interface_socket->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
2995 
2996  RNA_parameter_list_free(&list);
2997 }
2998 
2999 static void rna_NodeSocketInterface_unregister(Main *UNUSED(bmain), StructRNA *type)
3000 {
3002  if (!st) {
3003  return;
3004  }
3005 
3006  RNA_struct_free_extension(type, &st->ext_interface);
3007 
3009 
3010  /* update while blender is running */
3012 }
3013 
3014 static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain),
3015  ReportList *UNUSED(reports),
3016  void *data,
3017  const char *identifier,
3018  StructValidateFunc validate,
3019  StructCallbackFunc call,
3021 {
3022  bNodeSocketType *st, dummyst;
3023  bNodeSocket dummysock;
3024  PointerRNA dummyptr;
3025  int have_function[5];
3026 
3027  /* setup dummy socket & socket type to store static properties in */
3028  memset(&dummyst, 0, sizeof(bNodeSocketType));
3029 
3030  memset(&dummysock, 0, sizeof(bNodeSocket));
3031  dummysock.typeinfo = &dummyst;
3032  RNA_pointer_create(NULL, &RNA_NodeSocketInterface, &dummysock, &dummyptr);
3033 
3034  /* validate the python class */
3035  if (validate(&dummyptr, data, have_function) != 0) {
3036  return NULL;
3037  }
3038 
3039  /* check if we have registered this socket type before */
3040  st = nodeSocketTypeFind(dummyst.idname);
3041  if (st) {
3042  /* basic socket type registered by a socket class before. */
3043  }
3044  else {
3045  /* create a new node socket type */
3046  st = MEM_mallocN(sizeof(bNodeSocketType), "node socket type");
3047  memcpy(st, &dummyst, sizeof(dummyst));
3048 
3050  }
3051 
3052  st->free_self = (void (*)(bNodeSocketType * stype)) MEM_freeN;
3053 
3054  /* if RNA type is already registered, unregister first */
3055  if (st->ext_interface.srna) {
3056  StructRNA *srna = st->ext_interface.srna;
3057  RNA_struct_free_extension(srna, &st->ext_interface);
3058  RNA_struct_free(&BLENDER_RNA, srna);
3059  }
3060  st->ext_interface.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_NodeSocketInterface);
3061  st->ext_interface.data = data;
3062  st->ext_interface.call = call;
3063  st->ext_interface.free = free;
3064  RNA_struct_blender_type_set(st->ext_interface.srna, st);
3065 
3066  st->interface_draw = (have_function[0]) ? rna_NodeSocketInterface_draw : NULL;
3067  st->interface_draw_color = (have_function[1]) ? rna_NodeSocketInterface_draw_color : NULL;
3068  st->interface_register_properties = (have_function[2]) ?
3069  rna_NodeSocketInterface_register_properties :
3070  NULL;
3071  st->interface_init_socket = (have_function[3]) ? rna_NodeSocketInterface_init_socket : NULL;
3072  st->interface_from_socket = (have_function[4]) ? rna_NodeSocketInterface_from_socket : NULL;
3073 
3074  /* update while blender is running */
3076 
3077  return st->ext_interface.srna;
3078 }
3079 
3080 static StructRNA *rna_NodeSocketInterface_refine(PointerRNA *ptr)
3081 {
3082  bNodeSocket *sock = (bNodeSocket *)ptr->data;
3083 
3084  if (sock->typeinfo && sock->typeinfo->ext_interface.srna) {
3085  return sock->typeinfo->ext_interface.srna;
3086  }
3087  else {
3088  return &RNA_NodeSocketInterface;
3089  }
3090 }
3091 
3092 static char *rna_NodeSocketInterface_path(const PointerRNA *ptr)
3093 {
3094  const bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
3095  const bNodeSocket *sock = (bNodeSocket *)ptr->data;
3096  int socketindex;
3097 
3098  socketindex = BLI_findindex(&ntree->inputs, sock);
3099  if (socketindex != -1) {
3100  return BLI_sprintfN("inputs[%d]", socketindex);
3101  }
3102 
3103  socketindex = BLI_findindex(&ntree->outputs, sock);
3104  if (socketindex != -1) {
3105  return BLI_sprintfN("outputs[%d]", socketindex);
3106  }
3107 
3108  return NULL;
3109 }
3110 
3111 static IDProperty **rna_NodeSocketInterface_idprops(PointerRNA *ptr)
3112 {
3113  bNodeSocket *sock = ptr->data;
3114  return &sock->prop;
3115 }
3116 
3117 static void rna_NodeSocketInterface_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
3118 {
3120  bNodeSocket *stemp = ptr->data;
3121 
3122  if (!stemp->typeinfo) {
3123  return;
3124  }
3125 
3128 }
3129 
3130 /* ******** Standard Node Socket Base Types ******** */
3131 
3132 static void rna_NodeSocketStandard_draw(ID *id,
3133  bNodeSocket *sock,
3134  struct bContext *C,
3135  struct uiLayout *layout,
3136  PointerRNA *nodeptr,
3137  const char *text)
3138 {
3139  PointerRNA ptr;
3140  RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
3141  sock->typeinfo->draw(C, layout, &ptr, nodeptr, text);
3142 }
3143 
3144 static void rna_NodeSocketStandard_draw_color(
3145  ID *id, bNodeSocket *sock, struct bContext *C, PointerRNA *nodeptr, float r_color[4])
3146 {
3147  PointerRNA ptr;
3148  RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
3149  sock->typeinfo->draw_color(C, &ptr, nodeptr, r_color);
3150 }
3151 
3152 static void rna_NodeSocketInterfaceStandard_draw(ID *id,
3153  bNodeSocket *sock,
3154  struct bContext *C,
3155  struct uiLayout *layout)
3156 {
3157  PointerRNA ptr;
3158  RNA_pointer_create(id, &RNA_NodeSocketInterface, sock, &ptr);
3159  sock->typeinfo->interface_draw(C, layout, &ptr);
3160 }
3161 
3162 static void rna_NodeSocketInterfaceStandard_draw_color(ID *id,
3163  bNodeSocket *sock,
3164  struct bContext *C,
3165  float r_color[4])
3166 {
3167  PointerRNA ptr;
3168  RNA_pointer_create(id, &RNA_NodeSocketInterface, sock, &ptr);
3169  sock->typeinfo->interface_draw_color(C, &ptr, r_color);
3170 }
3171 
3172 static void rna_NodeSocketStandard_float_range(
3173  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
3174 {
3175  bNodeSocket *sock = ptr->data;
3176  bNodeSocketValueFloat *dval = sock->default_value;
3177  int subtype = sock->typeinfo->subtype;
3178 
3179  if (dval->max < dval->min) {
3180  dval->max = dval->min;
3181  }
3182 
3183  *min = (subtype == PROP_UNSIGNED ? 0.0f : -FLT_MAX);
3184  *max = FLT_MAX;
3185  *softmin = dval->min;
3186  *softmax = dval->max;
3187 }
3188 
3189 static void rna_NodeSocketStandard_int_range(
3190  PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
3191 {
3192  bNodeSocket *sock = ptr->data;
3193  bNodeSocketValueInt *dval = sock->default_value;
3194  int subtype = sock->typeinfo->subtype;
3195 
3196  if (dval->max < dval->min) {
3197  dval->max = dval->min;
3198  }
3199 
3200  *min = (subtype == PROP_UNSIGNED ? 0 : INT_MIN);
3201  *max = INT_MAX;
3202  *softmin = dval->min;
3203  *softmax = dval->max;
3204 }
3205 
3206 static void rna_NodeSocketStandard_vector_range(
3207  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
3208 {
3209  bNodeSocket *sock = ptr->data;
3210  bNodeSocketValueVector *dval = sock->default_value;
3211 
3212  if (dval->max < dval->min) {
3213  dval->max = dval->min;
3214  }
3215 
3216  *min = -FLT_MAX;
3217  *max = FLT_MAX;
3218  *softmin = dval->min;
3219  *softmax = dval->max;
3220 }
3221 
3222 /* using a context update function here, to avoid searching the node if possible */
3223 static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *ptr)
3224 {
3225  /* default update */
3226  rna_NodeSocket_update(CTX_data_main(C), CTX_data_scene(C), ptr);
3227 }
3228 
3229 static void rna_NodeSocketStandard_value_and_relation_update(struct bContext *C, PointerRNA *ptr)
3230 {
3231  rna_NodeSocketStandard_value_update(C, ptr);
3232  Main *bmain = CTX_data_main(C);
3233  DEG_relations_tag_update(bmain);
3234 }
3235 
3236 /* ******** Node Types ******** */
3237 
3238 static void rna_NodeInternalSocketTemplate_name_get(PointerRNA *ptr, char *value)
3239 {
3240  bNodeSocketTemplate *stemp = ptr->data;
3241  strcpy(value, stemp->name);
3242 }
3243 
3244 static int rna_NodeInternalSocketTemplate_name_length(PointerRNA *ptr)
3245 {
3246  bNodeSocketTemplate *stemp = ptr->data;
3247  return strlen(stemp->name);
3248 }
3249 
3250 static void rna_NodeInternalSocketTemplate_identifier_get(PointerRNA *ptr, char *value)
3251 {
3252  bNodeSocketTemplate *stemp = ptr->data;
3253  strcpy(value, stemp->identifier);
3254 }
3255 
3256 static int rna_NodeInternalSocketTemplate_identifier_length(PointerRNA *ptr)
3257 {
3258  bNodeSocketTemplate *stemp = ptr->data;
3259  return strlen(stemp->identifier);
3260 }
3261 
3262 static int rna_NodeInternalSocketTemplate_type_get(PointerRNA *ptr)
3263 {
3264  bNodeSocketTemplate *stemp = ptr->data;
3265  return stemp->type;
3266 }
3267 
3268 static PointerRNA rna_NodeInternal_input_template(StructRNA *srna, int index)
3269 {
3270  bNodeType *ntype = RNA_struct_blender_type_get(srna);
3271  if (ntype && ntype->inputs) {
3272  bNodeSocketTemplate *stemp = ntype->inputs;
3273  int i = 0;
3274  while (i < index && stemp->type >= 0) {
3275  i++;
3276  stemp++;
3277  }
3278  if (i == index && stemp->type >= 0) {
3279  PointerRNA ptr;
3280  RNA_pointer_create(NULL, &RNA_NodeInternalSocketTemplate, stemp, &ptr);
3281  return ptr;
3282  }
3283  }
3284  return PointerRNA_NULL;
3285 }
3286 
3287 static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index)
3288 {
3289  bNodeType *ntype = RNA_struct_blender_type_get(srna);
3290  if (ntype && ntype->outputs) {
3291  bNodeSocketTemplate *stemp = ntype->outputs;
3292  int i = 0;
3293  while (i < index && stemp->type >= 0) {
3294  i++;
3295  stemp++;
3296  }
3297  if (i == index && stemp->type >= 0) {
3298  PointerRNA ptr;
3299  RNA_pointer_create(NULL, &RNA_NodeInternalSocketTemplate, stemp, &ptr);
3300  return ptr;
3301  }
3302  }
3303  return PointerRNA_NULL;
3304 }
3305 
3306 static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree)
3307 {
3308  bNodeType *ntype = RNA_struct_blender_type_get(srna);
3309  const char *disabled_hint;
3310  return ntype && (!ntype->poll || ntype->poll(ntype, ntree, &disabled_hint));
3311 }
3312 
3313 static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree)
3314 {
3315  bNodeType *ntype = node->typeinfo;
3316  const char *disabled_hint;
3317  if (ntype->poll_instance) {
3318  return ntype->poll_instance(node, ntree, &disabled_hint);
3319  }
3320  else {
3321  /* fall back to basic poll function */
3322  return !ntype->poll || ntype->poll(ntype, ntree, &disabled_hint);
3323  }
3324 }
3325 
3326 static void rna_NodeInternal_update(ID *id, bNode *node, Main *bmain)
3327 {
3328  bNodeTree *ntree = (bNodeTree *)id;
3331 }
3332 
3333 static void rna_NodeInternal_draw_buttons(ID *id,
3334  bNode *node,
3335  struct bContext *C,
3336  struct uiLayout *layout)
3337 {
3338  if (node->typeinfo->draw_buttons) {
3339  PointerRNA ptr;
3340  RNA_pointer_create(id, &RNA_Node, node, &ptr);
3341  node->typeinfo->draw_buttons(layout, C, &ptr);
3342  }
3343 }
3344 
3345 static void rna_NodeInternal_draw_buttons_ext(ID *id,
3346  bNode *node,
3347  struct bContext *C,
3348  struct uiLayout *layout)
3349 {
3350  if (node->typeinfo->draw_buttons_ex) {
3351  PointerRNA ptr;
3352  RNA_pointer_create(id, &RNA_Node, node, &ptr);
3353  node->typeinfo->draw_buttons_ex(layout, C, &ptr);
3354  }
3355  else if (node->typeinfo->draw_buttons) {
3356  PointerRNA ptr;
3357  RNA_pointer_create(id, &RNA_Node, node, &ptr);
3358  node->typeinfo->draw_buttons(layout, C, &ptr);
3359  }
3360 }
3361 
3362 static StructRNA *rna_NodeCustomGroup_register(Main *bmain,
3363  ReportList *reports,
3364  void *data,
3365  const char *identifier,
3366  StructValidateFunc validate,
3367  StructCallbackFunc call,
3369 {
3370  bNodeType *nt = rna_Node_register_base(
3371  bmain, reports, &RNA_NodeCustomGroup, data, identifier, validate, call, free);
3372  if (!nt) {
3373  return NULL;
3374  }
3375 
3376  /* this updates the group node instance from the tree's interface */
3378 
3379  nodeRegisterType(nt);
3380 
3381  /* update while blender is running */
3383 
3384  return nt->rna_ext.srna;
3385 }
3386 
3387 static StructRNA *rna_GeometryNodeCustomGroup_register(Main *bmain,
3388  ReportList *reports,
3389  void *data,
3390  const char *identifier,
3391  StructValidateFunc validate,
3392  StructCallbackFunc call,
3394 {
3395  bNodeType *nt = rna_Node_register_base(
3396  bmain, reports, &RNA_GeometryNodeCustomGroup, data, identifier, validate, call, free);
3397 
3398  if (!nt) {
3399  return NULL;
3400  }
3401 
3403  nt->type = NODE_CUSTOM_GROUP;
3404 
3406 
3407  nodeRegisterType(nt);
3408 
3410 
3411  return nt->rna_ext.srna;
3412 }
3413 
3415 
3416 static StructRNA *rna_ShaderNodeCustomGroup_register(Main *bmain,
3417  ReportList *reports,
3418  void *data,
3419  const char *identifier,
3420  StructValidateFunc validate,
3421  StructCallbackFunc call,
3423 {
3424  bNodeType *nt = rna_Node_register_base(
3425  bmain, reports, &RNA_ShaderNodeCustomGroup, data, identifier, validate, call, free);
3426 
3427  if (!nt) {
3428  return NULL;
3429  }
3430 
3432  nt->type = NODE_CUSTOM_GROUP;
3433 
3435 
3436  nodeRegisterType(nt);
3437 
3439 
3440  return nt->rna_ext.srna;
3441 }
3442 
3443 static StructRNA *rna_CompositorNodeCustomGroup_register(Main *bmain,
3444  ReportList *reports,
3445  void *data,
3446  const char *identifier,
3447  StructValidateFunc validate,
3448  StructCallbackFunc call,
3450 {
3451  bNodeType *nt = rna_Node_register_base(
3452  bmain, reports, &RNA_CompositorNodeCustomGroup, data, identifier, validate, call, free);
3453  if (!nt) {
3454  return NULL;
3455  }
3456 
3458  nt->type = NODE_CUSTOM_GROUP;
3459 
3461 
3462  nodeRegisterType(nt);
3463 
3465 
3466  return nt->rna_ext.srna;
3467 }
3468 
3469 static void rna_CompositorNode_tag_need_exec(bNode *node)
3470 {
3471  node->need_exec = true;
3472 }
3473 
3474 static void rna_Node_tex_image_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
3475 {
3477  bNode *node = (bNode *)ptr->data;
3478 
3482 }
3483 
3484 static void rna_NodeGroup_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
3485 {
3487  bNode *node = (bNode *)ptr->data;
3488 
3491  DEG_relations_tag_update(bmain);
3492 }
3493 
3494 static void rna_NodeGroup_node_tree_set(PointerRNA *ptr,
3495  const PointerRNA value,
3496  struct ReportList *UNUSED(reports))
3497 {
3499  bNode *node = ptr->data;
3500  bNodeTree *ngroup = value.data;
3501 
3502  const char *disabled_hint = NULL;
3503  if (nodeGroupPoll(ntree, ngroup, &disabled_hint)) {
3504  if (node->id) {
3505  id_us_min(node->id);
3506  }
3507  if (ngroup) {
3508  id_us_plus(&ngroup->id);
3509  }
3510 
3511  node->id = &ngroup->id;
3512  }
3513 }
3514 
3515 static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
3516 {
3518  bNodeTree *ngroup = value.data;
3519 
3520  /* only allow node trees of the same type as the group node's tree */
3521  if (ngroup->type != ntree->type) {
3522  return false;
3523  }
3524 
3525  const char *disabled_hint = NULL;
3526  return nodeGroupPoll(ntree, ngroup, &disabled_hint);
3527 }
3528 
3529 static StructRNA *rna_NodeGroup_interface_typef(PointerRNA *ptr)
3530 {
3531  bNode *node = ptr->data;
3532  bNodeTree *ngroup = (bNodeTree *)node->id;
3533 
3534  if (ngroup) {
3535  StructRNA *srna = ntreeInterfaceTypeGet(ngroup, true);
3536  if (srna) {
3537  return srna;
3538  }
3539  }
3540  return &RNA_PropertyGroup;
3541 }
3542 
3543 static StructRNA *rna_NodeGroupInputOutput_interface_typef(PointerRNA *ptr)
3544 {
3546 
3547  if (ntree) {
3548  StructRNA *srna = ntreeInterfaceTypeGet(ntree, true);
3549  if (srna) {
3550  return srna;
3551  }
3552  }
3553  return &RNA_PropertyGroup;
3554 }
3555 
3556 static void rna_distance_matte_t1_set(PointerRNA *ptr, float value)
3557 {
3558  bNode *node = (bNode *)ptr->data;
3559  NodeChroma *chroma = node->storage;
3560 
3561  chroma->t1 = value;
3562 }
3563 
3564 static void rna_distance_matte_t2_set(PointerRNA *ptr, float value)
3565 {
3566  bNode *node = (bNode *)ptr->data;
3567  NodeChroma *chroma = node->storage;
3568 
3569  chroma->t2 = value;
3570 }
3571 
3572 static void rna_difference_matte_t1_set(PointerRNA *ptr, float value)
3573 {
3574  bNode *node = (bNode *)ptr->data;
3575  NodeChroma *chroma = node->storage;
3576 
3577  chroma->t1 = value;
3578 }
3579 
3580 static void rna_difference_matte_t2_set(PointerRNA *ptr, float value)
3581 {
3582  bNode *node = (bNode *)ptr->data;
3583  NodeChroma *chroma = node->storage;
3584 
3585  chroma->t2 = value;
3586 }
3587 
3588 /* Button Set Funcs for Matte Nodes */
3589 static void rna_Matte_t1_set(PointerRNA *ptr, float value)
3590 {
3591  bNode *node = (bNode *)ptr->data;
3592  NodeChroma *chroma = node->storage;
3593 
3594  chroma->t1 = value;
3595 
3596  if (value < chroma->t2) {
3597  chroma->t2 = value;
3598  }
3599 }
3600 
3601 static void rna_Matte_t2_set(PointerRNA *ptr, float value)
3602 {
3603  bNode *node = (bNode *)ptr->data;
3604  NodeChroma *chroma = node->storage;
3605 
3606  if (value > chroma->t1) {
3607  value = chroma->t1;
3608  }
3609 
3610  chroma->t2 = value;
3611 }
3612 
3613 static void rna_Node_scene_set(PointerRNA *ptr,
3614  PointerRNA value,
3615  struct ReportList *UNUSED(reports))
3616 {
3617  bNode *node = (bNode *)ptr->data;
3618 
3619  if (node->id) {
3620  id_us_min(node->id);
3621  node->id = NULL;
3622  }
3623 
3624  node->id = value.data;
3625 
3626  id_us_plus(node->id);
3627 }
3628 
3629 static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3630 {
3631  bNode *node = (bNode *)ptr->data;
3632  Image *ima = (Image *)node->id;
3633  ImageUser *iuser = node->storage;
3634 
3635  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3636  return;
3637  }
3638 
3639  BKE_image_multilayer_index(ima->rr, iuser);
3640  BKE_image_signal(bmain, ima, iuser, IMA_SIGNAL_SRC_CHANGE);
3641 
3642  rna_Node_update(bmain, scene, ptr);
3643 
3644  if (scene != NULL && scene->nodetree != NULL) {
3646  }
3647 }
3648 
3649 static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
3650 {
3651  EnumPropertyItem *item = NULL;
3652  EnumPropertyItem tmp = {0};
3653  int i = 0, totitem = 0;
3654 
3655  while (rl) {
3656  tmp.identifier = rl->name;
3657  /* Little trick: using space char instead empty string
3658  * makes the item selectable in the drop-down. */
3659  if (rl->name[0] == '\0') {
3660  tmp.name = " ";
3661  }
3662  else {
3663  tmp.name = rl->name;
3664  }
3665  tmp.value = i++;
3666  RNA_enum_item_add(&item, &totitem, &tmp);
3667  rl = rl->next;
3668  }
3669 
3670  RNA_enum_item_end(&item, &totitem);
3671 
3672  return item;
3673 }
3674 
3675 static const EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C),
3676  PointerRNA *ptr,
3677  PropertyRNA *UNUSED(prop),
3678  bool *r_free)
3679 {
3680  bNode *node = (bNode *)ptr->data;
3681  Image *ima = (Image *)node->id;
3682  const EnumPropertyItem *item = NULL;
3683  RenderLayer *rl;
3684 
3685  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3686  return DummyRNA_NULL_items;
3687  }
3688 
3689  if (ima == NULL || ima->rr == NULL) {
3690  *r_free = false;
3691  return DummyRNA_NULL_items;
3692  }
3693 
3694  rl = ima->rr->layers.first;
3695  item = renderresult_layers_add_enum(rl);
3696 
3697  *r_free = true;
3698 
3699  return item;
3700 }
3701 
3702 static bool rna_Node_image_has_layers_get(PointerRNA *ptr)
3703 {
3704  bNode *node = (bNode *)ptr->data;
3705  Image *ima = (Image *)node->id;
3706 
3707  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3708  return false;
3709  }
3710 
3711  if (!ima || !(ima->rr)) {
3712  return false;
3713  }
3714 
3715  return RE_layers_have_name(ima->rr);
3716 }
3717 
3718 static bool rna_Node_image_has_views_get(PointerRNA *ptr)
3719 {
3720  bNode *node = (bNode *)ptr->data;
3721  Image *ima = (Image *)node->id;
3722 
3723  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3724  return false;
3725  }
3726 
3727  if (!ima || !(ima->rr)) {
3728  return false;
3729  }
3730 
3731  return BLI_listbase_count_at_most(&ima->rr->views, 2) > 1;
3732 }
3733 
3734 static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv)
3735 {
3736  EnumPropertyItem *item = NULL;
3737  EnumPropertyItem tmp = {0, "ALL", 0, "All", ""};
3738  int i = 1, totitem = 0;
3739 
3740  /* option to use all views */
3741  RNA_enum_item_add(&item, &totitem, &tmp);
3742 
3743  while (rv) {
3744  tmp.identifier = rv->name;
3745  /* Little trick: using space char instead empty string
3746  * makes the item selectable in the drop-down. */
3747  if (rv->name[0] == '\0') {
3748  tmp.name = " ";
3749  }
3750  else {
3751  tmp.name = rv->name;
3752  }
3753  tmp.value = i++;
3754  RNA_enum_item_add(&item, &totitem, &tmp);
3755  rv = rv->next;
3756  }
3757 
3758  RNA_enum_item_end(&item, &totitem);
3759 
3760  return item;
3761 }
3762 
3763 static const EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C),
3764  PointerRNA *ptr,
3765  PropertyRNA *UNUSED(prop),
3766  bool *r_free)
3767 {
3768  bNode *node = (bNode *)ptr->data;
3769  Image *ima = (Image *)node->id;
3770  const EnumPropertyItem *item = NULL;
3771  RenderView *rv;
3772 
3773  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3774  return DummyRNA_NULL_items;
3775  }
3776 
3777  if (ima == NULL || ima->rr == NULL) {
3778  *r_free = false;
3779  return DummyRNA_NULL_items;
3780  }
3781 
3782  rv = ima->rr->views.first;
3783  item = renderresult_views_add_enum(rv);
3784 
3785  *r_free = true;
3786 
3787  return item;
3788 }
3789 
3790 static const EnumPropertyItem *rna_Node_view_layer_itemf(bContext *UNUSED(C),
3791  PointerRNA *ptr,
3792  PropertyRNA *UNUSED(prop),
3793  bool *r_free)
3794 {
3795  bNode *node = (bNode *)ptr->data;
3796  Scene *sce = (Scene *)node->id;
3797  const EnumPropertyItem *item = NULL;
3798  RenderLayer *rl;
3799 
3800  if (sce == NULL) {
3801  *r_free = false;
3802  return DummyRNA_NULL_items;
3803  }
3804 
3805  rl = sce->view_layers.first;
3806  item = renderresult_layers_add_enum(rl);
3807 
3808  *r_free = true;
3809 
3810  return item;
3811 }
3812 
3813 static void rna_Node_view_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3814 {
3815  rna_Node_update(bmain, scene, ptr);
3816  if (scene != NULL && scene->nodetree != NULL) {
3818  }
3819 }
3820 
3821 static const EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C),
3822  PointerRNA *ptr,
3823  PropertyRNA *UNUSED(prop),
3824  bool *r_free)
3825 {
3826  bNode *node = (bNode *)ptr->data;
3827  EnumPropertyItem *item = NULL;
3828  EnumPropertyItem tmp = {0};
3829  int totitem = 0;
3830 
3831  switch (node->custom1) {
3833  tmp.identifier = "R";
3834  tmp.name = "R";
3835  tmp.value = 1;
3836  RNA_enum_item_add(&item, &totitem, &tmp);
3837  tmp.identifier = "G";
3838  tmp.name = "G";
3839  tmp.value = 2;
3840  RNA_enum_item_add(&item, &totitem, &tmp);
3841  tmp.identifier = "B";
3842  tmp.name = "B";
3843  tmp.value = 3;
3844  RNA_enum_item_add(&item, &totitem, &tmp);
3845  break;
3847  tmp.identifier = "H";
3848  tmp.name = "H";
3849  tmp.value = 1;
3850  RNA_enum_item_add(&item, &totitem, &tmp);
3851  tmp.identifier = "S";
3852  tmp.name = "S";
3853  tmp.value = 2;
3854  RNA_enum_item_add(&item, &totitem, &tmp);
3855  tmp.identifier = "V";
3856  tmp.name = "V";
3857  tmp.value = 3;
3858  RNA_enum_item_add(&item, &totitem, &tmp);
3859  break;
3861  tmp.identifier = "Y";
3862  tmp.name = "Y";
3863  tmp.value = 1;
3864  RNA_enum_item_add(&item, &totitem, &tmp);
3865  tmp.identifier = "G";
3866  tmp.name = "U";
3867  tmp.value = 2;
3868  RNA_enum_item_add(&item, &totitem, &tmp);
3869  tmp.identifier = "V";
3870  tmp.name = "V";
3871  tmp.value = 3;
3872  RNA_enum_item_add(&item, &totitem, &tmp);
3873  break;
3875  tmp.identifier = "Y";
3876  tmp.name = "Y";
3877  tmp.value = 1;
3878  RNA_enum_item_add(&item, &totitem, &tmp);
3879  tmp.identifier = "CB";
3880  tmp.name = "Cr";
3881  tmp.value = 2;
3882  RNA_enum_item_add(&item, &totitem, &tmp);
3883  tmp.identifier = "CR";
3884  tmp.name = "Cb";
3885  tmp.value = 3;
3886  RNA_enum_item_add(&item, &totitem, &tmp);
3887  break;
3888  default:
3889  return DummyRNA_NULL_items;
3890  }
3891 
3892  RNA_enum_item_end(&item, &totitem);
3893  *r_free = true;
3894 
3895  return item;
3896 }
3897 
3898 static void rna_Image_Node_update_id(Main *bmain, Scene *scene, PointerRNA *ptr)
3899 {
3900  bNode *node = (bNode *)ptr->data;
3901 
3902  node->update |= NODE_UPDATE_ID;
3903  rna_Node_update(bmain, scene, ptr);
3904 }
3905 
3906 static void rna_NodeOutputFile_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
3907 {
3908  bNode *node = ptr->data;
3909  rna_iterator_listbase_begin(iter, &node->inputs, NULL);
3910 }
3911 
3912 static PointerRNA rna_NodeOutputFile_slot_file_get(CollectionPropertyIterator *iter)
3913 {
3914  PointerRNA ptr;
3915  bNodeSocket *sock = rna_iterator_listbase_get(iter);
3916  RNA_pointer_create(iter->parent.owner_id, &RNA_NodeOutputFileSlotFile, sock->storage, &ptr);
3917  return ptr;
3918 }
3919 
3920 static void rna_NodeColorBalance_update_lgg(Main *bmain, Scene *scene, PointerRNA *ptr)
3921 {
3923  rna_Node_update(bmain, scene, ptr);
3924 }
3925 
3926 static void rna_NodeColorBalance_update_cdl(Main *bmain, Scene *scene, PointerRNA *ptr)
3927 {
3929  rna_Node_update(bmain, scene, ptr);
3930 }
3931 
3932 static void rna_NodeCryptomatte_source_set(PointerRNA *ptr, int value)
3933 {
3934  bNode *node = (bNode *)ptr->data;
3935  if (node->id && node->custom1 != value) {
3936  id_us_min((ID *)node->id);
3937  node->id = NULL;
3938  }
3939  node->custom1 = value;
3940 }
3941 
3942 static int rna_NodeCryptomatte_layer_name_get(PointerRNA *ptr)
3943 {
3944  int index = 0;
3945  bNode *node = (bNode *)ptr->data;
3946  NodeCryptomatte *storage = node->storage;
3947  LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, index) {
3948  if (STREQLEN(storage->layer_name, layer->name, sizeof(storage->layer_name))) {
3949  return index;
3950  }
3951  }
3952  return 0;
3953 }
3954 
3955 static void rna_NodeCryptomatte_layer_name_set(PointerRNA *ptr, int new_value)
3956 {
3957  bNode *node = (bNode *)ptr->data;
3958  NodeCryptomatte *storage = node->storage;
3959 
3960  CryptomatteLayer *layer = BLI_findlink(&storage->runtime.layers, new_value);
3961  if (layer) {
3962  STRNCPY(storage->layer_name, layer->name);
3963  }
3964 }
3965 
3966 static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext *C,
3967  PointerRNA *ptr,
3968  PropertyRNA *UNUSED(prop),
3969  bool *r_free)
3970 {
3971  bNode *node = (bNode *)ptr->data;
3972  NodeCryptomatte *storage = node->storage;
3973  EnumPropertyItem *item = NULL;
3974  EnumPropertyItem template = {0, "", 0, "", ""};
3975  int totitem = 0;
3976 
3978  int layer_index;
3979  LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, layer_index) {
3980  template.value = layer_index;
3981  template.identifier = layer->name;
3982  template.name = layer->name;
3983  RNA_enum_item_add(&item, &totitem, &template);
3984  }
3985 
3986  RNA_enum_item_end(&item, &totitem);
3987  *r_free = true;
3988 
3989  return item;
3990 }
3991 
3992 static PointerRNA rna_NodeCryptomatte_scene_get(PointerRNA *ptr)
3993 {
3994  bNode *node = (bNode *)ptr->data;
3995 
3996  Scene *scene = (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) ? (Scene *)node->id : NULL;
3997  return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene);
3998 }
3999 
4000 static void rna_NodeCryptomatte_scene_set(PointerRNA *ptr,
4001  PointerRNA value,
4002  struct ReportList *reports)
4003 {
4004  bNode *node = (bNode *)ptr->data;
4005 
4006  if (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) {
4007  rna_Node_scene_set(ptr, value, reports);
4008  }
4009 }
4010 
4011 static PointerRNA rna_NodeCryptomatte_image_get(PointerRNA *ptr)
4012 {
4013  bNode *node = (bNode *)ptr->data;
4014 
4015  Image *image = (node->custom1 == CMP_CRYPTOMATTE_SRC_IMAGE) ? (Image *)node->id : NULL;
4016  return rna_pointer_inherit_refine(ptr, &RNA_Image, image);
4017 }
4018 
4019 static void rna_NodeCryptomatte_image_set(PointerRNA *ptr,
4020  PointerRNA value,
4021  struct ReportList *UNUSED(reports))
4022 {
4023  bNode *node = (bNode *)ptr->data;
4024 
4025  if (node->custom1 == CMP_CRYPTOMATTE_SRC_IMAGE) {
4026  if (node->id)
4027  id_us_min((ID *)node->id);
4028  if (value.data)
4029  id_us_plus((ID *)value.data);
4030 
4031  node->id = value.data;
4032  }
4033 }
4034 
4035 static bool rna_NodeCryptomatte_image_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
4036 {
4037  Image *image = (Image *)value.owner_id;
4038  return image->type == IMA_TYPE_MULTILAYER;
4039 }
4040 
4041 static void rna_NodeCryptomatte_matte_get(PointerRNA *ptr, char *value)
4042 {
4043  bNode *node = (bNode *)ptr->data;
4044  NodeCryptomatte *nc = node->storage;
4045  char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
4046  strcpy(value, matte_id);
4047  MEM_freeN(matte_id);
4048 }
4049 
4050 static int rna_NodeCryptomatte_matte_length(PointerRNA *ptr)
4051 {
4052  bNode *node = (bNode *)ptr->data;
4053  NodeCryptomatte *nc = node->storage;
4054  char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
4055  int result = strlen(matte_id);
4056  MEM_freeN(matte_id);
4057  return result;
4058 }
4059 
4060 static void rna_NodeCryptomatte_matte_set(PointerRNA *ptr, const char *value)
4061 {
4062  bNode *node = (bNode *)ptr->data;
4063  NodeCryptomatte *nc = node->storage;
4065 }
4066 
4067 static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr)
4068 {
4070  rna_Node_update(bmain, scene, ptr);
4071 }
4072 
4073 static void rna_NodeCryptomatte_update_remove(Main *bmain, Scene *scene, PointerRNA *ptr)
4074 {
4076  rna_Node_update(bmain, scene, ptr);
4077 }
4078 
4079 /* ******** Node Socket Types ******** */
4080 
4081 static PointerRNA rna_NodeOutputFile_slot_layer_get(CollectionPropertyIterator *iter)
4082 {
4083  PointerRNA ptr;
4084  bNodeSocket *sock = rna_iterator_listbase_get(iter);
4085  RNA_pointer_create(iter->parent.owner_id, &RNA_NodeOutputFileSlotLayer, sock->storage, &ptr);
4086  return ptr;
4087 }
4088 
4089 static int rna_NodeOutputFileSocket_find_node(bNodeTree *ntree,
4091  bNode **nodep,
4092  bNodeSocket **sockp)
4093 {
4094  bNode *node;
4095  bNodeSocket *sock;
4096 
4097  for (node = ntree->nodes.first; node; node = node->next) {
4098  for (sock = node->inputs.first; sock; sock = sock->next) {
4099  NodeImageMultiFileSocket *sockdata = sock->storage;
4100  if (sockdata == data) {
4101  *nodep = node;
4102  *sockp = sock;
4103  return 1;
4104  }
4105  }
4106  }
4107 
4108  *nodep = NULL;
4109  *sockp = NULL;
4110  return 0;
4111 }
4112 
4113 static void rna_NodeOutputFileSlotFile_path_set(PointerRNA *ptr, const char *value)
4114 {
4116  NodeImageMultiFileSocket *sockdata = ptr->data;
4117  bNode *node;
4118  bNodeSocket *sock;
4119 
4120  if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
4121  ntreeCompositOutputFileSetPath(node, sock, value);
4122  }
4123 }
4124 
4125 static void rna_NodeOutputFileSlotLayer_name_set(PointerRNA *ptr, const char *value)
4126 {
4128  NodeImageMultiFileSocket *sockdata = ptr->data;
4129  bNode *node;
4130  bNodeSocket *sock;
4131 
4132  if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
4133  ntreeCompositOutputFileSetLayer(node, sock, value);
4134  }
4135 }
4136 
4137 static bNodeSocket *rna_NodeOutputFile_slots_new(
4138  ID *id, bNode *node, bContext *C, ReportList *UNUSED(reports), const char *name)
4139 {
4140  bNodeTree *ntree = (bNodeTree *)id;
4142  ImageFormatData *im_format = NULL;
4143  bNodeSocket *sock;
4144  if (scene) {
4145  im_format = &scene->r.im_format;
4146  }
4147 
4148  sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format);
4149 
4152 
4153  return sock;
4154 }
4155 
4156 static void rna_ShaderNodeTexIES_mode_set(PointerRNA *ptr, int value)
4157 {
4158  bNode *node = (bNode *)ptr->data;
4159  NodeShaderTexIES *nss = node->storage;
4160 
4161  if (nss->mode != value) {
4162  nss->mode = value;
4163  nss->filepath[0] = '\0';
4164 
4165  /* replace text datablock by filepath */
4166  if (node->id) {
4167  Text *text = (Text *)node->id;
4168 
4169  if (value == NODE_IES_EXTERNAL && text->filepath) {
4170  BLI_strncpy(nss->filepath, text->filepath, sizeof(nss->filepath));
4172  }
4173 
4174  id_us_min(node->id);
4175  node->id = NULL;
4176  }
4177  }
4178 }
4179 
4180 static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value)
4181 {
4182  bNode *node = (bNode *)ptr->data;
4183  NodeShaderScript *nss = node->storage;
4184 
4185  if (nss->mode != value) {
4186  nss->mode = value;
4187  nss->filepath[0] = '\0';
4188  nss->flag &= ~NODE_SCRIPT_AUTO_UPDATE;
4189 
4190  /* replace text data-block by filepath */
4191  if (node->id) {
4192  Text *text = (Text *)node->id;
4193 
4194  if (value == NODE_SCRIPT_EXTERNAL && text->filepath) {
4195  BLI_strncpy(nss->filepath, text->filepath, sizeof(nss->filepath));
4197  }
4198 
4199  id_us_min(node->id);
4200  node->id = NULL;
4201  }
4202 
4203  /* remove any bytecode */
4204  if (nss->bytecode) {
4205  MEM_freeN(nss->bytecode);
4206  nss->bytecode = NULL;
4207  }
4208 
4209  nss->bytecode_hash[0] = '\0';
4210  }
4211 }
4212 
4213 static void rna_ShaderNodeScript_bytecode_get(PointerRNA *ptr, char *value)
4214 {
4215  bNode *node = (bNode *)ptr->data;
4216  NodeShaderScript *nss = node->storage;
4217 
4218  strcpy(value, (nss->bytecode) ? nss->bytecode : "");
4219 }
4220 
4221 static int rna_ShaderNodeScript_bytecode_length(PointerRNA *ptr)
4222 {
4223  bNode *node = (bNode *)ptr->data;
4224  NodeShaderScript *nss = node->storage;
4225 
4226  return (nss->bytecode) ? strlen(nss->bytecode) : 0;
4227 }
4228 
4229 static void rna_ShaderNodeScript_bytecode_set(PointerRNA *ptr, const char *value)
4230 {
4231  bNode *node = (bNode *)ptr->data;
4232  NodeShaderScript *nss = node->storage;
4233 
4234  if (nss->bytecode) {
4235  MEM_freeN(nss->bytecode);
4236  }
4237 
4238  if (value && value[0]) {
4239  nss->bytecode = BLI_strdup(value);
4240  }
4241  else {
4242  nss->bytecode = NULL;
4243  }
4244 }
4245 
4246 static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4247 {
4249  bNode *node = (bNode *)ptr->data;
4250  RenderEngineType *engine_type = (scene != NULL) ? RE_engines_find(scene->r.engine) : NULL;
4251 
4252  if (engine_type && engine_type->update_script_node) {
4253  /* auto update node */
4254  RenderEngine *engine = RE_engine_create(engine_type);
4255  engine_type->update_script_node(engine, ntree, node);
4256  RE_engine_free(engine);
4257  }
4258 
4261 }
4262 
4263 static void rna_ShaderNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4264 {
4265  rna_Node_update(bmain, scene, ptr);
4266 }
4267 
4268 static void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4269 {
4270  rna_Node_update(bmain, scene, ptr);
4271 }
4272 
4273 static void rna_GeometryNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4274 {
4275  rna_Node_update(bmain, scene, ptr);
4276 }
4277 
4278 static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4279 {
4280  rna_Node_update(bmain, scene, ptr);
4281 }
4282 
4283 static void rna_ShaderNode_is_active_output_set(PointerRNA *ptr, bool value)
4284 {
4286  bNode *node = ptr->data;
4287  if (value) {
4288  /* If this node becomes the active output, the others of the same type can't be the active
4289  * output anymore. */
4290  LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
4291  if (other_node->type == node->type) {
4292  other_node->flag &= ~NODE_DO_OUTPUT;
4293  }
4294  }
4295  node->flag |= NODE_DO_OUTPUT;
4296  }
4297  else {
4298  node->flag &= ~NODE_DO_OUTPUT;
4299  }
4300 }
4301 
4302 static void rna_GroupOutput_is_active_output_set(PointerRNA *ptr, bool value)
4303 {
4305  bNode *node = ptr->data;
4306  if (value) {
4307  /* Make sure that no other group output is active at the same time. */
4308  LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
4309  if (other_node->type == NODE_GROUP_OUTPUT) {
4310  other_node->flag &= ~NODE_DO_OUTPUT;
4311  }
4312  }
4313  node->flag |= NODE_DO_OUTPUT;
4314  }
4315  else {
4316  node->flag &= ~NODE_DO_OUTPUT;
4317  }
4318 }
4319 
4320 static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr)
4321 {
4322  bNode *node = ptr->data;
4323  NodeShaderTexPointDensity *shader_point_density = node->storage;
4324  Object *ob = (Object *)node->id;
4325  ParticleSystem *psys = NULL;
4326  PointerRNA value;
4327 
4328  if (ob && shader_point_density->particle_system) {
4329  psys = BLI_findlink(&ob->particlesystem, shader_point_density->particle_system - 1);
4330  }
4331 
4332  RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
4333  return value;
4334 }
4335 
4336 static void rna_ShaderNodePointDensity_psys_set(PointerRNA *ptr,
4337  PointerRNA value,
4338  struct ReportList *UNUSED(reports))
4339 {
4340  bNode *node = ptr->data;
4341  NodeShaderTexPointDensity *shader_point_density = node->storage;
4342  Object *ob = (Object *)node->id;
4343 
4344  if (ob && value.owner_id == &ob->id) {
4345  shader_point_density->particle_system = BLI_findindex(&ob->particlesystem, value.data) + 1;
4346  }
4347  else {
4348  shader_point_density->particle_system = 0;
4349  }
4350 }
4351 
4352 static int point_density_particle_color_source_from_shader(
4353  NodeShaderTexPointDensity *shader_point_density)
4354 {
4355  switch (shader_point_density->color_source) {
4357  return TEX_PD_COLOR_PARTAGE;
4359  return TEX_PD_COLOR_PARTSPEED;
4361  return TEX_PD_COLOR_PARTVEL;
4362  default:
4363  BLI_assert_msg(0, "Unknown color source");
4364  return TEX_PD_COLOR_CONSTANT;
4365  }
4366 }
4367 
4368 static int point_density_vertex_color_source_from_shader(
4369  NodeShaderTexPointDensity *shader_point_density)
4370 {
4371  switch (shader_point_density->ob_color_source) {
4373  return TEX_PD_COLOR_VERTCOL;
4375  return TEX_PD_COLOR_VERTWEIGHT;
4377  return TEX_PD_COLOR_VERTNOR;
4378  default:
4379  BLI_assert_msg(0, "Unknown color source");
4380  return TEX_PD_COLOR_CONSTANT;
4381  }
4382 }
4383 
4384 void rna_ShaderNodePointDensity_density_cache(bNode *self, Depsgraph *depsgraph)
4385 {
4386  NodeShaderTexPointDensity *shader_point_density = self->storage;
4387  PointDensity *pd = &shader_point_density->pd;
4388 
4389  if (depsgraph == NULL) {
4390  return;
4391  }
4392 
4393  /* Make sure there's no cached data. */
4396 
4397  /* Create PointDensity structure from node for sampling. */
4399  pd->object = (Object *)self->id;
4400  pd->radius = shader_point_density->radius;
4401  if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
4402  pd->source = TEX_PD_PSYS;
4403  pd->psys = shader_point_density->particle_system;
4405  pd->color_source = point_density_particle_color_source_from_shader(shader_point_density);
4406  }
4407  else {
4408  BLI_assert(shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_OBJECT);
4409  pd->source = TEX_PD_OBJECT;
4411  pd->ob_color_source = point_density_vertex_color_source_from_shader(shader_point_density);
4413  shader_point_density->vertex_attribute_name,
4414  sizeof(pd->vertex_attribute_name));
4415  }
4416 
4417  /* Store resolution, so it can be changed in the UI. */
4418  shader_point_density->cached_resolution = shader_point_density->resolution;
4419 
4420  /* Single-threaded sampling of the voxel domain. */
4422 }
4423 
4424 void rna_ShaderNodePointDensity_density_calc(bNode *self,
4426  int *length,
4427  float **values)
4428 {
4429  NodeShaderTexPointDensity *shader_point_density = self->storage;
4430  PointDensity *pd = &shader_point_density->pd;
4431  const int resolution = shader_point_density->cached_resolution;
4432 
4433  if (depsgraph == NULL) {
4434  *length = 0;
4435  return;
4436  }
4437 
4438  /* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */
4439  *length = 4 * resolution * resolution * resolution;
4440 
4441  if (*values == NULL) {
4442  *values = MEM_mallocN(sizeof(float) * (*length), "point density dynamic array");
4443  }
4444 
4445  /* Single-threaded sampling of the voxel domain. */
4446  RE_point_density_sample(depsgraph, pd, resolution, *values);
4447 
4448  /* We're done, time to clean up. */
4450  memset(pd, 0, sizeof(*pd));
4451  shader_point_density->cached_resolution = 0.0f;
4452 }
4453 
4454 void rna_ShaderNodePointDensity_density_minmax(bNode *self,
4456  float r_min[3],
4457  float r_max[3])
4458 {
4459  NodeShaderTexPointDensity *shader_point_density = self->storage;
4460  PointDensity *pd = &shader_point_density->pd;
4461 
4462  if (depsgraph == NULL) {
4463  zero_v3(r_min);
4464  zero_v3(r_max);
4465  return;
4466  }
4467 
4468  RE_point_density_minmax(depsgraph, pd, r_min, r_max);
4469 }
4470 
4471 bool rna_NodeSocketMaterial_default_value_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
4472 {
4473  /* Do not show grease pencil materials for now. */
4474  Material *ma = (Material *)value.data;
4475  return ma->gp_style == NULL;
4476 }
4477 
4478 static int rna_NodeConvertColorSpace_from_color_space_get(struct PointerRNA *ptr)
4479 {
4480  bNode *node = (bNode *)ptr->data;
4481  NodeConvertColorSpace *node_storage = node->storage;
4482  return IMB_colormanagement_colorspace_get_named_index(node_storage->from_color_space);
4483 }
4484 
4485 static void rna_NodeConvertColorSpace_from_color_space_set(struct PointerRNA *ptr, int value)
4486 {
4487  bNode *node = (bNode *)ptr->data;
4488  NodeConvertColorSpace *node_storage = node->storage;
4489  const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
4490 
4491  if (name && name[0]) {
4492  BLI_strncpy(node_storage->from_color_space, name, sizeof(node_storage->from_color_space));
4493  }
4494 }
4495 static int rna_NodeConvertColorSpace_to_color_space_get(struct PointerRNA *ptr)
4496 {
4497  bNode *node = (bNode *)ptr->data;
4498  NodeConvertColorSpace *node_storage = node->storage;
4499  return IMB_colormanagement_colorspace_get_named_index(node_storage->to_color_space);
4500 }
4501 
4502 static void rna_NodeConvertColorSpace_to_color_space_set(struct PointerRNA *ptr, int value)
4503 {
4504  bNode *node = (bNode *)ptr->data;
4505  NodeConvertColorSpace *node_storage = node->storage;
4506  const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
4507 
4508  if (name && name[0]) {
4509  BLI_strncpy(node_storage->to_color_space, name, sizeof(node_storage->to_color_space));
4510  }
4511 }
4512 
4513 static const EnumPropertyItem *rna_NodeConvertColorSpace_color_space_itemf(
4514  bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
4515 {
4516  EnumPropertyItem *items = NULL;
4517  int totitem = 0;
4518 
4519  IMB_colormanagement_colorspace_items_add(&items, &totitem);
4520  RNA_enum_item_end(&items, &totitem);
4521 
4522  *r_free = true;
4523 
4524  return items;
4525 }
4526 
4527 #else
4528 
4530  {0, "PLACEHOLDER", 0, "Placeholder", ""},
4531  {0, NULL, 0, NULL, NULL},
4532 };
4533 
4535  {0, "ALL", 0, "All", ""},
4536  {0, NULL, 0, NULL, NULL},
4537 };
4538 
4540  {0, "PLACEHOLDER", 0, "Placeholder", ""},
4541  {0, NULL, 0, NULL, NULL},
4542 };
4543 
4545  {1, "R", 0, "R", "Red"},
4546  {2, "G", 0, "G", "Green"},
4547  {3, "B", 0, "B", "Blue"},
4548  {0, NULL, 0, NULL, NULL},
4549 };
4550 
4552  {0, "X", 0, "Flip X", ""},
4553  {1, "Y", 0, "Flip Y", ""},
4554  {2, "XY", 0, "Flip X & Y", ""},
4555  {0, NULL, 0, NULL, NULL},
4556 };
4557 
4559  {0, "ITUBT601", 0, "ITU 601", ""},
4560  {1, "ITUBT709", 0, "ITU 709", ""},
4561  {2, "JFIF", 0, "Jpeg", ""},
4562  {0, NULL, 0, NULL, NULL},
4563 };
4564 
4567  "SHARP",
4568  0,
4569  "Sharp",
4570  "Results in perfectly sharp reflections like a mirror. The Roughness value is not used"},
4571  {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4572  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4573  {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
4575  "MULTI_GGX",
4576  0,
4577  "Multiscatter GGX",
4578  "Slower than GGX but gives a more energy conserving results, which would otherwise be "
4579  "visible as excessive darkening"},
4580  {0, NULL, 0, NULL, NULL},
4581 };
4582 
4584  {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4585  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4587  "MULTI_GGX",
4588  0,
4589  "Multiscatter GGX",
4590  "Slower than GGX but gives a more energy conserving results, which would otherwise be "
4591  "visible as excessive darkening"},
4592  {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
4593  {0, NULL, 0, NULL, NULL},
4594 };
4595 
4598  "SHARP",
4599  0,
4600  "Sharp",
4601  "Results in perfectly sharp reflections like a mirror. The Roughness value is not used"},
4602  {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4603  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4605  "MULTI_GGX",
4606  0,
4607  "Multiscatter GGX",
4608  "Slower than GGX but gives a more energy conserving results, which would otherwise be "
4609  "visible as excessive darkening"},
4610  {0, NULL, 0, NULL, NULL},
4611 };
4612 
4615  "SHARP",
4616  0,
4617  "Sharp",
4618  "Results in perfectly sharp reflections like a mirror. The Roughness value is not used"},
4619  {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4620  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4621  {0, NULL, 0, NULL, NULL},
4622 };
4623 
4625  {SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", "Use diffuse BSDF"},
4626  {SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", "Use glossy BSDF"},
4627  {0, NULL, 0, NULL, NULL},
4628 };
4629 
4632  "Reflection",
4633  0,
4634  "Reflection",
4635  "The light that bounces off the surface of the hair"},
4637  "Transmission",
4638  0,
4639  "Transmission",
4640  "The light that passes through the hair and exits on the other side"},
4641  {0, NULL, 0, NULL, NULL},
4642 };
4643 
4646  "ABSORPTION",
4647  0,
4648  "Absorption Coefficient",
4649  "Directly set the absorption coefficient \"sigma_a\" (this is not the most intuitive way to "
4650  "color hair)"},
4652  "MELANIN",
4653  0,
4654  "Melanin Concentration",
4655  "Define the melanin concentrations below to get the most realistic-looking hair "
4656  "(you can get the concentrations for different types of hair online)"},
4658  "COLOR",
4659  0,
4660  "Direct Coloring",
4661  "Choose the color of your preference, and the shader will approximate the absorption "
4662  "coefficient to render lookalike hair"},
4663  {0, NULL, 0, NULL, NULL},
4664 };
4665 
4667  {NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
4668  {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
4669  {0, NULL, 0, NULL, NULL},
4670 };
4671 
4673  {NODE_IES_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
4674  {NODE_IES_EXTERNAL, "EXTERNAL", 0, "External", "Use external .ies file"},
4675  {0, NULL, 0, NULL, NULL},
4676 };
4677 
4679  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4681  "MULTI_GGX",
4682  0,
4683  "Multiscatter GGX",
4684  "Slower than GGX but gives a more energy conserving results, which would otherwise be "
4685  "visible as excessive darkening"},
4686  {0, NULL, 0, NULL, NULL},
4687 };
4688 
4691  "BURLEY",
4692  0,
4693  "Christensen-Burley",
4694  "Approximation to physically based volume scattering"},
4696  "RANDOM_WALK_FIXED_RADIUS",
4697  0,
4698  "Random Walk (Fixed Radius)",
4699  "Volumetric approximation to physically based volume scattering, using the scattering radius "
4700  "as specified"},
4702  "RANDOM_WALK",
4703  0,
4704  "Random Walk",
4705  "Volumetric approximation to physically based volume scattering, with scattering radius "
4706  "automatically adjusted to match color textures"},
4707  {0, NULL, 0, NULL, NULL}};
4708 
4709 /* -- Common nodes ---------------------------------------------------------- */
4710 
4711 static void def_group_input(StructRNA *srna)
4712 {
4713  PropertyRNA *prop;
4714 
4715  prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
4717  prop, NULL, NULL, "rna_NodeGroupInputOutput_interface_typef", NULL);
4718  RNA_def_property_struct_type(prop, "PropertyGroup");
4720  RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
4721 }
4722 
4723 static void def_group_output(StructRNA *srna)
4724 {
4725  PropertyRNA *prop;
4726 
4727  prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
4729  prop, NULL, NULL, "rna_NodeGroupInputOutput_interface_typef", NULL);
4730  RNA_def_property_struct_type(prop, "PropertyGroup");
4732  RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
4733 
4734  prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
4737  prop, "Active Output", "True if this node is used as the active group output");
4738  RNA_def_property_boolean_funcs(prop, NULL, "rna_GroupOutput_is_active_output_set");
4739  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4740 }
4741 
4742 static void def_group(StructRNA *srna)
4743 {
4744  PropertyRNA *prop;
4745 
4746  prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
4747  RNA_def_property_pointer_sdna(prop, NULL, "id");
4748  RNA_def_property_struct_type(prop, "NodeTree");
4750  prop, NULL, "rna_NodeGroup_node_tree_set", NULL, "rna_NodeGroup_node_tree_poll");
4753  RNA_def_property_ui_text(prop, "Node Tree", "");
4754  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
4755 
4756  prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
4757  RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_NodeGroup_interface_typef", NULL);
4758  RNA_def_property_struct_type(prop, "PropertyGroup");
4760  RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
4761 }
4762 
4763 static void def_custom_group(BlenderRNA *brna,
4764  const char *struct_name,
4765  const char *base_name,
4766  const char *ui_name,
4767  const char *ui_desc,
4768  const char *reg_func)
4769 {
4770  StructRNA *srna;
4771 
4772  srna = RNA_def_struct(brna, struct_name, base_name);
4773  RNA_def_struct_ui_text(srna, ui_name, ui_desc);
4774  RNA_def_struct_sdna(srna, "bNode");
4775 
4776  RNA_def_struct_register_funcs(srna, reg_func, "rna_Node_unregister", NULL);
4777 
4778  def_group(srna);
4779 }
4780 
4781 static void def_frame(StructRNA *srna)
4782 {
4783  PropertyRNA *prop;
4784 
4785  prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
4786  RNA_def_property_pointer_sdna(prop, NULL, "id");
4787  RNA_def_property_struct_type(prop, "Text");
4790  RNA_def_property_ui_text(prop, "Text", "");
4791  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4792 
4793  RNA_def_struct_sdna_from(srna, "NodeFrame", "storage");
4795 
4796  prop = RNA_def_property(srna, "shrink", PROP_BOOLEAN, PROP_NONE);
4798  RNA_def_property_ui_text(prop, "Shrink", "Shrink the frame to minimal bounding box");
4800 
4801  prop = RNA_def_property(srna, "label_size", PROP_INT, PROP_NONE);
4802  RNA_def_property_int_sdna(prop, NULL, "label_size");
4803  RNA_def_property_range(prop, 8, 64);
4804  RNA_def_property_ui_text(prop, "Label Font Size", "Font size to use for displaying the label");
4806 }
4807 
4808 static void def_clamp(StructRNA *srna)
4809 {
4810  PropertyRNA *prop;
4811 
4812  prop = RNA_def_property(srna, "clamp_type", PROP_ENUM, PROP_NONE);
4813  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4815  RNA_def_property_ui_text(prop, "Clamp Type", "");
4816  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4817 }
4818 
4819 static void def_map_range(StructRNA *srna)
4820 {
4821  static const EnumPropertyItem rna_enum_data_type_items[] = {
4822  {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
4823  {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
4824  {0, NULL, 0, NULL, NULL},
4825  };
4826 
4827  RNA_def_struct_sdna_from(srna, "NodeMapRange", "storage");
4828 
4829  PropertyRNA *prop;
4830 
4831  prop = RNA_def_property(srna, "clamp", PROP_BOOLEAN, PROP_NONE);
4832  RNA_def_property_boolean_sdna(prop, NULL, "clamp", 1);
4833  RNA_def_property_ui_text(prop, "Clamp", "Clamp the result to the target range [To Min, To Max]");
4834  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4835 
4836  prop = RNA_def_property(srna, "interpolation_type", PROP_ENUM, PROP_NONE);
4837  RNA_def_property_enum_sdna(prop, NULL, "interpolation_type");
4839  RNA_def_property_ui_text(prop, "Interpolation Type", "");
4840  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4841 
4842  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
4843  RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_type");
4844  RNA_def_property_enum_items(prop, rna_enum_data_type_items);
4845  RNA_def_property_ui_text(prop, "Data Type", "");
4846  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4847 }
4848 
4849 static void def_math(StructRNA *srna)
4850 {
4851  PropertyRNA *prop;
4852 
4853  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4854  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4856  RNA_def_property_ui_text(prop, "Operation", "");
4858  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4859 
4860  prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
4862  RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
4863  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4864 }
4865 
4866 static void def_boolean_math(StructRNA *srna)
4867 {
4868  PropertyRNA *prop;
4869 
4870  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4871  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4873  RNA_def_property_ui_text(prop, "Operation", "");
4874  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
4875 }
4876 
4877 static void def_compare(StructRNA *srna)
4878 {
4879 
4880  static const EnumPropertyItem mode_items[] = {
4882  "ELEMENT",
4883  0,
4884  "Element-Wise",
4885  "Compare each element of the input vectors"},
4886  {NODE_COMPARE_MODE_LENGTH, "LENGTH", 0, "Length", "Compare the length of the input vectors"},
4888  "AVERAGE",
4889  0,
4890  "Average",
4891  "Compare the average of the input vectors elements"},
4893  "DOT_PRODUCT",
4894  0,
4895  "Dot Product",
4896  "Compare the dot products of the input vectors"},
4898  "DIRECTION",
4899  0,
4900  "Direction",
4901  "Compare the direction of the input vectors"},
4902  {0, NULL, 0, NULL, NULL},
4903  };
4904 
4905  PropertyRNA *prop;
4906 
4907  RNA_def_struct_sdna_from(srna, "NodeFunctionCompare", "storage");
4908 
4909  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4910  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FunctionNodeCompare_operation_itemf");
4913  RNA_def_property_ui_text(prop, "Operation", "");
4914  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
4915 
4916  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
4917  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FunctionNodeCompare_type_itemf");
4920  RNA_def_property_ui_text(prop, "Input Type", "");
4921  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNodeCompare_data_type_update");
4922 
4923  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
4926  RNA_def_property_ui_text(prop, "Mode", "");
4927  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
4928 }
4929 
4930 static void def_float_to_int(StructRNA *srna)
4931 {
4932  PropertyRNA *prop;
4933 
4934  prop = RNA_def_property(srna, "rounding_mode", PROP_ENUM, PROP_NONE);
4935  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4938  prop, "Rounding Mode", "Method used to convert the float to an integer");
4939  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4940 }
4941 
4942 static void def_vector_math(StructRNA *srna)
4943 {
4944  PropertyRNA *prop;
4945 
4946  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4947  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4949  RNA_def_property_ui_text(prop, "Operation", "");
4950  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4951 }
4952 
4953 static void def_rgb_curve(StructRNA *srna)
4954 {
4955  PropertyRNA *prop;
4956 
4957  prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
4958  RNA_def_property_pointer_sdna(prop, NULL, "storage");
4959  RNA_def_property_struct_type(prop, "CurveMapping");
4960  RNA_def_property_ui_text(prop, "Mapping", "");
4961  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4962 }
4963 
4964 static void def_vector_curve(StructRNA *srna)
4965 {
4966  PropertyRNA *prop;
4967 
4968  prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
4969  RNA_def_property_pointer_sdna(prop, NULL, "storage");
4970  RNA_def_property_struct_type(prop, "CurveMapping");
4971  RNA_def_property_ui_text(prop, "Mapping", "");
4972  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4973 }
4974 
4975 static void def_float_curve(StructRNA *srna)
4976 {
4977  PropertyRNA *prop;
4978 
4979  prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
4980  RNA_def_property_pointer_sdna(prop, NULL, "storage");
4981  RNA_def_property_struct_type(prop, "CurveMapping");
4982  RNA_def_property_ui_text(prop, "Mapping", "");
4983  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4984 }
4985 
4986 static void def_time(StructRNA *srna)
4987 {
4988  PropertyRNA *prop;
4989 
4990  prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
4991  RNA_def_property_pointer_sdna(prop, NULL, "storage");
4992  RNA_def_property_struct_type(prop, "CurveMapping");
4993  RNA_def_property_ui_text(prop, "Curve", "");
4994  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4995 
4996  prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
4997  RNA_def_property_int_sdna(prop, NULL, "custom1");
4998  RNA_def_property_ui_text(prop, "Start Frame", "");
4999  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5000 
5001  prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
5002  RNA_def_property_int_sdna(prop, NULL, "custom2");
5003  RNA_def_property_ui_text(prop, "End Frame", "");
5004  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5005 }
5006 
5007 static void def_colorramp(StructRNA *srna)
5008 {
5009  PropertyRNA *prop;
5010 
5011  prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
5012  RNA_def_property_pointer_sdna(prop, NULL, "storage");
5013  RNA_def_property_struct_type(prop, "ColorRamp");
5014  RNA_def_property_ui_text(prop, "Color Ramp", "");
5015  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5016 }
5017 
5018 static void def_mix_rgb(StructRNA *srna)
5019 {
5020  PropertyRNA *prop;
5021 
5022  prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
5023  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5025  RNA_def_property_ui_text(prop, "Blending Mode", "");
5026  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5027 
5028  prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
5030  RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
5031  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5032 
5033  prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
5035  RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
5036  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5037 }
5038 
5039 static void def_texture(StructRNA *srna)
5040 {
5041  PropertyRNA *prop;
5042 
5043  prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
5044  RNA_def_property_pointer_sdna(prop, NULL, "id");
5045  RNA_def_property_struct_type(prop, "Texture");
5048  RNA_def_property_ui_text(prop, "Texture", "");
5049  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5050 
5051  prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
5052  RNA_def_property_int_sdna(prop, NULL, "custom1");
5054  prop, "Node Output", "For node-based textures, which output node to use");
5055  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5056 }
5057 
5058 static void def_fn_input_color(StructRNA *srna)
5059 {
5060  PropertyRNA *prop;
5061 
5062  RNA_def_struct_sdna_from(srna, "NodeInputColor", "storage");
5063 
5064  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
5065  RNA_def_property_array(prop, 4);
5066  RNA_def_property_float_sdna(prop, NULL, "color");
5067  RNA_def_property_ui_text(prop, "Color", "");
5068  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5069 }
5070 
5071 static void def_fn_input_bool(StructRNA *srna)
5072 {
5073  PropertyRNA *prop;
5074 
5075  RNA_def_struct_sdna_from(srna, "NodeInputBool", "storage");
5076 
5077  prop = RNA_def_property(srna, "boolean", PROP_BOOLEAN, PROP_NONE);
5078  RNA_def_property_boolean_sdna(prop, NULL, "boolean", 1);
5079  RNA_def_property_ui_text(prop, "Boolean", "Input value used for unconnected socket");
5080  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5081 }
5082 
5083 static void def_fn_input_int(StructRNA *srna)
5084 {
5085  PropertyRNA *prop;
5086 
5087  RNA_def_struct_sdna_from(srna, "NodeInputInt", "storage");
5088 
5089  prop = RNA_def_property(srna, "integer", PROP_INT, PROP_NONE);
5090  RNA_def_property_int_sdna(prop, NULL, "integer");
5092  RNA_def_property_ui_text(prop, "Integer", "Input value used for unconnected socket");
5093  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5094 }
5095 
5096 static void def_fn_input_vector(StructRNA *srna)
5097 {
5098  PropertyRNA *prop;
5099 
5100  RNA_def_struct_sdna_from(srna, "NodeInputVector", "storage");
5101 
5102  prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_XYZ);
5103  RNA_def_property_array(prop, 3);
5104  RNA_def_property_float_sdna(prop, NULL, "vector");
5105  RNA_def_property_ui_text(prop, "Vector", "");
5106  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5107 }
5108 
5109 static void def_fn_input_string(StructRNA *srna)
5110 {
5111  PropertyRNA *prop;
5112 
5113  RNA_def_struct_sdna_from(srna, "NodeInputString", "storage");
5114 
5115  prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
5116  RNA_def_property_ui_text(prop, "String", "");
5117  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5118 }
5119 
5121 {
5122  PropertyRNA *prop;
5123 
5124  RNA_def_struct_sdna_from(srna, "NodeCombSepColor", "storage");
5125 
5126  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
5128  RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
5129  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
5130 }
5131 
5132 /* -- Shader Nodes ---------------------------------------------------------- */
5133 
5134 static void def_sh_output(StructRNA *srna)
5135 {
5136  PropertyRNA *prop;
5137 
5138  prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
5141  prop, "Active Output", "True if this node is used as the active output");
5142  RNA_def_property_boolean_funcs(prop, NULL, "rna_ShaderNode_is_active_output_set");
5143  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5144 
5145  prop = RNA_def_property(srna, "target", PROP_ENUM, PROP_NONE);
5146  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5149  prop, "Target", "Which renderer and viewport shading types to use the shaders for");
5150  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5151 }
5152 
5154 {
5155  def_sh_output(srna);
5156  def_mix_rgb(srna);
5157 }
5158 
5159 static void def_sh_mapping(StructRNA *srna)
5160 {
5161  PropertyRNA *prop;
5162 
5163  prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
5164  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5166  RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
5167  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5168 }
5169 
5171 {
5172  PropertyRNA *prop;
5173 
5174  prop = RNA_def_property(srna, "rotation_type", PROP_ENUM, PROP_NONE);
5175  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5177  RNA_def_property_ui_text(prop, "Type", "Type of rotation");
5178  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5179 
5180  prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
5181  RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0);
5182  RNA_def_property_ui_text(prop, "Invert", "Invert angle");
5183  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5184 }
5185 
5186 static void def_sh_attribute(StructRNA *srna)
5187 {
5188  static const EnumPropertyItem prop_attribute_type[] = {
5190  "GEOMETRY",
5191  0,
5192  "Geometry",
5193  "The attribute is associated with the object geometry, and its value "
5194  "varies from vertex to vertex, or within the object volume"},
5196  "OBJECT",
5197  0,
5198  "Object",
5199  "The attribute is associated with the object or mesh data-block itself, "
5200  "and its value is uniform"},
5202  "INSTANCER",
5203  0,
5204  "Instancer",
5205  "The attribute is associated with the instancer particle system or object, "
5206  "falling back to the Object mode if the attribute isn't found, or the object "
5207  "is not instanced"},
5208  {0, NULL, 0, NULL, NULL},
5209  };
5210  PropertyRNA *prop;
5211 
5212  RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage");
5213 
5214  prop = RNA_def_property(srna, "attribute_type", PROP_ENUM, PROP_NONE);
5215  RNA_def_property_enum_sdna(prop, NULL, "type");
5216  RNA_def_property_enum_items(prop, prop_attribute_type);
5217  RNA_def_property_ui_text(prop, "Attribute Type", "General type of the attribute");
5218  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5219 
5220  prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
5221  RNA_def_property_string_sdna(prop, NULL, "name");
5222  RNA_def_property_ui_text(prop, "Attribute Name", "");
5223  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5224 }
5225 
5226 static void def_sh_tex(StructRNA *srna)
5227 {
5228  PropertyRNA *prop;
5229 
5230  prop = RNA_def_property(srna, "texture_mapping", PROP_POINTER, PROP_NONE);
5231  RNA_def_property_pointer_sdna(prop, NULL, "base.tex_mapping");
5233  RNA_def_property_ui_text(prop, "Texture Mapping", "Texture coordinate mapping settings");
5234 
5235  prop = RNA_def_property(srna, "color_mapping", PROP_POINTER, PROP_NONE);
5236  RNA_def_property_pointer_sdna(prop, NULL, "base.color_mapping");
5238  RNA_def_property_ui_text(prop, "Color Mapping", "Color mapping settings");
5239 }
5240 
5241 static void def_sh_tex_sky(StructRNA *srna)
5242 {
5243  static const EnumPropertyItem prop_sky_type[] = {
5244  {SHD_SKY_PREETHAM, "PREETHAM", 0, "Preetham", "Preetham 1999"},
5245  {SHD_SKY_HOSEK, "HOSEK_WILKIE", 0, "Hosek / Wilkie", "Hosek / Wilkie 2012"},
5246  {SHD_SKY_NISHITA, "NISHITA", 0, "Nishita", "Nishita 1993 improved"},
5247  {0, NULL, 0, NULL, NULL},
5248  };
5249  static float default_dir[3] = {0.0f, 0.0f, 1.0f};
5250 
5251  PropertyRNA *prop;
5252 
5253  RNA_def_struct_sdna_from(srna, "NodeTexSky", "storage");
5254  def_sh_tex(srna);
5255 
5256  prop = RNA_def_property(srna, "sky_type", PROP_ENUM, PROP_NONE);
5257  RNA_def_property_enum_sdna(prop, NULL, "sky_model");
5258  RNA_def_property_enum_items(prop, prop_sky_type);
5259  RNA_def_property_ui_text(prop, "Sky Type", "Which sky model should be used");
5260  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5261 
5262  prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION);
5263  RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining");
5264  RNA_def_property_array(prop, 3);
5265  RNA_def_property_float_array_default(prop, default_dir);
5266  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5267 
5268  prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE);
5269  RNA_def_property_range(prop, 1.0f, 10.0f);
5270  RNA_def_property_ui_range(prop, 1.0f, 10.0f, 10, 3);
5271  RNA_def_property_ui_text(prop, "Turbidity", "Atmospheric turbidity");
5272  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5273 
5274  prop = RNA_def_property(srna, "ground_albedo", PROP_FLOAT, PROP_FACTOR);
5275  RNA_def_property_range(prop, 0.0f, 1.0f);
5277  prop, "Ground Albedo", "Ground color that is subtly reflected in the sky");
5278  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5279 
5280  prop = RNA_def_property(srna, "sun_disc", PROP_BOOLEAN, PROP_NONE);
5281  RNA_def_property_ui_text(prop, "Sun Disc", "Include the sun itself in the output");
5282  RNA_def_property_boolean_sdna(prop, NULL, "sun_disc", 1);
5284  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5285 
5286  prop = RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_ANGLE);
5287  RNA_def_property_ui_text(prop, "Sun Size", "Size of sun disc");
5288  RNA_def_property_range(prop, 0.0f, M_PI_2);
5290  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5291 
5292  prop = RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
5293  RNA_def_property_ui_text(prop, "Sun Intensity", "Strength of sun");
5294  RNA_def_property_range(prop, 0.0f, 1000.0f);
5295  RNA_def_property_float_default(prop, 1.0f);
5296  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5297 
5298  prop = RNA_def_property(srna, "sun_elevation", PROP_FLOAT, PROP_ANGLE);
5299  RNA_def_property_ui_text(prop, "Sun Elevation", "Sun angle from horizon");
5301  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5302 
5303  prop = RNA_def_property(srna, "sun_rotation", PROP_FLOAT, PROP_ANGLE);
5304  RNA_def_property_ui_text(prop, "Sun Rotation", "Rotation of sun around zenith");
5305  RNA_def_property_float_default(prop, 0.0f);
5306  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5307 
5308  prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_DISTANCE);
5309  RNA_def_property_ui_text(prop, "Altitude", "Height from sea level");
5310  RNA_def_property_range(prop, 0.0f, 60000.0f);
5311  RNA_def_property_ui_range(prop, 0.0f, 60000.0f, 10, 1);
5312  RNA_def_property_float_default(prop, 0.0f);
5313  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5314 
5315  prop = RNA_def_property(srna, "air_density", PROP_FLOAT, PROP_FACTOR);
5316  RNA_def_property_ui_text(prop, "Air", "Density of air molecules");
5317  RNA_def_property_range(prop, 0.0f, 10.0f);
5318  RNA_def_property_float_default(prop, 1.0f);
5319  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5320 
5321  prop = RNA_def_property(srna, "dust_density", PROP_FLOAT, PROP_FACTOR);
5322  RNA_def_property_ui_text(prop, "Dust", "Density of dust molecules and water droplets");
5323  RNA_def_property_range(prop, 0.0f, 10.0f);
5324  RNA_def_property_float_default(prop, 1.0f);
5325  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5326 
5327  prop = RNA_def_property(srna, "ozone_density", PROP_FLOAT, PROP_FACTOR);
5328  RNA_def_property_ui_text(prop, "Ozone", "Density of ozone layer");
5329  RNA_def_property_range(prop, 0.0f, 10.0f);
5330  RNA_def_property_float_default(prop, 1.0f);
5331  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5332 }
5333 
5335  {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
5336  {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
5337  {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
5338  {SHD_INTERP_SMART, "Smart", 0, "Smart", "Bicubic when magnifying, else bilinear (OSL only)"},
5339  {0, NULL, 0, NULL, NULL},
5340 };
5341 
5343 {
5344  static const EnumPropertyItem prop_projection_items[] = {
5346  "EQUIRECTANGULAR",
5347  0,
5348  "Equirectangular",
5349  "Equirectangular or latitude-longitude projection"},
5351  "MIRROR_BALL",
5352  0,
5353  "Mirror Ball",
5354  "Projection from an orthographic photo of a mirror ball"},
5355  {0, NULL, 0, NULL, NULL},
5356  };
5357 
5358  PropertyRNA *prop;
5359 
5360  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
5361  RNA_def_property_pointer_sdna(prop, NULL, "id");
5362  RNA_def_property_struct_type(prop, "Image");
5365  RNA_def_property_ui_text(prop, "Image", "");
5366  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
5367 
5368  RNA_def_struct_sdna_from(srna, "NodeTexEnvironment", "storage");
5369  def_sh_tex(srna);
5370 
5371  prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
5372  RNA_def_property_enum_items(prop, prop_projection_items);
5373  RNA_def_property_ui_text(prop, "Projection", "Projection of the input image");
5374  RNA_def_property_update(prop, 0, "rna_Node_update");
5375 
5376  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5378  RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
5379  RNA_def_property_update(prop, 0, "rna_Node_update");
5380 
5381  prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
5383  RNA_def_property_pointer_sdna(prop, NULL, "iuser");
5385  prop,
5386  "Image User",
5387  "Parameters defining which layer, pass and frame of the image is displayed");
5388  RNA_def_property_update(prop, 0, "rna_Node_update");
5389 }
5390 
5391 static void def_sh_tex_image(StructRNA *srna)
5392 {
5393  static const EnumPropertyItem prop_projection_items[] = {
5394  {SHD_PROJ_FLAT,
5395  "FLAT",
5396  0,
5397  "Flat",
5398  "Image is projected flat using the X and Y coordinates of the texture vector"},
5399  {SHD_PROJ_BOX,
5400  "BOX",
5401  0,
5402  "Box",
5403  "Image is projected using different components for each side of the object space bounding "
5404  "box"},
5405  {SHD_PROJ_SPHERE,
5406  "SPHERE",
5407  0,
5408  "Sphere",
5409  "Image is projected spherically using the Z axis as central"},
5410  {SHD_PROJ_TUBE,
5411  "TUBE",
5412  0,
5413  "Tube",
5414  "Image is projected from the tube using the Z axis as central"},
5415  {0, NULL, 0, NULL, NULL},
5416  };
5417 
5418  static const EnumPropertyItem prop_image_extension[] = {
5420  "REPEAT",
5421  0,
5422  "Repeat",
5423  "Cause the image to repeat horizontally and vertically"},
5425  "EXTEND",
5426  0,
5427  "Extend",
5428  "Extend by repeating edge pixels of the image"},
5430  "CLIP",
5431  0,
5432  "Clip",
5433  "Clip to image size and set exterior pixels as transparent"},
5434  {0, NULL, 0, NULL, NULL},
5435  };
5436 
5437  PropertyRNA *prop;
5438 
5439  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
5440  RNA_def_property_pointer_sdna(prop, NULL, "id");
5441  RNA_def_property_struct_type(prop, "Image");
5444  RNA_def_property_ui_text(prop, "Image", "");
5445  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
5446 
5447  RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
5448  def_sh_tex(srna);
5449 
5450  prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
5451  RNA_def_property_enum_items(prop, prop_projection_items);
5453  prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
5454  RNA_def_property_update(prop, 0, "rna_Node_update");
5455 
5456  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5458  RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
5459  RNA_def_property_update(prop, 0, "rna_Node_update");
5460 
5461  prop = RNA_def_property(srna, "projection_blend", PROP_FLOAT, PROP_FACTOR);
5463  prop, "Projection Blend", "For box projection, amount of blend to use between sides");
5464  RNA_def_property_update(prop, 0, "rna_Node_update");
5465 
5466  prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
5467  RNA_def_property_enum_items(prop, prop_image_extension);
5469  prop, "Extension", "How the image is extrapolated past its original bounds");
5470  RNA_def_property_update(prop, 0, "rna_Node_update");
5471 
5472  prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
5474  RNA_def_property_pointer_sdna(prop, NULL, "iuser");
5476  prop,
5477  "Image User",
5478  "Parameters defining which layer, pass and frame of the image is displayed");
5479  RNA_def_property_update(prop, 0, "rna_Node_update");
5480 }
5481 
5483 {
5484  PropertyRNA *prop;
5485 
5486  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
5487  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5489  RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
5490  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
5491 }
5492 
5494 {
5495  static const EnumPropertyItem fn_tex_prop_interpolation_items[] = {
5496  {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
5497  {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
5498  {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
5499  {0, NULL, 0, NULL, NULL},
5500  };
5501 
5502  static const EnumPropertyItem prop_image_extension[] = {
5504  "REPEAT",
5505  0,
5506  "Repeat",
5507  "Cause the image to repeat horizontally and vertically"},
5509  "EXTEND",
5510  0,
5511  "Extend",
5512  "Extend by repeating edge pixels of the image"},
5514  "CLIP",
5515  0,
5516  "Clip",
5517  "Clip to image size and set exterior pixels as transparent"},
5518  {0, NULL, 0, NULL, NULL},
5519  };
5520 
5521  PropertyRNA *prop;
5522 
5523  RNA_def_struct_sdna_from(srna, "NodeGeometryImageTexture", "storage");
5524 
5525  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5526  RNA_def_property_enum_items(prop, fn_tex_prop_interpolation_items);
5527  RNA_def_property_ui_text(prop, "Interpolation", "Method for smoothing values between pixels");
5528  RNA_def_property_update(prop, 0, "rna_Node_update");
5529 
5530  prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
5531  RNA_def_property_enum_items(prop, prop_image_extension);
5533  prop, "Extension", "How the image is extrapolated past its original bounds");
5534  RNA_def_property_update(prop, 0, "rna_Node_update");
5535 }
5536 
5537 static void def_sh_tex_gradient(StructRNA *srna)
5538 {
5539  static const EnumPropertyItem prop_gradient_type[] = {
5540  {SHD_BLEND_LINEAR, "LINEAR", 0, "Linear", "Create a linear progression"},
5541  {SHD_BLEND_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
5543  "EASING",
5544  0,
5545  "Easing",
5546  "Create a progression easing from one step to the next"},
5547  {SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
5548  {SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
5550  "QUADRATIC_SPHERE",
5551  0,
5552  "Quadratic Sphere",
5553  "Create a quadratic progression in the shape of a sphere"},
5554  {SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Create a radial progression"},
5555  {0, NULL, 0, NULL, NULL},
5556  };
5557 
5558  PropertyRNA *prop;
5559 
5560  RNA_def_struct_sdna_from(srna, "NodeTexGradient", "storage");
5561  def_sh_tex(srna);
5562 
5563  prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
5564  RNA_def_property_enum_items(prop, prop_gradient_type);
5565  RNA_def_property_ui_text(prop, "Gradient Type", "Style of the color blending");
5566  RNA_def_property_update(prop, 0, "rna_Node_update");
5567 }
5568 
5569 static void def_sh_tex_noise(StructRNA *srna)
5570 {
5571  PropertyRNA *prop;
5572 
5573  RNA_def_struct_sdna_from(srna, "NodeTexNoise", "storage");
5574  def_sh_tex(srna);
5575 
5576  prop = RNA_def_property(srna, "noise_dimensions", PROP_ENUM, PROP_NONE);
5577  RNA_def_property_enum_sdna(prop, NULL, "dimensions");
5579  RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
5580  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5581 }
5582 
5583 static void def_sh_tex_checker(StructRNA *srna)
5584 {
5585  RNA_def_struct_sdna_from(srna, "NodeTexChecker", "storage");
5586  def_sh_tex(srna);
5587 }
5588 
5589 static void def_sh_tex_brick(StructRNA *srna)
5590 {
5591  PropertyRNA *prop;
5592 
5593  RNA_def_struct_sdna_from(srna, "NodeTexBrick", "storage");
5594  def_sh_tex(srna);
5595 
5596  prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
5597  RNA_def_property_int_sdna(prop, NULL, "offset_freq");
5599  RNA_def_property_range(prop, 1, 99);
5600  RNA_def_property_ui_text(prop, "Offset Frequency", "");
5601  RNA_def_property_update(prop, 0, "rna_Node_update");
5602 
5603  prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
5604  RNA_def_property_int_sdna(prop, NULL, "squash_freq");
5606  RNA_def_property_range(prop, 1, 99);
5607  RNA_def_property_ui_text(prop, "Squash Frequency", "");
5608  RNA_def_property_update(prop, 0, "rna_Node_update");
5609 
5610  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
5611  RNA_def_property_float_sdna(prop, NULL, "offset");
5612  RNA_def_property_float_default(prop, 0.5f);
5613  RNA_def_property_range(prop, 0.0f, 1.0f);
5614  RNA_def_property_ui_text(prop, "Offset Amount", "");
5615  RNA_def_property_update(prop, 0, "rna_Node_update");
5616 
5617  prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
5618  RNA_def_property_float_sdna(prop, NULL, "squash");
5619  RNA_def_property_float_default(prop, 1.0f);
5620  RNA_def_property_range(prop, 0.0f, 99.0f);
5621  RNA_def_property_ui_text(prop, "Squash Amount", "");
5622  RNA_def_property_update(prop, 0, "rna_Node_update");
5623 }
5624 
5625 static void def_sh_tex_magic(StructRNA *srna)
5626 {
5627  PropertyRNA *prop;
5628 
5629  RNA_def_struct_sdna_from(srna, "NodeTexMagic", "storage");
5630  def_sh_tex(srna);
5631 
5632  prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
5633  RNA_def_property_int_sdna(prop, NULL, "depth");
5634  RNA_def_property_range(prop, 0, 10);
5635  RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
5636  RNA_def_property_update(prop, 0, "rna_Node_update");
5637 }
5638 
5639 static void def_sh_tex_musgrave(StructRNA *srna)
5640 {
5641  static const EnumPropertyItem prop_musgrave_type[] = {
5643  "MULTIFRACTAL",
5644  0,
5645  "Multifractal",
5646  "More uneven result (varies with location), more similar to a real terrain"},
5648  "RIDGED_MULTIFRACTAL",
5649  0,
5650  "Ridged Multifractal",
5651  "Create sharp peaks"},
5653  "HYBRID_MULTIFRACTAL",
5654  0,
5655  "Hybrid Multifractal",
5656  "Create peaks and valleys with different roughness values"},
5657  {SHD_MUSGRAVE_FBM, "FBM", 0, "fBM", "Produce an unnatural homogeneous and isotropic result"},
5659  "HETERO_TERRAIN",
5660  0,
5661  "Hetero Terrain",
5662  "Similar to Hybrid Multifractal creates a heterogeneous terrain, but with the likeness of "
5663  "river channels"},
5664  {0, NULL, 0, NULL, NULL},
5665  };
5666 
5667  PropertyRNA *prop;
5668 
5669  RNA_def_struct_sdna_from(srna, "NodeTexMusgrave", "storage");
5670  def_sh_tex(srna);
5671 
5672  prop = RNA_def_property(srna, "musgrave_dimensions", PROP_ENUM, PROP_NONE);
5673  RNA_def_property_enum_sdna(prop, NULL, "dimensions");
5675  RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
5676  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5677 
5678  prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
5679  RNA_def_property_enum_sdna(prop, NULL, "musgrave_type");
5680  RNA_def_property_enum_items(prop, prop_musgrave_type);
5681  RNA_def_property_ui_text(prop, "Type", "Type of the Musgrave texture");
5682  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5683 }
5684 
5685 static void def_sh_tex_voronoi(StructRNA *srna)
5686 {
5687  static EnumPropertyItem prop_distance_items[] = {
5688  {SHD_VORONOI_EUCLIDEAN, "EUCLIDEAN", 0, "Euclidean", "Euclidean distance"},
5689  {SHD_VORONOI_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Manhattan distance"},
5690  {SHD_VORONOI_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Chebychev distance"},
5691  {SHD_VORONOI_MINKOWSKI, "MINKOWSKI", 0, "Minkowski", "Minkowski distance"},
5692  {0, NULL, 0, NULL, NULL}};
5693 
5694  static EnumPropertyItem prop_feature_items[] = {
5695  {SHD_VORONOI_F1,
5696  "F1",
5697  0,
5698  "F1",
5699  "Computes the distance to the closest point as well as its position and color"},
5700  {SHD_VORONOI_F2,
5701  "F2",
5702  0,
5703  "F2",
5704  "Computes the distance to the second closest point as well as its position and color"},
5706  "SMOOTH_F1",
5707  0,
5708  "Smooth F1",
5709  "Smoothed version of F1. Weighted sum of neighbor voronoi cells"},
5711  "DISTANCE_TO_EDGE",
5712  0,
5713  "Distance to Edge",
5714  "Computes the distance to the edge of the voronoi cell"},
5716  "N_SPHERE_RADIUS",
5717  0,
5718  "N-Sphere Radius",
5719  "Computes the radius of the n-sphere inscribed in the voronoi cell"},
5720  {0, NULL, 0, NULL, NULL}};
5721 
5722  PropertyRNA *prop;
5723 
5724  RNA_def_struct_sdna_from(srna, "NodeTexVoronoi", "storage");
5725  def_sh_tex(srna);
5726 
5727  prop = RNA_def_property(srna, "voronoi_dimensions", PROP_ENUM, PROP_NONE);
5728  RNA_def_property_enum_sdna(prop, NULL, "dimensions");
5730  RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
5731  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5732 
5733  prop = RNA_def_property(srna, "distance", PROP_ENUM, PROP_NONE);
5734  RNA_def_property_enum_sdna(prop, NULL, "distance");
5735  RNA_def_property_enum_items(prop, prop_distance_items);
5737  prop, "Distance Metric", "The distance metric used to compute the texture");
5738  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5739 
5740  prop = RNA_def_property(srna, "feature", PROP_ENUM, PROP_NONE);
5741  RNA_def_property_enum_sdna(prop, NULL, "feature");
5742  RNA_def_property_enum_items(prop, prop_feature_items);
5744  prop, "Feature Output", "The Voronoi feature that the node will compute");
5745  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5746 }
5747 
5748 static void def_sh_tex_wave(StructRNA *srna)
5749 {
5750  static const EnumPropertyItem prop_wave_type_items[] = {
5751  {SHD_WAVE_BANDS, "BANDS", 0, "Bands", "Use standard wave texture in bands"},
5752  {SHD_WAVE_RINGS, "RINGS", 0, "Rings", "Use wave texture in rings"},
5753  {0, NULL, 0, NULL, NULL},
5754  };
5755 
5756  static EnumPropertyItem prop_wave_bands_direction_items[] = {
5757  {SHD_WAVE_BANDS_DIRECTION_X, "X", 0, "X", "Bands across X axis"},
5758  {SHD_WAVE_BANDS_DIRECTION_Y, "Y", 0, "Y", "Bands across Y axis"},
5759  {SHD_WAVE_BANDS_DIRECTION_Z, "Z", 0, "Z", "Bands across Z axis"},
5760  {SHD_WAVE_BANDS_DIRECTION_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Bands across diagonal axis"},
5761  {0, NULL, 0, NULL, NULL},
5762  };
5763 
5764  static EnumPropertyItem prop_wave_rings_direction_items[] = {
5765  {SHD_WAVE_RINGS_DIRECTION_X, "X", 0, "X", "Rings along X axis"},
5766  {SHD_WAVE_RINGS_DIRECTION_Y, "Y", 0, "Y", "Rings along Y axis"},
5767  {SHD_WAVE_RINGS_DIRECTION_Z, "Z", 0, "Z", "Rings along Z axis"},
5769  "SPHERICAL",
5770  0,
5771  "Spherical",
5772  "Rings along spherical distance"},
5773  {0, NULL, 0, NULL, NULL},
5774  };
5775 
5776  static const EnumPropertyItem prop_wave_profile_items[] = {
5777  {SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"},
5778  {SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"},
5779  {SHD_WAVE_PROFILE_TRI, "TRI", 0, "Triangle", "Use a triangle profile"},
5780  {0, NULL, 0, NULL, NULL},
5781  };
5782 
5783  PropertyRNA *prop;
5784 
5785  RNA_def_struct_sdna_from(srna, "NodeTexWave", "storage");
5786  def_sh_tex(srna);
5787 
5788  prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
5789  RNA_def_property_enum_sdna(prop, NULL, "wave_type");
5790  RNA_def_property_enum_items(prop, prop_wave_type_items);
5791  RNA_def_property_ui_text(prop, "Wave Type", "");
5792  RNA_def_property_update(prop, 0, "rna_Node_update");
5793 
5794  prop = RNA_def_property(srna, "bands_direction", PROP_ENUM, PROP_NONE);
5795  RNA_def_property_enum_sdna(prop, NULL, "bands_direction");
5796  RNA_def_property_enum_items(prop, prop_wave_bands_direction_items);
5797  RNA_def_property_ui_text(prop, "Bands Direction", "");
5798  RNA_def_property_update(prop, 0, "rna_Node_update");
5799 
5800  prop = RNA_def_property(srna, "rings_direction", PROP_ENUM, PROP_NONE);
5801  RNA_def_property_enum_sdna(prop, NULL, "rings_direction");
5802  RNA_def_property_enum_items(prop, prop_wave_rings_direction_items);
5803  RNA_def_property_ui_text(prop, "Rings Direction", "");
5804  RNA_def_property_update(prop, 0, "rna_Node_update");
5805 
5806  prop = RNA_def_property(srna, "wave_profile", PROP_ENUM, PROP_NONE);
5807  RNA_def_property_enum_sdna(prop, NULL, "wave_profile");
5808  RNA_def_property_enum_items(prop, prop_wave_profile_items);
5809  RNA_def_property_ui_text(prop, "Wave Profile", "");
5810  RNA_def_property_update(prop, 0, "rna_Node_update");
5811 }
5812 
5814 {
5815  PropertyRNA *prop;
5816 
5817  prop = RNA_def_property(srna, "noise_dimensions", PROP_ENUM, PROP_NONE);
5818  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5820  RNA_def_property_ui_text(prop, "Dimensions", "Number of dimensions to output noise for");
5821  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5822 }
5823 
5824 static void def_sh_tex_coord(StructRNA *srna)
5825 {
5826  PropertyRNA *prop;
5827 
5828  prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
5829  RNA_def_property_pointer_sdna(prop, NULL, "id");
5830  RNA_def_property_struct_type(prop, "Object");
5834  prop, "Object", "Use coordinates from this object (for object texture coordinates output)");
5835  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
5836 
5837  prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
5838  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
5840  prop, "From Instancer", "Use the parent of the instance object if possible");
5841  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5842 }
5843 
5845 {
5846  static const EnumPropertyItem prop_vect_type_items[] = {
5847  {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
5848  {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
5850  "NORMAL",
5851  0,
5852  "Normal",
5853  "Transform a normal vector with unit length"},
5854  {0, NULL, 0, NULL, NULL},
5855  };
5856 
5857  static const EnumPropertyItem prop_vect_space_items[] = {
5858  {SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""},
5859  {SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""},
5860  {SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""},
5861  {0, NULL, 0, NULL, NULL},
5862  };
5863 
5864  PropertyRNA *prop;
5865 
5866  RNA_def_struct_sdna_from(srna, "NodeShaderVectTransform", "storage");
5867 
5868  prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
5869  RNA_def_property_enum_sdna(prop, NULL, "type");
5870  RNA_def_property_enum_items(prop, prop_vect_type_items);
5871  RNA_def_property_ui_text(prop, "Type", "");
5872  RNA_def_property_update(prop, 0, "rna_Node_update");
5873 
5874  prop = RNA_def_property(srna, "convert_from", PROP_ENUM, PROP_NONE);
5875  RNA_def_property_enum_items(prop, prop_vect_space_items);
5876  RNA_def_property_ui_text(prop, "Convert From", "Space to convert from");
5877  RNA_def_property_update(prop, 0, "rna_Node_update");
5878 
5879  prop = RNA_def_property(srna, "convert_to", PROP_ENUM, PROP_NONE);
5880  RNA_def_property_enum_items(prop, prop_vect_space_items);
5881  RNA_def_property_ui_text(prop, "Convert To", "Space to convert to");
5882  RNA_def_property_update(prop, 0, "rna_Node_update");
5883 }
5884 
5886 {
5887  PropertyRNA *prop;
5888 
5889  prop = RNA_def_property(srna, "use_pixel_size", PROP_BOOLEAN, PROP_NONE);
5890  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
5891  RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units");
5892  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5893 }
5894 
5896 {
5897  PropertyRNA *prop;
5898 
5899  FunctionRNA *func;
5900  PropertyRNA *parm;
5901 
5902  static const EnumPropertyItem point_source_items[] = {
5904  "PARTICLE_SYSTEM",
5905  0,
5906  "Particle System",
5907  "Generate point density from a particle system"},
5909  "OBJECT",
5910  0,
5911  "Object Vertices",
5912  "Generate point density from an object's vertices"},
5913  {0, NULL, 0, NULL, NULL},
5914  };
5915 
5916  static const EnumPropertyItem prop_interpolation_items[] = {
5917  {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
5918  {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
5919  {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
5920  {0, NULL, 0, NULL, NULL},
5921  };
5922 
5923  static const EnumPropertyItem space_items[] = {
5924  {SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""},
5925  {SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""},
5926  {0, NULL, 0, NULL, NULL},
5927  };
5928 
5929  static const EnumPropertyItem particle_color_source_items[] = {
5931  "PARTICLE_AGE",
5932  0,
5933  "Particle Age",
5934  "Lifetime mapped as 0.0 to 1.0 intensity"},
5936  "PARTICLE_SPEED",
5937  0,
5938  "Particle Speed",
5939  "Particle speed (absolute magnitude of velocity) mapped as 0.0 to 1.0 intensity"},
5941  "PARTICLE_VELOCITY",
5942  0,
5943  "Particle Velocity",
5944  "XYZ velocity mapped to RGB colors"},
5945  {0, NULL, 0, NULL, NULL},
5946  };
5947 
5948  static const EnumPropertyItem vertex_color_source_items[] = {
5949  {SHD_POINTDENSITY_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"},
5951  "VERTEX_WEIGHT",
5952  0,
5953  "Vertex Weight",
5954  "Vertex group weight"},
5956  "VERTEX_NORMAL",
5957  0,
5958  "Vertex Normal",
5959  "XYZ normal vector mapped to RGB colors"},
5960  {0, NULL, 0, NULL, NULL},
5961  };
5962 
5963  prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
5964  RNA_def_property_pointer_sdna(prop, NULL, "id");
5965  RNA_def_property_struct_type(prop, "Object");
5968  RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
5969  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5970 
5971  RNA_def_struct_sdna_from(srna, "NodeShaderTexPointDensity", "storage");
5972 
5973  prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
5974  RNA_def_property_enum_items(prop, point_source_items);
5975  RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
5976  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5977 
5978  prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
5979  RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
5980  RNA_def_property_struct_type(prop, "ParticleSystem");
5982  "rna_ShaderNodePointDensity_psys_get",
5983  "rna_ShaderNodePointDensity_psys_set",
5984  NULL,
5985  NULL);
5988  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5989 
5990  prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
5991  RNA_def_property_range(prop, 1, 32768);
5993  prop, "Resolution", "Resolution used by the texture holding the point density");
5994  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5995 
5996  prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
5997  RNA_def_property_float_sdna(prop, NULL, "radius");
5998  RNA_def_property_range(prop, 0.001, FLT_MAX);
6000  prop, "Radius", "Radius from the shaded sample to look for points within");
6001  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6002 
6003  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6005  RNA_def_property_ui_text(prop, "Space", "Coordinate system to calculate voxels in");
6006  RNA_def_property_update(prop, 0, "rna_Node_update");
6007 
6008  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
6009  RNA_def_property_enum_items(prop, prop_interpolation_items);
6010  RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
6011  RNA_def_property_update(prop, 0, "rna_Node_update");
6012 
6013  prop = RNA_def_property(srna, "particle_color_source", PROP_ENUM, PROP_NONE);
6014  RNA_def_property_enum_sdna(prop, NULL, "color_source");
6015  RNA_def_property_enum_items(prop, particle_color_source_items);
6016  RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
6017  RNA_def_property_update(prop, 0, "rna_Node_update");
6018 
6019  prop = RNA_def_property(srna, "vertex_color_source", PROP_ENUM, PROP_NONE);
6020  RNA_def_property_enum_sdna(prop, NULL, "ob_color_source");
6021  RNA_def_property_enum_items(prop, vertex_color_source_items);
6022  RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
6023  RNA_def_property_update(prop, 0, "rna_Node_update");
6024 
6025  prop = RNA_def_property(srna, "vertex_attribute_name", PROP_STRING, PROP_NONE);
6026  RNA_def_property_ui_text(prop, "Vertex Attribute Name", "Vertex attribute to use for color");
6027  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6028 
6029  func = RNA_def_function(srna, "cache_point_density", "rna_ShaderNodePointDensity_density_cache");
6030  RNA_def_function_ui_description(func, "Cache point density data for later calculation");
6031  RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
6032 
6033  func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc");
6034  RNA_def_function_ui_description(func, "Calculate point density");
6035  RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
6036  /* TODO: See how array size of 0 works, this shouldn't be used. */
6037  parm = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0);
6039  RNA_def_function_output(func, parm);
6040 
6041  func = RNA_def_function(
6042  srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax");
6043  RNA_def_function_ui_description(func, "Calculate point density");
6044  RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
6045  parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS);
6046  RNA_def_property_array(parm, 3);
6048  RNA_def_function_output(func, parm);
6049  parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_COORDS);
6050  RNA_def_property_array(parm, 3);
6052  RNA_def_function_output(func, parm);
6053 }
6054 
6055 static void def_glossy(StructRNA *srna)
6056 {
6057  PropertyRNA *prop;
6058 
6059  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6060  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6062  RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6063  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6064 }
6065 
6066 static void def_glass(StructRNA *srna)
6067 {
6068  PropertyRNA *prop;
6069 
6070  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6071  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6073  RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6074  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6075 }
6076 
6077 static void def_principled(StructRNA *srna)
6078 {
6079  PropertyRNA *prop;
6080 
6081  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6082  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6084  RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6085  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6086 
6087  prop = RNA_def_property(srna, "subsurface_method", PROP_ENUM, PROP_NONE);
6088  RNA_def_property_enum_sdna(prop, NULL, "custom2");
6091  prop, "Subsurface Method", "Method for rendering subsurface scattering");
6092  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6093 }
6094 
6095 static void def_refraction(StructRNA *srna)
6096 {
6097  PropertyRNA *prop;
6098 
6099  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6100  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6102  RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6103  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6104 }
6105 
6106 static void def_anisotropic(StructRNA *srna)
6107 {
6108  PropertyRNA *prop;
6109 
6110  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
6111  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6113  RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
6114  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6115 }
6116 
6117 static void def_toon(StructRNA *srna)
6118 {
6119  PropertyRNA *prop;
6120 
6121  prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
6122  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6124  RNA_def_property_ui_text(prop, "Component", "Toon BSDF component to use");
6125  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6126 }
6127 
6128 static void def_sh_bump(StructRNA *srna)
6129 {
6130  PropertyRNA *prop;
6131 
6132  prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
6133  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
6135  prop, "Invert", "Invert the bump mapping direction to push into the surface instead of out");
6136  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6137 }
6138 
6139 static void def_hair(StructRNA *srna)
6140 {
6141  PropertyRNA *prop;
6142 
6143  prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
6144  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6146  RNA_def_property_ui_text(prop, "Component", "Hair BSDF component to use");
6147  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6148 }
6149 
6150 /* RNA initialization for the custom property. */
6151 static void def_hair_principled(StructRNA *srna)
6152 {
6153  PropertyRNA *prop;
6154 
6155  prop = RNA_def_property(srna, "parametrization", PROP_ENUM, PROP_NONE);
6156  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6158  prop, "Color Parametrization", "Select the shader's color parametrization");
6161  /* Upon editing, update both the node data AND the UI representation */
6162  /* (This effectively shows/hides the relevant sockets) */
6163  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6164 }
6165 
6166 static void def_sh_uvmap(StructRNA *srna)
6167 {
6168  PropertyRNA *prop;
6169 
6170  prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
6171  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
6173  prop, "From Instancer", "Use the parent of the instance object if possible");
6174  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6175 
6176  RNA_def_struct_sdna_from(srna, "NodeShaderUVMap", "storage");
6177 
6178  prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
6179  RNA_def_property_ui_text(prop, "UV Map", "UV coordinates to be used for mapping");
6180  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6181 
6182  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6183 }
6184 
6185 static void def_sh_vertex_color(StructRNA *srna)
6186 {
6187  PropertyRNA *prop;
6188 
6189  RNA_def_struct_sdna_from(srna, "NodeShaderVertexColor", "storage");
6190 
6191  prop = RNA_def_property(srna, "layer_name", PROP_STRING, PROP_NONE);
6192  RNA_def_property_ui_text(prop, "Color Attribute", "Color Attribute");
6193  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6194 
6195  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6196 }
6197 
6199 {
6200  PropertyRNA *prop;
6201 
6202  prop = RNA_def_property(srna, "use_tips", PROP_BOOLEAN, PROP_NONE);
6203  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
6205  prop, "Use Tips", "Lower half of the texture is for tips of the stroke");
6206  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6207 }
6208 
6209 static void def_sh_normal_map(StructRNA *srna)
6210 {
6211  static const EnumPropertyItem prop_space_items[] = {
6212  {SHD_SPACE_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"},
6213  {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"},
6214  {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
6216  "BLENDER_OBJECT",
6217  0,
6218  "Blender Object Space",
6219  "Object space normal mapping, compatible with Blender render baking"},
6221  "BLENDER_WORLD",
6222  0,
6223  "Blender World Space",
6224  "World space normal mapping, compatible with Blender render baking"},
6225  {0, NULL, 0, NULL, NULL},
6226  };
6227 
6228  PropertyRNA *prop;
6229 
6230  RNA_def_struct_sdna_from(srna, "NodeShaderNormalMap", "storage");
6231 
6232  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6233  RNA_def_property_enum_items(prop, prop_space_items);
6234  RNA_def_property_ui_text(prop, "Space", "Space of the input normal");
6235  RNA_def_property_update(prop, 0, "rna_Node_update");
6236 
6237  prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
6238  RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent space maps");
6239  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6240 
6241  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6242 }
6243 
6244 static void def_sh_displacement(StructRNA *srna)
6245 {
6246  static const EnumPropertyItem prop_space_items[] = {
6248  "OBJECT",
6249  0,
6250  "Object Space",
6251  "Displacement is in object space, affected by object scale"},
6252  {SHD_SPACE_WORLD,
6253  "WORLD",
6254  0,
6255  "World Space",
6256  "Displacement is in world space, not affected by object scale"},
6257  {0, NULL, 0, NULL, NULL},
6258  };
6259 
6260  PropertyRNA *prop;
6261 
6262  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6263  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6264  RNA_def_property_enum_items(prop, prop_space_items);
6265  RNA_def_property_ui_text(prop, "Space", "Space of the input height");
6266  RNA_def_property_update(prop, 0, "rna_Node_update");
6267 
6268  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6269 }
6270 
6272 {
6273  static const EnumPropertyItem prop_space_items[] = {
6275  "TANGENT",
6276  0,
6277  "Tangent Space",
6278  "Tangent space vector displacement mapping"},
6279  {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space vector displacement mapping"},
6280  {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space vector displacement mapping"},
6281  {0, NULL, 0, NULL, NULL},
6282  };
6283 
6284  PropertyRNA *prop;
6285 
6286  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6287  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6288  RNA_def_property_enum_items(prop, prop_space_items);
6289  RNA_def_property_ui_text(prop, "Space", "Space of the input height");
6290  RNA_def_property_update(prop, 0, "rna_Node_update");
6291 
6292  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6293 }
6294 
6295 static void def_sh_tangent(StructRNA *srna)
6296 {
6297  static const EnumPropertyItem prop_direction_type_items[] = {
6298  {SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
6299  {SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
6300  {0, NULL, 0, NULL, NULL},
6301  };
6302 
6303  static const EnumPropertyItem prop_axis_items[] = {
6304  {SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
6305  {SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
6306  {SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
6307  {0, NULL, 0, NULL, NULL},
6308  };
6309 
6310  PropertyRNA *prop;
6311 
6312  RNA_def_struct_sdna_from(srna, "NodeShaderTangent", "storage");
6313 
6314  prop = RNA_def_property(srna, "direction_type", PROP_ENUM, PROP_NONE);
6315  RNA_def_property_enum_items(prop, prop_direction_type_items);
6316  RNA_def_property_ui_text(prop, "Direction", "Method to use for the tangent");
6317  RNA_def_property_update(prop, 0, "rna_Node_update");
6318 
6319  prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
6320  RNA_def_property_enum_items(prop, prop_axis_items);
6321  RNA_def_property_ui_text(prop, "Axis", "Axis for radial tangents");
6322  RNA_def_property_update(prop, 0, "rna_Node_update");
6323 
6324  prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
6325  RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent generated from UV");
6326  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6327 
6328  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6329 }
6330 
6331 static void def_sh_bevel(StructRNA *srna)
6332 {
6333  PropertyRNA *prop;
6334 
6335  prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
6336  RNA_def_property_int_sdna(prop, NULL, "custom1");
6337  RNA_def_property_range(prop, 2, 128);
6338  RNA_def_property_ui_range(prop, 2, 16, 1, 1);
6339  RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
6340  RNA_def_property_update(prop, 0, "rna_Node_update");
6341 }
6342 
6344 {
6345  PropertyRNA *prop;
6346 
6347  prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
6348  RNA_def_property_int_sdna(prop, NULL, "custom1");
6349  RNA_def_property_range(prop, 1, 128);
6350  RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
6351  RNA_def_property_update(prop, 0, "rna_Node_update");
6352 
6353  prop = RNA_def_property(srna, "inside", PROP_BOOLEAN, PROP_NONE);
6355  RNA_def_property_ui_text(prop, "Inside", "Trace rays towards the inside of the object");
6356  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6357 
6358  prop = RNA_def_property(srna, "only_local", PROP_BOOLEAN, PROP_NONE);
6359  RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_AO_LOCAL);
6361  prop, "Only Local", "Only consider the object itself when computing AO");
6362  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6363 }
6364 
6365 static void def_sh_subsurface(StructRNA *srna)
6366 {
6367  PropertyRNA *prop;
6368 
6369  prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
6370  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6372  RNA_def_property_ui_text(prop, "Method", "Method for rendering subsurface scattering");
6373  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6374 }
6375 
6376 static void def_sh_tex_ies(StructRNA *srna)
6377 {
6378  PropertyRNA *prop;
6379 
6380  prop = RNA_def_property(srna, "ies", PROP_POINTER, PROP_NONE);
6381  RNA_def_property_pointer_sdna(prop, NULL, "id");
6382  RNA_def_property_struct_type(prop, "Text");
6385  RNA_def_property_ui_text(prop, "IES Text", "Internal IES file");
6386  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6387 
6388  RNA_def_struct_sdna_from(srna, "NodeShaderTexIES", "storage");
6389 
6390  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
6391  RNA_def_property_ui_text(prop, "File Path", "IES light path");
6392  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6393 
6394  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6395  RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeTexIES_mode_set", NULL);
6398  prop, "Source", "Whether the IES file is loaded from disk or from a text data-block");
6399  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6400 
6401  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6402 }
6403 
6404 static void def_sh_output_aov(StructRNA *srna)
6405 {
6406  PropertyRNA *prop;
6407 
6408  RNA_def_struct_sdna_from(srna, "NodeShaderOutputAOV", "storage");
6409 
6410  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
6411  RNA_def_property_ui_text(prop, "Name", "Name of the AOV that this output writes to");
6412  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6413 
6414  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6415 }
6416 
6418 {
6419  static const EnumPropertyItem type_items[] = {
6420  {NODE_COMBSEP_COLOR_RGB, "RGB", ICON_NONE, "RGB", "Use RGB color processing"},
6421  {NODE_COMBSEP_COLOR_HSV, "HSV", ICON_NONE, "HSV", "Use HSV color processing"},
6422  {NODE_COMBSEP_COLOR_HSL, "HSL", ICON_NONE, "HSL", "Use HSL color processing"},
6423  {0, NULL, 0, NULL, NULL},
6424  };
6425 
6426  PropertyRNA *prop;
6427 
6428  RNA_def_struct_sdna_from(srna, "NodeCombSepColor", "storage");
6429 
6430  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6431  RNA_def_property_enum_items(prop, type_items);
6432  RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
6433  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
6434 }
6435 
6436 static void def_sh_script(StructRNA *srna)
6437 {
6438  PropertyRNA *prop;
6439 
6440  prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
6441  RNA_def_property_pointer_sdna(prop, NULL, "id");
6442  RNA_def_property_struct_type(prop, "Text");
6445  RNA_def_property_ui_text(prop, "Script", "Internal shader script to define the shader");
6446  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
6447 
6448  RNA_def_struct_sdna_from(srna, "NodeShaderScript", "storage");
6449 
6450  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
6451  RNA_def_property_ui_text(prop, "File Path", "Shader script path");
6452  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
6453 
6454  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6455  RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeScript_mode_set", NULL);
6457  RNA_def_property_ui_text(prop, "Script Source", "");
6458  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6459 
6460  prop = RNA_def_property(srna, "use_auto_update", PROP_BOOLEAN, PROP_NONE);
6463  prop,
6464  "Auto Update",
6465  "Automatically update the shader when the .osl file changes (external scripts only)");
6466 
6467  prop = RNA_def_property(srna, "bytecode", PROP_STRING, PROP_NONE);
6469  "rna_ShaderNodeScript_bytecode_get",
6470  "rna_ShaderNodeScript_bytecode_length",
6471  "rna_ShaderNodeScript_bytecode_set");
6472  RNA_def_property_ui_text(prop, "Bytecode", "Compile bytecode for shader script node");
6473  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6474 
6475  prop = RNA_def_property(srna, "bytecode_hash", PROP_STRING, PROP_NONE);
6477  prop, "Bytecode Hash", "Hash of compile bytecode, for quick equality checking");
6478  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6479 
6480  /* needs to be reset to avoid bad pointer type in API functions below */
6481  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6482 
6483  /* API functions */
6484 
6485 # if 0 /* XXX TODO: use general node api for this. */
6486  func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket");
6487  RNA_def_function_ui_description(func, "Find a socket by name");
6488  parm = RNA_def_string(func, "name", NULL, 0, "Socket name", "");
6490  /*parm =*/RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
6491  parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
6492  RNA_def_function_return(func, parm);
6493 
6494  func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket");
6495  RNA_def_function_ui_description(func, "Add a socket socket");
6497  parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
6499  parm = RNA_def_enum(func, "type", node_socket_type_items, SOCK_FLOAT, "Type", "");
6501  /*parm =*/RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
6502  parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
6503  RNA_def_function_return(func, parm);
6504 
6505  func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket");
6506  RNA_def_function_ui_description(func, "Remove a socket socket");
6508  parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "");
6510 # endif
6511 }
6512 
6513 /* -- Compositor Nodes ------------------------------------------------------ */
6514 
6515 static void def_cmp_alpha_over(StructRNA *srna)
6516 {
6517  PropertyRNA *prop;
6518 
6519  /* XXX: Tooltip */
6520  prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
6521  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
6522  RNA_def_property_ui_text(prop, "Convert Premultiplied", "");
6523  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6524 
6525  RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
6526 
6527  prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_FACTOR);
6528  RNA_def_property_float_sdna(prop, NULL, "x");
6529  RNA_def_property_range(prop, 0.0f, 1.0f);
6530  RNA_def_property_ui_text(prop, "Premultiplied", "Mix Factor");
6531  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6532 }
6533 
6534 static void def_cmp_blur(StructRNA *srna)
6535 {
6536  PropertyRNA *prop;
6537 
6538  static const EnumPropertyItem filter_type_items[] = {
6539  {R_FILTER_BOX, "FLAT", 0, "Flat", ""},
6540  {R_FILTER_TENT, "TENT", 0, "Tent", ""},
6541  {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
6542  {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
6543  {R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
6544  {R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
6545  {R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
6546  {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
6547  {0, NULL, 0, NULL, NULL},
6548  };
6549 
6550  static const EnumPropertyItem aspect_correction_type_items[] = {
6551  {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
6552  {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
6553  {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
6554  {0, NULL, 0, NULL, NULL},
6555  };
6556 
6557  /* duplicated in def_cmp_bokehblur */
6558  prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
6561  prop, "Variable Size", "Support variable blur per pixel when using an image for size input");
6562  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6563 
6564  prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
6567  prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
6568  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6569 
6570  RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
6571 
6572  prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
6573  RNA_def_property_int_sdna(prop, NULL, "sizex");
6574  RNA_def_property_range(prop, 0, 2048);
6575  RNA_def_property_ui_text(prop, "Size X", "");
6576  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6577 
6578  prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
6579  RNA_def_property_int_sdna(prop, NULL, "sizey");
6580  RNA_def_property_range(prop, 0, 2048);
6581  RNA_def_property_ui_text(prop, "Size Y", "");
6582  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6583 
6584  prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
6585  RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
6587  prop, "Relative", "Use relative (percent) values to define blur radius");
6588  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6589 
6590  prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE);
6591  RNA_def_property_enum_sdna(prop, NULL, "aspect");
6592  RNA_def_property_enum_items(prop, aspect_correction_type_items);
6593  RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use");
6594  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6595 
6596  prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
6597  RNA_def_property_float_sdna(prop, NULL, "fac");
6598  RNA_def_property_range(prop, 0.0f, 2.0f);
6599  RNA_def_property_ui_text(prop, "Factor", "");
6600  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6601 
6602  prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE);
6603  RNA_def_property_float_sdna(prop, NULL, "percentx");
6604  RNA_def_property_range(prop, 0.0f, 100.0f);
6605  RNA_def_property_ui_text(prop, "Relative Size X", "");
6606  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6607 
6608  prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE);
6609  RNA_def_property_float_sdna(prop, NULL, "percenty");
6610  RNA_def_property_range(prop, 0.0f, 100.0f);
6611  RNA_def_property_ui_text(prop, "Relative Size Y", "");
6612  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6613 
6614  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
6615  RNA_def_property_enum_sdna(prop, NULL, "filtertype");
6616  RNA_def_property_enum_items(prop, filter_type_items);
6617  RNA_def_property_ui_text(prop, "Filter Type", "");
6618  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6619 
6620  prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE);
6621  RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1);
6622  RNA_def_property_ui_text(prop, "Bokeh", "Use circular filter (slower)");
6623  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6624 
6625  prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
6626  RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1);
6627  RNA_def_property_ui_text(prop, "Gamma", "Apply filter on gamma corrected values");
6628  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6629 }
6630 
6631 static void def_cmp_filter(StructRNA *srna)
6632 {
6633  PropertyRNA *prop;
6634 
6635  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
6636  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6638  RNA_def_property_ui_text(prop, "Filter Type", "");
6639  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6640 }
6641 
6642 static void def_cmp_map_value(StructRNA *srna)
6643 {
6644  PropertyRNA *prop;
6645 
6646  RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
6647 
6648  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
6649  RNA_def_property_float_sdna(prop, NULL, "loc");
6650  RNA_def_property_array(prop, 1);
6651  RNA_def_property_range(prop, -1000.0f, 1000.0f);
6652  RNA_def_property_ui_text(prop, "Offset", "");
6653  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6654 
6655  prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
6656  RNA_def_property_float_sdna(prop, NULL, "size");
6657  RNA_def_property_array(prop, 1);
6658  RNA_def_property_range(prop, -1000.0f, 1000.0f);
6659  RNA_def_property_ui_text(prop, "Size", "");
6660  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6661 
6662  prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
6664  RNA_def_property_ui_text(prop, "Use Minimum", "");
6665  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6666 
6667  prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
6669  RNA_def_property_ui_text(prop, "Use Maximum", "");
6670  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6671 
6672  prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
6673  RNA_def_property_float_sdna(prop, NULL, "min");
6674  RNA_def_property_array(prop, 1);
6675  RNA_def_property_range(prop, -1000.0f, 1000.0f);
6676  RNA_def_property_ui_text(prop, "Minimum", "");
6677  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6678 
6679  prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
6680  RNA_def_property_float_sdna(prop, NULL, "max");
6681  RNA_def_property_array(prop, 1);
6682  RNA_def_property_range(prop, -1000.0f, 1000.0f);
6683  RNA_def_property_ui_text(prop, "Maximum", "");
6684  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6685 }
6686 
6687 static void def_cmp_map_range(StructRNA *srna)
6688 {
6689  PropertyRNA *prop;
6690 
6691  prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
6692  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
6693  RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
6694  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6695 }
6696 
6697 static void def_cmp_vector_blur(StructRNA *srna)
6698 {
6699  PropertyRNA *prop;
6700 
6701  RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
6702 
6703  prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
6704  RNA_def_property_int_sdna(prop, NULL, "samples");
6705  RNA_def_property_range(prop, 1, 256);
6706  RNA_def_property_ui_text(prop, "Samples", "");
6707  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6708 
6709  prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
6710  RNA_def_property_int_sdna(prop, NULL, "minspeed");
6711  RNA_def_property_range(prop, 0, 1024);
6713  prop,
6714  "Min Speed",
6715  "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
6716  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6717 
6718  prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
6719  RNA_def_property_int_sdna(prop, NULL, "maxspeed");
6720  RNA_def_property_range(prop, 0, 1024);
6721  RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none");
6722  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6723 
6724  prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
6725  RNA_def_property_float_sdna(prop, NULL, "fac");
6726  RNA_def_property_range(prop, 0.0, 20.0);
6727  RNA_def_property_ui_range(prop, 0.0, 2.0, 1.0, 2);
6729  prop,
6730  "Blur Factor",
6731  "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
6732  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6733 
6734  prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
6735  RNA_def_property_boolean_sdna(prop, NULL, "curved", 1);
6737  prop, "Curved", "Interpolate between frames in a Bezier curve, rather than linearly");
6738  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6739 }
6740 
6741 static void def_cmp_set_alpha(StructRNA *srna)
6742 {
6743  PropertyRNA *prop;
6744 
6745  static const EnumPropertyItem mode_items[] = {
6747  "APPLY",
6748  0,
6749  "Apply Mask",
6750  "Multiply the input image's RGBA channels by the alpha input value"},
6752  "REPLACE_ALPHA",
6753  0,
6754  "Replace Alpha",
6755  "Replace the input image's alpha channel by the alpha input value"},
6756  {0, NULL, 0, NULL, NULL},
6757  };
6758 
6759  RNA_def_struct_sdna_from(srna, "NodeSetAlpha", "storage");
6760 
6761  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6763  RNA_def_property_ui_text(prop, "Mode", "");
6764  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6765 }
6766 
6767 static void def_cmp_levels(StructRNA *srna)
6768 {
6769  PropertyRNA *prop;
6770 
6771  static const EnumPropertyItem channel_items[] = {
6772  {1, "COMBINED_RGB", 0, "Combined", "Combined RGB"},
6773  {2, "RED", 0, "Red", "Red Channel"},
6774  {3, "GREEN", 0, "Green", "Green Channel"},
6775  {4, "BLUE", 0, "Blue", "Blue Channel"},
6776  {5, "LUMINANCE", 0, "Luminance", "Luminance Channel"},
6777  {0, NULL, 0, NULL, NULL},
6778  };
6779 
6780  prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
6781  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6782  RNA_def_property_enum_items(prop, channel_items);
6783  RNA_def_property_ui_text(prop, "Channel", "");
6784  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6785 }
6786 
6787 static void def_node_image_user(StructRNA *srna)
6788 {
6789  PropertyRNA *prop;
6790 
6791  prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
6792  RNA_def_property_int_sdna(prop, NULL, "frames");
6795  prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.c */
6796  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6797 
6798  prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
6799  RNA_def_property_int_sdna(prop, NULL, "sfra");
6801  /* copied from the rna_image.c */
6803  prop,
6804  "Start Frame",
6805  "Global starting frame of the movie/sequence, assuming first picture has a #1");
6806  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6807 
6808  prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
6809  RNA_def_property_int_sdna(prop, NULL, "offset");
6811  /* copied from the rna_image.c */
6813  prop, "Offset", "Offset the number of the frame to use in the animation");
6814  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6815 
6816  prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
6817  RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1);
6819  prop, "Cyclic", "Cycle the images in the movie"); /* copied from the rna_image.c */
6820  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6821 
6822  prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
6824  /* copied from the rna_image.c */
6825  RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes");
6826  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6827 
6828  prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
6829  RNA_def_property_enum_sdna(prop, NULL, "layer");
6831  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_layer_itemf");
6833  RNA_def_property_ui_text(prop, "Layer", "");
6834  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_image_layer_update");
6835 
6836  prop = RNA_def_property(srna, "has_layers", PROP_BOOLEAN, PROP_NONE);
6837  RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_layers_get", NULL);
6839  RNA_def_property_ui_text(prop, "Has Layers", "True if this image has any named layer");
6840 
6841  prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
6842  RNA_def_property_enum_sdna(prop, NULL, "view");
6844  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_view_itemf");
6846  RNA_def_property_ui_text(prop, "View", "");
6847  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6848 
6849  prop = RNA_def_property(srna, "has_views", PROP_BOOLEAN, PROP_NONE);
6850  RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_views_get", NULL);
6852  RNA_def_property_ui_text(prop, "Has View", "True if this image has multiple views");
6853 }
6854 
6855 static void def_cmp_image(StructRNA *srna)
6856 {
6857  PropertyRNA *prop;
6858 
6859 # if 0
6860  static const EnumPropertyItem type_items[] = {
6861  {IMA_SRC_FILE, "IMAGE", 0, "Image", ""},
6862  {IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
6863  {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
6864  {IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
6865  {0, NULL, 0, NULL, NULL},
6866  };
6867 # endif
6868 
6869  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
6870  RNA_def_property_pointer_sdna(prop, NULL, "id");
6871  RNA_def_property_struct_type(prop, "Image");
6874  RNA_def_property_ui_text(prop, "Image", "");
6875  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Image_Node_update_id");
6876 
6877  prop = RNA_def_property(srna, "use_straight_alpha_output", PROP_BOOLEAN, PROP_NONE);
6880  "Straight Alpha Output",
6881  "Put node output buffer to straight alpha instead of premultiplied");
6882  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6883 
6884  /* NOTE: Image user properties used in the UI are redefined in def_node_image_user,
6885  * to trigger correct updates of the node editor. RNA design problem that prevents
6886  * updates from nested structs. */
6887  RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
6888  def_node_image_user(srna);
6889 }
6890 
6892 {
6893  PropertyRNA *prop;
6894 
6895  prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
6896  RNA_def_property_pointer_sdna(prop, NULL, "id");
6897  RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
6898  RNA_def_property_struct_type(prop, "Scene");
6901  RNA_def_property_ui_text(prop, "Scene", "");
6902  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
6903 
6904  prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
6905  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6907  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_view_layer_itemf");
6909  RNA_def_property_ui_text(prop, "Layer", "");
6910  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
6911 }
6912 
6914 {
6915  StructRNA *srna;
6916  PropertyRNA *prop;
6917 
6918  srna = RNA_def_struct(brna, "NodeOutputFileSlotFile", NULL);
6919  RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
6921  srna, "Output File Slot", "Single layer file slot of the file output node");
6922 
6923  prop = RNA_def_property(srna, "use_node_format", PROP_BOOLEAN, PROP_NONE);
6924  RNA_def_property_boolean_sdna(prop, NULL, "use_node_format", 1);
6925  RNA_def_property_ui_text(prop, "Use Node Format", "");
6927 
6928  prop = RNA_def_property(srna, "save_as_render", PROP_BOOLEAN, PROP_NONE);
6929  RNA_def_property_boolean_sdna(prop, NULL, "save_as_render", 1);
6931  prop, "Save as Render", "Apply render part of display transform when saving byte image");
6933 
6934  prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
6935  RNA_def_property_struct_type(prop, "ImageFormatSettings");
6936 
6937  prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
6938  RNA_def_property_string_sdna(prop, NULL, "path");
6939  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NodeOutputFileSlotFile_path_set");
6940  RNA_def_struct_name_property(srna, prop);
6941  RNA_def_property_ui_text(prop, "Path", "Subpath used for this slot");
6943 }
6945 {
6946  StructRNA *srna;
6947  PropertyRNA *prop;
6948 
6949  srna = RNA_def_struct(brna, "NodeOutputFileSlotLayer", NULL);
6950  RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
6952  srna, "Output File Layer Slot", "Multilayer slot of the file output node");
6953 
6954  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
6955  RNA_def_property_string_sdna(prop, NULL, "layer");
6956  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NodeOutputFileSlotLayer_name_set");
6957  RNA_def_struct_name_property(srna, prop);
6958  RNA_def_property_ui_text(prop, "Name", "OpenEXR layer name used for this slot");
6960 }
6962  PropertyRNA *cprop,
6963  const char *struct_name)
6964 {
6965  StructRNA *srna;
6966  PropertyRNA *parm;
6967  FunctionRNA *func;
6968 
6969  RNA_def_property_srna(cprop, struct_name);
6970  srna = RNA_def_struct(brna, struct_name, NULL);
6971  RNA_def_struct_sdna(srna, "bNode");
6972  RNA_def_struct_ui_text(srna, "File Output Slots", "Collection of File Output node slots");
6973 
6974  func = RNA_def_function(srna, "new", "rna_NodeOutputFile_slots_new");
6975  RNA_def_function_ui_description(func, "Add a file slot to this node");
6977  parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
6979  /* return value */
6980  parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
6981  RNA_def_function_return(func, parm);
6982 
6983  /* NOTE: methods below can use the standard node socket API functions,
6984  * included here for completeness. */
6985 
6986  func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
6987  RNA_def_function_ui_description(func, "Remove a file slot from this node");
6989  parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
6991 
6992  func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear");
6993  RNA_def_function_ui_description(func, "Remove all file slots from this node");
6995 
6996  func = RNA_def_function(srna, "move", "rna_Node_inputs_move");
6997  RNA_def_function_ui_description(func, "Move a file slot to another position");
6999  parm = RNA_def_int(
7000  func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
7002  parm = RNA_def_int(
7003  func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
7005 }
7006 static void def_cmp_output_file(BlenderRNA *brna, StructRNA *srna)
7007 {
7008  PropertyRNA *prop;
7009 
7010  RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage");
7011 
7012  prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH);
7013  RNA_def_property_string_sdna(prop, NULL, "base_path");
7014  RNA_def_property_ui_text(prop, "Base Path", "Base output path for the image");
7015  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7016 
7017  prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_NONE);
7018  RNA_def_property_int_sdna(prop, NULL, "active_input");
7019  RNA_def_property_ui_text(prop, "Active Input Index", "Active input index in details view list");
7020  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7021 
7022  prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
7023  RNA_def_property_struct_type(prop, "ImageFormatSettings");
7024 
7025  /* XXX using two different collections here for the same basic DNA list!
7026  * Details of the output slots depend on whether the node is in Multilayer EXR mode.
7027  */
7028 
7029  prop = RNA_def_property(srna, "file_slots", PROP_COLLECTION, PROP_NONE);
7031  "rna_NodeOutputFile_slots_begin",
7032  "rna_iterator_listbase_next",
7033  "rna_iterator_listbase_end",
7034  "rna_NodeOutputFile_slot_file_get",
7035  NULL,
7036  NULL,
7037  NULL,
7038  NULL);
7039  RNA_def_property_struct_type(prop, "NodeOutputFileSlotFile");
7040  RNA_def_property_ui_text(prop, "File Slots", "");
7041  rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileFileSlots");
7042 
7043  prop = RNA_def_property(srna, "layer_slots", PROP_COLLECTION, PROP_NONE);
7045  "rna_NodeOutputFile_slots_begin",
7046  "rna_iterator_listbase_next",
7047  "rna_iterator_listbase_end",
7048  "rna_NodeOutputFile_slot_layer_get",
7049  NULL,
7050  NULL,
7051  NULL,
7052  NULL);
7053  RNA_def_property_struct_type(prop, "NodeOutputFileSlotLayer");
7054  RNA_def_property_ui_text(prop, "EXR Layer Slots", "");
7055  rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileLayerSlots");
7056 }
7057 
7059 {
7060  PropertyRNA *prop;
7061 
7062  static const EnumPropertyItem mode_items[] = {
7063  {CMP_NODE_DILATEERODE_STEP, "STEP", 0, "Step", ""},
7064  {CMP_NODE_DILATEERODE_DISTANCE_THRESH, "THRESHOLD", 0, "Threshold", ""},
7065  {CMP_NODE_DILATEERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
7066  {CMP_NODE_DILATEERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
7067  {0, NULL, 0, NULL, NULL},
7068  };
7069 
7070  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
7071  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7073  RNA_def_property_ui_text(prop, "Mode", "Growing/shrinking mode");
7074  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7075 
7076  prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
7077  RNA_def_property_int_sdna(prop, NULL, "custom2");
7078  RNA_def_property_range(prop, -5000, 5000);
7079  RNA_def_property_ui_range(prop, -100, 100, 1, -1);
7080  RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
7081  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7082 
7083  /* CMP_NODE_DILATEERODE_DISTANCE_THRESH only */
7084  prop = RNA_def_property(srna, "edge", PROP_FLOAT, PROP_NONE);
7085  RNA_def_property_float_sdna(prop, NULL, "custom3");
7086  RNA_def_property_range(prop, -100, 100);
7087  RNA_def_property_ui_text(prop, "Edge", "Edge to inset");
7088  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7089 
7090  RNA_def_struct_sdna_from(srna, "NodeDilateErode", "storage");
7091 
7092  /* CMP_NODE_DILATEERODE_DISTANCE_FEATHER only */
7093  prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
7094  RNA_def_property_enum_sdna(prop, NULL, "falloff");
7096  RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
7098  BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
7099  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7100 }
7101 
7102 static void def_cmp_inpaint(StructRNA *srna)
7103 {
7104  PropertyRNA *prop;
7105 
7106 # if 0
7107  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
7108 
7109  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7110  RNA_def_property_enum_items(prop, type_items);
7111  RNA_def_property_ui_text(prop, "Type", "Type of inpaint algorithm");
7112  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7113 # endif
7114 
7115  prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
7116  RNA_def_property_int_sdna(prop, NULL, "custom2");
7117  RNA_def_property_range(prop, 0, 10000);
7118  RNA_def_property_ui_text(prop, "Distance", "Distance to inpaint (number of iterations)");
7119  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7120 }
7121 
7122 static void def_cmp_despeckle(StructRNA *srna)
7123 {
7124  PropertyRNA *prop;
7125 
7126  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
7127  RNA_def_property_float_sdna(prop, NULL, "custom3");
7128  RNA_def_property_range(prop, 0.0, 1.0f);
7129  RNA_def_property_ui_text(prop, "Threshold", "Threshold for detecting pixels to despeckle");
7130  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7131 
7132  prop = RNA_def_property(srna, "threshold_neighbor", PROP_FLOAT, PROP_NONE);
7133  RNA_def_property_float_sdna(prop, NULL, "custom4");
7134  RNA_def_property_range(prop, 0.0, 1.0f);
7136  prop, "Neighbor", "Threshold for the number of neighbor pixels that must match");
7137  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7138 }
7139 
7140 static void def_cmp_scale(StructRNA *srna)
7141 {
7142  PropertyRNA *prop;
7143 
7144  static const EnumPropertyItem space_items[] = {
7145  {CMP_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""},
7146  {CMP_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
7147  {CMP_SCALE_SCENEPERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
7148  {CMP_SCALE_RENDERPERCENT, "RENDER_SIZE", 0, "Render Size", ""},
7149  {0, NULL, 0, NULL, NULL},
7150  };
7151 
7152  /* matching bgpic_camera_frame_items[] */
7153  static const EnumPropertyItem space_frame_items[] = {
7154  {0, "STRETCH", 0, "Stretch", ""},
7155  {CMP_SCALE_RENDERSIZE_FRAME_ASPECT, "FIT", 0, "Fit", ""},
7157  {0, NULL, 0, NULL, NULL},
7158  };
7159 
7160  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
7161  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7163  RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
7164  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_CompositorNodeScale_update");
7165 
7166  /* expose 2 flags as a enum of 3 items */
7167  prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
7168  RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom2");
7169  RNA_def_property_enum_items(prop, space_frame_items);
7170  RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
7171  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7172 
7173  prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
7174  RNA_def_property_float_sdna(prop, NULL, "custom3");
7175  RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally (factor of image size)");
7176  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7177 
7178  prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
7179  RNA_def_property_float_sdna(prop, NULL, "custom4");
7180  RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically (factor of image size)");
7181  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7182 }
7183 
7184 static void def_cmp_rotate(StructRNA *srna)
7185 {
7186  PropertyRNA *prop;
7187 
7188  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
7189  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7191  RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
7192  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7193 }
7194 
7195 static void def_cmp_diff_matte(StructRNA *srna)
7196 {
7197  PropertyRNA *prop;
7198 
7199  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7200 
7201  prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
7202  RNA_def_property_float_sdna(prop, NULL, "t1");
7203  RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t1_set", NULL);
7204  RNA_def_property_range(prop, 0.0f, 1.0f);
7205  RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
7206  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7207 
7208  prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
7209  RNA_def_property_float_sdna(prop, NULL, "t2");
7210  RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t2_set", NULL);
7211  RNA_def_property_range(prop, 0.0f, 1.0f);
7213  prop, "Falloff", "Color distances below this additional threshold are partially keyed");
7214  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7215 }
7216 
7217 static void def_cmp_color_matte(StructRNA *srna)
7218 {
7219  PropertyRNA *prop;
7220 
7221  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7222 
7223  prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE);
7224  RNA_def_property_float_sdna(prop, NULL, "t1");
7225  RNA_def_property_range(prop, 0.0f, 1.0f);
7226  RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color");
7227  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7228 
7229  prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE);
7230  RNA_def_property_float_sdna(prop, NULL, "t2");
7231  RNA_def_property_range(prop, 0.0f, 1.0f);
7232  RNA_def_property_ui_text(prop, "S", "Saturation tolerance for the color");
7233  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7234 
7235  prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE);
7236  RNA_def_property_float_sdna(prop, NULL, "t3");
7237  RNA_def_property_range(prop, 0.0f, 1.0f);
7238  RNA_def_property_ui_text(prop, "V", "Value tolerance for the color");
7239  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7240 }
7241 
7243 {
7244  PropertyRNA *prop;
7245 
7246  static const EnumPropertyItem color_space_items[] = {
7247  {1, "RGB", 0, "RGB", "RGB color space"},
7248  {2, "YCC", 0, "YCC", "YCbCr suppression"},
7249  {0, NULL, 0, NULL, NULL},
7250  };
7251 
7252  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7253 
7254  prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
7255  RNA_def_property_enum_sdna(prop, NULL, "channel");
7256  RNA_def_property_enum_items(prop, color_space_items);
7257  RNA_def_property_ui_text(prop, "Channel", "");
7258  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7259 
7260  prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
7261  RNA_def_property_float_sdna(prop, NULL, "t1");
7262  RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t1_set", NULL);
7263  RNA_def_property_range(prop, 0.0f, 1.0f);
7264  RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
7265  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7266 
7267  prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
7268  RNA_def_property_float_sdna(prop, NULL, "t2");
7269  RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t2_set", NULL);
7270  RNA_def_property_range(prop, 0.0f, 1.0f);
7272  prop, "Falloff", "Color distances below this additional threshold are partially keyed");
7273  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7274 }
7275 
7277 {
7278  PropertyRNA *prop;
7279  RNA_def_struct_sdna_from(srna, "NodeConvertColorSpace", "storage");
7280 
7281  static const EnumPropertyItem color_space_items[] = {
7282  {0,
7283  "NONE",
7284  0,
7285  "None",
7286  "Do not perform any color transform on load, treat colors as in scene linear space "
7287  "already"},
7288  {0, NULL, 0, NULL, NULL},
7289  };
7290 
7291  prop = RNA_def_property(srna, "from_color_space", PROP_ENUM, PROP_NONE);
7293  RNA_def_property_enum_items(prop, color_space_items);
7295  "rna_NodeConvertColorSpace_from_color_space_get",
7296  "rna_NodeConvertColorSpace_from_color_space_set",
7297  "rna_NodeConvertColorSpace_color_space_itemf");
7298  RNA_def_property_ui_text(prop, "From", "Color space of the input image");
7299  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7300 
7301  prop = RNA_def_property(srna, "to_color_space", PROP_ENUM, PROP_NONE);
7303  RNA_def_property_enum_items(prop, color_space_items);
7305  "rna_NodeConvertColorSpace_to_color_space_get",
7306  "rna_NodeConvertColorSpace_to_color_space_set",
7307  "rna_NodeConvertColorSpace_color_space_itemf");
7308  RNA_def_property_ui_text(prop, "To", "Color space of the output image");
7309  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7310 }
7311 
7312 static void def_cmp_color_spill(StructRNA *srna)
7313 {
7314  PropertyRNA *prop;
7315 
7316  static const EnumPropertyItem channel_items[] = {
7317  {1, "R", 0, "R", "Red spill suppression"},
7318  {2, "G", 0, "G", "Green spill suppression"},
7319  {3, "B", 0, "B", "Blue spill suppression"},
7320  {0, NULL, 0, NULL, NULL},
7321  };
7322 
7323  static const EnumPropertyItem limit_channel_items[] = {
7324  {0, "R", 0, "R", "Limit by red"},
7325  {1, "G", 0, "G", "Limit by green"},
7326  {2, "B", 0, "B", "Limit by blue"},
7327  {0, NULL, 0, NULL, NULL},
7328  };
7329 
7330  static const EnumPropertyItem algorithm_items[] = {
7331  {0, "SIMPLE", 0, "Simple", "Simple limit algorithm"},
7332  {1, "AVERAGE", 0, "Average", "Average limit algorithm"},
7333  {0, NULL, 0, NULL, NULL},
7334  };
7335 
7336  prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
7337  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7338  RNA_def_property_enum_items(prop, channel_items);
7339  RNA_def_property_ui_text(prop, "Channel", "");
7340  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7341 
7342  prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
7343  RNA_def_property_enum_sdna(prop, NULL, "custom2");
7344  RNA_def_property_enum_items(prop, algorithm_items);
7345  RNA_def_property_ui_text(prop, "Algorithm", "");
7346  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7347 
7348  RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage");
7349 
7350  prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
7351  RNA_def_property_enum_sdna(prop, NULL, "limchan");
7352  RNA_def_property_enum_items(prop, limit_channel_items);
7353  RNA_def_property_ui_text(prop, "Limit Channel", "");
7354  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7355 
7356  prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
7357  RNA_def_property_float_sdna(prop, NULL, "limscale");
7358  RNA_def_property_range(prop, 0.5f, 1.5f);
7359  RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value");
7360  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7361 
7362  prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE);
7363  RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0);
7364  RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (differently) by hand");
7365  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7366 
7367  prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE);
7368  RNA_def_property_float_sdna(prop, NULL, "uspillr");
7369  RNA_def_property_range(prop, 0.0f, 1.5f);
7370  RNA_def_property_ui_text(prop, "R", "Red spillmap scale");
7371  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7372 
7373  prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE);
7374  RNA_def_property_float_sdna(prop, NULL, "uspillg");
7375  RNA_def_property_range(prop, 0.0f, 1.5f);
7376  RNA_def_property_ui_text(prop, "G", "Green spillmap scale");
7377  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7378 
7379  prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE);
7380  RNA_def_property_float_sdna(prop, NULL, "uspillb");
7381  RNA_def_property_range(prop, 0.0f, 1.5f);
7382  RNA_def_property_ui_text(prop, "B", "Blue spillmap scale");
7383  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7384 }
7385 
7386 static void def_cmp_luma_matte(StructRNA *srna)
7387 {
7388  PropertyRNA *prop;
7389 
7390  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7391 
7392  prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
7393  RNA_def_property_float_sdna(prop, NULL, "t1");
7394  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
7395  RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7396  RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
7397  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7398 
7399  prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
7400  RNA_def_property_float_sdna(prop, NULL, "t2");
7401  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
7402  RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7403  RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
7404  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7405 }
7406 
7408 {
7409  PropertyRNA *prop;
7410 
7411  prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
7412  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
7413  RNA_def_property_ui_text(prop, "Convert Premultiplied", "Keep output image premultiplied alpha");
7414  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7415 }
7416 
7418 {
7419  PropertyRNA *prop;
7420 
7421  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7422 
7423  prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_ANGLE);
7424  RNA_def_property_float_sdna(prop, NULL, "t1");
7425  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
7426  RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(80.0f));
7428  prop, "Acceptance", "Tolerance for a color to be considered a keying color");
7429  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7430 
7431  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_ANGLE);
7432  RNA_def_property_float_sdna(prop, NULL, "t2");
7433  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
7434  RNA_def_property_range(prop, 0.0f, DEG2RADF(30.0f));
7436  prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
7437  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7438 
7439  prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
7440  RNA_def_property_float_sdna(prop, NULL, "fsize");
7441  RNA_def_property_range(prop, 0.0f, 1.0f);
7442  RNA_def_property_ui_text(prop, "Lift", "Alpha lift");
7443  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7444 
7445  prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
7446  RNA_def_property_float_sdna(prop, NULL, "fstrength");
7447  RNA_def_property_range(prop, 0.0f, 1.0f);
7448  RNA_def_property_ui_text(prop, "Falloff", "Alpha falloff");
7449  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7450 
7451  prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
7452  RNA_def_property_float_sdna(prop, NULL, "t3");
7453  RNA_def_property_range(prop, 0.0f, 1.0f);
7455  prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
7456  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7457 }
7458 
7460 {
7461  PropertyRNA *prop;
7462 
7463  static const EnumPropertyItem color_space_items[] = {
7464  {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB color space"},
7465  {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV color space"},
7466  {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV color space"},
7467  {CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr color space"},
7468  {0, NULL, 0, NULL, NULL},
7469  };
7470 
7471  static const EnumPropertyItem algorithm_items[] = {
7472  {0, "SINGLE", 0, "Single", "Limit by single channel"},
7473  {1, "MAX", 0, "Max", "Limit by maximum of other channels"},
7474  {0, NULL, 0, NULL, NULL},
7475  };
7476 
7477  prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
7478  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7479  RNA_def_property_enum_items(prop, color_space_items);
7480  RNA_def_property_ui_text(prop, "Color Space", "");
7481  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7482 
7483  prop = RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
7484  RNA_def_property_enum_sdna(prop, NULL, "custom2");
7486  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
7487  RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte");
7488  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7489 
7490  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7491 
7492  prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
7493  RNA_def_property_enum_sdna(prop, NULL, "algorithm");
7494  RNA_def_property_enum_items(prop, algorithm_items);
7495  RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel");
7496  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7497 
7498  prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
7499  RNA_def_property_enum_sdna(prop, NULL, "channel");
7501  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
7502  RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channel's value");
7503  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7504 
7505  prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
7506  RNA_def_property_float_sdna(prop, NULL, "t1");
7507  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
7508  RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7509  RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
7510  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7511 
7512  prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
7513  RNA_def_property_float_sdna(prop, NULL, "t2");
7514  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
7515  RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7516  RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
7517  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7518 }
7519 
7520 static void def_cmp_flip(StructRNA *srna)
7521 {
7522  PropertyRNA *prop;
7523 
7524  prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
7525  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7527  RNA_def_property_ui_text(prop, "Axis", "");
7528  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7529 }
7530 
7531 static void def_cmp_splitviewer(StructRNA *srna)
7532 {
7533  PropertyRNA *prop;
7534 
7535  prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
7536  RNA_def_property_enum_sdna(prop, NULL, "custom2");
7538  RNA_def_property_ui_text(prop, "Axis", "");
7539  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7540 
7541  prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR);
7542  RNA_def_property_int_sdna(prop, NULL, "custom1");
7543  RNA_def_property_range(prop, 0, 100);
7544  RNA_def_property_ui_text(prop, "Factor", "");
7545  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7546 }
7547 
7548 static void def_cmp_id_mask(StructRNA *srna)
7549 {
7550  PropertyRNA *prop;
7551 
7552  prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
7553  RNA_def_property_int_sdna(prop, NULL, "custom1");
7554  RNA_def_property_range(prop, 0, 32767);
7555  RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
7556  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7557 
7558  prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
7559  RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0);
7560  RNA_def_property_ui_text(prop, "Anti-Aliasing", "Apply an anti-aliasing filter to the mask");
7561  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7562 }
7563 
7565 {
7566  PropertyRNA *prop;
7567 
7568  static const EnumPropertyItem BufEdgeMode_items[] = {
7569  {0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to bleed along edges"},
7570  {1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from touching edges"},
7571  {0, NULL, 0, NULL, NULL},
7572  };
7573 
7574  static const EnumPropertyItem InnerEdgeMode_items[] = {
7575  {0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"},
7576  {1,
7577  "ADJACENT_ONLY",
7578  0,
7579  "Adjacent Only",
7580  "Only inner mask pixels adjacent to outer mask pixels are considered during mask "
7581  "calculation"},
7582  {0, NULL, 0, NULL, NULL},
7583  };
7584 
7585  prop = RNA_def_property(srna, "inner_mode", PROP_ENUM, PROP_NONE);
7586  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7587  RNA_def_property_enum_items(prop, InnerEdgeMode_items);
7588  RNA_def_property_ui_text(prop, "Inner Edge Mode", "");
7589  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7590 
7591  prop = RNA_def_property(srna, "edge_mode", PROP_ENUM, PROP_NONE);
7592  RNA_def_property_enum_sdna(prop, NULL, "custom2");
7593  RNA_def_property_enum_items(prop, BufEdgeMode_items);
7594  RNA_def_property_ui_text(prop, "Buffer Edge Mode", "");
7595  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7596 }
7597 
7598 static void def_cmp_map_uv(StructRNA *srna)
7599 {
7600  PropertyRNA *prop;
7601 
7602  prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_FACTOR);
7603  RNA_def_property_int_sdna(prop, NULL, "custom1");
7604  RNA_def_property_range(prop, 0, 100);
7605  RNA_def_property_ui_text(prop, "Alpha", "");
7606  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7607 }
7608 
7609 static void def_cmp_defocus(StructRNA *srna)
7610 {
7611  PropertyRNA *prop;
7612 
7613  static const EnumPropertyItem bokeh_items[] = {
7614  {8, "OCTAGON", 0, "Octagonal", "8 sides"},
7615  {7, "HEPTAGON", 0, "Heptagonal", "7 sides"},
7616  {6, "HEXAGON", 0, "Hexagonal", "6 sides"},
7617  {5, "PENTAGON", 0, "Pentagonal", "5 sides"},
7618  {4, "SQUARE", 0, "Square", "4 sides"},
7619  {3, "TRIANGLE", 0, "Triangular", "3 sides"},
7620  {0, "CIRCLE", 0, "Circular", ""},
7621  {0, NULL, 0, NULL, NULL},
7622  };
7623 
7624  prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
7625  RNA_def_property_pointer_sdna(prop, NULL, "id");
7626  RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
7627  RNA_def_property_struct_type(prop, "Scene");
7631  prop, "Scene", "Scene from which to select the active camera (render scene if undefined)");
7632  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7633 
7634  RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage");
7635 
7636  prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE);
7637  RNA_def_property_enum_sdna(prop, NULL, "bktype");
7638  RNA_def_property_enum_items(prop, bokeh_items);
7639  RNA_def_property_ui_text(prop, "Bokeh Type", "");
7640  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7641 
7642  prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
7643  RNA_def_property_float_sdna(prop, NULL, "rotation");
7644  RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
7645  RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset");
7646  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7647 
7648  prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
7649  RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1);
7651  prop, "Gamma Correction", "Enable gamma correction before and after main process");
7652  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7653 
7654  /* TODO */
7655  prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
7656  RNA_def_property_float_sdna(prop, NULL, "fstop");
7657  RNA_def_property_range(prop, 0.0f, 128.0f);
7659  prop,
7660  "F-Stop",
7661  "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles "
7662  "the blur radius");
7663  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7664 
7665  prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
7666  RNA_def_property_float_sdna(prop, NULL, "maxblur");
7667  RNA_def_property_range(prop, 0.0f, 10000.0f);
7668  RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
7669  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7670 
7671  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
7672  RNA_def_property_float_sdna(prop, NULL, "bthresh");
7673  RNA_def_property_range(prop, 0.0f, 100.0f);
7675  prop,
7676  "Threshold",
7677  "CoC radius threshold, prevents background bleed on in-focus midground, 0 is disabled");
7678  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7679 
7680  prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
7681  RNA_def_property_boolean_sdna(prop, NULL, "preview", 1);
7682  RNA_def_property_ui_text(prop, "Preview", "Enable low quality mode, useful for preview");
7683  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7684 
7685  prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
7686  RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1);
7688  "Use Z-Buffer",
7689  "Disable when using an image as input instead of actual z-buffer "
7690  "(auto enabled if node not image based, eg. time node)");
7691  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7692 
7693  prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
7694  RNA_def_property_float_sdna(prop, NULL, "scale");
7695  RNA_def_property_range(prop, 0.0f, 1000.0f);
7697  prop,
7698  "Z-Scale",
7699  "Scale the Z input when not using a z-buffer, controls maximum blur designated "
7700  "by the color white or input value 1");
7701  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7702 }
7703 
7704 static void def_cmp_invert(StructRNA *srna)
7705 {
7706  PropertyRNA *prop;
7707 
7708  prop = RNA_def_property(srna, "invert_rgb", PROP_BOOLEAN, PROP_NONE);
7709  RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB);
7710  RNA_def_property_ui_text(prop, "RGB", "");
7711  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7712 
7713  prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
7714  RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A);
7715  RNA_def_property_ui_text(prop, "Alpha", "");
7716  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7717 }
7718 
7719 static void def_cmp_crop(StructRNA *srna)
7720 {
7721  PropertyRNA *prop;
7722 
7723  prop = RNA_def_property(srna, "use_crop_size", PROP_BOOLEAN, PROP_NONE);
7724  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
7725  RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
7726  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7727 
7728  prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
7729  RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
7730  RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
7731  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7732 
7733  RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
7734 
7735  prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
7736  RNA_def_property_int_sdna(prop, NULL, "x1");
7737  RNA_def_property_range(prop, 0, 10000);
7738  RNA_def_property_ui_text(prop, "X1", "");
7739  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7740 
7741  prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE);
7742  RNA_def_property_int_sdna(prop, NULL, "x2");
7743  RNA_def_property_range(prop, 0, 10000);
7744  RNA_def_property_ui_text(prop, "X2", "");
7745  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7746 
7747  prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE);
7748  RNA_def_property_int_sdna(prop, NULL, "y1");
7749  RNA_def_property_range(prop, 0, 10000);
7750  RNA_def_property_ui_text(prop, "Y1", "");
7751  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7752 
7753  prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE);
7754  RNA_def_property_int_sdna(prop, NULL, "y2");
7755  RNA_def_property_range(prop, 0, 10000);
7756  RNA_def_property_ui_text(prop, "Y2", "");
7757  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7758 
7759  prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
7760  RNA_def_property_float_sdna(prop, NULL, "fac_x1");
7761  RNA_def_property_range(prop, 0.0, 1.0);
7762  RNA_def_property_ui_text(prop, "X1", "");
7763  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7764 
7765  prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
7766  RNA_def_property_float_sdna(prop, NULL, "fac_x2");
7767  RNA_def_property_range(prop, 0.0, 1.0);
7768  RNA_def_property_ui_text(prop, "X2", "");
7769  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7770 
7771  prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
7772  RNA_def_property_float_sdna(prop, NULL, "fac_y1");
7773  RNA_def_property_range(prop, 0.0, 1.0);
7774  RNA_def_property_ui_text(prop, "Y1", "");
7775  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7776 
7777  prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
7778  RNA_def_property_float_sdna(prop, NULL, "fac_y2");
7779  RNA_def_property_range(prop, 0.0, 1.0);
7780  RNA_def_property_ui_text(prop, "Y2", "");
7781  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7782 }
7783 
7784 static void def_cmp_dblur(StructRNA *srna)
7785 {
7786  PropertyRNA *prop;
7787 
7788  RNA_def_struct_sdna_from(srna, "NodeDBlurData", "storage");
7789 
7790  prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7791  RNA_def_property_int_sdna(prop, NULL, "iter");
7792  RNA_def_property_range(prop, 1, 32);
7793  RNA_def_property_ui_text(prop, "Iterations", "");
7794  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7795 
7796  prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
7797  RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1);
7798  RNA_def_property_ui_text(prop, "Wrap", "");
7799  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7800 
7801  prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
7802  RNA_def_property_float_sdna(prop, NULL, "center_x");
7803  RNA_def_property_range(prop, 0.0f, 1.0f);
7804  RNA_def_property_ui_text(prop, "Center X", "");
7805  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7806 
7807  prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
7808  RNA_def_property_float_sdna(prop, NULL, "center_y");
7809  RNA_def_property_range(prop, 0.0f, 1.0f);
7810  RNA_def_property_ui_text(prop, "Center Y", "");
7811  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7812 
7813  prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
7814  RNA_def_property_float_sdna(prop, NULL, "distance");
7815  RNA_def_property_range(prop, -1.0f, 1.0f);
7816  RNA_def_property_ui_text(prop, "Distance", "");
7817  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7818 
7819  prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
7820  RNA_def_property_float_sdna(prop, NULL, "angle");
7821  RNA_def_property_range(prop, 0.0f, DEG2RADF(360.0f));
7822  RNA_def_property_ui_text(prop, "Angle", "");
7823  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7824 
7825  prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_ANGLE);
7826  RNA_def_property_float_sdna(prop, NULL, "spin");
7827  RNA_def_property_range(prop, DEG2RADF(-360.0f), DEG2RADF(360.0f));
7828  RNA_def_property_ui_text(prop, "Spin", "");
7829  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7830 
7831  prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
7832  RNA_def_property_float_sdna(prop, NULL, "zoom");
7833  RNA_def_property_range(prop, 0.0f, 100.0f);
7834  RNA_def_property_ui_text(prop, "Zoom", "");
7835  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7836 }
7837 
7839 {
7840  PropertyRNA *prop;
7841 
7842  RNA_def_struct_sdna_from(srna, "NodeBilateralBlurData", "storage");
7843 
7844  prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7845  RNA_def_property_int_sdna(prop, NULL, "iter");
7846  RNA_def_property_range(prop, 1, 128);
7847  RNA_def_property_ui_text(prop, "Iterations", "");
7848  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7849 
7850  prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
7851  RNA_def_property_float_sdna(prop, NULL, "sigma_color");
7852  RNA_def_property_range(prop, 0.01f, 3.0f);
7853  RNA_def_property_ui_text(prop, "Color Sigma", "");
7854  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7855 
7856  prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
7857  RNA_def_property_float_sdna(prop, NULL, "sigma_space");
7858  RNA_def_property_range(prop, 0.01f, 30.0f);
7859  RNA_def_property_ui_text(prop, "Space Sigma", "");
7860  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7861 }
7862 
7863 static void def_cmp_premul_key(StructRNA *srna)
7864 {
7865  PropertyRNA *prop;
7866 
7867  static const EnumPropertyItem type_items[] = {
7868  {0, "STRAIGHT_TO_PREMUL", 0, "To Premultiplied", "Convert straight to premultiplied"},
7869  {1, "PREMUL_TO_STRAIGHT", 0, "To Straight", "Convert premultiplied to straight"},
7870  {0, NULL, 0, NULL, NULL},
7871  };
7872 
7873  prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
7874  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7875  RNA_def_property_enum_items(prop, type_items);
7877  prop, "Mapping", "Conversion between premultiplied alpha and key alpha");
7878  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7879 }
7880 
7881 static void def_cmp_glare(StructRNA *srna)
7882 {
7883  PropertyRNA *prop;
7884 
7885  static const EnumPropertyItem type_items[] = {
7886  {3, "GHOSTS", 0, "Ghosts", ""},
7887  {2, "STREAKS", 0, "Streaks", ""},
7888  {1, "FOG_GLOW", 0, "Fog Glow", ""},
7889  {0, "SIMPLE_STAR", 0, "Simple Star", ""},
7890  {0, NULL, 0, NULL, NULL},
7891  };
7892 
7893  static const EnumPropertyItem quality_items[] = {
7894  {0, "HIGH", 0, "High", ""},
7895  {1, "MEDIUM", 0, "Medium", ""},
7896  {2, "LOW", 0, "Low", ""},
7897  {0, NULL, 0, NULL, NULL},
7898  };
7899 
7900  RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
7901 
7902  prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE);
7903  RNA_def_property_enum_sdna(prop, NULL, "type");
7904  RNA_def_property_enum_items(prop, type_items);
7905  RNA_def_property_ui_text(prop, "Glare Type", "");
7906  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7907 
7908  prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
7909  RNA_def_property_enum_sdna(prop, NULL, "quality");
7910  RNA_def_property_enum_items(prop, quality_items);
7912  prop,
7913  "Quality",
7914  "If not set to high quality, the effect will be applied to a low-res copy "
7915  "of the source image");
7916  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7917 
7918  prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7919  RNA_def_property_int_sdna(prop, NULL, "iter");
7920  RNA_def_property_range(prop, 2, 5);
7921  RNA_def_property_ui_text(prop, "Iterations", "");
7922  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7923 
7924  prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
7925  RNA_def_property_float_sdna(prop, NULL, "colmod");
7926  RNA_def_property_range(prop, 0.0f, 1.0f);
7928  prop,
7929  "Color Modulation",
7930  "Amount of Color Modulation, modulates colors of streaks and ghosts for "
7931  "a spectral dispersion effect");
7932  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7933 
7934  prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
7935  RNA_def_property_float_sdna(prop, NULL, "mix");
7936  RNA_def_property_range(prop, -1.0f, 1.0f);
7938  prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
7939  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7940 
7941  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
7942  RNA_def_property_float_sdna(prop, NULL, "threshold");
7943  RNA_def_property_range(prop, 0.0f, 1000.0f);
7945  prop,
7946  "Threshold",
7947  "The glare filter will only be applied to pixels brighter than this value");
7948  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7949 
7950  prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
7951  RNA_def_property_int_sdna(prop, NULL, "streaks");
7952  RNA_def_property_range(prop, 1, 16);
7953  RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
7954  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7955 
7956  prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE);
7957  RNA_def_property_float_sdna(prop, NULL, "angle_ofs");
7958  RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
7959  RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset");
7960  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7961 
7962  prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
7963  RNA_def_property_float_sdna(prop, NULL, "fade");
7964  RNA_def_property_range(prop, 0.75f, 1.0f);
7965  RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor");
7966  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7967 
7968  prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE);
7969  RNA_def_property_boolean_sdna(prop, NULL, "star_45", 0);
7970  RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset");
7971  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7972 
7973  prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
7974  RNA_def_property_int_sdna(prop, NULL, "size");
7975  RNA_def_property_range(prop, 6, 9);
7977  prop,
7978  "Size",
7979  "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
7980  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7981 
7982  /* TODO */
7983 }
7984 
7985 static void def_cmp_tonemap(StructRNA *srna)
7986 {
7987  PropertyRNA *prop;
7988 
7989  static const EnumPropertyItem type_items[] = {
7990  {1, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
7991  {0, "RH_SIMPLE", 0, "Rh Simple", ""},
7992  {0, NULL, 0, NULL, NULL},
7993  };
7994 
7995  RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
7996 
7997  prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
7998  RNA_def_property_enum_sdna(prop, NULL, "type");
7999  RNA_def_property_enum_items(prop, type_items);
8000  RNA_def_property_ui_text(prop, "Tonemap Type", "");
8001  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8002 
8003  prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE);
8004  RNA_def_property_float_sdna(prop, NULL, "key");
8005  RNA_def_property_range(prop, 0.0f, 1.0f);
8006  RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
8007  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8008 
8009  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
8010  RNA_def_property_float_sdna(prop, NULL, "offset");
8011  RNA_def_property_range(prop, 0.001f, 10.0f);
8013  prop,
8014  "Offset",
8015  "Normally always 1, but can be used as an extra control to alter the brightness curve");
8016  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8017 
8018  prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
8019  RNA_def_property_float_sdna(prop, NULL, "gamma");
8020  RNA_def_property_range(prop, 0.001f, 3.0f);
8021  RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
8022  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8023 
8024  prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
8025  RNA_def_property_float_sdna(prop, NULL, "f");
8026  RNA_def_property_range(prop, -8.0f, 8.0f);
8028  prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
8029  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8030 
8031  prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
8032  RNA_def_property_float_sdna(prop, NULL, "m");
8033  RNA_def_property_range(prop, 0.0f, 1.0f);
8034  RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
8035  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8036 
8037  prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
8038  RNA_def_property_float_sdna(prop, NULL, "a");
8039  RNA_def_property_range(prop, 0.0f, 1.0f);
8040  RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
8041  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8042 
8043  prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
8044  RNA_def_property_float_sdna(prop, NULL, "c");
8045  RNA_def_property_range(prop, 0.0f, 1.0f);
8047  prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
8048  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8049 }
8050 
8051 static void def_cmp_lensdist(StructRNA *srna)
8052 {
8053  PropertyRNA *prop;
8054 
8055  RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
8056 
8057  prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
8058  RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
8060  prop,
8061  "Projector",
8062  "Enable/disable projector mode (the effect is applied in horizontal direction only)");
8063  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8064 
8065  prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
8066  RNA_def_property_boolean_sdna(prop, NULL, "jit", 1);
8067  RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering (faster, but also noisier)");
8068  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8069 
8070  prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
8071  RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
8073  prop,
8074  "Fit",
8075  "For positive distortion factor only: scale image such that black areas are not visible");
8076  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8077 }
8078 
8080 {
8081  PropertyRNA *prop;
8082  static float default_1[3] = {1.0f, 1.0f, 1.0f};
8083 
8084  static const EnumPropertyItem type_items[] = {
8085  {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
8086  {1,
8087  "OFFSET_POWER_SLOPE",
8088  0,
8089  "Offset/Power/Slope (ASC-CDL)",
8090  "ASC-CDL standard color correction"},
8091  {0, NULL, 0, NULL, NULL},
8092  };
8093 
8094  prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
8095  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8096  RNA_def_property_enum_items(prop, type_items);
8097  RNA_def_property_ui_text(prop, "Correction Formula", "");
8098  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8099 
8100  RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage");
8101 
8102  prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
8103  RNA_def_property_float_sdna(prop, NULL, "lift");
8104  RNA_def_property_array(prop, 3);
8105  RNA_def_property_float_array_default(prop, default_1);
8106  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8107  RNA_def_property_ui_text(prop, "Lift", "Correction for shadows");
8108  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
8109 
8110  prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
8111  RNA_def_property_float_sdna(prop, NULL, "gamma");
8112  RNA_def_property_array(prop, 3);
8113  RNA_def_property_float_array_default(prop, default_1);
8114  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8115  RNA_def_property_ui_text(prop, "Gamma", "Correction for midtones");
8116  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
8117 
8118  prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
8119  RNA_def_property_float_sdna(prop, NULL, "gain");
8120  RNA_def_property_array(prop, 3);
8121  RNA_def_property_float_array_default(prop, default_1);
8122  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8123  RNA_def_property_ui_text(prop, "Gain", "Correction for highlights");
8124  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
8125 
8126  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
8127  RNA_def_property_float_sdna(prop, NULL, "offset");
8128  RNA_def_property_array(prop, 3);
8129  RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
8130  RNA_def_property_ui_text(prop, "Offset", "Correction for entire tonal range");
8131  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
8132 
8133  prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
8134  RNA_def_property_float_sdna(prop, NULL, "power");
8135  RNA_def_property_array(prop, 3);
8136  RNA_def_property_float_array_default(prop, default_1);
8137  RNA_def_property_range(prop, 0.0f, FLT_MAX);
8138  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8139  RNA_def_property_ui_text(prop, "Power", "Correction for midtones");
8140  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
8141 
8142  prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
8143  RNA_def_property_float_sdna(prop, NULL, "slope");
8144  RNA_def_property_array(prop, 3);
8145  RNA_def_property_float_array_default(prop, default_1);
8146  RNA_def_property_range(prop, 0.0f, FLT_MAX);
8147  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
8148  RNA_def_property_ui_text(prop, "Slope", "Correction for highlights");
8149  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
8150 
8151  prop = RNA_def_property(srna, "offset_basis", PROP_FLOAT, PROP_NONE);
8152  RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
8153  RNA_def_property_ui_range(prop, -1.0, 1.0, 1.0, 2);
8154  RNA_def_property_ui_text(prop, "Basis", "Support negative color by using this as the RGB basis");
8155  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
8156 }
8157 
8158 static void def_cmp_huecorrect(StructRNA *srna)
8159 {
8160  PropertyRNA *prop;
8161 
8162  prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
8163  RNA_def_property_pointer_sdna(prop, NULL, "storage");
8164  RNA_def_property_struct_type(prop, "CurveMapping");
8165  RNA_def_property_ui_text(prop, "Mapping", "");
8166  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8167 }
8168 
8169 static void def_cmp_zcombine(StructRNA *srna)
8170 {
8171  PropertyRNA *prop;
8172 
8173  prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
8174  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
8176  prop, "Use Alpha", "Take alpha channel into account when doing the Z operation");
8177  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8178 
8179  prop = RNA_def_property(srna, "use_antialias_z", PROP_BOOLEAN, PROP_NONE);
8180  RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 0);
8182  prop,
8183  "Anti-Alias Z",
8184  "Anti-alias the z-buffer to try to avoid artifacts, mostly useful for Blender renders");
8185  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8186 }
8187 
8188 static void def_cmp_ycc(StructRNA *srna)
8189 {
8190  PropertyRNA *prop;
8191 
8192  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
8193  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8195  RNA_def_property_ui_text(prop, "Mode", "");
8196  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8197 }
8198 
8200 {
8201  static const EnumPropertyItem mode_items[] = {
8202  {CMP_NODE_COMBSEP_COLOR_RGB, "RGB", ICON_NONE, "RGB", "Use RGB color processing"},
8203  {CMP_NODE_COMBSEP_COLOR_HSV, "HSV", ICON_NONE, "HSV", "Use HSV color processing"},
8204  {CMP_NODE_COMBSEP_COLOR_HSL, "HSL", ICON_NONE, "HSL", "Use HSL color processing"},
8205  {CMP_NODE_COMBSEP_COLOR_YCC, "YCC", ICON_NONE, "YCbCr", "Use YCbCr color processing"},
8206  {CMP_NODE_COMBSEP_COLOR_YUV, "YUV", ICON_NONE, "YUV", "Use YUV color processing"},
8207  {0, NULL, 0, NULL, NULL},
8208  };
8209 
8210  PropertyRNA *prop;
8211 
8212  RNA_def_struct_sdna_from(srna, "NodeCMPCombSepColor", "storage");
8213 
8214  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
8216  RNA_def_property_ui_text(prop, "Mode", "Mode of color processing");
8217  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
8218 
8219  prop = RNA_def_property(srna, "ycc_mode", PROP_ENUM, PROP_NONE);
8221  RNA_def_property_ui_text(prop, "Color Space", "Color space used for YCbCrA processing");
8222  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8223 }
8224 
8225 static void def_cmp_movieclip(StructRNA *srna)
8226 {
8227  PropertyRNA *prop;
8228 
8229  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8230  RNA_def_property_pointer_sdna(prop, NULL, "id");
8231  RNA_def_property_struct_type(prop, "MovieClip");
8234  RNA_def_property_ui_text(prop, "Movie Clip", "");
8235  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8236 
8237  RNA_def_struct_sdna_from(srna, "MovieClipUser", "storage");
8238 }
8239 
8240 static void def_cmp_stabilize2d(StructRNA *srna)
8241 {
8242  PropertyRNA *prop;
8243 
8244  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8245  RNA_def_property_pointer_sdna(prop, NULL, "id");
8246  RNA_def_property_struct_type(prop, "MovieClip");
8249  RNA_def_property_ui_text(prop, "Movie Clip", "");
8250  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8251 
8252  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
8253  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8255  RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
8256  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8257 
8258  prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
8261  prop, "Invert", "Invert stabilization to re-introduce motion to the frame");
8262  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8263 }
8264 
8266 {
8267  PropertyRNA *prop;
8268 
8269  static const EnumPropertyItem distortion_type_items[] = {
8270  {0, "UNDISTORT", 0, "Undistort", ""},
8271  {1, "DISTORT", 0, "Distort", ""},
8272  {0, NULL, 0, NULL, NULL},
8273  };
8274 
8275  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8276  RNA_def_property_pointer_sdna(prop, NULL, "id");
8277  RNA_def_property_struct_type(prop, "MovieClip");
8280  RNA_def_property_ui_text(prop, "Movie Clip", "");
8281  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8282 
8283  prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
8284  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8285  RNA_def_property_enum_items(prop, distortion_type_items);
8286  RNA_def_property_ui_text(prop, "Distortion", "Distortion to use to filter image");
8287  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8288 }
8289 
8290 static void def_cmp_mask(StructRNA *srna)
8291 {
8292  PropertyRNA *prop;
8293 
8294  static const EnumPropertyItem aspect_type_items[] = {
8295  {0, "SCENE", 0, "Scene Size", ""},
8296  {CMP_NODEFLAG_MASK_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
8298  "FIXED_SCENE",
8299  0,
8300  "Fixed/Scene",
8301  "Pixel size scaled by scene percentage"},
8302  {0, NULL, 0, NULL, NULL},
8303  };
8304 
8305  prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
8306  RNA_def_property_pointer_sdna(prop, NULL, "id");
8307  RNA_def_property_struct_type(prop, "Mask");
8310  RNA_def_property_ui_text(prop, "Mask", "");
8311 
8312  prop = RNA_def_property(srna, "use_feather", PROP_BOOLEAN, PROP_NONE);
8314  RNA_def_property_ui_text(prop, "Feather", "Use feather information from the mask");
8315  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8316 
8317  prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
8319  RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
8320  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8321 
8322  prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
8323  RNA_def_property_int_sdna(prop, NULL, "custom2");
8325  RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
8326  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8327 
8328  prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
8329  RNA_def_property_float_sdna(prop, NULL, "custom3");
8330  RNA_def_property_range(prop, 0.0, 1.0f);
8331  RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
8332  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8333 
8334  prop = RNA_def_property(srna, "size_source", PROP_ENUM, PROP_NONE);
8335  RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom1");
8336  RNA_def_property_enum_items(prop, aspect_type_items);
8338  prop, "Size Source", "Where to get the mask size from for aspect/size information");
8339  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8340 
8341  RNA_def_struct_sdna_from(srna, "NodeMask", "storage");
8342 
8343  prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
8344  RNA_def_property_range(prop, 1.0f, 10000.0f);
8345  RNA_def_property_ui_text(prop, "X", "");
8346  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8347 
8348  prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
8349  RNA_def_property_range(prop, 1.0f, 10000.0f);
8350  RNA_def_property_ui_text(prop, "Y", "");
8351  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8352 }
8353 
8354 static void dev_cmd_transform(StructRNA *srna)
8355 {
8356  PropertyRNA *prop;
8357 
8358  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
8359  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8361  RNA_def_property_ui_text(prop, "Filter", "Method to use to filter transform");
8362  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8363 }
8364 
8365 /* -- Compositor Nodes ------------------------------------------------------ */
8366 
8368  {0, "ADD", 0, "Add", ""},
8369  {1, "SUBTRACT", 0, "Subtract", ""},
8370  {2, "MULTIPLY", 0, "Multiply", ""},
8371  {3, "NOT", 0, "Not", ""},
8372  {0, NULL, 0, NULL, NULL},
8373 };
8374 
8375 static void def_cmp_boxmask(StructRNA *srna)
8376 {
8377  PropertyRNA *prop;
8378 
8379  prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
8380  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8382  RNA_def_property_ui_text(prop, "Mask Type", "");
8383  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8384 
8385  RNA_def_struct_sdna_from(srna, "NodeBoxMask", "storage");
8386 
8387  prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
8388  RNA_def_property_float_sdna(prop, NULL, "x");
8389  RNA_def_property_float_default(prop, 0.5f);
8390  RNA_def_property_range(prop, -1.0f, 2.0f);
8391  RNA_def_property_ui_text(prop, "X", "X position of the middle of the box");
8392  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8393 
8394  prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
8395  RNA_def_property_float_sdna(prop, NULL, "y");
8396  RNA_def_property_float_default(prop, 0.5f);
8397  RNA_def_property_range(prop, -1.0f, 2.0f);
8398  RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the box");
8399  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8400 
8401  prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
8402  RNA_def_property_float_sdna(prop, NULL, "width");
8403  RNA_def_property_float_default(prop, 0.3f);
8404  RNA_def_property_range(prop, 0.0f, 2.0f);
8405  RNA_def_property_ui_text(prop, "Width", "Width of the box");
8406  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8407 
8408  prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
8409  RNA_def_property_float_sdna(prop, NULL, "height");
8410  RNA_def_property_float_default(prop, 0.2f);
8411  RNA_def_property_range(prop, 0.0f, 2.0f);
8412  RNA_def_property_ui_text(prop, "Height", "Height of the box");
8413  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8414 
8415  prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
8416  RNA_def_property_float_sdna(prop, NULL, "rotation");
8417  RNA_def_property_float_default(prop, 0.0f);
8418  RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
8419  RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the box");
8420  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8421 }
8422 
8423 static void def_cmp_ellipsemask(StructRNA *srna)
8424 {
8425  PropertyRNA *prop;
8426  prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
8427  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8429  RNA_def_property_ui_text(prop, "Mask Type", "");
8430  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8431 
8432  RNA_def_struct_sdna_from(srna, "NodeEllipseMask", "storage");
8433 
8434  prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
8435  RNA_def_property_float_sdna(prop, NULL, "x");
8436  RNA_def_property_float_default(prop, 0.5f);
8437  RNA_def_property_range(prop, -1.0f, 2.0f);
8438  RNA_def_property_ui_text(prop, "X", "X position of the middle of the ellipse");
8439  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8440 
8441  prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
8442  RNA_def_property_float_sdna(prop, NULL, "y");
8443  RNA_def_property_float_default(prop, 0.5f);
8444  RNA_def_property_range(prop, -1.0f, 2.0f);
8445  RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the ellipse");
8446  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8447 
8448  prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
8449  RNA_def_property_float_sdna(prop, NULL, "width");
8450  RNA_def_property_float_default(prop, 0.3f);
8451  RNA_def_property_range(prop, 0.0f, 2.0f);
8452  RNA_def_property_ui_text(prop, "Width", "Width of the ellipse");
8453  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8454 
8455  prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
8456  RNA_def_property_float_sdna(prop, NULL, "height");
8457  RNA_def_property_float_default(prop, 0.2f);
8458  RNA_def_property_range(prop, 0.0f, 2.0f);
8459  RNA_def_property_ui_text(prop, "Height", "Height of the ellipse");
8460  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8461 
8462  prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
8463  RNA_def_property_float_sdna(prop, NULL, "rotation");
8464  RNA_def_property_float_default(prop, 0.0f);
8465  RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
8466  RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the ellipse");
8467  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8468 }
8469 
8470 static void def_cmp_bokehblur(StructRNA *srna)
8471 {
8472  PropertyRNA *prop;
8473 
8474  /* duplicated in def_cmp_blur */
8475  prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
8478  prop, "Variable Size", "Support variable blur per pixel when using an image for size input");
8479  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8480 
8481  prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
8484  prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
8485  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8486 
8487 # if 0
8488  prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
8489  RNA_def_property_float_sdna(prop, NULL, "custom3");
8490  RNA_def_property_range(prop, 0.0f, 128.0f);
8492  prop,
8493  "F-Stop",
8494  "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles "
8495  "the blur radius");
8496  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8497 # endif
8498 
8499  prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
8500  RNA_def_property_float_sdna(prop, NULL, "custom4");
8501  RNA_def_property_range(prop, 0.0f, 10000.0f);
8502  RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
8503  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8504 }
8505 
8506 static void def_cmp_bokehimage(StructRNA *srna)
8507 {
8508  PropertyRNA *prop;
8509 
8510  RNA_def_struct_sdna_from(srna, "NodeBokehImage", "storage");
8511 
8512  prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
8513  RNA_def_property_float_sdna(prop, NULL, "angle");
8514  RNA_def_property_float_default(prop, 0.0f);
8515  RNA_def_property_range(prop, DEG2RADF(-720.0f), DEG2RADF(720.0f));
8516  RNA_def_property_ui_text(prop, "Angle", "Angle of the bokeh");
8517  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8518 
8519  prop = RNA_def_property(srna, "flaps", PROP_INT, PROP_NONE);
8520  RNA_def_property_int_sdna(prop, NULL, "flaps");
8522  RNA_def_property_range(prop, 3, 24);
8523  RNA_def_property_ui_text(prop, "Flaps", "Number of flaps");
8524  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8525 
8526  prop = RNA_def_property(srna, "rounding", PROP_FLOAT, PROP_NONE);
8527  RNA_def_property_float_sdna(prop, NULL, "rounding");
8528  RNA_def_property_float_default(prop, 0.0f);
8529  RNA_def_property_range(prop, -0.0f, 1.0f);
8530  RNA_def_property_ui_text(prop, "Rounding", "Level of rounding of the bokeh");
8531  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8532 
8533  prop = RNA_def_property(srna, "catadioptric", PROP_FLOAT, PROP_NONE);
8534  RNA_def_property_float_sdna(prop, NULL, "catadioptric");
8535  RNA_def_property_float_default(prop, 0.0f);
8536  RNA_def_property_range(prop, -0.0f, 1.0f);
8537  RNA_def_property_ui_text(prop, "Catadioptric", "Level of catadioptric of the bokeh");
8538  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8539 
8540  prop = RNA_def_property(srna, "shift", PROP_FLOAT, PROP_NONE);
8541  RNA_def_property_float_sdna(prop, NULL, "lensshift");
8542  RNA_def_property_float_default(prop, 0.0f);
8543  RNA_def_property_range(prop, -1.0f, 1.0f);
8544  RNA_def_property_ui_text(prop, "Lens Shift", "Shift of the lens components");
8545  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8546 }
8547 
8548 static void def_cmp_switch(StructRNA *srna)
8549 {
8550  PropertyRNA *prop;
8551 
8552  prop = RNA_def_property(srna, "check", PROP_BOOLEAN, PROP_NONE);
8553  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
8554  RNA_def_property_ui_text(prop, "Switch", "Off: first socket, On: second socket");
8555  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8556 }
8557 
8559 {
8560 }
8561 
8563 {
8564  PropertyRNA *prop;
8565  prop = RNA_def_property(srna, "red", PROP_BOOLEAN, PROP_NONE);
8566  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
8568  RNA_def_property_ui_text(prop, "Red", "Red channel active");
8569  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8570 
8571  prop = RNA_def_property(srna, "green", PROP_BOOLEAN, PROP_NONE);
8572  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 2);
8574  RNA_def_property_ui_text(prop, "Green", "Green channel active");
8575  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8576 
8577  prop = RNA_def_property(srna, "blue", PROP_BOOLEAN, PROP_NONE);
8578  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 4);
8580  RNA_def_property_ui_text(prop, "Blue", "Blue channel active");
8581  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8582 
8583  RNA_def_struct_sdna_from(srna, "NodeColorCorrection", "storage");
8584 
8585  prop = RNA_def_property(srna, "midtones_start", PROP_FLOAT, PROP_NONE);
8586  RNA_def_property_float_sdna(prop, NULL, "startmidtones");
8587  RNA_def_property_float_default(prop, 0.2f);
8588  RNA_def_property_range(prop, 0, 1);
8589  RNA_def_property_ui_text(prop, "Midtones Start", "Start of midtones");
8590  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8591 
8592  prop = RNA_def_property(srna, "midtones_end", PROP_FLOAT, PROP_NONE);
8593  RNA_def_property_float_sdna(prop, NULL, "endmidtones");
8594  RNA_def_property_float_default(prop, 0.7f);
8595  RNA_def_property_range(prop, 0, 1);
8596  RNA_def_property_ui_text(prop, "Midtones End", "End of midtones");
8597  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8598 
8599  prop = RNA_def_property(srna, "master_saturation", PROP_FLOAT, PROP_NONE);
8600  RNA_def_property_float_sdna(prop, NULL, "master.saturation");
8601  RNA_def_property_float_default(prop, 1.0f);
8602  RNA_def_property_range(prop, 0, 4);
8603  RNA_def_property_ui_text(prop, "Master Saturation", "Master saturation");
8604  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8605 
8606  prop = RNA_def_property(srna, "master_contrast", PROP_FLOAT, PROP_NONE);
8607  RNA_def_property_float_sdna(prop, NULL, "master.contrast");
8608  RNA_def_property_float_default(prop, 1.0f);
8609  RNA_def_property_range(prop, 0, 4);
8610  RNA_def_property_ui_text(prop, "Master Contrast", "Master contrast");
8611  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8612 
8613  prop = RNA_def_property(srna, "master_gamma", PROP_FLOAT, PROP_NONE);
8614  RNA_def_property_float_sdna(prop, NULL, "master.gamma");
8615  RNA_def_property_float_default(prop, 1.0f);
8616  RNA_def_property_range(prop, 0, 4);
8617  RNA_def_property_ui_text(prop, "Master Gamma", "Master gamma");
8618  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8619 
8620  prop = RNA_def_property(srna, "master_gain", PROP_FLOAT, PROP_NONE);
8621  RNA_def_property_float_sdna(prop, NULL, "master.gain");
8622  RNA_def_property_float_default(prop, 1.0f);
8623  RNA_def_property_range(prop, 0, 4);
8624  RNA_def_property_ui_text(prop, "Master Gain", "Master gain");
8625  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8626 
8627  prop = RNA_def_property(srna, "master_lift", PROP_FLOAT, PROP_NONE);
8628  RNA_def_property_float_sdna(prop, NULL, "master.lift");
8629  RNA_def_property_float_default(prop, 0.0f);
8630  RNA_def_property_range(prop, -1, 1);
8631  RNA_def_property_ui_text(prop, "Master Lift", "Master lift");
8632  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8633 
8634  //
8635  prop = RNA_def_property(srna, "shadows_saturation", PROP_FLOAT, PROP_NONE);
8636  RNA_def_property_float_sdna(prop, NULL, "shadows.saturation");
8637  RNA_def_property_float_default(prop, 1.0f);
8638  RNA_def_property_range(prop, 0, 4);
8639  RNA_def_property_ui_text(prop, "Shadows Saturation", "Shadows saturation");
8640  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8641 
8642  prop = RNA_def_property(srna, "shadows_contrast", PROP_FLOAT, PROP_NONE);
8643  RNA_def_property_float_sdna(prop, NULL, "shadows.contrast");
8644  RNA_def_property_float_default(prop, 1.0f);
8645  RNA_def_property_range(prop, 0, 4);
8646  RNA_def_property_ui_text(prop, "Shadows Contrast", "Shadows contrast");
8647  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8648 
8649  prop = RNA_def_property(srna, "shadows_gamma", PROP_FLOAT, PROP_NONE);
8650  RNA_def_property_float_sdna(prop, NULL, "shadows.gamma");
8651  RNA_def_property_float_default(prop, 1.0f);
8652  RNA_def_property_range(prop, 0, 4);
8653  RNA_def_property_ui_text(prop, "Shadows Gamma", "Shadows gamma");
8654  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8655 
8656  prop = RNA_def_property(srna, "shadows_gain", PROP_FLOAT, PROP_NONE);
8657  RNA_def_property_float_sdna(prop, NULL, "shadows.gain");
8658  RNA_def_property_float_default(prop, 1.0f);
8659  RNA_def_property_range(prop, 0, 4);
8660  RNA_def_property_ui_text(prop, "Shadows Gain", "Shadows gain");
8661  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8662 
8663  prop = RNA_def_property(srna, "shadows_lift", PROP_FLOAT, PROP_NONE);
8664  RNA_def_property_float_sdna(prop, NULL, "shadows.lift");
8665  RNA_def_property_float_default(prop, 0.0f);
8666  RNA_def_property_range(prop, -1, 1);
8667  RNA_def_property_ui_text(prop, "Shadows Lift", "Shadows lift");
8668  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8669  //
8670  prop = RNA_def_property(srna, "midtones_saturation", PROP_FLOAT, PROP_NONE);
8671  RNA_def_property_float_sdna(prop, NULL, "midtones.saturation");
8672  RNA_def_property_float_default(prop, 1.0f);
8673  RNA_def_property_range(prop, 0, 4);
8674  RNA_def_property_ui_text(prop, "Midtones Saturation", "Midtones saturation");
8675  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8676 
8677  prop = RNA_def_property(srna, "midtones_contrast", PROP_FLOAT, PROP_NONE);
8678  RNA_def_property_float_sdna(prop, NULL, "midtones.contrast");
8679  RNA_def_property_float_default(prop, 1.0f);
8680  RNA_def_property_range(prop, 0, 4);
8681  RNA_def_property_ui_text(prop, "Midtones Contrast", "Midtones contrast");
8682  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8683 
8684  prop = RNA_def_property(srna, "midtones_gamma", PROP_FLOAT, PROP_NONE);
8685  RNA_def_property_float_sdna(prop, NULL, "midtones.gamma");
8686  RNA_def_property_float_default(prop, 1.0f);
8687  RNA_def_property_range(prop, 0, 4);
8688  RNA_def_property_ui_text(prop, "Midtones Gamma", "Midtones gamma");
8689  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8690 
8691  prop = RNA_def_property(srna, "midtones_gain", PROP_FLOAT, PROP_NONE);
8692  RNA_def_property_float_sdna(prop, NULL, "midtones.gain");
8693  RNA_def_property_float_default(prop, 1.0f);
8694  RNA_def_property_range(prop, 0, 4);
8695  RNA_def_property_ui_text(prop, "Midtones Gain", "Midtones gain");
8696  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8697 
8698  prop = RNA_def_property(srna, "midtones_lift", PROP_FLOAT, PROP_NONE);
8699  RNA_def_property_float_sdna(prop, NULL, "midtones.lift");
8700  RNA_def_property_float_default(prop, 0.0f);
8701  RNA_def_property_range(prop, -1, 1);
8702  RNA_def_property_ui_text(prop, "Midtones Lift", "Midtones lift");
8703  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8704  //
8705  prop = RNA_def_property(srna, "highlights_saturation", PROP_FLOAT, PROP_NONE);
8706  RNA_def_property_float_sdna(prop, NULL, "highlights.saturation");
8707  RNA_def_property_float_default(prop, 1.0f);
8708  RNA_def_property_range(prop, 0, 4);
8709  RNA_def_property_ui_text(prop, "Highlights Saturation", "Highlights saturation");
8710  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8711 
8712  prop = RNA_def_property(srna, "highlights_contrast", PROP_FLOAT, PROP_NONE);
8713  RNA_def_property_float_sdna(prop, NULL, "highlights.contrast");
8714  RNA_def_property_float_default(prop, 1.0f);
8715  RNA_def_property_range(prop, 0, 4);
8716  RNA_def_property_ui_text(prop, "Highlights Contrast", "Highlights contrast");
8717  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8718 
8719  prop = RNA_def_property(srna, "highlights_gamma", PROP_FLOAT, PROP_NONE);
8720  RNA_def_property_float_sdna(prop, NULL, "highlights.gamma");
8721  RNA_def_property_float_default(prop, 1.0f);
8722  RNA_def_property_range(prop, 0, 4);
8723  RNA_def_property_ui_text(prop, "Highlights Gamma", "Highlights gamma");
8724  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8725 
8726  prop = RNA_def_property(srna, "highlights_gain", PROP_FLOAT, PROP_NONE);
8727  RNA_def_property_float_sdna(prop, NULL, "highlights.gain");
8728  RNA_def_property_float_default(prop, 1.0f);
8729  RNA_def_property_range(prop, 0, 4);
8730  RNA_def_property_ui_text(prop, "Highlights Gain", "Highlights gain");
8731  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8732 
8733  prop = RNA_def_property(srna, "highlights_lift", PROP_FLOAT, PROP_NONE);
8734  RNA_def_property_float_sdna(prop, NULL, "highlights.lift");
8735  RNA_def_property_float_default(prop, 0.0f);
8736  RNA_def_property_range(prop, -1, 1);
8737  RNA_def_property_ui_text(prop, "Highlights Lift", "Highlights lift");
8738  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8739 }
8740 
8741 static void def_cmp_viewer(StructRNA *srna)
8742 {
8743  PropertyRNA *prop;
8744  static const EnumPropertyItem tileorder_items[] = {
8745  {0, "CENTEROUT", 0, "Center", "Expand from center"},
8746  {1, "RANDOM", 0, "Random", "Random tiles"},
8747  {2, "BOTTOMUP", 0, "Bottom Up", "Expand from bottom"},
8748  {3, "RULE_OF_THIRDS", 0, "Rule of Thirds", "Expand from 9 places"},
8749  {0, NULL, 0, NULL, NULL},
8750  };
8751 
8752  prop = RNA_def_property(srna, "tile_order", PROP_ENUM, PROP_NONE);
8753  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8754  RNA_def_property_enum_items(prop, tileorder_items);
8755  RNA_def_property_ui_text(prop, "Tile Order", "Tile order");
8756  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8757 
8758  prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
8759  RNA_def_property_float_sdna(prop, NULL, "custom3");
8760  RNA_def_property_float_default(prop, 0.5f);
8761  RNA_def_property_range(prop, 0.0f, 1.0f);
8762  RNA_def_property_ui_text(prop, "X", "");
8763  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8764 
8765  prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
8766  RNA_def_property_float_sdna(prop, NULL, "custom4");
8767  RNA_def_property_float_default(prop, 0.5f);
8768  RNA_def_property_range(prop, 0.0f, 1.0f);
8769  RNA_def_property_ui_text(prop, "Y", "");
8770  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8771 
8772  prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
8775  prop,
8776  "Use Alpha",
8777  "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
8778  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8779 }
8780 
8781 static void def_cmp_composite(StructRNA *srna)
8782 {
8783  PropertyRNA *prop;
8784 
8785  prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
8788  prop,
8789  "Use Alpha",
8790  "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
8791  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8792 }
8793 
8795 {
8796  PropertyRNA *prop;
8797 
8798  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8799  RNA_def_property_pointer_sdna(prop, NULL, "id");
8800  RNA_def_property_struct_type(prop, "MovieClip");
8803  RNA_def_property_ui_text(prop, "Movie Clip", "");
8804  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8805 
8806  RNA_def_struct_sdna_from(srna, "NodeKeyingScreenData", "storage");
8807 
8808  prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
8809  RNA_def_property_string_sdna(prop, NULL, "tracking_object");
8810  RNA_def_property_ui_text(prop, "Tracking Object", "");
8811  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8812 }
8813 
8814 static void def_cmp_keying(StructRNA *srna)
8815 {
8816  PropertyRNA *prop;
8817 
8818  RNA_def_struct_sdna_from(srna, "NodeKeyingData", "storage");
8819 
8820  prop = RNA_def_property(srna, "screen_balance", PROP_FLOAT, PROP_FACTOR);
8821  RNA_def_property_float_sdna(prop, NULL, "screen_balance");
8822  RNA_def_property_range(prop, 0.0f, 1.0f);
8824  prop,
8825  "Screen Balance",
8826  "Balance between two non-primary channels primary channel is comparing against");
8827  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8828 
8829  prop = RNA_def_property(srna, "despill_factor", PROP_FLOAT, PROP_FACTOR);
8830  RNA_def_property_float_sdna(prop, NULL, "despill_factor");
8831  RNA_def_property_range(prop, 0.0f, 1.0f);
8832  RNA_def_property_ui_text(prop, "Despill Factor", "Factor of despilling screen color from image");
8833  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8834 
8835  prop = RNA_def_property(srna, "despill_balance", PROP_FLOAT, PROP_FACTOR);
8836  RNA_def_property_float_sdna(prop, NULL, "despill_balance");
8837  RNA_def_property_range(prop, 0.0f, 1.0f);
8839  prop,
8840  "Despill Balance",
8841  "Balance between non-key colors used to detect amount of key color to be removed");
8842  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8843 
8844  prop = RNA_def_property(srna, "clip_black", PROP_FLOAT, PROP_FACTOR);
8845  RNA_def_property_float_sdna(prop, NULL, "clip_black");
8846  RNA_def_property_range(prop, 0.0f, 1.0f);
8848  prop,
8849  "Clip Black",
8850  "Value of non-scaled matte pixel which considers as fully background pixel");
8851  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8852 
8853  prop = RNA_def_property(srna, "clip_white", PROP_FLOAT, PROP_FACTOR);
8854  RNA_def_property_float_sdna(prop, NULL, "clip_white");
8855  RNA_def_property_range(prop, 0.0f, 1.0f);
8857  prop,
8858  "Clip White",
8859  "Value of non-scaled matte pixel which considers as fully foreground pixel");
8860  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8861 
8862  prop = RNA_def_property(srna, "blur_pre", PROP_INT, PROP_NONE);
8863  RNA_def_property_int_sdna(prop, NULL, "blur_pre");
8864  RNA_def_property_range(prop, 0, 2048);
8866  prop, "Pre Blur", "Chroma pre-blur size which applies before running keyer");
8867  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8868 
8869  prop = RNA_def_property(srna, "blur_post", PROP_INT, PROP_NONE);
8870  RNA_def_property_int_sdna(prop, NULL, "blur_post");
8871  RNA_def_property_range(prop, 0, 2048);
8873  prop, "Post Blur", "Matte blur size which applies after clipping and dilate/eroding");
8874  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8875 
8876  prop = RNA_def_property(srna, "dilate_distance", PROP_INT, PROP_NONE);
8877  RNA_def_property_int_sdna(prop, NULL, "dilate_distance");
8878  RNA_def_property_range(prop, -100, 100);
8879  RNA_def_property_ui_text(prop, "Dilate/Erode", "Matte dilate/erode side");
8880  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8881 
8882  prop = RNA_def_property(srna, "edge_kernel_radius", PROP_INT, PROP_NONE);
8883  RNA_def_property_int_sdna(prop, NULL, "edge_kernel_radius");
8884  RNA_def_property_range(prop, 0, 100);
8886  prop, "Edge Kernel Radius", "Radius of kernel used to detect whether pixel belongs to edge");
8887  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8888 
8889  prop = RNA_def_property(srna, "edge_kernel_tolerance", PROP_FLOAT, PROP_FACTOR);
8890  RNA_def_property_float_sdna(prop, NULL, "edge_kernel_tolerance");
8891  RNA_def_property_range(prop, 0.0f, 1.0f);
8893  prop,
8894  "Edge Kernel Tolerance",
8895  "Tolerance to pixels inside kernel which are treating as belonging to the same plane");
8896  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8897 
8898  prop = RNA_def_property(srna, "feather_falloff", PROP_ENUM, PROP_NONE);
8899  RNA_def_property_enum_sdna(prop, NULL, "feather_falloff");
8901  RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type the feather");
8903  BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
8904  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8905 
8906  prop = RNA_def_property(srna, "feather_distance", PROP_INT, PROP_NONE);
8907  RNA_def_property_int_sdna(prop, NULL, "feather_distance");
8908  RNA_def_property_range(prop, -100, 100);
8909  RNA_def_property_ui_text(prop, "Feather Distance", "Distance to grow/shrink the feather");
8910  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8911 }
8912 
8913 static void def_cmp_trackpos(StructRNA *srna)
8914 {
8915  PropertyRNA *prop;
8916 
8917  static const EnumPropertyItem position_items[] = {
8918  {CMP_TRACKPOS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Output absolute position of a marker"},
8920  "RELATIVE_START",
8921  0,
8922  "Relative Start",
8923  "Output position of a marker relative to first marker of a track"},
8925  "RELATIVE_FRAME",
8926  0,
8927  "Relative Frame",
8928  "Output position of a marker relative to marker at given frame number"},
8930  "ABSOLUTE_FRAME",
8931  0,
8932  "Absolute Frame",
8933  "Output absolute position of a marker at given frame number"},
8934  {0, NULL, 0, NULL, NULL},
8935  };
8936 
8937  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8938  RNA_def_property_pointer_sdna(prop, NULL, "id");
8939  RNA_def_property_struct_type(prop, "MovieClip");
8942  RNA_def_property_ui_text(prop, "Movie Clip", "");
8943  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8944 
8945  prop = RNA_def_property(srna, "position", PROP_ENUM, PROP_NONE);
8946  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8947  RNA_def_property_enum_items(prop, position_items);
8948  RNA_def_property_ui_text(prop, "Position", "Which marker position to use for output");
8949  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8950 
8951  prop = RNA_def_property(srna, "frame_relative", PROP_INT, PROP_NONE);
8952  RNA_def_property_int_sdna(prop, NULL, "custom2");
8953  RNA_def_property_ui_text(prop, "Frame", "Frame to be used for relative position");
8954  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8955 
8956  RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
8957 
8958  prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
8959  RNA_def_property_string_sdna(prop, NULL, "tracking_object");
8960  RNA_def_property_ui_text(prop, "Tracking Object", "");
8961  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8962 
8963  prop = RNA_def_property(srna, "track_name", PROP_STRING, PROP_NONE);
8964  RNA_def_property_string_sdna(prop, NULL, "track_name");
8965  RNA_def_property_ui_text(prop, "Track", "");
8966  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8967 }
8968 
8969 static void def_cmp_translate(StructRNA *srna)
8970 {
8971  static const EnumPropertyItem translate_items[] = {
8972  {CMP_NODE_WRAP_NONE, "NONE", 0, "None", "No wrapping on X and Y"},
8973  {CMP_NODE_WRAP_X, "XAXIS", 0, "X Axis", "Wrap all pixels on the X axis"},
8974  {CMP_NODE_WRAP_Y, "YAXIS", 0, "Y Axis", "Wrap all pixels on the Y axis"},
8975  {CMP_NODE_WRAP_XY, "BOTH", 0, "Both Axes", "Wrap all pixels on both axes"},
8976  {0, NULL, 0, NULL, NULL},
8977  };
8978 
8979  PropertyRNA *prop;
8980 
8981  RNA_def_struct_sdna_from(srna, "NodeTranslateData", "storage");
8982 
8983  prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
8984  RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
8986  prop,
8987  "Relative",
8988  "Use relative (fraction of input image size) values to define translation");
8989  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8990 
8991  prop = RNA_def_property(srna, "wrap_axis", PROP_ENUM, PROP_NONE);
8992  RNA_def_property_enum_sdna(prop, NULL, "wrap_axis");
8993  RNA_def_property_enum_items(prop, translate_items);
8994  RNA_def_property_ui_text(prop, "Wrapping", "Wrap image on a specific axis");
8995  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8996 }
8997 
8999 {
9000  PropertyRNA *prop;
9001 
9002  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
9003  RNA_def_property_pointer_sdna(prop, NULL, "id");
9004  RNA_def_property_struct_type(prop, "MovieClip");
9007  RNA_def_property_ui_text(prop, "Movie Clip", "");
9008  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9009 
9010  RNA_def_struct_sdna_from(srna, "NodePlaneTrackDeformData", "storage");
9011 
9012  prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
9013  RNA_def_property_string_sdna(prop, NULL, "tracking_object");
9014  RNA_def_property_ui_text(prop, "Tracking Object", "");
9015  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9016 
9017  prop = RNA_def_property(srna, "plane_track_name", PROP_STRING, PROP_NONE);
9018  RNA_def_property_string_sdna(prop, NULL, "plane_track_name");
9019  RNA_def_property_ui_text(prop, "Plane Track", "");
9020  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9021 
9022  prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
9024  RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
9025  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9026 
9027  prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
9029  RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
9030  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9031 
9032  prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
9033  RNA_def_property_range(prop, 0.0, 1.0f);
9034  RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
9035  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9036 }
9037 
9038 static void def_cmp_sunbeams(StructRNA *srna)
9039 {
9040  PropertyRNA *prop;
9041 
9042  RNA_def_struct_sdna_from(srna, "NodeSunBeams", "storage");
9043 
9044  prop = RNA_def_property(srna, "source", PROP_FLOAT, PROP_NONE);
9045  RNA_def_property_float_sdna(prop, NULL, "source");
9046  RNA_def_property_range(prop, -100.0f, 100.0f);
9047  RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
9049  prop, "Source", "Source point of rays as a factor of the image width and height");
9050  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9051 
9052  prop = RNA_def_property(srna, "ray_length", PROP_FLOAT, PROP_UNSIGNED);
9053  RNA_def_property_float_sdna(prop, NULL, "ray_length");
9054  RNA_def_property_range(prop, 0.0f, 100.0f);
9055  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 3);
9056  RNA_def_property_ui_text(prop, "Ray Length", "Length of rays as a factor of the image size");
9057  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9058 }
9059 
9061 {
9062  StructRNA *srna;
9063  PropertyRNA *prop;
9064 
9065  srna = RNA_def_struct(brna, "CryptomatteEntry", NULL);
9066  RNA_def_struct_sdna(srna, "CryptomatteEntry");
9067 
9068  prop = RNA_def_property(srna, "encoded_hash", PROP_FLOAT, PROP_NONE);
9070  RNA_def_property_float_sdna(prop, NULL, "encoded_hash");
9071 
9072  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
9074  RNA_def_property_ui_text(prop, "Name", "");
9075  RNA_def_struct_name_property(srna, prop);
9076 }
9077 
9079 {
9080  PropertyRNA *prop;
9081  static float default_1[3] = {1.0f, 1.0f, 1.0f};
9082 
9083  prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE);
9085  "rna_NodeCryptomatte_matte_get",
9086  "rna_NodeCryptomatte_matte_length",
9087  "rna_NodeCryptomatte_matte_set");
9089  prop, "Matte Objects", "List of object and material crypto IDs to include in matte");
9090  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9091 
9092  prop = RNA_def_property(srna, "add", PROP_FLOAT, PROP_COLOR);
9093  RNA_def_property_float_sdna(prop, NULL, "runtime.add");
9094  RNA_def_property_float_array_default(prop, default_1);
9095  RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
9097  prop, "Add", "Add object or material to matte, by picking a color from the Pick output");
9098  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_add");
9099 
9100  prop = RNA_def_property(srna, "remove", PROP_FLOAT, PROP_COLOR);
9101  RNA_def_property_float_sdna(prop, NULL, "runtime.remove");
9102  RNA_def_property_float_array_default(prop, default_1);
9103  RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
9105  prop,
9106  "Remove",
9107  "Remove object or material from matte, by picking a color from the Pick output");
9108  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_remove");
9109 }
9110 
9112 {
9113  RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
9115 }
9116 
9117 static void def_cmp_cryptomatte(StructRNA *srna)
9118 {
9119  PropertyRNA *prop;
9120 
9121  static const EnumPropertyItem cryptomatte_source_items[] = {
9122  {CMP_CRYPTOMATTE_SRC_RENDER, "RENDER", 0, "Render", "Use Cryptomatte passes from a render"},
9123  {CMP_CRYPTOMATTE_SRC_IMAGE, "IMAGE", 0, "Image", "Use Cryptomatte passes from an image"},
9124  {0, NULL, 0, NULL, NULL}};
9125 
9126  prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
9127  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9128  RNA_def_property_enum_items(prop, cryptomatte_source_items);
9129  RNA_def_property_enum_funcs(prop, NULL, "rna_NodeCryptomatte_source_set", NULL);
9130  RNA_def_property_ui_text(prop, "Source", "Where the Cryptomatte passes are loaded from");
9131 
9132  prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
9134  prop, "rna_NodeCryptomatte_scene_get", "rna_NodeCryptomatte_scene_set", NULL, NULL);
9135  RNA_def_property_struct_type(prop, "Scene");
9138  RNA_def_property_ui_text(prop, "Scene", "");
9139  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9140 
9141  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
9143  "rna_NodeCryptomatte_image_get",
9144  "rna_NodeCryptomatte_image_set",
9145  NULL,
9146  "rna_NodeCryptomatte_image_poll");
9147  RNA_def_property_struct_type(prop, "Image");
9150  RNA_def_property_ui_text(prop, "Image", "");
9151  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9152 
9153  RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
9155 
9156  prop = RNA_def_property(srna, "layer_name", PROP_ENUM, PROP_NONE);
9159  "rna_NodeCryptomatte_layer_name_get",
9160  "rna_NodeCryptomatte_layer_name_set",
9161  "rna_NodeCryptomatte_layer_name_itemf");
9162  RNA_def_property_ui_text(prop, "Cryptomatte Layer", "What Cryptomatte layer is used");
9163  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9164 
9165  prop = RNA_def_property(srna, "entries", PROP_COLLECTION, PROP_NONE);
9166  RNA_def_property_collection_sdna(prop, NULL, "entries", NULL);
9167  RNA_def_property_struct_type(prop, "CryptomatteEntry");
9168  RNA_def_property_ui_text(prop, "Mattes", "");
9170 
9171  /* Included here instead of defining image_user as a property of the node,
9172  * see def_cmp_image for details.
9173  * As mentioned in DNA_node_types.h, iuser is the first member of the Cryptomatte
9174  * storage type, so we can cast node->storage to ImageUser.
9175  * That is required since we can't define the properties from storage->iuser directly... */
9176  RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
9177  def_node_image_user(srna);
9178 }
9179 
9180 static void def_cmp_denoise(StructRNA *srna)
9181 {
9182  PropertyRNA *prop;
9183 
9184  static const EnumPropertyItem prefilter_items[] = {
9186  "NONE",
9187  0,
9188  "None",
9189  "No prefiltering, use when guiding passes are noise-free"},
9191  "FAST",
9192  0,
9193  "Fast",
9194  "Denoise image and guiding passes together. Improves quality when guiding passes are noisy "
9195  "using least amount of extra processing time"},
9197  "ACCURATE",
9198  0,
9199  "Accurate",
9200  "Prefilter noisy guiding passes before denoising image. Improves quality when guiding "
9201  "passes are noisy using extra processing time"},
9202  {0, NULL, 0, NULL, NULL}};
9203 
9204  RNA_def_struct_sdna_from(srna, "NodeDenoise", "storage");
9205 
9206  prop = RNA_def_property(srna, "use_hdr", PROP_BOOLEAN, PROP_NONE);
9207  RNA_def_property_boolean_sdna(prop, NULL, "hdr", 0);
9208  RNA_def_property_ui_text(prop, "HDR", "Process HDR images");
9209  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9210 
9211  prop = RNA_def_property(srna, "prefilter", PROP_ENUM, PROP_NONE);
9212  RNA_def_property_enum_items(prop, prefilter_items);
9213  RNA_def_property_ui_text(prop, "", "Denoising prefilter");
9214  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9215 }
9216 
9218 {
9219  PropertyRNA *prop;
9220 
9221  RNA_def_struct_sdna_from(srna, "NodeAntiAliasingData", "storage");
9222 
9223  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
9224  RNA_def_property_float_sdna(prop, NULL, "threshold");
9225  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
9227  prop,
9228  "Threshold",
9229  "Threshold to detect edges (smaller threshold makes more sensitive detection)");
9230  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9231 
9232  prop = RNA_def_property(srna, "contrast_limit", PROP_FLOAT, PROP_FACTOR);
9233  RNA_def_property_float_sdna(prop, NULL, "contrast_limit");
9234  RNA_def_property_range(prop, 0.0f, 1.0f);
9235  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
9237  prop,
9238  "Contrast Limit",
9239  "How much to eliminate spurious edges to avoid artifacts (the larger value makes less "
9240  "active; the value 2.0, for example, means discard a detected edge if there is a "
9241  "neighboring edge that has 2.0 times bigger contrast than the current one)");
9242  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9243 
9244  prop = RNA_def_property(srna, "corner_rounding", PROP_FLOAT, PROP_FACTOR);
9245  RNA_def_property_float_sdna(prop, NULL, "corner_rounding");
9246  RNA_def_property_range(prop, 0.0f, 1.0f);
9247  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
9248  RNA_def_property_ui_text(prop, "Corner Rounding", "How much sharp corners will be rounded");
9249  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9250 }
9251 
9252 /* -- Texture Nodes --------------------------------------------------------- */
9253 
9254 static void def_tex_output(StructRNA *srna)
9255 {
9256  PropertyRNA *prop;
9257 
9258  RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage");
9259 
9260  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
9261  RNA_def_property_string_sdna(prop, NULL, "name");
9262  RNA_def_property_ui_text(prop, "Output Name", "");
9263  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9264 }
9265 
9266 static void def_tex_image(StructRNA *srna)
9267 {
9268  PropertyRNA *prop;
9269 
9270  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
9271  RNA_def_property_pointer_sdna(prop, NULL, "id");
9272  RNA_def_property_struct_type(prop, "Image");
9275  RNA_def_property_ui_text(prop, "Image", "");
9276  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9277 
9278  prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
9279  RNA_def_property_pointer_sdna(prop, NULL, "storage");
9280  RNA_def_property_struct_type(prop, "ImageUser");
9282  prop, "Image User", "Parameters defining the image duration, offset and related settings");
9283  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9284 }
9285 
9286 static void def_tex_bricks(StructRNA *srna)
9287 {
9288  PropertyRNA *prop;
9289 
9290  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
9291  RNA_def_property_float_sdna(prop, NULL, "custom3");
9292  RNA_def_property_range(prop, 0.0f, 1.0f);
9293  RNA_def_property_ui_text(prop, "Offset Amount", "");
9294  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9295 
9296  prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
9297  RNA_def_property_int_sdna(prop, NULL, "custom1");
9298  RNA_def_property_range(prop, 2, 99);
9299  RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
9300  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9301 
9302  prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
9303  RNA_def_property_float_sdna(prop, NULL, "custom4");
9304  RNA_def_property_range(prop, 0.0f, 99.0f);
9305  RNA_def_property_ui_text(prop, "Squash Amount", "");
9306  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9307 
9308  prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
9309  RNA_def_property_int_sdna(prop, NULL, "custom2");
9310  RNA_def_property_range(prop, 2, 99);
9311  RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
9312  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9313 }
9314 
9315 /* -- Geometry Nodes --------------------------------------------------------- */
9316 
9317 static void def_geo_boolean(StructRNA *srna)
9318 {
9319  PropertyRNA *prop;
9320 
9321  static const EnumPropertyItem rna_node_geometry_boolean_method_items[] = {
9323  "INTERSECT",
9324  0,
9325  "Intersect",
9326  "Keep the part of the mesh that is common between all operands"},
9327  {GEO_NODE_BOOLEAN_UNION, "UNION", 0, "Union", "Combine meshes in an additive way"},
9329  "DIFFERENCE",
9330  0,
9331  "Difference",
9332  "Combine meshes in a subtractive way"},
9333  {0, NULL, 0, NULL, NULL},
9334  };
9335 
9336  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
9337  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9338  RNA_def_property_enum_items(prop, rna_node_geometry_boolean_method_items);
9340  RNA_def_property_ui_text(prop, "Operation", "");
9341  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9342 }
9343 
9345 {
9346  PropertyRNA *prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
9347  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9350  RNA_def_property_ui_text(prop, "Component", "");
9351  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9352 }
9353 
9355 {
9356  static const EnumPropertyItem mode_items[] = {
9357 
9359  "POSITION",
9360  ICON_NONE,
9361  "Position",
9362  "The start and end handles are fixed positions"},
9364  "OFFSET",
9365  ICON_NONE,
9366  "Offset",
9367  "The start and end handles are offsets from the spline's control points"},
9368  {0, NULL, 0, NULL, NULL},
9369  };
9370 
9371  PropertyRNA *prop;
9372 
9373  RNA_def_struct_sdna_from(srna, "NodeGeometryCurvePrimitiveBezierSegment", "storage");
9374 
9375  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9377  RNA_def_property_ui_text(prop, "Mode", "Method used to determine control handles");
9378  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9379 }
9380 
9382 {
9383  static EnumPropertyItem mode_items[] = {
9385  "FACTOR",
9386  0,
9387  "Factor",
9388  "Find sample positions on the curve using a factor of its total length"},
9390  "LENGTH",
9391  0,
9392  "Length",
9393  "Find sample positions on the curve using a distance from its beginning"},
9394  {0, NULL, 0, NULL, NULL},
9395  };
9396 
9397  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSample", "storage");
9398 
9399  PropertyRNA *prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9401  RNA_def_property_ui_text(prop, "Mode", "Method for sampling input");
9402  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9403 }
9404 
9405 static void def_geo_triangulate(StructRNA *srna)
9406 {
9407  PropertyRNA *prop;
9408 
9409  static const EnumPropertyItem rna_node_geometry_triangulate_quad_method_items[] = {
9411  "BEAUTY",
9412  0,
9413  "Beauty",
9414  "Split the quads in nice triangles, slower method"},
9416  "FIXED",
9417  0,
9418  "Fixed",
9419  "Split the quads on the first and third vertices"},
9421  "FIXED_ALTERNATE",
9422  0,
9423  "Fixed Alternate",
9424  "Split the quads on the 2nd and 4th vertices"},
9426  "SHORTEST_DIAGONAL",
9427  0,
9428  "Shortest Diagonal",
9429  "Split the quads along their shortest diagonal"},
9431  "LONGEST_DIAGONAL",
9432  0,
9433  "Longest Diagonal",
9434  "Split the quads along their longest diagonal"},
9435  {0, NULL, 0, NULL, NULL},
9436  };
9437 
9438  static const EnumPropertyItem rna_node_geometry_triangulate_ngon_method_items[] = {
9440  "BEAUTY",
9441  0,
9442  "Beauty",
9443  "Arrange the new triangles evenly (slow)"},
9445  "CLIP",
9446  0,
9447  "Clip",
9448  "Split the polygons with an ear clipping algorithm"},
9449  {0, NULL, 0, NULL, NULL},
9450  };
9451 
9452  prop = RNA_def_property(srna, "quad_method", PROP_ENUM, PROP_NONE);
9453  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9454  RNA_def_property_enum_items(prop, rna_node_geometry_triangulate_quad_method_items);
9456  RNA_def_property_ui_text(prop, "Quad Method", "Method for splitting the quads into triangles");
9457  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9458 
9459  prop = RNA_def_property(srna, "ngon_method", PROP_ENUM, PROP_NONE);
9460  RNA_def_property_enum_sdna(prop, NULL, "custom2");
9461  RNA_def_property_enum_items(prop, rna_node_geometry_triangulate_ngon_method_items);
9463  RNA_def_property_ui_text(prop, "N-gon Method", "Method for splitting the n-gons into triangles");
9464  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9465 }
9466 
9468 {
9469  PropertyRNA *prop;
9470 
9471  RNA_def_struct_sdna_from(srna, "NodeGeometrySubdivisionSurface", "storage");
9472  prop = RNA_def_property(srna, "uv_smooth", PROP_ENUM, PROP_NONE);
9473  RNA_def_property_enum_sdna(prop, NULL, "uv_smooth");
9476  RNA_def_property_ui_text(prop, "UV Smooth", "Controls how smoothing is applied to UVs");
9477  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9478 
9479  prop = RNA_def_property(srna, "boundary_smooth", PROP_ENUM, PROP_NONE);
9480  RNA_def_property_enum_sdna(prop, NULL, "boundary_smooth");
9483  RNA_def_property_ui_text(prop, "Boundary Smooth", "Controls how open boundaries are smoothed");
9484  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9485 }
9486 
9488 {
9489  PropertyRNA *prop;
9490 
9491  RNA_def_struct_sdna_from(srna, "NodeAccumulateField", "storage");
9492 
9493  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
9494  RNA_def_property_enum_sdna(prop, NULL, "data_type");
9496  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeoNodeAccumulateField_type_itemf");
9498  RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
9499  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9500 
9501  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
9502  RNA_def_property_enum_sdna(prop, NULL, "domain");
9505  RNA_def_property_ui_text(prop, "Domain", "");
9506  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9507 }
9508 
9509 static void def_fn_random_value(StructRNA *srna)
9510 {
9511  PropertyRNA *prop;
9512 
9513  RNA_def_struct_sdna_from(srna, "NodeRandomValue", "storage");
9514 
9515  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
9516  RNA_def_property_enum_sdna(prop, NULL, "data_type");
9518  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FunctionNodeRandomValue_type_itemf");
9520  RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
9521  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9522 }
9523 
9525 {
9526  PropertyRNA *prop;
9527 
9528  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
9529  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9531  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeStatistic_type_itemf");
9534  prop,
9535  "Data Type",
9536  "The data type the attribute is converted to before calculating the results");
9537  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
9538 
9539  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
9540  RNA_def_property_enum_sdna(prop, NULL, "custom2");
9543  RNA_def_property_ui_text(prop, "Domain", "Which domain to read the data from");
9544  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9545 }
9546 
9548 {
9549  PropertyRNA *prop;
9550 
9551  static const EnumPropertyItem mode_items[] = {
9552  {GEO_NODE_EXTRUDE_MESH_VERTICES, "VERTICES", 0, "Vertices", ""},
9553  {GEO_NODE_EXTRUDE_MESH_EDGES, "EDGES", 0, "Edges", ""},
9554  {GEO_NODE_EXTRUDE_MESH_FACES, "FACES", 0, "Faces", ""},
9555  {0, NULL, 0, NULL, NULL},
9556  };
9557 
9558  RNA_def_struct_sdna_from(srna, "NodeGeometryExtrudeMesh", "storage");
9559 
9560  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9561  RNA_def_property_enum_sdna(prop, NULL, "mode");
9564  RNA_def_property_ui_text(prop, "Mode", "");
9565  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9566 }
9567 
9569 {
9570  PropertyRNA *prop;
9571 
9572  static const EnumPropertyItem rna_node_geometry_distribute_points_on_faces_mode_items[] = {
9574  "RANDOM",
9575  0,
9576  "Random",
9577  "Distribute points randomly on the surface"},
9579  "POISSON",
9580  0,
9581  "Poisson Disk",
9582  "Distribute the points randomly on the surface while taking a minimum distance between "
9583  "points into account"},
9584  {0, NULL, 0, NULL, NULL},
9585  };
9586 
9587  prop = RNA_def_property(srna, "distribute_method", PROP_ENUM, PROP_NONE);
9588  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9589  RNA_def_property_enum_items(prop, rna_node_geometry_distribute_points_on_faces_mode_items);
9591  RNA_def_property_ui_text(prop, "Distribution Method", "Method to use for scattering points");
9592  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9593 }
9594 
9596 {
9597  PropertyRNA *prop;
9598  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSplineType", "storage");
9599 
9600  prop = RNA_def_property(srna, "spline_type", PROP_ENUM, PROP_NONE);
9601  RNA_def_property_enum_sdna(prop, NULL, "spline_type");
9603  RNA_def_property_ui_text(prop, "Type", "The curve type to change the selected curves to");
9604 
9605  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9606 }
9607 
9609 {
9610  PropertyRNA *prop;
9611 
9612  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSetHandles", "storage");
9613 
9614  prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
9615  RNA_def_property_enum_sdna(prop, NULL, "handle_type");
9617  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9618 
9619  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9621  RNA_def_property_ui_text(prop, "Mode", "Whether to update left and right handles");
9623  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9624 }
9625 
9627 {
9628  PropertyRNA *prop;
9629 
9630  RNA_def_struct_sdna_from(srna, "NodeGeometrySetCurveHandlePositions", "storage");
9631 
9632  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9634  RNA_def_property_ui_text(prop, "Mode", "Whether to update left and right handles");
9635  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9636 }
9637 
9639 {
9640  PropertyRNA *prop;
9641 
9642  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSelectHandles", "storage");
9643 
9644  prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
9645  RNA_def_property_enum_sdna(prop, NULL, "handle_type");
9647  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9648 
9649  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9651  RNA_def_property_ui_text(prop, "Mode", "Whether to check the type of left and right handles");
9653  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9654 }
9655 
9657 {
9658  static const EnumPropertyItem mode_items[] = {
9660  "POINTS",
9661  ICON_NONE,
9662  "Points",
9663  "Define the radius and location with three points"},
9665  "RADIUS",
9666  ICON_NONE,
9667  "Radius",
9668  "Define the radius with a float"},
9669  {0, NULL, 0, NULL, NULL},
9670  };
9671 
9672  PropertyRNA *prop;
9673 
9674  RNA_def_struct_sdna_from(srna, "NodeGeometryCurvePrimitiveCircle", "storage");
9675 
9676  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9678  RNA_def_property_ui_text(prop, "Mode", "Method used to determine radius and placement");
9679  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9680 }
9681 
9683 {
9684  static const EnumPropertyItem mode_items[] = {
9685 
9687  "POINTS",
9688  ICON_NONE,
9689  "Points",
9690  "Define arc by 3 points on circle. Arc is calculated between start and end points"},
9692  "RADIUS",
9693  ICON_NONE,
9694  "Radius",
9695  "Define radius with a float"},
9696  {0, NULL, 0, NULL, NULL},
9697  };
9698 
9699  PropertyRNA *prop;
9700 
9701  RNA_def_struct_sdna_from(srna, "NodeGeometryCurvePrimitiveArc", "storage");
9702 
9703  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9705  RNA_def_property_ui_text(prop, "Mode", "Method used to determine radius and placement");
9706  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9707 }
9708 
9710 {
9711  static const EnumPropertyItem mode_items[] = {
9713  "POINTS",
9714  ICON_NONE,
9715  "Points",
9716  "Define the start and end points of the line"},
9718  "DIRECTION",
9719  ICON_NONE,
9720  "Direction",
9721  "Define a line with a start point, direction and length"},
9722  {0, NULL, 0, NULL, NULL},
9723  };
9724 
9725  PropertyRNA *prop;
9726 
9727  RNA_def_struct_sdna_from(srna, "NodeGeometryCurvePrimitiveLine", "storage");
9728 
9729  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9731  RNA_def_property_ui_text(prop, "Mode", "Method used to determine radius and placement");
9732  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9733 }
9734 
9735 static void def_fn_rotate_euler(StructRNA *srna)
9736 {
9737  static const EnumPropertyItem type_items[] = {
9739  "AXIS_ANGLE",
9740  ICON_NONE,
9741  "Axis Angle",
9742  "Rotate around an axis by an angle"},
9744  "EULER",
9745  ICON_NONE,
9746  "Euler",
9747  "Rotate around the X, Y, and Z axes"},
9748  {0, NULL, 0, NULL, NULL},
9749  };
9750 
9751  static const EnumPropertyItem space_items[] = {
9753  "OBJECT",
9754  ICON_NONE,
9755  "Object",
9756  "Rotate the input rotation in the local space of the object"},
9758  "LOCAL",
9759  ICON_NONE,
9760  "Local",
9761  "Rotate the input rotation in its local space"},
9762  {0, NULL, 0, NULL, NULL},
9763  };
9764 
9765  PropertyRNA *prop;
9766 
9767  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
9768  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9769  RNA_def_property_enum_items(prop, type_items);
9770  RNA_def_property_ui_text(prop, "Type", "Method used to describe the rotation");
9771  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9772 
9773  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
9774  RNA_def_property_enum_sdna(prop, NULL, "custom2");
9776  RNA_def_property_ui_text(prop, "Space", "Base orientation for rotation");
9777  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9778 }
9779 
9781 {
9782  static const EnumPropertyItem axis_items[] = {
9784  "X",
9785  ICON_NONE,
9786  "X",
9787  "Align the X axis with the vector"},
9789  "Y",
9790  ICON_NONE,
9791  "Y",
9792  "Align the Y axis with the vector"},
9794  "Z",
9795  ICON_NONE,
9796  "Z",
9797  "Align the Z axis with the vector"},
9798  {0, NULL, 0, NULL, NULL},
9799  };
9800 
9801  static const EnumPropertyItem pivot_axis_items[] = {
9803  "AUTO",
9804  ICON_NONE,
9805  "Auto",
9806  "Automatically detect the best rotation axis to rotate towards the vector"},
9808  "X",
9809  ICON_NONE,
9810  "X",
9811  "Rotate around the local X axis"},
9813  "Y",
9814  ICON_NONE,
9815  "Y",
9816  "Rotate around the local Y axis"},
9818  "Z",
9819  ICON_NONE,
9820  "Z",
9821  "Rotate around the local Z axis"},
9822  {0, NULL, 0, NULL, NULL},
9823  };
9824 
9825  PropertyRNA *prop;
9826 
9827  prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
9828  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9829  RNA_def_property_enum_items(prop, axis_items);
9830  RNA_def_property_ui_text(prop, "Axis", "Axis to align to the vector");
9831  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9832 
9833  prop = RNA_def_property(srna, "pivot_axis", PROP_ENUM, PROP_NONE);
9834  RNA_def_property_enum_sdna(prop, NULL, "custom2");
9835  RNA_def_property_enum_items(prop, pivot_axis_items);
9836  RNA_def_property_ui_text(prop, "Pivot Axis", "Axis to rotate around");
9837  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9838 }
9839 
9840 static void def_geo_object_info(StructRNA *srna)
9841 {
9842  PropertyRNA *prop;
9843 
9844  static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = {
9846  "ORIGINAL",
9847  0,
9848  "Original",
9849  "Output the geometry relative to the input object transform, and the location, rotation "
9850  "and "
9851  "scale relative to the world origin"},
9853  "RELATIVE",
9854  0,
9855  "Relative",
9856  "Bring the input object geometry, location, rotation and scale into the modified object, "
9857  "maintaining the relative position between the two objects in the scene"},
9858  {0, NULL, 0, NULL, NULL},
9859  };
9860 
9861  RNA_def_struct_sdna_from(srna, "NodeGeometryObjectInfo", "storage");
9862 
9863  prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
9864  RNA_def_property_enum_items(prop, rna_node_geometry_object_info_transform_space_items);
9866  prop, "Transform Space", "The transformation of the vector and geometry outputs");
9867  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9868 }
9869 
9871 {
9872  PropertyRNA *prop;
9873 
9874  static EnumPropertyItem resolution_mode_items[] = {
9876  "VOXEL_AMOUNT",
9877  0,
9878  "Amount",
9879  "Specify the approximate number of voxels along the diagonal"},
9881  "VOXEL_SIZE",
9882  0,
9883  "Size",
9884  "Specify the voxel side length"},
9885  {0, NULL, 0, NULL, NULL},
9886  };
9887 
9888  RNA_def_struct_sdna_from(srna, "NodeGeometryPointsToVolume", "storage");
9889 
9890  prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE);
9891  RNA_def_property_enum_items(prop, resolution_mode_items);
9892  RNA_def_property_ui_text(prop, "Resolution Mode", "How the voxel size is specified");
9893  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9894 }
9895 
9896 static void def_geo_uv_unwrap(StructRNA *srna)
9897 {
9898  PropertyRNA *prop;
9899 
9900  static EnumPropertyItem rna_node_geometry_uv_unwrap_method_items[] = {
9902  "ANGLE_BASED",
9903  0,
9904  "Angle Based",
9905  "This method gives a good 2D representation of a mesh"},
9907  "CONFORMAL",
9908  0,
9909  "Conformal",
9910  "Uses LSCM (Least Squares Conformal Mapping). This usually gives a less accurate UV "
9911  "mapping than Angle Based, but works better for simpler objects"},
9912  {0, NULL, 0, NULL, NULL},
9913  };
9914 
9915  RNA_def_struct_sdna_from(srna, "NodeGeometryUVUnwrap", "storage");
9916 
9917  prop = RNA_def_property(srna, "method", PROP_ENUM, PROP_NONE);
9918  RNA_def_property_enum_items(prop, rna_node_geometry_uv_unwrap_method_items);
9919  RNA_def_property_ui_text(prop, "Method", "");
9920  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9921 }
9922 
9924 {
9925  PropertyRNA *prop;
9926 
9927  static const EnumPropertyItem rna_node_geometry_collection_info_transform_space_items[] = {
9929  "ORIGINAL",
9930  0,
9931  "Original",
9932  "Output the geometry relative to the collection offset"},
9934  "RELATIVE",
9935  0,
9936  "Relative",
9937  "Bring the input collection geometry into the modified object, maintaining the relative "
9938  "position between the objects in the scene"},
9939  {0, NULL, 0, NULL, NULL},
9940  };
9941 
9942  RNA_def_struct_sdna_from(srna, "NodeGeometryCollectionInfo", "storage");
9943 
9944  prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
9945  RNA_def_property_enum_items(prop, rna_node_geometry_collection_info_transform_space_items);
9946  RNA_def_property_ui_text(prop, "Transform Space", "The transformation of the geometry output");
9947  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9948 }
9949 
9950 static void def_geo_proximity(StructRNA *srna)
9951 {
9952  static const EnumPropertyItem target_element_items[] = {
9954  "POINTS",
9955  ICON_NONE,
9956  "Points",
9957  "Calculate the proximity to the target's points (faster than the other modes)"},
9959  "EDGES",
9960  ICON_NONE,
9961  "Edges",
9962  "Calculate the proximity to the target's edges"},
9964  "FACES",
9965  ICON_NONE,
9966  "Faces",
9967  "Calculate the proximity to the target's faces"},
9968  {0, NULL, 0, NULL, NULL},
9969  };
9970 
9971  PropertyRNA *prop;
9972 
9973  RNA_def_struct_sdna_from(srna, "NodeGeometryProximity", "storage");
9974 
9975  prop = RNA_def_property(srna, "target_element", PROP_ENUM, PROP_NONE);
9976  RNA_def_property_enum_items(prop, target_element_items);
9979  prop, "Target Geometry", "Element of the target geometry to calculate the distance from");
9980  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9981 }
9982 
9984 {
9985  PropertyRNA *prop;
9986 
9987  static EnumPropertyItem resolution_mode_items[] = {
9989  "GRID",
9990  0,
9991  "Grid",
9992  "Use resolution of the volume grid"},
9994  "VOXEL_AMOUNT",
9995  0,
9996  "Amount",
9997  "Desired number of voxels along one axis"},
9999  "VOXEL_SIZE",
10000  0,
10001  "Size",
10002  "Desired voxel side length"},
10003  {0, NULL, 0, NULL, NULL},
10004  };
10005 
10006  RNA_def_struct_sdna_from(srna, "NodeGeometryVolumeToMesh", "storage");
10007 
10008  prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE);
10009  RNA_def_property_enum_items(prop, resolution_mode_items);
10010  RNA_def_property_ui_text(prop, "Resolution Mode", "How the voxel size is specified");
10011  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10012 }
10013 
10015 {
10016  PropertyRNA *prop;
10017 
10018  static EnumPropertyItem resolution_mode_items[] = {
10020  "VOXEL_AMOUNT",
10021  0,
10022  "Amount",
10023  "Desired number of voxels along one axis"},
10025  "VOXEL_SIZE",
10026  0,
10027  "Size",
10028  "Desired voxel side length"},
10029  {0, NULL, 0, NULL, NULL},
10030  };
10031 
10032  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshToVolume", "storage");
10033 
10034  prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE);
10035  RNA_def_property_enum_items(prop, resolution_mode_items);
10036  RNA_def_property_ui_text(prop, "Resolution Mode", "How the voxel size is specified");
10037  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10038 }
10039 
10040 static void def_geo_mesh_circle(StructRNA *srna)
10041 {
10042  PropertyRNA *prop;
10043 
10044  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshCircle", "storage");
10045 
10046  prop = RNA_def_property(srna, "fill_type", PROP_ENUM, PROP_NONE);
10048  RNA_def_property_ui_text(prop, "Fill Type", "");
10049  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10050 }
10051 
10053 {
10054  PropertyRNA *prop;
10055 
10056  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshCylinder", "storage");
10057 
10058  prop = RNA_def_property(srna, "fill_type", PROP_ENUM, PROP_NONE);
10060  RNA_def_property_ui_text(prop, "Fill Type", "");
10061  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10062 }
10063 
10064 static void def_geo_mesh_cone(StructRNA *srna)
10065 {
10066  PropertyRNA *prop;
10067 
10068  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshCone", "storage");
10069 
10070  prop = RNA_def_property(srna, "fill_type", PROP_ENUM, PROP_NONE);
10072  RNA_def_property_ui_text(prop, "Fill Type", "");
10073  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10074 }
10075 
10077 {
10078  PropertyRNA *prop;
10079 
10080  static EnumPropertyItem mode_items[] = {
10082  "ALL",
10083  0,
10084  "All",
10085  "Merge all close selected points, whether or not they are connected"},
10087  "CONNECTED",
10088  0,
10089  "Connected",
10090  "Only merge mesh vertices along existing edges. This method can be much faster"},
10091  {0, NULL, 0, NULL, NULL},
10092  };
10093 
10094  RNA_def_struct_sdna_from(srna, "NodeGeometryMergeByDistance", "storage");
10095 
10096  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10098  RNA_def_property_ui_text(prop, "Mode", "");
10099  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10100 }
10101 
10102 static void def_geo_mesh_line(StructRNA *srna)
10103 {
10104  PropertyRNA *prop;
10105 
10106  static EnumPropertyItem mode_items[] = {
10108  "OFFSET",
10109  0,
10110  "Offset",
10111  "Specify the offset from one vertex to the next"},
10113  "END_POINTS",
10114  0,
10115  "End Points",
10116  "Specify the line's start and end points"},
10117  {0, NULL, 0, NULL, NULL},
10118  };
10119 
10120  static EnumPropertyItem count_mode_items[] = {
10122  "TOTAL",
10123  0,
10124  "Count",
10125  "Specify the total number of vertices"},
10127  "RESOLUTION",
10128  0,
10129  "Resolution",
10130  "Specify the distance between vertices"},
10131  {0, NULL, 0, NULL, NULL},
10132  };
10133 
10134  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshLine", "storage");
10135 
10136  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10138  RNA_def_property_ui_text(prop, "Mode", "");
10139  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10140 
10141  prop = RNA_def_property(srna, "count_mode", PROP_ENUM, PROP_NONE);
10142  RNA_def_property_enum_items(prop, count_mode_items);
10143  RNA_def_property_ui_text(prop, "Count Mode", "");
10144  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10145 }
10146 
10147 static void def_geo_switch(StructRNA *srna)
10148 {
10149  PropertyRNA *prop;
10150 
10151  RNA_def_struct_sdna_from(srna, "NodeSwitch", "storage");
10152  prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE);
10153  RNA_def_property_enum_sdna(prop, NULL, "input_type");
10155  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeSwitch_type_itemf");
10156  RNA_def_property_ui_text(prop, "Input Type", "");
10157  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10158 }
10159 
10161 {
10162  PropertyRNA *prop;
10163 
10164  static EnumPropertyItem mode_items[] = {
10166  "RECTANGLE",
10167  0,
10168  "Rectangle",
10169  "Create a rectangle"},
10171  "PARALLELOGRAM",
10172  0,
10173  "Parallelogram",
10174  "Create a parallelogram"},
10176  "TRAPEZOID",
10177  0,
10178  "Trapezoid",
10179  "Create a trapezoid"},
10180  {GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_KITE, "KITE", 0, "Kite", "Create a Kite / Dart"},
10182  "POINTS",
10183  0,
10184  "Points",
10185  "Create a quadrilateral from four points"},
10186  {0, NULL, 0, NULL, NULL},
10187  };
10188 
10189  RNA_def_struct_sdna_from(srna, "NodeGeometryCurvePrimitiveQuad", "storage");
10190 
10191  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10192  RNA_def_property_enum_sdna(prop, NULL, "mode");
10195  RNA_def_property_ui_text(prop, "Mode", "");
10196  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10197 }
10198 
10200 {
10201  PropertyRNA *prop;
10202 
10203  static EnumPropertyItem mode_items[] = {
10205  "EVALUATED",
10206  0,
10207  "Evaluated",
10208  "Output the input spline's evaluated points, based on the resolution attribute for NURBS "
10209  "and Bezier splines. Poly splines are unchanged"},
10211  "COUNT",
10212  0,
10213  "Count",
10214  "Sample the specified number of points along each spline"},
10216  "LENGTH",
10217  0,
10218  "Length",
10219  "Calculate the number of samples by splitting each spline into segments with the specified "
10220  "length"},
10221  {0, NULL, 0, NULL, NULL},
10222  };
10223 
10224  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveResample", "storage");
10225 
10226  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10228  RNA_def_property_ui_text(prop, "Mode", "How to specify the amount of samples");
10229  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10230 }
10231 
10233 {
10234  PropertyRNA *prop;
10235 
10236  static EnumPropertyItem mode_items[] = {
10238  "BEZIER",
10239  0,
10240  "Bezier",
10241  "Align Bezier handles to create circular arcs at each control point"},
10243  "POLY",
10244  0,
10245  "Poly",
10246  "Add control points along a circular arc (handle type is vector if Bezier Spline)"},
10247  {0, NULL, 0, NULL, NULL},
10248  };
10249 
10250  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveFillet", "storage");
10251 
10252  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10254  RNA_def_property_ui_text(prop, "Mode", "How to choose number of vertices on fillet");
10255  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10256 }
10257 
10259 {
10260  PropertyRNA *prop;
10261 
10262  static EnumPropertyItem mode_items[] = {
10264  "EVALUATED",
10265  0,
10266  "Evaluated",
10267  "Create points from the curve's evaluated points, based on the resolution attribute for "
10268  "NURBS and Bezier splines"},
10270  "COUNT",
10271  0,
10272  "Count",
10273  "Sample each spline by evenly distributing the specified number of points"},
10275  "LENGTH",
10276  0,
10277  "Length",
10278  "Sample each spline by splitting it into segments with the specified length"},
10279  {0, NULL, 0, NULL, NULL},
10280  };
10281 
10282  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveToPoints", "storage");
10283 
10284  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10286  RNA_def_property_ui_text(prop, "Mode", "How to generate points from the input curve");
10287  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10288 }
10289 
10291 {
10292  PropertyRNA *prop;
10293 
10294  static EnumPropertyItem mode_items[] = {
10296  "VERTICES",
10297  0,
10298  "Vertices",
10299  "Create a point in the point cloud for each selected vertex"},
10301  "EDGES",
10302  0,
10303  "Edges",
10304  "Create a point in the point cloud for each selected edge"},
10306  "FACES",
10307  0,
10308  "Faces",
10309  "Create a point in the point cloud for each selected face"},
10311  "CORNERS",
10312  0,
10313  "Corners",
10314  "Create a point in the point cloud for each selected face corner"},
10315  {0, NULL, 0, NULL, NULL},
10316  };
10317 
10318  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshToPoints", "storage");
10319 
10320  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10322  RNA_def_property_ui_text(prop, "Mode", "");
10323  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10324 }
10325 
10326 static void def_geo_curve_trim(StructRNA *srna)
10327 {
10328  PropertyRNA *prop;
10329 
10330  static EnumPropertyItem mode_items[] = {
10332  "FACTOR",
10333  0,
10334  "Factor",
10335  "Find the endpoint positions using a factor of each spline's length"},
10337  "LENGTH",
10338  0,
10339  "Length",
10340  "Find the endpoint positions using a length from the start of each spline"},
10341  {0, NULL, 0, NULL, NULL},
10342  };
10343 
10344  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveTrim", "storage");
10345 
10346  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10348  RNA_def_property_ui_text(prop, "Mode", "How to find endpoint positions for the trimmed spline");
10349  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10350 }
10351 
10353 {
10354  static EnumPropertyItem mapping_items[] = {
10356  "NEAREST_FACE_INTERPOLATED",
10357  0,
10358  "Nearest Face Interpolated",
10359  "Transfer the attribute from the nearest face on a surface (loose points and edges are "
10360  "ignored)"},
10362  "NEAREST",
10363  0,
10364  "Nearest",
10365  "Transfer the element from the nearest element (using face and edge centers for the "
10366  "distance computation)"},
10368  "INDEX",
10369  0,
10370  "Index",
10371  "Transfer the data from the element with the corresponding index in the target geometry"},
10372  {0, NULL, 0, NULL, NULL},
10373  };
10374 
10375  PropertyRNA *prop;
10376 
10377  RNA_def_struct_sdna_from(srna, "NodeGeometryTransferAttribute", "storage");
10378 
10379  prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
10380  RNA_def_property_enum_sdna(prop, NULL, "mode");
10381  RNA_def_property_enum_items(prop, mapping_items);
10382  RNA_def_property_ui_text(prop, "Mapping", "Mapping between geometries");
10383  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10384 
10385  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10387  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_NodeGeometryTransferAttribute_type_itemf");
10389  RNA_def_property_ui_text(prop, "Data Type", "The type for the source and result data");
10390  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10391 
10392  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10395  RNA_def_property_ui_text(prop, "Domain", "The domain to use on the target geometry");
10396  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10397 }
10398 
10400 {
10401  PropertyRNA *prop;
10402 
10403  prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
10404  RNA_def_property_pointer_sdna(prop, NULL, "id");
10405  RNA_def_property_struct_type(prop, "Material");
10408  RNA_def_property_ui_text(prop, "Material", "");
10409  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10410 }
10411 
10412 static void def_geo_raycast(StructRNA *srna)
10413 {
10414  static EnumPropertyItem mapping_items[] = {
10416  "INTERPOLATED",
10417  0,
10418  "Interpolated",
10419  "Interpolate the attribute from the corners of the hit face"},
10421  "NEAREST",
10422  0,
10423  "Nearest",
10424  "Use the attribute value of the closest mesh element"},
10425  {0, NULL, 0, NULL, NULL},
10426  };
10427 
10428  PropertyRNA *prop;
10429 
10430  RNA_def_struct_sdna_from(srna, "NodeGeometryRaycast", "storage");
10431 
10432  prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
10433  RNA_def_property_enum_items(prop, mapping_items);
10434  RNA_def_property_ui_text(prop, "Mapping", "Mapping from the target geometry to hit points");
10435  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10436 
10437  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10440  prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
10442  RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
10443  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10444 }
10445 
10446 static void def_geo_curve_fill(StructRNA *srna)
10447 {
10448  static const EnumPropertyItem mode_items[] = {
10449  {GEO_NODE_CURVE_FILL_MODE_TRIANGULATED, "TRIANGLES", 0, "Triangles", ""},
10450  {GEO_NODE_CURVE_FILL_MODE_NGONS, "NGONS", 0, "N-gons", ""},
10451  {0, NULL, 0, NULL, NULL},
10452  };
10453 
10454  PropertyRNA *prop;
10455  RNA_def_struct_sdna_from(srna, "NodeGeometryCurveFill", "storage");
10456 
10457  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10458  RNA_def_property_enum_sdna(prop, NULL, "mode");
10460  RNA_def_property_ui_text(prop, "Mode", "");
10461  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10462 }
10463 
10465 {
10466  PropertyRNA *prop;
10467 
10468  RNA_def_struct_sdna_from(srna, "NodeGeometryStoreNamedAttribute", "storage");
10469 
10470  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10472  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_itemf");
10474  RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
10475  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10476 
10477  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10480  RNA_def_property_ui_text(prop, "Domain", "Which domain to store the data in");
10481  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10482 }
10483 
10485 {
10486  PropertyRNA *prop;
10487 
10488  RNA_def_struct_sdna_from(srna, "NodeGeometryInputNamedAttribute", "storage");
10489 
10490  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10493  prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
10495  RNA_def_property_ui_text(prop, "Data Type", "The data type used to read the attribute values");
10496  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10497 }
10498 
10500 {
10501  PropertyRNA *prop;
10502 
10503  RNA_def_struct_sdna_from(srna, "NodeGeometryAttributeCapture", "storage");
10504 
10505  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10508  prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
10510  RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
10511  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10512 
10513  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10516  RNA_def_property_ui_text(prop, "Domain", "Which domain to store the data in");
10517  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10518 }
10519 
10521 {
10522  PropertyRNA *prop;
10523 
10524  static const EnumPropertyItem mode_items[] = {
10525  {GEO_NODE_DELETE_GEOMETRY_MODE_ALL, "ALL", 0, "All", ""},
10526  {GEO_NODE_DELETE_GEOMETRY_MODE_EDGE_FACE, "EDGE_FACE", 0, "Only Edges & Faces", ""},
10527  {GEO_NODE_DELETE_GEOMETRY_MODE_ONLY_FACE, "ONLY_FACE", 0, "Only Faces", ""},
10528  {0, NULL, 0, NULL, NULL},
10529  };
10530  RNA_def_struct_sdna_from(srna, "NodeGeometryDeleteGeometry", "storage");
10531 
10532  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
10535  RNA_def_property_ui_text(prop, "Mode", "Which parts of the mesh component to delete");
10536  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10537 
10538  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10541  RNA_def_property_ui_text(prop, "Domain", "Which domain to delete in");
10542  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10543 }
10544 
10546 {
10547  PropertyRNA *prop;
10548 
10549  static const EnumPropertyItem domain_items[] = {
10550  {ATTR_DOMAIN_POINT, "POINT", 0, "Point", ""},
10551  {ATTR_DOMAIN_EDGE, "EDGE", 0, "Edge", ""},
10552  {ATTR_DOMAIN_FACE, "FACE", 0, "Face", ""},
10553  {ATTR_DOMAIN_CURVE, "SPLINE", 0, "Spline", ""},
10554  {ATTR_DOMAIN_INSTANCE, "INSTANCE", 0, "Instance", ""},
10555  {0, NULL, 0, NULL, NULL},
10556  };
10557  RNA_def_struct_sdna_from(srna, "NodeGeometryDuplicateElements", "storage");
10558 
10559  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10560  RNA_def_property_enum_items(prop, domain_items);
10562  RNA_def_property_ui_text(prop, "Domain", "Which domain to duplicate");
10563  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10564 }
10565 
10567 {
10568  static const EnumPropertyItem rna_node_geometry_string_to_curves_overflow_items[] = {
10570  "OVERFLOW",
10571  ICON_NONE,
10572  "Overflow",
10573  "Let the text use more space than the specified height"},
10575  "SCALE_TO_FIT",
10576  ICON_NONE,
10577  "Scale To Fit",
10578  "Scale the text size to fit inside the width and height"},
10580  "TRUNCATE",
10581  ICON_NONE,
10582  "Truncate",
10583  "Only output curves that fit within the width and height. Output the remainder to the "
10584  "\"Remainder\" output"},
10585  {0, NULL, 0, NULL, NULL},
10586  };
10587 
10588  static const EnumPropertyItem rna_node_geometry_string_to_curves_align_x_items[] = {
10590  "LEFT",
10591  ICON_ALIGN_LEFT,
10592  "Left",
10593  "Align text to the left"},
10595  "CENTER",
10596  ICON_ALIGN_CENTER,
10597  "Center",
10598  "Align text to the center"},
10600  "RIGHT",
10601  ICON_ALIGN_RIGHT,
10602  "Right",
10603  "Align text to the right"},
10605  "JUSTIFY",
10606  ICON_ALIGN_JUSTIFY,
10607  "Justify",
10608  "Align text to the left and the right"},
10610  "FLUSH",
10611  ICON_ALIGN_FLUSH,
10612  "Flush",
10613  "Align text to the left and the right, with equal character spacing"},
10614  {0, NULL, 0, NULL, NULL},
10615  };
10616 
10617  static const EnumPropertyItem rna_node_geometry_string_to_curves_align_y_items[] = {
10619  "TOP_BASELINE",
10620  ICON_ALIGN_TOP,
10621  "Top Baseline",
10622  "Align text to the top baseline"},
10624  "TOP",
10625  ICON_ALIGN_TOP,
10626  "Top",
10627  "Align text to the top"},
10629  "MIDDLE",
10630  ICON_ALIGN_MIDDLE,
10631  "Middle",
10632  "Align text to the middle"},
10634  "BOTTOM_BASELINE",
10635  ICON_ALIGN_BOTTOM,
10636  "Bottom Baseline",
10637  "Align text to the bottom baseline"},
10639  "BOTTOM",
10640  ICON_ALIGN_BOTTOM,
10641  "Bottom",
10642  "Align text to the bottom"},
10643  {0, NULL, 0, NULL, NULL},
10644  };
10645 
10646  static const EnumPropertyItem rna_node_geometry_string_to_curves_pivot_mode[] = {
10647  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT, "MIDPOINT", 0, "Midpoint", "Midpoint"},
10648  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT, "TOP_LEFT", 0, "Top Left", "Top Left"},
10650  "TOP_CENTER",
10651  0,
10652  "Top Center",
10653  "Top Center"},
10654  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT, "TOP_RIGHT", 0, "Top Right", "Top Right"},
10656  "BOTTOM_LEFT",
10657  0,
10658  "Bottom Left",
10659  "Bottom Left"},
10661  "BOTTOM_CENTER",
10662  0,
10663  "Bottom Center",
10664  "Bottom Center"},
10666  "BOTTOM_RIGHT",
10667  0,
10668  "Bottom Right",
10669  "Bottom Right"},
10670  {0, NULL, 0, NULL, NULL},
10671  };
10672 
10673  PropertyRNA *prop;
10674 
10675  prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
10676  RNA_def_property_pointer_sdna(prop, NULL, "id");
10677  RNA_def_property_struct_type(prop, "VectorFont");
10678  RNA_def_property_ui_text(prop, "Font", "Font of the text. Falls back to the UI font by default");
10681  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10682 
10683  RNA_def_struct_sdna_from(srna, "NodeGeometryStringToCurves", "storage");
10684 
10685  prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
10686  RNA_def_property_enum_sdna(prop, NULL, "overflow");
10687  RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_overflow_items);
10689  RNA_def_property_ui_text(prop, "Overflow", "");
10690  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
10691 
10692  prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
10693  RNA_def_property_enum_sdna(prop, NULL, "align_x");
10694  RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_align_x_items);
10696  RNA_def_property_ui_text(prop, "Align X", "");
10697  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10698 
10699  prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
10700  RNA_def_property_enum_sdna(prop, NULL, "align_y");
10701  RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_align_y_items);
10703  RNA_def_property_ui_text(prop, "Align Y", "");
10704  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10705 
10706  prop = RNA_def_property(srna, "pivot_mode", PROP_ENUM, PROP_NONE);
10707  RNA_def_property_enum_sdna(prop, NULL, "pivot_mode");
10708  RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_pivot_mode);
10710  RNA_def_property_ui_text(prop, "Pivot Point", "Pivot point position relative to character");
10711  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10712 }
10713 
10715 {
10716  PropertyRNA *prop;
10717 
10718  RNA_def_struct_sdna_from(srna, "NodeGeometrySeparateGeometry", "storage");
10719 
10720  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10723  RNA_def_property_ui_text(prop, "Domain", "Which domain to separate on");
10724  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10725 }
10726 
10727 static void def_geo_viewer(StructRNA *srna)
10728 {
10729  PropertyRNA *prop;
10730 
10731  RNA_def_struct_sdna_from(srna, "NodeGeometryViewer", "storage");
10732 
10733  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10736  prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
10738  RNA_def_property_ui_text(prop, "Data Type", "");
10739  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10740 }
10741 
10743 {
10744  PropertyRNA *prop;
10745 
10746  prop = RNA_def_property(srna, "legacy_behavior", PROP_BOOLEAN, PROP_NONE);
10749  prop, "Legacy Behavior", "Behave like before instance attributes existed");
10750  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10751 }
10752 
10754 {
10755  PropertyRNA *prop;
10756 
10757  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10758  RNA_def_property_enum_sdna(prop, NULL, "custom1");
10760  RNA_def_property_ui_text(prop, "Domain", "Domain the field is evaluated in");
10761  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10762 
10763  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10764  RNA_def_property_enum_sdna(prop, NULL, "custom2");
10767  prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
10768  RNA_def_property_ui_text(prop, "Data Type", "");
10769  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10770 }
10771 
10773 {
10774  PropertyRNA *prop;
10775 
10776  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10777  RNA_def_property_enum_sdna(prop, NULL, "custom1");
10779  RNA_def_property_ui_text(prop, "Domain", "Domain the field is evaluated in");
10780  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10781 
10782  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
10783  RNA_def_property_enum_sdna(prop, NULL, "custom2");
10786  prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
10787  RNA_def_property_ui_text(prop, "Data Type", "");
10788  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10789 }
10790 
10792 {
10793  PropertyRNA *prop;
10794 
10795  static const EnumPropertyItem domain_items[] = {
10797  "FACE",
10798  ICON_NONE,
10799  "Face",
10800  "Scale individual faces or neighboring face islands"},
10802  "EDGE",
10803  ICON_NONE,
10804  "Edge",
10805  "Scale individual edges or neighboring edge islands"},
10806  {0, NULL, 0, NULL, NULL},
10807  };
10808 
10809  static const EnumPropertyItem scale_mode_items[] = {
10811  "UNIFORM",
10812  ICON_NONE,
10813  "Uniform",
10814  "Scale elements by the same factor in every direction"},
10816  "SINGLE_AXIS",
10817  ICON_NONE,
10818  "Single Axis",
10819  "Scale elements in a single direction"},
10820  {0, NULL, 0, NULL, NULL},
10821 
10822  };
10823 
10824  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
10825  RNA_def_property_enum_sdna(prop, NULL, "custom1");
10826  RNA_def_property_enum_items(prop, domain_items);
10828  RNA_def_property_ui_text(prop, "Domain", "Element type to transform");
10829  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10830 
10831  prop = RNA_def_property(srna, "scale_mode", PROP_ENUM, PROP_NONE);
10832  RNA_def_property_enum_sdna(prop, NULL, "custom2");
10833  RNA_def_property_enum_items(prop, scale_mode_items);
10834  RNA_def_property_ui_text(prop, "Scale Mode", "");
10835  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
10836 }
10837 
10838 /* -------------------------------------------------------------------------- */
10839 
10841 {
10842  StructRNA *srna;
10843 
10844  srna = RNA_def_struct(brna, "ShaderNode", "NodeInternal");
10845  RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node");
10846  RNA_def_struct_sdna(srna, "bNode");
10847  RNA_def_struct_register_funcs(srna, "rna_ShaderNode_register", "rna_Node_unregister", NULL);
10848 }
10849 
10851 {
10852  StructRNA *srna;
10853  FunctionRNA *func;
10854 
10855  srna = RNA_def_struct(brna, "CompositorNode", "NodeInternal");
10856  RNA_def_struct_ui_text(srna, "Compositor Node", "");
10857  RNA_def_struct_sdna(srna, "bNode");
10858  RNA_def_struct_register_funcs(srna, "rna_CompositorNode_register", "rna_Node_unregister", NULL);
10859 
10860  /* compositor node need_exec flag */
10861  func = RNA_def_function(srna, "tag_need_exec", "rna_CompositorNode_tag_need_exec");
10862  RNA_def_function_ui_description(func, "Tag the node for compositor update");
10863 
10865 }
10866 
10868 {
10869  StructRNA *srna;
10870 
10871  srna = RNA_def_struct(brna, "TextureNode", "NodeInternal");
10872  RNA_def_struct_ui_text(srna, "Texture Node", "");
10873  RNA_def_struct_sdna(srna, "bNode");
10874  RNA_def_struct_register_funcs(srna, "rna_TextureNode_register", "rna_Node_unregister", NULL);
10875 }
10876 
10878 {
10879  StructRNA *srna;
10880 
10881  srna = RNA_def_struct(brna, "GeometryNode", "NodeInternal");
10882  RNA_def_struct_ui_text(srna, "Geometry Node", "");
10883  RNA_def_struct_sdna(srna, "bNode");
10884  RNA_def_struct_register_funcs(srna, "rna_GeometryNode_register", "rna_Node_unregister", NULL);
10885 }
10886 
10888 {
10889  StructRNA *srna;
10890 
10891  srna = RNA_def_struct(brna, "FunctionNode", "NodeInternal");
10892  RNA_def_struct_ui_text(srna, "Function Node", "");
10893  RNA_def_struct_sdna(srna, "bNode");
10894  RNA_def_struct_register_funcs(srna, "rna_FunctionNode_register", "rna_Node_unregister", NULL);
10895 }
10896 
10897 /* -------------------------------------------------------------------------- */
10898 
10900 {
10901  StructRNA *srna;
10902  PropertyRNA *prop;
10903  PropertyRNA *parm;
10904  FunctionRNA *func;
10905 
10906  static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
10907 
10908  srna = RNA_def_struct(brna, "NodeSocket", NULL);
10909  RNA_def_struct_ui_text(srna, "Node Socket", "Input or output socket of a node");
10910  RNA_def_struct_sdna(srna, "bNodeSocket");
10911  RNA_def_struct_refine_func(srna, "rna_NodeSocket_refine");
10912  RNA_def_struct_ui_icon(srna, ICON_NONE);
10913  RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
10915  srna, "rna_NodeSocket_register", "rna_NodeSocket_unregister", NULL);
10916  RNA_def_struct_idprops_func(srna, "rna_NodeSocket_idprops");
10917 
10918  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
10919  RNA_def_property_ui_text(prop, "Name", "Socket name");
10920  RNA_def_struct_name_property(srna, prop);
10921  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
10922 
10923  prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
10924  RNA_def_property_string_sdna(prop, NULL, "label");
10926  RNA_def_property_ui_text(prop, "Label", "Custom dynamic defined socket label");
10927 
10928  prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
10929  RNA_def_property_string_sdna(prop, NULL, "identifier");
10931  RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets");
10932 
10933  prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
10934  RNA_def_property_string_sdna(prop, NULL, "description");
10935  RNA_def_property_ui_text(prop, "Tooltip", "Socket tooltip");
10936  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
10937 
10938  prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
10939  RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL);
10941  RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input");
10942 
10943  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
10945  RNA_def_property_boolean_funcs(prop, NULL, "rna_NodeSocket_hide_set");
10946  RNA_def_property_ui_text(prop, "Hide", "Hide the socket");
10948 
10949  prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
10951  RNA_def_property_ui_text(prop, "Enabled", "Enable the socket");
10953 
10954  prop = RNA_def_property(srna, "link_limit", PROP_INT, PROP_NONE);
10955  RNA_def_property_int_sdna(prop, NULL, "limit");
10956  RNA_def_property_int_funcs(prop, NULL, "rna_NodeSocket_link_limit_set", NULL);
10957  RNA_def_property_range(prop, 1, 0xFFF);
10958  RNA_def_property_ui_text(prop, "Link Limit", "Max number of links allowed for this socket");
10960 
10961  prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE);
10964  RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected");
10965 
10966  prop = RNA_def_property(srna, "is_multi_input", PROP_BOOLEAN, PROP_NONE);
10970  prop, "Multi Input", "True if the socket can accept multiple ordered input links");
10971 
10972  prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
10975  RNA_def_property_ui_text(prop, "Expanded", "Socket links are expanded in the user interface");
10977 
10978  prop = RNA_def_property(srna, "hide_value", PROP_BOOLEAN, PROP_NONE);
10980  RNA_def_property_ui_text(prop, "Hide Value", "Hide the socket input value");
10982 
10983  prop = RNA_def_property(srna, "node", PROP_POINTER, PROP_NONE);
10984  RNA_def_property_pointer_funcs(prop, "rna_NodeSocket_node_get", NULL, NULL, NULL);
10985  RNA_def_property_struct_type(prop, "Node");
10989  RNA_def_property_ui_text(prop, "Node", "Node owning this socket");
10990 
10991  /* NOTE: The type property is used by standard sockets.
10992  * Ideally should be defined only for the registered subclass,
10993  * but to use the existing DNA is added in the base type here.
10994  * Future socket types can ignore or override this if needed. */
10995 
10996  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
10997  RNA_def_property_enum_sdna(prop, NULL, "type");
11000  RNA_def_property_enum_funcs(prop, NULL, "rna_NodeSocket_type_set", NULL);
11001  RNA_def_property_ui_text(prop, "Type", "Data type");
11002  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
11003 
11004  prop = RNA_def_property(srna, "display_shape", PROP_ENUM, PROP_NONE);
11005  RNA_def_property_enum_sdna(prop, NULL, "display_shape");
11008  RNA_def_property_ui_text(prop, "Shape", "Socket shape");
11009  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
11010 
11011  /* registration */
11012  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
11013  RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
11015  RNA_def_property_ui_text(prop, "ID Name", "");
11016 
11017  prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
11018  RNA_def_property_string_sdna(prop, NULL, "typeinfo->label");
11020  RNA_def_property_ui_text(prop, "Type Label", "Label to display for the socket type in the UI");
11021 
11022  /* draw socket */
11023  func = RNA_def_function(srna, "draw", NULL);
11024  RNA_def_function_ui_description(func, "Draw socket");
11026  parm = RNA_def_pointer(func, "context", "Context", "", "");
11028  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
11029  RNA_def_property_struct_type(parm, "UILayout");
11030  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
11032  parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
11033  RNA_def_property_struct_type(parm, "Node");
11034  RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
11036  parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
11037  RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
11038  // RNA_def_property_string_default(parm, "");
11040 
11041  func = RNA_def_function(srna, "draw_color", NULL);
11042  RNA_def_function_ui_description(func, "Color of the socket icon");
11044  parm = RNA_def_pointer(func, "context", "Context", "", "");
11046  parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
11047  RNA_def_property_struct_type(parm, "Node");
11048  RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
11050  parm = RNA_def_float_array(
11051  func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
11052  RNA_def_function_output(func, parm);
11053 }
11054 
11056 {
11057  StructRNA *srna;
11058  PropertyRNA *prop;
11059  PropertyRNA *parm;
11060  FunctionRNA *func;
11061 
11062  static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
11063 
11064  srna = RNA_def_struct(brna, "NodeSocketInterface", NULL);
11065  RNA_def_struct_ui_text(srna, "Node Socket Template", "Parameters to define node sockets");
11066  /* XXX Using bNodeSocket DNA for templates is a compatibility hack.
11067  * This allows to keep the inputs/outputs lists in bNodeTree working for earlier versions
11068  * and at the same time use them for socket templates in groups.
11069  */
11070  RNA_def_struct_sdna(srna, "bNodeSocket");
11071  RNA_def_struct_refine_func(srna, "rna_NodeSocketInterface_refine");
11072  RNA_def_struct_path_func(srna, "rna_NodeSocketInterface_path");
11073  RNA_def_struct_idprops_func(srna, "rna_NodeSocketInterface_idprops");
11075  srna, "rna_NodeSocketInterface_register", "rna_NodeSocketInterface_unregister", NULL);
11076 
11077  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
11078  RNA_def_property_ui_text(prop, "Name", "Socket name");
11079  RNA_def_struct_name_property(srna, prop);
11080  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11081 
11082  prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
11083  RNA_def_property_string_sdna(prop, NULL, "identifier");
11085  RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets");
11086 
11087  prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
11088  RNA_def_property_string_sdna(prop, NULL, "description");
11089  RNA_def_property_ui_text(prop, "Tooltip", "Socket tooltip");
11090  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11091 
11092  prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
11093  RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL);
11095  RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input");
11096 
11097  prop = RNA_def_property(srna, "hide_value", PROP_BOOLEAN, PROP_NONE);
11101  prop, "Hide Value", "Hide the socket input value even when the socket is not connected");
11102  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11103 
11104  prop = RNA_def_property(srna, "attribute_domain", PROP_ENUM, PROP_NONE);
11107  prop,
11108  "Attribute Domain",
11109  "Attribute domain used by the geometry nodes modifier to create an attribute output");
11110  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11111 
11112  prop = RNA_def_property(srna, "default_attribute_name", PROP_STRING, PROP_NONE);
11113  RNA_def_property_string_sdna(prop, NULL, "default_attribute_name");
11115  "Default Attribute",
11116  "The attribute name used by default when the node group is used by a "
11117  "geometry nodes modifier");
11118  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11119 
11120  /* registration */
11121  prop = RNA_def_property(srna, "bl_socket_idname", PROP_STRING, PROP_NONE);
11122  RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
11124  RNA_def_property_ui_text(prop, "ID Name", "");
11125 
11126  prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
11127  RNA_def_property_string_sdna(prop, NULL, "typeinfo->label");
11129  RNA_def_property_ui_text(prop, "Type Label", "Label to display for the socket type in the UI");
11130 
11131  func = RNA_def_function(srna, "draw", NULL);
11132  RNA_def_function_ui_description(func, "Draw template settings");
11134  parm = RNA_def_pointer(func, "context", "Context", "", "");
11136  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
11137  RNA_def_property_struct_type(parm, "UILayout");
11138  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
11140 
11141  func = RNA_def_function(srna, "draw_color", NULL);
11142  RNA_def_function_ui_description(func, "Color of the socket icon");
11144  parm = RNA_def_pointer(func, "context", "Context", "", "");
11146  parm = RNA_def_float_array(
11147  func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
11148  RNA_def_function_output(func, parm);
11149 
11150  func = RNA_def_function(srna, "register_properties", NULL);
11151  RNA_def_function_ui_description(func, "Define RNA properties of a socket");
11153  parm = RNA_def_pointer(
11154  func, "data_rna_type", "Struct", "Data RNA Type", "RNA type for special socket properties");
11156 
11157  func = RNA_def_function(srna, "init_socket", NULL);
11158  RNA_def_function_ui_description(func, "Initialize a node socket instance");
11160  parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the socket to initialize");
11162  parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Socket to initialize");
11164  parm = RNA_def_string(
11165  func, "data_path", NULL, 0, "Data Path", "Path to specialized socket data");
11167 
11168  func = RNA_def_function(srna, "from_socket", NULL);
11169  RNA_def_function_ui_description(func, "Setup template parameters from an existing socket");
11171  parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the original socket");
11173  parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Original socket");
11175 }
11176 
11178  const char *idname,
11179  const char *interface_idname,
11180  PropertySubType subtype)
11181 {
11182  StructRNA *srna;
11183  PropertyRNA *prop;
11184  float value_default;
11185 
11186  /* choose sensible common default based on subtype */
11187  switch (subtype) {
11188  case PROP_FACTOR:
11189  value_default = 1.0f;
11190  break;
11191  case PROP_PERCENTAGE:
11192  value_default = 100.0f;
11193  break;
11194  default:
11195  value_default = 0.0f;
11196  break;
11197  }
11198 
11199  srna = RNA_def_struct(brna, idname, "NodeSocketStandard");
11200  RNA_def_struct_ui_text(srna, "Float Node Socket", "Floating-point number socket of a node");
11201  RNA_def_struct_sdna(srna, "bNodeSocket");
11202 
11203  RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "default_value");
11204 
11205  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
11206  RNA_def_property_float_sdna(prop, NULL, "value");
11207  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_float_range");
11208  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11209  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
11211 
11212  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11213 
11214  /* socket interface */
11215  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11217  srna, "Float Node Socket Interface", "Floating-point number socket of a node");
11218  RNA_def_struct_sdna(srna, "bNodeSocket");
11219 
11220  RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "default_value");
11221 
11222  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
11223  RNA_def_property_float_sdna(prop, NULL, "value");
11224  RNA_def_property_float_default(prop, value_default);
11226  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_float_range");
11227  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11228  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11229 
11230  prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
11231  RNA_def_property_float_sdna(prop, NULL, "min");
11233  RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
11234  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11235 
11236  prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
11237  RNA_def_property_float_sdna(prop, NULL, "max");
11239  RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
11240  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11241 
11242  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11243 }
11244 
11246  const char *identifier,
11247  const char *interface_idname,
11248  PropertySubType subtype)
11249 {
11250  StructRNA *srna;
11251  PropertyRNA *prop;
11252  int value_default;
11253 
11254  /* choose sensible common default based on subtype */
11255  switch (subtype) {
11256  case PROP_FACTOR:
11257  value_default = 1;
11258  break;
11259  case PROP_PERCENTAGE:
11260  value_default = 100;
11261  break;
11262  default:
11263  value_default = 0;
11264  break;
11265  }
11266 
11267  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11268  RNA_def_struct_ui_text(srna, "Integer Node Socket", "Integer number socket of a node");
11269  RNA_def_struct_sdna(srna, "bNodeSocket");
11270 
11271  RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "default_value");
11272 
11273  prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
11274  RNA_def_property_int_sdna(prop, NULL, "value");
11275  RNA_def_property_int_default(prop, value_default);
11276  RNA_def_property_int_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_int_range");
11277  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11278  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
11280 
11281  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11282 
11283  /* socket interface */
11284  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11285  RNA_def_struct_ui_text(srna, "Integer Node Socket Interface", "Integer number socket of a node");
11286  RNA_def_struct_sdna(srna, "bNodeSocket");
11287 
11288  RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "default_value");
11289 
11290  prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
11291  RNA_def_property_int_sdna(prop, NULL, "value");
11293  RNA_def_property_int_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_int_range");
11294  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11295  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11296 
11297  prop = RNA_def_property(srna, "min_value", PROP_INT, PROP_NONE);
11298  RNA_def_property_int_sdna(prop, NULL, "min");
11300  RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
11301  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11302 
11303  prop = RNA_def_property(srna, "max_value", PROP_INT, PROP_NONE);
11304  RNA_def_property_int_sdna(prop, NULL, "max");
11306  RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
11307  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11308 
11309  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11310 }
11311 
11313  const char *identifier,
11314  const char *interface_idname)
11315 {
11316  StructRNA *srna;
11317  PropertyRNA *prop;
11318 
11319  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11320  RNA_def_struct_ui_text(srna, "Boolean Node Socket", "Boolean value socket of a node");
11321  RNA_def_struct_sdna(srna, "bNodeSocket");
11322 
11323  RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "default_value");
11324 
11325  prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
11326  RNA_def_property_boolean_sdna(prop, NULL, "value", 1);
11327  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11328  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
11330 
11331  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11332 
11333  /* socket interface */
11334  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11335  RNA_def_struct_ui_text(srna, "Boolean Node Socket Interface", "Boolean value socket of a node");
11336  RNA_def_struct_sdna(srna, "bNodeSocket");
11337 
11338  RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "default_value");
11339 
11340  prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
11341  RNA_def_property_boolean_sdna(prop, NULL, "value", 1);
11343  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11344  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11345 
11346  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11347 }
11348 
11350  const char *identifier,
11351  const char *interface_idname,
11352  PropertySubType subtype)
11353 {
11354  StructRNA *srna;
11355  PropertyRNA *prop;
11356  const float *value_default;
11357 
11358  /* choose sensible common default based on subtype */
11359  switch (subtype) {
11360  case PROP_DIRECTION: {
11361  static const float default_direction[3] = {0.0f, 0.0f, 1.0f};
11362  value_default = default_direction;
11363  break;
11364  }
11365  default: {
11366  static const float default_vector[3] = {0.0f, 0.0f, 0.0f};
11367  value_default = default_vector;
11368  break;
11369  }
11370  }
11371 
11372  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11373  RNA_def_struct_ui_text(srna, "Vector Node Socket", "3D vector socket of a node");
11374  RNA_def_struct_sdna(srna, "bNodeSocket");
11375 
11376  RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "default_value");
11377 
11378  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
11379  RNA_def_property_float_sdna(prop, NULL, "value");
11380  RNA_def_property_float_array_default(prop, value_default);
11381  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_vector_range");
11382  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11383  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
11385 
11386  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11387 
11388  /* socket interface */
11389  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11390  RNA_def_struct_ui_text(srna, "Vector Node Socket Interface", "3D vector socket of a node");
11391  RNA_def_struct_sdna(srna, "bNodeSocket");
11392 
11393  RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "default_value");
11394 
11395  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
11396  RNA_def_property_float_sdna(prop, NULL, "value");
11398  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_vector_range");
11399  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11400  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11401 
11402  prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
11403  RNA_def_property_float_sdna(prop, NULL, "min");
11405  RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
11406  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11407 
11408  prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
11409  RNA_def_property_float_sdna(prop, NULL, "max");
11411  RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
11412  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11413 
11414  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11415 }
11416 
11418  const char *identifier,
11419  const char *interface_idname)
11420 {
11421  StructRNA *srna;
11422  PropertyRNA *prop;
11423 
11424  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11425  RNA_def_struct_ui_text(srna, "Color Node Socket", "RGBA color socket of a node");
11426  RNA_def_struct_sdna(srna, "bNodeSocket");
11427 
11428  RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "default_value");
11429 
11430  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
11431  RNA_def_property_float_sdna(prop, NULL, "value");
11432  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11433  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
11435 
11436  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11437 
11438  /* socket interface */
11439  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11440  RNA_def_struct_ui_text(srna, "Color Node Socket Interface", "RGBA color socket of a node");
11441  RNA_def_struct_sdna(srna, "bNodeSocket");
11442 
11443  RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "default_value");
11444 
11445  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
11446  RNA_def_property_float_sdna(prop, NULL, "value");
11448  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11449  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11450 
11451  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11452 }
11453 
11455  const char *identifier,
11456  const char *interface_idname)
11457 {
11458  StructRNA *srna;
11459  PropertyRNA *prop;
11460 
11461  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11462  RNA_def_struct_ui_text(srna, "String Node Socket", "String socket of a node");
11463  RNA_def_struct_sdna(srna, "bNodeSocket");
11464 
11465  RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
11466 
11467  prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
11468  RNA_def_property_string_sdna(prop, NULL, "value");
11469  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11470  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
11472 
11473  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11474 
11475  /* socket interface */
11476  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11477  RNA_def_struct_ui_text(srna, "String Node Socket Interface", "String socket of a node");
11478  RNA_def_struct_sdna(srna, "bNodeSocket");
11479 
11480  RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
11481 
11482  prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
11483  RNA_def_property_string_sdna(prop, NULL, "value");
11485  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11486  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11487 
11488  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
11489 }
11490 
11492  const char *identifier,
11493  const char *interface_idname)
11494 {
11495  StructRNA *srna;
11496 
11497  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11498  RNA_def_struct_ui_text(srna, "Shader Node Socket", "Shader socket of a node");
11499  RNA_def_struct_sdna(srna, "bNodeSocket");
11500 
11501  /* socket interface */
11502  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11503  RNA_def_struct_ui_text(srna, "Shader Node Socket Interface", "Shader socket of a node");
11504  RNA_def_struct_sdna(srna, "bNodeSocket");
11505 }
11506 
11507 static void rna_def_node_socket_virtual(BlenderRNA *brna, const char *identifier)
11508 {
11509  StructRNA *srna;
11510 
11511  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11512  RNA_def_struct_ui_text(srna, "Virtual Node Socket", "Virtual socket of a node");
11513  RNA_def_struct_sdna(srna, "bNodeSocket");
11514 }
11515 
11517  const char *identifier,
11518  const char *interface_idname)
11519 {
11520  StructRNA *srna;
11521  PropertyRNA *prop;
11522 
11523  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11524  RNA_def_struct_ui_text(srna, "Object Node Socket", "Object socket of a node");
11525  RNA_def_struct_sdna(srna, "bNodeSocket");
11526 
11527  RNA_def_struct_sdna_from(srna, "bNodeSocketValueObject", "default_value");
11528 
11529  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11530  RNA_def_property_pointer_sdna(prop, NULL, "value");
11531  RNA_def_property_struct_type(prop, "Object");
11532  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11534  prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update");
11537 
11538  /* socket interface */
11539  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11540  RNA_def_struct_ui_text(srna, "Object Node Socket Interface", "Object socket of a node");
11541  RNA_def_struct_sdna(srna, "bNodeSocket");
11542 
11543  RNA_def_struct_sdna_from(srna, "bNodeSocketValueObject", "default_value");
11544 
11545  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11546  RNA_def_property_pointer_sdna(prop, NULL, "value");
11547  RNA_def_property_struct_type(prop, "Object");
11548  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11549  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11552 }
11553 
11555  const char *identifier,
11556  const char *interface_idname)
11557 {
11558  StructRNA *srna;
11559  PropertyRNA *prop;
11560 
11561  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11562  RNA_def_struct_ui_text(srna, "Image Node Socket", "Image socket of a node");
11563  RNA_def_struct_sdna(srna, "bNodeSocket");
11564 
11565  RNA_def_struct_sdna_from(srna, "bNodeSocketValueImage", "default_value");
11566 
11567  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11568  RNA_def_property_pointer_sdna(prop, NULL, "value");
11569  RNA_def_property_struct_type(prop, "Image");
11570  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11572  prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update");
11575 
11576  /* socket interface */
11577  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11578  RNA_def_struct_ui_text(srna, "Image Node Socket Interface", "Image socket of a node");
11579  RNA_def_struct_sdna(srna, "bNodeSocket");
11580 
11581  RNA_def_struct_sdna_from(srna, "bNodeSocketValueImage", "default_value");
11582 
11583  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11584  RNA_def_property_pointer_sdna(prop, NULL, "value");
11585  RNA_def_property_struct_type(prop, "Image");
11586  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11587  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11590 }
11591 
11593  const char *identifier,
11594  const char *interface_idname)
11595 {
11596  StructRNA *srna;
11597 
11598  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11599  RNA_def_struct_ui_text(srna, "Geometry Node Socket", "Geometry socket of a node");
11600  RNA_def_struct_sdna(srna, "bNodeSocket");
11601 
11602  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11603  RNA_def_struct_ui_text(srna, "Geometry Node Socket Interface", "Geometry socket of a node");
11604  RNA_def_struct_sdna(srna, "bNodeSocket");
11605 }
11606 
11608  const char *identifier,
11609  const char *interface_idname)
11610 {
11611  StructRNA *srna;
11612  PropertyRNA *prop;
11613 
11614  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11615  RNA_def_struct_ui_text(srna, "Collection Node Socket", "Collection socket of a node");
11616  RNA_def_struct_sdna(srna, "bNodeSocket");
11617 
11618  RNA_def_struct_sdna_from(srna, "bNodeSocketValueCollection", "default_value");
11619 
11620  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11621  RNA_def_property_pointer_sdna(prop, NULL, "value");
11622  RNA_def_property_struct_type(prop, "Collection");
11623  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11625  prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update");
11628 
11629  /* socket interface */
11630  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11631  RNA_def_struct_ui_text(srna, "Collection Node Socket Interface", "Collection socket of a node");
11632  RNA_def_struct_sdna(srna, "bNodeSocket");
11633 
11634  RNA_def_struct_sdna_from(srna, "bNodeSocketValueCollection", "default_value");
11635 
11636  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11637  RNA_def_property_pointer_sdna(prop, NULL, "value");
11638  RNA_def_property_struct_type(prop, "Collection");
11639  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11640  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11643 }
11644 
11646  const char *identifier,
11647  const char *interface_idname)
11648 {
11649  StructRNA *srna;
11650  PropertyRNA *prop;
11651 
11652  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11653  RNA_def_struct_ui_text(srna, "Texture Node Socket", "Texture socket of a node");
11654  RNA_def_struct_sdna(srna, "bNodeSocket");
11655 
11656  RNA_def_struct_sdna_from(srna, "bNodeSocketValueTexture", "default_value");
11657 
11658  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11659  RNA_def_property_pointer_sdna(prop, NULL, "value");
11660  RNA_def_property_struct_type(prop, "Texture");
11661  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11663  prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update");
11666 
11667  /* socket interface */
11668  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11669  RNA_def_struct_ui_text(srna, "Texture Node Socket Interface", "Texture socket of a node");
11670  RNA_def_struct_sdna(srna, "bNodeSocket");
11671 
11672  RNA_def_struct_sdna_from(srna, "bNodeSocketValueTexture", "default_value");
11673 
11674  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11675  RNA_def_property_pointer_sdna(prop, NULL, "value");
11676  RNA_def_property_struct_type(prop, "Texture");
11677  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11678  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11681 }
11682 
11684  const char *identifier,
11685  const char *interface_idname)
11686 {
11687  StructRNA *srna;
11688  PropertyRNA *prop;
11689 
11690  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
11691  RNA_def_struct_ui_text(srna, "Material Node Socket", "Material socket of a node");
11692  RNA_def_struct_sdna(srna, "bNodeSocket");
11693 
11694  RNA_def_struct_sdna_from(srna, "bNodeSocketValueMaterial", "default_value");
11695 
11696  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11697  RNA_def_property_pointer_sdna(prop, NULL, "value");
11698  RNA_def_property_struct_type(prop, "Material");
11700  prop, NULL, NULL, NULL, "rna_NodeSocketMaterial_default_value_poll");
11701  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11703  prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update");
11706 
11707  /* socket interface */
11708  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
11709  RNA_def_struct_ui_text(srna, "Material Node Socket Interface", "Material socket of a node");
11710  RNA_def_struct_sdna(srna, "bNodeSocket");
11711 
11712  RNA_def_struct_sdna_from(srna, "bNodeSocketValueMaterial", "default_value");
11713 
11714  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
11715  RNA_def_property_pointer_sdna(prop, NULL, "value");
11716  RNA_def_property_struct_type(prop, "Material");
11718  prop, NULL, NULL, NULL, "rna_NodeSocketMaterial_default_value_poll");
11719  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
11720  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
11723 }
11724 
11726 {
11727  /* XXX Workaround: Registered functions are not exposed in python by bpy,
11728  * it expects them to be registered from python and use the native implementation.
11729  * However, the standard socket types below are not registering these functions from python,
11730  * so in order to call them in py scripts we need to overload and
11731  * replace them with plain C callbacks.
11732  * These types provide a usable basis for socket types defined in C.
11733  */
11734 
11735  StructRNA *srna;
11736  PropertyRNA *parm, *prop;
11737  FunctionRNA *func;
11738 
11739  static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
11740 
11741  srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket");
11742  RNA_def_struct_sdna(srna, "bNodeSocket");
11743 
11744  /* draw socket */
11745  func = RNA_def_function(srna, "draw", "rna_NodeSocketStandard_draw");
11747  RNA_def_function_ui_description(func, "Draw socket");
11748  parm = RNA_def_pointer(func, "context", "Context", "", "");
11750  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
11751  RNA_def_property_struct_type(parm, "UILayout");
11752  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
11754  parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
11755  RNA_def_property_struct_type(parm, "Node");
11756  RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
11758  parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
11759  RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
11760  // RNA_def_property_string_default(parm, "");
11762 
11763  func = RNA_def_function(srna, "draw_color", "rna_NodeSocketStandard_draw_color");
11765  RNA_def_function_ui_description(func, "Color of the socket icon");
11766  parm = RNA_def_pointer(func, "context", "Context", "", "");
11768  parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
11769  RNA_def_property_struct_type(parm, "Node");
11770  RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
11772  parm = RNA_def_float_array(
11773  func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
11774  RNA_def_function_output(func, parm);
11775 
11776  srna = RNA_def_struct(brna, "NodeSocketInterfaceStandard", "NodeSocketInterface");
11777  RNA_def_struct_sdna(srna, "bNodeSocket");
11778 
11779  /* for easier type comparison in python */
11780  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
11781  RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type");
11785  RNA_def_property_ui_text(prop, "Type", "Data type");
11786 
11787  func = RNA_def_function(srna, "draw", "rna_NodeSocketInterfaceStandard_draw");
11789  RNA_def_function_ui_description(func, "Draw template settings");
11790  parm = RNA_def_pointer(func, "context", "Context", "", "");
11792  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
11793  RNA_def_property_struct_type(parm, "UILayout");
11794  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
11796 
11797  func = RNA_def_function(srna, "draw_color", "rna_NodeSocketInterfaceStandard_draw_color");
11799  RNA_def_function_ui_description(func, "Color of the socket icon");
11800  parm = RNA_def_pointer(func, "context", "Context", "", "");
11802  parm = RNA_def_float_array(
11803  func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
11804  RNA_def_function_output(func, parm);
11805 
11806  /* XXX These types should eventually be registered at runtime.
11807  * Then use the nodeStaticSocketType and nodeStaticSocketInterfaceType functions
11808  * to get the idname strings from int type and subtype
11809  * (see node_socket.cc, register_standard_node_socket_types).
11810  */
11811 
11812  rna_def_node_socket_float(brna, "NodeSocketFloat", "NodeSocketInterfaceFloat", PROP_NONE);
11814  brna, "NodeSocketFloatUnsigned", "NodeSocketInterfaceFloatUnsigned", PROP_UNSIGNED);
11816  brna, "NodeSocketFloatPercentage", "NodeSocketInterfaceFloatPercentage", PROP_PERCENTAGE);
11818  brna, "NodeSocketFloatFactor", "NodeSocketInterfaceFloatFactor", PROP_FACTOR);
11820  brna, "NodeSocketFloatAngle", "NodeSocketInterfaceFloatAngle", PROP_ANGLE);
11822  brna, "NodeSocketFloatTime", "NodeSocketInterfaceFloatTime", PROP_TIME);
11824  "NodeSocketFloatTimeAbsolute",
11825  "NodeSocketInterfaceFloatTimeAbsolute",
11828  brna, "NodeSocketFloatDistance", "NodeSocketInterfaceFloatDistance", PROP_DISTANCE);
11829 
11830  rna_def_node_socket_int(brna, "NodeSocketInt", "NodeSocketInterfaceInt", PROP_NONE);
11832  brna, "NodeSocketIntUnsigned", "NodeSocketInterfaceIntUnsigned", PROP_UNSIGNED);
11834  brna, "NodeSocketIntPercentage", "NodeSocketInterfaceIntPercentage", PROP_PERCENTAGE);
11836  brna, "NodeSocketIntFactor", "NodeSocketInterfaceIntFactor", PROP_FACTOR);
11837 
11838  rna_def_node_socket_bool(brna, "NodeSocketBool", "NodeSocketInterfaceBool");
11839 
11840  rna_def_node_socket_vector(brna, "NodeSocketVector", "NodeSocketInterfaceVector", PROP_NONE);
11842  "NodeSocketVectorTranslation",
11843  "NodeSocketInterfaceVectorTranslation",
11846  brna, "NodeSocketVectorDirection", "NodeSocketInterfaceVectorDirection", PROP_DIRECTION);
11848  brna, "NodeSocketVectorVelocity", "NodeSocketInterfaceVectorVelocity", PROP_VELOCITY);
11850  "NodeSocketVectorAcceleration",
11851  "NodeSocketInterfaceVectorAcceleration",
11854  brna, "NodeSocketVectorEuler", "NodeSocketInterfaceVectorEuler", PROP_EULER);
11856  brna, "NodeSocketVectorXYZ", "NodeSocketInterfaceVectorXYZ", PROP_XYZ);
11857 
11858  rna_def_node_socket_color(brna, "NodeSocketColor", "NodeSocketInterfaceColor");
11859 
11860  rna_def_node_socket_string(brna, "NodeSocketString", "NodeSocketInterfaceString");
11861 
11862  rna_def_node_socket_shader(brna, "NodeSocketShader", "NodeSocketInterfaceShader");
11863 
11864  rna_def_node_socket_virtual(brna, "NodeSocketVirtual");
11865 
11866  rna_def_node_socket_object(brna, "NodeSocketObject", "NodeSocketInterfaceObject");
11867 
11868  rna_def_node_socket_image(brna, "NodeSocketImage", "NodeSocketInterfaceImage");
11869 
11870  rna_def_node_socket_geometry(brna, "NodeSocketGeometry", "NodeSocketInterfaceGeometry");
11871 
11872  rna_def_node_socket_collection(brna, "NodeSocketCollection", "NodeSocketInterfaceCollection");
11873 
11874  rna_def_node_socket_texture(brna, "NodeSocketTexture", "NodeSocketInterfaceTexture");
11875 
11876  rna_def_node_socket_material(brna, "NodeSocketMaterial", "NodeSocketInterfaceMaterial");
11877 }
11878 
11880 {
11881  StructRNA *srna;
11882  PropertyRNA *prop, *parm;
11883  FunctionRNA *func;
11884 
11885  srna = RNA_def_struct(brna, "NodeInternalSocketTemplate", NULL);
11886  RNA_def_struct_ui_text(srna, "Socket Template", "Type and default value of a node socket");
11887 
11888  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
11890  "rna_NodeInternalSocketTemplate_name_get",
11891  "rna_NodeInternalSocketTemplate_name_length",
11892  NULL);
11893  RNA_def_property_ui_text(prop, "Name", "Name of the socket");
11895 
11896  prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
11898  "rna_NodeInternalSocketTemplate_identifier_get",
11899  "rna_NodeInternalSocketTemplate_identifier_length",
11900  NULL);
11901  RNA_def_property_ui_text(prop, "Identifier", "Identifier of the socket");
11903 
11904  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
11905  RNA_def_property_enum_funcs(prop, "rna_NodeInternalSocketTemplate_type_get", NULL, NULL);
11907  RNA_def_property_ui_text(prop, "Type", "Data type of the socket");
11909 
11910  /* XXX Workaround: Registered functions are not exposed in python by bpy,
11911  * it expects them to be registered from python and use the native implementation.
11912  *
11913  * However, the standard node types are not registering these functions from python,
11914  * so in order to call them in py scripts we need to overload and
11915  * replace them with plain C callbacks.
11916  * This type provides a usable basis for node types defined in C.
11917  */
11918 
11919  srna = RNA_def_struct(brna, "NodeInternal", "Node");
11920  RNA_def_struct_sdna(srna, "bNode");
11921 
11922  /* poll */
11923  func = RNA_def_function(srna, "poll", "rna_NodeInternal_poll");
11925  func, "If non-null output is returned, the node type can be added to the tree");
11927  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
11928  parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
11930 
11931  func = RNA_def_function(srna, "poll_instance", "rna_NodeInternal_poll_instance");
11933  func, "If non-null output is returned, the node can be added to the tree");
11934  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
11935  parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
11937 
11938  /* update */
11939  func = RNA_def_function(srna, "update", "rna_NodeInternal_update");
11941  func, "Update on node graph topology changes (adding or removing nodes and links)");
11943 
11944  /* draw buttons */
11945  func = RNA_def_function(srna, "draw_buttons", "rna_NodeInternal_draw_buttons");
11946  RNA_def_function_ui_description(func, "Draw node buttons");
11948  parm = RNA_def_pointer(func, "context", "Context", "", "");
11950  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
11951  RNA_def_property_struct_type(parm, "UILayout");
11952  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
11954 
11955  /* draw buttons extended */
11956  func = RNA_def_function(srna, "draw_buttons_ext", "rna_NodeInternal_draw_buttons_ext");
11957  RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
11959  parm = RNA_def_pointer(func, "context", "Context", "", "");
11961  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
11962  RNA_def_property_struct_type(parm, "UILayout");
11963  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
11965 }
11966 
11967 static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
11968 {
11969  StructRNA *srna;
11970  PropertyRNA *parm;
11971  FunctionRNA *func;
11972  const char *structtype = (in_out == SOCK_IN ? "NodeInputs" : "NodeOutputs");
11973  const char *uiname = (in_out == SOCK_IN ? "Node Inputs" : "Node Outputs");
11974  const char *newfunc = (in_out == SOCK_IN ? "rna_Node_inputs_new" : "rna_Node_outputs_new");
11975  const char *clearfunc = (in_out == SOCK_IN ? "rna_Node_inputs_clear" : "rna_Node_outputs_clear");
11976  const char *movefunc = (in_out == SOCK_IN ? "rna_Node_inputs_move" : "rna_Node_outputs_move");
11977 
11978  RNA_def_property_srna(cprop, structtype);
11979  srna = RNA_def_struct(brna, structtype, NULL);
11980  RNA_def_struct_sdna(srna, "bNode");
11981  RNA_def_struct_ui_text(srna, uiname, "Collection of Node Sockets");
11982 
11983  func = RNA_def_function(srna, "new", newfunc);
11984  RNA_def_function_ui_description(func, "Add a socket to this node");
11986  parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
11988  parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
11990  RNA_def_string(func, "identifier", NULL, MAX_NAME, "Identifier", "Unique socket identifier");
11991  /* return value */
11992  parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
11993  RNA_def_function_return(func, parm);
11994 
11995  func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
11996  RNA_def_function_ui_description(func, "Remove a socket from this node");
11998  parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
12000 
12001  func = RNA_def_function(srna, "clear", clearfunc);
12002  RNA_def_function_ui_description(func, "Remove all sockets from this node");
12004 
12005  func = RNA_def_function(srna, "move", movefunc);
12006  RNA_def_function_ui_description(func, "Move a socket to another position");
12008  parm = RNA_def_int(
12009  func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
12011  parm = RNA_def_int(
12012  func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
12014 }
12015 
12016 static void rna_def_node(BlenderRNA *brna)
12017 {
12018  StructRNA *srna;
12019  PropertyRNA *prop;
12020  FunctionRNA *func;
12021  PropertyRNA *parm;
12022 
12023  static const EnumPropertyItem dummy_static_type_items[] = {
12024  {NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"},
12025  {0, NULL, 0, NULL, NULL},
12026  };
12027 
12028  srna = RNA_def_struct(brna, "Node", NULL);
12029  RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
12030  RNA_def_struct_sdna(srna, "bNode");
12031  RNA_def_struct_ui_icon(srna, ICON_NODE);
12032  RNA_def_struct_refine_func(srna, "rna_Node_refine");
12033  RNA_def_struct_path_func(srna, "rna_Node_path");
12034  RNA_def_struct_register_funcs(srna, "rna_Node_register", "rna_Node_unregister", NULL);
12035  RNA_def_struct_idprops_func(srna, "rna_Node_idprops");
12036 
12037  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
12038  RNA_def_property_enum_sdna(prop, NULL, "type");
12039  RNA_def_property_enum_items(prop, dummy_static_type_items);
12040  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_node_static_type_itemf");
12044  prop,
12045  "Type",
12046  "Node type (deprecated, use bl_static_type or bl_idname for the actual identifier string)");
12047 
12048  prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
12049  RNA_def_property_float_sdna(prop, NULL, "locx");
12050  RNA_def_property_array(prop, 2);
12051  RNA_def_property_range(prop, -100000.0f, 100000.0f);
12052  RNA_def_property_ui_text(prop, "Location", "");
12053  RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
12054 
12055  prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_XYZ);
12056  RNA_def_property_float_sdna(prop, NULL, "width");
12057  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
12058  RNA_def_property_ui_text(prop, "Width", "Width of the node");
12060 
12061  prop = RNA_def_property(srna, "width_hidden", PROP_FLOAT, PROP_XYZ);
12062  RNA_def_property_float_sdna(prop, NULL, "miniwidth");
12063  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
12064  RNA_def_property_ui_text(prop, "Width Hidden", "Width of the node in hidden state");
12066 
12067  prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_XYZ);
12068  RNA_def_property_float_sdna(prop, NULL, "height");
12069  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_height_range");
12070  RNA_def_property_ui_text(prop, "Height", "Height of the node");
12072 
12073  prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
12074  RNA_def_property_array(prop, 2);
12075  RNA_def_property_float_funcs(prop, "rna_Node_dimensions_get", NULL, NULL);
12076  RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the node");
12078 
12079  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
12080  RNA_def_property_ui_text(prop, "Name", "Unique node identifier");
12081  RNA_def_struct_name_property(srna, prop);
12082  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set");
12083  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
12084 
12085  prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
12086  RNA_def_property_string_sdna(prop, NULL, "label");
12087  RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
12089 
12090  prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
12091  RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
12092  RNA_def_property_struct_type(prop, "NodeSocket");
12094  RNA_def_property_ui_text(prop, "Inputs", "");
12095  rna_def_node_sockets_api(brna, prop, SOCK_IN);
12096 
12097  prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
12098  RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
12099  RNA_def_property_struct_type(prop, "NodeSocket");
12101  RNA_def_property_ui_text(prop, "Outputs", "");
12102  rna_def_node_sockets_api(brna, prop, SOCK_OUT);
12103 
12104  prop = RNA_def_property(srna, "internal_links", PROP_COLLECTION, PROP_NONE);
12105  RNA_def_property_collection_sdna(prop, NULL, "internal_links", NULL);
12106  RNA_def_property_struct_type(prop, "NodeLink");
12108  prop, "Internal Links", "Internal input-to-output connections for muting");
12109 
12110  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
12111  RNA_def_property_pointer_sdna(prop, NULL, "parent");
12112  RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_parent_set", NULL, "rna_Node_parent_poll");
12116  RNA_def_property_struct_type(prop, "Node");
12117  RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to");
12118 
12119  prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
12122  RNA_def_property_ui_text(prop, "Custom Color", "Use custom color for the node");
12124 
12125  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
12126  RNA_def_property_array(prop, 3);
12127  RNA_def_property_range(prop, 0.0f, 1.0f);
12128  RNA_def_property_ui_text(prop, "Color", "Custom color of the node body");
12130 
12131  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
12132  RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
12133  RNA_def_property_boolean_funcs(prop, NULL, "rna_Node_select_set");
12134  RNA_def_property_ui_text(prop, "Select", "Node selection state");
12136 
12137  prop = RNA_def_property(srna, "show_options", PROP_BOOLEAN, PROP_NONE);
12139  RNA_def_property_ui_text(prop, "Show Options", "");
12141 
12142  prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
12144  RNA_def_property_ui_text(prop, "Show Preview", "");
12146 
12147  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
12149  RNA_def_property_ui_text(prop, "Hide", "");
12151 
12152  prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
12154  RNA_def_property_ui_text(prop, "Mute", "");
12155  RNA_def_property_update(prop, 0, "rna_Node_update");
12156 
12157  prop = RNA_def_property(srna, "show_texture", PROP_BOOLEAN, PROP_NONE);
12159  RNA_def_property_ui_text(prop, "Show Texture", "Display node in viewport textured shading mode");
12160  RNA_def_property_update(prop, 0, "rna_Node_update");
12161 
12162  /* generic property update function */
12163  func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update");
12164  RNA_def_function_ui_description(func, "Update after property changes");
12166  parm = RNA_def_pointer(func, "context", "Context", "", "");
12168 
12169  func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
12170  RNA_def_function_ui_description(func, "True if a registered node type");
12172  parm = RNA_def_boolean(func, "result", false, "Result", "");
12173  RNA_def_function_return(func, parm);
12174 
12175  /* registration */
12176  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
12177  RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
12179  RNA_def_property_ui_text(prop, "ID Name", "");
12180 
12181  prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
12182  RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name");
12184  RNA_def_property_ui_text(prop, "Label", "The node label");
12185 
12186  prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
12187  RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_description");
12189 
12190  prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
12191  RNA_def_property_enum_sdna(prop, NULL, "typeinfo->ui_icon");
12193  RNA_def_property_enum_default(prop, ICON_NODE);
12195  RNA_def_property_ui_text(prop, "Icon", "The node icon");
12196 
12197  prop = RNA_def_property(srna, "bl_static_type", PROP_ENUM, PROP_NONE);
12198  RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type");
12199  RNA_def_property_enum_items(prop, dummy_static_type_items);
12200  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_node_static_type_itemf");
12203  RNA_def_property_ui_text(prop, "Static Type", "Node type (deprecated, use with care)");
12204 
12205  /* type-based size properties */
12206  prop = RNA_def_property(srna, "bl_width_default", PROP_FLOAT, PROP_UNSIGNED);
12207  RNA_def_property_float_sdna(prop, NULL, "typeinfo->width");
12209 
12210  prop = RNA_def_property(srna, "bl_width_min", PROP_FLOAT, PROP_UNSIGNED);
12211  RNA_def_property_float_sdna(prop, NULL, "typeinfo->minwidth");
12213 
12214  prop = RNA_def_property(srna, "bl_width_max", PROP_FLOAT, PROP_UNSIGNED);
12215  RNA_def_property_float_sdna(prop, NULL, "typeinfo->maxwidth");
12217 
12218  prop = RNA_def_property(srna, "bl_height_default", PROP_FLOAT, PROP_UNSIGNED);
12219  RNA_def_property_float_sdna(prop, NULL, "typeinfo->height");
12221 
12222  prop = RNA_def_property(srna, "bl_height_min", PROP_FLOAT, PROP_UNSIGNED);
12223  RNA_def_property_float_sdna(prop, NULL, "typeinfo->minheight");
12225 
12226  prop = RNA_def_property(srna, "bl_height_max", PROP_FLOAT, PROP_UNSIGNED);
12227  RNA_def_property_float_sdna(prop, NULL, "typeinfo->minheight");
12229 
12230  /* poll */
12231  func = RNA_def_function(srna, "poll", NULL);
12233  func, "If non-null output is returned, the node type can be added to the tree");
12235  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
12236  parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
12238 
12239  func = RNA_def_function(srna, "poll_instance", NULL);
12241  func, "If non-null output is returned, the node can be added to the tree");
12243  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
12244  parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
12246 
12247  /* update */
12248  func = RNA_def_function(srna, "update", NULL);
12250  func, "Update on node graph topology changes (adding or removing nodes and links)");
12252 
12253  /* insert_link */
12254  func = RNA_def_function(srna, "insert_link", NULL);
12255  RNA_def_function_ui_description(func, "Handle creation of a link to or from the node");
12257  parm = RNA_def_pointer(func, "link", "NodeLink", "Link", "Node link that will be inserted");
12259 
12260  /* init */
12261  func = RNA_def_function(srna, "init", NULL);
12262  RNA_def_function_ui_description(func, "Initialize a new instance of this node");
12264  parm = RNA_def_pointer(func, "context", "Context", "", "");
12266 
12267  /* copy */
12268  func = RNA_def_function(srna, "copy", NULL);
12270  "Initialize a new instance of this node from an existing node");
12272  parm = RNA_def_pointer(func, "node", "Node", "Node", "Existing node to copy");
12274 
12275  /* free */
12276  func = RNA_def_function(srna, "free", NULL);
12277  RNA_def_function_ui_description(func, "Clean up node on removal");
12279 
12280  /* draw buttons */
12281  func = RNA_def_function(srna, "draw_buttons", NULL);
12282  RNA_def_function_ui_description(func, "Draw node buttons");
12284  parm = RNA_def_pointer(func, "context", "Context", "", "");
12286  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
12287  RNA_def_property_struct_type(parm, "UILayout");
12288  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
12290 
12291  /* draw buttons extended */
12292  func = RNA_def_function(srna, "draw_buttons_ext", NULL);
12293  RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
12295  parm = RNA_def_pointer(func, "context", "Context", "", "");
12297  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
12298  RNA_def_property_struct_type(parm, "UILayout");
12299  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
12301 
12302  /* dynamic label */
12303  func = RNA_def_function(srna, "draw_label", NULL);
12304  RNA_def_function_ui_description(func, "Returns a dynamic label string");
12306  parm = RNA_def_string(func, "label", NULL, MAX_NAME, "Label", "");
12307  RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
12308  RNA_def_function_output(func, parm);
12309 }
12310 
12311 static void rna_def_node_link(BlenderRNA *brna)
12312 {
12313  StructRNA *srna;
12314  PropertyRNA *prop;
12315 
12316  srna = RNA_def_struct(brna, "NodeLink", NULL);
12317  RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree");
12318  RNA_def_struct_sdna(srna, "bNodeLink");
12319  RNA_def_struct_ui_icon(srna, ICON_NODE);
12320 
12321  prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
12323  RNA_def_property_ui_text(prop, "Valid", "Link is valid");
12325 
12326  prop = RNA_def_property(srna, "is_muted", PROP_BOOLEAN, PROP_NONE);
12328  RNA_def_property_ui_text(prop, "Muted", "Link is muted and can be ignored");
12330 
12331  prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE);
12332  RNA_def_property_pointer_sdna(prop, NULL, "fromnode");
12333  RNA_def_property_struct_type(prop, "Node");
12337  RNA_def_property_ui_text(prop, "From node", "");
12338 
12339  prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE);
12340  RNA_def_property_pointer_sdna(prop, NULL, "tonode");
12341  RNA_def_property_struct_type(prop, "Node");
12345  RNA_def_property_ui_text(prop, "To node", "");
12346 
12347  prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE);
12348  RNA_def_property_pointer_sdna(prop, NULL, "fromsock");
12349  RNA_def_property_struct_type(prop, "NodeSocket");
12353  RNA_def_property_ui_text(prop, "From socket", "");
12354 
12355  prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE);
12356  RNA_def_property_pointer_sdna(prop, NULL, "tosock");
12357  RNA_def_property_struct_type(prop, "NodeSocket");
12361  RNA_def_property_ui_text(prop, "To socket", "");
12362 
12363  prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
12364  RNA_def_property_boolean_funcs(prop, "rna_NodeLink_is_hidden_get", NULL);
12368  RNA_def_property_ui_text(prop, "Is Hidden", "Link is hidden due to invisible sockets");
12369 }
12370 
12372 {
12373  StructRNA *srna;
12374  PropertyRNA *parm, *prop;
12375  FunctionRNA *func;
12376 
12377  RNA_def_property_srna(cprop, "Nodes");
12378  srna = RNA_def_struct(brna, "Nodes", NULL);
12379  RNA_def_struct_sdna(srna, "bNodeTree");
12380  RNA_def_struct_ui_text(srna, "Nodes", "Collection of Nodes");
12381 
12382  func = RNA_def_function(srna, "new", "rna_NodeTree_node_new");
12383  RNA_def_function_ui_description(func, "Add a node to this node tree");
12385  /* XXX warning note should eventually be removed,
12386  * added this here to avoid frequent confusion with API changes from "type" to "bl_idname"
12387  */
12388  parm = RNA_def_string(
12389  func,
12390  "type",
12391  NULL,
12392  MAX_NAME,
12393  "Type",
12394  "Type of node to add (Warning: should be same as node.bl_idname, not node.type!)");
12396  /* return value */
12397  parm = RNA_def_pointer(func, "node", "Node", "", "New node");
12398  RNA_def_function_return(func, parm);
12399 
12400  func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
12401  RNA_def_function_ui_description(func, "Remove a node from this node tree");
12403  parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
12406 
12407  func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
12408  RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
12410 
12411  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
12412  RNA_def_property_struct_type(prop, "Node");
12414  prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", NULL, NULL);
12416  RNA_def_property_ui_text(prop, "Active Node", "Active node in this tree");
12417  RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, "rna_NodeTree_update");
12418 }
12419 
12421 {
12422  StructRNA *srna;
12423  PropertyRNA *parm;
12424  FunctionRNA *func;
12425 
12426  RNA_def_property_srna(cprop, "NodeLinks");
12427  srna = RNA_def_struct(brna, "NodeLinks", NULL);
12428  RNA_def_struct_sdna(srna, "bNodeTree");
12429  RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links");
12430 
12431  func = RNA_def_function(srna, "new", "rna_NodeTree_link_new");
12432  RNA_def_function_ui_description(func, "Add a node link to this node tree");
12434  parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
12436  parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
12438  RNA_def_boolean(func,
12439  "verify_limits",
12440  true,
12441  "Verify Limits",
12442  "Remove existing links if connection limit is exceeded");
12443  /* return */
12444  parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link");
12445  RNA_def_function_return(func, parm);
12446 
12447  func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
12448  RNA_def_function_ui_description(func, "remove a node link from the node tree");
12450  parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
12453 
12454  func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
12455  RNA_def_function_ui_description(func, "remove all node links from the node tree");
12457 }
12458 
12459 static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
12460 {
12461  StructRNA *srna;
12462  PropertyRNA *parm;
12463  FunctionRNA *func;
12464  const char *structtype = (in_out == SOCK_IN ? "NodeTreeInputs" : "NodeTreeOutputs");
12465  const char *uiname = (in_out == SOCK_IN ? "Node Tree Inputs" : "Node Tree Outputs");
12466  const char *newfunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_new" :
12467  "rna_NodeTree_outputs_new");
12468  const char *clearfunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_clear" :
12469  "rna_NodeTree_outputs_clear");
12470  const char *movefunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_move" :
12471  "rna_NodeTree_outputs_move");
12472 
12473  RNA_def_property_srna(cprop, structtype);
12474  srna = RNA_def_struct(brna, structtype, NULL);
12475  RNA_def_struct_sdna(srna, "bNodeTree");
12476  RNA_def_struct_ui_text(srna, uiname, "Collection of Node Tree Sockets");
12477 
12478  func = RNA_def_function(srna, "new", newfunc);
12479  RNA_def_function_ui_description(func, "Add a socket to this node tree");
12481  parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
12483  parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
12485  /* return value */
12486  parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "New socket");
12487  RNA_def_function_return(func, parm);
12488 
12489  func = RNA_def_function(srna, "remove", "rna_NodeTree_socket_remove");
12490  RNA_def_function_ui_description(func, "Remove a socket from this node tree");
12492  parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "The socket to remove");
12494 
12495  func = RNA_def_function(srna, "clear", clearfunc);
12496  RNA_def_function_ui_description(func, "Remove all sockets from this node tree");
12498 
12499  func = RNA_def_function(srna, "move", movefunc);
12500  RNA_def_function_ui_description(func, "Move a socket to another position");
12502  parm = RNA_def_int(
12503  func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
12505  parm = RNA_def_int(
12506  func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
12508 }
12509 
12510 static void rna_def_nodetree(BlenderRNA *brna)
12511 {
12512  StructRNA *srna;
12513  PropertyRNA *prop;
12514  FunctionRNA *func;
12515  PropertyRNA *parm;
12516 
12517  static const EnumPropertyItem static_type_items[] = {
12518  {NTREE_UNDEFINED,
12519  "UNDEFINED",
12520  ICON_QUESTION,
12521  "Undefined",
12522  "Undefined type of nodes (can happen e.g. when a linked node tree goes missing)"},
12523  {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
12524  {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
12525  {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
12526  {NTREE_GEOMETRY, "GEOMETRY", ICON_GEOMETRY_NODES, "Geometry", "Geometry nodes"},
12527  {0, NULL, 0, NULL, NULL},
12528  };
12529 
12530  srna = RNA_def_struct(brna, "NodeTree", "ID");
12532  srna,
12533  "Node Tree",
12534  "Node tree consisting of linked nodes used for shading, textures and compositing");
12535  RNA_def_struct_sdna(srna, "bNodeTree");
12536  RNA_def_struct_ui_icon(srna, ICON_NODETREE);
12537  RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
12538  RNA_def_struct_register_funcs(srna, "rna_NodeTree_register", "rna_NodeTree_unregister", NULL);
12539 
12540  prop = RNA_def_property(srna, "view_center", PROP_FLOAT, PROP_XYZ);
12541  RNA_def_property_array(prop, 2);
12542  RNA_def_property_float_sdna(prop, NULL, "view_center");
12544  prop, "", "The current location (offset) of the view for this Node Tree");
12546 
12547  /* AnimData */
12549 
12550  /* Nodes Collection */
12551  prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
12552  RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
12553  RNA_def_property_struct_type(prop, "Node");
12555  RNA_def_property_ui_text(prop, "Nodes", "");
12556  rna_def_nodetree_nodes_api(brna, prop);
12557 
12558  /* NodeLinks Collection */
12559  prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE);
12560  RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
12561  RNA_def_property_struct_type(prop, "NodeLink");
12562  RNA_def_property_ui_text(prop, "Links", "");
12563  rna_def_nodetree_link_api(brna, prop);
12564 
12565  /* Grease Pencil */
12566  prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
12567  RNA_def_property_pointer_sdna(prop, NULL, "gpd");
12568  RNA_def_property_struct_type(prop, "GreasePencil");
12570  prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
12573  RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block");
12575 
12576  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
12578  RNA_def_property_enum_items(prop, static_type_items);
12580  prop,
12581  "Type",
12582  "Node Tree type (deprecated, bl_idname is the actual node tree type identifier)");
12583 
12584  prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
12585  RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
12586  RNA_def_property_struct_type(prop, "NodeSocketInterface");
12588  RNA_def_property_ui_text(prop, "Inputs", "Node tree inputs");
12590 
12591  prop = RNA_def_property(srna, "active_input", PROP_INT, PROP_UNSIGNED);
12593  prop, "rna_NodeTree_active_input_get", "rna_NodeTree_active_input_set", NULL);
12594  RNA_def_property_ui_text(prop, "Active Input", "Index of the active input");
12597 
12598  prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
12599  RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
12600  RNA_def_property_struct_type(prop, "NodeSocketInterface");
12602  RNA_def_property_ui_text(prop, "Outputs", "Node tree outputs");
12604 
12605  prop = RNA_def_property(srna, "active_output", PROP_INT, PROP_UNSIGNED);
12607  prop, "rna_NodeTree_active_output_get", "rna_NodeTree_active_output_set", NULL);
12608  RNA_def_property_ui_text(prop, "Active Output", "Index of the active output");
12611 
12612  /* exposed as a function for runtime interface type properties */
12613  func = RNA_def_function(srna, "interface_update", "rna_NodeTree_interface_update");
12614  RNA_def_function_ui_description(func, "Updated node group interface");
12615  parm = RNA_def_pointer(func, "context", "Context", "", "");
12617 
12618  /* registration */
12619  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
12620  RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
12622  RNA_def_property_ui_text(prop, "ID Name", "");
12623 
12624  prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
12625  RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name");
12627  RNA_def_property_ui_text(prop, "Label", "The node tree label");
12628 
12629  prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
12630  RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_description");
12632 
12633  prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
12634  RNA_def_property_enum_sdna(prop, NULL, "typeinfo->ui_icon");
12636  RNA_def_property_enum_default(prop, ICON_NODETREE);
12638  RNA_def_property_ui_text(prop, "Icon", "The node tree icon");
12639 
12640  /* poll */
12641  func = RNA_def_function(srna, "poll", NULL);
12642  RNA_def_function_ui_description(func, "Check visibility in the editor");
12644  parm = RNA_def_pointer(func, "context", "Context", "", "");
12646  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
12647 
12648  /* update */
12649  func = RNA_def_function(srna, "update", NULL);
12650  RNA_def_function_ui_description(func, "Update on editor changes");
12652 
12653  /* get a node tree from context */
12654  func = RNA_def_function(srna, "get_from_context", NULL);
12655  RNA_def_function_ui_description(func, "Get a node tree from the context");
12657  parm = RNA_def_pointer(func, "context", "Context", "", "");
12659  parm = RNA_def_pointer(
12660  func, "result_1", "NodeTree", "Node Tree", "Active node tree from context");
12661  RNA_def_function_output(func, parm);
12662  parm = RNA_def_pointer(
12663  func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree");
12664  RNA_def_function_output(func, parm);
12665  parm = RNA_def_pointer(
12666  func, "result_3", "ID", "From ID", "Original ID data-block selected from the context");
12667  RNA_def_function_output(func, parm);
12668 
12669  /* Check for support of a socket type with a type identifier. */
12670  func = RNA_def_function(srna, "valid_socket_type", NULL);
12671  RNA_def_function_ui_description(func, "Check if the socket type is valid for the node tree");
12673  parm = RNA_def_string(
12674  func, "idname", "NodeSocket", MAX_NAME, "Socket Type", "Identifier of the socket type");
12676  RNA_def_function_return(func, RNA_def_boolean(func, "valid", false, "", ""));
12677 }
12678 
12680 {
12681  StructRNA *srna;
12682  PropertyRNA *prop;
12683 
12684  srna = RNA_def_struct(brna, "CompositorNodeTree", "NodeTree");
12686  srna, "Compositor Node Tree", "Node tree consisting of linked nodes used for compositing");
12687  RNA_def_struct_sdna(srna, "bNodeTree");
12688  RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
12689 
12690  prop = RNA_def_property(srna, "execution_mode", PROP_ENUM, PROP_NONE);
12691  RNA_def_property_enum_sdna(prop, NULL, "execution_mode");
12693  RNA_def_property_ui_text(prop, "Execution Mode", "Set how compositing is executed");
12694  RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update");
12695 
12696  prop = RNA_def_property(srna, "render_quality", PROP_ENUM, PROP_NONE);
12697  RNA_def_property_enum_sdna(prop, NULL, "render_quality");
12699  RNA_def_property_ui_text(prop, "Render Quality", "Quality when rendering");
12700 
12701  prop = RNA_def_property(srna, "edit_quality", PROP_ENUM, PROP_NONE);
12702  RNA_def_property_enum_sdna(prop, NULL, "edit_quality");
12704  RNA_def_property_ui_text(prop, "Edit Quality", "Quality when editing");
12705 
12706  prop = RNA_def_property(srna, "chunk_size", PROP_ENUM, PROP_NONE);
12707  RNA_def_property_enum_sdna(prop, NULL, "chunksize");
12710  "Chunksize",
12711  "Max size of a tile (smaller values gives better distribution "
12712  "of multiple threads, but more overhead)");
12713 
12714  prop = RNA_def_property(srna, "use_opencl", PROP_BOOLEAN, PROP_NONE);
12716  RNA_def_property_ui_text(prop, "OpenCL", "Enable GPU calculations");
12717 
12718  prop = RNA_def_property(srna, "use_groupnode_buffer", PROP_BOOLEAN, PROP_NONE);
12720  RNA_def_property_ui_text(prop, "Buffer Groups", "Enable buffering of group nodes");
12721 
12722  prop = RNA_def_property(srna, "use_two_pass", PROP_BOOLEAN, PROP_NONE);
12725  "Two Pass",
12726  "Use two pass execution during editing: first calculate fast nodes, "
12727  "second pass calculate all nodes");
12728 
12729  prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE);
12732  prop, "Viewer Region", "Use boundaries for viewer nodes and composite backdrop");
12733  RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update");
12734 }
12735 
12737 {
12738  StructRNA *srna;
12739  FunctionRNA *func;
12740  PropertyRNA *parm;
12741 
12742  srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
12744  srna,
12745  "Shader Node Tree",
12746  "Node tree consisting of linked nodes used for materials (and other shading data-blocks)");
12747  RNA_def_struct_sdna(srna, "bNodeTree");
12748  RNA_def_struct_ui_icon(srna, ICON_MATERIAL);
12749 
12750  func = RNA_def_function(srna, "get_output_node", "ntreeShaderOutputNode");
12752  "Return active shader output node for the specified target");
12753  parm = RNA_def_enum(
12754  func, "target", prop_shader_output_target_items, SHD_OUTPUT_ALL, "Target", "");
12756  parm = RNA_def_pointer(func, "node", "ShaderNode", "Node", "");
12757  RNA_def_function_return(func, parm);
12758 }
12759 
12761 {
12762  StructRNA *srna;
12763 
12764  srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree");
12766  srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures");
12767  RNA_def_struct_sdna(srna, "bNodeTree");
12768  RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
12769 }
12770 
12772 {
12773  StructRNA *srna;
12774 
12775  srna = RNA_def_struct(brna, "GeometryNodeTree", "NodeTree");
12777  srna, "Geometry Node Tree", "Node tree consisting of linked nodes used for geometries");
12778  RNA_def_struct_sdna(srna, "bNodeTree");
12779  RNA_def_struct_ui_icon(srna, ICON_NODETREE);
12780 }
12781 
12783  const char *struct_name,
12784  const char *base_name,
12785  const char *ui_name,
12786  const char *ui_desc,
12787  void (*def_func)(StructRNA *))
12788 {
12789  StructRNA *srna;
12790  FunctionRNA *func;
12791  PropertyRNA *parm;
12792 
12793  /* XXX hack, want to avoid "NodeInternal" prefix,
12794  * so use "Node" in NOD_static_types.h and replace here */
12795  if (STREQ(base_name, "Node")) {
12796  base_name = "NodeInternal";
12797  }
12798 
12799  srna = RNA_def_struct(brna, struct_name, base_name);
12800  RNA_def_struct_ui_text(srna, ui_name, ui_desc);
12801  RNA_def_struct_sdna(srna, "bNode");
12802 
12803  func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
12804  RNA_def_function_ui_description(func, "True if a registered node type");
12806  parm = RNA_def_boolean(func, "result", false, "Result", "");
12807  RNA_def_function_return(func, parm);
12808 
12809  /* Exposes the socket template type lists in RNA for use in scripts
12810  * Only used in the C nodes and not exposed in the base class to
12811  * keep the namespace clean for py-nodes. */
12812  func = RNA_def_function(srna, "input_template", "rna_NodeInternal_input_template");
12813  RNA_def_function_ui_description(func, "Input socket template");
12815  parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
12816  RNA_def_property_ui_text(parm, "Index", "");
12818  parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
12819  RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
12821  RNA_def_function_return(func, parm);
12822 
12823  func = RNA_def_function(srna, "output_template", "rna_NodeInternal_output_template");
12824  RNA_def_function_ui_description(func, "Output socket template");
12826  parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
12827  RNA_def_property_ui_text(parm, "Index", "");
12829  parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
12830  RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
12832  RNA_def_function_return(func, parm);
12833 
12834  if (def_func) {
12835  def_func(srna);
12836  }
12837 
12838  return srna;
12839 }
12840 
12842 {
12843  StructRNA *srna;
12844 
12845  srna = RNA_def_struct(brna, "NodeInstanceHash", NULL);
12846  RNA_def_struct_ui_text(srna, "Node Instance Hash", "Hash table containing node instance data");
12847 
12848  /* XXX This type is a stub for now, only used to store instance hash in the context.
12849  * Eventually could use a StructRNA pointer to define a specific data type
12850  * and expose lookup functions.
12851  */
12852 }
12853 
12855 {
12856  StructRNA *srna;
12857 
12858  rna_def_node_socket(brna);
12860 
12861  rna_def_node(brna);
12862  rna_def_node_link(brna);
12863 
12864  rna_def_internal_node(brna);
12865  rna_def_shader_node(brna);
12867  rna_def_texture_node(brna);
12868  rna_def_geometry_node(brna);
12869  rna_def_function_node(brna);
12870 
12871  rna_def_nodetree(brna);
12872 
12874 
12879 
12880 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
12881  { \
12882  srna = define_specific_node( \
12883  brna, #Category #StructName, #Category, UIName, UIDesc, DefFunc); \
12884  if (ID == CMP_NODE_OUTPUT_FILE) { \
12885  /* needs brna argument, can't use NOD_static_types.h */ \
12886  def_cmp_output_file(brna, srna); \
12887  } \
12888  }
12889 
12890  /* hack, don't want to add include path to RNA just for this, since in the future RNA types
12891  * for nodes should be defined locally at runtime anyway ...
12892  */
12893 # include "../../nodes/NOD_static_types.h"
12894 
12895  /* Node group types need to be defined for shader, compositor, texture, geometry nodes
12896  * individually. Cannot use the static types header for this, since they share the same int id.
12897  */
12898  define_specific_node(brna, "ShaderNodeGroup", "ShaderNode", "Group", "", def_group);
12899  define_specific_node(brna, "CompositorNodeGroup", "CompositorNode", "Group", "", def_group);
12900  define_specific_node(brna, "TextureNodeGroup", "TextureNode", "Group", "", def_group);
12901  define_specific_node(brna, "GeometryNodeGroup", "GeometryNode", "Group", "", def_group);
12902  def_custom_group(brna,
12903  "ShaderNodeCustomGroup",
12904  "ShaderNode",
12905  "Shader Custom Group",
12906  "Custom Shader Group Node for Python nodes",
12907  "rna_ShaderNodeCustomGroup_register");
12908  def_custom_group(brna,
12909  "CompositorNodeCustomGroup",
12910  "CompositorNode",
12911  "Compositor Custom Group",
12912  "Custom Compositor Group Node for Python nodes",
12913  "rna_CompositorNodeCustomGroup_register");
12914  def_custom_group(brna,
12915  "NodeCustomGroup",
12916  "Node",
12917  "Custom Group",
12918  "Base node type for custom registered node group types",
12919  "rna_NodeCustomGroup_register");
12920  def_custom_group(brna,
12921  "GeometryNodeCustomGroup",
12922  "GeometryNode",
12923  "Geometry Custom Group",
12924  "Custom Geometry Group Node for Python nodes",
12925  "rna_GeometryNodeCustomGroup_register");
12926 
12927  /* special socket types */
12930 
12932 }
12933 
12934 /* clean up macro definition */
12935 # undef NODE_DEFINE_SUBTYPES
12936 
12937 #endif
void BKE_animdata_fix_paths_rename_all(struct ID *ref_id, const char *prefix, const char *oldName, const char *newName)
Definition: anim_data.c:1287
Generic geometry attributes built on CustomData.
@ ATTR_DOMAIN_CURVE
Definition: BKE_attribute.h:31
@ ATTR_DOMAIN_INSTANCE
Definition: BKE_attribute.h:32
@ ATTR_DOMAIN_POINT
Definition: BKE_attribute.h:27
@ ATTR_DOMAIN_FACE
Definition: BKE_attribute.h:29
@ ATTR_DOMAIN_EDGE
Definition: BKE_attribute.h:28
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
void BKE_cryptomatte_matte_id_to_entries(struct NodeCryptomatte *node_storage, const char *matte_id)
Definition: cryptomatte.cc:234
char * BKE_cryptomatte_entries_to_matte_id(struct NodeCryptomatte *node_storage)
Definition: cryptomatte.cc:213
@ GEO_COMPONENT_TYPE_MESH
struct RenderPass * BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser)
#define IMA_SIGNAL_SRC_CHANGE
Definition: BKE_image.h:132
void BKE_image_signal(struct Main *bmain, struct Image *ima, struct ImageUser *iuser, int signal)
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
const char * BKE_main_blendfile_path_from_global(void)
Definition: main.c:562
#define CMP_SCALE_ABSOLUTE
Definition: BKE_node.h:1317
void ntreeTypeAdd(struct bNodeTreeType *nt)
Definition: node.cc:1292
#define NODE_TYPES_BEGIN(ntype)
Definition: BKE_node.h:567
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:2127
#define CMP_SCALE_SCENEPERCENT
Definition: BKE_node.h:1318
#define NODE_CLASS_OUTPUT
Definition: BKE_node.h:346
const char * nodeSocketTypeLabel(const bNodeSocketType *stype)
Definition: node.cc:1443
#define NODE_UNDEFINED
Definition: BKE_node.h:980
void nodeRegisterSocketType(struct bNodeSocketType *stype)
Definition: node.cc:1419
#define CMP_TRACKPOS_ABSOLUTE_FRAME
Definition: BKE_node.h:1328
#define CMP_CHAN_RGB
Definition: BKE_node.h:1302
void node_type_base_custom(struct bNodeType *ntype, const char *idname, const char *name, short nclass)
Definition: node.cc:4311
bool nodeLinkIsHidden(const struct bNodeLink *link)
bool nodeAttachNodeCheck(const struct bNode *node, const struct bNode *parent)
struct bNodeSocket * nodeAddSocket(struct bNodeTree *ntree, struct bNode *node, eNodeSocketInOut in_out, const char *idname, const char *identifier, const char *name)
Definition: node.cc:1679
bool nodeGroupPoll(struct bNodeTree *nodetree, struct bNodeTree *grouptree, const char **r_disabled_hint)
Definition: node_common.cc:85
#define CMP_SCALE_RENDERSIZE_FRAME_CROP
Definition: BKE_node.h:1322
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock)
Definition: node.cc:2455
#define NODE_CUSTOM_GROUP
Definition: BKE_node.h:989
#define CMP_NODE_CRYPTOMATTE
Definition: BKE_node.h:1292
struct bNodeTreeType * ntreeTypeFind(const char *idname)
Definition: node.cc:1280
#define CMP_TRACKPOS_RELATIVE_START
Definition: BKE_node.h:1326
#define CMP_TRACKPOS_RELATIVE_FRAME
Definition: BKE_node.h:1327
struct StructRNA * ntreeInterfaceTypeGet(struct bNodeTree *ntree, bool create)
Definition: node.cc:3495
#define SH_NODE_TEX_ENVIRONMENT
Definition: BKE_node.h:1128
void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *sock)
Definition: node.cc:3415
#define NODE_CUSTOM
Definition: BKE_node.h:981
void nodeAttachNode(struct bNode *node, struct bNode *parent)
Definition: node.cc:2594
struct bNode * nodeGetActive(struct bNodeTree *ntree)
Definition: node.cc:3601
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link)
Definition: node.cc:2338
#define CMP_SCALE_RENDERSIZE_FRAME_ASPECT
Definition: BKE_node.h:1321
#define CMP_SCALE_RENDERPERCENT
Definition: BKE_node.h:1319
void nodeRemoveNode(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node, bool do_id_user)
Definition: node.cc:3011
#define CMP_SCALE_RELATIVE
Definition: BKE_node.h:1316
void nodeModifySocketTypeStatic(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype)
Definition: node.cc:1666
int nodeSocketLinkLimit(const struct bNodeSocket *sock)
struct bNodeType * nodeTypeFind(const char *idname)
Definition: node.cc:1327
#define CMP_NODE_OUTPUT_FILE
Definition: BKE_node.h:1218
void ntreeSetOutput(struct bNodeTree *ntree)
Definition: node.cc:3141
#define NODE_TREE_TYPES_BEGIN(ntype)
Definition: BKE_node.h:426
struct bNodeLink * nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock)
Definition: node.cc:2296
void nodeClearActive(struct bNodeTree *ntree)
Definition: node.cc:3633
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock)
Definition: node.cc:1933
#define NODE_SOCKET_TYPES_BEGIN(stype)
Definition: BKE_node.h:593
struct bNode * nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname)
Definition: node.cc:2133
void ntreeTypeFreeLink(const struct bNodeTreeType *nt)
bool ntreeIsRegistered(struct bNodeTree *ntree)
Definition: node.cc:1317
void nodeSetSelected(struct bNode *node, bool select)
Definition: node.cc:3615
#define CMP_CRYPTOMATTE_SRC_RENDER
Definition: BKE_node.h:1331
#define NODE_TREE_TYPES_END
Definition: BKE_node.h:433
bool nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **r_node, int *r_sockindex)
Definition: node.cc:1997
#define NODE_FRAME
Definition: BKE_node.h:985
void nodeUnregisterSocketType(struct bNodeSocketType *stype)
Definition: node.cc:1428
struct bNodeSocket * ntreeAddSocketInterface(struct bNodeTree *ntree, eNodeSocketInOut in_out, const char *idname, const char *name)
Definition: node.cc:3349
#define NODE_SOCKET_TYPES_END
Definition: BKE_node.h:601
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock)
#define NODE_GROUP_INPUT
Definition: BKE_node.h:987
#define NODE_TYPES_END
Definition: BKE_node.h:574
void nodeDetachNode(struct bNode *node)
Definition: node.cc:2607
#define CMP_CRYPTOMATTE_SRC_IMAGE
Definition: BKE_node.h:1332
struct bNodeSocketType * nodeSocketTypeFind(const char *idname)
Definition: node.cc:1395
void nodeUnregisterType(struct bNodeType *ntype)
Definition: node.cc:1378
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:3644
#define CMP_TRACKPOS_ABSOLUTE
Definition: BKE_node.h:1325
#define CMP_CHAN_A
Definition: BKE_node.h:1303
void BKE_ntree_update_tag_interface(struct bNodeTree *ntree)
void BKE_ntree_update_tag_all(struct bNodeTree *ntree)
void BKE_ntree_update_tag_node_property(struct bNodeTree *ntree, struct bNode *node)
void BKE_ntree_update_tag_socket_property(struct bNodeTree *ntree, struct bNodeSocket *socket)
void BKE_ntree_update_tag_active_output_changed(struct bNodeTree *ntree)
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.c:83
void BKE_texture_pointdensity_init_data(struct PointDensity *pd)
Definition: texture.c:589
void BKE_texture_pointdensity_free_data(struct PointDensity *pd)
Definition: texture.c:640
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:102
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:301
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
Definition: BLI_listbase.h:344
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.c:100
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.c:340
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define M_PI_2
Definition: BLI_math_base.h:23
#define DEG2RADF(_deg)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void zero_v3(float r[3])
void BLI_path_rel(char *file, const char *relfile) ATTR_NONNULL()
Definition: path_util.c:450
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
#define STRNCPY(dst, src)
Definition: BLI_string.h:483
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:42
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL()
Definition: string.c:250
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
#define STREQLEN(a, b, n)
#define UNUSED(x)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
#define STREQ(a, b)
#define BLT_I18NCONTEXT_ID_NODETREE
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_relations_tag_update(struct Main *bmain)
@ CD_PROP_BYTE_COLOR
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
@ CD_PROP_COLOR
@ CD_PROP_INT32
@ CD_PROP_BOOL
#define MAX_NAME
Definition: DNA_defs.h:48
#define IMA_ANIM_ALWAYS
@ IMA_SRC_FILE
@ IMA_SRC_MOVIE
@ IMA_SRC_GENERATED
@ IMA_SRC_SEQUENCE
@ IMA_TYPE_MULTILAYER
@ SUBSURF_BOUNDARY_SMOOTH_ALL
@ MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_SIZE
@ MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT
@ VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE
@ VOLUME_TO_MESH_RESOLUTION_MODE_GRID
@ VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT
@ SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES
@ SHD_POINTDENSITY_SOURCE_PSYS
@ SHD_POINTDENSITY_SOURCE_OBJECT
#define SHD_HAIR_TRANSMISSION
@ 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
#define SHD_SPACE_WORLD
@ GEO_NODE_MESH_CIRCLE_FILL_NGON
@ GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN
@ GEO_NODE_MESH_CIRCLE_FILL_NONE
#define CMP_NODE_BLUR_ASPECT_X
#define NODE_OPTIONS
@ GEO_NODE_TRIANGULATE_QUAD_SHORTEDGE
@ GEO_NODE_TRIANGULATE_QUAD_BEAUTY
@ GEO_NODE_TRIANGULATE_QUAD_ALTERNATE
@ GEO_NODE_TRIANGULATE_QUAD_LONGEDGE
@ GEO_NODE_TRIANGULATE_QUAD_FIXED
@ GEO_NODE_PROX_TARGET_EDGES
@ GEO_NODE_PROX_TARGET_POINTS
@ GEO_NODE_PROX_TARGET_FACES
@ GEO_NODE_CURVE_PRIMITIVE_LINE_MODE_POINTS
@ GEO_NODE_CURVE_PRIMITIVE_LINE_MODE_DIRECTION
@ 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_GLOSSY_ASHIKHMIN_SHIRLEY
@ CMP_NODE_DILATEERODE_STEP
@ CMP_NODE_DILATEERODE_DISTANCE_THRESH
@ CMP_NODE_DILATEERODE_DISTANCE_FEATHER
@ CMP_NODE_DILATEERODE_DISTANCE
#define SHD_BLEND_DIAGONAL
@ NTREE_EXECUTION_MODE_TILED
@ NTREE_EXECUTION_MODE_FULL_FRAME
#define CMP_NODE_WRAP_X
#define NTREE_QUALITY_LOW
#define CMP_NODE_PLANETRACKDEFORM_MBLUR_SAMPLES_MAX
#define SHD_GLOSSY_SHARP
#define SHD_BLEND_LINEAR
@ SHD_SUBSURFACE_BURLEY
@ SHD_SUBSURFACE_RANDOM_WALK_FIXED_RADIUS
@ SHD_SUBSURFACE_RANDOM_WALK
#define SHD_TOON_DIFFUSE
#define SHD_PROJ_EQUIRECTANGULAR
#define SHD_SKY_NISHITA
@ GEO_NODE_UV_UNWRAP_METHOD_CONFORMAL
@ GEO_NODE_UV_UNWRAP_METHOD_ANGLE_BASED
@ NODE_MAP_RANGE_STEPPED
@ NODE_MAP_RANGE_SMOOTHERSTEP
@ NODE_MAP_RANGE_SMOOTHSTEP
@ NODE_MAP_RANGE_LINEAR
@ 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_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
#define SHD_TANGENT_AXIS_Z
#define SHD_PROJ_SPHERE
@ GEO_NODE_SCALE_ELEMENTS_SINGLE_AXIS
@ GEO_NODE_SCALE_ELEMENTS_UNIFORM
#define CMP_NODE_CHANNEL_MATTE_CS_HSV
#define NODE_LINK_VALID
#define NODE_CUSTOM_COLOR
#define NTREE_TEXTURE
#define NTREE_CHUNKSIZE_512
#define NTREE_UNDEFINED
#define SHD_VECT_TRANSFORM_TYPE_VECTOR
#define NTREE_CHUNKSIZE_128
#define SHD_VECT_TRANSFORM_TYPE_NORMAL
@ SHD_WAVE_PROFILE_SIN
@ SHD_WAVE_PROFILE_TRI
@ SHD_WAVE_PROFILE_SAW
#define SHD_HAIR_REFLECTION
@ NODE_VECTOR_ROTATE_TYPE_AXIS
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Z
@ NODE_VECTOR_ROTATE_TYPE_AXIS_X
@ NODE_VECTOR_ROTATE_TYPE_EULER_XYZ
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Y
#define SHD_SKY_PREETHAM
#define SHD_TANGENT_AXIS_X
#define NTREE_QUALITY_MEDIUM
#define SHD_MUSGRAVE_MULTIFRACTAL
@ SHD_OUTPUT_CYCLES
@ SHD_OUTPUT_ALL
@ SHD_OUTPUT_EEVEE
#define CMP_NODE_CHANNEL_MATTE_CS_YUV
@ CMP_NODEFLAG_STABILIZE_INVERSE
@ SHD_WAVE_BANDS_DIRECTION_Y
@ SHD_WAVE_BANDS_DIRECTION_X
@ SHD_WAVE_BANDS_DIRECTION_Z
@ SHD_WAVE_BANDS_DIRECTION_DIAGONAL
@ GEO_NODE_CURVE_PRIMITIVE_ARC_TYPE_POINTS
@ GEO_NODE_CURVE_PRIMITIVE_ARC_TYPE_RADIUS
#define SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION
#define NODE_SCRIPT_EXTERNAL
@ GEO_NODE_CURVE_HANDLE_RIGHT
@ GEO_NODE_CURVE_HANDLE_LEFT
@ GEO_NODE_REALIZE_INSTANCES_LEGACY_BEHAVIOR
@ GEO_NODE_TRIANGULATE_NGON_EARCLIP
@ GEO_NODE_TRIANGULATE_NGON_BEAUTY
#define NTREE_TWO_PASS
#define NODE_DO_OUTPUT
#define NTREE_GEOMETRY
#define NTREE_CUSTOM
#define SHD_WAVE_RINGS
@ FN_NODE_ALIGN_EULER_TO_VECTOR_AXIS_Z
@ FN_NODE_ALIGN_EULER_TO_VECTOR_AXIS_Y
@ FN_NODE_ALIGN_EULER_TO_VECTOR_AXIS_X
#define CMP_NODE_BLUR_ASPECT_Y
#define CMP_NODE_CHANNEL_MATTE_CS_RGB
#define NODE_MUTED
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_RIGHT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_CENTER
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_CENTER
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT
@ SHD_VORONOI_F2
@ SHD_VORONOI_SMOOTH_F1
@ SHD_VORONOI_DISTANCE_TO_EDGE
@ SHD_VORONOI_F1
@ SHD_VORONOI_N_SPHERE_RADIUS
@ SHD_POINTDENSITY_SPACE_WORLD
@ SHD_POINTDENSITY_SPACE_OBJECT
#define SHD_PROJ_BOX
#define SHD_BLEND_SPHERICAL
#define SHD_MUSGRAVE_RIDGED_MULTIFRACTAL
#define SHD_WAVE_BANDS
#define NTREE_COMPOSIT
@ GEO_NODE_MESH_LINE_COUNT_RESOLUTION
@ GEO_NODE_MESH_LINE_COUNT_TOTAL
@ FN_NODE_ALIGN_EULER_TO_VECTOR_PIVOT_AXIS_Y
@ FN_NODE_ALIGN_EULER_TO_VECTOR_PIVOT_AXIS_AUTO
@ FN_NODE_ALIGN_EULER_TO_VECTOR_PIVOT_AXIS_X
@ FN_NODE_ALIGN_EULER_TO_VECTOR_PIVOT_AXIS_Z
#define NODE_ACTIVE_TEXTURE
#define SHD_VECT_TRANSFORM_TYPE_POINT
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_TEXTURE
@ NODE_MAPPING_TYPE_NORMAL
#define SHD_MIXRGB_USE_ALPHA
#define NODE_UPDATE_ID
@ FN_NODE_ROTATE_EULER_TYPE_EULER
@ FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE
#define SHD_IMAGE_EXTENSION_CLIP
#define NTREE_VIEWER_BORDER
@ CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR
@ GEO_NODE_EXTRUDE_MESH_FACES
@ GEO_NODE_EXTRUDE_MESH_VERTICES
@ GEO_NODE_EXTRUDE_MESH_EDGES
#define SHD_VECT_TRANSFORM_SPACE_OBJECT
#define SHD_IMAGE_EXTENSION_EXTEND
@ GEO_NODE_CURVE_RESAMPLE_LENGTH
@ GEO_NODE_CURVE_RESAMPLE_EVALUATED
@ GEO_NODE_CURVE_RESAMPLE_COUNT
#define SHD_INTERP_SMART
@ SHD_WAVE_RINGS_DIRECTION_Z
@ SHD_WAVE_RINGS_DIRECTION_Y
@ SHD_WAVE_RINGS_DIRECTION_X
@ SHD_WAVE_RINGS_DIRECTION_SPHERICAL
#define NTREE_COM_GROUPNODE_BUFFER
#define CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT
#define CMP_NODE_WRAP_NONE
#define SHD_IMAGE_EXTENSION_REPEAT
@ GEO_NODE_CURVE_SAMPLE_FACTOR
@ GEO_NODE_CURVE_SAMPLE_LENGTH
@ GEO_NODE_MESH_TO_POINTS_FACES
@ GEO_NODE_MESH_TO_POINTS_VERTICES
@ GEO_NODE_MESH_TO_POINTS_CORNERS
@ GEO_NODE_MESH_TO_POINTS_EDGES
@ CMP_NODEFLAG_MASK_FIXED_SCENE
@ CMP_NODEFLAG_MASK_NO_FEATHER
@ CMP_NODEFLAG_MASK_FIXED
@ CMP_NODEFLAG_MASK_MOTION_BLUR
#define CMP_NODE_BLUR_ASPECT_NONE
@ GEO_NODE_CURVE_FILL_MODE_TRIANGULATED
@ GEO_NODE_CURVE_FILL_MODE_NGONS
#define SHD_PRINCIPLED_HAIR_REFLECTANCE
#define SHD_PROJ_FLAT
#define SHD_SPACE_TANGENT
@ GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_RANDOM
@ GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_POISSON
#define NODE_HIDDEN
@ SOCK_OUT
@ SOCK_IN
#define NTREE_QUALITY_HIGH
@ NODE_CLAMP_RANGE
@ NODE_CLAMP_MINMAX
@ SHD_POINTDENSITY_COLOR_VERTNOR
@ SHD_POINTDENSITY_COLOR_VERTWEIGHT
@ SHD_POINTDENSITY_COLOR_VERTCOL
#define SHD_VECT_TRANSFORM_SPACE_CAMERA
@ CMP_NODE_SETALPHA_MODE_REPLACE_ALPHA
@ CMP_NODE_SETALPHA_MODE_APPLY
#define NODE_PREVIEW
#define SHD_MATH_CLAMP
@ GEO_NODE_MERGE_BY_DISTANCE_MODE_ALL
@ GEO_NODE_MERGE_BY_DISTANCE_MODE_CONNECTED
#define CMP_NODE_MASK_MBLUR_SAMPLES_MAX
@ SHD_VORONOI_EUCLIDEAN
@ SHD_VORONOI_CHEBYCHEV
@ SHD_VORONOI_MANHATTAN
@ SHD_VORONOI_MINKOWSKI
@ GEO_NODE_MESH_LINE_MODE_END_POINTS
@ GEO_NODE_MESH_LINE_MODE_OFFSET
#define CMP_NODE_CHANNEL_MATTE_CS_YCC
@ SOCK_HIDE_VALUE
@ SOCK_MULTI_INPUT
@ SOCK_IN_USE
@ SOCK_COLLAPSED
@ SOCK_HIDDEN
@ SOCK_UNAVAIL
#define NODE_FRAME_SHRINK
@ 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
#define SHD_GLOSSY_BECKMANN
#define SHD_BLEND_EASING
@ SOCK_DISPLAY_SHAPE_CIRCLE_DOT
@ SOCK_DISPLAY_SHAPE_CIRCLE
@ SOCK_DISPLAY_SHAPE_SQUARE_DOT
@ SOCK_DISPLAY_SHAPE_SQUARE
@ SOCK_DISPLAY_SHAPE_DIAMOND
@ SOCK_DISPLAY_SHAPE_DIAMOND_DOT
#define SHD_GLOSSY_GGX
@ SOCK_INT
@ SOCK_TEXTURE
@ SOCK_VECTOR
@ SOCK_BOOLEAN
@ SOCK_MATERIAL
@ SOCK_SHADER
@ SOCK_FLOAT
@ SOCK_IMAGE
@ SOCK_COLLECTION
@ SOCK_CUSTOM
@ SOCK_GEOMETRY
@ SOCK_OBJECT
@ SOCK_STRING
@ SOCK_RGBA
#define SHD_MUSGRAVE_FBM
#define SHD_TANGENT_UVMAP
@ GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_AMOUNT
@ GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_SIZE
@ CMP_NODEFLAG_BLUR_VARIABLE_SIZE
@ CMP_NODEFLAG_BLUR_EXTEND_BOUNDS
#define CMP_NODE_WRAP_XY
@ NODE_COMBSEP_COLOR_RGB
@ NODE_COMBSEP_COLOR_HSV
@ NODE_COMBSEP_COLOR_HSL
#define SHD_TOON_GLOSSY
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_KITE
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_TRAPEZOID
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_POINTS
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_RECTANGLE
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_PARALLELOGRAM
#define SHD_SPACE_BLENDER_OBJECT
#define SHD_AO_LOCAL
#define NTREE_CHUNKSIZE_256
#define SHD_SPACE_BLENDER_WORLD
#define NTREE_CHUNKSIZE_32
#define NODE_SCRIPT_AUTO_UPDATE
#define SHD_PROJ_MIRROR_BALL
#define SHD_BLEND_QUADRATIC
@ SHD_POINTDENSITY_COLOR_PARTSPEED
@ SHD_POINTDENSITY_COLOR_PARTVEL
@ SHD_POINTDENSITY_COLOR_PARTAGE
#define CMP_NODE_WRAP_Y
@ FN_NODE_ROTATE_EULER_SPACE_OBJECT
@ FN_NODE_ROTATE_EULER_SPACE_LOCAL
#define NTREE_CHUNKSIZE_1024
@ GEO_NODE_BOOLEAN_DIFFERENCE
@ GEO_NODE_BOOLEAN_UNION
@ GEO_NODE_BOOLEAN_INTERSECT
#define SHD_MUSGRAVE_HYBRID_MULTIFRACTAL
#define NODE_IES_EXTERNAL
#define SHD_BLEND_QUADRATIC_SPHERE
@ GEO_NODE_RAYCAST_NEAREST
@ GEO_NODE_RAYCAST_INTERPOLATED
#define SHD_AO_INSIDE
@ GEO_NODE_STRING_TO_CURVES_MODE_TRUNCATE
@ GEO_NODE_STRING_TO_CURVES_MODE_SCALE_TO_FIT
@ GEO_NODE_STRING_TO_CURVES_MODE_OVERFLOW
#define SHD_VECT_TRANSFORM_SPACE_WORLD
#define SHD_GLOSSY_MULTI_GGX
#define SHD_PROJ_TUBE
#define SHD_INTERP_CLOSEST
@ GEO_NODE_CURVE_HANDLE_ALIGN
@ GEO_NODE_CURVE_HANDLE_AUTO
@ GEO_NODE_CURVE_HANDLE_FREE
@ GEO_NODE_CURVE_HANDLE_VECTOR
#define NODE_SCRIPT_INTERNAL
#define NTREE_SHADER
@ 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
@ GEO_NODE_TRANSFORM_SPACE_RELATIVE
@ GEO_NODE_TRANSFORM_SPACE_ORIGINAL
@ FN_NODE_FLOAT_TO_INT_TRUNCATE
@ FN_NODE_FLOAT_TO_INT_CEIL
@ FN_NODE_FLOAT_TO_INT_ROUND
@ FN_NODE_FLOAT_TO_INT_FLOOR
#define SHD_TANGENT_AXIS_Y
#define SHD_INTERP_CUBIC
#define SHD_TANGENT_RADIAL
#define SHD_MUSGRAVE_HETERO_TERRAIN
#define SHD_MIXRGB_CLAMP
#define NODE_LINK_MUTED
@ GEO_NODE_DELETE_GEOMETRY_MODE_EDGE_FACE
@ GEO_NODE_DELETE_GEOMETRY_MODE_ONLY_FACE
@ GEO_NODE_DELETE_GEOMETRY_MODE_ALL
#define NTREE_CHUNKSIZE_64
#define NTREE_COM_OPENCL
@ GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_POSITION
@ GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_OFFSET
@ SHD_ATTRIBUTE_OBJECT
@ SHD_ATTRIBUTE_GEOMETRY
@ SHD_ATTRIBUTE_INSTANCER
#define NODE_IES_INTERNAL
@ NODE_COMPARE_MODE_ELEMENT
@ NODE_COMPARE_MODE_LENGTH
@ NODE_COMPARE_MODE_DOT_PRODUCT
@ NODE_COMPARE_MODE_AVERAGE
@ NODE_COMPARE_MODE_DIRECTION
#define SHD_BLEND_RADIAL
#define SHD_SPACE_OBJECT
@ GEO_NODE_ATTRIBUTE_TRANSFER_NEAREST_FACE_INTERPOLATED
@ GEO_NODE_ATTRIBUTE_TRANSFER_INDEX
@ GEO_NODE_ATTRIBUTE_TRANSFER_NEAREST
#define CMP_NODE_OUTPUT_IGNORE_ALPHA
#define SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION
@ GEO_NODE_CURVE_PRIMITIVE_CIRCLE_TYPE_RADIUS
@ GEO_NODE_CURVE_PRIMITIVE_CIRCLE_TYPE_POINTS
@ 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
#define SHD_INTERP_LINEAR
@ CMP_NODE_DENOISE_PREFILTER_FAST
@ CMP_NODE_DENOISE_PREFILTER_NONE
@ CMP_NODE_DENOISE_PREFILTER_ACCURATE
#define SHD_SKY_HOSEK
@ GEO_NODE_CURVE_FILLET_BEZIER
@ GEO_NODE_CURVE_FILLET_POLY
Object is a sort of wrapper for general info.
#define R_FILTER_GAUSS
#define R_FILTER_QUAD
#define R_FILTER_MITCH
#define MAXFRAMEF
#define R_FILTER_FAST_GAUSS
#define R_FILTER_TENT
#define R_FILTER_CUBIC
#define MINAFRAMEF
#define R_FILTER_BOX
#define R_FILTER_CATROM
#define TEX_PD_OBJECTSPACE
#define TEX_PD_OBJECT
#define TEX_PD_PSYS
@ 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
#define TEXMAP_CLIP_MIN
#define TEXMAP_CLIP_MAX
void ED_init_custom_node_socket_type(struct bNodeSocketType *stype)
Definition: drawnode.cc:1179
void ED_init_custom_node_type(struct bNodeType *ntype)
void ED_node_tree_propagate_change(const struct bContext *C, struct Main *bmain, struct bNodeTree *ntree)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
const char * IMB_colormanagement_colorspace_get_indexed_name(int index)
int IMB_colormanagement_colorspace_get_named_index(const char *name)
void IMB_colormanagement_colorspace_items_add(struct EnumPropertyItem **items, int *totitem)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
void register_node_type_sh_custom_group(bNodeType *ntype)
NODE_GROUP_OUTPUT
NODE_GROUP
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 Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position 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 SH_NODE_TEX_IMAGE
void ntreeTexCheckCyclics(struct bNodeTree *ntree)
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:744
struct bNodeSocketType * rna_node_socket_type_from_enum(int value)
const EnumPropertyItem * rna_node_tree_type_itemf(void *data, bool(*poll)(void *data, struct bNodeTreeType *), bool *r_free)
struct bNodeTreeType * rna_node_tree_type_from_enum(int value)
int rna_node_socket_idname_to_enum(const char *idname)
int rna_node_socket_type_to_enum(struct bNodeSocketType *typeinfo)
const EnumPropertyItem * rna_node_type_itemf(void *data, bool(*poll)(void *data, struct bNodeType *), bool *r_free)
int rna_node_tree_idname_to_enum(const char *idname)
int rna_node_type_to_enum(struct bNodeType *typeinfo)
const EnumPropertyItem * rna_node_socket_type_itemf(void *data, bool(*poll)(void *data, struct bNodeSocketType *), bool *r_free)
struct bNodeType * rna_node_type_from_enum(int value)
int rna_node_idname_to_enum(const char *idname)
int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo)
@ PARM_RNAPTR
Definition: RNA_types.h:354
@ PARM_REQUIRED
Definition: RNA_types.h:352
void(* StructFreeFunc)(void *data)
Definition: RNA_types.h:737
int(* StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function)
Definition: RNA_types.h:732
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_SELF_TYPE
Definition: RNA_types.h:658
@ FUNC_NO_SELF
Definition: RNA_types.h:656
@ FUNC_REGISTER
Definition: RNA_types.h:670
@ FUNC_USE_MAIN
Definition: RNA_types.h:661
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:662
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ FUNC_REGISTER_OPTIONAL
Definition: RNA_types.h:672
@ FUNC_ALLOW_WRITE
Definition: RNA_types.h:678
int(* StructCallbackFunc)(struct bContext *C, struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list)
Definition: RNA_types.h:733
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
#define RNA_ENUM_ITEM_SEPR
Definition: RNA_types.h:483
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROPOVERRIDE_NO_COMPARISON
Definition: RNA_types.h:320
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_DYNAMIC
Definition: RNA_types.h:290
@ PROP_CONTEXT_UPDATE
Definition: RNA_types.h:269
@ PROP_ANIMATABLE
Definition: RNA_types.h:202
@ PROP_NEVER_UNLINK
Definition: RNA_types.h:246
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_ENUM_FLAG
Definition: RNA_types.h:266
@ PROP_REGISTER_OPTIONAL
Definition: RNA_types.h:274
@ PROP_ENUM_NO_CONTEXT
Definition: RNA_types.h:292
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_NO_DEG_UPDATE
Definition: RNA_types.h:301
@ PROP_ENUM_NO_TRANSLATE
Definition: RNA_types.h:294
@ PROP_REGISTER
Definition: RNA_types.h:273
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:257
@ PROP_ID_REFCOUNT
Definition: RNA_types.h:226
@ PROP_IDPROPERTY
Definition: RNA_types.h:288
#define RNA_ENUM_ITEM_HEADING(name, description)
Definition: RNA_types.h:477
PropertySubType
Definition: RNA_types.h:125
@ PROP_TIME
Definition: RNA_types.h:146
@ PROP_DIRECTION
Definition: RNA_types.h:155
@ PROP_XYZ
Definition: RNA_types.h:162
@ PROP_DISTANCE
Definition: RNA_types.h:149
@ PROP_ACCELERATION
Definition: RNA_types.h:157
@ PROP_COLOR
Definition: RNA_types.h:153
@ PROP_ANGLE
Definition: RNA_types.h:145
@ PROP_TIME_ABSOLUTE
Definition: RNA_types.h:147
@ PROP_EULER
Definition: RNA_types.h:159
@ PROP_COORDS
Definition: RNA_types.h:167
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_PERCENTAGE
Definition: RNA_types.h:143
@ PROP_FACTOR
Definition: RNA_types.h:144
@ PROP_COLOR_GAMMA
Definition: RNA_types.h:165
@ PROP_TRANSLATION
Definition: RNA_types.h:154
@ PROP_XYZ_LENGTH
Definition: RNA_types.h:163
@ PROP_UNSIGNED
Definition: RNA_types.h:142
@ PROP_FILEPATH
Definition: RNA_types.h:129
@ PROP_VELOCITY
Definition: RNA_types.h:156
#define C
Definition: RandGen.cpp:25
#define NC_NODE
Definition: WM_types.h:344
#define ND_OB_ACTIVE
Definition: WM_types.h:388
#define ND_DISPLAY
Definition: WM_types.h:439
#define NC_SCENE
Definition: WM_types.h:328
#define ND_NODES
Definition: WM_types.h:384
#define NA_EDITED
Definition: WM_types.h:523
#define NC_IMAGE
Definition: WM_types.h:334
#define NA_SELECTED
Definition: WM_types.h:528
return(oflags[bm->toolflag_index].f &oflag) !=0
PyObject * self
Definition: bpy_driver.c:165
#define SELECT
OperationNode * node
const char * label
Scene scene
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
bNodeTree * ntree
RenderEngine * RE_engine_create(RenderEngineType *type)
Definition: engine.c:136
RenderEngineType * RE_engines_find(const char *idname)
Definition: engine.c:98
void RE_engine_free(RenderEngine *engine)
Definition: engine.c:164
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
T length(const vec_base< T, Size > &a)
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
void node_group_update(struct bNodeTree *ntree, struct bNode *node)
Definition: node_common.cc:213
void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *UNUSED(ntree), bNode *node)
void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *UNUSED(ntree), bNode *node)
void register_node_type_cmp_custom_group(bNodeType *ntype)
void ntreeCompositCryptomatteSyncFromRemove(bNode *node)
void ntreeCompositCryptomatteSyncFromAdd(const Scene *scene, bNode *node)
void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node)
void ntreeCompositOutputFileSetPath(bNode *node, bNodeSocket *sock, const char *name)
bNodeSocket * ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, const char *name, const ImageFormatData *im_format)
void ntreeCompositOutputFileSetLayer(bNode *node, bNodeSocket *sock, const char *name)
void ntreeCompositUpdateRLayers(bNodeTree *ntree)
void register_node_type_geo_custom_group(bNodeType *ntype)
static const EnumPropertyItem mode_items[]
Definition: paint_mask.c:59
bool RE_layers_have_name(struct RenderResult *rr)
Definition: pipeline.c:2567
return ret
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
Definition: rna_access.c:695
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void **value)
Definition: rna_access.c:6026
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:112
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
Definition: rna_access.c:902
ParameterList * RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSED(ptr), FunctionRNA *func)
Definition: rna_access.c:5826
const char * RNA_struct_ui_description(const StructRNA *type)
Definition: rna_access.c:609
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:61
void * RNA_struct_blender_type_get(StructRNA *srna)
Definition: rna_access.c:897
void RNA_parameter_list_free(ParameterList *parms)
Definition: rna_access.c:5922
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
Definition: rna_access.c:4729
int RNA_struct_ui_icon(const StructRNA *type)
Definition: rna_access.c:601
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value)
Definition: rna_access.c:6088
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
void * rna_iterator_listbase_get(CollectionPropertyIterator *iter)
Definition: rna_access.c:4761
void rna_def_animdata_common(StructRNA *srna)
const EnumPropertyItem rna_enum_attribute_domain_items[]
Definition: rna_attribute.c:70
const EnumPropertyItem rna_enum_attribute_domain_without_corner_items[]
Definition: rna_attribute.c:84
const EnumPropertyItem rna_enum_attribute_type_items[]
Definition: rna_attribute.c:26
const EnumPropertyItem rna_enum_curves_types[]
Definition: rna_curves.c:21
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
Definition: rna_define.c:1148
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1193
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1526
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
void RNA_def_property_float_default(PropertyRNA *prop, float value)
Definition: rna_define.c:2022
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:4076
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
Definition: rna_define.c:2106
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2695
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
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)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
Definition: rna_define.c:4337
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
Definition: rna_define.c:1937
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2944
void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
Definition: rna_define.c:1172
void RNA_def_property_int_default(PropertyRNA *prop, int value)
Definition: rna_define.c:1978
StructRNA * RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
Definition: rna_define.c:900
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname)
Definition: rna_define.c:1075
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3224
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2669
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4487
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *rna_ext)
Definition: rna_define.c:762
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4436
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
FunctionRNA * RNA_def_function_runtime(StructRNA *srna, const char *identifier, CallFunc call)
Definition: rna_define.c:4296
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
Definition: rna_define.c:777
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
Definition: rna_define.c:1160
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2848
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
Definition: rna_define.c:1250
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
Definition: rna_define.c:2043
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2327
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
BlenderRNA BLENDER_RNA
StructRNA RNA_PropertyGroup
char * rna_Node_ImageUser_path(const struct PointerRNA *ptr)
const EnumPropertyItem rna_enum_ramp_blend_items[]
Definition: rna_material.c:26
const EnumPropertyItem rna_enum_axis_xy_items[]
Definition: rna_modifier.c:609
const EnumPropertyItem rna_enum_subdivision_uv_smooth_items[]
Definition: rna_modifier.c:629
const EnumPropertyItem rna_enum_subdivision_boundary_smooth_items[]
Definition: rna_modifier.c:657
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_geo_store_named_attribute(StructRNA *srna)
static void def_geo_separate_geometry(StructRNA *srna)
static void def_cmp_filter(StructRNA *srna)
static void def_geo_curve_primitive_bezier_segment(StructRNA *srna)
static void def_principled(StructRNA *srna)
static void def_refraction(StructRNA *srna)
static void def_geo_boolean(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_geo_extrude_mesh(StructRNA *srna)
static void def_node_image_user(StructRNA *srna)
static void def_geo_accumulate_field(StructRNA *srna)
static void def_cmp_double_edge_mask(StructRNA *srna)
static void def_cmp_flip(StructRNA *srna)
static EnumPropertyItem node_ies_mode_items[]
static void def_geo_curve_set_handle_positions(StructRNA *srna)
static void def_group(StructRNA *srna)
static void rna_def_node_socket_virtual(BlenderRNA *brna, const char *identifier)
static void rna_def_texture_node(BlenderRNA *brna)
static void def_fn_input_int(StructRNA *srna)
static void def_geo_delete_geometry(StructRNA *srna)
static void def_geo_curve_primitive_quadrilateral(StructRNA *srna)
static void def_geo_field_at_index(StructRNA *srna)
static void def_geo_transfer_attribute(StructRNA *srna)
static void def_rgb_curve(StructRNA *srna)
static void def_sh_tex_image(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)
static void def_geo_curve_primitive_arc(StructRNA *srna)
static void rna_def_node_link(BlenderRNA *brna)
static const EnumPropertyItem rna_node_geometry_curve_handle_type_items[]
Definition: rna_nodetree.c:464
static void def_sh_tex_checker(StructRNA *srna)
static const EnumPropertyItem prop_image_view_items[]
static const EnumPropertyItem rna_node_combsep_color_items[]
Definition: rna_nodetree.c:492
static void def_geo_interpolate_domain(StructRNA *srna)
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[]
Definition: rna_nodetree.c:500
static void def_geo_curve_set_handle_type(StructRNA *srna)
static void def_sh_uvalongstroke(StructRNA *srna)
static const EnumPropertyItem prop_shader_output_target_items[]
Definition: rna_nodetree.c:507
static void def_geo_collection_info(StructRNA *srna)
static const EnumPropertyItem node_flip_items[]
static void def_cmp_bilateral_blur(StructRNA *srna)
static const EnumPropertyItem node_hair_items[]
static void def_sh_tex_white_noise(StructRNA *srna)
static void def_cmp_zcombine(StructRNA *srna)
static void rna_def_compositor_node(BlenderRNA *brna)
static void def_geo_points_to_volume(StructRNA *srna)
static void def_cmp_switch_view(StructRNA *UNUSED(srna))
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_curve_trim(StructRNA *srna)
static void def_time(StructRNA *srna)
static void def_sh_tex_gradient(StructRNA *srna)
const EnumPropertyItem rna_enum_node_float_to_int_items[]
Definition: rna_nodetree.c:385
static void def_cmp_brightcontrast(StructRNA *srna)
static void def_anisotropic(StructRNA *srna)
static void dev_cmd_transform(StructRNA *srna)
static void def_sh_normal_map(StructRNA *srna)
static void def_cmp_id_mask(StructRNA *srna)
static const EnumPropertyItem node_principled_hair_items[]
static void def_geo_attribute_domain_size(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 def_vector_math(StructRNA *srna)
static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
static void def_sh_vertex_color(StructRNA *srna)
static void def_geo_attribute_capture(StructRNA *srna)
static void rna_def_node(BlenderRNA *brna)
static void def_cmp_map_uv(StructRNA *srna)
static const EnumPropertyItem rna_enum_node_tex_dimensions_items[]
Definition: rna_nodetree.c:444
static void def_group_input(StructRNA *srna)
static void def_sh_tex_magic(StructRNA *srna)
static void def_geo_curve_primitive_circle(StructRNA *srna)
static void def_geo_triangulate(StructRNA *srna)
static const EnumPropertyItem node_masktype_items[]
static void def_geo_mesh_line(StructRNA *srna)
static void rna_def_cmp_output_file_slot_layer(BlenderRNA *brna)
static void def_cmp_premul_key(StructRNA *srna)
static void def_sh_bump(StructRNA *srna)
static void def_sh_uvmap(StructRNA *srna)
static void def_sh_output(StructRNA *srna)
static void def_math(StructRNA *srna)
static void def_geo_mesh_to_points(StructRNA *srna)
static void def_sh_tangent(StructRNA *srna)
static void def_mix_rgb(StructRNA *srna)
static void def_geo_distribute_points_on_faces(StructRNA *srna)
static const EnumPropertyItem rna_node_geometry_curve_handle_side_items[]
Definition: rna_nodetree.c:487
static void rna_def_node_socket_color(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void def_geo_switch(StructRNA *srna)
static void def_sh_vector_displacement(StructRNA *srna)
static void def_cmp_set_alpha(StructRNA *srna)
static void def_fn_input_vector(StructRNA *srna)
static const EnumPropertyItem rna_enum_node_socket_display_shape_items[]
Definition: rna_nodetree.c:74
static void def_geo_curve_fill(StructRNA *srna)
static void def_sh_tex_wireframe(StructRNA *srna)
static void rna_def_node_socket_geometry(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void rna_def_internal_node(BlenderRNA *brna)
static void def_cmp_colorcorrection(StructRNA *srna)
static const EnumPropertyItem node_quality_items[]
Definition: rna_nodetree.c:101
static void def_cmp_sunbeams(StructRNA *srna)
static void def_geo_proximity(StructRNA *srna)
static void def_cmp_levels(StructRNA *srna)
static void def_frame(StructRNA *srna)
const EnumPropertyItem rna_enum_mapping_type_items[]
Definition: rna_nodetree.c:133
static void def_geo_raycast(StructRNA *srna)
static void def_sh_attribute(StructRNA *srna)
static const EnumPropertyItem rna_enum_vector_rotate_type_items[]
Definition: rna_nodetree.c:153
static const EnumPropertyItem rna_enum_execution_mode_items[]
Definition: rna_nodetree.c:119
static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
static void def_cmp_blur(StructRNA *srna)
static void rna_def_node_socket_texture(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void def_cmp_composite(StructRNA *srna)
static void def_geo_curve_sample(StructRNA *srna)
static void def_sh_tex_voronoi(StructRNA *srna)
static void def_fn_input_string(StructRNA *srna)
static void def_geo_uv_unwrap(StructRNA *srna)
static const EnumPropertyItem node_cryptomatte_layer_name_items[]
Definition: rna_nodetree.c:518
static void def_geo_duplicate_elements(StructRNA *srna)
static void def_cmp_combsep_color(StructRNA *srna)
static const EnumPropertyItem node_ycc_items[]
static void def_cmp_lensdist(StructRNA *srna)
static void def_cmp_color_matte(StructRNA *srna)
static void def_geo_curve_to_points(StructRNA *srna)
static void def_toon(StructRNA *srna)
static void def_geo_attribute_statistic(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 EnumPropertyItem rna_node_geometry_mesh_circle_fill_type_items[]
Definition: rna_nodetree.c:525
static void def_geo_viewer(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 void def_geo_merge_by_distance(StructRNA *srna)
static void def_sh_ambient_occlusion(StructRNA *srna)
static void rna_def_node_socket_string(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void def_fn_random_value(StructRNA *srna)
static void rna_def_node_socket_standard_types(BlenderRNA *brna)
static void def_group_output(StructRNA *srna)
static void rna_def_node_socket_interface(BlenderRNA *brna)
static void def_geo_input_named_attribute(StructRNA *srna)
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_geo_mesh_cone(StructRNA *srna)
static void def_clamp(StructRNA *srna)
static void def_compare(StructRNA *srna)
static void def_sh_tex_ies(StructRNA *srna)
static void def_sh_tex_musgrave(StructRNA *srna)
static void def_cmp_image(StructRNA *srna)
static void rna_def_texture_nodetree(BlenderRNA *brna)
static void def_cmp_keying(StructRNA *srna)
static void def_geo_scale_elements(StructRNA *srna)
const EnumPropertyItem rna_enum_node_socket_in_out_items[]
Definition: rna_nodetree.c:54
static void rna_def_node_socket_image(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void rna_def_node_socket_int(BlenderRNA *brna, const char *identifier, const char *interface_idname, PropertySubType subtype)
static void def_geo_subdivision_surface(StructRNA *srna)
static void rna_def_node_socket_vector(BlenderRNA *brna, const char *identifier, const char *interface_idname, PropertySubType subtype)
static void def_sh_output_aov(StructRNA *srna)
void RNA_def_nodetree(BlenderRNA *brna)
static void def_sh_output_linestyle(StructRNA *srna)
static void rna_def_node_socket(BlenderRNA *brna)
static void rna_def_node_socket_object(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void def_tex_combsep_color(StructRNA *srna)
static void def_cmp_vector_blur(StructRNA *srna)
const EnumPropertyItem rna_enum_node_math_items[]
Definition: rna_nodetree.c:166
static void rna_def_shader_nodetree(BlenderRNA *brna)
static void def_geo_image_texture(StructRNA *srna)
static void def_geo_curve_spline_type(StructRNA *srna)
static void def_geo_mesh_to_volume(StructRNA *srna)
static void def_boolean_math(StructRNA *srna)
static void def_cmp_huecorrect(StructRNA *srna)
static void def_cmp_channel_matte(StructRNA *srna)
static void def_fn_align_euler_to_vector(StructRNA *srna)
static void def_cmp_convert_color_space(StructRNA *srna)
const EnumPropertyItem rna_enum_node_vec_math_items[]
Definition: rna_nodetree.c:235
static void def_sh_displacement(StructRNA *srna)
static void def_geo_volume_to_mesh(StructRNA *srna)
static void def_cmp_glare(StructRNA *srna)
static void def_sh_tex_sky(StructRNA *srna)
static void def_cmp_splitviewer(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_geometry_nodetree(BlenderRNA *brna)
static void def_sh_combsep_color(StructRNA *srna)
static void def_sh_script(StructRNA *srna)
static void rna_def_node_socket_bool(BlenderRNA *brna, const char *identifier, const char *interface_idname)
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_anisotropic_items[]
static void rna_def_node_socket_material(BlenderRNA *brna, const char *identifier, const char *interface_idname)
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 prop_tri_channel_items[]
static void def_sh_bevel(StructRNA *srna)
static void def_geo_mesh_circle(StructRNA *srna)
static void def_sh_mapping(StructRNA *srna)
static void def_fn_rotate_euler(StructRNA *srna)
static const EnumPropertyItem node_glass_items[]
static void rna_def_node_socket_shader(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void def_geo_input_material(StructRNA *srna)
static void def_cmp_bokehimage(StructRNA *srna)
static void def_cmp_moviedistortion(StructRNA *srna)
const EnumPropertyItem rna_enum_node_boolean_math_items[]
Definition: rna_nodetree.c:288
static void def_cmp_dilate_erode(StructRNA *srna)
static void def_cmp_planetrackdeform(StructRNA *srna)
static void def_cmp_movieclip(StructRNA *srna)
static void def_hair_principled(StructRNA *srna)
static void def_cmp_despeckle(StructRNA *srna)
const EnumPropertyItem rna_enum_node_map_range_items[]
Definition: rna_nodetree.c:410
const EnumPropertyItem rna_enum_node_float_compare_items[]
Definition: rna_nodetree.c:319
static void def_sh_vect_transform(StructRNA *srna)
const EnumPropertyItem rna_enum_node_compare_operation_items[]
Definition: rna_nodetree.c:349
static void def_geo_curve_resample(StructRNA *srna)
const EnumPropertyItem rna_enum_node_filter_items[]
Definition: rna_nodetree.c:452
static const EnumPropertyItem node_socket_data_type_items[]
Definition: rna_nodetree.c:57
static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
static StructRNA * define_specific_node(BlenderRNA *brna, const char *struct_name, const char *base_name, const char *ui_name, const char *ui_desc, void(*def_func)(StructRNA *))
static void def_cmp_ellipsemask(StructRNA *srna)
static void def_float_curve(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_geo_mesh_cylinder(StructRNA *srna)
static void rna_def_node_socket_collection(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void def_cmp_diff_matte(StructRNA *srna)
static void def_cmp_keyingscreen(StructRNA *srna)
static void def_cmp_cryptomatte_legacy(StructRNA *srna)
static void def_cmp_colorbalance(StructRNA *srna)
static void def_cmp_mask(StructRNA *srna)
static void def_geo_curve_fillet(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[]
Definition: rna_nodetree.c:434
static void def_geo_object_info(StructRNA *srna)
static void def_vector_curve(StructRNA *srna)
static void def_cmp_chroma_matte(StructRNA *srna)
static void def_cmp_color_spill(StructRNA *srna)
static void def_cmp_cryptomatte_entry(BlenderRNA *brna)
static const EnumPropertyItem node_chunksize_items[]
Definition: rna_nodetree.c:108
static void def_sh_tex_wave(StructRNA *srna)
static void def_cmp_output_file(BlenderRNA *brna, StructRNA *srna)
static void def_geo_curve_primitive_line(StructRNA *srna)
static void def_sh_tex_pointdensity(StructRNA *srna)
static const EnumPropertyItem node_socket_type_items[]
Definition: rna_nodetree.c:83
static void def_sh_tex_coord(StructRNA *srna)
static const EnumPropertyItem node_principled_distribution_items[]
static void def_sh_tex_brick(StructRNA *srna)
static void def_geo_realize_instances(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 def_fn_combsep_color(StructRNA *srna)
static void rna_def_node_socket_float(BlenderRNA *brna, const char *idname, const char *interface_idname, PropertySubType subtype)
static void def_cmp_translate(StructRNA *srna)
static void def_sh_tex_environment(StructRNA *srna)
static const EnumPropertyItem space_items[]
const EnumPropertyItem DummyRNA_NULL_items[]
Definition: rna_rna.c:26
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
Definition: rna_scene.c:120
const EnumPropertyItem rna_enum_geometry_component_type_items[]
Definition: rna_space.c:62
const EnumPropertyItem rna_enum_icon_items[]
Definition: rna_ui_api.c:30
#define min(a, b)
Definition: sort.c:35
const char * identifier
Definition: RNA_types.h:461
const char * name
Definition: RNA_types.h:465
const char * description
Definition: RNA_types.h:467
StructRNA * srna
Definition: RNA_types.h:766
StructCallbackFunc call
Definition: RNA_types.h:767
void * data
Definition: RNA_types.h:765
StructFreeFunc free
Definition: RNA_types.h:768
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
struct MaterialGPencilStyle * gp_style
ListBase particlesystem
char vertex_attribute_name[64]
struct Object * object
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
char engine[32]
struct ImageFormatData im_format
void(* update_script_node)(struct RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node)
Definition: RE_engine.h:106
char name[RE_MAXNAME]
Definition: RE_pipeline.h:87
struct RenderLayer * next
Definition: RE_pipeline.h:84
struct RenderView * next
Definition: RE_pipeline.h:50
char name[64]
Definition: RE_pipeline.h:51
struct bNodeTree * nodetree
struct RenderData r
char * filepath
Compact definition of a node socket.
Definition: BKE_node.h:84
char identifier[64]
Definition: BKE_node.h:94
Defines a socket type.
Definition: BKE_node.h:143
void(* draw_color)(struct bContext *C, struct PointerRNA *ptr, struct PointerRNA *node_ptr, float *r_color)
Definition: BKE_node.h:154
ExtensionRNA ext_interface
Definition: BKE_node.h:181
ExtensionRNA ext_socket
Definition: BKE_node.h:180
void(* interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color)
Definition: BKE_node.h:160
void(* draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr, struct PointerRNA *node_ptr, const char *text)
Definition: BKE_node.h:149
void(* interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr)
Definition: BKE_node.h:159
char idname[64]
Definition: BKE_node.h:145
IDProperty * prop
struct bNodeSocket * next
void * default_value
struct bNodeSocketType * typeinfo
char identifier[64]
bool(* poll)(const struct bContext *C, struct bNodeTreeType *ntreetype)
Definition: BKE_node.h:387
char idname[64]
Definition: BKE_node.h:375
void(* update)(struct bNodeTree *ntree)
Definition: BKE_node.h:400
void(* get_from_context)(const struct bContext *C, struct bNodeTreeType *ntreetype, struct bNodeTree **r_ntree, struct ID **r_id, struct ID **r_from)
Definition: BKE_node.h:389
char ui_name[64]
Definition: BKE_node.h:377
char ui_description[256]
Definition: BKE_node.h:378
bool(* valid_socket_type)(struct bNodeTreeType *ntreetype, struct bNodeSocketType *socket_type)
Definition: BKE_node.h:407
ExtensionRNA rna_ext
Definition: BKE_node.h:410
char idname[64]
struct bNodeTreeType * typeinfo
ListBase nodes
ListBase inputs
ListBase links
ListBase outputs
Defines a node type.
Definition: BKE_node.h:226
float minwidth
Definition: BKE_node.h:234
void(* group_update_func)(struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:267
float width
Definition: BKE_node.h:234
char ui_name[64]
Definition: BKE_node.h:230
bool(* poll)(struct bNodeType *ntype, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:292
float maxwidth
Definition: BKE_node.h:234
ExtensionRNA rna_ext
Definition: BKE_node.h:341
int type
Definition: BKE_node.h:228
void(* updatefunc)(struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:265
bNodeSocketTemplate * outputs
Definition: BKE_node.h:239
void(* initfunc_api)(const struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:279
void(* free_self)(struct bNodeType *ntype)
Definition: BKE_node.h:303
char ui_description[256]
Definition: BKE_node.h:231
void(* insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link)
Definition: BKE_node.h:301
void(* labelfunc)(const struct bNodeTree *ntree, const struct bNode *node, char *label, int maxlen)
Definition: BKE_node.h:256
void(* draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:246
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:244
float minheight
Definition: BKE_node.h:235
void(* freefunc_api)(struct PointerRNA *ptr)
Definition: BKE_node.h:280
float height
Definition: BKE_node.h:235
bNodeSocketTemplate * inputs
Definition: BKE_node.h:239
float maxheight
Definition: BKE_node.h:235
bool(* poll_instance)(struct bNode *node, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:296
char idname[64]
Definition: BKE_node.h:227
void(* copyfunc_api)(struct PointerRNA *ptr, const struct bNode *src_node)
Definition: BKE_node.h:281
int ui_icon
Definition: BKE_node.h:232
struct bNodeType * typeinfo
short type
void RE_point_density_sample(Depsgraph *depsgraph, PointDensity *pd, const int resolution, float *values)
void RE_point_density_minmax(struct Depsgraph *depsgraph, struct PointDensity *pd, float r_min[3], float r_max[3])
void RE_point_density_cache(struct Depsgraph *depsgraph, PointDensity *pd)
void RE_point_density_free(struct PointDensity *pd)
float max
#define N_(msgid)
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480