Blender  V2.93
rna_nodetree.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <limits.h>
22 #include <stdlib.h>
23 #include <string.h>
24 
25 #include "BLI_math.h"
26 #include "BLI_utildefines.h"
27 
28 #include "BLT_translation.h"
29 
30 #include "DNA_material_types.h"
31 #include "DNA_mesh_types.h"
32 #include "DNA_modifier_types.h"
33 #include "DNA_node_types.h"
34 #include "DNA_object_types.h"
35 #include "DNA_particle_types.h"
36 #include "DNA_text_types.h"
37 #include "DNA_texture_types.h"
38 
39 #include "BKE_animsys.h"
40 #include "BKE_attribute.h"
41 #include "BKE_cryptomatte.h"
42 #include "BKE_image.h"
43 #include "BKE_node.h"
44 #include "BKE_texture.h"
45 
46 #include "RNA_access.h"
47 #include "RNA_define.h"
48 #include "RNA_enum_types.h"
49 
50 #include "rna_internal.h"
51 #include "rna_internal_types.h"
52 
53 #include "IMB_imbuf.h"
54 #include "IMB_imbuf_types.h"
55 
56 #include "WM_types.h"
57 
58 #include "MEM_guardedalloc.h"
59 
60 #include "RE_texture.h"
61 
62 #include "DEG_depsgraph.h"
63 #include "DEG_depsgraph_query.h"
64 
66  {SOCK_IN, "IN", 0, "Input", ""}, {SOCK_OUT, "OUT", 0, "Output", ""}, {0, NULL, 0, NULL, NULL}};
67 
68 #ifndef RNA_RUNTIME
70  {SOCK_DISPLAY_SHAPE_CIRCLE, "CIRCLE", 0, "Circle", ""},
71  {SOCK_DISPLAY_SHAPE_SQUARE, "SQUARE", 0, "Square", ""},
72  {SOCK_DISPLAY_SHAPE_DIAMOND, "DIAMOND", 0, "Diamond", ""},
73  {SOCK_DISPLAY_SHAPE_CIRCLE_DOT, "CIRCLE_DOT", 0, "Circle with inner dot", ""},
74  {SOCK_DISPLAY_SHAPE_SQUARE_DOT, "SQUARE_DOT", 0, "Square with inner dot", ""},
75  {SOCK_DISPLAY_SHAPE_DIAMOND_DOT, "DIAMOND_DOT", 0, "Diamond with inner dot", ""},
76  {0, NULL, 0, NULL, NULL}};
77 
79  {SOCK_CUSTOM, "CUSTOM", 0, "Custom", ""},
80  {SOCK_FLOAT, "VALUE", 0, "Value", ""},
81  {SOCK_INT, "INT", 0, "Int", ""},
82  {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
83  {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
84  {SOCK_STRING, "STRING", 0, "String", ""},
85  {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
86  {SOCK_SHADER, "SHADER", 0, "Shader", ""},
87  {SOCK_OBJECT, "OBJECT", 0, "Object", ""},
88  {SOCK_IMAGE, "IMAGE", 0, "Image", ""},
89  {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""},
90  {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""},
91  {0, NULL, 0, NULL, NULL},
92 };
93 
95  {NTREE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"},
96  {NTREE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", "Medium quality"},
97  {NTREE_QUALITY_LOW, "LOW", 0, "Low", "Low quality"},
98  {0, NULL, 0, NULL, NULL},
99 };
100 
102  {NTREE_CHUNKSIZE_32, "32", 0, "32x32", "Chunksize of 32x32"},
103  {NTREE_CHUNKSIZE_64, "64", 0, "64x64", "Chunksize of 64x64"},
104  {NTREE_CHUNKSIZE_128, "128", 0, "128x128", "Chunksize of 128x128"},
105  {NTREE_CHUNKSIZE_256, "256", 0, "256x256", "Chunksize of 256x256"},
106  {NTREE_CHUNKSIZE_512, "512", 0, "512x512", "Chunksize of 512x512"},
107  {NTREE_CHUNKSIZE_1024, "1024", 0, "1024x1024", "Chunksize of 1024x1024"},
108  {0, NULL, 0, NULL, NULL},
109 };
110 #endif
111 
113  {NODE_MAPPING_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
115  "TEXTURE",
116  0,
117  "Texture",
118  "Transform a texture by inverse mapping the texture coordinate"},
120  "VECTOR",
121  0,
122  "Vector",
123  "Transform a direction vector. Location is ignored"},
125  "NORMAL",
126  0,
127  "Normal",
128  "Transform a unit normal vector. Location is ignored"},
129  {0, NULL, 0, NULL, NULL},
130 };
131 
134  "AXIS_ANGLE",
135  0,
136  "Axis Angle",
137  "Rotate a point using axis angle"},
138  {NODE_VECTOR_ROTATE_TYPE_AXIS_X, "X_AXIS", 0, "X Axis", "Rotate a point using X axis"},
139  {NODE_VECTOR_ROTATE_TYPE_AXIS_Y, "Y_AXIS", 0, "Y Axis", "Rotate a point using Y axis"},
140  {NODE_VECTOR_ROTATE_TYPE_AXIS_Z, "Z_AXIS", 0, "Z Axis", "Rotate a point using Z axis"},
141  {NODE_VECTOR_ROTATE_TYPE_EULER_XYZ, "EULER_XYZ", 0, "Euler", "Rotate a point using XYZ order"},
142  {0, NULL, 0, NULL, NULL},
143 };
144 
146  {0, "", 0, N_("Functions"), ""},
147  {NODE_MATH_ADD, "ADD", 0, "Add", "A + B"},
148  {NODE_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
149  {NODE_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "A * B"},
150  {NODE_MATH_DIVIDE, "DIVIDE", 0, "Divide", "A / B"},
151  {NODE_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"},
152  {0, "", ICON_NONE, NULL, NULL},
153  {NODE_MATH_POWER, "POWER", 0, "Power", "A power B"},
154  {NODE_MATH_LOGARITHM, "LOGARITHM", 0, "Logarithm", "Logarithm A base B"},
155  {NODE_MATH_SQRT, "SQRT", 0, "Square Root", "Square root of A"},
156  {NODE_MATH_INV_SQRT, "INVERSE_SQRT", 0, "Inverse Square Root", "1 / Square root of A"},
157  {NODE_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Magnitude of A"},
158  {NODE_MATH_EXPONENT, "EXPONENT", 0, "Exponent", "exp(A)"},
159  {0, "", 0, N_("Comparison"), ""},
160  {NODE_MATH_MINIMUM, "MINIMUM", 0, "Minimum", "The minimum from A and B"},
161  {NODE_MATH_MAXIMUM, "MAXIMUM", 0, "Maximum", "The maximum from A and B"},
162  {NODE_MATH_LESS_THAN, "LESS_THAN", 0, "Less Than", "1 if A < B else 0"},
163  {NODE_MATH_GREATER_THAN, "GREATER_THAN", 0, "Greater Than", "1 if A > B else 0"},
164  {NODE_MATH_SIGN, "SIGN", 0, "Sign", "Returns the sign of A"},
165  {NODE_MATH_COMPARE, "COMPARE", 0, "Compare", "1 if (A == B) within tolerance C else 0"},
167  "SMOOTH_MIN",
168  0,
169  "Smooth Minimum",
170  "The minimum from A and B with smoothing C"},
172  "SMOOTH_MAX",
173  0,
174  "Smooth Maximum",
175  "The maximum from A and B with smoothing C"},
176  {0, "", 0, N_("Rounding"), ""},
178  "ROUND",
179  0,
180  "Round",
181  "Round A to the nearest integer. Round upward if the fraction part is 0.5"},
182  {NODE_MATH_FLOOR, "FLOOR", 0, "Floor", "The largest integer smaller than or equal A"},
183  {NODE_MATH_CEIL, "CEIL", 0, "Ceil", "The smallest integer greater than or equal A"},
184  {NODE_MATH_TRUNC, "TRUNC", 0, "Truncate", "The integer part of A, removing fractional digits"},
185  {0, "", ICON_NONE, NULL, NULL},
186  {NODE_MATH_FRACTION, "FRACT", 0, "Fraction", "The fraction part of A"},
187  {NODE_MATH_MODULO, "MODULO", 0, "Modulo", "Modulo using fmod(A,B)"},
188  {NODE_MATH_WRAP, "WRAP", 0, "Wrap", "Wrap value to range, wrap(A,B)"},
189  {NODE_MATH_SNAP, "SNAP", 0, "Snap", "Snap to increment, snap(A,B)"},
191  "PINGPONG",
192  0,
193  "Ping-Pong",
194  "Wraps a value and reverses every other cycle (A,B)"},
195  {0, "", 0, N_("Trigonometric"), ""},
196  {NODE_MATH_SINE, "SINE", 0, "Sine", "sin(A)"},
197  {NODE_MATH_COSINE, "COSINE", 0, "Cosine", "cos(A)"},
198  {NODE_MATH_TANGENT, "TANGENT", 0, "Tangent", "tan(A)"},
199  {0, "", ICON_NONE, NULL, NULL},
200  {NODE_MATH_ARCSINE, "ARCSINE", 0, "Arcsine", "arcsin(A)"},
201  {NODE_MATH_ARCCOSINE, "ARCCOSINE", 0, "Arccosine", "arccos(A)"},
202  {NODE_MATH_ARCTANGENT, "ARCTANGENT", 0, "Arctangent", "arctan(A)"},
203  {NODE_MATH_ARCTAN2, "ARCTAN2", 0, "Arctan2", "The signed angle arctan(A / B)"},
204  {0, "", ICON_NONE, NULL, NULL},
205  {NODE_MATH_SINH, "SINH", 0, "Hyperbolic Sine", "sinh(A)"},
206  {NODE_MATH_COSH, "COSH", 0, "Hyperbolic Cosine", "cosh(A)"},
207  {NODE_MATH_TANH, "TANH", 0, "Hyperbolic Tangent", "tanh(A)"},
208  {0, "", 0, N_("Conversion"), ""},
209  {NODE_MATH_RADIANS, "RADIANS", 0, "To Radians", "Convert from degrees to radians"},
210  {NODE_MATH_DEGREES, "DEGREES", 0, "To Degrees", "Convert from radians to degrees"},
211  {0, NULL, 0, NULL, NULL},
212 };
213 
215  {NODE_VECTOR_MATH_ADD, "ADD", 0, "Add", "A + B"},
216  {NODE_VECTOR_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"},
217  {NODE_VECTOR_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "Entry-wise multiply"},
218  {NODE_VECTOR_MATH_DIVIDE, "DIVIDE", 0, "Divide", "Entry-wise divide"},
219  {0, "", ICON_NONE, NULL, NULL},
220  {NODE_VECTOR_MATH_CROSS_PRODUCT, "CROSS_PRODUCT", 0, "Cross Product", "A cross B"},
221  {NODE_VECTOR_MATH_PROJECT, "PROJECT", 0, "Project", "Project A onto B"},
223  "REFLECT",
224  0,
225  "Reflect",
226  "Reflect A around the normal B. B doesn't need to be normalized"},
228  "REFRACT",
229  0,
230  "Refract",
231  "For a given incident vector A, surface normal B and ratio of indices of refraction, Ior, "
232  "refract returns the refraction vector, R"},
234  "FACEFORWARD",
235  0,
236  "Faceforward",
237  "Orients a vector A to point away from a surface B as defined by its normal C. "
238  "Returns (dot(B, C) < 0) ? A : -A"},
239  {NODE_VECTOR_MATH_DOT_PRODUCT, "DOT_PRODUCT", 0, "Dot Product", "A dot B"},
240  {0, "", ICON_NONE, NULL, NULL},
241  {NODE_VECTOR_MATH_DISTANCE, "DISTANCE", 0, "Distance", "Distance between A and B"},
242  {NODE_VECTOR_MATH_LENGTH, "LENGTH", 0, "Length", "Length of A"},
243  {NODE_VECTOR_MATH_SCALE, "SCALE", 0, "Scale", "A multiplied by Scale"},
244  {NODE_VECTOR_MATH_NORMALIZE, "NORMALIZE", 0, "Normalize", "Normalize A"},
245  {0, "", ICON_NONE, NULL, NULL},
246  {NODE_VECTOR_MATH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Entry-wise absolute"},
247  {NODE_VECTOR_MATH_MINIMUM, "MINIMUM", 0, "Minimum", "Entry-wise minimum"},
248  {NODE_VECTOR_MATH_MAXIMUM, "MAXIMUM", 0, "Maximum", "Entry-wise maximum"},
249  {NODE_VECTOR_MATH_FLOOR, "FLOOR", 0, "Floor", "Entry-wise floor"},
250  {NODE_VECTOR_MATH_CEIL, "CEIL", 0, "Ceil", "Entry-wise ceil"},
251  {NODE_VECTOR_MATH_FRACTION, "FRACTION", 0, "Fraction", "The fraction part of A entry-wise"},
252  {NODE_VECTOR_MATH_MODULO, "MODULO", 0, "Modulo", "Entry-wise modulo using fmod(A,B)"},
253  {NODE_VECTOR_MATH_WRAP, "WRAP", 0, "Wrap", "Entry-wise wrap(A,B)"},
255  "SNAP",
256  0,
257  "Snap",
258  "Round A to the largest integer multiple of B less than or equal A"},
259  {0, "", ICON_NONE, NULL, NULL},
260  {NODE_VECTOR_MATH_SINE, "SINE", 0, "Sine", "Entry-wise sin(A)"},
261  {NODE_VECTOR_MATH_COSINE, "COSINE", 0, "Cosine", "Entry-wise cos(A)"},
262  {NODE_VECTOR_MATH_TANGENT, "TANGENT", 0, "Tangent", "Entry-wise tan(A)"},
263  {0, NULL, 0, NULL, NULL},
264 };
265 
267  {NODE_BOOLEAN_MATH_AND, "AND", 0, "And", "Outputs true only when both inputs are true"},
268  {NODE_BOOLEAN_MATH_OR, "OR", 0, "Or", "Outputs or when at least one of the inputs is true"},
269  {NODE_BOOLEAN_MATH_NOT, "NOT", 0, "Not", "Outputs the opposite of the input"},
270  {0, NULL, 0, NULL, NULL},
271 };
272 
275  "LESS_THAN",
276  0,
277  "Less Than",
278  "True when the first input is smaller than second input"},
280  "LESS_EQUAL",
281  0,
282  "Less Than or Equal",
283  "True when the first input is smaller than the second input or equal"},
285  "GREATER_THAN",
286  0,
287  "Greater Than",
288  "True when the first input is greater than the second input"},
290  "GREATER_EQUAL",
291  0,
292  "Greater Than or Equal",
293  "True when the first input is greater than the second input or equal"},
295  "EQUAL",
296  0,
297  "Equal",
298  "True when both inputs are approximately equal"},
300  "NOT_EQUAL",
301  0,
302  "Not Equal",
303  "True when both inputs are not approximately equal"},
304  {0, NULL, 0, NULL, NULL},
305 };
306 
309  "LINEAR",
310  0,
311  "Linear",
312  "Linear interpolation between From Min and From Max values"},
314  "STEPPED",
315  0,
316  "Stepped Linear",
317  "Stepped linear interpolation between From Min and From Max values"},
319  "SMOOTHSTEP",
320  0,
321  "Smooth Step",
322  "Smooth Hermite edge interpolation between From Min and From Max values"},
324  "SMOOTHERSTEP",
325  0,
326  "Smoother Step",
327  "Smoother Hermite edge interpolation between From Min and From Max values"},
328  {0, NULL, 0, NULL, NULL},
329 };
330 
332  {NODE_CLAMP_MINMAX, "MINMAX", 0, "Min Max", "Constrain value between min and max"},
334  "RANGE",
335  0,
336  "Range",
337  "Constrain value between min and max, swapping arguments when min > max"},
338  {0, NULL, 0, NULL, NULL},
339 };
340 
342  {1, "1D", 0, "1D", "Use the scalar value W as input"},
343  {2, "2D", 0, "2D", "Use the 2D vector (x, y) as input. The z component is ignored"},
344  {3, "3D", 0, "3D", "Use the 3D vector Vector as input"},
345  {4, "4D", 0, "4D", "Use the 4D vector (x, y, z, w) as input"},
346  {0, NULL, 0, NULL, NULL},
347 };
348 
350  {0, "SOFTEN", 0, "Soften", ""},
351  {1, "SHARPEN", 0, "Sharpen", ""},
352  {2, "LAPLACE", 0, "Laplace", ""},
353  {3, "SOBEL", 0, "Sobel", ""},
354  {4, "PREWITT", 0, "Prewitt", ""},
355  {5, "KIRSCH", 0, "Kirsch", ""},
356  {6, "SHADOW", 0, "Shadow", ""},
357  {0, NULL, 0, NULL, NULL},
358 };
359 
362  "REPLACE_CREATE",
363  ICON_NONE,
364  "Replace/Create",
365  "Replace the value and data type of an existing attribute, or create a new one"},
367  "ADD",
368  ICON_NONE,
369  "Add",
370  "Add the random values to the existing attribute values"},
372  "SUBTRACT",
373  ICON_NONE,
374  "Subtract",
375  "Subtract random values from the existing attribute values"},
377  "MULTIPLY",
378  ICON_NONE,
379  "Multiply",
380  "Multiply the existing attribute values with the random values"},
381  {0, NULL, 0, NULL, NULL},
382 };
383 
384 #ifndef RNA_RUNTIME
386  {0, "NEAREST", 0, "Nearest", ""},
387  {1, "BILINEAR", 0, "Bilinear", ""},
388  {2, "BICUBIC", 0, "Bicubic", ""},
389  {0, NULL, 0, NULL, NULL},
390 };
391 
394  "ALL",
395  0,
396  "All",
397  "Use shaders for all renderers and viewports, unless there exists a more specific output"},
398  {SHD_OUTPUT_EEVEE, "EEVEE", 0, "Eevee", "Use shaders for Eevee renderer"},
399  {SHD_OUTPUT_CYCLES, "CYCLES", 0, "Cycles", "Use shaders for Cycles renderer"},
400  {0, NULL, 0, NULL, NULL},
401 };
402 
404  {0, "CryptoObject", 0, "Object", "Use Object layer"},
405  {1, "CryptoMaterial", 0, "Material", "Use Material layer"},
406  {2, "CryptoAsset", 0, "Asset", "Use Asset layer"},
407  {0, NULL, 0, NULL, NULL},
408 };
409 
411  {GEO_NODE_MESH_CIRCLE_FILL_NONE, "NONE", 0, "None", ""},
412  {GEO_NODE_MESH_CIRCLE_FILL_NGON, "NGON", 0, "N-Gon", ""},
413  {GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN, "TRIANGLE_FAN", 0, "Triangles", ""},
414  {0, NULL, 0, NULL, NULL},
415 };
416 #endif
417 
418 #define ITEM_ATTRIBUTE \
419  { \
420  GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE, "ATTRIBUTE", 0, "Attribute", "" \
421  }
422 #define ITEM_FLOAT \
423  { \
424  GEO_NODE_ATTRIBUTE_INPUT_FLOAT, "FLOAT", 0, "Float", "" \
425  }
426 #define ITEM_VECTOR \
427  { \
428  GEO_NODE_ATTRIBUTE_INPUT_VECTOR, "VECTOR", 0, "Vector", "" \
429  }
430 #define ITEM_COLOR \
431  { \
432  GEO_NODE_ATTRIBUTE_INPUT_COLOR, "COLOR", 0, "Color", "" \
433  }
434 #define ITEM_BOOLEAN \
435  { \
436  GEO_NODE_ATTRIBUTE_INPUT_BOOLEAN, "BOOLEAN", 0, "Boolean", "" \
437  }
438 
439 /* Used in both runtime and static code. */
442  ITEM_FLOAT,
443  ITEM_VECTOR,
444  ITEM_COLOR,
445  ITEM_BOOLEAN,
446  {0, NULL, 0, NULL, NULL},
447 };
448 
449 #ifndef RNA_RUNTIME
450 
453  ITEM_VECTOR,
454  {0, NULL, 0, NULL, NULL},
455 };
458  ITEM_FLOAT,
459  ITEM_VECTOR,
460  {0, NULL, 0, NULL, NULL},
461 };
464  ITEM_FLOAT,
465  {0, NULL, 0, NULL, NULL},
466 };
469  ITEM_FLOAT,
470  ITEM_VECTOR,
471  ITEM_COLOR,
472  {0, NULL, 0, NULL, NULL},
473 };
474 
475 #endif
476 
477 #undef ITEM_ATTRIBUTE
478 #undef ITEM_FLOAT
479 #undef ITEM_VECTOR
480 #undef ITEM_COLOR
481 #undef ITEM_BOOLEAN
482 
483 #ifdef RNA_RUNTIME
484 
485 # include "BLI_linklist.h"
486 # include "BLI_string.h"
487 
488 # include "BKE_context.h"
489 # include "BKE_idprop.h"
490 
491 # include "BKE_global.h"
492 
493 # include "ED_node.h"
494 # include "ED_render.h"
495 
496 # include "GPU_material.h"
497 
498 # include "NOD_common.h"
499 # include "NOD_composite.h"
500 # include "NOD_geometry.h"
501 # include "NOD_shader.h"
502 # include "NOD_socket.h"
503 
504 # include "RE_engine.h"
505 # include "RE_pipeline.h"
506 
507 # include "DNA_scene_types.h"
508 # include "WM_api.h"
509 
510 static void rna_Node_socket_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr);
511 
513 {
514  int i = 0, result = -1;
515  NODE_TREE_TYPES_BEGIN (nt) {
516  if (nt == typeinfo) {
517  result = i;
518  break;
519  }
520  i++;
521  }
523  return result;
524 }
525 
526 int rna_node_tree_idname_to_enum(const char *idname)
527 {
528  int i = 0, result = -1;
529  NODE_TREE_TYPES_BEGIN (nt) {
530  if (STREQ(nt->idname, idname)) {
531  result = i;
532  break;
533  }
534  i++;
535  }
537  return result;
538 }
539 
541 {
542  int i = 0;
544  NODE_TREE_TYPES_BEGIN (nt) {
545  if (i == value) {
546  result = nt;
547  break;
548  }
549  i++;
550  }
552  return result;
553 }
554 
556  bool (*poll)(void *data, bNodeTreeType *),
557  bool *r_free)
558 {
559  EnumPropertyItem tmp = {0};
560  EnumPropertyItem *item = NULL;
561  int totitem = 0, i = 0;
562 
563  NODE_TREE_TYPES_BEGIN (nt) {
564  if (poll && !poll(data, nt)) {
565  i++;
566  continue;
567  }
568 
569  tmp.value = i;
570  tmp.identifier = nt->idname;
571  tmp.icon = nt->ui_icon;
572  tmp.name = nt->ui_name;
573  tmp.description = nt->ui_description;
574 
575  RNA_enum_item_add(&item, &totitem, &tmp);
576 
577  i++;
578  }
580 
581  if (totitem == 0) {
582  *r_free = false;
583  return DummyRNA_NULL_items;
584  }
585 
586  RNA_enum_item_end(&item, &totitem);
587  *r_free = true;
588 
589  return item;
590 }
591 
592 int rna_node_type_to_enum(bNodeType *typeinfo)
593 {
594  int i = 0, result = -1;
595  NODE_TYPES_BEGIN (ntype) {
596  if (ntype == typeinfo) {
597  result = i;
598  break;
599  }
600  i++;
601  }
603  return result;
604 }
605 
606 int rna_node_idname_to_enum(const char *idname)
607 {
608  int i = 0, result = -1;
609  NODE_TYPES_BEGIN (ntype) {
610  if (STREQ(ntype->idname, idname)) {
611  result = i;
612  break;
613  }
614  i++;
615  }
617  return result;
618 }
619 
621 {
622  int i = 0;
623  bNodeType *result = NULL;
624  NODE_TYPES_BEGIN (ntype) {
625  if (i == value) {
626  result = ntype;
627  break;
628  }
629  i++;
630  }
632  return result;
633 }
634 
636  bool (*poll)(void *data, bNodeType *),
637  bool *r_free)
638 {
639  EnumPropertyItem *item = NULL;
640  EnumPropertyItem tmp = {0};
641  int totitem = 0, i = 0;
642 
643  NODE_TYPES_BEGIN (ntype) {
644  if (poll && !poll(data, ntype)) {
645  i++;
646  continue;
647  }
648 
649  tmp.value = i;
650  tmp.identifier = ntype->idname;
651  tmp.icon = ntype->ui_icon;
652  tmp.name = ntype->ui_name;
653  tmp.description = ntype->ui_description;
654 
655  RNA_enum_item_add(&item, &totitem, &tmp);
656 
657  i++;
658  }
660 
661  if (totitem == 0) {
662  *r_free = false;
663  return DummyRNA_NULL_items;
664  }
665 
666  RNA_enum_item_end(&item, &totitem);
667  *r_free = true;
668 
669  return item;
670 }
671 
673 {
674  int i = 0, result = -1;
675  NODE_SOCKET_TYPES_BEGIN (stype) {
676  if (stype == typeinfo) {
677  result = i;
678  break;
679  }
680  i++;
681  }
683  return result;
684 }
685 
686 int rna_node_socket_idname_to_enum(const char *idname)
687 {
688  int i = 0, result = -1;
689  NODE_SOCKET_TYPES_BEGIN (stype) {
690  if (STREQ(stype->idname, idname)) {
691  result = i;
692  break;
693  }
694  i++;
695  }
697  return result;
698 }
699 
701 {
702  int i = 0;
704  NODE_SOCKET_TYPES_BEGIN (stype) {
705  if (i == value) {
706  result = stype;
707  break;
708  }
709  i++;
710  }
712  return result;
713 }
714 
716  bool (*poll)(void *data, bNodeSocketType *),
717  bool *r_free)
718 {
719  EnumPropertyItem *item = NULL;
720  EnumPropertyItem tmp = {0};
721  int totitem = 0, i = 0;
722  StructRNA *srna;
723 
724  NODE_SOCKET_TYPES_BEGIN (stype) {
725  if (poll && !poll(data, stype)) {
726  i++;
727  continue;
728  }
729 
730  srna = stype->ext_socket.srna;
731  tmp.value = i;
732  tmp.identifier = stype->idname;
733  tmp.icon = RNA_struct_ui_icon(srna);
734  tmp.name = RNA_struct_ui_name(srna);
736 
737  RNA_enum_item_add(&item, &totitem, &tmp);
738 
739  i++;
740  }
742 
743  if (totitem == 0) {
744  *r_free = false;
745  return DummyRNA_NULL_items;
746  }
747 
748  RNA_enum_item_end(&item, &totitem);
749  *r_free = true;
750 
751  return item;
752 }
753 
754 static const EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C),
755  PointerRNA *ptr,
756  PropertyRNA *UNUSED(prop),
757  bool *r_free)
758 {
759  EnumPropertyItem *item = NULL;
760  EnumPropertyItem tmp;
761  int totitem = 0;
762 
763  /* hack, don't want to add include path to RNA just for this, since in the future RNA types
764  * for nodes should be defined locally at runtime anyway ...
765  */
766 
767  tmp.value = NODE_CUSTOM;
768  tmp.identifier = "CUSTOM";
769  tmp.name = "Custom";
770  tmp.description = "Custom Node";
771  tmp.icon = ICON_NONE;
772  RNA_enum_item_add(&item, &totitem, &tmp);
773 
774  tmp.value = NODE_CUSTOM_GROUP;
775  tmp.identifier = "CUSTOM GROUP";
776  tmp.name = "CustomGroup";
777  tmp.description = "Custom Group Node";
778  tmp.icon = ICON_NONE;
779  RNA_enum_item_add(&item, &totitem, &tmp);
780 
781  tmp.value = NODE_UNDEFINED;
782  tmp.identifier = "UNDEFINED";
783  tmp.name = "UNDEFINED";
784  tmp.description = "";
785  tmp.icon = ICON_NONE;
786  RNA_enum_item_add(&item, &totitem, &tmp);
787 
788 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
789  if (STREQ(#Category, "Node")) { \
790  tmp.value = ID; \
791  tmp.identifier = EnumName; \
792  tmp.name = UIName; \
793  tmp.description = UIDesc; \
794  tmp.icon = ICON_NONE; \
795  RNA_enum_item_add(&item, &totitem, &tmp); \
796  }
797 # include "../../nodes/NOD_static_types.h"
798 # undef DefNode
799 
801 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
802  if (STREQ(#Category, "ShaderNode")) { \
803  tmp.value = ID; \
804  tmp.identifier = EnumName; \
805  tmp.name = UIName; \
806  tmp.description = UIDesc; \
807  tmp.icon = ICON_NONE; \
808  RNA_enum_item_add(&item, &totitem, &tmp); \
809  }
810 # include "../../nodes/NOD_static_types.h"
811 # undef DefNode
812  }
813 
815 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
816  if (STREQ(#Category, "CompositorNode")) { \
817  tmp.value = ID; \
818  tmp.identifier = EnumName; \
819  tmp.name = UIName; \
820  tmp.description = UIDesc; \
821  tmp.icon = ICON_NONE; \
822  RNA_enum_item_add(&item, &totitem, &tmp); \
823  }
824 # include "../../nodes/NOD_static_types.h"
825 # undef DefNode
826  }
827 
829 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
830  if (STREQ(#Category, "TextureNode")) { \
831  tmp.value = ID; \
832  tmp.identifier = EnumName; \
833  tmp.name = UIName; \
834  tmp.description = UIDesc; \
835  tmp.icon = ICON_NONE; \
836  RNA_enum_item_add(&item, &totitem, &tmp); \
837  }
838 # include "../../nodes/NOD_static_types.h"
839 # undef DefNode
840  }
841 
843 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
844  if (STREQ(#Category, "GeometryNode")) { \
845  tmp.value = ID; \
846  tmp.identifier = EnumName; \
847  tmp.name = UIName; \
848  tmp.description = UIDesc; \
849  tmp.icon = ICON_NONE; \
850  RNA_enum_item_add(&item, &totitem, &tmp); \
851  }
852 # include "../../nodes/NOD_static_types.h"
853 # undef DefNode
854  }
855 
857 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
858  if (STREQ(#Category, "FunctionNode")) { \
859  tmp.value = ID; \
860  tmp.identifier = EnumName; \
861  tmp.name = UIName; \
862  tmp.description = UIDesc; \
863  tmp.icon = ICON_NONE; \
864  RNA_enum_item_add(&item, &totitem, &tmp); \
865  }
866 # include "../../nodes/NOD_static_types.h"
867 # undef DefNode
868  }
869 
870  RNA_enum_item_end(&item, &totitem);
871  *r_free = true;
872 
873  return item;
874 }
875 
876 /* ******** Node Tree ******** */
877 
878 static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr)
879 {
881 
883  return ntree->typeinfo->rna_ext.srna;
884  }
885  else {
886  return &RNA_NodeTree;
887  }
888 }
889 
890 static bool rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype)
891 {
892  extern FunctionRNA rna_NodeTree_poll_func;
893 
894  PointerRNA ptr;
895  ParameterList list;
896  FunctionRNA *func;
897  void *ret;
898  bool visible;
899 
900  RNA_pointer_create(NULL, ntreetype->rna_ext.srna, NULL, &ptr); /* dummy */
901  func = &rna_NodeTree_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
902 
903  RNA_parameter_list_create(&list, &ptr, func);
904  RNA_parameter_set_lookup(&list, "context", &C);
905  ntreetype->rna_ext.call((bContext *)C, &ptr, func, &list);
906 
907  RNA_parameter_get_lookup(&list, "visible", &ret);
908  visible = *(bool *)ret;
909 
911 
912  return visible;
913 }
914 
915 static void rna_NodeTree_update_reg(bNodeTree *ntree)
916 {
917  extern FunctionRNA rna_NodeTree_update_func;
918 
919  PointerRNA ptr;
920  ParameterList list;
921  FunctionRNA *func;
922 
924  func = &rna_NodeTree_update_func; /* RNA_struct_find_function(&ptr, "update"); */
925 
926  RNA_parameter_list_create(&list, &ptr, func);
927  ntree->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
928 
930 }
931 
932 static void rna_NodeTree_get_from_context(
933  const bContext *C, bNodeTreeType *ntreetype, bNodeTree **r_ntree, ID **r_id, ID **r_from)
934 {
935  extern FunctionRNA rna_NodeTree_get_from_context_func;
936 
937  PointerRNA ptr;
938  ParameterList list;
939  FunctionRNA *func;
940  void *ret1, *ret2, *ret3;
941 
942  RNA_pointer_create(NULL, ntreetype->rna_ext.srna, NULL, &ptr); /* dummy */
943  /* RNA_struct_find_function(&ptr, "get_from_context"); */
944  func = &rna_NodeTree_get_from_context_func;
945 
946  RNA_parameter_list_create(&list, &ptr, func);
947  RNA_parameter_set_lookup(&list, "context", &C);
948  ntreetype->rna_ext.call((bContext *)C, &ptr, func, &list);
949 
950  RNA_parameter_get_lookup(&list, "result_1", &ret1);
951  RNA_parameter_get_lookup(&list, "result_2", &ret2);
952  RNA_parameter_get_lookup(&list, "result_3", &ret3);
953  *r_ntree = *(bNodeTree **)ret1;
954  *r_id = *(ID **)ret2;
955  *r_from = *(ID **)ret3;
956 
958 }
959 
960 static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type)
961 {
963 
964  if (!nt) {
965  return;
966  }
967 
970 
971  ntreeTypeFreeLink(nt);
972 
973  /* update while blender is running */
975 }
976 
977 static StructRNA *rna_NodeTree_register(Main *bmain,
978  ReportList *reports,
979  void *data,
980  const char *identifier,
981  StructValidateFunc validate,
982  StructCallbackFunc call,
984 {
985  bNodeTreeType *nt, dummynt;
986  bNodeTree dummyntree;
987  PointerRNA dummyptr;
988  int have_function[3];
989 
990  /* setup dummy tree & tree type to store static properties in */
991  memset(&dummynt, 0, sizeof(bNodeTreeType));
992  memset(&dummyntree, 0, sizeof(bNodeTree));
993  dummyntree.typeinfo = &dummynt;
994  RNA_pointer_create(NULL, &RNA_NodeTree, &dummyntree, &dummyptr);
995 
996  /* validate the python class */
997  if (validate(&dummyptr, data, have_function) != 0) {
998  return NULL;
999  }
1000 
1001  if (strlen(identifier) >= sizeof(dummynt.idname)) {
1002  BKE_reportf(reports,
1003  RPT_ERROR,
1004  "Registering node tree class: '%s' is too long, maximum length is %d",
1005  identifier,
1006  (int)sizeof(dummynt.idname));
1007  return NULL;
1008  }
1009 
1010  /* check if we have registered this tree type before, and remove it */
1011  nt = ntreeTypeFind(dummynt.idname);
1012  if (nt) {
1013  rna_NodeTree_unregister(bmain, nt->rna_ext.srna);
1014  }
1015 
1016  /* create a new node tree type */
1017  nt = MEM_mallocN(sizeof(bNodeTreeType), "node tree type");
1018  memcpy(nt, &dummynt, sizeof(dummynt));
1019 
1020  nt->type = NTREE_CUSTOM;
1021 
1023  nt->rna_ext.data = data;
1024  nt->rna_ext.call = call;
1025  nt->rna_ext.free = free;
1027 
1030 
1031  nt->poll = (have_function[0]) ? rna_NodeTree_poll : NULL;
1032  nt->update = (have_function[1]) ? rna_NodeTree_update_reg : NULL;
1033  nt->get_from_context = (have_function[2]) ? rna_NodeTree_get_from_context : NULL;
1034 
1035  ntreeTypeAdd(nt);
1036 
1037  /* update while blender is running */
1039 
1040  return nt->rna_ext.srna;
1041 }
1042 
1043 static bool rna_NodeTree_check(bNodeTree *ntree, ReportList *reports)
1044 {
1045  if (!ntreeIsRegistered(ntree)) {
1046  if (reports) {
1047  BKE_reportf(reports,
1048  RPT_ERROR,
1049  "Node tree '%s' has undefined type %s",
1050  ntree->id.name + 2,
1051  ntree->idname);
1052  }
1053  return false;
1054  }
1055  else {
1056  return true;
1057  }
1058 }
1059 
1060 static void rna_NodeTree_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1061 {
1063 
1066 
1068 }
1069 
1070 static bNode *rna_NodeTree_node_new(bNodeTree *ntree,
1071  bContext *C,
1072  ReportList *reports,
1073  const char *type)
1074 {
1075  bNodeType *ntype;
1076  bNode *node;
1077 
1078  if (!rna_NodeTree_check(ntree, reports)) {
1079  return NULL;
1080  }
1081 
1082  ntype = nodeTypeFind(type);
1083  if (!ntype) {
1084  BKE_reportf(reports, RPT_ERROR, "Node type %s undefined", type);
1085  return NULL;
1086  }
1087 
1088  const char *disabled_hint = NULL;
1089  if (ntype->poll && !ntype->poll(ntype, ntree, &disabled_hint)) {
1090  if (disabled_hint) {
1091  BKE_reportf(reports,
1092  RPT_ERROR,
1093  "Cannot add node of type %s to node tree '%s'\n %s",
1094  type,
1095  ntree->id.name + 2,
1096  disabled_hint);
1097  return NULL;
1098  }
1099  else {
1100  BKE_reportf(reports,
1101  RPT_ERROR,
1102  "Cannot add node of type %s to node tree '%s'",
1103  type,
1104  ntree->id.name + 2);
1105  return NULL;
1106  }
1107  }
1108 
1109  node = nodeAddNode(C, ntree, type);
1110  BLI_assert(node && node->typeinfo);
1111 
1112  if (ntree->type == NTREE_TEXTURE) {
1114  }
1115 
1117  nodeUpdate(ntree, node);
1119 
1120  return node;
1121 }
1122 
1123 static void rna_NodeTree_node_remove(bNodeTree *ntree,
1124  Main *bmain,
1125  ReportList *reports,
1126  PointerRNA *node_ptr)
1127 {
1128  bNode *node = node_ptr->data;
1129 
1130  if (!rna_NodeTree_check(ntree, reports)) {
1131  return;
1132  }
1133 
1134  if (BLI_findindex(&ntree->nodes, node) == -1) {
1135  BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name);
1136  return;
1137  }
1138 
1139  nodeRemoveNode(bmain, ntree, node, true);
1140 
1141  RNA_POINTER_INVALIDATE(node_ptr);
1142 
1143  ntreeUpdateTree(bmain, ntree); /* update group node socket links */
1145 }
1146 
1147 static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1148 {
1149  bNode *node = ntree->nodes.first;
1150 
1151  if (!rna_NodeTree_check(ntree, reports)) {
1152  return;
1153  }
1154 
1155  while (node) {
1156  bNode *next_node = node->next;
1157 
1158  nodeRemoveNode(bmain, ntree, node, true);
1159 
1160  node = next_node;
1161  }
1162 
1163  ntreeUpdateTree(bmain, ntree);
1164 
1166 }
1167 
1168 static PointerRNA rna_NodeTree_active_node_get(PointerRNA *ptr)
1169 {
1170  bNodeTree *ntree = (bNodeTree *)ptr->data;
1173 }
1174 
1175 static void rna_NodeTree_active_node_set(PointerRNA *ptr,
1176  const PointerRNA value,
1177  struct ReportList *UNUSED(reports))
1178 {
1179  bNodeTree *ntree = (bNodeTree *)ptr->data;
1180  bNode *node = (bNode *)value.data;
1181 
1182  if (node && BLI_findindex(&ntree->nodes, node) != -1) {
1184  }
1185  else {
1187  }
1188 }
1189 
1190 static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree,
1191  Main *bmain,
1192  ReportList *reports,
1193  bNodeSocket *fromsock,
1194  bNodeSocket *tosock,
1195  bool verify_limits)
1196 {
1197  bNodeLink *ret;
1198  bNode *fromnode = NULL, *tonode = NULL;
1199 
1200  if (!rna_NodeTree_check(ntree, reports)) {
1201  return NULL;
1202  }
1203 
1204  nodeFindNode(ntree, fromsock, &fromnode, NULL);
1205  nodeFindNode(ntree, tosock, &tonode, NULL);
1206  /* check validity of the sockets:
1207  * if sockets from different trees are passed in this will fail!
1208  */
1209  if (!fromnode || !tonode) {
1210  return NULL;
1211  }
1212 
1213  if (&fromsock->in_out == &tosock->in_out) {
1214  BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets");
1215  return NULL;
1216  }
1217 
1218  if (verify_limits) {
1219  /* remove other socket links if limit is exceeded */
1220  if (nodeCountSocketLinks(ntree, fromsock) + 1 > nodeSocketLinkLimit(fromsock)) {
1221  nodeRemSocketLinks(ntree, fromsock);
1222  }
1223  if (nodeCountSocketLinks(ntree, tosock) + 1 > nodeSocketLinkLimit(tosock)) {
1224  nodeRemSocketLinks(ntree, tosock);
1225  }
1226  if (tosock->flag & SOCK_MULTI_INPUT) {
1228  if (link->fromsock == fromsock && link->tosock == tosock) {
1229  nodeRemLink(ntree, link);
1230  }
1231  }
1232  }
1233  }
1234 
1235  ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock);
1236 
1237  if (ret) {
1238 
1239  /* not an issue from the UI, clear hidden from API to keep valid state. */
1240  fromsock->flag &= ~SOCK_HIDDEN;
1241  tosock->flag &= ~SOCK_HIDDEN;
1242 
1243  if (tonode) {
1244  nodeUpdate(ntree, tonode);
1245  }
1246 
1247  ntreeUpdateTree(bmain, ntree);
1248 
1249  ED_node_tag_update_nodetree(bmain, ntree, ret->tonode);
1251  }
1252  return ret;
1253 }
1254 
1255 static void rna_NodeTree_link_remove(bNodeTree *ntree,
1256  Main *bmain,
1257  ReportList *reports,
1258  PointerRNA *link_ptr)
1259 {
1260  bNodeLink *link = link_ptr->data;
1261 
1262  if (!rna_NodeTree_check(ntree, reports)) {
1263  return;
1264  }
1265 
1266  if (BLI_findindex(&ntree->links, link) == -1) {
1267  BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree");
1268  return;
1269  }
1270 
1271  nodeRemLink(ntree, link);
1272  RNA_POINTER_INVALIDATE(link_ptr);
1273 
1274  ntreeUpdateTree(bmain, ntree);
1276 }
1277 
1278 static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1279 {
1280  bNodeLink *link = ntree->links.first;
1281 
1282  if (!rna_NodeTree_check(ntree, reports)) {
1283  return;
1284  }
1285 
1286  while (link) {
1287  bNodeLink *next_link = link->next;
1288 
1289  nodeRemLink(ntree, link);
1290 
1291  link = next_link;
1292  }
1293  ntreeUpdateTree(bmain, ntree);
1294 
1296 }
1297 
1298 static int rna_NodeTree_active_input_get(PointerRNA *ptr)
1299 {
1300  bNodeTree *ntree = (bNodeTree *)ptr->data;
1301  int index = 0;
1302  LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->inputs, index) {
1303  if (socket->flag & SELECT) {
1304  return index;
1305  }
1306  }
1307  return -1;
1308 }
1309 
1310 static void rna_NodeTree_active_input_set(PointerRNA *ptr, int value)
1311 {
1312  bNodeTree *ntree = (bNodeTree *)ptr->data;
1313 
1314  int index = 0;
1315  LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->inputs, index) {
1316  SET_FLAG_FROM_TEST(socket->flag, index == value, SELECT);
1317  }
1318 }
1319 
1320 static int rna_NodeTree_active_output_get(PointerRNA *ptr)
1321 {
1322  bNodeTree *ntree = (bNodeTree *)ptr->data;
1323  int index = 0;
1324  LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->outputs, index) {
1325  if (socket->flag & SELECT) {
1326  return index;
1327  }
1328  }
1329  return -1;
1330 }
1331 
1332 static void rna_NodeTree_active_output_set(PointerRNA *ptr, int value)
1333 {
1334  bNodeTree *ntree = (bNodeTree *)ptr->data;
1335 
1336  int index = 0;
1337  LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->outputs, index) {
1338  SET_FLAG_FROM_TEST(socket->flag, index == value, SELECT);
1339  }
1340 }
1341 
1342 static bNodeSocket *rna_NodeTree_inputs_new(
1343  bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
1344 {
1345  if (!rna_NodeTree_check(ntree, reports)) {
1346  return NULL;
1347  }
1348 
1350 
1351  ntreeUpdateTree(bmain, ntree);
1353 
1354  return sock;
1355 }
1356 
1357 static bNodeSocket *rna_NodeTree_outputs_new(
1358  bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
1359 {
1360  if (!rna_NodeTree_check(ntree, reports)) {
1361  return NULL;
1362  }
1363 
1365 
1366  ntreeUpdateTree(bmain, ntree);
1368 
1369  return sock;
1370 }
1371 
1372 static void rna_NodeTree_socket_remove(bNodeTree *ntree,
1373  Main *bmain,
1374  ReportList *reports,
1375  bNodeSocket *sock)
1376 {
1377  if (!rna_NodeTree_check(ntree, reports)) {
1378  return;
1379  }
1380 
1381  if (BLI_findindex(&ntree->inputs, sock) == -1 && BLI_findindex(&ntree->outputs, sock) == -1) {
1382  BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
1383  }
1384  else {
1386 
1387  ntreeUpdateTree(bmain, ntree);
1388  DEG_id_tag_update(&ntree->id, 0);
1390  }
1391 }
1392 
1393 static void rna_NodeTree_inputs_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1394 {
1395  if (!rna_NodeTree_check(ntree, reports)) {
1396  return;
1397  }
1398 
1401  }
1402 
1403  ntreeUpdateTree(bmain, ntree);
1405 }
1406 
1407 static void rna_NodeTree_outputs_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
1408 {
1409  if (!rna_NodeTree_check(ntree, reports)) {
1410  return;
1411  }
1412 
1415  }
1416 
1417  ntreeUpdateTree(bmain, ntree);
1419 }
1420 
1421 static void rna_NodeTree_inputs_move(bNodeTree *ntree, Main *bmain, int from_index, int to_index)
1422 {
1423  if (from_index == to_index) {
1424  return;
1425  }
1426  if (from_index < 0 || to_index < 0) {
1427  return;
1428  }
1429 
1430  bNodeSocket *sock = BLI_findlink(&ntree->inputs, from_index);
1431  if (to_index < from_index) {
1432  bNodeSocket *nextsock = BLI_findlink(&ntree->inputs, to_index);
1433  if (nextsock) {
1434  BLI_remlink(&ntree->inputs, sock);
1435  BLI_insertlinkbefore(&ntree->inputs, nextsock, sock);
1436  }
1437  }
1438  else {
1439  bNodeSocket *prevsock = BLI_findlink(&ntree->inputs, to_index);
1440  if (prevsock) {
1441  BLI_remlink(&ntree->inputs, sock);
1442  BLI_insertlinkafter(&ntree->inputs, prevsock, sock);
1443  }
1444  }
1445 
1447 
1448  ntreeUpdateTree(bmain, ntree);
1450 }
1451 
1452 static void rna_NodeTree_outputs_move(bNodeTree *ntree, Main *bmain, int from_index, int to_index)
1453 {
1454  if (from_index == to_index) {
1455  return;
1456  }
1457  if (from_index < 0 || to_index < 0) {
1458  return;
1459  }
1460 
1461  bNodeSocket *sock = BLI_findlink(&ntree->outputs, from_index);
1462  if (to_index < from_index) {
1463  bNodeSocket *nextsock = BLI_findlink(&ntree->outputs, to_index);
1464  if (nextsock) {
1465  BLI_remlink(&ntree->outputs, sock);
1466  BLI_insertlinkbefore(&ntree->outputs, nextsock, sock);
1467  }
1468  }
1469  else {
1470  bNodeSocket *prevsock = BLI_findlink(&ntree->outputs, to_index);
1471  if (prevsock) {
1472  BLI_remlink(&ntree->outputs, sock);
1473  BLI_insertlinkafter(&ntree->outputs, prevsock, sock);
1474  }
1475  }
1476 
1478 
1479  ntreeUpdateTree(bmain, ntree);
1481 }
1482 
1483 static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C)
1484 {
1485  Main *bmain = CTX_data_main(C);
1486 
1488  ntreeUpdateTree(bmain, ntree);
1489 
1491 }
1492 
1493 /* ******** NodeLink ******** */
1494 
1495 static bool rna_NodeLink_is_hidden_get(PointerRNA *ptr)
1496 {
1497  bNodeLink *link = ptr->data;
1498  return nodeLinkIsHidden(link);
1499 }
1500 
1501 /* ******** Node ******** */
1502 
1503 static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
1504 {
1505  bNode *node = (bNode *)ptr->data;
1506 
1507  if (node->typeinfo->rna_ext.srna) {
1508  return node->typeinfo->rna_ext.srna;
1509  }
1510  else {
1511  return ptr->type;
1512  }
1513 }
1514 
1515 static char *rna_Node_path(PointerRNA *ptr)
1516 {
1517  bNode *node = (bNode *)ptr->data;
1518  char name_esc[sizeof(node->name) * 2];
1519 
1520  BLI_str_escape(name_esc, node->name, sizeof(name_esc));
1521  return BLI_sprintfN("nodes[\"%s\"]", name_esc);
1522 }
1523 
1525 {
1527  bNode *node;
1528  char name_esc[sizeof(node->name) * 2];
1529 
1530  for (node = ntree->nodes.first; node; node = node->next) {
1531  if (node->type == SH_NODE_TEX_ENVIRONMENT) {
1532  NodeTexEnvironment *data = node->storage;
1533  if (&data->iuser != ptr->data) {
1534  continue;
1535  }
1536  }
1537  else if (node->type == SH_NODE_TEX_IMAGE) {
1538  NodeTexImage *data = node->storage;
1539  if (&data->iuser != ptr->data) {
1540  continue;
1541  }
1542  }
1543  else {
1544  continue;
1545  }
1546 
1547  BLI_str_escape(name_esc, node->name, sizeof(name_esc));
1548  return BLI_sprintfN("nodes[\"%s\"].image_user", name_esc);
1549  }
1550 
1551  return NULL;
1552 }
1553 
1554 static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree, const char **UNUSED(r_disabled_hint))
1555 {
1556  extern FunctionRNA rna_Node_poll_func;
1557 
1558  PointerRNA ptr;
1559  ParameterList list;
1560  FunctionRNA *func;
1561  void *ret;
1562  bool visible;
1563 
1564  RNA_pointer_create(NULL, ntype->rna_ext.srna, NULL, &ptr); /* dummy */
1565  func = &rna_Node_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
1566 
1567  RNA_parameter_list_create(&list, &ptr, func);
1568  RNA_parameter_set_lookup(&list, "node_tree", &ntree);
1569  ntype->rna_ext.call(NULL, &ptr, func, &list);
1570 
1571  RNA_parameter_get_lookup(&list, "visible", &ret);
1572  visible = *(bool *)ret;
1573 
1574  RNA_parameter_list_free(&list);
1575 
1576  return visible;
1577 }
1578 
1579 static bool rna_Node_poll_instance(bNode *node,
1580  bNodeTree *ntree,
1581  const char **UNUSED(disabled_info))
1582 {
1583  extern FunctionRNA rna_Node_poll_instance_func;
1584 
1585  PointerRNA ptr;
1586  ParameterList list;
1587  FunctionRNA *func;
1588  void *ret;
1589  bool visible;
1590 
1591  RNA_pointer_create(NULL, node->typeinfo->rna_ext.srna, node, &ptr); /* dummy */
1592  func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */
1593 
1594  RNA_parameter_list_create(&list, &ptr, func);
1595  RNA_parameter_set_lookup(&list, "node_tree", &ntree);
1596  node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
1597 
1598  RNA_parameter_get_lookup(&list, "visible", &ret);
1599  visible = *(bool *)ret;
1600 
1601  RNA_parameter_list_free(&list);
1602 
1603  return visible;
1604 }
1605 
1606 static bool rna_Node_poll_instance_default(bNode *node,
1607  bNodeTree *ntree,
1608  const char **disabled_info)
1609 {
1610  /* use the basic poll function */
1611  return rna_Node_poll(node->typeinfo, ntree, disabled_info);
1612 }
1613 
1614 static void rna_Node_update_reg(bNodeTree *ntree, bNode *node)
1615 {
1616  extern FunctionRNA rna_Node_update_func;
1617 
1618  PointerRNA ptr;
1619  ParameterList list;
1620  FunctionRNA *func;
1621 
1622  RNA_pointer_create((ID *)ntree, node->typeinfo->rna_ext.srna, node, &ptr);
1623  func = &rna_Node_update_func; /* RNA_struct_find_function(&ptr, "update"); */
1624 
1625  RNA_parameter_list_create(&list, &ptr, func);
1626  node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
1627 
1628  RNA_parameter_list_free(&list);
1629 }
1630 
1631 static void rna_Node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
1632 {
1633  extern FunctionRNA rna_Node_insert_link_func;
1634 
1635  PointerRNA ptr;
1636  ParameterList list;
1637  FunctionRNA *func;
1638 
1639  RNA_pointer_create((ID *)ntree, node->typeinfo->rna_ext.srna, node, &ptr);
1640  func = &rna_Node_insert_link_func;
1641 
1642  RNA_parameter_list_create(&list, &ptr, func);
1643  RNA_parameter_set_lookup(&list, "link", &link);
1644  node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
1645 
1646  RNA_parameter_list_free(&list);
1647 }
1648 
1649 static void rna_Node_init(const bContext *C, PointerRNA *ptr)
1650 {
1651  extern FunctionRNA rna_Node_init_func;
1652 
1653  bNode *node = (bNode *)ptr->data;
1654  ParameterList list;
1655  FunctionRNA *func;
1656 
1657  func = &rna_Node_init_func; /* RNA_struct_find_function(&ptr, "init"); */
1658 
1659  RNA_parameter_list_create(&list, ptr, func);
1660  node->typeinfo->rna_ext.call((bContext *)C, ptr, func, &list);
1661 
1662  RNA_parameter_list_free(&list);
1663 }
1664 
1665 static void rna_Node_copy(PointerRNA *ptr, const struct bNode *copynode)
1666 {
1667  extern FunctionRNA rna_Node_copy_func;
1668 
1669  bNode *node = (bNode *)ptr->data;
1670  ParameterList list;
1671  FunctionRNA *func;
1672 
1673  func = &rna_Node_copy_func; /* RNA_struct_find_function(&ptr, "copy"); */
1674 
1675  RNA_parameter_list_create(&list, ptr, func);
1676  RNA_parameter_set_lookup(&list, "node", &copynode);
1677  node->typeinfo->rna_ext.call(NULL, ptr, func, &list);
1678 
1679  RNA_parameter_list_free(&list);
1680 }
1681 
1682 static void rna_Node_free(PointerRNA *ptr)
1683 {
1684  extern FunctionRNA rna_Node_free_func;
1685 
1686  bNode *node = (bNode *)ptr->data;
1687  ParameterList list;
1688  FunctionRNA *func;
1689 
1690  func = &rna_Node_free_func; /* RNA_struct_find_function(&ptr, "free"); */
1691 
1692  RNA_parameter_list_create(&list, ptr, func);
1693  node->typeinfo->rna_ext.call(NULL, ptr, func, &list);
1694 
1695  RNA_parameter_list_free(&list);
1696 }
1697 
1698 static void rna_Node_draw_buttons(struct uiLayout *layout, bContext *C, PointerRNA *ptr)
1699 {
1700  extern FunctionRNA rna_Node_draw_buttons_func;
1701 
1702  bNode *node = (bNode *)ptr->data;
1703  ParameterList list;
1704  FunctionRNA *func;
1705 
1706  func = &rna_Node_draw_buttons_func; /* RNA_struct_find_function(&ptr, "draw_buttons"); */
1707 
1708  RNA_parameter_list_create(&list, ptr, func);
1709  RNA_parameter_set_lookup(&list, "context", &C);
1710  RNA_parameter_set_lookup(&list, "layout", &layout);
1711  node->typeinfo->rna_ext.call(C, ptr, func, &list);
1712 
1713  RNA_parameter_list_free(&list);
1714 }
1715 
1716 static void rna_Node_draw_buttons_ext(struct uiLayout *layout, bContext *C, PointerRNA *ptr)
1717 {
1718  extern FunctionRNA rna_Node_draw_buttons_ext_func;
1719 
1720  bNode *node = (bNode *)ptr->data;
1721  ParameterList list;
1722  FunctionRNA *func;
1723 
1724  func = &rna_Node_draw_buttons_ext_func; /* RNA_struct_find_function(&ptr, "draw_buttons_ext"); */
1725 
1726  RNA_parameter_list_create(&list, ptr, func);
1727  RNA_parameter_set_lookup(&list, "context", &C);
1728  RNA_parameter_set_lookup(&list, "layout", &layout);
1729  node->typeinfo->rna_ext.call(C, ptr, func, &list);
1730 
1731  RNA_parameter_list_free(&list);
1732 }
1733 
1734 static void rna_Node_draw_label(bNodeTree *ntree, bNode *node, char *label, int maxlen)
1735 {
1736  extern FunctionRNA rna_Node_draw_label_func;
1737 
1738  PointerRNA ptr;
1739  ParameterList list;
1740  FunctionRNA *func;
1741  void *ret;
1742  char *rlabel;
1743 
1744  func = &rna_Node_draw_label_func; /* RNA_struct_find_function(&ptr, "draw_label"); */
1745 
1747  RNA_parameter_list_create(&list, &ptr, func);
1748  node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
1749 
1750  RNA_parameter_get_lookup(&list, "label", &ret);
1751  rlabel = (char *)ret;
1752  BLI_strncpy(label, rlabel != NULL ? rlabel : "", maxlen);
1753 
1754  RNA_parameter_list_free(&list);
1755 }
1756 
1757 static bool rna_Node_is_registered_node_type(StructRNA *type)
1758 {
1759  return (RNA_struct_blender_type_get(type) != NULL);
1760 }
1761 
1762 static void rna_Node_is_registered_node_type_runtime(bContext *UNUSED(C),
1763  ReportList *UNUSED(reports),
1764  PointerRNA *ptr,
1765  ParameterList *parms)
1766 {
1768  RNA_parameter_set_lookup(parms, "result", &result);
1769 }
1770 
1771 static void rna_Node_unregister(Main *UNUSED(bmain), StructRNA *type)
1772 {
1774 
1775  if (!nt) {
1776  return;
1777  }
1778 
1781 
1782  /* this also frees the allocated nt pointer, no MEM_free call needed! */
1783  nodeUnregisterType(nt);
1784 
1785  /* update while blender is running */
1787 }
1788 
1789 /* Generic internal registration function.
1790  * Can be used to implement callbacks for registerable RNA node subtypes.
1791  */
1792 static bNodeType *rna_Node_register_base(Main *bmain,
1793  ReportList *reports,
1794  StructRNA *basetype,
1795  void *data,
1796  const char *identifier,
1797  StructValidateFunc validate,
1798  StructCallbackFunc call,
1800 {
1801  bNodeType *nt, dummynt;
1802  bNode dummynode;
1803  PointerRNA dummyptr;
1804  FunctionRNA *func;
1805  PropertyRNA *parm;
1806  int have_function[10];
1807 
1808  /* setup dummy node & node type to store static properties in */
1809  memset(&dummynt, 0, sizeof(bNodeType));
1810  /* this does some additional initialization of default values */
1811  node_type_base_custom(&dummynt, identifier, "", 0, 0);
1812 
1813  memset(&dummynode, 0, sizeof(bNode));
1814  dummynode.typeinfo = &dummynt;
1815  RNA_pointer_create(NULL, basetype, &dummynode, &dummyptr);
1816 
1817  /* validate the python class */
1818  if (validate(&dummyptr, data, have_function) != 0) {
1819  return NULL;
1820  }
1821 
1822  if (strlen(identifier) >= sizeof(dummynt.idname)) {
1823  BKE_reportf(reports,
1824  RPT_ERROR,
1825  "Registering node class: '%s' is too long, maximum length is %d",
1826  identifier,
1827  (int)sizeof(dummynt.idname));
1828  return NULL;
1829  }
1830 
1831  /* check if we have registered this node type before, and remove it */
1832  nt = nodeTypeFind(dummynt.idname);
1833  if (nt) {
1834  rna_Node_unregister(bmain, nt->rna_ext.srna);
1835  }
1836 
1837  /* create a new node type */
1838  nt = MEM_mallocN(sizeof(bNodeType), "node type");
1839  memcpy(nt, &dummynt, sizeof(dummynt));
1840  nt->free_self = (void (*)(bNodeType *))MEM_freeN;
1841 
1842  nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, basetype);
1843  nt->rna_ext.data = data;
1844  nt->rna_ext.call = call;
1845  nt->rna_ext.free = free;
1847 
1850 
1851  func = RNA_def_function_runtime(
1852  nt->rna_ext.srna, "is_registered_node_type", rna_Node_is_registered_node_type_runtime);
1853  RNA_def_function_ui_description(func, "True if a registered node type");
1855  parm = RNA_def_boolean(func, "result", false, "Result", "");
1856  RNA_def_function_return(func, parm);
1857 
1858  /* XXX bad level call! needed to initialize the basic draw functions ... */
1860 
1861  nt->poll = (have_function[0]) ? rna_Node_poll : NULL;
1862  nt->poll_instance = (have_function[1]) ? rna_Node_poll_instance : rna_Node_poll_instance_default;
1863  nt->updatefunc = (have_function[2]) ? rna_Node_update_reg : NULL;
1864  nt->insert_link = (have_function[3]) ? rna_Node_insert_link : NULL;
1865  nt->initfunc_api = (have_function[4]) ? rna_Node_init : NULL;
1866  nt->copyfunc_api = (have_function[5]) ? rna_Node_copy : NULL;
1867  nt->freefunc_api = (have_function[6]) ? rna_Node_free : NULL;
1868  nt->draw_buttons = (have_function[7]) ? rna_Node_draw_buttons : NULL;
1869  nt->draw_buttons_ex = (have_function[8]) ? rna_Node_draw_buttons_ext : NULL;
1870  nt->labelfunc = (have_function[9]) ? rna_Node_draw_label : NULL;
1871 
1872  /* sanitize size values in case not all have been registered */
1873  if (nt->maxwidth < nt->minwidth) {
1874  nt->maxwidth = nt->minwidth;
1875  }
1876  if (nt->maxheight < nt->minheight) {
1877  nt->maxheight = nt->minheight;
1878  }
1879  CLAMP(nt->width, nt->minwidth, nt->maxwidth);
1880  CLAMP(nt->height, nt->minheight, nt->maxheight);
1881 
1882  return nt;
1883 }
1884 
1885 static StructRNA *rna_Node_register(Main *bmain,
1886  ReportList *reports,
1887  void *data,
1888  const char *identifier,
1889  StructValidateFunc validate,
1890  StructCallbackFunc call,
1892 {
1893  bNodeType *nt = rna_Node_register_base(
1894  bmain, reports, &RNA_Node, data, identifier, validate, call, free);
1895  if (!nt) {
1896  return NULL;
1897  }
1898 
1899  nodeRegisterType(nt);
1900 
1901  /* update while blender is running */
1903 
1904  return nt->rna_ext.srna;
1905 }
1906 
1907 static const EnumPropertyItem *itemf_function_check(
1908  const EnumPropertyItem *original_item_array,
1909  bool (*value_supported)(const EnumPropertyItem *item))
1910 {
1911  EnumPropertyItem *item_array = NULL;
1912  int items_len = 0;
1913 
1914  for (const EnumPropertyItem *item = original_item_array; item->identifier != NULL; item++) {
1915  if (value_supported(item)) {
1916  RNA_enum_item_add(&item_array, &items_len, item);
1917  }
1918  }
1919 
1920  RNA_enum_item_end(&item_array, &items_len);
1921  return item_array;
1922 }
1923 
1924 static bool attribute_clamp_type_supported(const EnumPropertyItem *item)
1925 {
1927 }
1928 static const EnumPropertyItem *rna_GeometryNodeAttributeClamp_type_itemf(bContext *UNUSED(C),
1929  PointerRNA *UNUSED(ptr),
1930  PropertyRNA *UNUSED(prop),
1931  bool *r_free)
1932 {
1933  *r_free = true;
1934  return itemf_function_check(rna_enum_attribute_type_items, attribute_clamp_type_supported);
1935 }
1936 
1937 static bool attribute_random_type_supported(const EnumPropertyItem *item)
1938 {
1940 }
1941 static const EnumPropertyItem *rna_GeometryNodeAttributeRandom_type_itemf(
1942  bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
1943 {
1944  *r_free = true;
1945  return itemf_function_check(rna_enum_attribute_type_items, attribute_random_type_supported);
1946 }
1947 
1948 static const EnumPropertyItem *rna_GeometryNodeAttributeRandomize_operation_itemf(
1949  bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
1950 {
1951  bNode *node = ptr->data;
1952  const NodeAttributeRandomize *node_storage = (NodeAttributeRandomize *)node->storage;
1953  const CustomDataType data_type = (CustomDataType)node_storage->data_type;
1954 
1955  EnumPropertyItem *item_array = NULL;
1956  int items_len = 0;
1958  item->identifier != NULL;
1959  item++) {
1960  if (data_type == CD_PROP_BOOL) {
1962  RNA_enum_item_add(&item_array, &items_len, item);
1963  }
1964  }
1965  else {
1966  RNA_enum_item_add(&item_array, &items_len, item);
1967  }
1968  }
1969  RNA_enum_item_end(&item_array, &items_len);
1970 
1971  *r_free = true;
1972  return item_array;
1973 }
1974 
1975 static void rna_GeometryNodeAttributeRandomize_data_type_update(Main *bmain,
1976  Scene *scene,
1977  PointerRNA *ptr)
1978 {
1979  bNode *node = ptr->data;
1980  NodeAttributeRandomize *node_storage = (NodeAttributeRandomize *)node->storage;
1981 
1982  /* The boolean data type has no extra operations besides,
1983  * replace, so make sure the enum value is set properly. */
1984  if (node_storage->data_type == CD_PROP_BOOL) {
1986  }
1987 
1988  rna_Node_socket_update(bmain, scene, ptr);
1989 }
1990 
1991 static bool attribute_convert_type_supported(const EnumPropertyItem *item)
1992 {
1993  return ELEM(item->value,
1994  CD_PROP_FLOAT,
1997  CD_PROP_COLOR,
1998  CD_PROP_BOOL,
1999  CD_PROP_INT32);
2000 }
2001 static const EnumPropertyItem *rna_GeometryNodeAttributeConvert_type_itemf(
2002  bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
2003 {
2004  *r_free = true;
2005  return itemf_function_check(rna_enum_attribute_type_items, attribute_convert_type_supported);
2006 }
2007 
2008 static bool attribute_fill_type_supported(const EnumPropertyItem *item)
2009 {
2010  return ELEM(
2012 }
2013 static const EnumPropertyItem *rna_GeometryNodeAttributeFill_type_itemf(bContext *UNUSED(C),
2014  PointerRNA *UNUSED(ptr),
2015  PropertyRNA *UNUSED(prop),
2016  bool *r_free)
2017 {
2018  *r_free = true;
2019  return itemf_function_check(rna_enum_attribute_type_items, attribute_fill_type_supported);
2020 }
2021 
2026 static const EnumPropertyItem *rna_GeometryNodeAttributeVectorMath_input_type_b_itemf(
2027  bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
2028 {
2029  bNode *node = ptr->data;
2030  NodeAttributeVectorMath *node_storage = (NodeAttributeVectorMath *)node->storage;
2031 
2032  EnumPropertyItem *item_array = NULL;
2033  int items_len = 0;
2035  item->identifier != NULL;
2036  item++) {
2038  RNA_enum_item_add(&item_array, &items_len, item);
2039  }
2040  else if (item->value == GEO_NODE_ATTRIBUTE_INPUT_FLOAT) {
2041  if (node_storage->operation == NODE_VECTOR_MATH_SCALE) {
2042  RNA_enum_item_add(&item_array, &items_len, item);
2043  }
2044  }
2045  else if (item->value == GEO_NODE_ATTRIBUTE_INPUT_VECTOR) {
2046  if (node_storage->operation != NODE_VECTOR_MATH_SCALE) {
2047  RNA_enum_item_add(&item_array, &items_len, item);
2048  }
2049  }
2050  }
2051  RNA_enum_item_end(&item_array, &items_len);
2052 
2053  *r_free = true;
2054  return item_array;
2055 }
2056 
2057 static const EnumPropertyItem *rna_GeometryNodeAttributeVectorMath_input_type_c_itemf(
2058  bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
2059 {
2060  bNode *node = ptr->data;
2061  NodeAttributeVectorMath *node_storage = (NodeAttributeVectorMath *)node->storage;
2062 
2063  EnumPropertyItem *item_array = NULL;
2064  int items_len = 0;
2066  item->identifier != NULL;
2067  item++) {
2069  RNA_enum_item_add(&item_array, &items_len, item);
2070  }
2071  else if (item->value == GEO_NODE_ATTRIBUTE_INPUT_FLOAT) {
2072  if (node_storage->operation == NODE_VECTOR_MATH_REFRACT) {
2073  RNA_enum_item_add(&item_array, &items_len, item);
2074  }
2075  }
2076  else if (item->value == GEO_NODE_ATTRIBUTE_INPUT_VECTOR) {
2077  if (node_storage->operation != NODE_VECTOR_MATH_REFRACT) {
2078  RNA_enum_item_add(&item_array, &items_len, item);
2079  }
2080  }
2081  }
2082  RNA_enum_item_end(&item_array, &items_len);
2083 
2084  *r_free = true;
2085  return item_array;
2086 }
2087 
2088 static void rna_GeometryNodeAttributeVectorMath_operation_update(Main *bmain,
2089  Scene *scene,
2090  PointerRNA *ptr)
2091 {
2092  bNode *node = ptr->data;
2093  NodeAttributeVectorMath *node_storage = (NodeAttributeVectorMath *)node->storage;
2094 
2095  const NodeVectorMathOperation operation = (NodeVectorMathOperation)node_storage->operation;
2096 
2097  /* The scale operation can't use a vector input, so reset
2098  * the input type enum in case it's set to vector. */
2099  if (operation == NODE_VECTOR_MATH_SCALE) {
2100  if (node_storage->input_type_b == GEO_NODE_ATTRIBUTE_INPUT_VECTOR) {
2102  }
2103  }
2104 
2105  /* Scale is also the only operation that uses the float input type, so a
2106  * a check is also necessary for the other direction. */
2107  if (operation != NODE_VECTOR_MATH_SCALE) {
2108  if (node_storage->input_type_b == GEO_NODE_ATTRIBUTE_INPUT_FLOAT) {
2110  }
2111  }
2112 
2113  rna_Node_socket_update(bmain, scene, ptr);
2114 }
2115 
2116 static bool attribute_map_range_type_supported(const EnumPropertyItem *item)
2117 {
2118  return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3);
2119 }
2120 static const EnumPropertyItem *rna_GeometryNodeAttributeMapRange_type_itemf(
2121  bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
2122 {
2123  *r_free = true;
2124  return itemf_function_check(rna_enum_attribute_type_items, attribute_map_range_type_supported);
2125 }
2126 
2127 static StructRNA *rna_ShaderNode_register(Main *bmain,
2128  ReportList *reports,
2129  void *data,
2130  const char *identifier,
2131  StructValidateFunc validate,
2132  StructCallbackFunc call,
2134 {
2135  bNodeType *nt = rna_Node_register_base(
2136  bmain, reports, &RNA_ShaderNode, data, identifier, validate, call, free);
2137  if (!nt) {
2138  return NULL;
2139  }
2140 
2141  nodeRegisterType(nt);
2142 
2143  /* update while blender is running */
2145 
2146  return nt->rna_ext.srna;
2147 }
2148 
2149 static StructRNA *rna_CompositorNode_register(Main *bmain,
2150  ReportList *reports,
2151  void *data,
2152  const char *identifier,
2153  StructValidateFunc validate,
2154  StructCallbackFunc call,
2156 {
2157  bNodeType *nt = rna_Node_register_base(
2158  bmain, reports, &RNA_CompositorNode, data, identifier, validate, call, free);
2159  if (!nt) {
2160  return NULL;
2161  }
2162 
2163  nodeRegisterType(nt);
2164 
2165  /* update while blender is running */
2167 
2168  return nt->rna_ext.srna;
2169 }
2170 
2171 static StructRNA *rna_TextureNode_register(Main *bmain,
2172  ReportList *reports,
2173  void *data,
2174  const char *identifier,
2175  StructValidateFunc validate,
2176  StructCallbackFunc call,
2178 {
2179  bNodeType *nt = rna_Node_register_base(
2180  bmain, reports, &RNA_TextureNode, data, identifier, validate, call, free);
2181  if (!nt) {
2182  return NULL;
2183  }
2184 
2185  nodeRegisterType(nt);
2186 
2187  /* update while blender is running */
2189 
2190  return nt->rna_ext.srna;
2191 }
2192 
2193 static StructRNA *rna_GeometryNode_register(Main *bmain,
2194  ReportList *reports,
2195  void *data,
2196  const char *identifier,
2197  StructValidateFunc validate,
2198  StructCallbackFunc call,
2200 {
2201  bNodeType *nt = rna_Node_register_base(
2202  bmain, reports, &RNA_GeometryNode, data, identifier, validate, call, free);
2203  if (!nt) {
2204  return NULL;
2205  }
2206 
2207  nodeRegisterType(nt);
2208 
2209  /* update while blender is running */
2211 
2212  return nt->rna_ext.srna;
2213 }
2214 
2215 static StructRNA *rna_FunctionNode_register(Main *bmain,
2216  ReportList *reports,
2217  void *data,
2218  const char *identifier,
2219  StructValidateFunc validate,
2220  StructCallbackFunc call,
2222 {
2223  bNodeType *nt = rna_Node_register_base(
2224  bmain, reports, &RNA_FunctionNode, data, identifier, validate, call, free);
2225  if (!nt) {
2226  return NULL;
2227  }
2228 
2229  nodeRegisterType(nt);
2230 
2231  /* update while blender is running */
2233 
2234  return nt->rna_ext.srna;
2235 }
2236 
2237 static IDProperty *rna_Node_idprops(PointerRNA *ptr, bool create)
2238 {
2239  bNode *node = ptr->data;
2240 
2241  if (create && !node->prop) {
2242  IDPropertyTemplate val = {0};
2243  node->prop = IDP_New(IDP_GROUP, &val, "RNA_Node ID properties");
2244  }
2245 
2246  return node->prop;
2247 }
2248 
2249 static void rna_Node_parent_set(PointerRNA *ptr,
2250  PointerRNA value,
2251  struct ReportList *UNUSED(reports))
2252 {
2253  bNode *node = ptr->data;
2254  bNode *parent = value.data;
2255 
2256  if (parent) {
2257  /* XXX only Frame node allowed for now,
2258  * in the future should have a poll function or so to test possible attachment.
2259  */
2260  if (parent->type != NODE_FRAME) {
2261  return;
2262  }
2263 
2264  /* make sure parent is not attached to the node */
2265  if (nodeAttachNodeCheck(parent, node)) {
2266  return;
2267  }
2268  }
2269 
2271  if (parent) {
2272  nodeAttachNode(node, parent);
2273  }
2274 }
2275 
2276 static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value)
2277 {
2278  bNode *node = ptr->data;
2279  bNode *parent = value.data;
2280 
2281  /* XXX only Frame node allowed for now,
2282  * in the future should have a poll function or so to test possible attachment.
2283  */
2284  if (parent->type != NODE_FRAME) {
2285  return false;
2286  }
2287 
2288  /* make sure parent is not attached to the node */
2289  if (nodeAttachNodeCheck(parent, node)) {
2290  return false;
2291  }
2292 
2293  return true;
2294 }
2295 
2296 static void rna_Node_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
2297 {
2299  bNode *node = (bNode *)ptr->data;
2301 }
2302 
2303 static void rna_Node_update_relations(Main *bmain, Scene *scene, PointerRNA *ptr)
2304 {
2305  rna_Node_update(bmain, scene, ptr);
2306  DEG_relations_tag_update(bmain);
2307 }
2308 
2309 static void rna_Node_socket_value_update(ID *id, bNode *node, bContext *C)
2310 {
2312 }
2313 
2314 static void rna_Node_select_set(PointerRNA *ptr, bool value)
2315 {
2316  bNode *node = (bNode *)ptr->data;
2317  nodeSetSelected(node, value);
2318 }
2319 
2320 static void rna_Node_name_set(PointerRNA *ptr, const char *value)
2321 {
2323  bNode *node = (bNode *)ptr->data;
2324  char oldname[sizeof(node->name)];
2325 
2326  /* make a copy of the old name first */
2327  BLI_strncpy(oldname, node->name, sizeof(node->name));
2328  /* set new name */
2329  BLI_strncpy_utf8(node->name, value, sizeof(node->name));
2330 
2332 
2333  /* fix all the animation data which may link to this */
2334  BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name);
2335 }
2336 
2337 static bNodeSocket *rna_Node_inputs_new(ID *id,
2338  bNode *node,
2339  Main *bmain,
2340  ReportList *reports,
2341  const char *type,
2342  const char *name,
2343  const char *identifier)
2344 {
2345 
2346  if (ELEM(node->type, NODE_GROUP_INPUT, NODE_FRAME)) {
2347  BKE_report(reports, RPT_ERROR, "Unable to create socket");
2348  return NULL;
2349  }
2350  /* Adding an input to a group node is not working,
2351  * simpler to add it to its underlying nodetree. */
2352  if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
2353  return rna_NodeTree_inputs_new((bNodeTree *)node->id, bmain, reports, type, name);
2354  }
2355 
2356  bNodeTree *ntree = (bNodeTree *)id;
2357  bNodeSocket *sock;
2358 
2359  sock = nodeAddSocket(ntree, node, SOCK_IN, type, identifier, name);
2360 
2361  if (sock == NULL) {
2362  BKE_report(reports, RPT_ERROR, "Unable to create socket");
2363  }
2364  else {
2365  ntreeUpdateTree(bmain, ntree);
2367  }
2368 
2369  return sock;
2370 }
2371 
2372 static bNodeSocket *rna_Node_outputs_new(ID *id,
2373  bNode *node,
2374  Main *bmain,
2375  ReportList *reports,
2376  const char *type,
2377  const char *name,
2378  const char *identifier)
2379 {
2380  if (ELEM(node->type, NODE_GROUP_OUTPUT, NODE_FRAME)) {
2381  BKE_report(reports, RPT_ERROR, "Unable to create socket");
2382  return NULL;
2383  }
2384  /* Adding an output to a group node is not working,
2385  * simpler to add it to its underlying nodetree. */
2386  if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
2387  return rna_NodeTree_outputs_new((bNodeTree *)node->id, bmain, reports, type, name);
2388  }
2389 
2390  bNodeTree *ntree = (bNodeTree *)id;
2391  bNodeSocket *sock;
2392 
2393  sock = nodeAddSocket(ntree, node, SOCK_OUT, type, identifier, name);
2394 
2395  if (sock == NULL) {
2396  BKE_report(reports, RPT_ERROR, "Unable to create socket");
2397  }
2398  else {
2399  ntreeUpdateTree(bmain, ntree);
2401  }
2402 
2403  return sock;
2404 }
2405 
2406 static void rna_Node_socket_remove(
2407  ID *id, bNode *node, Main *bmain, ReportList *reports, bNodeSocket *sock)
2408 {
2409  bNodeTree *ntree = (bNodeTree *)id;
2410 
2411  if (BLI_findindex(&node->inputs, sock) == -1 && BLI_findindex(&node->outputs, sock) == -1) {
2412  BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
2413  }
2414  else {
2415  nodeRemoveSocket(ntree, node, sock);
2416 
2417  ntreeUpdateTree(bmain, ntree);
2419  }
2420 }
2421 
2422 static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain)
2423 {
2424  bNodeTree *ntree = (bNodeTree *)id;
2425  bNodeSocket *sock, *nextsock;
2426 
2427  for (sock = node->inputs.first; sock; sock = nextsock) {
2428  nextsock = sock->next;
2429  nodeRemoveSocket(ntree, node, sock);
2430  }
2431 
2432  ntreeUpdateTree(bmain, ntree);
2434 }
2435 
2436 static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain)
2437 {
2438  bNodeTree *ntree = (bNodeTree *)id;
2439  bNodeSocket *sock, *nextsock;
2440 
2441  for (sock = node->outputs.first; sock; sock = nextsock) {
2442  nextsock = sock->next;
2443  nodeRemoveSocket(ntree, node, sock);
2444  }
2445 
2446  ntreeUpdateTree(bmain, ntree);
2448 }
2449 
2450 static void rna_Node_inputs_move(ID *id, bNode *node, Main *bmain, int from_index, int to_index)
2451 {
2452  bNodeTree *ntree = (bNodeTree *)id;
2453  bNodeSocket *sock;
2454 
2455  if (from_index == to_index) {
2456  return;
2457  }
2458  if (from_index < 0 || to_index < 0) {
2459  return;
2460  }
2461 
2462  sock = BLI_findlink(&node->inputs, from_index);
2463  if (to_index < from_index) {
2464  bNodeSocket *nextsock = BLI_findlink(&node->inputs, to_index);
2465  if (nextsock) {
2466  BLI_remlink(&node->inputs, sock);
2467  BLI_insertlinkbefore(&node->inputs, nextsock, sock);
2468  }
2469  }
2470  else {
2471  bNodeSocket *prevsock = BLI_findlink(&node->inputs, to_index);
2472  if (prevsock) {
2473  BLI_remlink(&node->inputs, sock);
2474  BLI_insertlinkafter(&node->inputs, prevsock, sock);
2475  }
2476  }
2477 
2478  ntreeUpdateTree(bmain, ntree);
2480 }
2481 
2482 static void rna_Node_outputs_move(ID *id, bNode *node, Main *bmain, int from_index, int to_index)
2483 {
2484  bNodeTree *ntree = (bNodeTree *)id;
2485  bNodeSocket *sock;
2486 
2487  if (from_index == to_index) {
2488  return;
2489  }
2490  if (from_index < 0 || to_index < 0) {
2491  return;
2492  }
2493 
2494  sock = BLI_findlink(&node->outputs, from_index);
2495  if (to_index < from_index) {
2496  bNodeSocket *nextsock = BLI_findlink(&node->outputs, to_index);
2497  if (nextsock) {
2498  BLI_remlink(&node->outputs, sock);
2499  BLI_insertlinkbefore(&node->outputs, nextsock, sock);
2500  }
2501  }
2502  else {
2503  bNodeSocket *prevsock = BLI_findlink(&node->outputs, to_index);
2504  if (prevsock) {
2505  BLI_remlink(&node->outputs, sock);
2506  BLI_insertlinkafter(&node->outputs, prevsock, sock);
2507  }
2508  }
2509 
2510  ntreeUpdateTree(bmain, ntree);
2512 }
2513 
2514 static void rna_Node_width_range(
2515  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
2516 {
2517  bNode *node = ptr->data;
2518  *min = *softmin = node->typeinfo->minwidth;
2519  *max = *softmax = node->typeinfo->maxwidth;
2520 }
2521 
2522 static void rna_Node_height_range(
2523  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
2524 {
2525  bNode *node = ptr->data;
2526  *min = *softmin = node->typeinfo->minheight;
2527  *max = *softmax = node->typeinfo->maxheight;
2528 }
2529 
2530 static void rna_Node_dimensions_get(PointerRNA *ptr, float *value)
2531 {
2532  bNode *node = ptr->data;
2533  value[0] = node->totr.xmax - node->totr.xmin;
2534  value[1] = node->totr.ymax - node->totr.ymin;
2535 }
2536 
2537 /* ******** Node Socket ******** */
2538 
2539 static void rna_NodeSocket_draw(
2540  bContext *C, struct uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text)
2541 {
2542  extern FunctionRNA rna_NodeSocket_draw_func;
2543 
2544  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2545  ParameterList list;
2546  FunctionRNA *func;
2547 
2548  func = &rna_NodeSocket_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
2549 
2550  RNA_parameter_list_create(&list, ptr, func);
2551  RNA_parameter_set_lookup(&list, "context", &C);
2552  RNA_parameter_set_lookup(&list, "layout", &layout);
2553  RNA_parameter_set_lookup(&list, "node", node_ptr);
2554  RNA_parameter_set_lookup(&list, "text", &text);
2555  sock->typeinfo->ext_socket.call(C, ptr, func, &list);
2556 
2557  RNA_parameter_list_free(&list);
2558 }
2559 
2560 static void rna_NodeSocket_draw_color(bContext *C,
2561  PointerRNA *ptr,
2562  PointerRNA *node_ptr,
2563  float *r_color)
2564 {
2565  extern FunctionRNA rna_NodeSocket_draw_color_func;
2566 
2567  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2568  ParameterList list;
2569  FunctionRNA *func;
2570  void *ret;
2571 
2572  func = &rna_NodeSocket_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */
2573 
2574  RNA_parameter_list_create(&list, ptr, func);
2575  RNA_parameter_set_lookup(&list, "context", &C);
2576  RNA_parameter_set_lookup(&list, "node", node_ptr);
2577  sock->typeinfo->ext_socket.call(C, ptr, func, &list);
2578 
2579  RNA_parameter_get_lookup(&list, "color", &ret);
2580  copy_v4_v4(r_color, (float *)ret);
2581 
2582  RNA_parameter_list_free(&list);
2583 }
2584 
2585 static void rna_NodeSocket_unregister(Main *UNUSED(bmain), StructRNA *type)
2586 {
2588  if (!st) {
2589  return;
2590  }
2591 
2594 
2596 
2597  /* update while blender is running */
2599 }
2600 
2601 static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain),
2602  ReportList *reports,
2603  void *data,
2604  const char *identifier,
2605  StructValidateFunc validate,
2606  StructCallbackFunc call,
2608 {
2609  bNodeSocketType *st, dummyst;
2610  bNodeSocket dummysock;
2611  PointerRNA dummyptr;
2612  int have_function[2];
2613 
2614  /* setup dummy socket & socket type to store static properties in */
2615  memset(&dummyst, 0, sizeof(bNodeSocketType));
2616  dummyst.type = SOCK_CUSTOM;
2617 
2618  memset(&dummysock, 0, sizeof(bNodeSocket));
2619  dummysock.typeinfo = &dummyst;
2620  RNA_pointer_create(NULL, &RNA_NodeSocket, &dummysock, &dummyptr);
2621 
2622  /* validate the python class */
2623  if (validate(&dummyptr, data, have_function) != 0) {
2624  return NULL;
2625  }
2626 
2627  if (strlen(identifier) >= sizeof(dummyst.idname)) {
2628  BKE_reportf(reports,
2629  RPT_ERROR,
2630  "Registering node socket class: '%s' is too long, maximum length is %d",
2631  identifier,
2632  (int)sizeof(dummyst.idname));
2633  return NULL;
2634  }
2635 
2636  /* check if we have registered this socket type before */
2637  st = nodeSocketTypeFind(dummyst.idname);
2638  if (!st) {
2639  /* create a new node socket type */
2640  st = MEM_mallocN(sizeof(bNodeSocketType), "node socket type");
2641  memcpy(st, &dummyst, sizeof(dummyst));
2642 
2644  }
2645 
2646  st->free_self = (void (*)(bNodeSocketType * stype)) MEM_freeN;
2647 
2648  /* if RNA type is already registered, unregister first */
2649  if (st->ext_socket.srna) {
2650  StructRNA *srna = st->ext_socket.srna;
2652  RNA_struct_free(&BLENDER_RNA, srna);
2653  }
2655  st->ext_socket.data = data;
2656  st->ext_socket.call = call;
2657  st->ext_socket.free = free;
2659 
2660  /* XXX bad level call! needed to initialize the basic draw functions ... */
2662 
2663  st->draw = (have_function[0]) ? rna_NodeSocket_draw : NULL;
2664  st->draw_color = (have_function[1]) ? rna_NodeSocket_draw_color : NULL;
2665 
2666  /* update while blender is running */
2668 
2669  return st->ext_socket.srna;
2670 }
2671 
2672 static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
2673 {
2674  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2675 
2676  if (sock->typeinfo->ext_socket.srna) {
2677  return sock->typeinfo->ext_socket.srna;
2678  }
2679  else {
2680  return &RNA_NodeSocket;
2681  }
2682 }
2683 
2684 static char *rna_NodeSocket_path(PointerRNA *ptr)
2685 {
2687  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2688  bNode *node;
2689  int socketindex;
2690  char name_esc[sizeof(node->name) * 2];
2691 
2692  if (!nodeFindNode(ntree, sock, &node, &socketindex)) {
2693  return NULL;
2694  }
2695 
2696  BLI_str_escape(name_esc, node->name, sizeof(name_esc));
2697 
2698  if (sock->in_out == SOCK_IN) {
2699  return BLI_sprintfN("nodes[\"%s\"].inputs[%d]", name_esc, socketindex);
2700  }
2701  else {
2702  return BLI_sprintfN("nodes[\"%s\"].outputs[%d]", name_esc, socketindex);
2703  }
2704 }
2705 
2706 static IDProperty *rna_NodeSocket_idprops(PointerRNA *ptr, bool create)
2707 {
2708  bNodeSocket *sock = ptr->data;
2709 
2710  if (create && !sock->prop) {
2711  IDPropertyTemplate val = {0};
2712  sock->prop = IDP_New(IDP_GROUP, &val, "RNA_NodeSocket ID properties");
2713  }
2714 
2715  return sock->prop;
2716 }
2717 
2718 static PointerRNA rna_NodeSocket_node_get(PointerRNA *ptr)
2719 {
2721  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2722  bNode *node;
2723  PointerRNA r_ptr;
2724 
2725  nodeFindNode(ntree, sock, &node, NULL);
2726 
2727  RNA_pointer_create((ID *)ntree, &RNA_Node, node, &r_ptr);
2728  return r_ptr;
2729 }
2730 
2731 static void rna_NodeSocket_type_set(PointerRNA *ptr, int value)
2732 {
2734  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2735  bNode *node;
2736  nodeFindNode(ntree, sock, &node, NULL);
2737  nodeModifySocketType(ntree, node, sock, value, 0);
2738 }
2739 
2740 static void rna_NodeSocket_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
2741 {
2743  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2744  bNode *node;
2745  if (nodeFindNode(ntree, sock, &node, NULL)) {
2747  }
2748 }
2749 
2750 static bool rna_NodeSocket_is_output_get(PointerRNA *ptr)
2751 {
2752  bNodeSocket *sock = ptr->data;
2753  return sock->in_out == SOCK_OUT;
2754 }
2755 
2756 static void rna_NodeSocket_link_limit_set(PointerRNA *ptr, int value)
2757 {
2758  /* Does not have any effect if the link limit is defined in the socket type. */
2759  bNodeSocket *sock = ptr->data;
2760  sock->limit = (value == 0 ? 0xFFF : value);
2761 }
2762 
2763 static void rna_NodeSocket_hide_set(PointerRNA *ptr, bool value)
2764 {
2765  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2766 
2767  /* don't hide linked sockets */
2768  if (sock->flag & SOCK_IN_USE) {
2769  return;
2770  }
2771 
2772  if (value) {
2773  sock->flag |= SOCK_HIDDEN;
2774  }
2775  else {
2776  sock->flag &= ~SOCK_HIDDEN;
2777  }
2778 }
2779 
2780 static void rna_NodeSocketInterface_draw(bContext *C, struct uiLayout *layout, PointerRNA *ptr)
2781 {
2782  extern FunctionRNA rna_NodeSocketInterface_draw_func;
2783 
2784  bNodeSocket *stemp = (bNodeSocket *)ptr->data;
2785  ParameterList list;
2786  FunctionRNA *func;
2787 
2788  if (!stemp->typeinfo) {
2789  return;
2790  }
2791 
2792  func = &rna_NodeSocketInterface_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
2793 
2794  RNA_parameter_list_create(&list, ptr, func);
2795  RNA_parameter_set_lookup(&list, "context", &C);
2796  RNA_parameter_set_lookup(&list, "layout", &layout);
2797  stemp->typeinfo->ext_interface.call(C, ptr, func, &list);
2798 
2799  RNA_parameter_list_free(&list);
2800 }
2801 
2802 static void rna_NodeSocketInterface_draw_color(bContext *C, PointerRNA *ptr, float *r_color)
2803 {
2804  extern FunctionRNA rna_NodeSocketInterface_draw_color_func;
2805 
2806  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2807  ParameterList list;
2808  FunctionRNA *func;
2809  void *ret;
2810 
2811  if (!sock->typeinfo) {
2812  return;
2813  }
2814 
2815  func =
2816  &rna_NodeSocketInterface_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */
2817 
2818  RNA_parameter_list_create(&list, ptr, func);
2819  RNA_parameter_set_lookup(&list, "context", &C);
2820  sock->typeinfo->ext_interface.call(C, ptr, func, &list);
2821 
2822  RNA_parameter_get_lookup(&list, "color", &ret);
2823  copy_v4_v4(r_color, (float *)ret);
2824 
2825  RNA_parameter_list_free(&list);
2826 }
2827 
2828 static void rna_NodeSocketInterface_register_properties(bNodeTree *ntree,
2829  bNodeSocket *stemp,
2830  StructRNA *data_srna)
2831 {
2832  extern FunctionRNA rna_NodeSocketInterface_register_properties_func;
2833 
2834  PointerRNA ptr;
2835  ParameterList list;
2836  FunctionRNA *func;
2837 
2838  if (!stemp->typeinfo) {
2839  return;
2840  }
2841 
2843  /* RNA_struct_find_function(&ptr, "register_properties"); */
2844  func = &rna_NodeSocketInterface_register_properties_func;
2845 
2846  RNA_parameter_list_create(&list, &ptr, func);
2847  RNA_parameter_set_lookup(&list, "data_rna_type", &data_srna);
2848  stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
2849 
2850  RNA_parameter_list_free(&list);
2851 }
2852 
2853 static void rna_NodeSocketInterface_init_socket(
2854  bNodeTree *ntree, bNodeSocket *stemp, bNode *node, bNodeSocket *sock, const char *data_path)
2855 {
2856  extern FunctionRNA rna_NodeSocketInterface_init_socket_func;
2857 
2858  PointerRNA ptr, node_ptr, sock_ptr;
2859  ParameterList list;
2860  FunctionRNA *func;
2861 
2862  if (!stemp->typeinfo) {
2863  return;
2864  }
2865 
2867  RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
2868  RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sock_ptr);
2869  /* RNA_struct_find_function(&ptr, "init_socket"); */
2870  func = &rna_NodeSocketInterface_init_socket_func;
2871 
2872  RNA_parameter_list_create(&list, &ptr, func);
2873  RNA_parameter_set_lookup(&list, "node", &node_ptr);
2874  RNA_parameter_set_lookup(&list, "socket", &sock_ptr);
2875  RNA_parameter_set_lookup(&list, "data_path", &data_path);
2876  stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
2877 
2878  RNA_parameter_list_free(&list);
2879 }
2880 
2881 static void rna_NodeSocketInterface_from_socket(bNodeTree *ntree,
2882  bNodeSocket *stemp,
2883  bNode *node,
2884  bNodeSocket *sock)
2885 {
2886  extern FunctionRNA rna_NodeSocketInterface_from_socket_func;
2887 
2888  PointerRNA ptr, node_ptr, sock_ptr;
2889  ParameterList list;
2890  FunctionRNA *func;
2891 
2892  if (!stemp->typeinfo) {
2893  return;
2894  }
2895 
2897  RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
2898  RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sock_ptr);
2899  /* RNA_struct_find_function(&ptr, "from_socket"); */
2900  func = &rna_NodeSocketInterface_from_socket_func;
2901 
2902  RNA_parameter_list_create(&list, &ptr, func);
2903  RNA_parameter_set_lookup(&list, "node", &node_ptr);
2904  RNA_parameter_set_lookup(&list, "socket", &sock_ptr);
2905  stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
2906 
2907  RNA_parameter_list_free(&list);
2908 }
2909 
2910 static void rna_NodeSocketInterface_unregister(Main *UNUSED(bmain), StructRNA *type)
2911 {
2913  if (!st) {
2914  return;
2915  }
2916 
2918 
2920 
2921  /* update while blender is running */
2923 }
2924 
2925 static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain),
2926  ReportList *UNUSED(reports),
2927  void *data,
2928  const char *identifier,
2929  StructValidateFunc validate,
2930  StructCallbackFunc call,
2932 {
2933  bNodeSocketType *st, dummyst;
2934  bNodeSocket dummysock;
2935  PointerRNA dummyptr;
2936  int have_function[5];
2937 
2938  /* setup dummy socket & socket type to store static properties in */
2939  memset(&dummyst, 0, sizeof(bNodeSocketType));
2940 
2941  memset(&dummysock, 0, sizeof(bNodeSocket));
2942  dummysock.typeinfo = &dummyst;
2943  RNA_pointer_create(NULL, &RNA_NodeSocketInterface, &dummysock, &dummyptr);
2944 
2945  /* validate the python class */
2946  if (validate(&dummyptr, data, have_function) != 0) {
2947  return NULL;
2948  }
2949 
2950  /* check if we have registered this socket type before */
2951  st = nodeSocketTypeFind(dummyst.idname);
2952  if (st) {
2953  /* basic socket type registered by a socket class before. */
2954  }
2955  else {
2956  /* create a new node socket type */
2957  st = MEM_mallocN(sizeof(bNodeSocketType), "node socket type");
2958  memcpy(st, &dummyst, sizeof(dummyst));
2959 
2961  }
2962 
2963  st->free_self = (void (*)(bNodeSocketType * stype)) MEM_freeN;
2964 
2965  /* if RNA type is already registered, unregister first */
2966  if (st->ext_interface.srna) {
2967  StructRNA *srna = st->ext_interface.srna;
2969  RNA_struct_free(&BLENDER_RNA, srna);
2970  }
2972  st->ext_interface.data = data;
2973  st->ext_interface.call = call;
2974  st->ext_interface.free = free;
2976 
2977  st->interface_draw = (have_function[0]) ? rna_NodeSocketInterface_draw : NULL;
2978  st->interface_draw_color = (have_function[1]) ? rna_NodeSocketInterface_draw_color : NULL;
2979  st->interface_register_properties = (have_function[2]) ?
2980  rna_NodeSocketInterface_register_properties :
2981  NULL;
2982  st->interface_init_socket = (have_function[3]) ? rna_NodeSocketInterface_init_socket : NULL;
2983  st->interface_from_socket = (have_function[4]) ? rna_NodeSocketInterface_from_socket : NULL;
2984 
2985  /* update while blender is running */
2987 
2988  return st->ext_interface.srna;
2989 }
2990 
2991 static StructRNA *rna_NodeSocketInterface_refine(PointerRNA *ptr)
2992 {
2993  bNodeSocket *sock = (bNodeSocket *)ptr->data;
2994 
2995  if (sock->typeinfo && sock->typeinfo->ext_interface.srna) {
2996  return sock->typeinfo->ext_interface.srna;
2997  }
2998  else {
2999  return &RNA_NodeSocketInterface;
3000  }
3001 }
3002 
3003 static char *rna_NodeSocketInterface_path(PointerRNA *ptr)
3004 {
3006  bNodeSocket *sock = (bNodeSocket *)ptr->data;
3007  int socketindex;
3008 
3009  socketindex = BLI_findindex(&ntree->inputs, sock);
3010  if (socketindex != -1) {
3011  return BLI_sprintfN("inputs[%d]", socketindex);
3012  }
3013 
3014  socketindex = BLI_findindex(&ntree->outputs, sock);
3015  if (socketindex != -1) {
3016  return BLI_sprintfN("outputs[%d]", socketindex);
3017  }
3018 
3019  return NULL;
3020 }
3021 
3022 static IDProperty *rna_NodeSocketInterface_idprops(PointerRNA *ptr, bool create)
3023 {
3024  bNodeSocket *sock = ptr->data;
3025 
3026  if (create && !sock->prop) {
3027  IDPropertyTemplate val = {0};
3028  sock->prop = IDP_New(IDP_GROUP, &val, "RNA_NodeSocketInterface ID properties");
3029  }
3030 
3031  return sock->prop;
3032 }
3033 
3034 static void rna_NodeSocketInterface_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
3035 {
3037  bNodeSocket *stemp = ptr->data;
3038 
3039  if (!stemp->typeinfo) {
3040  return;
3041  }
3042 
3044  ntreeUpdateTree(bmain, ntree);
3045 
3047 }
3048 
3049 /* ******** Standard Node Socket Base Types ******** */
3050 
3051 static void rna_NodeSocketStandard_draw(ID *id,
3052  bNodeSocket *sock,
3053  struct bContext *C,
3054  struct uiLayout *layout,
3055  PointerRNA *nodeptr,
3056  const char *text)
3057 {
3058  PointerRNA ptr;
3059  RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
3060  sock->typeinfo->draw(C, layout, &ptr, nodeptr, text);
3061 }
3062 
3063 static void rna_NodeSocketStandard_draw_color(
3064  ID *id, bNodeSocket *sock, struct bContext *C, PointerRNA *nodeptr, float *r_color)
3065 {
3066  PointerRNA ptr;
3067  RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
3068  sock->typeinfo->draw_color(C, &ptr, nodeptr, r_color);
3069 }
3070 
3071 static void rna_NodeSocketInterfaceStandard_draw(ID *id,
3072  bNodeSocket *sock,
3073  struct bContext *C,
3074  struct uiLayout *layout)
3075 {
3076  PointerRNA ptr;
3077  RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
3078  sock->typeinfo->interface_draw(C, layout, &ptr);
3079 }
3080 
3081 static void rna_NodeSocketInterfaceStandard_draw_color(ID *id,
3082  bNodeSocket *sock,
3083  struct bContext *C,
3084  float *r_color)
3085 {
3086  PointerRNA ptr;
3087  RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
3088  sock->typeinfo->interface_draw_color(C, &ptr, r_color);
3089 }
3090 
3091 static void rna_NodeSocketStandard_float_range(
3092  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
3093 {
3094  bNodeSocket *sock = ptr->data;
3095  bNodeSocketValueFloat *dval = sock->default_value;
3096  int subtype = sock->typeinfo->subtype;
3097 
3098  if (dval->max < dval->min) {
3099  dval->max = dval->min;
3100  }
3101 
3102  *min = (subtype == PROP_UNSIGNED ? 0.0f : -FLT_MAX);
3103  *max = FLT_MAX;
3104  *softmin = dval->min;
3105  *softmax = dval->max;
3106 }
3107 
3108 static void rna_NodeSocketStandard_int_range(
3109  PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
3110 {
3111  bNodeSocket *sock = ptr->data;
3112  bNodeSocketValueInt *dval = sock->default_value;
3113  int subtype = sock->typeinfo->subtype;
3114 
3115  if (dval->max < dval->min) {
3116  dval->max = dval->min;
3117  }
3118 
3119  *min = (subtype == PROP_UNSIGNED ? 0 : INT_MIN);
3120  *max = INT_MAX;
3121  *softmin = dval->min;
3122  *softmax = dval->max;
3123 }
3124 
3125 static void rna_NodeSocketStandard_vector_range(
3126  PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
3127 {
3128  bNodeSocket *sock = ptr->data;
3129  bNodeSocketValueVector *dval = sock->default_value;
3130 
3131  if (dval->max < dval->min) {
3132  dval->max = dval->min;
3133  }
3134 
3135  *min = -FLT_MAX;
3136  *max = FLT_MAX;
3137  *softmin = dval->min;
3138  *softmax = dval->max;
3139 }
3140 
3141 /* using a context update function here, to avoid searching the node if possible */
3142 static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *ptr)
3143 {
3144  bNode *node;
3145 
3146  /* default update */
3147  rna_NodeSocket_update(CTX_data_main(C), CTX_data_scene(C), ptr);
3148 
3149  /* try to use node from context, faster */
3150  node = CTX_data_pointer_get(C, "node").data;
3151  if (!node) {
3153  bNodeSocket *sock = ptr->data;
3154 
3155  /* fall back to searching node in the tree */
3156  nodeFindNode(ntree, sock, &node, NULL);
3157  }
3158 }
3159 
3160 static void rna_NodeSocketStandard_value_and_relation_update(struct bContext *C, PointerRNA *ptr)
3161 {
3162  rna_NodeSocketStandard_value_update(C, ptr);
3164  Main *bmain = CTX_data_main(C);
3165  ntreeUpdateTree(bmain, ntree);
3166  DEG_relations_tag_update(bmain);
3167 }
3168 
3169 /* ******** Node Types ******** */
3170 
3171 static void rna_NodeInternalSocketTemplate_name_get(PointerRNA *ptr, char *value)
3172 {
3173  bNodeSocketTemplate *stemp = ptr->data;
3174  strcpy(value, stemp->name);
3175 }
3176 
3177 static int rna_NodeInternalSocketTemplate_name_length(PointerRNA *ptr)
3178 {
3179  bNodeSocketTemplate *stemp = ptr->data;
3180  return strlen(stemp->name);
3181 }
3182 
3183 static void rna_NodeInternalSocketTemplate_identifier_get(PointerRNA *ptr, char *value)
3184 {
3185  bNodeSocketTemplate *stemp = ptr->data;
3186  strcpy(value, stemp->identifier);
3187 }
3188 
3189 static int rna_NodeInternalSocketTemplate_identifier_length(PointerRNA *ptr)
3190 {
3191  bNodeSocketTemplate *stemp = ptr->data;
3192  return strlen(stemp->identifier);
3193 }
3194 
3195 static int rna_NodeInternalSocketTemplate_type_get(PointerRNA *ptr)
3196 {
3197  bNodeSocketTemplate *stemp = ptr->data;
3198  return stemp->type;
3199 }
3200 
3201 static PointerRNA rna_NodeInternal_input_template(StructRNA *srna, int index)
3202 {
3203  bNodeType *ntype = RNA_struct_blender_type_get(srna);
3204  if (ntype && ntype->inputs) {
3205  bNodeSocketTemplate *stemp = ntype->inputs;
3206  int i = 0;
3207  while (i < index && stemp->type >= 0) {
3208  i++;
3209  stemp++;
3210  }
3211  if (i == index && stemp->type >= 0) {
3212  PointerRNA ptr;
3213  RNA_pointer_create(NULL, &RNA_NodeInternalSocketTemplate, stemp, &ptr);
3214  return ptr;
3215  }
3216  }
3217  return PointerRNA_NULL;
3218 }
3219 
3220 static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index)
3221 {
3222  bNodeType *ntype = RNA_struct_blender_type_get(srna);
3223  if (ntype && ntype->outputs) {
3224  bNodeSocketTemplate *stemp = ntype->outputs;
3225  int i = 0;
3226  while (i < index && stemp->type >= 0) {
3227  i++;
3228  stemp++;
3229  }
3230  if (i == index && stemp->type >= 0) {
3231  PointerRNA ptr;
3232  RNA_pointer_create(NULL, &RNA_NodeInternalSocketTemplate, stemp, &ptr);
3233  return ptr;
3234  }
3235  }
3236  return PointerRNA_NULL;
3237 }
3238 
3239 static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree)
3240 {
3241  bNodeType *ntype = RNA_struct_blender_type_get(srna);
3242  const char *disabled_hint;
3243  return ntype && (!ntype->poll || ntype->poll(ntype, ntree, &disabled_hint));
3244 }
3245 
3246 static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree)
3247 {
3248  bNodeType *ntype = node->typeinfo;
3249  const char *disabled_hint;
3250  if (ntype->poll_instance) {
3251  return ntype->poll_instance(node, ntree, &disabled_hint);
3252  }
3253  else {
3254  /* fall back to basic poll function */
3255  return !ntype->poll || ntype->poll(ntype, ntree, &disabled_hint);
3256  }
3257 }
3258 
3259 static void rna_NodeInternal_update(ID *id, bNode *node)
3260 {
3261  bNodeTree *ntree = (bNodeTree *)id;
3262  if (node->typeinfo->updatefunc) {
3263  node->typeinfo->updatefunc(ntree, node);
3264  }
3265 }
3266 
3267 static void rna_NodeInternal_draw_buttons(ID *id,
3268  bNode *node,
3269  struct bContext *C,
3270  struct uiLayout *layout)
3271 {
3272  if (node->typeinfo->draw_buttons) {
3273  PointerRNA ptr;
3275  node->typeinfo->draw_buttons(layout, C, &ptr);
3276  }
3277 }
3278 
3279 static void rna_NodeInternal_draw_buttons_ext(ID *id,
3280  bNode *node,
3281  struct bContext *C,
3282  struct uiLayout *layout)
3283 {
3284  if (node->typeinfo->draw_buttons_ex) {
3285  PointerRNA ptr;
3287  node->typeinfo->draw_buttons_ex(layout, C, &ptr);
3288  }
3289  else if (node->typeinfo->draw_buttons) {
3290  PointerRNA ptr;
3292  node->typeinfo->draw_buttons(layout, C, &ptr);
3293  }
3294 }
3295 
3296 static StructRNA *rna_NodeCustomGroup_register(Main *bmain,
3297  ReportList *reports,
3298  void *data,
3299  const char *identifier,
3300  StructValidateFunc validate,
3301  StructCallbackFunc call,
3303 {
3304  bNodeType *nt = rna_Node_register_base(
3305  bmain, reports, &RNA_NodeCustomGroup, data, identifier, validate, call, free);
3306  if (!nt) {
3307  return NULL;
3308  }
3309 
3310  /* this updates the group node instance from the tree's interface */
3312 
3313  nodeRegisterType(nt);
3314 
3315  /* update while blender is running */
3317 
3318  return nt->rna_ext.srna;
3319 }
3320 
3321 static StructRNA *rna_GeometryNodeCustomGroup_register(Main *bmain,
3322  ReportList *reports,
3323  void *data,
3324  const char *identifier,
3325  StructValidateFunc validate,
3326  StructCallbackFunc call,
3328 {
3329  bNodeType *nt = rna_Node_register_base(
3330  bmain, reports, &RNA_GeometryNodeCustomGroup, data, identifier, validate, call, free);
3331 
3332  if (!nt) {
3333  return NULL;
3334  }
3335 
3337  nt->type = NODE_CUSTOM_GROUP;
3338 
3340 
3341  nodeRegisterType(nt);
3342 
3344 
3345  return nt->rna_ext.srna;
3346 }
3347 
3349 
3350 static StructRNA *rna_ShaderNodeCustomGroup_register(Main *bmain,
3351  ReportList *reports,
3352  void *data,
3353  const char *identifier,
3354  StructValidateFunc validate,
3355  StructCallbackFunc call,
3357 {
3358  bNodeType *nt = rna_Node_register_base(
3359  bmain, reports, &RNA_ShaderNodeCustomGroup, data, identifier, validate, call, free);
3360 
3361  if (!nt) {
3362  return NULL;
3363  }
3364 
3366  nt->type = NODE_CUSTOM_GROUP;
3367 
3369 
3370  nodeRegisterType(nt);
3371 
3373 
3374  return nt->rna_ext.srna;
3375 }
3376 
3377 static StructRNA *rna_CompositorNodeCustomGroup_register(Main *bmain,
3378  ReportList *reports,
3379  void *data,
3380  const char *identifier,
3381  StructValidateFunc validate,
3382  StructCallbackFunc call,
3384 {
3385  bNodeType *nt = rna_Node_register_base(
3386  bmain, reports, &RNA_CompositorNodeCustomGroup, data, identifier, validate, call, free);
3387  if (!nt) {
3388  return NULL;
3389  }
3390 
3392  nt->type = NODE_CUSTOM_GROUP;
3393 
3395 
3396  nodeRegisterType(nt);
3397 
3399 
3400  return nt->rna_ext.srna;
3401 }
3402 
3403 static void rna_CompositorNode_tag_need_exec(bNode *node)
3404 {
3405  node->need_exec = true;
3406 }
3407 
3408 static void rna_Node_tex_image_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
3409 {
3411  bNode *node = (bNode *)ptr->data;
3412 
3415 }
3416 
3417 static void rna_NodeGroup_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
3418 {
3420  bNode *node = (bNode *)ptr->data;
3421 
3422  if (node->id) {
3423  ntreeUpdateTree(bmain, (bNodeTree *)node->id);
3424  }
3425 
3427  DEG_relations_tag_update(bmain);
3428 }
3429 
3430 static void rna_NodeGroup_node_tree_set(PointerRNA *ptr,
3431  const PointerRNA value,
3432  struct ReportList *UNUSED(reports))
3433 {
3435  bNode *node = ptr->data;
3436  bNodeTree *ngroup = value.data;
3437 
3438  const char *disabled_hint = NULL;
3439  if (nodeGroupPoll(ntree, ngroup, &disabled_hint)) {
3440  if (node->id) {
3441  id_us_min(node->id);
3442  }
3443  if (ngroup) {
3444  id_us_plus(&ngroup->id);
3445  }
3446 
3447  node->id = &ngroup->id;
3448  }
3449 }
3450 
3451 static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
3452 {
3454  bNodeTree *ngroup = value.data;
3455 
3456  /* only allow node trees of the same type as the group node's tree */
3457  if (ngroup->type != ntree->type) {
3458  return false;
3459  }
3460 
3461  const char *disabled_hint = NULL;
3462  return nodeGroupPoll(ntree, ngroup, &disabled_hint);
3463 }
3464 
3465 static StructRNA *rna_NodeGroup_interface_typef(PointerRNA *ptr)
3466 {
3467  bNode *node = ptr->data;
3468  bNodeTree *ngroup = (bNodeTree *)node->id;
3469 
3470  if (ngroup) {
3471  StructRNA *srna = ntreeInterfaceTypeGet(ngroup, true);
3472  if (srna) {
3473  return srna;
3474  }
3475  }
3476  return &RNA_PropertyGroup;
3477 }
3478 
3479 static StructRNA *rna_NodeGroupInputOutput_interface_typef(PointerRNA *ptr)
3480 {
3482 
3483  if (ntree) {
3484  StructRNA *srna = ntreeInterfaceTypeGet(ntree, true);
3485  if (srna) {
3486  return srna;
3487  }
3488  }
3489  return &RNA_PropertyGroup;
3490 }
3491 
3492 static void rna_distance_matte_t1_set(PointerRNA *ptr, float value)
3493 {
3494  bNode *node = (bNode *)ptr->data;
3495  NodeChroma *chroma = node->storage;
3496 
3497  chroma->t1 = value;
3498 }
3499 
3500 static void rna_distance_matte_t2_set(PointerRNA *ptr, float value)
3501 {
3502  bNode *node = (bNode *)ptr->data;
3503  NodeChroma *chroma = node->storage;
3504 
3505  chroma->t2 = value;
3506 }
3507 
3508 static void rna_difference_matte_t1_set(PointerRNA *ptr, float value)
3509 {
3510  bNode *node = (bNode *)ptr->data;
3511  NodeChroma *chroma = node->storage;
3512 
3513  chroma->t1 = value;
3514 }
3515 
3516 static void rna_difference_matte_t2_set(PointerRNA *ptr, float value)
3517 {
3518  bNode *node = (bNode *)ptr->data;
3519  NodeChroma *chroma = node->storage;
3520 
3521  chroma->t2 = value;
3522 }
3523 
3524 /* Button Set Funcs for Matte Nodes */
3525 static void rna_Matte_t1_set(PointerRNA *ptr, float value)
3526 {
3527  bNode *node = (bNode *)ptr->data;
3528  NodeChroma *chroma = node->storage;
3529 
3530  chroma->t1 = value;
3531 
3532  if (value < chroma->t2) {
3533  chroma->t2 = value;
3534  }
3535 }
3536 
3537 static void rna_Matte_t2_set(PointerRNA *ptr, float value)
3538 {
3539  bNode *node = (bNode *)ptr->data;
3540  NodeChroma *chroma = node->storage;
3541 
3542  if (value > chroma->t1) {
3543  value = chroma->t1;
3544  }
3545 
3546  chroma->t2 = value;
3547 }
3548 
3549 static void rna_Node_scene_set(PointerRNA *ptr,
3550  PointerRNA value,
3551  struct ReportList *UNUSED(reports))
3552 {
3553  bNode *node = (bNode *)ptr->data;
3554 
3555  if (node->id) {
3556  id_us_min(node->id);
3557  node->id = NULL;
3558  }
3559 
3560  node->id = value.data;
3561 
3562  id_us_plus(node->id);
3563 }
3564 
3565 static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3566 {
3567  bNode *node = (bNode *)ptr->data;
3568  Image *ima = (Image *)node->id;
3569  ImageUser *iuser = node->storage;
3570 
3571  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3572  return;
3573  }
3574 
3575  BKE_image_multilayer_index(ima->rr, iuser);
3576  BKE_image_signal(bmain, ima, iuser, IMA_SIGNAL_SRC_CHANGE);
3577 
3578  rna_Node_update(bmain, scene, ptr);
3579 
3580  if (scene->nodetree != NULL) {
3582  }
3583 }
3584 
3585 static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
3586 {
3587  EnumPropertyItem *item = NULL;
3588  EnumPropertyItem tmp = {0};
3589  int i = 0, totitem = 0;
3590 
3591  while (rl) {
3592  tmp.identifier = rl->name;
3593  /* Little trick: using space char instead empty string
3594  * makes the item selectable in the drop-down. */
3595  if (rl->name[0] == '\0') {
3596  tmp.name = " ";
3597  }
3598  else {
3599  tmp.name = rl->name;
3600  }
3601  tmp.value = i++;
3602  RNA_enum_item_add(&item, &totitem, &tmp);
3603  rl = rl->next;
3604  }
3605 
3606  RNA_enum_item_end(&item, &totitem);
3607 
3608  return item;
3609 }
3610 
3611 static const EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C),
3612  PointerRNA *ptr,
3613  PropertyRNA *UNUSED(prop),
3614  bool *r_free)
3615 {
3616  bNode *node = (bNode *)ptr->data;
3617  Image *ima = (Image *)node->id;
3618  const EnumPropertyItem *item = NULL;
3619  RenderLayer *rl;
3620 
3621  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3622  return DummyRNA_NULL_items;
3623  }
3624 
3625  if (ima == NULL || ima->rr == NULL) {
3626  *r_free = false;
3627  return DummyRNA_NULL_items;
3628  }
3629 
3630  rl = ima->rr->layers.first;
3631  item = renderresult_layers_add_enum(rl);
3632 
3633  *r_free = true;
3634 
3635  return item;
3636 }
3637 
3638 static bool rna_Node_image_has_layers_get(PointerRNA *ptr)
3639 {
3640  bNode *node = (bNode *)ptr->data;
3641  Image *ima = (Image *)node->id;
3642 
3643  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3644  return false;
3645  }
3646 
3647  if (!ima || !(ima->rr)) {
3648  return false;
3649  }
3650 
3651  return RE_layers_have_name(ima->rr);
3652 }
3653 
3654 static bool rna_Node_image_has_views_get(PointerRNA *ptr)
3655 {
3656  bNode *node = (bNode *)ptr->data;
3657  Image *ima = (Image *)node->id;
3658 
3659  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3660  return false;
3661  }
3662 
3663  if (!ima || !(ima->rr)) {
3664  return false;
3665  }
3666 
3667  return BLI_listbase_count_at_most(&ima->rr->views, 2) > 1;
3668 }
3669 
3670 static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv)
3671 {
3672  EnumPropertyItem *item = NULL;
3673  EnumPropertyItem tmp = {0, "ALL", 0, "All", ""};
3674  int i = 1, totitem = 0;
3675 
3676  /* option to use all views */
3677  RNA_enum_item_add(&item, &totitem, &tmp);
3678 
3679  while (rv) {
3680  tmp.identifier = rv->name;
3681  /* Little trick: using space char instead empty string
3682  * makes the item selectable in the drop-down. */
3683  if (rv->name[0] == '\0') {
3684  tmp.name = " ";
3685  }
3686  else {
3687  tmp.name = rv->name;
3688  }
3689  tmp.value = i++;
3690  RNA_enum_item_add(&item, &totitem, &tmp);
3691  rv = rv->next;
3692  }
3693 
3694  RNA_enum_item_end(&item, &totitem);
3695 
3696  return item;
3697 }
3698 
3699 static const EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C),
3700  PointerRNA *ptr,
3701  PropertyRNA *UNUSED(prop),
3702  bool *r_free)
3703 {
3704  bNode *node = (bNode *)ptr->data;
3705  Image *ima = (Image *)node->id;
3706  const EnumPropertyItem *item = NULL;
3707  RenderView *rv;
3708 
3709  if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
3710  return DummyRNA_NULL_items;
3711  }
3712 
3713  if (ima == NULL || ima->rr == NULL) {
3714  *r_free = false;
3715  return DummyRNA_NULL_items;
3716  }
3717 
3718  rv = ima->rr->views.first;
3719  item = renderresult_views_add_enum(rv);
3720 
3721  *r_free = true;
3722 
3723  return item;
3724 }
3725 
3726 static const EnumPropertyItem *rna_Node_view_layer_itemf(bContext *UNUSED(C),
3727  PointerRNA *ptr,
3728  PropertyRNA *UNUSED(prop),
3729  bool *r_free)
3730 {
3731  bNode *node = (bNode *)ptr->data;
3732  Scene *sce = (Scene *)node->id;
3733  const EnumPropertyItem *item = NULL;
3734  RenderLayer *rl;
3735 
3736  if (sce == NULL) {
3737  *r_free = false;
3738  return DummyRNA_NULL_items;
3739  }
3740 
3741  rl = sce->view_layers.first;
3742  item = renderresult_layers_add_enum(rl);
3743 
3744  *r_free = true;
3745 
3746  return item;
3747 }
3748 
3749 static void rna_Node_view_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
3750 {
3751  rna_Node_update(bmain, scene, ptr);
3752  if (scene->nodetree != NULL) {
3754  }
3755 }
3756 
3757 static const EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C),
3758  PointerRNA *ptr,
3759  PropertyRNA *UNUSED(prop),
3760  bool *r_free)
3761 {
3762  bNode *node = (bNode *)ptr->data;
3763  EnumPropertyItem *item = NULL;
3764  EnumPropertyItem tmp = {0};
3765  int totitem = 0;
3766 
3767  switch (node->custom1) {
3769  tmp.identifier = "R";
3770  tmp.name = "R";
3771  tmp.value = 1;
3772  RNA_enum_item_add(&item, &totitem, &tmp);
3773  tmp.identifier = "G";
3774  tmp.name = "G";
3775  tmp.value = 2;
3776  RNA_enum_item_add(&item, &totitem, &tmp);
3777  tmp.identifier = "B";
3778  tmp.name = "B";
3779  tmp.value = 3;
3780  RNA_enum_item_add(&item, &totitem, &tmp);
3781  break;
3783  tmp.identifier = "H";
3784  tmp.name = "H";
3785  tmp.value = 1;
3786  RNA_enum_item_add(&item, &totitem, &tmp);
3787  tmp.identifier = "S";
3788  tmp.name = "S";
3789  tmp.value = 2;
3790  RNA_enum_item_add(&item, &totitem, &tmp);
3791  tmp.identifier = "V";
3792  tmp.name = "V";
3793  tmp.value = 3;
3794  RNA_enum_item_add(&item, &totitem, &tmp);
3795  break;
3797  tmp.identifier = "Y";
3798  tmp.name = "Y";
3799  tmp.value = 1;
3800  RNA_enum_item_add(&item, &totitem, &tmp);
3801  tmp.identifier = "G";
3802  tmp.name = "U";
3803  tmp.value = 2;
3804  RNA_enum_item_add(&item, &totitem, &tmp);
3805  tmp.identifier = "V";
3806  tmp.name = "V";
3807  tmp.value = 3;
3808  RNA_enum_item_add(&item, &totitem, &tmp);
3809  break;
3811  tmp.identifier = "Y";
3812  tmp.name = "Y";
3813  tmp.value = 1;
3814  RNA_enum_item_add(&item, &totitem, &tmp);
3815  tmp.identifier = "CB";
3816  tmp.name = "Cr";
3817  tmp.value = 2;
3818  RNA_enum_item_add(&item, &totitem, &tmp);
3819  tmp.identifier = "CR";
3820  tmp.name = "Cb";
3821  tmp.value = 3;
3822  RNA_enum_item_add(&item, &totitem, &tmp);
3823  break;
3824  default:
3825  return DummyRNA_NULL_items;
3826  }
3827 
3828  RNA_enum_item_end(&item, &totitem);
3829  *r_free = true;
3830 
3831  return item;
3832 }
3833 
3834 static void rna_Image_Node_update_id(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
3835 {
3837  bNode *node = (bNode *)ptr->data;
3838 
3839  node->update |= NODE_UPDATE_ID;
3840  nodeUpdate(ntree, node); /* to update image node sockets */
3841 }
3842 
3843 static void rna_NodeOutputFile_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
3844 {
3845  bNode *node = ptr->data;
3846  rna_iterator_listbase_begin(iter, &node->inputs, NULL);
3847 }
3848 
3849 static PointerRNA rna_NodeOutputFile_slot_file_get(CollectionPropertyIterator *iter)
3850 {
3851  PointerRNA ptr;
3852  bNodeSocket *sock = rna_iterator_listbase_get(iter);
3854  return ptr;
3855 }
3856 
3857 static void rna_NodeColorBalance_update_lgg(Main *bmain, Scene *scene, PointerRNA *ptr)
3858 {
3860  rna_Node_update(bmain, scene, ptr);
3861 }
3862 
3863 static void rna_NodeColorBalance_update_cdl(Main *bmain, Scene *scene, PointerRNA *ptr)
3864 {
3866  rna_Node_update(bmain, scene, ptr);
3867 }
3868 
3869 static void rna_NodeCryptomatte_source_set(PointerRNA *ptr, int value)
3870 {
3871  bNode *node = (bNode *)ptr->data;
3872  if (node->id && node->custom1 != value) {
3873  id_us_min((ID *)node->id);
3874  node->id = NULL;
3875  }
3876  node->custom1 = value;
3877 }
3878 
3879 static int rna_NodeCryptomatte_layer_name_get(PointerRNA *ptr)
3880 {
3881  int index = 0;
3882  bNode *node = (bNode *)ptr->data;
3883  NodeCryptomatte *storage = node->storage;
3884  LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, index) {
3885  if (STREQLEN(storage->layer_name, layer->name, sizeof(storage->layer_name))) {
3886  return index;
3887  }
3888  }
3889  return 0;
3890 }
3891 
3892 static void rna_NodeCryptomatte_layer_name_set(PointerRNA *ptr, int new_value)
3893 {
3894  bNode *node = (bNode *)ptr->data;
3895  NodeCryptomatte *storage = node->storage;
3896 
3897  CryptomatteLayer *layer = BLI_findlink(&storage->runtime.layers, new_value);
3898  if (layer) {
3899  STRNCPY(storage->layer_name, layer->name);
3900  }
3901 }
3902 
3903 static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext *C,
3904  PointerRNA *ptr,
3905  PropertyRNA *UNUSED(prop),
3906  bool *r_free)
3907 {
3908  bNode *node = (bNode *)ptr->data;
3909  NodeCryptomatte *storage = node->storage;
3910  EnumPropertyItem *item = NULL;
3911  EnumPropertyItem template = {0, "", 0, "", ""};
3912  int totitem = 0;
3913 
3915  int layer_index;
3916  LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, layer_index) {
3917  template.value = layer_index;
3918  template.identifier = layer->name;
3919  template.name = layer->name;
3920  RNA_enum_item_add(&item, &totitem, &template);
3921  }
3922 
3923  RNA_enum_item_end(&item, &totitem);
3924  *r_free = true;
3925 
3926  return item;
3927 }
3928 
3929 static PointerRNA rna_NodeCryptomatte_scene_get(PointerRNA *ptr)
3930 {
3931  bNode *node = (bNode *)ptr->data;
3932 
3933  Scene *scene = (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) ? (Scene *)node->id : NULL;
3935 }
3936 
3937 static void rna_NodeCryptomatte_scene_set(PointerRNA *ptr,
3938  PointerRNA value,
3939  struct ReportList *reports)
3940 {
3941  bNode *node = (bNode *)ptr->data;
3942 
3943  if (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) {
3944  rna_Node_scene_set(ptr, value, reports);
3945  }
3946 }
3947 
3948 static PointerRNA rna_NodeCryptomatte_image_get(PointerRNA *ptr)
3949 {
3950  bNode *node = (bNode *)ptr->data;
3951 
3952  Image *image = (node->custom1 == CMP_CRYPTOMATTE_SRC_IMAGE) ? (Image *)node->id : NULL;
3953  return rna_pointer_inherit_refine(ptr, &RNA_Image, image);
3954 }
3955 
3956 static void rna_NodeCryptomatte_image_set(PointerRNA *ptr,
3957  PointerRNA value,
3958  struct ReportList *UNUSED(reports))
3959 {
3960  bNode *node = (bNode *)ptr->data;
3961 
3962  if (node->custom1 == CMP_CRYPTOMATTE_SRC_IMAGE) {
3963  if (node->id)
3964  id_us_min((ID *)node->id);
3965  if (value.data)
3966  id_us_plus((ID *)value.data);
3967 
3968  node->id = value.data;
3969  }
3970 }
3971 
3972 static bool rna_NodeCryptomatte_image_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
3973 {
3974  Image *image = (Image *)value.owner_id;
3975  return image->type == IMA_TYPE_MULTILAYER;
3976 }
3977 
3978 static void rna_NodeCryptomatte_matte_get(PointerRNA *ptr, char *value)
3979 {
3980  bNode *node = (bNode *)ptr->data;
3981  NodeCryptomatte *nc = node->storage;
3982  char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
3983  strcpy(value, matte_id);
3984  MEM_freeN(matte_id);
3985 }
3986 
3987 static int rna_NodeCryptomatte_matte_length(PointerRNA *ptr)
3988 {
3989  bNode *node = (bNode *)ptr->data;
3990  NodeCryptomatte *nc = node->storage;
3991  char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc);
3992  int result = strlen(matte_id);
3993  MEM_freeN(matte_id);
3994  return result;
3995 }
3996 
3997 static void rna_NodeCryptomatte_matte_set(PointerRNA *ptr, const char *value)
3998 {
3999  bNode *node = (bNode *)ptr->data;
4000  NodeCryptomatte *nc = node->storage;
4002 }
4003 
4004 static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr)
4005 {
4007  rna_Node_update(bmain, scene, ptr);
4008 }
4009 
4010 static void rna_NodeCryptomatte_update_remove(Main *bmain, Scene *scene, PointerRNA *ptr)
4011 {
4013  rna_Node_update(bmain, scene, ptr);
4014 }
4015 
4016 /* ******** Node Socket Types ******** */
4017 
4018 static PointerRNA rna_NodeOutputFile_slot_layer_get(CollectionPropertyIterator *iter)
4019 {
4020  PointerRNA ptr;
4021  bNodeSocket *sock = rna_iterator_listbase_get(iter);
4023  return ptr;
4024 }
4025 
4026 static int rna_NodeOutputFileSocket_find_node(bNodeTree *ntree,
4028  bNode **nodep,
4029  bNodeSocket **sockp)
4030 {
4031  bNode *node;
4032  bNodeSocket *sock;
4033 
4034  for (node = ntree->nodes.first; node; node = node->next) {
4035  for (sock = node->inputs.first; sock; sock = sock->next) {
4036  NodeImageMultiFileSocket *sockdata = sock->storage;
4037  if (sockdata == data) {
4038  *nodep = node;
4039  *sockp = sock;
4040  return 1;
4041  }
4042  }
4043  }
4044 
4045  *nodep = NULL;
4046  *sockp = NULL;
4047  return 0;
4048 }
4049 
4050 static void rna_NodeOutputFileSlotFile_path_set(PointerRNA *ptr, const char *value)
4051 {
4053  NodeImageMultiFileSocket *sockdata = ptr->data;
4054  bNode *node;
4055  bNodeSocket *sock;
4056 
4057  if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
4058  ntreeCompositOutputFileSetPath(node, sock, value);
4059  }
4060 }
4061 
4062 static void rna_NodeOutputFileSlotLayer_name_set(PointerRNA *ptr, const char *value)
4063 {
4065  NodeImageMultiFileSocket *sockdata = ptr->data;
4066  bNode *node;
4067  bNodeSocket *sock;
4068 
4069  if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
4070  ntreeCompositOutputFileSetLayer(node, sock, value);
4071  }
4072 }
4073 
4074 static bNodeSocket *rna_NodeOutputFile_slots_new(
4075  ID *id, bNode *node, bContext *C, ReportList *UNUSED(reports), const char *name)
4076 {
4077  bNodeTree *ntree = (bNodeTree *)id;
4079  ImageFormatData *im_format = NULL;
4080  bNodeSocket *sock;
4081  if (scene) {
4082  im_format = &scene->r.im_format;
4083  }
4084 
4085  sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format);
4086 
4089 
4090  return sock;
4091 }
4092 
4093 static void rna_ShaderNodeTexIES_mode_set(PointerRNA *ptr, int value)
4094 {
4095  bNode *node = (bNode *)ptr->data;
4096  NodeShaderTexIES *nss = node->storage;
4097 
4098  if (nss->mode != value) {
4099  nss->mode = value;
4100  nss->filepath[0] = '\0';
4101 
4102  /* replace text datablock by filepath */
4103  if (node->id) {
4104  Text *text = (Text *)node->id;
4105 
4106  if (value == NODE_IES_EXTERNAL && text->filepath) {
4107  BLI_strncpy(nss->filepath, text->filepath, sizeof(nss->filepath));
4109  }
4110 
4111  id_us_min(node->id);
4112  node->id = NULL;
4113  }
4114  }
4115 }
4116 
4117 static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value)
4118 {
4119  bNode *node = (bNode *)ptr->data;
4120  NodeShaderScript *nss = node->storage;
4121 
4122  if (nss->mode != value) {
4123  nss->mode = value;
4124  nss->filepath[0] = '\0';
4125  nss->flag &= ~NODE_SCRIPT_AUTO_UPDATE;
4126 
4127  /* replace text data-block by filepath */
4128  if (node->id) {
4129  Text *text = (Text *)node->id;
4130 
4131  if (value == NODE_SCRIPT_EXTERNAL && text->filepath) {
4132  BLI_strncpy(nss->filepath, text->filepath, sizeof(nss->filepath));
4134  }
4135 
4136  id_us_min(node->id);
4137  node->id = NULL;
4138  }
4139 
4140  /* remove any bytecode */
4141  if (nss->bytecode) {
4142  MEM_freeN(nss->bytecode);
4143  nss->bytecode = NULL;
4144  }
4145 
4146  nss->bytecode_hash[0] = '\0';
4147  }
4148 }
4149 
4150 static void rna_ShaderNodeScript_bytecode_get(PointerRNA *ptr, char *value)
4151 {
4152  bNode *node = (bNode *)ptr->data;
4153  NodeShaderScript *nss = node->storage;
4154 
4155  strcpy(value, (nss->bytecode) ? nss->bytecode : "");
4156 }
4157 
4158 static int rna_ShaderNodeScript_bytecode_length(PointerRNA *ptr)
4159 {
4160  bNode *node = (bNode *)ptr->data;
4161  NodeShaderScript *nss = node->storage;
4162 
4163  return (nss->bytecode) ? strlen(nss->bytecode) : 0;
4164 }
4165 
4166 static void rna_ShaderNodeScript_bytecode_set(PointerRNA *ptr, const char *value)
4167 {
4168  bNode *node = (bNode *)ptr->data;
4169  NodeShaderScript *nss = node->storage;
4170 
4171  if (nss->bytecode) {
4172  MEM_freeN(nss->bytecode);
4173  }
4174 
4175  if (value && value[0]) {
4176  nss->bytecode = BLI_strdup(value);
4177  }
4178  else {
4179  nss->bytecode = NULL;
4180  }
4181 }
4182 
4183 static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4184 {
4186  bNode *node = (bNode *)ptr->data;
4187  RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
4188 
4189  if (engine_type && engine_type->update_script_node) {
4190  /* auto update node */
4191  RenderEngine *engine = RE_engine_create(engine_type);
4192  engine_type->update_script_node(engine, ntree, node);
4193  RE_engine_free(engine);
4194  }
4195 
4197 }
4198 
4199 static void rna_ShaderNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4200 {
4202  bNode *node = (bNode *)ptr->data;
4203 
4204  nodeUpdate(ntree, node);
4205  rna_Node_update(bmain, scene, ptr);
4206 }
4207 
4208 static void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4209 {
4211  bNode *node = (bNode *)ptr->data;
4212 
4213  nodeUpdate(ntree, node);
4214  rna_Node_update(bmain, scene, ptr);
4215 }
4216 
4217 static void rna_GeometryNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4218 {
4220  bNode *node = (bNode *)ptr->data;
4221 
4222  nodeUpdate(ntree, node);
4223  rna_Node_update(bmain, scene, ptr);
4224 }
4225 
4226 static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA *ptr)
4227 {
4229  bNode *node = (bNode *)ptr->data;
4230 
4231  nodeUpdate(ntree, node);
4232  rna_Node_update(bmain, scene, ptr);
4233 }
4234 
4235 static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr)
4236 {
4237  bNode *node = ptr->data;
4238  NodeShaderTexPointDensity *shader_point_density = node->storage;
4239  Object *ob = (Object *)node->id;
4240  ParticleSystem *psys = NULL;
4241  PointerRNA value;
4242 
4243  if (ob && shader_point_density->particle_system) {
4244  psys = BLI_findlink(&ob->particlesystem, shader_point_density->particle_system - 1);
4245  }
4246 
4247  RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
4248  return value;
4249 }
4250 
4251 static void rna_ShaderNodePointDensity_psys_set(PointerRNA *ptr,
4252  PointerRNA value,
4253  struct ReportList *UNUSED(reports))
4254 {
4255  bNode *node = ptr->data;
4256  NodeShaderTexPointDensity *shader_point_density = node->storage;
4257  Object *ob = (Object *)node->id;
4258 
4259  if (ob && value.owner_id == &ob->id) {
4260  shader_point_density->particle_system = BLI_findindex(&ob->particlesystem, value.data) + 1;
4261  }
4262  else {
4263  shader_point_density->particle_system = 0;
4264  }
4265 }
4266 
4267 static int point_density_particle_color_source_from_shader(
4268  NodeShaderTexPointDensity *shader_point_density)
4269 {
4270  switch (shader_point_density->color_source) {
4272  return TEX_PD_COLOR_PARTAGE;
4274  return TEX_PD_COLOR_PARTSPEED;
4276  return TEX_PD_COLOR_PARTVEL;
4277  default:
4278  BLI_assert(!"Unknown color source");
4279  return TEX_PD_COLOR_CONSTANT;
4280  }
4281 }
4282 
4283 static int point_density_vertex_color_source_from_shader(
4284  NodeShaderTexPointDensity *shader_point_density)
4285 {
4286  switch (shader_point_density->ob_color_source) {
4288  return TEX_PD_COLOR_VERTCOL;
4290  return TEX_PD_COLOR_VERTWEIGHT;
4292  return TEX_PD_COLOR_VERTNOR;
4293  default:
4294  BLI_assert(!"Unknown color source");
4295  return TEX_PD_COLOR_CONSTANT;
4296  }
4297 }
4298 
4299 void rna_ShaderNodePointDensity_density_cache(bNode *self, Depsgraph *depsgraph)
4300 {
4301  NodeShaderTexPointDensity *shader_point_density = self->storage;
4302  PointDensity *pd = &shader_point_density->pd;
4303 
4304  if (depsgraph == NULL) {
4305  return;
4306  }
4307 
4308  /* Make sure there's no cached data. */
4311 
4312  /* Create PointDensity structure from node for sampling. */
4314  pd->object = (Object *)self->id;
4315  pd->radius = shader_point_density->radius;
4316  if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
4317  pd->source = TEX_PD_PSYS;
4318  pd->psys = shader_point_density->particle_system;
4320  pd->color_source = point_density_particle_color_source_from_shader(shader_point_density);
4321  }
4322  else {
4323  BLI_assert(shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_OBJECT);
4324  pd->source = TEX_PD_OBJECT;
4326  pd->ob_color_source = point_density_vertex_color_source_from_shader(shader_point_density);
4328  shader_point_density->vertex_attribute_name,
4329  sizeof(pd->vertex_attribute_name));
4330  }
4331 
4332  /* Store resolution, so it can be changed in the UI. */
4333  shader_point_density->cached_resolution = shader_point_density->resolution;
4334 
4335  /* Single-threaded sampling of the voxel domain. */
4337 }
4338 
4339 void rna_ShaderNodePointDensity_density_calc(bNode *self,
4341  int *length,
4342  float **values)
4343 {
4344  NodeShaderTexPointDensity *shader_point_density = self->storage;
4345  PointDensity *pd = &shader_point_density->pd;
4346  const int resolution = shader_point_density->cached_resolution;
4347 
4348  if (depsgraph == NULL) {
4349  *length = 0;
4350  return;
4351  }
4352 
4353  /* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */
4354  *length = 4 * resolution * resolution * resolution;
4355 
4356  if (*values == NULL) {
4357  *values = MEM_mallocN(sizeof(float) * (*length), "point density dynamic array");
4358  }
4359 
4360  /* Single-threaded sampling of the voxel domain. */
4361  RE_point_density_sample(depsgraph, pd, resolution, *values);
4362 
4363  /* We're done, time to clean up. */
4365  memset(pd, 0, sizeof(*pd));
4366  shader_point_density->cached_resolution = 0.0f;
4367 }
4368 
4369 void rna_ShaderNodePointDensity_density_minmax(bNode *self,
4371  float r_min[3],
4372  float r_max[3])
4373 {
4374  NodeShaderTexPointDensity *shader_point_density = self->storage;
4375  PointDensity *pd = &shader_point_density->pd;
4376 
4377  if (depsgraph == NULL) {
4378  zero_v3(r_min);
4379  zero_v3(r_max);
4380  return;
4381  }
4382 
4383  RE_point_density_minmax(depsgraph, pd, r_min, r_max);
4384 }
4385 
4386 #else
4387 
4389  {0, "PLACEHOLDER", 0, "Placeholder", ""},
4390  {0, NULL, 0, NULL, NULL},
4391 };
4392 
4394  {0, "ALL", 0, "All", ""},
4395  {0, NULL, 0, NULL, NULL},
4396 };
4397 
4399  {0, "PLACEHOLDER", 0, "Placeholder", ""},
4400  {0, NULL, 0, NULL, NULL},
4401 };
4402 
4404  {1, "R", 0, "R", ""},
4405  {2, "G", 0, "G", ""},
4406  {3, "B", 0, "B", ""},
4407  {0, NULL, 0, NULL, NULL},
4408 };
4409 
4411  {0, "X", 0, "Flip X", ""},
4412  {1, "Y", 0, "Flip Y", ""},
4413  {2, "XY", 0, "Flip X & Y", ""},
4414  {0, NULL, 0, NULL, NULL},
4415 };
4416 
4418  {0, "ITUBT601", 0, "ITU 601", ""},
4419  {1, "ITUBT709", 0, "ITU 709", ""},
4420  {2, "JFIF", 0, "Jpeg", ""},
4421  {0, NULL, 0, NULL, NULL},
4422 };
4423 
4425  {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
4426  {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4427  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4428  {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
4429  {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
4430  {0, NULL, 0, NULL, NULL},
4431 };
4432 
4434  {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4435  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4436  {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
4437  {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
4438  {0, NULL, 0, NULL, NULL},
4439 };
4440 
4442  {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
4443  {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4444  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4445  {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
4446  {0, NULL, 0, NULL, NULL},
4447 };
4448 
4450  {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
4451  {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
4452  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4453  {0, NULL, 0, NULL, NULL},
4454 };
4455 
4457  {SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
4458  {SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", ""},
4459  {0, NULL, 0, NULL, NULL},
4460 };
4461 
4463  {SHD_HAIR_REFLECTION, "Reflection", 0, "Reflection", ""},
4464  {SHD_HAIR_TRANSMISSION, "Transmission", 0, "Transmission", ""},
4465  {0, NULL, 0, NULL, NULL},
4466 };
4467 
4470  "ABSORPTION",
4471  0,
4472  "Absorption Coefficient",
4473  "Directly set the absorption coefficient \"sigma_a\" (this is not the most intuitive way to "
4474  "color hair)"},
4476  "MELANIN",
4477  0,
4478  "Melanin Concentration",
4479  "Define the melanin concentrations below to get the most realistic-looking hair "
4480  "(you can get the concentrations for different types of hair online)"},
4482  "COLOR",
4483  0,
4484  "Direct Coloring",
4485  "Choose the color of your preference, and the shader will approximate the absorption "
4486  "coefficient to render lookalike hair"},
4487  {0, NULL, 0, NULL, NULL},
4488 };
4489 
4491  {NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
4492  {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
4493  {0, NULL, 0, NULL, NULL},
4494 };
4495 
4497  {NODE_IES_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
4498  {NODE_IES_EXTERNAL, "EXTERNAL", 0, "External", "Use external .ies file"},
4499  {0, NULL, 0, NULL, NULL},
4500 };
4501 
4503  {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
4504  {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
4505  {0, NULL, 0, NULL, NULL},
4506 };
4507 
4510  "BURLEY",
4511  0,
4512  "Christensen-Burley",
4513  "Approximation to physically based volume scattering"},
4515  "RANDOM_WALK",
4516  0,
4517  "Random Walk",
4518  "Volumetric approximation to physically based volume scattering"},
4519  {0, NULL, 0, NULL, NULL}};
4520 
4521 /* -- Common nodes ---------------------------------------------------------- */
4522 
4523 static void def_group_input(StructRNA *srna)
4524 {
4525  PropertyRNA *prop;
4526 
4527  prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
4529  prop, NULL, NULL, "rna_NodeGroupInputOutput_interface_typef", NULL);
4530  RNA_def_property_struct_type(prop, "PropertyGroup");
4532  RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
4533 }
4534 
4535 static void def_group_output(StructRNA *srna)
4536 {
4537  PropertyRNA *prop;
4538 
4539  prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
4541  prop, NULL, NULL, "rna_NodeGroupInputOutput_interface_typef", NULL);
4542  RNA_def_property_struct_type(prop, "PropertyGroup");
4544  RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
4545 
4546  prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
4549  prop, "Active Output", "True if this node is used as the active group output");
4550  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4551 }
4552 
4553 static void def_group(StructRNA *srna)
4554 {
4555  PropertyRNA *prop;
4556 
4557  prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
4558  RNA_def_property_pointer_sdna(prop, NULL, "id");
4559  RNA_def_property_struct_type(prop, "NodeTree");
4561  prop, NULL, "rna_NodeGroup_node_tree_set", NULL, "rna_NodeGroup_node_tree_poll");
4564  RNA_def_property_ui_text(prop, "Node Tree", "");
4565  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
4566 
4567  prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
4568  RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_NodeGroup_interface_typef", NULL);
4569  RNA_def_property_struct_type(prop, "PropertyGroup");
4571  RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
4572 }
4573 
4574 static void def_custom_group(BlenderRNA *brna,
4575  const char *struct_name,
4576  const char *base_name,
4577  const char *ui_name,
4578  const char *ui_desc,
4579  const char *reg_func)
4580 {
4581  StructRNA *srna;
4582 
4583  srna = RNA_def_struct(brna, struct_name, base_name);
4584  RNA_def_struct_ui_text(srna, ui_name, ui_desc);
4585  RNA_def_struct_sdna(srna, "bNode");
4586 
4587  RNA_def_struct_register_funcs(srna, reg_func, "rna_Node_unregister", NULL);
4588 
4589  def_group(srna);
4590 }
4591 
4592 static void def_frame(StructRNA *srna)
4593 {
4594  PropertyRNA *prop;
4595 
4596  prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
4597  RNA_def_property_pointer_sdna(prop, NULL, "id");
4598  RNA_def_property_struct_type(prop, "Text");
4600  RNA_def_property_ui_text(prop, "Text", "");
4601  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4602 
4603  RNA_def_struct_sdna_from(srna, "NodeFrame", "storage");
4605 
4606  prop = RNA_def_property(srna, "shrink", PROP_BOOLEAN, PROP_NONE);
4608  RNA_def_property_ui_text(prop, "Shrink", "Shrink the frame to minimal bounding box");
4610 
4611  prop = RNA_def_property(srna, "label_size", PROP_INT, PROP_NONE);
4612  RNA_def_property_int_sdna(prop, NULL, "label_size");
4613  RNA_def_property_range(prop, 8, 64);
4614  RNA_def_property_ui_text(prop, "Label Font Size", "Font size to use for displaying the label");
4616 }
4617 
4618 static void def_clamp(StructRNA *srna)
4619 {
4620  PropertyRNA *prop;
4621 
4622  prop = RNA_def_property(srna, "clamp_type", PROP_ENUM, PROP_NONE);
4623  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4625  RNA_def_property_ui_text(prop, "Clamp Type", "");
4626  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4627 }
4628 
4629 static void def_map_range(StructRNA *srna)
4630 {
4631  PropertyRNA *prop;
4632 
4633  prop = RNA_def_property(srna, "clamp", PROP_BOOLEAN, PROP_NONE);
4634  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
4635  RNA_def_property_ui_text(prop, "Clamp", "Clamp the result to the target range [To Min, To Max]");
4636  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4637 
4638  prop = RNA_def_property(srna, "interpolation_type", PROP_ENUM, PROP_NONE);
4639  RNA_def_property_enum_sdna(prop, NULL, "custom2");
4641  RNA_def_property_ui_text(prop, "Interpolation Type", "");
4642  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4643 }
4644 
4645 static void def_math(StructRNA *srna)
4646 {
4647  PropertyRNA *prop;
4648 
4649  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4650  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4652  RNA_def_property_ui_text(prop, "Operation", "");
4653  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4654 
4655  prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
4657  RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
4658  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4659 }
4660 
4661 static void def_boolean_math(StructRNA *srna)
4662 {
4663  PropertyRNA *prop;
4664 
4665  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4666  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4668  RNA_def_property_ui_text(prop, "Operation", "");
4669  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
4670 }
4671 
4672 static void def_float_compare(StructRNA *srna)
4673 {
4674  PropertyRNA *prop;
4675 
4676  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4677  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4679  RNA_def_property_ui_text(prop, "Operation", "");
4680  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
4681 }
4682 
4683 static void def_vector_math(StructRNA *srna)
4684 {
4685  PropertyRNA *prop;
4686 
4687  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
4688  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4690  RNA_def_property_ui_text(prop, "Operation", "");
4691  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4692 }
4693 
4694 static void def_rgb_curve(StructRNA *srna)
4695 {
4696  PropertyRNA *prop;
4697 
4698  prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
4699  RNA_def_property_pointer_sdna(prop, NULL, "storage");
4700  RNA_def_property_struct_type(prop, "CurveMapping");
4701  RNA_def_property_ui_text(prop, "Mapping", "");
4702  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4703 }
4704 
4705 static void def_vector_curve(StructRNA *srna)
4706 {
4707  PropertyRNA *prop;
4708 
4709  prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
4710  RNA_def_property_pointer_sdna(prop, NULL, "storage");
4711  RNA_def_property_struct_type(prop, "CurveMapping");
4712  RNA_def_property_ui_text(prop, "Mapping", "");
4713  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4714 }
4715 
4716 static void def_time(StructRNA *srna)
4717 {
4718  PropertyRNA *prop;
4719 
4720  prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
4721  RNA_def_property_pointer_sdna(prop, NULL, "storage");
4722  RNA_def_property_struct_type(prop, "CurveMapping");
4723  RNA_def_property_ui_text(prop, "Curve", "");
4724  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4725 
4726  prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
4727  RNA_def_property_int_sdna(prop, NULL, "custom1");
4728  RNA_def_property_ui_text(prop, "Start Frame", "");
4729  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4730 
4731  prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
4732  RNA_def_property_int_sdna(prop, NULL, "custom2");
4733  RNA_def_property_ui_text(prop, "End Frame", "");
4734  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4735 }
4736 
4737 static void def_colorramp(StructRNA *srna)
4738 {
4739  PropertyRNA *prop;
4740 
4741  prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
4742  RNA_def_property_pointer_sdna(prop, NULL, "storage");
4743  RNA_def_property_struct_type(prop, "ColorRamp");
4744  RNA_def_property_ui_text(prop, "Color Ramp", "");
4745  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4746 }
4747 
4748 static void def_mix_rgb(StructRNA *srna)
4749 {
4750  PropertyRNA *prop;
4751 
4752  prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
4753  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4755  RNA_def_property_ui_text(prop, "Blending Mode", "");
4756  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4757 
4758  prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
4760  RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
4761  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4762 
4763  prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
4765  RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
4766  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4767 }
4768 
4769 static void def_texture(StructRNA *srna)
4770 {
4771  PropertyRNA *prop;
4772 
4773  prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
4774  RNA_def_property_pointer_sdna(prop, NULL, "id");
4775  RNA_def_property_struct_type(prop, "Texture");
4778  RNA_def_property_ui_text(prop, "Texture", "");
4779  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4780 
4781  prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
4782  RNA_def_property_int_sdna(prop, NULL, "custom1");
4784  prop, "Node Output", "For node-based textures, which output node to use");
4785  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4786 }
4787 
4788 static void def_fn_input_vector(StructRNA *srna)
4789 {
4790  PropertyRNA *prop;
4791 
4792  RNA_def_struct_sdna_from(srna, "NodeInputVector", "storage");
4793 
4794  prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_XYZ);
4795  RNA_def_property_array(prop, 3);
4796  RNA_def_property_float_sdna(prop, NULL, "vector");
4797  RNA_def_property_ui_text(prop, "Vector", "");
4798  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4799 }
4800 
4801 static void def_fn_input_string(StructRNA *srna)
4802 {
4803  PropertyRNA *prop;
4804 
4805  RNA_def_struct_sdna_from(srna, "NodeInputString", "storage");
4806 
4807  prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
4808  RNA_def_property_ui_text(prop, "String", "");
4809  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4810 }
4811 
4812 /* -- Shader Nodes ---------------------------------------------------------- */
4813 
4814 static void def_sh_output(StructRNA *srna)
4815 {
4816  PropertyRNA *prop;
4817 
4818  prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
4821  prop, "Active Output", "True if this node is used as the active output");
4822  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4823 
4824  prop = RNA_def_property(srna, "target", PROP_ENUM, PROP_NONE);
4825  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4828  prop, "Target", "Which renderer and viewport shading types to use the shaders for");
4829  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4830 }
4831 
4833 {
4834  def_sh_output(srna);
4835  def_mix_rgb(srna);
4836 }
4837 
4838 static void def_sh_mapping(StructRNA *srna)
4839 {
4840  PropertyRNA *prop;
4841 
4842  prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
4843  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4845  RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
4846  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4847 }
4848 
4850 {
4851  PropertyRNA *prop;
4852 
4853  prop = RNA_def_property(srna, "rotation_type", PROP_ENUM, PROP_NONE);
4854  RNA_def_property_enum_sdna(prop, NULL, "custom1");
4856  RNA_def_property_ui_text(prop, "Type", "Type of rotation");
4857  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
4858 
4859  prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
4860  RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0);
4861  RNA_def_property_ui_text(prop, "Invert", "Invert angle");
4862  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4863 }
4864 
4865 static void def_sh_attribute(StructRNA *srna)
4866 {
4867  static const EnumPropertyItem prop_attribute_type[] = {
4869  "GEOMETRY",
4870  0,
4871  "Geometry",
4872  "The attribute is associated with the object geometry, and its value "
4873  "varies from vertex to vertex, or within the object volume"},
4875  "OBJECT",
4876  0,
4877  "Object",
4878  "The attribute is associated with the object or mesh data-block itself, "
4879  "and its value is uniform"},
4881  "INSTANCER",
4882  0,
4883  "Instancer",
4884  "The attribute is associated with the instancer particle system or object, "
4885  "falling back to the Object mode if the attribute isn't found, or the object "
4886  "is not instanced"},
4887  {0, NULL, 0, NULL, NULL},
4888  };
4889  PropertyRNA *prop;
4890 
4891  RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage");
4892 
4893  prop = RNA_def_property(srna, "attribute_type", PROP_ENUM, PROP_NONE);
4894  RNA_def_property_enum_sdna(prop, NULL, "type");
4895  RNA_def_property_enum_items(prop, prop_attribute_type);
4896  RNA_def_property_ui_text(prop, "Attribute Type", "General type of the attribute");
4897  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4898 
4899  prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
4900  RNA_def_property_string_sdna(prop, NULL, "name");
4901  RNA_def_property_ui_text(prop, "Attribute Name", "");
4902  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4903 }
4904 
4905 static void def_sh_tex(StructRNA *srna)
4906 {
4907  PropertyRNA *prop;
4908 
4909  prop = RNA_def_property(srna, "texture_mapping", PROP_POINTER, PROP_NONE);
4910  RNA_def_property_pointer_sdna(prop, NULL, "base.tex_mapping");
4912  RNA_def_property_ui_text(prop, "Texture Mapping", "Texture coordinate mapping settings");
4913 
4914  prop = RNA_def_property(srna, "color_mapping", PROP_POINTER, PROP_NONE);
4915  RNA_def_property_pointer_sdna(prop, NULL, "base.color_mapping");
4917  RNA_def_property_ui_text(prop, "Color Mapping", "Color mapping settings");
4918 }
4919 
4920 static void def_sh_tex_sky(StructRNA *srna)
4921 {
4922  static const EnumPropertyItem prop_sky_type[] = {
4923  {SHD_SKY_PREETHAM, "PREETHAM", 0, "Preetham", "Preetham 1999"},
4924  {SHD_SKY_HOSEK, "HOSEK_WILKIE", 0, "Hosek / Wilkie", "Hosek / Wilkie 2012"},
4925  {SHD_SKY_NISHITA, "NISHITA", 0, "Nishita", "Nishita 1993 improved"},
4926  {0, NULL, 0, NULL, NULL},
4927  };
4928  static float default_dir[3] = {0.0f, 0.0f, 1.0f};
4929 
4930  PropertyRNA *prop;
4931 
4932  RNA_def_struct_sdna_from(srna, "NodeTexSky", "storage");
4933  def_sh_tex(srna);
4934 
4935  prop = RNA_def_property(srna, "sky_type", PROP_ENUM, PROP_NONE);
4936  RNA_def_property_enum_sdna(prop, NULL, "sky_model");
4937  RNA_def_property_enum_items(prop, prop_sky_type);
4938  RNA_def_property_ui_text(prop, "Sky Type", "Which sky model should be used");
4939  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
4940 
4941  prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION);
4942  RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining");
4943  RNA_def_property_array(prop, 3);
4944  RNA_def_property_float_array_default(prop, default_dir);
4945  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4946 
4947  prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE);
4948  RNA_def_property_range(prop, 1.0f, 10.0f);
4949  RNA_def_property_ui_range(prop, 1.0f, 10.0f, 10, 3);
4950  RNA_def_property_ui_text(prop, "Turbidity", "Atmospheric turbidity");
4951  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4952 
4953  prop = RNA_def_property(srna, "ground_albedo", PROP_FLOAT, PROP_FACTOR);
4954  RNA_def_property_range(prop, 0.0f, 1.0f);
4956  prop, "Ground Albedo", "Ground color that is subtly reflected in the sky");
4957  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4958 
4959  prop = RNA_def_property(srna, "sun_disc", PROP_BOOLEAN, PROP_NONE);
4960  RNA_def_property_ui_text(prop, "Sun Disc", "Include the sun itself in the output");
4961  RNA_def_property_boolean_sdna(prop, NULL, "sun_disc", 1);
4963  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
4964 
4965  prop = RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_ANGLE);
4966  RNA_def_property_ui_text(prop, "Sun Size", "Size of sun disc");
4967  RNA_def_property_range(prop, 0.0f, M_PI_2);
4969  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4970 
4971  prop = RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
4972  RNA_def_property_ui_text(prop, "Sun Intensity", "Strength of sun");
4973  RNA_def_property_range(prop, 0.0f, 1000.0f);
4974  RNA_def_property_float_default(prop, 1.0f);
4975  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4976 
4977  prop = RNA_def_property(srna, "sun_elevation", PROP_FLOAT, PROP_ANGLE);
4978  RNA_def_property_ui_text(prop, "Sun Elevation", "Sun angle from horizon");
4981  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4982 
4983  prop = RNA_def_property(srna, "sun_rotation", PROP_FLOAT, PROP_ANGLE);
4984  RNA_def_property_ui_text(prop, "Sun Rotation", "Rotation of sun around zenith");
4985  RNA_def_property_float_default(prop, 0.0f);
4986  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4987 
4988  prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_DISTANCE);
4989  RNA_def_property_ui_text(prop, "Altitude", "Height from sea level");
4990  RNA_def_property_range(prop, 0.0f, 60000.0f);
4991  RNA_def_property_ui_range(prop, 0.0f, 60000.0f, 10, 1);
4992  RNA_def_property_float_default(prop, 0.0f);
4993  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
4994 
4995  prop = RNA_def_property(srna, "air_density", PROP_FLOAT, PROP_FACTOR);
4996  RNA_def_property_ui_text(prop, "Air", "Density of air molecules");
4997  RNA_def_property_range(prop, 0.0f, 10.0f);
4998  RNA_def_property_float_default(prop, 1.0f);
4999  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5000 
5001  prop = RNA_def_property(srna, "dust_density", PROP_FLOAT, PROP_FACTOR);
5002  RNA_def_property_ui_text(prop, "Dust", "Density of dust molecules and water droplets");
5003  RNA_def_property_range(prop, 0.0f, 10.0f);
5004  RNA_def_property_float_default(prop, 1.0f);
5005  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5006 
5007  prop = RNA_def_property(srna, "ozone_density", PROP_FLOAT, PROP_FACTOR);
5008  RNA_def_property_ui_text(prop, "Ozone", "Density of ozone layer");
5009  RNA_def_property_range(prop, 0.0f, 10.0f);
5010  RNA_def_property_float_default(prop, 1.0f);
5011  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5012 }
5013 
5015  {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
5016  {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
5017  {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
5018  {SHD_INTERP_SMART, "Smart", 0, "Smart", "Bicubic when magnifying, else bilinear (OSL only)"},
5019  {0, NULL, 0, NULL, NULL},
5020 };
5021 
5023 {
5024  static const EnumPropertyItem prop_projection_items[] = {
5026  "EQUIRECTANGULAR",
5027  0,
5028  "Equirectangular",
5029  "Equirectangular or latitude-longitude projection"},
5031  "MIRROR_BALL",
5032  0,
5033  "Mirror Ball",
5034  "Projection from an orthographic photo of a mirror ball"},
5035  {0, NULL, 0, NULL, NULL},
5036  };
5037 
5038  PropertyRNA *prop;
5039 
5040  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
5041  RNA_def_property_pointer_sdna(prop, NULL, "id");
5042  RNA_def_property_struct_type(prop, "Image");
5045  RNA_def_property_ui_text(prop, "Image", "");
5046  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
5047 
5048  RNA_def_struct_sdna_from(srna, "NodeTexEnvironment", "storage");
5049  def_sh_tex(srna);
5050 
5051  prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
5052  RNA_def_property_enum_items(prop, prop_projection_items);
5053  RNA_def_property_ui_text(prop, "Projection", "Projection of the input image");
5054  RNA_def_property_update(prop, 0, "rna_Node_update");
5055 
5056  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5058  RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
5059  RNA_def_property_update(prop, 0, "rna_Node_update");
5060 
5061  prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
5063  RNA_def_property_pointer_sdna(prop, NULL, "iuser");
5065  prop,
5066  "Image User",
5067  "Parameters defining which layer, pass and frame of the image is displayed");
5068  RNA_def_property_update(prop, 0, "rna_Node_update");
5069 }
5070 
5071 static void def_sh_tex_image(StructRNA *srna)
5072 {
5073  static const EnumPropertyItem prop_projection_items[] = {
5074  {SHD_PROJ_FLAT,
5075  "FLAT",
5076  0,
5077  "Flat",
5078  "Image is projected flat using the X and Y coordinates of the texture vector"},
5079  {SHD_PROJ_BOX,
5080  "BOX",
5081  0,
5082  "Box",
5083  "Image is projected using different components for each side of the object space bounding "
5084  "box"},
5085  {SHD_PROJ_SPHERE,
5086  "SPHERE",
5087  0,
5088  "Sphere",
5089  "Image is projected spherically using the Z axis as central"},
5090  {SHD_PROJ_TUBE,
5091  "TUBE",
5092  0,
5093  "Tube",
5094  "Image is projected from the tube using the Z axis as central"},
5095  {0, NULL, 0, NULL, NULL},
5096  };
5097 
5098  static const EnumPropertyItem prop_image_extension[] = {
5100  "REPEAT",
5101  0,
5102  "Repeat",
5103  "Cause the image to repeat horizontally and vertically"},
5105  "EXTEND",
5106  0,
5107  "Extend",
5108  "Extend by repeating edge pixels of the image"},
5110  "CLIP",
5111  0,
5112  "Clip",
5113  "Clip to image size and set exterior pixels as transparent"},
5114  {0, NULL, 0, NULL, NULL},
5115  };
5116 
5117  PropertyRNA *prop;
5118 
5119  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
5120  RNA_def_property_pointer_sdna(prop, NULL, "id");
5121  RNA_def_property_struct_type(prop, "Image");
5124  RNA_def_property_ui_text(prop, "Image", "");
5125  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
5126 
5127  RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
5128  def_sh_tex(srna);
5129 
5130  prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
5131  RNA_def_property_enum_items(prop, prop_projection_items);
5133  prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
5134  RNA_def_property_update(prop, 0, "rna_Node_update");
5135 
5136  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5138  RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
5139  RNA_def_property_update(prop, 0, "rna_Node_update");
5140 
5141  prop = RNA_def_property(srna, "projection_blend", PROP_FLOAT, PROP_FACTOR);
5143  prop, "Projection Blend", "For box projection, amount of blend to use between sides");
5144  RNA_def_property_update(prop, 0, "rna_Node_update");
5145 
5146  prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
5147  RNA_def_property_enum_items(prop, prop_image_extension);
5149  prop, "Extension", "How the image is extrapolated past its original bounds");
5150  RNA_def_property_update(prop, 0, "rna_Node_update");
5151 
5152  prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
5154  RNA_def_property_pointer_sdna(prop, NULL, "iuser");
5156  prop,
5157  "Image User",
5158  "Parameters defining which layer, pass and frame of the image is displayed");
5159  RNA_def_property_update(prop, 0, "rna_Node_update");
5160 }
5161 
5162 static void def_sh_tex_gradient(StructRNA *srna)
5163 {
5164  static const EnumPropertyItem prop_gradient_type[] = {
5165  {SHD_BLEND_LINEAR, "LINEAR", 0, "Linear", "Create a linear progression"},
5166  {SHD_BLEND_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
5168  "EASING",
5169  0,
5170  "Easing",
5171  "Create a progression easing from one step to the next"},
5172  {SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
5173  {SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
5175  "QUADRATIC_SPHERE",
5176  0,
5177  "Quadratic Sphere",
5178  "Create a quadratic progression in the shape of a sphere"},
5179  {SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Create a radial progression"},
5180  {0, NULL, 0, NULL, NULL},
5181  };
5182 
5183  PropertyRNA *prop;
5184 
5185  RNA_def_struct_sdna_from(srna, "NodeTexGradient", "storage");
5186  def_sh_tex(srna);
5187 
5188  prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
5189  RNA_def_property_enum_items(prop, prop_gradient_type);
5190  RNA_def_property_ui_text(prop, "Gradient Type", "Style of the color blending");
5191  RNA_def_property_update(prop, 0, "rna_Node_update");
5192 }
5193 
5194 static void def_sh_tex_noise(StructRNA *srna)
5195 {
5196  PropertyRNA *prop;
5197 
5198  RNA_def_struct_sdna_from(srna, "NodeTexNoise", "storage");
5199  def_sh_tex(srna);
5200 
5201  prop = RNA_def_property(srna, "noise_dimensions", PROP_ENUM, PROP_NONE);
5202  RNA_def_property_enum_sdna(prop, NULL, "dimensions");
5205  prop, "Dimensions", "The dimensions of the space to evaluate the noise in");
5206  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5207 }
5208 
5209 static void def_sh_tex_checker(StructRNA *srna)
5210 {
5211  RNA_def_struct_sdna_from(srna, "NodeTexChecker", "storage");
5212  def_sh_tex(srna);
5213 }
5214 
5215 static void def_sh_tex_brick(StructRNA *srna)
5216 {
5217  PropertyRNA *prop;
5218 
5219  RNA_def_struct_sdna_from(srna, "NodeTexBrick", "storage");
5220  def_sh_tex(srna);
5221 
5222  prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
5223  RNA_def_property_int_sdna(prop, NULL, "offset_freq");
5225  RNA_def_property_range(prop, 1, 99);
5226  RNA_def_property_ui_text(prop, "Offset Frequency", "");
5227  RNA_def_property_update(prop, 0, "rna_Node_update");
5228 
5229  prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
5230  RNA_def_property_int_sdna(prop, NULL, "squash_freq");
5232  RNA_def_property_range(prop, 1, 99);
5233  RNA_def_property_ui_text(prop, "Squash Frequency", "");
5234  RNA_def_property_update(prop, 0, "rna_Node_update");
5235 
5236  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
5237  RNA_def_property_float_sdna(prop, NULL, "offset");
5238  RNA_def_property_float_default(prop, 0.5f);
5239  RNA_def_property_range(prop, 0.0f, 1.0f);
5240  RNA_def_property_ui_text(prop, "Offset Amount", "");
5241  RNA_def_property_update(prop, 0, "rna_Node_update");
5242 
5243  prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
5244  RNA_def_property_float_sdna(prop, NULL, "squash");
5245  RNA_def_property_float_default(prop, 1.0f);
5246  RNA_def_property_range(prop, 0.0f, 99.0f);
5247  RNA_def_property_ui_text(prop, "Squash Amount", "");
5248  RNA_def_property_update(prop, 0, "rna_Node_update");
5249 }
5250 
5251 static void def_sh_tex_magic(StructRNA *srna)
5252 {
5253  PropertyRNA *prop;
5254 
5255  RNA_def_struct_sdna_from(srna, "NodeTexMagic", "storage");
5256  def_sh_tex(srna);
5257 
5258  prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
5259  RNA_def_property_int_sdna(prop, NULL, "depth");
5260  RNA_def_property_range(prop, 0, 10);
5261  RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
5262  RNA_def_property_update(prop, 0, "rna_Node_update");
5263 }
5264 
5265 static void def_sh_tex_musgrave(StructRNA *srna)
5266 {
5267  static const EnumPropertyItem prop_musgrave_type[] = {
5268  {SHD_MUSGRAVE_MULTIFRACTAL, "MULTIFRACTAL", 0, "Multifractal", ""},
5269  {SHD_MUSGRAVE_RIDGED_MULTIFRACTAL, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", ""},
5270  {SHD_MUSGRAVE_HYBRID_MULTIFRACTAL, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", ""},
5271  {SHD_MUSGRAVE_FBM, "FBM", 0, "fBM", ""},
5272  {SHD_MUSGRAVE_HETERO_TERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", ""},
5273  {0, NULL, 0, NULL, NULL},
5274  };
5275 
5276  PropertyRNA *prop;
5277 
5278  RNA_def_struct_sdna_from(srna, "NodeTexMusgrave", "storage");
5279  def_sh_tex(srna);
5280 
5281  prop = RNA_def_property(srna, "musgrave_dimensions", PROP_ENUM, PROP_NONE);
5282  RNA_def_property_enum_sdna(prop, NULL, "dimensions");
5284  RNA_def_property_ui_text(prop, "Dimensions", "");
5285  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5286 
5287  prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
5288  RNA_def_property_enum_sdna(prop, NULL, "musgrave_type");
5289  RNA_def_property_enum_items(prop, prop_musgrave_type);
5290  RNA_def_property_ui_text(prop, "Type", "");
5291  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5292 }
5293 
5294 static void def_sh_tex_voronoi(StructRNA *srna)
5295 {
5296  static EnumPropertyItem prop_distance_items[] = {
5297  {SHD_VORONOI_EUCLIDEAN, "EUCLIDEAN", 0, "Euclidean", "Euclidean distance"},
5298  {SHD_VORONOI_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Manhattan distance"},
5299  {SHD_VORONOI_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Chebychev distance"},
5300  {SHD_VORONOI_MINKOWSKI, "MINKOWSKI", 0, "Minkowski", "Minkowski distance"},
5301  {0, NULL, 0, NULL, NULL}};
5302 
5303  static EnumPropertyItem prop_feature_items[] = {
5304  {SHD_VORONOI_F1,
5305  "F1",
5306  0,
5307  "F1",
5308  "Computes the distance to the closest point as well as its position and color"},
5309  {SHD_VORONOI_F2,
5310  "F2",
5311  0,
5312  "F2",
5313  "Computes the distance to the second closest point as well as its position and color"},
5315  "SMOOTH_F1",
5316  0,
5317  "Smooth F1",
5318  "Smoothed version of F1. Weighted sum of neighbor voronoi cells"},
5320  "DISTANCE_TO_EDGE",
5321  0,
5322  "Distance to Edge",
5323  "Computes the distance to the edge of the voronoi cell"},
5325  "N_SPHERE_RADIUS",
5326  0,
5327  "N-Sphere Radius",
5328  "Computes the radius of the n-sphere inscribed in the voronoi cell"},
5329  {0, NULL, 0, NULL, NULL}};
5330 
5331  PropertyRNA *prop;
5332 
5333  RNA_def_struct_sdna_from(srna, "NodeTexVoronoi", "storage");
5334  def_sh_tex(srna);
5335 
5336  prop = RNA_def_property(srna, "voronoi_dimensions", PROP_ENUM, PROP_NONE);
5337  RNA_def_property_enum_sdna(prop, NULL, "dimensions");
5339  RNA_def_property_ui_text(prop, "Dimensions", "");
5340  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5341 
5342  prop = RNA_def_property(srna, "distance", PROP_ENUM, PROP_NONE);
5343  RNA_def_property_enum_sdna(prop, NULL, "distance");
5344  RNA_def_property_enum_items(prop, prop_distance_items);
5345  RNA_def_property_ui_text(prop, "Distance Metric", "");
5346  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5347 
5348  prop = RNA_def_property(srna, "feature", PROP_ENUM, PROP_NONE);
5349  RNA_def_property_enum_sdna(prop, NULL, "feature");
5350  RNA_def_property_enum_items(prop, prop_feature_items);
5351  RNA_def_property_ui_text(prop, "Feature Output", "");
5352  RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
5353 }
5354 
5355 static void def_sh_tex_wave(StructRNA *srna)
5356 {
5357  static const EnumPropertyItem prop_wave_type_items[] = {
5358  {SHD_WAVE_BANDS, "BANDS", 0, "Bands", "Use standard wave texture in bands"},
5359  {SHD_WAVE_RINGS, "RINGS", 0, "Rings", "Use wave texture in rings"},
5360  {0, NULL, 0, NULL, NULL},
5361  };
5362 
5363  static EnumPropertyItem prop_wave_bands_direction_items[] = {
5364  {SHD_WAVE_BANDS_DIRECTION_X, "X", 0, "X", "Bands across X axis"},
5365  {SHD_WAVE_BANDS_DIRECTION_Y, "Y", 0, "Y", "Bands across Y axis"},
5366  {SHD_WAVE_BANDS_DIRECTION_Z, "Z", 0, "Z", "Bands across Z axis"},
5367  {SHD_WAVE_BANDS_DIRECTION_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Bands across diagonal axis"},
5368  {0, NULL, 0, NULL, NULL},
5369  };
5370 
5371  static EnumPropertyItem prop_wave_rings_direction_items[] = {
5372  {SHD_WAVE_RINGS_DIRECTION_X, "X", 0, "X", "Rings along X axis"},
5373  {SHD_WAVE_RINGS_DIRECTION_Y, "Y", 0, "Y", "Rings along Y axis"},
5374  {SHD_WAVE_RINGS_DIRECTION_Z, "Z", 0, "Z", "Rings along Z axis"},
5376  "SPHERICAL",
5377  0,
5378  "Spherical",
5379  "Rings along spherical distance"},
5380  {0, NULL, 0, NULL, NULL},
5381  };
5382 
5383  static const EnumPropertyItem prop_wave_profile_items[] = {
5384  {SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"},
5385  {SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"},
5386  {SHD_WAVE_PROFILE_TRI, "TRI", 0, "Triangle", "Use a triangle profile"},
5387  {0, NULL, 0, NULL, NULL},
5388  };
5389 
5390  PropertyRNA *prop;
5391 
5392  RNA_def_struct_sdna_from(srna, "NodeTexWave", "storage");
5393  def_sh_tex(srna);
5394 
5395  prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
5396  RNA_def_property_enum_sdna(prop, NULL, "wave_type");
5397  RNA_def_property_enum_items(prop, prop_wave_type_items);
5398  RNA_def_property_ui_text(prop, "Wave Type", "");
5399  RNA_def_property_update(prop, 0, "rna_Node_update");
5400 
5401  prop = RNA_def_property(srna, "bands_direction", PROP_ENUM, PROP_NONE);
5402  RNA_def_property_enum_sdna(prop, NULL, "bands_direction");
5403  RNA_def_property_enum_items(prop, prop_wave_bands_direction_items);
5404  RNA_def_property_ui_text(prop, "Bands Direction", "");
5405  RNA_def_property_update(prop, 0, "rna_Node_update");
5406 
5407  prop = RNA_def_property(srna, "rings_direction", PROP_ENUM, PROP_NONE);
5408  RNA_def_property_enum_sdna(prop, NULL, "rings_direction");
5409  RNA_def_property_enum_items(prop, prop_wave_rings_direction_items);
5410  RNA_def_property_ui_text(prop, "Rings Direction", "");
5411  RNA_def_property_update(prop, 0, "rna_Node_update");
5412 
5413  prop = RNA_def_property(srna, "wave_profile", PROP_ENUM, PROP_NONE);
5414  RNA_def_property_enum_sdna(prop, NULL, "wave_profile");
5415  RNA_def_property_enum_items(prop, prop_wave_profile_items);
5416  RNA_def_property_ui_text(prop, "Wave Profile", "");
5417  RNA_def_property_update(prop, 0, "rna_Node_update");
5418 }
5419 
5421 {
5422  PropertyRNA *prop;
5423 
5424  prop = RNA_def_property(srna, "noise_dimensions", PROP_ENUM, PROP_NONE);
5425  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5428  prop, "Dimensions", "The dimensions of the space to evaluate the noise in");
5429  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5430 }
5431 
5432 static void def_sh_tex_coord(StructRNA *srna)
5433 {
5434  PropertyRNA *prop;
5435 
5436  prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
5437  RNA_def_property_pointer_sdna(prop, NULL, "id");
5438  RNA_def_property_struct_type(prop, "Object");
5442  prop, "Object", "Use coordinates from this object (for object texture coordinates output)");
5443  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
5444 
5445  prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
5446  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
5448  prop, "From Instancer", "Use the parent of the instance object if possible");
5449  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5450 }
5451 
5453 {
5454  static const EnumPropertyItem prop_vect_type_items[] = {
5455  {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
5456  {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
5458  "NORMAL",
5459  0,
5460  "Normal",
5461  "Transform a normal vector with unit length"},
5462  {0, NULL, 0, NULL, NULL},
5463  };
5464 
5465  static const EnumPropertyItem prop_vect_space_items[] = {
5466  {SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""},
5467  {SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""},
5468  {SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""},
5469  {0, NULL, 0, NULL, NULL},
5470  };
5471 
5472  PropertyRNA *prop;
5473 
5474  RNA_def_struct_sdna_from(srna, "NodeShaderVectTransform", "storage");
5475 
5476  prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
5477  RNA_def_property_enum_sdna(prop, NULL, "type");
5478  RNA_def_property_enum_items(prop, prop_vect_type_items);
5479  RNA_def_property_ui_text(prop, "Type", "");
5480  RNA_def_property_update(prop, 0, "rna_Node_update");
5481 
5482  prop = RNA_def_property(srna, "convert_from", PROP_ENUM, PROP_NONE);
5483  RNA_def_property_enum_items(prop, prop_vect_space_items);
5484  RNA_def_property_ui_text(prop, "Convert From", "Space to convert from");
5485  RNA_def_property_update(prop, 0, "rna_Node_update");
5486 
5487  prop = RNA_def_property(srna, "convert_to", PROP_ENUM, PROP_NONE);
5488  RNA_def_property_enum_items(prop, prop_vect_space_items);
5489  RNA_def_property_ui_text(prop, "Convert To", "Space to convert to");
5490  RNA_def_property_update(prop, 0, "rna_Node_update");
5491 }
5492 
5494 {
5495  PropertyRNA *prop;
5496 
5497  prop = RNA_def_property(srna, "use_pixel_size", PROP_BOOLEAN, PROP_NONE);
5498  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
5499  RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units");
5500  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5501 }
5502 
5504 {
5505  PropertyRNA *prop;
5506 
5507  FunctionRNA *func;
5508  PropertyRNA *parm;
5509 
5510  static const EnumPropertyItem point_source_items[] = {
5512  "PARTICLE_SYSTEM",
5513  0,
5514  "Particle System",
5515  "Generate point density from a particle system"},
5517  "OBJECT",
5518  0,
5519  "Object Vertices",
5520  "Generate point density from an object's vertices"},
5521  {0, NULL, 0, NULL, NULL},
5522  };
5523 
5524  static const EnumPropertyItem prop_interpolation_items[] = {
5525  {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
5526  {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
5527  {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
5528  {0, NULL, 0, NULL, NULL},
5529  };
5530 
5531  static const EnumPropertyItem space_items[] = {
5532  {SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""},
5533  {SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""},
5534  {0, NULL, 0, NULL, NULL},
5535  };
5536 
5537  static const EnumPropertyItem particle_color_source_items[] = {
5539  "PARTICLE_AGE",
5540  0,
5541  "Particle Age",
5542  "Lifetime mapped as 0.0 to 1.0 intensity"},
5544  "PARTICLE_SPEED",
5545  0,
5546  "Particle Speed",
5547  "Particle speed (absolute magnitude of velocity) mapped as 0.0 to 1.0 intensity"},
5549  "PARTICLE_VELOCITY",
5550  0,
5551  "Particle Velocity",
5552  "XYZ velocity mapped to RGB colors"},
5553  {0, NULL, 0, NULL, NULL},
5554  };
5555 
5556  static const EnumPropertyItem vertex_color_source_items[] = {
5557  {SHD_POINTDENSITY_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"},
5559  "VERTEX_WEIGHT",
5560  0,
5561  "Vertex Weight",
5562  "Vertex group weight"},
5564  "VERTEX_NORMAL",
5565  0,
5566  "Vertex Normal",
5567  "XYZ normal vector mapped to RGB colors"},
5568  {0, NULL, 0, NULL, NULL},
5569  };
5570 
5571  prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
5572  RNA_def_property_pointer_sdna(prop, NULL, "id");
5573  RNA_def_property_struct_type(prop, "Object");
5576  RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
5577  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5578 
5579  RNA_def_struct_sdna_from(srna, "NodeShaderTexPointDensity", "storage");
5580 
5581  prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
5582  RNA_def_property_enum_items(prop, point_source_items);
5583  RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
5584  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5585 
5586  prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
5587  RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
5588  RNA_def_property_struct_type(prop, "ParticleSystem");
5590  "rna_ShaderNodePointDensity_psys_get",
5591  "rna_ShaderNodePointDensity_psys_set",
5592  NULL,
5593  NULL);
5595  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5596 
5597  prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
5598  RNA_def_property_range(prop, 1, 32768);
5600  prop, "Resolution", "Resolution used by the texture holding the point density");
5601  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5602 
5603  prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
5604  RNA_def_property_float_sdna(prop, NULL, "radius");
5605  RNA_def_property_range(prop, 0.001, FLT_MAX);
5607  prop, "Radius", "Radius from the shaded sample to look for points within");
5608  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5609 
5610  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
5612  RNA_def_property_ui_text(prop, "Space", "Coordinate system to calculate voxels in");
5613  RNA_def_property_update(prop, 0, "rna_Node_update");
5614 
5615  prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
5616  RNA_def_property_enum_items(prop, prop_interpolation_items);
5617  RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
5618  RNA_def_property_update(prop, 0, "rna_Node_update");
5619 
5620  prop = RNA_def_property(srna, "particle_color_source", PROP_ENUM, PROP_NONE);
5621  RNA_def_property_enum_sdna(prop, NULL, "color_source");
5622  RNA_def_property_enum_items(prop, particle_color_source_items);
5623  RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
5624  RNA_def_property_update(prop, 0, "rna_Node_update");
5625 
5626  prop = RNA_def_property(srna, "vertex_color_source", PROP_ENUM, PROP_NONE);
5627  RNA_def_property_enum_sdna(prop, NULL, "ob_color_source");
5628  RNA_def_property_enum_items(prop, vertex_color_source_items);
5629  RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
5630  RNA_def_property_update(prop, 0, "rna_Node_update");
5631 
5632  prop = RNA_def_property(srna, "vertex_attribute_name", PROP_STRING, PROP_NONE);
5633  RNA_def_property_ui_text(prop, "Vertex Attribute Name", "Vertex attribute to use for color");
5634  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5635 
5636  func = RNA_def_function(srna, "cache_point_density", "rna_ShaderNodePointDensity_density_cache");
5637  RNA_def_function_ui_description(func, "Cache point density data for later calculation");
5638  RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
5639 
5640  func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc");
5641  RNA_def_function_ui_description(func, "Calculate point density");
5642  RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
5643  /* TODO, See how array size of 0 works, this shouldn't be used. */
5644  parm = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0);
5646  RNA_def_function_output(func, parm);
5647 
5648  func = RNA_def_function(
5649  srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax");
5650  RNA_def_function_ui_description(func, "Calculate point density");
5651  RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
5652  parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS);
5653  RNA_def_property_array(parm, 3);
5655  RNA_def_function_output(func, parm);
5656  parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_COORDS);
5657  RNA_def_property_array(parm, 3);
5659  RNA_def_function_output(func, parm);
5660 }
5661 
5662 static void def_glossy(StructRNA *srna)
5663 {
5664  PropertyRNA *prop;
5665 
5666  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5667  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5669  RNA_def_property_ui_text(prop, "Distribution", "");
5670  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5671 }
5672 
5673 static void def_glass(StructRNA *srna)
5674 {
5675  PropertyRNA *prop;
5676 
5677  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5678  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5680  RNA_def_property_ui_text(prop, "Distribution", "");
5681  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5682 }
5683 
5684 static void def_principled(StructRNA *srna)
5685 {
5686  PropertyRNA *prop;
5687 
5688  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5689  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5691  RNA_def_property_ui_text(prop, "Distribution", "");
5692  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5693 
5694  prop = RNA_def_property(srna, "subsurface_method", PROP_ENUM, PROP_NONE);
5695  RNA_def_property_enum_sdna(prop, NULL, "custom2");
5698  prop, "Subsurface Method", "Method for rendering subsurface scattering");
5699  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5700 }
5701 
5702 static void def_refraction(StructRNA *srna)
5703 {
5704  PropertyRNA *prop;
5705 
5706  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5707  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5709  RNA_def_property_ui_text(prop, "Distribution", "");
5710  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5711 }
5712 
5713 static void def_anisotropic(StructRNA *srna)
5714 {
5715  PropertyRNA *prop;
5716 
5717  prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
5718  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5720  RNA_def_property_ui_text(prop, "Distribution", "");
5721  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5722 }
5723 
5724 static void def_toon(StructRNA *srna)
5725 {
5726  PropertyRNA *prop;
5727 
5728  prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
5729  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5731  RNA_def_property_ui_text(prop, "Component", "");
5732  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5733 }
5734 
5735 static void def_sh_bump(StructRNA *srna)
5736 {
5737  PropertyRNA *prop;
5738 
5739  prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
5740  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
5742  prop, "Invert", "Invert the bump mapping direction to push into the surface instead of out");
5743  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5744 }
5745 
5746 static void def_hair(StructRNA *srna)
5747 {
5748  PropertyRNA *prop;
5749 
5750  prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
5751  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5753  RNA_def_property_ui_text(prop, "Component", "");
5754  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5755 }
5756 
5757 /* RNA initialization for the custom property. */
5758 static void def_hair_principled(StructRNA *srna)
5759 {
5760  PropertyRNA *prop;
5761 
5762  prop = RNA_def_property(srna, "parametrization", PROP_ENUM, PROP_NONE);
5763  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5765  prop, "Color Parametrization", "Select the shader's color parametrization");
5768  /* Upon editing, update both the node data AND the UI representation */
5769  /* (This effectively shows/hides the relevant sockets) */
5770  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
5771 }
5772 
5773 static void def_sh_uvmap(StructRNA *srna)
5774 {
5775  PropertyRNA *prop;
5776 
5777  prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
5778  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
5780  prop, "From Instancer", "Use the parent of the instance object if possible");
5781  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5782 
5783  RNA_def_struct_sdna_from(srna, "NodeShaderUVMap", "storage");
5784 
5785  prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
5786  RNA_def_property_ui_text(prop, "UV Map", "UV coordinates to be used for mapping");
5787  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5788 
5789  RNA_def_struct_sdna_from(srna, "bNode", NULL);
5790 }
5791 
5792 static void def_sh_vertex_color(StructRNA *srna)
5793 {
5794  PropertyRNA *prop;
5795 
5796  RNA_def_struct_sdna_from(srna, "NodeShaderVertexColor", "storage");
5797 
5798  prop = RNA_def_property(srna, "layer_name", PROP_STRING, PROP_NONE);
5799  RNA_def_property_ui_text(prop, "Vertex Color", "Vertex Color");
5800  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5801 
5802  RNA_def_struct_sdna_from(srna, "bNode", NULL);
5803 }
5804 
5806 {
5807  PropertyRNA *prop;
5808 
5809  prop = RNA_def_property(srna, "use_tips", PROP_BOOLEAN, PROP_NONE);
5810  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
5812  prop, "Use Tips", "Lower half of the texture is for tips of the stroke");
5813  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5814 }
5815 
5816 static void def_sh_normal_map(StructRNA *srna)
5817 {
5818  static const EnumPropertyItem prop_space_items[] = {
5819  {SHD_SPACE_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"},
5820  {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"},
5821  {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
5823  "BLENDER_OBJECT",
5824  0,
5825  "Blender Object Space",
5826  "Object space normal mapping, compatible with Blender render baking"},
5828  "BLENDER_WORLD",
5829  0,
5830  "Blender World Space",
5831  "World space normal mapping, compatible with Blender render baking"},
5832  {0, NULL, 0, NULL, NULL},
5833  };
5834 
5835  PropertyRNA *prop;
5836 
5837  RNA_def_struct_sdna_from(srna, "NodeShaderNormalMap", "storage");
5838 
5839  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
5840  RNA_def_property_enum_items(prop, prop_space_items);
5841  RNA_def_property_ui_text(prop, "Space", "Space of the input normal");
5842  RNA_def_property_update(prop, 0, "rna_Node_update");
5843 
5844  prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
5845  RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent space maps");
5846  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5847 
5848  RNA_def_struct_sdna_from(srna, "bNode", NULL);
5849 }
5850 
5851 static void def_sh_displacement(StructRNA *srna)
5852 {
5853  static const EnumPropertyItem prop_space_items[] = {
5855  "OBJECT",
5856  0,
5857  "Object Space",
5858  "Displacement is in object space, affected by object scale"},
5859  {SHD_SPACE_WORLD,
5860  "WORLD",
5861  0,
5862  "World Space",
5863  "Displacement is in world space, not affected by object scale"},
5864  {0, NULL, 0, NULL, NULL},
5865  };
5866 
5867  PropertyRNA *prop;
5868 
5869  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
5870  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5871  RNA_def_property_enum_items(prop, prop_space_items);
5872  RNA_def_property_ui_text(prop, "Space", "Space of the input height");
5873  RNA_def_property_update(prop, 0, "rna_Node_update");
5874 
5875  RNA_def_struct_sdna_from(srna, "bNode", NULL);
5876 }
5877 
5879 {
5880  static const EnumPropertyItem prop_space_items[] = {
5882  "TANGENT",
5883  0,
5884  "Tangent Space",
5885  "Tangent space vector displacement mapping"},
5886  {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space vector displacement mapping"},
5887  {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space vector displacement mapping"},
5888  {0, NULL, 0, NULL, NULL},
5889  };
5890 
5891  PropertyRNA *prop;
5892 
5893  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
5894  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5895  RNA_def_property_enum_items(prop, prop_space_items);
5896  RNA_def_property_ui_text(prop, "Space", "Space of the input height");
5897  RNA_def_property_update(prop, 0, "rna_Node_update");
5898 
5899  RNA_def_struct_sdna_from(srna, "bNode", NULL);
5900 }
5901 
5902 static void def_sh_tangent(StructRNA *srna)
5903 {
5904  static const EnumPropertyItem prop_direction_type_items[] = {
5905  {SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
5906  {SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
5907  {0, NULL, 0, NULL, NULL},
5908  };
5909 
5910  static const EnumPropertyItem prop_axis_items[] = {
5911  {SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
5912  {SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
5913  {SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
5914  {0, NULL, 0, NULL, NULL},
5915  };
5916 
5917  PropertyRNA *prop;
5918 
5919  RNA_def_struct_sdna_from(srna, "NodeShaderTangent", "storage");
5920 
5921  prop = RNA_def_property(srna, "direction_type", PROP_ENUM, PROP_NONE);
5922  RNA_def_property_enum_items(prop, prop_direction_type_items);
5923  RNA_def_property_ui_text(prop, "Direction", "Method to use for the tangent");
5924  RNA_def_property_update(prop, 0, "rna_Node_update");
5925 
5926  prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
5927  RNA_def_property_enum_items(prop, prop_axis_items);
5928  RNA_def_property_ui_text(prop, "Axis", "Axis for radial tangents");
5929  RNA_def_property_update(prop, 0, "rna_Node_update");
5930 
5931  prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
5932  RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent generated from UV");
5933  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5934 
5935  RNA_def_struct_sdna_from(srna, "bNode", NULL);
5936 }
5937 
5938 static void def_sh_bevel(StructRNA *srna)
5939 {
5940  PropertyRNA *prop;
5941 
5942  prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
5943  RNA_def_property_int_sdna(prop, NULL, "custom1");
5944  RNA_def_property_range(prop, 2, 128);
5945  RNA_def_property_ui_range(prop, 2, 16, 1, 1);
5946  RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
5947  RNA_def_property_update(prop, 0, "rna_Node_update");
5948 }
5949 
5951 {
5952  PropertyRNA *prop;
5953 
5954  prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
5955  RNA_def_property_int_sdna(prop, NULL, "custom1");
5956  RNA_def_property_range(prop, 1, 128);
5957  RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
5958  RNA_def_property_update(prop, 0, "rna_Node_update");
5959 
5960  prop = RNA_def_property(srna, "inside", PROP_BOOLEAN, PROP_NONE);
5962  RNA_def_property_ui_text(prop, "Inside", "Trace rays towards the inside of the object");
5963  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5964 
5965  prop = RNA_def_property(srna, "only_local", PROP_BOOLEAN, PROP_NONE);
5966  RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_AO_LOCAL);
5968  prop, "Only Local", "Only consider the object itself when computing AO");
5969  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
5970 }
5971 
5972 static void def_sh_subsurface(StructRNA *srna)
5973 {
5974  static const EnumPropertyItem prop_subsurface_falloff_items[] = {
5975  {SHD_SUBSURFACE_CUBIC, "CUBIC", 0, "Cubic", "Simple cubic falloff function"},
5977  "GAUSSIAN",
5978  0,
5979  "Gaussian",
5980  "Normal distribution, multiple can be combined to fit more complex profiles"},
5982  "BURLEY",
5983  0,
5984  "Christensen-Burley",
5985  "Approximation to physically based volume scattering"},
5987  "RANDOM_WALK",
5988  0,
5989  "Random Walk",
5990  "Volumetric approximation to physically based volume scattering"},
5991  {0, NULL, 0, NULL, NULL},
5992  };
5993 
5994  PropertyRNA *prop;
5995 
5996  prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
5997  RNA_def_property_enum_sdna(prop, NULL, "custom1");
5998  RNA_def_property_enum_items(prop, prop_subsurface_falloff_items);
6000  "Falloff",
6001  "Function to determine how much light nearby points contribute based "
6002  "on their distance to the shading point");
6003  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
6004 }
6005 
6006 static void def_sh_tex_ies(StructRNA *srna)
6007 {
6008  PropertyRNA *prop;
6009 
6010  prop = RNA_def_property(srna, "ies", PROP_POINTER, PROP_NONE);
6011  RNA_def_property_pointer_sdna(prop, NULL, "id");
6012  RNA_def_property_struct_type(prop, "Text");
6014  RNA_def_property_ui_text(prop, "IES Text", "Internal IES file");
6015  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6016 
6017  RNA_def_struct_sdna_from(srna, "NodeShaderTexIES", "storage");
6018 
6019  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
6020  RNA_def_property_ui_text(prop, "File Path", "IES light path");
6021  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6022 
6023  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6024  RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeTexIES_mode_set", NULL);
6027  prop, "Source", "Whether the IES file is loaded from disk or from a text data-block");
6028  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6029 
6030  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6031 }
6032 
6033 static void def_sh_output_aov(StructRNA *srna)
6034 {
6035  PropertyRNA *prop;
6036 
6037  RNA_def_struct_sdna_from(srna, "NodeShaderOutputAOV", "storage");
6038 
6039  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
6040  RNA_def_property_ui_text(prop, "Name", "Name of the AOV that this output writes to");
6041  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6042 
6043  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6044 }
6045 
6046 static void def_sh_script(StructRNA *srna)
6047 {
6048  PropertyRNA *prop;
6049 
6050  prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
6051  RNA_def_property_pointer_sdna(prop, NULL, "id");
6052  RNA_def_property_struct_type(prop, "Text");
6054  RNA_def_property_ui_text(prop, "Script", "Internal shader script to define the shader");
6055  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
6056 
6057  RNA_def_struct_sdna_from(srna, "NodeShaderScript", "storage");
6058 
6059  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
6060  RNA_def_property_ui_text(prop, "File Path", "Shader script path");
6061  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
6062 
6063  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6064  RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeScript_mode_set", NULL);
6066  RNA_def_property_ui_text(prop, "Script Source", "");
6067  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6068 
6069  prop = RNA_def_property(srna, "use_auto_update", PROP_BOOLEAN, PROP_NONE);
6072  prop,
6073  "Auto Update",
6074  "Automatically update the shader when the .osl file changes (external scripts only)");
6075 
6076  prop = RNA_def_property(srna, "bytecode", PROP_STRING, PROP_NONE);
6078  "rna_ShaderNodeScript_bytecode_get",
6079  "rna_ShaderNodeScript_bytecode_length",
6080  "rna_ShaderNodeScript_bytecode_set");
6081  RNA_def_property_ui_text(prop, "Bytecode", "Compile bytecode for shader script node");
6082  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6083 
6084  prop = RNA_def_property(srna, "bytecode_hash", PROP_STRING, PROP_NONE);
6086  prop, "Bytecode Hash", "Hash of compile bytecode, for quick equality checking");
6087  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6088 
6089  /* needs to be reset to avoid bad pointer type in API functions below */
6090  RNA_def_struct_sdna_from(srna, "bNode", NULL);
6091 
6092  /* API functions */
6093 
6094 # if 0 /* XXX TODO use general node api for this */
6095  func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket");
6096  RNA_def_function_ui_description(func, "Find a socket by name");
6097  parm = RNA_def_string(func, "name", NULL, 0, "Socket name", "");
6099  /*parm =*/RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
6100  parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
6101  RNA_def_function_return(func, parm);
6102 
6103  func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket");
6104  RNA_def_function_ui_description(func, "Add a socket socket");
6106  parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
6108  parm = RNA_def_enum(func, "type", node_socket_type_items, SOCK_FLOAT, "Type", "");
6110  /*parm =*/RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
6111  parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
6112  RNA_def_function_return(func, parm);
6113 
6114  func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket");
6115  RNA_def_function_ui_description(func, "Remove a socket socket");
6117  parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "");
6119 # endif
6120 }
6121 
6122 /* -- Compositor Nodes ------------------------------------------------------ */
6123 
6124 static void def_cmp_alpha_over(StructRNA *srna)
6125 {
6126  PropertyRNA *prop;
6127 
6128  /* XXX: Tooltip */
6129  prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
6130  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
6131  RNA_def_property_ui_text(prop, "Convert Premultiplied", "");
6132  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6133 
6134  RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
6135 
6136  prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_FACTOR);
6137  RNA_def_property_float_sdna(prop, NULL, "x");
6138  RNA_def_property_range(prop, 0.0f, 1.0f);
6139  RNA_def_property_ui_text(prop, "Premultiplied", "Mix Factor");
6140  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6141 }
6142 
6143 static void def_cmp_blur(StructRNA *srna)
6144 {
6145  PropertyRNA *prop;
6146 
6147  static const EnumPropertyItem filter_type_items[] = {
6148  {R_FILTER_BOX, "FLAT", 0, "Flat", ""},
6149  {R_FILTER_TENT, "TENT", 0, "Tent", ""},
6150  {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
6151  {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
6152  {R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
6153  {R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
6154  {R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
6155  {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
6156  {0, NULL, 0, NULL, NULL},
6157  };
6158 
6159  static const EnumPropertyItem aspect_correction_type_items[] = {
6160  {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
6161  {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
6162  {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
6163  {0, NULL, 0, NULL, NULL},
6164  };
6165 
6166  /* duplicated in def_cmp_bokehblur */
6167  prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
6170  prop, "Variable Size", "Support variable blur per pixel when using an image for size input");
6171  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6172 
6173  prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
6176  prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
6177  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6178 
6179  RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
6180 
6181  prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
6182  RNA_def_property_int_sdna(prop, NULL, "sizex");
6183  RNA_def_property_range(prop, 0, 2048);
6184  RNA_def_property_ui_text(prop, "Size X", "");
6185  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6186 
6187  prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
6188  RNA_def_property_int_sdna(prop, NULL, "sizey");
6189  RNA_def_property_range(prop, 0, 2048);
6190  RNA_def_property_ui_text(prop, "Size Y", "");
6191  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6192 
6193  prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
6194  RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
6196  prop, "Relative", "Use relative (percent) values to define blur radius");
6197  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6198 
6199  prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE);
6200  RNA_def_property_enum_sdna(prop, NULL, "aspect");
6201  RNA_def_property_enum_items(prop, aspect_correction_type_items);
6202  RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use");
6203  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6204 
6205  prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
6206  RNA_def_property_float_sdna(prop, NULL, "fac");
6207  RNA_def_property_range(prop, 0.0f, 2.0f);
6208  RNA_def_property_ui_text(prop, "Factor", "");
6209  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6210 
6211  prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE);
6212  RNA_def_property_float_sdna(prop, NULL, "percentx");
6213  RNA_def_property_range(prop, 0.0f, 100.0f);
6214  RNA_def_property_ui_text(prop, "Relative Size X", "");
6215  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6216 
6217  prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE);
6218  RNA_def_property_float_sdna(prop, NULL, "percenty");
6219  RNA_def_property_range(prop, 0.0f, 100.0f);
6220  RNA_def_property_ui_text(prop, "Relative Size Y", "");
6221  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6222 
6223  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
6224  RNA_def_property_enum_sdna(prop, NULL, "filtertype");
6225  RNA_def_property_enum_items(prop, filter_type_items);
6226  RNA_def_property_ui_text(prop, "Filter Type", "");
6227  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6228 
6229  prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE);
6230  RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1);
6231  RNA_def_property_ui_text(prop, "Bokeh", "Use circular filter (slower)");
6232  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6233 
6234  prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
6235  RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1);
6236  RNA_def_property_ui_text(prop, "Gamma", "Apply filter on gamma corrected values");
6237  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6238 }
6239 
6240 static void def_cmp_filter(StructRNA *srna)
6241 {
6242  PropertyRNA *prop;
6243 
6244  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
6245  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6247  RNA_def_property_ui_text(prop, "Filter Type", "");
6248  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6249 }
6250 
6251 static void def_cmp_map_value(StructRNA *srna)
6252 {
6253  PropertyRNA *prop;
6254 
6255  RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
6256 
6257  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
6258  RNA_def_property_float_sdna(prop, NULL, "loc");
6259  RNA_def_property_array(prop, 1);
6260  RNA_def_property_range(prop, -1000.0f, 1000.0f);
6261  RNA_def_property_ui_text(prop, "Offset", "");
6262  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6263 
6264  prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
6265  RNA_def_property_float_sdna(prop, NULL, "size");
6266  RNA_def_property_array(prop, 1);
6267  RNA_def_property_range(prop, -1000.0f, 1000.0f);
6268  RNA_def_property_ui_text(prop, "Size", "");
6269  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6270 
6271  prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
6273  RNA_def_property_ui_text(prop, "Use Minimum", "");
6274  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6275 
6276  prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
6278  RNA_def_property_ui_text(prop, "Use Maximum", "");
6279  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6280 
6281  prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
6282  RNA_def_property_float_sdna(prop, NULL, "min");
6283  RNA_def_property_array(prop, 1);
6284  RNA_def_property_range(prop, -1000.0f, 1000.0f);
6285  RNA_def_property_ui_text(prop, "Minimum", "");
6286  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6287 
6288  prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
6289  RNA_def_property_float_sdna(prop, NULL, "max");
6290  RNA_def_property_array(prop, 1);
6291  RNA_def_property_range(prop, -1000.0f, 1000.0f);
6292  RNA_def_property_ui_text(prop, "Maximum", "");
6293  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6294 }
6295 
6296 static void def_cmp_map_range(StructRNA *srna)
6297 {
6298  PropertyRNA *prop;
6299 
6300  prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
6301  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
6302  RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range");
6303  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6304 }
6305 
6306 static void def_cmp_vector_blur(StructRNA *srna)
6307 {
6308  PropertyRNA *prop;
6309 
6310  RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
6311 
6312  prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
6313  RNA_def_property_int_sdna(prop, NULL, "samples");
6314  RNA_def_property_range(prop, 1, 256);
6315  RNA_def_property_ui_text(prop, "Samples", "");
6316  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6317 
6318  prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
6319  RNA_def_property_int_sdna(prop, NULL, "minspeed");
6320  RNA_def_property_range(prop, 0, 1024);
6322  prop,
6323  "Min Speed",
6324  "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
6325  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6326 
6327  prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
6328  RNA_def_property_int_sdna(prop, NULL, "maxspeed");
6329  RNA_def_property_range(prop, 0, 1024);
6330  RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none");
6331  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6332 
6333  prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
6334  RNA_def_property_float_sdna(prop, NULL, "fac");
6335  RNA_def_property_range(prop, 0.0, 20.0);
6336  RNA_def_property_ui_range(prop, 0.0, 2.0, 1.0, 2);
6338  prop,
6339  "Blur Factor",
6340  "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
6341  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6342 
6343  prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
6344  RNA_def_property_boolean_sdna(prop, NULL, "curved", 1);
6346  prop, "Curved", "Interpolate between frames in a Bezier curve, rather than linearly");
6347  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6348 }
6349 
6350 static void def_cmp_set_alpha(StructRNA *srna)
6351 {
6352  PropertyRNA *prop;
6353 
6354  static const EnumPropertyItem mode_items[] = {
6356  "APPLY",
6357  0,
6358  "Apply Mask",
6359  "Multiply the input image's RGBA channels by the alpha input value"},
6361  "REPLACE_ALPHA",
6362  0,
6363  "Replace Alpha",
6364  "Replace the input image's alpha channels by the alpha input value"},
6365  {0, NULL, 0, NULL, NULL},
6366  };
6367 
6368  RNA_def_struct_sdna_from(srna, "NodeSetAlpha", "storage");
6369 
6370  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6372  RNA_def_property_ui_text(prop, "Mode", "");
6373  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6374 }
6375 
6376 static void def_cmp_levels(StructRNA *srna)
6377 {
6378  PropertyRNA *prop;
6379 
6380  static const EnumPropertyItem channel_items[] = {
6381  {1, "COMBINED_RGB", 0, "C", "Combined RGB"},
6382  {2, "RED", 0, "R", "Red Channel"},
6383  {3, "GREEN", 0, "G", "Green Channel"},
6384  {4, "BLUE", 0, "B", "Blue Channel"},
6385  {5, "LUMINANCE", 0, "L", "Luminance Channel"},
6386  {0, NULL, 0, NULL, NULL},
6387  };
6388 
6389  prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
6390  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6391  RNA_def_property_enum_items(prop, channel_items);
6392  RNA_def_property_ui_text(prop, "Channel", "");
6393  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6394 }
6395 
6396 static void def_node_image_user(StructRNA *srna)
6397 {
6398  PropertyRNA *prop;
6399 
6400  prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
6401  RNA_def_property_int_sdna(prop, NULL, "frames");
6404  prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.c */
6405  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6406 
6407  prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
6408  RNA_def_property_int_sdna(prop, NULL, "sfra");
6410  /* copied from the rna_image.c */
6412  prop,
6413  "Start Frame",
6414  "Global starting frame of the movie/sequence, assuming first picture has a #1");
6415  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6416 
6417  prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
6418  RNA_def_property_int_sdna(prop, NULL, "offset");
6420  /* copied from the rna_image.c */
6422  prop, "Offset", "Offset the number of the frame to use in the animation");
6423  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6424 
6425  prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
6426  RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1);
6428  prop, "Cyclic", "Cycle the images in the movie"); /* copied from the rna_image.c */
6429  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6430 
6431  prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
6433  /* copied from the rna_image.c */
6434  RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes");
6435  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6436 
6437  prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
6438  RNA_def_property_enum_sdna(prop, NULL, "layer");
6440  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_layer_itemf");
6442  RNA_def_property_ui_text(prop, "Layer", "");
6443  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_image_layer_update");
6444 
6445  prop = RNA_def_property(srna, "has_layers", PROP_BOOLEAN, PROP_NONE);
6446  RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_layers_get", NULL);
6448  RNA_def_property_ui_text(prop, "Has Layers", "True if this image has any named layer");
6449 
6450  prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
6451  RNA_def_property_enum_sdna(prop, NULL, "view");
6453  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_view_itemf");
6455  RNA_def_property_ui_text(prop, "View", "");
6456  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6457 
6458  prop = RNA_def_property(srna, "has_views", PROP_BOOLEAN, PROP_NONE);
6459  RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_views_get", NULL);
6461  RNA_def_property_ui_text(prop, "Has View", "True if this image has multiple views");
6462 }
6463 
6464 static void def_cmp_image(StructRNA *srna)
6465 {
6466  PropertyRNA *prop;
6467 
6468 # if 0
6469  static const EnumPropertyItem type_items[] = {
6470  {IMA_SRC_FILE, "IMAGE", 0, "Image", ""},
6471  {IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
6472  {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
6473  {IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
6474  {0, NULL, 0, NULL, NULL},
6475  };
6476 # endif
6477 
6478  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
6479  RNA_def_property_pointer_sdna(prop, NULL, "id");
6480  RNA_def_property_struct_type(prop, "Image");
6483  RNA_def_property_ui_text(prop, "Image", "");
6484  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Image_Node_update_id");
6485 
6486  prop = RNA_def_property(srna, "use_straight_alpha_output", PROP_BOOLEAN, PROP_NONE);
6489  "Straight Alpha Output",
6490  "Put node output buffer to straight alpha instead of premultiplied");
6491  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6492 
6493  /* NB: image user properties used in the UI are redefined in def_node_image_user,
6494  * to trigger correct updates of the node editor. RNA design problem that prevents
6495  * updates from nested structs ...
6496  */
6497  RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
6498  def_node_image_user(srna);
6499 }
6500 
6502 {
6503  PropertyRNA *prop;
6504 
6505  prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
6506  RNA_def_property_pointer_sdna(prop, NULL, "id");
6507  RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
6508  RNA_def_property_struct_type(prop, "Scene");
6511  RNA_def_property_ui_text(prop, "Scene", "");
6512  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
6513 
6514  prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
6515  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6517  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_view_layer_itemf");
6519  RNA_def_property_ui_text(prop, "Layer", "");
6520  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
6521 }
6522 
6524 {
6525  StructRNA *srna;
6526  PropertyRNA *prop;
6527 
6528  srna = RNA_def_struct(brna, "NodeOutputFileSlotFile", NULL);
6529  RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
6531  srna, "Output File Slot", "Single layer file slot of the file output node");
6532 
6533  prop = RNA_def_property(srna, "use_node_format", PROP_BOOLEAN, PROP_NONE);
6534  RNA_def_property_boolean_sdna(prop, NULL, "use_node_format", 1);
6535  RNA_def_property_ui_text(prop, "Use Node Format", "");
6537 
6538  prop = RNA_def_property(srna, "save_as_render", PROP_BOOLEAN, PROP_NONE);
6539  RNA_def_property_boolean_sdna(prop, NULL, "save_as_render", 1);
6541  prop, "Save as Render", "Apply render part of display transform when saving byte image");
6543 
6544  prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
6545  RNA_def_property_struct_type(prop, "ImageFormatSettings");
6546 
6547  prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
6548  RNA_def_property_string_sdna(prop, NULL, "path");
6549  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NodeOutputFileSlotFile_path_set");
6550  RNA_def_struct_name_property(srna, prop);
6551  RNA_def_property_ui_text(prop, "Path", "Subpath used for this slot");
6553 }
6555 {
6556  StructRNA *srna;
6557  PropertyRNA *prop;
6558 
6559  srna = RNA_def_struct(brna, "NodeOutputFileSlotLayer", NULL);
6560  RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
6562  srna, "Output File Layer Slot", "Multilayer slot of the file output node");
6563 
6564  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
6565  RNA_def_property_string_sdna(prop, NULL, "layer");
6566  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NodeOutputFileSlotLayer_name_set");
6567  RNA_def_struct_name_property(srna, prop);
6568  RNA_def_property_ui_text(prop, "Name", "OpenEXR layer name used for this slot");
6570 }
6572  PropertyRNA *cprop,
6573  const char *struct_name)
6574 {
6575  StructRNA *srna;
6576  PropertyRNA *parm;
6577  FunctionRNA *func;
6578 
6579  RNA_def_property_srna(cprop, struct_name);
6580  srna = RNA_def_struct(brna, struct_name, NULL);
6581  RNA_def_struct_sdna(srna, "bNode");
6582  RNA_def_struct_ui_text(srna, "File Output Slots", "Collection of File Output node slots");
6583 
6584  func = RNA_def_function(srna, "new", "rna_NodeOutputFile_slots_new");
6585  RNA_def_function_ui_description(func, "Add a file slot to this node");
6587  parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
6589  /* return value */
6590  parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
6591  RNA_def_function_return(func, parm);
6592 
6593  /* NB: methods below can use the standard node socket API functions,
6594  * included here for completeness.
6595  */
6596 
6597  func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
6598  RNA_def_function_ui_description(func, "Remove a file slot from this node");
6600  parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
6602 
6603  func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear");
6604  RNA_def_function_ui_description(func, "Remove all file slots from this node");
6606 
6607  func = RNA_def_function(srna, "move", "rna_Node_inputs_move");
6608  RNA_def_function_ui_description(func, "Move a file slot to another position");
6610  parm = RNA_def_int(
6611  func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
6613  parm = RNA_def_int(
6614  func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
6616 }
6617 static void def_cmp_output_file(BlenderRNA *brna, StructRNA *srna)
6618 {
6619  PropertyRNA *prop;
6620 
6621  RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage");
6622 
6623  prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH);
6624  RNA_def_property_string_sdna(prop, NULL, "base_path");
6625  RNA_def_property_ui_text(prop, "Base Path", "Base output path for the image");
6626  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6627 
6628  prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_NONE);
6629  RNA_def_property_int_sdna(prop, NULL, "active_input");
6630  RNA_def_property_ui_text(prop, "Active Input Index", "Active input index in details view list");
6631  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6632 
6633  prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
6634  RNA_def_property_struct_type(prop, "ImageFormatSettings");
6635 
6636  /* XXX using two different collections here for the same basic DNA list!
6637  * Details of the output slots depend on whether the node is in Multilayer EXR mode.
6638  */
6639 
6640  prop = RNA_def_property(srna, "file_slots", PROP_COLLECTION, PROP_NONE);
6642  "rna_NodeOutputFile_slots_begin",
6643  "rna_iterator_listbase_next",
6644  "rna_iterator_listbase_end",
6645  "rna_NodeOutputFile_slot_file_get",
6646  NULL,
6647  NULL,
6648  NULL,
6649  NULL);
6650  RNA_def_property_struct_type(prop, "NodeOutputFileSlotFile");
6651  RNA_def_property_ui_text(prop, "File Slots", "");
6652  rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileFileSlots");
6653 
6654  prop = RNA_def_property(srna, "layer_slots", PROP_COLLECTION, PROP_NONE);
6656  "rna_NodeOutputFile_slots_begin",
6657  "rna_iterator_listbase_next",
6658  "rna_iterator_listbase_end",
6659  "rna_NodeOutputFile_slot_layer_get",
6660  NULL,
6661  NULL,
6662  NULL,
6663  NULL);
6664  RNA_def_property_struct_type(prop, "NodeOutputFileSlotLayer");
6665  RNA_def_property_ui_text(prop, "EXR Layer Slots", "");
6666  rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileLayerSlots");
6667 }
6668 
6670 {
6671  PropertyRNA *prop;
6672 
6673  static const EnumPropertyItem mode_items[] = {
6674  {CMP_NODE_DILATEERODE_STEP, "STEP", 0, "Step", ""},
6675  {CMP_NODE_DILATEERODE_DISTANCE_THRESH, "THRESHOLD", 0, "Threshold", ""},
6676  {CMP_NODE_DILATEERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
6677  {CMP_NODE_DILATEERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
6678  {0, NULL, 0, NULL, NULL},
6679  };
6680 
6681  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
6682  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6684  RNA_def_property_ui_text(prop, "Mode", "Growing/shrinking mode");
6685  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6686 
6687  prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
6688  RNA_def_property_int_sdna(prop, NULL, "custom2");
6689  RNA_def_property_range(prop, -5000, 5000);
6690  RNA_def_property_ui_range(prop, -100, 100, 1, -1);
6691  RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
6692  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6693 
6694  /* CMP_NODE_DILATEERODE_DISTANCE_THRESH only */
6695  prop = RNA_def_property(srna, "edge", PROP_FLOAT, PROP_NONE);
6696  RNA_def_property_float_sdna(prop, NULL, "custom3");
6697  RNA_def_property_range(prop, -100, 100);
6698  RNA_def_property_ui_text(prop, "Edge", "Edge to inset");
6699  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6700 
6701  RNA_def_struct_sdna_from(srna, "NodeDilateErode", "storage");
6702 
6703  /* CMP_NODE_DILATEERODE_DISTANCE_FEATHER only */
6704  prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
6705  RNA_def_property_enum_sdna(prop, NULL, "falloff");
6707  RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
6708  RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
6709  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6710 }
6711 
6712 static void def_cmp_inpaint(StructRNA *srna)
6713 {
6714  PropertyRNA *prop;
6715 
6716 # if 0
6717  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
6718 
6719  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6720  RNA_def_property_enum_items(prop, type_items);
6721  RNA_def_property_ui_text(prop, "Type", "Type of inpaint algorithm");
6722  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6723 # endif
6724 
6725  prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
6726  RNA_def_property_int_sdna(prop, NULL, "custom2");
6727  RNA_def_property_range(prop, 0, 10000);
6728  RNA_def_property_ui_text(prop, "Distance", "Distance to inpaint (number of iterations)");
6729  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6730 }
6731 
6732 static void def_cmp_despeckle(StructRNA *srna)
6733 {
6734  PropertyRNA *prop;
6735 
6736  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
6737  RNA_def_property_float_sdna(prop, NULL, "custom3");
6738  RNA_def_property_range(prop, 0.0, 1.0f);
6739  RNA_def_property_ui_text(prop, "Threshold", "Threshold for detecting pixels to despeckle");
6740  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6741 
6742  prop = RNA_def_property(srna, "threshold_neighbor", PROP_FLOAT, PROP_NONE);
6743  RNA_def_property_float_sdna(prop, NULL, "custom4");
6744  RNA_def_property_range(prop, 0.0, 1.0f);
6746  prop, "Neighbor", "Threshold for the number of neighbor pixels that must match");
6747  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6748 }
6749 
6750 static void def_cmp_scale(StructRNA *srna)
6751 {
6752  PropertyRNA *prop;
6753 
6754  static const EnumPropertyItem space_items[] = {
6755  {CMP_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""},
6756  {CMP_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
6757  {CMP_SCALE_SCENEPERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
6758  {CMP_SCALE_RENDERPERCENT, "RENDER_SIZE", 0, "Render Size", ""},
6759  {0, NULL, 0, NULL, NULL},
6760  };
6761 
6762  /* matching bgpic_camera_frame_items[] */
6763  static const EnumPropertyItem space_frame_items[] = {
6764  {0, "STRETCH", 0, "Stretch", ""},
6765  {CMP_SCALE_RENDERSIZE_FRAME_ASPECT, "FIT", 0, "Fit", ""},
6767  {0, NULL, 0, NULL, NULL},
6768  };
6769 
6770  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
6771  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6773  RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
6774  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_CompositorNodeScale_update");
6775 
6776  /* expose 2 flags as a enum of 3 items */
6777  prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
6778  RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom2");
6779  RNA_def_property_enum_items(prop, space_frame_items);
6780  RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
6781  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6782 
6783  prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
6784  RNA_def_property_float_sdna(prop, NULL, "custom3");
6785  RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally (factor of image size)");
6786  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6787 
6788  prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
6789  RNA_def_property_float_sdna(prop, NULL, "custom4");
6790  RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically (factor of image size)");
6791  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6792 }
6793 
6794 static void def_cmp_rotate(StructRNA *srna)
6795 {
6796  PropertyRNA *prop;
6797 
6798  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
6799  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6801  RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
6802  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6803 }
6804 
6805 static void def_cmp_diff_matte(StructRNA *srna)
6806 {
6807  PropertyRNA *prop;
6808 
6809  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
6810 
6811  prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
6812  RNA_def_property_float_sdna(prop, NULL, "t1");
6813  RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t1_set", NULL);
6814  RNA_def_property_range(prop, 0.0f, 1.0f);
6815  RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
6816  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6817 
6818  prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
6819  RNA_def_property_float_sdna(prop, NULL, "t2");
6820  RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t2_set", NULL);
6821  RNA_def_property_range(prop, 0.0f, 1.0f);
6823  prop, "Falloff", "Color distances below this additional threshold are partially keyed");
6824  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6825 }
6826 
6827 static void def_cmp_color_matte(StructRNA *srna)
6828 {
6829  PropertyRNA *prop;
6830 
6831  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
6832 
6833  prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE);
6834  RNA_def_property_float_sdna(prop, NULL, "t1");
6835  RNA_def_property_range(prop, 0.0f, 1.0f);
6836  RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color");
6837  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6838 
6839  prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE);
6840  RNA_def_property_float_sdna(prop, NULL, "t2");
6841  RNA_def_property_range(prop, 0.0f, 1.0f);
6842  RNA_def_property_ui_text(prop, "S", "Saturation tolerance for the color");
6843  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6844 
6845  prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE);
6846  RNA_def_property_float_sdna(prop, NULL, "t3");
6847  RNA_def_property_range(prop, 0.0f, 1.0f);
6848  RNA_def_property_ui_text(prop, "V", "Value tolerance for the color");
6849  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6850 }
6851 
6853 {
6854  PropertyRNA *prop;
6855 
6856  static const EnumPropertyItem color_space_items[] = {
6857  {1, "RGB", 0, "RGB", "RGB color space"},
6858  {2, "YCC", 0, "YCC", "YCbCr suppression"},
6859  {0, NULL, 0, NULL, NULL},
6860  };
6861 
6862  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
6863 
6864  prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
6865  RNA_def_property_enum_sdna(prop, NULL, "channel");
6866  RNA_def_property_enum_items(prop, color_space_items);
6867  RNA_def_property_ui_text(prop, "Channel", "");
6868  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6869 
6870  prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
6871  RNA_def_property_float_sdna(prop, NULL, "t1");
6872  RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t1_set", NULL);
6873  RNA_def_property_range(prop, 0.0f, 1.0f);
6874  RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
6875  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6876 
6877  prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
6878  RNA_def_property_float_sdna(prop, NULL, "t2");
6879  RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t2_set", NULL);
6880  RNA_def_property_range(prop, 0.0f, 1.0f);
6882  prop, "Falloff", "Color distances below this additional threshold are partially keyed");
6883  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6884 }
6885 
6886 static void def_cmp_color_spill(StructRNA *srna)
6887 {
6888  PropertyRNA *prop;
6889 
6890  static const EnumPropertyItem channel_items[] = {
6891  {1, "R", 0, "R", "Red spill suppression"},
6892  {2, "G", 0, "G", "Green spill suppression"},
6893  {3, "B", 0, "B", "Blue spill suppression"},
6894  {0, NULL, 0, NULL, NULL},
6895  };
6896 
6897  static const EnumPropertyItem limit_channel_items[] = {
6898  {0, "R", 0, "R", "Limit by red"},
6899  {1, "G", 0, "G", "Limit by green"},
6900  {2, "B", 0, "B", "Limit by blue"},
6901  {0, NULL, 0, NULL, NULL},
6902  };
6903 
6904  static const EnumPropertyItem algorithm_items[] = {
6905  {0, "SIMPLE", 0, "Simple", "Simple limit algorithm"},
6906  {1, "AVERAGE", 0, "Average", "Average limit algorithm"},
6907  {0, NULL, 0, NULL, NULL},
6908  };
6909 
6910  prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
6911  RNA_def_property_enum_sdna(prop, NULL, "custom1");
6912  RNA_def_property_enum_items(prop, channel_items);
6913  RNA_def_property_ui_text(prop, "Channel", "");
6914  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6915 
6916  prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
6917  RNA_def_property_enum_sdna(prop, NULL, "custom2");
6918  RNA_def_property_enum_items(prop, algorithm_items);
6919  RNA_def_property_ui_text(prop, "Algorithm", "");
6920  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6921 
6922  RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage");
6923 
6924  prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
6925  RNA_def_property_enum_sdna(prop, NULL, "limchan");
6926  RNA_def_property_enum_items(prop, limit_channel_items);
6927  RNA_def_property_ui_text(prop, "Limit Channel", "");
6928  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6929 
6930  prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
6931  RNA_def_property_float_sdna(prop, NULL, "limscale");
6932  RNA_def_property_range(prop, 0.5f, 1.5f);
6933  RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value");
6934  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6935 
6936  prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE);
6937  RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0);
6938  RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (differently) by hand");
6939  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6940 
6941  prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE);
6942  RNA_def_property_float_sdna(prop, NULL, "uspillr");
6943  RNA_def_property_range(prop, 0.0f, 1.5f);
6944  RNA_def_property_ui_text(prop, "R", "Red spillmap scale");
6945  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6946 
6947  prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE);
6948  RNA_def_property_float_sdna(prop, NULL, "uspillg");
6949  RNA_def_property_range(prop, 0.0f, 1.5f);
6950  RNA_def_property_ui_text(prop, "G", "Green spillmap scale");
6951  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6952 
6953  prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE);
6954  RNA_def_property_float_sdna(prop, NULL, "uspillb");
6955  RNA_def_property_range(prop, 0.0f, 1.5f);
6956  RNA_def_property_ui_text(prop, "B", "Blue spillmap scale");
6957  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6958 }
6959 
6960 static void def_cmp_luma_matte(StructRNA *srna)
6961 {
6962  PropertyRNA *prop;
6963 
6964  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
6965 
6966  prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
6967  RNA_def_property_float_sdna(prop, NULL, "t1");
6968  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
6969  RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
6970  RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
6971  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6972 
6973  prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
6974  RNA_def_property_float_sdna(prop, NULL, "t2");
6975  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
6976  RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
6977  RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
6978  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6979 }
6980 
6982 {
6983  PropertyRNA *prop;
6984 
6985  prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
6986  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
6987  RNA_def_property_ui_text(prop, "Convert Premultiplied", "Keep output image premultiplied alpha");
6988  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
6989 }
6990 
6992 {
6993  PropertyRNA *prop;
6994 
6995  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
6996 
6997  prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_ANGLE);
6998  RNA_def_property_float_sdna(prop, NULL, "t1");
6999  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
7000  RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(80.0f));
7002  prop, "Acceptance", "Tolerance for a color to be considered a keying color");
7003  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7004 
7005  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_ANGLE);
7006  RNA_def_property_float_sdna(prop, NULL, "t2");
7007  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
7008  RNA_def_property_range(prop, 0.0f, DEG2RADF(30.0f));
7010  prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
7011  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7012 
7013  prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
7014  RNA_def_property_float_sdna(prop, NULL, "fsize");
7015  RNA_def_property_range(prop, 0.0f, 1.0f);
7016  RNA_def_property_ui_text(prop, "Lift", "Alpha lift");
7017  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7018 
7019  prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
7020  RNA_def_property_float_sdna(prop, NULL, "fstrength");
7021  RNA_def_property_range(prop, 0.0f, 1.0f);
7022  RNA_def_property_ui_text(prop, "Falloff", "Alpha falloff");
7023  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7024 
7025  prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
7026  RNA_def_property_float_sdna(prop, NULL, "t3");
7027  RNA_def_property_range(prop, 0.0f, 1.0f);
7029  prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
7030  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7031 }
7032 
7034 {
7035  PropertyRNA *prop;
7036 
7037  static const EnumPropertyItem color_space_items[] = {
7038  {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB color space"},
7039  {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV color space"},
7040  {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV color space"},
7041  {CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr color space"},
7042  {0, NULL, 0, NULL, NULL},
7043  };
7044 
7045  static const EnumPropertyItem algorithm_items[] = {
7046  {0, "SINGLE", 0, "Single", "Limit by single channel"},
7047  {1, "MAX", 0, "Max", "Limit by maximum of other channels"},
7048  {0, NULL, 0, NULL, NULL},
7049  };
7050 
7051  prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
7052  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7053  RNA_def_property_enum_items(prop, color_space_items);
7054  RNA_def_property_ui_text(prop, "Color Space", "");
7055  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7056 
7057  prop = RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
7058  RNA_def_property_enum_sdna(prop, NULL, "custom2");
7060  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
7061  RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte");
7062  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7063 
7064  RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
7065 
7066  prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
7067  RNA_def_property_enum_sdna(prop, NULL, "algorithm");
7068  RNA_def_property_enum_items(prop, algorithm_items);
7069  RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel");
7070  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7071 
7072  prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
7073  RNA_def_property_enum_sdna(prop, NULL, "channel");
7075  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
7076  RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channel's value");
7077  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7078 
7079  prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
7080  RNA_def_property_float_sdna(prop, NULL, "t1");
7081  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
7082  RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7083  RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
7084  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7085 
7086  prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
7087  RNA_def_property_float_sdna(prop, NULL, "t2");
7088  RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
7089  RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
7090  RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
7091  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7092 }
7093 
7094 static void def_cmp_flip(StructRNA *srna)
7095 {
7096  PropertyRNA *prop;
7097 
7098  prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
7099  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7101  RNA_def_property_ui_text(prop, "Axis", "");
7102  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7103 }
7104 
7105 static void def_cmp_splitviewer(StructRNA *srna)
7106 {
7107  PropertyRNA *prop;
7108 
7109  prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
7110  RNA_def_property_enum_sdna(prop, NULL, "custom2");
7112  RNA_def_property_ui_text(prop, "Axis", "");
7113  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7114 
7115  prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR);
7116  RNA_def_property_int_sdna(prop, NULL, "custom1");
7117  RNA_def_property_range(prop, 0, 100);
7118  RNA_def_property_ui_text(prop, "Factor", "");
7119  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7120 }
7121 
7122 static void def_cmp_id_mask(StructRNA *srna)
7123 {
7124  PropertyRNA *prop;
7125 
7126  prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
7127  RNA_def_property_int_sdna(prop, NULL, "custom1");
7128  RNA_def_property_range(prop, 0, 32767);
7129  RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
7130  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7131 
7132  prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
7133  RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0);
7134  RNA_def_property_ui_text(prop, "Anti-Aliasing", "Apply an anti-aliasing filter to the mask");
7135  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7136 }
7137 
7139 {
7140  PropertyRNA *prop;
7141 
7142  static const EnumPropertyItem BufEdgeMode_items[] = {
7143  {0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to bleed along edges"},
7144  {1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from touching edges"},
7145  {0, NULL, 0, NULL, NULL},
7146  };
7147 
7148  static const EnumPropertyItem InnerEdgeMode_items[] = {
7149  {0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"},
7150  {1,
7151  "ADJACENT_ONLY",
7152  0,
7153  "Adjacent Only",
7154  "Only inner mask pixels adjacent to outer mask pixels are considered during mask "
7155  "calculation"},
7156  {0, NULL, 0, NULL, NULL},
7157  };
7158 
7159  prop = RNA_def_property(srna, "inner_mode", PROP_ENUM, PROP_NONE);
7160  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7161  RNA_def_property_enum_items(prop, InnerEdgeMode_items);
7162  RNA_def_property_ui_text(prop, "Inner Edge Mode", "");
7163  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7164 
7165  prop = RNA_def_property(srna, "edge_mode", PROP_ENUM, PROP_NONE);
7166  RNA_def_property_enum_sdna(prop, NULL, "custom2");
7167  RNA_def_property_enum_items(prop, BufEdgeMode_items);
7168  RNA_def_property_ui_text(prop, "Buffer Edge Mode", "");
7169  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7170 }
7171 
7172 static void def_cmp_map_uv(StructRNA *srna)
7173 {
7174  PropertyRNA *prop;
7175 
7176  prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_FACTOR);
7177  RNA_def_property_int_sdna(prop, NULL, "custom1");
7178  RNA_def_property_range(prop, 0, 100);
7179  RNA_def_property_ui_text(prop, "Alpha", "");
7180  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7181 }
7182 
7183 static void def_cmp_defocus(StructRNA *srna)
7184 {
7185  PropertyRNA *prop;
7186 
7187  static const EnumPropertyItem bokeh_items[] = {
7188  {8, "OCTAGON", 0, "Octagonal", "8 sides"},
7189  {7, "HEPTAGON", 0, "Heptagonal", "7 sides"},
7190  {6, "HEXAGON", 0, "Hexagonal", "6 sides"},
7191  {5, "PENTAGON", 0, "Pentagonal", "5 sides"},
7192  {4, "SQUARE", 0, "Square", "4 sides"},
7193  {3, "TRIANGLE", 0, "Triangular", "3 sides"},
7194  {0, "CIRCLE", 0, "Circular", ""},
7195  {0, NULL, 0, NULL, NULL},
7196  };
7197 
7198  prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
7199  RNA_def_property_pointer_sdna(prop, NULL, "id");
7200  RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
7201  RNA_def_property_struct_type(prop, "Scene");
7205  prop, "Scene", "Scene from which to select the active camera (render scene if undefined)");
7206  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7207 
7208  RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage");
7209 
7210  prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE);
7211  RNA_def_property_enum_sdna(prop, NULL, "bktype");
7212  RNA_def_property_enum_items(prop, bokeh_items);
7213  RNA_def_property_ui_text(prop, "Bokeh Type", "");
7214  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7215 
7216  prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
7217  RNA_def_property_float_sdna(prop, NULL, "rotation");
7218  RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
7219  RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset");
7220  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7221 
7222  prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
7223  RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1);
7225  prop, "Gamma Correction", "Enable gamma correction before and after main process");
7226  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7227 
7228  /* TODO */
7229  prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
7230  RNA_def_property_float_sdna(prop, NULL, "fstop");
7231  RNA_def_property_range(prop, 0.0f, 128.0f);
7233  prop,
7234  "F-Stop",
7235  "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles "
7236  "the blur radius");
7237  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7238 
7239  prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
7240  RNA_def_property_float_sdna(prop, NULL, "maxblur");
7241  RNA_def_property_range(prop, 0.0f, 10000.0f);
7242  RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
7243  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7244 
7245  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
7246  RNA_def_property_float_sdna(prop, NULL, "bthresh");
7247  RNA_def_property_range(prop, 0.0f, 100.0f);
7249  prop,
7250  "Threshold",
7251  "CoC radius threshold, prevents background bleed on in-focus midground, 0 is disabled");
7252  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7253 
7254  prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
7255  RNA_def_property_boolean_sdna(prop, NULL, "preview", 1);
7256  RNA_def_property_ui_text(prop, "Preview", "Enable low quality mode, useful for preview");
7257  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7258 
7259  prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
7260  RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1);
7262  "Use Z-Buffer",
7263  "Disable when using an image as input instead of actual z-buffer "
7264  "(auto enabled if node not image based, eg. time node)");
7265  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7266 
7267  prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
7268  RNA_def_property_float_sdna(prop, NULL, "scale");
7269  RNA_def_property_range(prop, 0.0f, 1000.0f);
7271  prop,
7272  "Z-Scale",
7273  "Scale the Z input when not using a z-buffer, controls maximum blur designated "
7274  "by the color white or input value 1");
7275  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7276 }
7277 
7278 static void def_cmp_invert(StructRNA *srna)
7279 {
7280  PropertyRNA *prop;
7281 
7282  prop = RNA_def_property(srna, "invert_rgb", PROP_BOOLEAN, PROP_NONE);
7283  RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB);
7284  RNA_def_property_ui_text(prop, "RGB", "");
7285  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7286 
7287  prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
7288  RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A);
7289  RNA_def_property_ui_text(prop, "Alpha", "");
7290  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7291 }
7292 
7293 static void def_cmp_crop(StructRNA *srna)
7294 {
7295  PropertyRNA *prop;
7296 
7297  prop = RNA_def_property(srna, "use_crop_size", PROP_BOOLEAN, PROP_NONE);
7298  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
7299  RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
7300  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7301 
7302  prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
7303  RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
7304  RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
7305  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7306 
7307  RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
7308 
7309  prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
7310  RNA_def_property_int_sdna(prop, NULL, "x1");
7311  RNA_def_property_range(prop, 0, 10000);
7312  RNA_def_property_ui_text(prop, "X1", "");
7313  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7314 
7315  prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE);
7316  RNA_def_property_int_sdna(prop, NULL, "x2");
7317  RNA_def_property_range(prop, 0, 10000);
7318  RNA_def_property_ui_text(prop, "X2", "");
7319  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7320 
7321  prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE);
7322  RNA_def_property_int_sdna(prop, NULL, "y1");
7323  RNA_def_property_range(prop, 0, 10000);
7324  RNA_def_property_ui_text(prop, "Y1", "");
7325  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7326 
7327  prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE);
7328  RNA_def_property_int_sdna(prop, NULL, "y2");
7329  RNA_def_property_range(prop, 0, 10000);
7330  RNA_def_property_ui_text(prop, "Y2", "");
7331  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7332 
7333  prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
7334  RNA_def_property_float_sdna(prop, NULL, "fac_x1");
7335  RNA_def_property_range(prop, 0.0, 1.0);
7336  RNA_def_property_ui_text(prop, "X1", "");
7337  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7338 
7339  prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
7340  RNA_def_property_float_sdna(prop, NULL, "fac_x2");
7341  RNA_def_property_range(prop, 0.0, 1.0);
7342  RNA_def_property_ui_text(prop, "X2", "");
7343  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7344 
7345  prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
7346  RNA_def_property_float_sdna(prop, NULL, "fac_y1");
7347  RNA_def_property_range(prop, 0.0, 1.0);
7348  RNA_def_property_ui_text(prop, "Y1", "");
7349  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7350 
7351  prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
7352  RNA_def_property_float_sdna(prop, NULL, "fac_y2");
7353  RNA_def_property_range(prop, 0.0, 1.0);
7354  RNA_def_property_ui_text(prop, "Y2", "");
7355  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7356 }
7357 
7358 static void def_cmp_dblur(StructRNA *srna)
7359 {
7360  PropertyRNA *prop;
7361 
7362  RNA_def_struct_sdna_from(srna, "NodeDBlurData", "storage");
7363 
7364  prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7365  RNA_def_property_int_sdna(prop, NULL, "iter");
7366  RNA_def_property_range(prop, 1, 32);
7367  RNA_def_property_ui_text(prop, "Iterations", "");
7368  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7369 
7370  prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
7371  RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1);
7372  RNA_def_property_ui_text(prop, "Wrap", "");
7373  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7374 
7375  prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
7376  RNA_def_property_float_sdna(prop, NULL, "center_x");
7377  RNA_def_property_range(prop, 0.0f, 1.0f);
7378  RNA_def_property_ui_text(prop, "Center X", "");
7379  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7380 
7381  prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
7382  RNA_def_property_float_sdna(prop, NULL, "center_y");
7383  RNA_def_property_range(prop, 0.0f, 1.0f);
7384  RNA_def_property_ui_text(prop, "Center Y", "");
7385  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7386 
7387  prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
7388  RNA_def_property_float_sdna(prop, NULL, "distance");
7389  RNA_def_property_range(prop, -1.0f, 1.0f);
7390  RNA_def_property_ui_text(prop, "Distance", "");
7391  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7392 
7393  prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
7394  RNA_def_property_float_sdna(prop, NULL, "angle");
7395  RNA_def_property_range(prop, 0.0f, DEG2RADF(360.0f));
7396  RNA_def_property_ui_text(prop, "Angle", "");
7397  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7398 
7399  prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_ANGLE);
7400  RNA_def_property_float_sdna(prop, NULL, "spin");
7401  RNA_def_property_range(prop, DEG2RADF(-360.0f), DEG2RADF(360.0f));
7402  RNA_def_property_ui_text(prop, "Spin", "");
7403  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7404 
7405  prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
7406  RNA_def_property_float_sdna(prop, NULL, "zoom");
7407  RNA_def_property_range(prop, 0.0f, 100.0f);
7408  RNA_def_property_ui_text(prop, "Zoom", "");
7409  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7410 }
7411 
7413 {
7414  PropertyRNA *prop;
7415 
7416  RNA_def_struct_sdna_from(srna, "NodeBilateralBlurData", "storage");
7417 
7418  prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7419  RNA_def_property_int_sdna(prop, NULL, "iter");
7420  RNA_def_property_range(prop, 1, 128);
7421  RNA_def_property_ui_text(prop, "Iterations", "");
7422  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7423 
7424  prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
7425  RNA_def_property_float_sdna(prop, NULL, "sigma_color");
7426  RNA_def_property_range(prop, 0.01f, 3.0f);
7427  RNA_def_property_ui_text(prop, "Color Sigma", "");
7428  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7429 
7430  prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
7431  RNA_def_property_float_sdna(prop, NULL, "sigma_space");
7432  RNA_def_property_range(prop, 0.01f, 30.0f);
7433  RNA_def_property_ui_text(prop, "Space Sigma", "");
7434  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7435 }
7436 
7437 static void def_cmp_premul_key(StructRNA *srna)
7438 {
7439  PropertyRNA *prop;
7440 
7441  static const EnumPropertyItem type_items[] = {
7442  {0, "STRAIGHT_TO_PREMUL", 0, "To Premultiplied", "Convert straight to premultiplied"},
7443  {1, "PREMUL_TO_STRAIGHT", 0, "To Straight", "Convert premultiplied to straight"},
7444  {0, NULL, 0, NULL, NULL},
7445  };
7446 
7447  prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
7448  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7449  RNA_def_property_enum_items(prop, type_items);
7451  prop, "Mapping", "Conversion between premultiplied alpha and key alpha");
7452  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7453 }
7454 
7455 static void def_cmp_glare(StructRNA *srna)
7456 {
7457  PropertyRNA *prop;
7458 
7459  static const EnumPropertyItem type_items[] = {
7460  {3, "GHOSTS", 0, "Ghosts", ""},
7461  {2, "STREAKS", 0, "Streaks", ""},
7462  {1, "FOG_GLOW", 0, "Fog Glow", ""},
7463  {0, "SIMPLE_STAR", 0, "Simple Star", ""},
7464  {0, NULL, 0, NULL, NULL},
7465  };
7466 
7467  static const EnumPropertyItem quality_items[] = {
7468  {0, "HIGH", 0, "High", ""},
7469  {1, "MEDIUM", 0, "Medium", ""},
7470  {2, "LOW", 0, "Low", ""},
7471  {0, NULL, 0, NULL, NULL},
7472  };
7473 
7474  RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
7475 
7476  prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE);
7477  RNA_def_property_enum_sdna(prop, NULL, "type");
7478  RNA_def_property_enum_items(prop, type_items);
7479  RNA_def_property_ui_text(prop, "Glare Type", "");
7480  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7481 
7482  prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
7483  RNA_def_property_enum_sdna(prop, NULL, "quality");
7484  RNA_def_property_enum_items(prop, quality_items);
7486  prop,
7487  "Quality",
7488  "If not set to high quality, the effect will be applied to a low-res copy "
7489  "of the source image");
7490  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7491 
7492  prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
7493  RNA_def_property_int_sdna(prop, NULL, "iter");
7494  RNA_def_property_range(prop, 2, 5);
7495  RNA_def_property_ui_text(prop, "Iterations", "");
7496  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7497 
7498  prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
7499  RNA_def_property_float_sdna(prop, NULL, "colmod");
7500  RNA_def_property_range(prop, 0.0f, 1.0f);
7502  prop,
7503  "Color Modulation",
7504  "Amount of Color Modulation, modulates colors of streaks and ghosts for "
7505  "a spectral dispersion effect");
7506  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7507 
7508  prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
7509  RNA_def_property_float_sdna(prop, NULL, "mix");
7510  RNA_def_property_range(prop, -1.0f, 1.0f);
7512  prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
7513  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7514 
7515  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
7516  RNA_def_property_float_sdna(prop, NULL, "threshold");
7517  RNA_def_property_range(prop, 0.0f, 1000.0f);
7519  prop,
7520  "Threshold",
7521  "The glare filter will only be applied to pixels brighter than this value");
7522  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7523 
7524  prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
7525  RNA_def_property_int_sdna(prop, NULL, "streaks");
7526  RNA_def_property_range(prop, 1, 16);
7527  RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
7528  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7529 
7530  prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE);
7531  RNA_def_property_float_sdna(prop, NULL, "angle_ofs");
7532  RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
7533  RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset");
7534  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7535 
7536  prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
7537  RNA_def_property_float_sdna(prop, NULL, "fade");
7538  RNA_def_property_range(prop, 0.75f, 1.0f);
7539  RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor");
7540  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7541 
7542  prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE);
7543  RNA_def_property_boolean_sdna(prop, NULL, "star_45", 0);
7544  RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset");
7545  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7546 
7547  prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
7548  RNA_def_property_int_sdna(prop, NULL, "size");
7549  RNA_def_property_range(prop, 6, 9);
7551  prop,
7552  "Size",
7553  "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
7554  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7555 
7556  /* TODO */
7557 }
7558 
7559 static void def_cmp_tonemap(StructRNA *srna)
7560 {
7561  PropertyRNA *prop;
7562 
7563  static const EnumPropertyItem type_items[] = {
7564  {1, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
7565  {0, "RH_SIMPLE", 0, "Rh Simple", ""},
7566  {0, NULL, 0, NULL, NULL},
7567  };
7568 
7569  RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
7570 
7571  prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
7572  RNA_def_property_enum_sdna(prop, NULL, "type");
7573  RNA_def_property_enum_items(prop, type_items);
7574  RNA_def_property_ui_text(prop, "Tonemap Type", "");
7575  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7576 
7577  prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE);
7578  RNA_def_property_float_sdna(prop, NULL, "key");
7579  RNA_def_property_range(prop, 0.0f, 1.0f);
7580  RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
7581  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7582 
7583  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
7584  RNA_def_property_float_sdna(prop, NULL, "offset");
7585  RNA_def_property_range(prop, 0.001f, 10.0f);
7587  prop,
7588  "Offset",
7589  "Normally always 1, but can be used as an extra control to alter the brightness curve");
7590  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7591 
7592  prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
7593  RNA_def_property_float_sdna(prop, NULL, "gamma");
7594  RNA_def_property_range(prop, 0.001f, 3.0f);
7595  RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
7596  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7597 
7598  prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
7599  RNA_def_property_float_sdna(prop, NULL, "f");
7600  RNA_def_property_range(prop, -8.0f, 8.0f);
7602  prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
7603  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7604 
7605  prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
7606  RNA_def_property_float_sdna(prop, NULL, "m");
7607  RNA_def_property_range(prop, 0.0f, 1.0f);
7608  RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
7609  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7610 
7611  prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
7612  RNA_def_property_float_sdna(prop, NULL, "a");
7613  RNA_def_property_range(prop, 0.0f, 1.0f);
7614  RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
7615  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7616 
7617  prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
7618  RNA_def_property_float_sdna(prop, NULL, "c");
7619  RNA_def_property_range(prop, 0.0f, 1.0f);
7621  prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
7622  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7623 }
7624 
7625 static void def_cmp_lensdist(StructRNA *srna)
7626 {
7627  PropertyRNA *prop;
7628 
7629  RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
7630 
7631  prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
7632  RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
7634  prop,
7635  "Projector",
7636  "Enable/disable projector mode (the effect is applied in horizontal direction only)");
7637  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7638 
7639  prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
7640  RNA_def_property_boolean_sdna(prop, NULL, "jit", 1);
7641  RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering (faster, but also noisier)");
7642  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7643 
7644  prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
7645  RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
7647  prop,
7648  "Fit",
7649  "For positive distortion factor only: scale image such that black areas are not visible");
7650  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7651 }
7652 
7654 {
7655  PropertyRNA *prop;
7656  static float default_1[3] = {1.0f, 1.0f, 1.0f};
7657 
7658  static const EnumPropertyItem type_items[] = {
7659  {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
7660  {1,
7661  "OFFSET_POWER_SLOPE",
7662  0,
7663  "Offset/Power/Slope (ASC-CDL)",
7664  "ASC-CDL standard color correction"},
7665  {0, NULL, 0, NULL, NULL},
7666  };
7667 
7668  prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
7669  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7670  RNA_def_property_enum_items(prop, type_items);
7671  RNA_def_property_ui_text(prop, "Correction Formula", "");
7672  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7673 
7674  RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage");
7675 
7676  prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
7677  RNA_def_property_float_sdna(prop, NULL, "lift");
7678  RNA_def_property_array(prop, 3);
7679  RNA_def_property_float_array_default(prop, default_1);
7680  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
7681  RNA_def_property_ui_text(prop, "Lift", "Correction for shadows");
7682  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
7683 
7684  prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
7685  RNA_def_property_float_sdna(prop, NULL, "gamma");
7686  RNA_def_property_array(prop, 3);
7687  RNA_def_property_float_array_default(prop, default_1);
7688  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
7689  RNA_def_property_ui_text(prop, "Gamma", "Correction for midtones");
7690  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
7691 
7692  prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
7693  RNA_def_property_float_sdna(prop, NULL, "gain");
7694  RNA_def_property_array(prop, 3);
7695  RNA_def_property_float_array_default(prop, default_1);
7696  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
7697  RNA_def_property_ui_text(prop, "Gain", "Correction for highlights");
7698  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
7699 
7700  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
7701  RNA_def_property_float_sdna(prop, NULL, "offset");
7702  RNA_def_property_array(prop, 3);
7703  RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
7704  RNA_def_property_ui_text(prop, "Offset", "Correction for entire tonal range");
7705  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
7706 
7707  prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
7708  RNA_def_property_float_sdna(prop, NULL, "power");
7709  RNA_def_property_array(prop, 3);
7710  RNA_def_property_float_array_default(prop, default_1);
7711  RNA_def_property_range(prop, 0.0f, FLT_MAX);
7712  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
7713  RNA_def_property_ui_text(prop, "Power", "Correction for midtones");
7714  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
7715 
7716  prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
7717  RNA_def_property_float_sdna(prop, NULL, "slope");
7718  RNA_def_property_array(prop, 3);
7719  RNA_def_property_float_array_default(prop, default_1);
7720  RNA_def_property_range(prop, 0.0f, FLT_MAX);
7721  RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
7722  RNA_def_property_ui_text(prop, "Slope", "Correction for highlights");
7723  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
7724 
7725  prop = RNA_def_property(srna, "offset_basis", PROP_FLOAT, PROP_NONE);
7726  RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
7727  RNA_def_property_ui_range(prop, -1.0, 1.0, 1.0, 2);
7728  RNA_def_property_ui_text(prop, "Basis", "Support negative color by using this as the RGB basis");
7729  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
7730 }
7731 
7732 static void def_cmp_huecorrect(StructRNA *srna)
7733 {
7734  PropertyRNA *prop;
7735 
7736  prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
7737  RNA_def_property_pointer_sdna(prop, NULL, "storage");
7738  RNA_def_property_struct_type(prop, "CurveMapping");
7739  RNA_def_property_ui_text(prop, "Mapping", "");
7740  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7741 }
7742 
7743 static void def_cmp_zcombine(StructRNA *srna)
7744 {
7745  PropertyRNA *prop;
7746 
7747  prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
7748  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
7750  prop, "Use Alpha", "Take alpha channel into account when doing the Z operation");
7751  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7752 
7753  prop = RNA_def_property(srna, "use_antialias_z", PROP_BOOLEAN, PROP_NONE);
7754  RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 0);
7756  prop,
7757  "Anti-Alias Z",
7758  "Anti-alias the z-buffer to try to avoid artifacts, mostly useful for Blender renders");
7759  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7760 }
7761 
7762 static void def_cmp_ycc(StructRNA *srna)
7763 {
7764  PropertyRNA *prop;
7765 
7766  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
7767  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7769  RNA_def_property_ui_text(prop, "Mode", "");
7770  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7771 }
7772 
7773 static void def_cmp_movieclip(StructRNA *srna)
7774 {
7775  PropertyRNA *prop;
7776 
7777  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
7778  RNA_def_property_pointer_sdna(prop, NULL, "id");
7779  RNA_def_property_struct_type(prop, "MovieClip");
7781  RNA_def_property_ui_text(prop, "Movie Clip", "");
7782  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7783 
7784  RNA_def_struct_sdna_from(srna, "MovieClipUser", "storage");
7785 }
7786 
7787 static void def_cmp_stabilize2d(StructRNA *srna)
7788 {
7789  PropertyRNA *prop;
7790 
7791  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
7792  RNA_def_property_pointer_sdna(prop, NULL, "id");
7793  RNA_def_property_struct_type(prop, "MovieClip");
7795  RNA_def_property_ui_text(prop, "Movie Clip", "");
7796  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7797 
7798  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
7799  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7801  RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
7802  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7803 
7804  prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
7807  prop, "Invert", "Invert stabilization to re-introduce motion to the frame");
7808  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7809 }
7810 
7812 {
7813  PropertyRNA *prop;
7814 
7815  static const EnumPropertyItem distortion_type_items[] = {
7816  {0, "UNDISTORT", 0, "Undistort", ""},
7817  {1, "DISTORT", 0, "Distort", ""},
7818  {0, NULL, 0, NULL, NULL},
7819  };
7820 
7821  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
7822  RNA_def_property_pointer_sdna(prop, NULL, "id");
7823  RNA_def_property_struct_type(prop, "MovieClip");
7825  RNA_def_property_ui_text(prop, "Movie Clip", "");
7826  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7827 
7828  prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
7829  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7830  RNA_def_property_enum_items(prop, distortion_type_items);
7831  RNA_def_property_ui_text(prop, "Distortion", "Distortion to use to filter image");
7832  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7833 }
7834 
7835 static void def_cmp_mask(StructRNA *srna)
7836 {
7837  PropertyRNA *prop;
7838 
7839  static const EnumPropertyItem aspect_type_items[] = {
7840  {0, "SCENE", 0, "Scene Size", ""},
7841  {CMP_NODEFLAG_MASK_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
7843  "FIXED_SCENE",
7844  0,
7845  "Fixed/Scene",
7846  "Pixel size scaled by scene percentage"},
7847  {0, NULL, 0, NULL, NULL},
7848  };
7849 
7850  prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
7851  RNA_def_property_pointer_sdna(prop, NULL, "id");
7852  RNA_def_property_struct_type(prop, "Mask");
7854  RNA_def_property_ui_text(prop, "Mask", "");
7855 
7856  prop = RNA_def_property(srna, "use_feather", PROP_BOOLEAN, PROP_NONE);
7858  RNA_def_property_ui_text(prop, "Feather", "Use feather information from the mask");
7859  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7860 
7861  prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
7863  RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
7864  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7865 
7866  prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
7867  RNA_def_property_int_sdna(prop, NULL, "custom2");
7869  RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
7870  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7871 
7872  prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
7873  RNA_def_property_float_sdna(prop, NULL, "custom3");
7874  RNA_def_property_range(prop, 0.0, 1.0f);
7875  RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
7876  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7877 
7878  prop = RNA_def_property(srna, "size_source", PROP_ENUM, PROP_NONE);
7879  RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom1");
7880  RNA_def_property_enum_items(prop, aspect_type_items);
7882  prop, "Size Source", "Where to get the mask size from for aspect/size information");
7883  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7884 
7885  RNA_def_struct_sdna_from(srna, "NodeMask", "storage");
7886 
7887  prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
7888  RNA_def_property_range(prop, 1.0f, 10000.0f);
7889  RNA_def_property_ui_text(prop, "X", "");
7890  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7891 
7892  prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
7893  RNA_def_property_range(prop, 1.0f, 10000.0f);
7894  RNA_def_property_ui_text(prop, "Y", "");
7895  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7896 }
7897 
7898 static void dev_cmd_transform(StructRNA *srna)
7899 {
7900  PropertyRNA *prop;
7901 
7902  prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
7903  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7905  RNA_def_property_ui_text(prop, "Filter", "Method to use to filter transform");
7906  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7907 }
7908 
7909 /* -- Compositor Nodes ------------------------------------------------------ */
7910 
7912  {0, "ADD", 0, "Add", ""},
7913  {1, "SUBTRACT", 0, "Subtract", ""},
7914  {2, "MULTIPLY", 0, "Multiply", ""},
7915  {3, "NOT", 0, "Not", ""},
7916  {0, NULL, 0, NULL, NULL},
7917 };
7918 
7919 static void def_cmp_boxmask(StructRNA *srna)
7920 {
7921  PropertyRNA *prop;
7922 
7923  prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
7924  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7926  RNA_def_property_ui_text(prop, "Mask Type", "");
7927  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7928 
7929  RNA_def_struct_sdna_from(srna, "NodeBoxMask", "storage");
7930 
7931  prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
7932  RNA_def_property_float_sdna(prop, NULL, "x");
7933  RNA_def_property_float_default(prop, 0.5f);
7934  RNA_def_property_range(prop, -1.0f, 2.0f);
7935  RNA_def_property_ui_text(prop, "X", "X position of the middle of the box");
7936  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7937 
7938  prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
7939  RNA_def_property_float_sdna(prop, NULL, "y");
7940  RNA_def_property_float_default(prop, 0.5f);
7941  RNA_def_property_range(prop, -1.0f, 2.0f);
7942  RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the box");
7943  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7944 
7945  prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
7946  RNA_def_property_float_sdna(prop, NULL, "width");
7947  RNA_def_property_float_default(prop, 0.3f);
7948  RNA_def_property_range(prop, 0.0f, 2.0f);
7949  RNA_def_property_ui_text(prop, "Width", "Width of the box");
7950  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7951 
7952  prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
7953  RNA_def_property_float_sdna(prop, NULL, "height");
7954  RNA_def_property_float_default(prop, 0.2f);
7955  RNA_def_property_range(prop, 0.0f, 2.0f);
7956  RNA_def_property_ui_text(prop, "Height", "Height of the box");
7957  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7958 
7959  prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
7960  RNA_def_property_float_sdna(prop, NULL, "rotation");
7961  RNA_def_property_float_default(prop, 0.0f);
7962  RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
7963  RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the box");
7964  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7965 }
7966 
7967 static void def_cmp_ellipsemask(StructRNA *srna)
7968 {
7969  PropertyRNA *prop;
7970  prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
7971  RNA_def_property_enum_sdna(prop, NULL, "custom1");
7973  RNA_def_property_ui_text(prop, "Mask Type", "");
7974  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7975 
7976  RNA_def_struct_sdna_from(srna, "NodeEllipseMask", "storage");
7977 
7978  prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
7979  RNA_def_property_float_sdna(prop, NULL, "x");
7980  RNA_def_property_float_default(prop, 0.5f);
7981  RNA_def_property_range(prop, -1.0f, 2.0f);
7982  RNA_def_property_ui_text(prop, "X", "X position of the middle of the ellipse");
7983  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7984 
7985  prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
7986  RNA_def_property_float_sdna(prop, NULL, "y");
7987  RNA_def_property_float_default(prop, 0.5f);
7988  RNA_def_property_range(prop, -1.0f, 2.0f);
7989  RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the ellipse");
7990  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7991 
7992  prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
7993  RNA_def_property_float_sdna(prop, NULL, "width");
7994  RNA_def_property_float_default(prop, 0.3f);
7995  RNA_def_property_range(prop, 0.0f, 2.0f);
7996  RNA_def_property_ui_text(prop, "Width", "Width of the ellipse");
7997  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
7998 
7999  prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
8000  RNA_def_property_float_sdna(prop, NULL, "height");
8001  RNA_def_property_float_default(prop, 0.2f);
8002  RNA_def_property_range(prop, 0.0f, 2.0f);
8003  RNA_def_property_ui_text(prop, "Height", "Height of the ellipse");
8004  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8005 
8006  prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
8007  RNA_def_property_float_sdna(prop, NULL, "rotation");
8008  RNA_def_property_float_default(prop, 0.0f);
8009  RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
8010  RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the ellipse");
8011  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8012 }
8013 
8014 static void def_cmp_bokehblur(StructRNA *srna)
8015 {
8016  PropertyRNA *prop;
8017 
8018  /* duplicated in def_cmp_blur */
8019  prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
8022  prop, "Variable Size", "Support variable blur per pixel when using an image for size input");
8023  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8024 
8025  prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
8028  prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
8029  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8030 
8031 # if 0
8032  prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
8033  RNA_def_property_float_sdna(prop, NULL, "custom3");
8034  RNA_def_property_range(prop, 0.0f, 128.0f);
8036  prop,
8037  "F-Stop",
8038  "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles "
8039  "the blur radius");
8040  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8041 # endif
8042 
8043  prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
8044  RNA_def_property_float_sdna(prop, NULL, "custom4");
8045  RNA_def_property_range(prop, 0.0f, 10000.0f);
8046  RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
8047  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8048 }
8049 
8050 static void def_cmp_bokehimage(StructRNA *srna)
8051 {
8052  PropertyRNA *prop;
8053 
8054  RNA_def_struct_sdna_from(srna, "NodeBokehImage", "storage");
8055 
8056  prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
8057  RNA_def_property_float_sdna(prop, NULL, "angle");
8058  RNA_def_property_float_default(prop, 0.0f);
8059  RNA_def_property_range(prop, DEG2RADF(-720.0f), DEG2RADF(720.0f));
8060  RNA_def_property_ui_text(prop, "Angle", "Angle of the bokeh");
8061  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8062 
8063  prop = RNA_def_property(srna, "flaps", PROP_INT, PROP_NONE);
8064  RNA_def_property_int_sdna(prop, NULL, "flaps");
8066  RNA_def_property_range(prop, 3, 24);
8067  RNA_def_property_ui_text(prop, "Flaps", "Number of flaps");
8068  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8069 
8070  prop = RNA_def_property(srna, "rounding", PROP_FLOAT, PROP_NONE);
8071  RNA_def_property_float_sdna(prop, NULL, "rounding");
8072  RNA_def_property_float_default(prop, 0.0f);
8073  RNA_def_property_range(prop, -0.0f, 1.0f);
8074  RNA_def_property_ui_text(prop, "Rounding", "Level of rounding of the bokeh");
8075  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8076 
8077  prop = RNA_def_property(srna, "catadioptric", PROP_FLOAT, PROP_NONE);
8078  RNA_def_property_float_sdna(prop, NULL, "catadioptric");
8079  RNA_def_property_float_default(prop, 0.0f);
8080  RNA_def_property_range(prop, -0.0f, 1.0f);
8081  RNA_def_property_ui_text(prop, "Catadioptric", "Level of catadioptric of the bokeh");
8082  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8083 
8084  prop = RNA_def_property(srna, "shift", PROP_FLOAT, PROP_NONE);
8085  RNA_def_property_float_sdna(prop, NULL, "lensshift");
8086  RNA_def_property_float_default(prop, 0.0f);
8087  RNA_def_property_range(prop, -1.0f, 1.0f);
8088  RNA_def_property_ui_text(prop, "Lens Shift", "Shift of the lens components");
8089  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8090 }
8091 
8092 static void def_cmp_switch(StructRNA *srna)
8093 {
8094  PropertyRNA *prop;
8095 
8096  prop = RNA_def_property(srna, "check", PROP_BOOLEAN, PROP_NONE);
8097  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
8098  RNA_def_property_ui_text(prop, "Switch", "Off: first socket, On: second socket");
8099  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8100 }
8101 
8103 {
8104 }
8105 
8107 {
8108  PropertyRNA *prop;
8109  prop = RNA_def_property(srna, "red", PROP_BOOLEAN, PROP_NONE);
8110  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
8112  RNA_def_property_ui_text(prop, "Red", "Red channel active");
8113  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8114 
8115  prop = RNA_def_property(srna, "green", PROP_BOOLEAN, PROP_NONE);
8116  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 2);
8118  RNA_def_property_ui_text(prop, "Green", "Green channel active");
8119  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8120 
8121  prop = RNA_def_property(srna, "blue", PROP_BOOLEAN, PROP_NONE);
8122  RNA_def_property_boolean_sdna(prop, NULL, "custom1", 4);
8124  RNA_def_property_ui_text(prop, "Blue", "Blue channel active");
8125  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8126 
8127  RNA_def_struct_sdna_from(srna, "NodeColorCorrection", "storage");
8128 
8129  prop = RNA_def_property(srna, "midtones_start", PROP_FLOAT, PROP_NONE);
8130  RNA_def_property_float_sdna(prop, NULL, "startmidtones");
8131  RNA_def_property_float_default(prop, 0.2f);
8132  RNA_def_property_range(prop, 0, 1);
8133  RNA_def_property_ui_text(prop, "Midtones Start", "Start of midtones");
8134  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8135 
8136  prop = RNA_def_property(srna, "midtones_end", PROP_FLOAT, PROP_NONE);
8137  RNA_def_property_float_sdna(prop, NULL, "endmidtones");
8138  RNA_def_property_float_default(prop, 0.7f);
8139  RNA_def_property_range(prop, 0, 1);
8140  RNA_def_property_ui_text(prop, "Midtones End", "End of midtones");
8141  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8142 
8143  prop = RNA_def_property(srna, "master_saturation", PROP_FLOAT, PROP_NONE);
8144  RNA_def_property_float_sdna(prop, NULL, "master.saturation");
8145  RNA_def_property_float_default(prop, 1.0f);
8146  RNA_def_property_range(prop, 0, 4);
8147  RNA_def_property_ui_text(prop, "Master Saturation", "Master saturation");
8148  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8149 
8150  prop = RNA_def_property(srna, "master_contrast", PROP_FLOAT, PROP_NONE);
8151  RNA_def_property_float_sdna(prop, NULL, "master.contrast");
8152  RNA_def_property_float_default(prop, 1.0f);
8153  RNA_def_property_range(prop, 0, 4);
8154  RNA_def_property_ui_text(prop, "Master Contrast", "Master contrast");
8155  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8156 
8157  prop = RNA_def_property(srna, "master_gamma", PROP_FLOAT, PROP_NONE);
8158  RNA_def_property_float_sdna(prop, NULL, "master.gamma");
8159  RNA_def_property_float_default(prop, 1.0f);
8160  RNA_def_property_range(prop, 0, 4);
8161  RNA_def_property_ui_text(prop, "Master Gamma", "Master gamma");
8162  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8163 
8164  prop = RNA_def_property(srna, "master_gain", PROP_FLOAT, PROP_NONE);
8165  RNA_def_property_float_sdna(prop, NULL, "master.gain");
8166  RNA_def_property_float_default(prop, 1.0f);
8167  RNA_def_property_range(prop, 0, 4);
8168  RNA_def_property_ui_text(prop, "Master Gain", "Master gain");
8169  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8170 
8171  prop = RNA_def_property(srna, "master_lift", PROP_FLOAT, PROP_NONE);
8172  RNA_def_property_float_sdna(prop, NULL, "master.lift");
8173  RNA_def_property_float_default(prop, 0.0f);
8174  RNA_def_property_range(prop, -1, 1);
8175  RNA_def_property_ui_text(prop, "Master Lift", "Master lift");
8176  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8177 
8178  //
8179  prop = RNA_def_property(srna, "shadows_saturation", PROP_FLOAT, PROP_NONE);
8180  RNA_def_property_float_sdna(prop, NULL, "shadows.saturation");
8181  RNA_def_property_float_default(prop, 1.0f);
8182  RNA_def_property_range(prop, 0, 4);
8183  RNA_def_property_ui_text(prop, "Shadows Saturation", "Shadows saturation");
8184  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8185 
8186  prop = RNA_def_property(srna, "shadows_contrast", PROP_FLOAT, PROP_NONE);
8187  RNA_def_property_float_sdna(prop, NULL, "shadows.contrast");
8188  RNA_def_property_float_default(prop, 1.0f);
8189  RNA_def_property_range(prop, 0, 4);
8190  RNA_def_property_ui_text(prop, "Shadows Contrast", "Shadows contrast");
8191  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8192 
8193  prop = RNA_def_property(srna, "shadows_gamma", PROP_FLOAT, PROP_NONE);
8194  RNA_def_property_float_sdna(prop, NULL, "shadows.gamma");
8195  RNA_def_property_float_default(prop, 1.0f);
8196  RNA_def_property_range(prop, 0, 4);
8197  RNA_def_property_ui_text(prop, "Shadows Gamma", "Shadows gamma");
8198  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8199 
8200  prop = RNA_def_property(srna, "shadows_gain", PROP_FLOAT, PROP_NONE);
8201  RNA_def_property_float_sdna(prop, NULL, "shadows.gain");
8202  RNA_def_property_float_default(prop, 1.0f);
8203  RNA_def_property_range(prop, 0, 4);
8204  RNA_def_property_ui_text(prop, "Shadows Gain", "Shadows gain");
8205  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8206 
8207  prop = RNA_def_property(srna, "shadows_lift", PROP_FLOAT, PROP_NONE);
8208  RNA_def_property_float_sdna(prop, NULL, "shadows.lift");
8209  RNA_def_property_float_default(prop, 0.0f);
8210  RNA_def_property_range(prop, -1, 1);
8211  RNA_def_property_ui_text(prop, "Shadows Lift", "Shadows lift");
8212  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8213  //
8214  prop = RNA_def_property(srna, "midtones_saturation", PROP_FLOAT, PROP_NONE);
8215  RNA_def_property_float_sdna(prop, NULL, "midtones.saturation");
8216  RNA_def_property_float_default(prop, 1.0f);
8217  RNA_def_property_range(prop, 0, 4);
8218  RNA_def_property_ui_text(prop, "Midtones Saturation", "Midtones saturation");
8219  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8220 
8221  prop = RNA_def_property(srna, "midtones_contrast", PROP_FLOAT, PROP_NONE);
8222  RNA_def_property_float_sdna(prop, NULL, "midtones.contrast");
8223  RNA_def_property_float_default(prop, 1.0f);
8224  RNA_def_property_range(prop, 0, 4);
8225  RNA_def_property_ui_text(prop, "Midtones Contrast", "Midtones contrast");
8226  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8227 
8228  prop = RNA_def_property(srna, "midtones_gamma", PROP_FLOAT, PROP_NONE);
8229  RNA_def_property_float_sdna(prop, NULL, "midtones.gamma");
8230  RNA_def_property_float_default(prop, 1.0f);
8231  RNA_def_property_range(prop, 0, 4);
8232  RNA_def_property_ui_text(prop, "Midtones Gamma", "Midtones gamma");
8233  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8234 
8235  prop = RNA_def_property(srna, "midtones_gain", PROP_FLOAT, PROP_NONE);
8236  RNA_def_property_float_sdna(prop, NULL, "midtones.gain");
8237  RNA_def_property_float_default(prop, 1.0f);
8238  RNA_def_property_range(prop, 0, 4);
8239  RNA_def_property_ui_text(prop, "Midtones Gain", "Midtones gain");
8240  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8241 
8242  prop = RNA_def_property(srna, "midtones_lift", PROP_FLOAT, PROP_NONE);
8243  RNA_def_property_float_sdna(prop, NULL, "midtones.lift");
8244  RNA_def_property_float_default(prop, 0.0f);
8245  RNA_def_property_range(prop, -1, 1);
8246  RNA_def_property_ui_text(prop, "Midtones Lift", "Midtones lift");
8247  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8248  //
8249  prop = RNA_def_property(srna, "highlights_saturation", PROP_FLOAT, PROP_NONE);
8250  RNA_def_property_float_sdna(prop, NULL, "highlights.saturation");
8251  RNA_def_property_float_default(prop, 1.0f);
8252  RNA_def_property_range(prop, 0, 4);
8253  RNA_def_property_ui_text(prop, "Highlights Saturation", "Highlights saturation");
8254  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8255 
8256  prop = RNA_def_property(srna, "highlights_contrast", PROP_FLOAT, PROP_NONE);
8257  RNA_def_property_float_sdna(prop, NULL, "highlights.contrast");
8258  RNA_def_property_float_default(prop, 1.0f);
8259  RNA_def_property_range(prop, 0, 4);
8260  RNA_def_property_ui_text(prop, "Highlights Contrast", "Highlights contrast");
8261  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8262 
8263  prop = RNA_def_property(srna, "highlights_gamma", PROP_FLOAT, PROP_NONE);
8264  RNA_def_property_float_sdna(prop, NULL, "highlights.gamma");
8265  RNA_def_property_float_default(prop, 1.0f);
8266  RNA_def_property_range(prop, 0, 4);
8267  RNA_def_property_ui_text(prop, "Highlights Gamma", "Highlights gamma");
8268  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8269 
8270  prop = RNA_def_property(srna, "highlights_gain", PROP_FLOAT, PROP_NONE);
8271  RNA_def_property_float_sdna(prop, NULL, "highlights.gain");
8272  RNA_def_property_float_default(prop, 1.0f);
8273  RNA_def_property_range(prop, 0, 4);
8274  RNA_def_property_ui_text(prop, "Highlights Gain", "Highlights gain");
8275  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8276 
8277  prop = RNA_def_property(srna, "highlights_lift", PROP_FLOAT, PROP_NONE);
8278  RNA_def_property_float_sdna(prop, NULL, "highlights.lift");
8279  RNA_def_property_float_default(prop, 0.0f);
8280  RNA_def_property_range(prop, -1, 1);
8281  RNA_def_property_ui_text(prop, "Highlights Lift", "Highlights lift");
8282  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8283 }
8284 
8285 static void def_cmp_viewer(StructRNA *srna)
8286 {
8287  PropertyRNA *prop;
8288  static const EnumPropertyItem tileorder_items[] = {
8289  {0, "CENTEROUT", 0, "Center", "Expand from center"},
8290  {1, "RANDOM", 0, "Random", "Random tiles"},
8291  {2, "BOTTOMUP", 0, "Bottom Up", "Expand from bottom"},
8292  {3, "RULE_OF_THIRDS", 0, "Rule of Thirds", "Expand from 9 places"},
8293  {0, NULL, 0, NULL, NULL},
8294  };
8295 
8296  prop = RNA_def_property(srna, "tile_order", PROP_ENUM, PROP_NONE);
8297  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8298  RNA_def_property_enum_items(prop, tileorder_items);
8299  RNA_def_property_ui_text(prop, "Tile Order", "Tile order");
8300  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8301 
8302  prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
8303  RNA_def_property_float_sdna(prop, NULL, "custom3");
8304  RNA_def_property_float_default(prop, 0.5f);
8305  RNA_def_property_range(prop, 0.0f, 1.0f);
8306  RNA_def_property_ui_text(prop, "X", "");
8307  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8308 
8309  prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
8310  RNA_def_property_float_sdna(prop, NULL, "custom4");
8311  RNA_def_property_float_default(prop, 0.5f);
8312  RNA_def_property_range(prop, 0.0f, 1.0f);
8313  RNA_def_property_ui_text(prop, "Y", "");
8314  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8315 
8316  prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
8319  prop,
8320  "Use Alpha",
8321  "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
8322  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8323 }
8324 
8325 static void def_cmp_composite(StructRNA *srna)
8326 {
8327  PropertyRNA *prop;
8328 
8329  prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
8332  prop,
8333  "Use Alpha",
8334  "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
8335  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8336 }
8337 
8339 {
8340  PropertyRNA *prop;
8341 
8342  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8343  RNA_def_property_pointer_sdna(prop, NULL, "id");
8344  RNA_def_property_struct_type(prop, "MovieClip");
8346  RNA_def_property_ui_text(prop, "Movie Clip", "");
8347  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8348 
8349  RNA_def_struct_sdna_from(srna, "NodeKeyingScreenData", "storage");
8350 
8351  prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
8352  RNA_def_property_string_sdna(prop, NULL, "tracking_object");
8353  RNA_def_property_ui_text(prop, "Tracking Object", "");
8354  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8355 }
8356 
8357 static void def_cmp_keying(StructRNA *srna)
8358 {
8359  PropertyRNA *prop;
8360 
8361  RNA_def_struct_sdna_from(srna, "NodeKeyingData", "storage");
8362 
8363  prop = RNA_def_property(srna, "screen_balance", PROP_FLOAT, PROP_FACTOR);
8364  RNA_def_property_float_sdna(prop, NULL, "screen_balance");
8365  RNA_def_property_range(prop, 0.0f, 1.0f);
8367  prop,
8368  "Screen Balance",
8369  "Balance between two non-primary channels primary channel is comparing against");
8370  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8371 
8372  prop = RNA_def_property(srna, "despill_factor", PROP_FLOAT, PROP_FACTOR);
8373  RNA_def_property_float_sdna(prop, NULL, "despill_factor");
8374  RNA_def_property_range(prop, 0.0f, 1.0f);
8375  RNA_def_property_ui_text(prop, "Despill Factor", "Factor of despilling screen color from image");
8376  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8377 
8378  prop = RNA_def_property(srna, "despill_balance", PROP_FLOAT, PROP_FACTOR);
8379  RNA_def_property_float_sdna(prop, NULL, "despill_balance");
8380  RNA_def_property_range(prop, 0.0f, 1.0f);
8382  prop,
8383  "Despill Balance",
8384  "Balance between non-key colors used to detect amount of key color to be removed");
8385  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8386 
8387  prop = RNA_def_property(srna, "clip_black", PROP_FLOAT, PROP_FACTOR);
8388  RNA_def_property_float_sdna(prop, NULL, "clip_black");
8389  RNA_def_property_range(prop, 0.0f, 1.0f);
8391  prop,
8392  "Clip Black",
8393  "Value of non-scaled matte pixel which considers as fully background pixel");
8394  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8395 
8396  prop = RNA_def_property(srna, "clip_white", PROP_FLOAT, PROP_FACTOR);
8397  RNA_def_property_float_sdna(prop, NULL, "clip_white");
8398  RNA_def_property_range(prop, 0.0f, 1.0f);
8400  prop,
8401  "Clip White",
8402  "Value of non-scaled matte pixel which considers as fully foreground pixel");
8403  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8404 
8405  prop = RNA_def_property(srna, "blur_pre", PROP_INT, PROP_NONE);
8406  RNA_def_property_int_sdna(prop, NULL, "blur_pre");
8407  RNA_def_property_range(prop, 0, 2048);
8409  prop, "Pre Blur", "Chroma pre-blur size which applies before running keyer");
8410  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8411 
8412  prop = RNA_def_property(srna, "blur_post", PROP_INT, PROP_NONE);
8413  RNA_def_property_int_sdna(prop, NULL, "blur_post");
8414  RNA_def_property_range(prop, 0, 2048);
8416  prop, "Post Blur", "Matte blur size which applies after clipping and dilate/eroding");
8417  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8418 
8419  prop = RNA_def_property(srna, "dilate_distance", PROP_INT, PROP_NONE);
8420  RNA_def_property_int_sdna(prop, NULL, "dilate_distance");
8421  RNA_def_property_range(prop, -100, 100);
8422  RNA_def_property_ui_text(prop, "Dilate/Erode", "Matte dilate/erode side");
8423  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8424 
8425  prop = RNA_def_property(srna, "edge_kernel_radius", PROP_INT, PROP_NONE);
8426  RNA_def_property_int_sdna(prop, NULL, "edge_kernel_radius");
8427  RNA_def_property_range(prop, 0, 100);
8429  prop, "Edge Kernel Radius", "Radius of kernel used to detect whether pixel belongs to edge");
8430  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8431 
8432  prop = RNA_def_property(srna, "edge_kernel_tolerance", PROP_FLOAT, PROP_FACTOR);
8433  RNA_def_property_float_sdna(prop, NULL, "edge_kernel_tolerance");
8434  RNA_def_property_range(prop, 0.0f, 1.0f);
8436  prop,
8437  "Edge Kernel Tolerance",
8438  "Tolerance to pixels inside kernel which are treating as belonging to the same plane");
8439  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8440 
8441  prop = RNA_def_property(srna, "feather_falloff", PROP_ENUM, PROP_NONE);
8442  RNA_def_property_enum_sdna(prop, NULL, "feather_falloff");
8444  RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type the feather");
8445  RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
8446  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8447 
8448  prop = RNA_def_property(srna, "feather_distance", PROP_INT, PROP_NONE);
8449  RNA_def_property_int_sdna(prop, NULL, "feather_distance");
8450  RNA_def_property_range(prop, -100, 100);
8451  RNA_def_property_ui_text(prop, "Feather Distance", "Distance to grow/shrink the feather");
8452  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8453 }
8454 
8455 static void def_cmp_trackpos(StructRNA *srna)
8456 {
8457  PropertyRNA *prop;
8458 
8459  static const EnumPropertyItem position_items[] = {
8460  {CMP_TRACKPOS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Output absolute position of a marker"},
8462  "RELATIVE_START",
8463  0,
8464  "Relative Start",
8465  "Output position of a marker relative to first marker of a track"},
8467  "RELATIVE_FRAME",
8468  0,
8469  "Relative Frame",
8470  "Output position of a marker relative to marker at given frame number"},
8472  "ABSOLUTE_FRAME",
8473  0,
8474  "Absolute Frame",
8475  "Output absolute position of a marker at given frame number"},
8476  {0, NULL, 0, NULL, NULL},
8477  };
8478 
8479  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8480  RNA_def_property_pointer_sdna(prop, NULL, "id");
8481  RNA_def_property_struct_type(prop, "MovieClip");
8483  RNA_def_property_ui_text(prop, "Movie Clip", "");
8484  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8485 
8486  prop = RNA_def_property(srna, "position", PROP_ENUM, PROP_NONE);
8487  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8488  RNA_def_property_enum_items(prop, position_items);
8489  RNA_def_property_ui_text(prop, "Position", "Which marker position to use for output");
8490  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8491 
8492  prop = RNA_def_property(srna, "frame_relative", PROP_INT, PROP_NONE);
8493  RNA_def_property_int_sdna(prop, NULL, "custom2");
8494  RNA_def_property_ui_text(prop, "Frame", "Frame to be used for relative position");
8495  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8496 
8497  RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
8498 
8499  prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
8500  RNA_def_property_string_sdna(prop, NULL, "tracking_object");
8501  RNA_def_property_ui_text(prop, "Tracking Object", "");
8502  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8503 
8504  prop = RNA_def_property(srna, "track_name", PROP_STRING, PROP_NONE);
8505  RNA_def_property_string_sdna(prop, NULL, "track_name");
8506  RNA_def_property_ui_text(prop, "Track", "");
8507  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8508 }
8509 
8510 static void def_cmp_translate(StructRNA *srna)
8511 {
8512  static const EnumPropertyItem translate_items[] = {
8513  {CMP_NODE_WRAP_NONE, "NONE", 0, "None", "No wrapping on X and Y"},
8514  {CMP_NODE_WRAP_X, "XAXIS", 0, "X Axis", "Wrap all pixels on the X axis"},
8515  {CMP_NODE_WRAP_Y, "YAXIS", 0, "Y Axis", "Wrap all pixels on the Y axis"},
8516  {CMP_NODE_WRAP_XY, "BOTH", 0, "Both Axes", "Wrap all pixels on both axes"},
8517  {0, NULL, 0, NULL, NULL},
8518  };
8519 
8520  PropertyRNA *prop;
8521 
8522  RNA_def_struct_sdna_from(srna, "NodeTranslateData", "storage");
8523 
8524  prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
8525  RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
8527  prop,
8528  "Relative",
8529  "Use relative (fraction of input image size) values to define translation");
8530  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8531 
8532  prop = RNA_def_property(srna, "wrap_axis", PROP_ENUM, PROP_NONE);
8533  RNA_def_property_enum_sdna(prop, NULL, "wrap_axis");
8534  RNA_def_property_enum_items(prop, translate_items);
8535  RNA_def_property_ui_text(prop, "Wrapping", "Wrap image on a specific axis");
8536  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8537 }
8538 
8540 {
8541  PropertyRNA *prop;
8542 
8543  prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
8544  RNA_def_property_pointer_sdna(prop, NULL, "id");
8545  RNA_def_property_struct_type(prop, "MovieClip");
8547  RNA_def_property_ui_text(prop, "Movie Clip", "");
8548  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8549 
8550  RNA_def_struct_sdna_from(srna, "NodePlaneTrackDeformData", "storage");
8551 
8552  prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
8553  RNA_def_property_string_sdna(prop, NULL, "tracking_object");
8554  RNA_def_property_ui_text(prop, "Tracking Object", "");
8555  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8556 
8557  prop = RNA_def_property(srna, "plane_track_name", PROP_STRING, PROP_NONE);
8558  RNA_def_property_string_sdna(prop, NULL, "plane_track_name");
8559  RNA_def_property_ui_text(prop, "Plane Track", "");
8560  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8561 
8562  prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
8564  RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
8565  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8566 
8567  prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
8569  RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
8570  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8571 
8572  prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
8573  RNA_def_property_range(prop, 0.0, 1.0f);
8574  RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
8575  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8576 }
8577 
8578 static void def_cmp_sunbeams(StructRNA *srna)
8579 {
8580  PropertyRNA *prop;
8581 
8582  RNA_def_struct_sdna_from(srna, "NodeSunBeams", "storage");
8583 
8584  prop = RNA_def_property(srna, "source", PROP_FLOAT, PROP_NONE);
8585  RNA_def_property_float_sdna(prop, NULL, "source");
8586  RNA_def_property_range(prop, -100.0f, 100.0f);
8587  RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
8589  prop, "Source", "Source point of rays as a factor of the image width and height");
8590  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8591 
8592  prop = RNA_def_property(srna, "ray_length", PROP_FLOAT, PROP_UNSIGNED);
8593  RNA_def_property_float_sdna(prop, NULL, "ray_length");
8594  RNA_def_property_range(prop, 0.0f, 100.0f);
8595  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 3);
8596  RNA_def_property_ui_text(prop, "Ray Length", "Length of rays as a factor of the image size");
8597  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8598 }
8599 
8601 {
8602  StructRNA *srna;
8603  PropertyRNA *prop;
8604 
8605  srna = RNA_def_struct(brna, "CryptomatteEntry", NULL);
8606  RNA_def_struct_sdna(srna, "CryptomatteEntry");
8607 
8608  prop = RNA_def_property(srna, "encoded_hash", PROP_FLOAT, PROP_NONE);
8610  RNA_def_property_float_sdna(prop, NULL, "encoded_hash");
8611 
8612  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
8614  RNA_def_property_ui_text(prop, "Name", "");
8615  RNA_def_struct_name_property(srna, prop);
8616 }
8617 
8619 {
8620  PropertyRNA *prop;
8621  static float default_1[3] = {1.0f, 1.0f, 1.0f};
8622 
8623  prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE);
8625  "rna_NodeCryptomatte_matte_get",
8626  "rna_NodeCryptomatte_matte_length",
8627  "rna_NodeCryptomatte_matte_set");
8629  prop, "Matte Objects", "List of object and material crypto IDs to include in matte");
8630  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8631 
8632  prop = RNA_def_property(srna, "add", PROP_FLOAT, PROP_COLOR);
8633  RNA_def_property_float_sdna(prop, NULL, "runtime.add");
8634  RNA_def_property_float_array_default(prop, default_1);
8635  RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
8637  prop, "Add", "Add object or material to matte, by picking a color from the Pick output");
8638  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_add");
8639 
8640  prop = RNA_def_property(srna, "remove", PROP_FLOAT, PROP_COLOR);
8641  RNA_def_property_float_sdna(prop, NULL, "runtime.remove");
8642  RNA_def_property_float_array_default(prop, default_1);
8643  RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
8645  prop,
8646  "Remove",
8647  "Remove object or material from matte, by picking a color from the Pick output");
8648  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_remove");
8649 }
8650 
8652 {
8653  RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
8655 }
8656 
8657 static void def_cmp_cryptomatte(StructRNA *srna)
8658 {
8659  PropertyRNA *prop;
8660 
8661  static const EnumPropertyItem cryptomatte_source_items[] = {
8662  {CMP_CRYPTOMATTE_SRC_RENDER, "RENDER", 0, "Render", "Use Cryptomatte passes from a render"},
8663  {CMP_CRYPTOMATTE_SRC_IMAGE, "IMAGE", 0, "Image", "Use Cryptomatte passes from an image"},
8664  {0, NULL, 0, NULL, NULL}};
8665 
8666  prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
8667  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8668  RNA_def_property_enum_items(prop, cryptomatte_source_items);
8669  RNA_def_property_enum_funcs(prop, NULL, "rna_NodeCryptomatte_source_set", NULL);
8670  RNA_def_property_ui_text(prop, "Source", "Where the Cryptomatte passes are loaded from");
8671 
8672  prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
8674  prop, "rna_NodeCryptomatte_scene_get", "rna_NodeCryptomatte_scene_set", NULL, NULL);
8675  RNA_def_property_struct_type(prop, "Scene");
8677  RNA_def_property_ui_text(prop, "Scene", "");
8678  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8679 
8680  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
8682  "rna_NodeCryptomatte_image_get",
8683  "rna_NodeCryptomatte_image_set",
8684  NULL,
8685  "rna_NodeCryptomatte_image_poll");
8686  RNA_def_property_struct_type(prop, "Image");
8688  RNA_def_property_ui_text(prop, "Image", "");
8689  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8690 
8691  RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
8693 
8694  prop = RNA_def_property(srna, "layer_name", PROP_ENUM, PROP_NONE);
8697  "rna_NodeCryptomatte_layer_name_get",
8698  "rna_NodeCryptomatte_layer_name_set",
8699  "rna_NodeCryptomatte_layer_name_itemf");
8700  RNA_def_property_ui_text(prop, "Cryptomatte Layer", "What Cryptomatte layer is used");
8701  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8702 
8703  prop = RNA_def_property(srna, "entries", PROP_COLLECTION, PROP_NONE);
8704  RNA_def_property_collection_sdna(prop, NULL, "entries", NULL);
8705  RNA_def_property_struct_type(prop, "CryptomatteEntry");
8706  RNA_def_property_ui_text(prop, "Mattes", "");
8708 
8709  /* Included here instead of defining image_user as a property of the node,
8710  * see def_cmp_image for details.
8711  * As mentioned in DNA_node_types.h, iuser is the first member of the Cryptomatte
8712  * storage type, so we can cast node->storage to ImageUser.
8713  * That is required since we can't define the properties from storage->iuser directly... */
8714  RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
8715  def_node_image_user(srna);
8716 }
8717 
8718 static void def_cmp_denoise(StructRNA *srna)
8719 {
8720  PropertyRNA *prop;
8721 
8722  RNA_def_struct_sdna_from(srna, "NodeDenoise", "storage");
8723 
8724  prop = RNA_def_property(srna, "use_hdr", PROP_BOOLEAN, PROP_NONE);
8725  RNA_def_property_boolean_sdna(prop, NULL, "hdr", 0);
8726  RNA_def_property_ui_text(prop, "HDR", "Process HDR images");
8727  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8728 }
8729 
8731 {
8732  PropertyRNA *prop;
8733 
8734  RNA_def_struct_sdna_from(srna, "NodeAntiAliasingData", "storage");
8735 
8736  prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
8737  RNA_def_property_float_sdna(prop, NULL, "threshold");
8738  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
8740  prop,
8741  "Threshold",
8742  "Threshold to detect edges (smaller threshold makes more sensitive detection)");
8743  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8744 
8745  prop = RNA_def_property(srna, "contrast_limit", PROP_FLOAT, PROP_FACTOR);
8746  RNA_def_property_float_sdna(prop, NULL, "contrast_limit");
8747  RNA_def_property_range(prop, 0.0f, 1.0f);
8748  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
8750  prop,
8751  "Contrast Limit",
8752  "How much to eliminate spurious edges to avoid artifacts (the larger value makes less "
8753  "active; the value 2.0, for example, means discard a detected edge if there is a "
8754  "neighboring edge that has 2.0 times bigger contrast than the current one)");
8755  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8756 
8757  prop = RNA_def_property(srna, "corner_rounding", PROP_FLOAT, PROP_FACTOR);
8758  RNA_def_property_float_sdna(prop, NULL, "corner_rounding");
8759  RNA_def_property_range(prop, 0.0f, 1.0f);
8760  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
8761  RNA_def_property_ui_text(prop, "Corner Rounding", "How much sharp corners will be rounded");
8762  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8763 }
8764 
8765 /* -- Texture Nodes --------------------------------------------------------- */
8766 
8767 static void def_tex_output(StructRNA *srna)
8768 {
8769  PropertyRNA *prop;
8770 
8771  RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage");
8772 
8773  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
8774  RNA_def_property_string_sdna(prop, NULL, "name");
8775  RNA_def_property_ui_text(prop, "Output Name", "");
8776  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8777 }
8778 
8779 static void def_tex_image(StructRNA *srna)
8780 {
8781  PropertyRNA *prop;
8782 
8783  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
8784  RNA_def_property_pointer_sdna(prop, NULL, "id");
8785  RNA_def_property_struct_type(prop, "Image");
8787  RNA_def_property_ui_text(prop, "Image", "");
8788  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8789 
8790  prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
8791  RNA_def_property_pointer_sdna(prop, NULL, "storage");
8792  RNA_def_property_struct_type(prop, "ImageUser");
8794  prop, "Image User", "Parameters defining the image duration, offset and related settings");
8795  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8796 }
8797 
8798 static void def_tex_bricks(StructRNA *srna)
8799 {
8800  PropertyRNA *prop;
8801 
8802  prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
8803  RNA_def_property_float_sdna(prop, NULL, "custom3");
8804  RNA_def_property_range(prop, 0.0f, 1.0f);
8805  RNA_def_property_ui_text(prop, "Offset Amount", "");
8806  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8807 
8808  prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
8809  RNA_def_property_int_sdna(prop, NULL, "custom1");
8810  RNA_def_property_range(prop, 2, 99);
8811  RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
8812  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8813 
8814  prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
8815  RNA_def_property_float_sdna(prop, NULL, "custom4");
8816  RNA_def_property_range(prop, 0.0f, 99.0f);
8817  RNA_def_property_ui_text(prop, "Squash Amount", "");
8818  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8819 
8820  prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
8821  RNA_def_property_int_sdna(prop, NULL, "custom2");
8822  RNA_def_property_range(prop, 2, 99);
8823  RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
8824  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8825 }
8826 
8827 /* -- Geometry Nodes --------------------------------------------------------- */
8828 
8829 static void def_geo_boolean(StructRNA *srna)
8830 {
8831  PropertyRNA *prop;
8832 
8833  static const EnumPropertyItem rna_node_geometry_boolean_method_items[] = {
8835  "INTERSECT",
8836  0,
8837  "Intersect",
8838  "Keep the part of the mesh that is common between all operands"},
8839  {GEO_NODE_BOOLEAN_UNION, "UNION", 0, "Union", "Combine meshes in an additive way"},
8841  "DIFFERENCE",
8842  0,
8843  "Difference",
8844  "Combine meshes in a subtractive way"},
8845  {0, NULL, 0, NULL, NULL},
8846  };
8847 
8848  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
8849  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8850  RNA_def_property_enum_items(prop, rna_node_geometry_boolean_method_items);
8852  RNA_def_property_ui_text(prop, "Operation", "");
8853  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
8854 }
8855 
8856 static void def_geo_triangulate(StructRNA *srna)
8857 {
8858  PropertyRNA *prop;
8859 
8860  static const EnumPropertyItem rna_node_geometry_triangulate_quad_method_items[] = {
8862  "BEAUTY",
8863  0,
8864  "Beauty",
8865  "Split the quads in nice triangles, slower method"},
8867  "FIXED",
8868  0,
8869  "Fixed",
8870  "Split the quads on the first and third vertices"},
8872  "FIXED_ALTERNATE",
8873  0,
8874  "Fixed Alternate",
8875  "Split the quads on the 2nd and 4th vertices"},
8877  "SHORTEST_DIAGONAL",
8878  0,
8879  "Shortest Diagonal",
8880  "Split the quads based on the distance between the vertices"},
8881  {0, NULL, 0, NULL, NULL},
8882  };
8883 
8884  static const EnumPropertyItem rna_node_geometry_triangulate_ngon_method_items[] = {
8886  "BEAUTY",
8887  0,
8888  "Beauty",
8889  "Arrange the new triangles evenly (slow)"},
8891  "CLIP",
8892  0,
8893  "Clip",
8894  "Split the polygons with an ear clipping algorithm"},
8895  {0, NULL, 0, NULL, NULL},
8896  };
8897 
8898  prop = RNA_def_property(srna, "quad_method", PROP_ENUM, PROP_NONE);
8899  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8900  RNA_def_property_enum_items(prop, rna_node_geometry_triangulate_quad_method_items);
8902  RNA_def_property_ui_text(prop, "Quad Method", "Method for splitting the quads into triangles");
8903  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8904 
8905  prop = RNA_def_property(srna, "ngon_method", PROP_ENUM, PROP_NONE);
8906  RNA_def_property_enum_sdna(prop, NULL, "custom2");
8907  RNA_def_property_enum_items(prop, rna_node_geometry_triangulate_ngon_method_items);
8909  RNA_def_property_ui_text(prop, "N-gon Method", "Method for splitting the n-gons into triangles");
8910  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8911 }
8912 
8914 {
8915  PropertyRNA *prop;
8916 
8917  RNA_def_struct_sdna_from(srna, "NodeAttributeRandomize", "storage");
8918 
8919  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
8920  RNA_def_property_enum_sdna(prop, NULL, "data_type");
8922  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeRandom_type_itemf");
8924  RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
8926  prop, NC_NODE | NA_EDITED, "rna_GeometryNodeAttributeRandomize_data_type_update");
8927 
8928  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
8929  RNA_def_property_enum_sdna(prop, NULL, "operation");
8932  prop, NULL, NULL, "rna_GeometryNodeAttributeRandomize_operation_itemf");
8934  RNA_def_property_ui_text(prop, "Operation", "");
8935  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
8936 }
8937 
8939 {
8940  PropertyRNA *prop;
8941 
8942  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
8943  RNA_def_property_enum_sdna(prop, NULL, "custom1");
8945  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeFill_type_itemf");
8947  RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
8948  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
8949 
8950  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
8951  RNA_def_property_enum_sdna(prop, NULL, "custom2");
8954  RNA_def_property_ui_text(prop, "Domain", "");
8955  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8956 }
8957 
8959 {
8960  PropertyRNA *prop;
8961 
8962  RNA_def_struct_sdna_from(srna, "NodeAttributeConvert", "storage");
8963 
8964  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
8966  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeConvert_type_itemf");
8968  RNA_def_property_ui_text(prop, "Data Type", "The data type to save the result attribute with");
8969  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
8970 
8971  prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
8974  RNA_def_property_ui_text(prop, "Domain", "The geometry domain to save the result attribute in");
8975  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
8976 }
8977 
8979 {
8980  PropertyRNA *prop;
8981 
8982  RNA_def_struct_sdna_from(srna, "NodeAttributeMath", "storage");
8983 
8984  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
8985  RNA_def_property_enum_sdna(prop, NULL, "operation");
8988  RNA_def_property_ui_text(prop, "Operation", "");
8989  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
8990 
8991  prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE);
8992  RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_a");
8994  RNA_def_property_ui_text(prop, "Input Type A", "");
8995  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
8996 
8997  prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE);
8998  RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_b");
9000  RNA_def_property_ui_text(prop, "Input Type B", "");
9001  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9002 
9003  prop = RNA_def_property(srna, "input_type_c", PROP_ENUM, PROP_NONE);
9004  RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_c");
9006  RNA_def_property_ui_text(prop, "Input Type C", "");
9007  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9008 }
9009 
9011 {
9012  PropertyRNA *prop;
9013 
9014  RNA_def_struct_sdna_from(srna, "NodeAttributeVectorMath", "storage");
9015 
9016  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
9017  RNA_def_property_enum_sdna(prop, NULL, "operation");
9019  RNA_def_property_ui_text(prop, "Operation", "");
9021  prop, NC_NODE | NA_EDITED, "rna_GeometryNodeAttributeVectorMath_operation_update");
9022 
9023  prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE);
9024  RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_a");
9026  RNA_def_property_ui_text(prop, "Input Type A", "");
9027  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9028 
9029  prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE);
9030  RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_b");
9033  prop, NULL, NULL, "rna_GeometryNodeAttributeVectorMath_input_type_b_itemf");
9034  RNA_def_property_ui_text(prop, "Input Type B", "");
9035  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9036 
9037  prop = RNA_def_property(srna, "input_type_c", PROP_ENUM, PROP_NONE);
9038  RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_c");
9041  prop, NULL, NULL, "rna_GeometryNodeAttributeVectorMath_input_type_c_itemf");
9042  RNA_def_property_ui_text(prop, "Input Type C", "");
9043  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9044 }
9045 
9047 {
9048  PropertyRNA *prop;
9049 
9050  RNA_def_struct_sdna_from(srna, "NodeAttributeMapRange", "storage");
9051 
9052  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
9053  RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_type");
9055  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeMapRange_type_itemf");
9056  RNA_def_property_ui_text(prop, "Data Type", "");
9057  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9058 
9059  prop = RNA_def_property(srna, "interpolation_type", PROP_ENUM, PROP_NONE);
9060  RNA_def_property_enum_sdna(prop, NULL, "interpolation_type");
9062  RNA_def_property_ui_text(prop, "Interpolation Type", "");
9063  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
9064 }
9065 
9067 {
9068  static const EnumPropertyItem instance_type_items[] = {
9070  "OBJECT",
9071  ICON_NONE,
9072  "Object",
9073  "Instance an individual object on all points"},
9075  "COLLECTION",
9076  ICON_NONE,
9077  "Collection",
9078  "Instance an entire collection on all points"},
9079  {0, NULL, 0, NULL, NULL},
9080  };
9081 
9082  PropertyRNA *prop;
9083  RNA_def_struct_sdna_from(srna, "NodeGeometryPointInstance", "storage");
9084 
9085  prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);
9086  RNA_def_property_enum_sdna(prop, NULL, "instance_type");
9087  RNA_def_property_enum_items(prop, instance_type_items);
9089  RNA_def_property_ui_text(prop, "Instance Type", "");
9090  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9091 
9092  prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE);
9094  RNA_def_property_ui_text(prop, "Whole Collection", "Instance entire collection on each point");
9095  RNA_def_property_update(prop, 0, "rna_Node_socket_update");
9096 }
9097 
9099 {
9100  PropertyRNA *prop;
9101 
9102  RNA_def_struct_sdna_from(srna, "NodeAttributeMix", "storage");
9103 
9104  prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
9107  RNA_def_property_ui_text(prop, "Blending Mode", "");
9108  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9109 
9110  prop = RNA_def_property(srna, "input_type_factor", PROP_ENUM, PROP_NONE);
9112  RNA_def_property_ui_text(prop, "Input Type Factor", "");
9113  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9114 
9115  prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE);
9117  RNA_def_property_ui_text(prop, "Input Type A", "");
9118  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9119 
9120  prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE);
9122  RNA_def_property_ui_text(prop, "Input Type B", "");
9123  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9124 }
9125 
9127 {
9128  PropertyRNA *prop;
9129 
9130  RNA_def_struct_sdna_from(srna, "NodeAttributeClamp", "storage");
9131 
9132  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
9133  RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_type");
9135  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeClamp_type_itemf");
9136  RNA_def_property_ui_text(prop, "Data Type", "");
9137  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9138 
9139  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
9142  RNA_def_property_ui_text(prop, "Operation", "");
9143  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9144 }
9145 
9147 {
9148  PropertyRNA *prop;
9149 
9150  RNA_def_struct_sdna_from(srna, "NodeAttributeCompare", "storage");
9151 
9152  prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
9155  RNA_def_property_ui_text(prop, "Operation", "");
9156  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9157 
9158  prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE);
9160  RNA_def_property_ui_text(prop, "Input Type A", "");
9161  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9162 
9163  prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE);
9165  RNA_def_property_ui_text(prop, "Input Type B", "");
9166  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9167 }
9168 
9170 {
9171  PropertyRNA *prop;
9172 
9173  static const EnumPropertyItem rna_node_geometry_point_distribute_method_items[] = {
9175  "RANDOM",
9176  0,
9177  "Random",
9178  "Distribute points randomly on the surface"},
9180  "POISSON",
9181  0,
9182  "Poisson Disk",
9183  "Distribute the points randomly on the surface while taking a minimum distance between "
9184  "points into account"},
9185  {0, NULL, 0, NULL, NULL},
9186  };
9187 
9188  prop = RNA_def_property(srna, "distribute_method", PROP_ENUM, PROP_NONE);
9189  RNA_def_property_enum_sdna(prop, NULL, "custom1");
9190  RNA_def_property_enum_items(prop, rna_node_geometry_point_distribute_method_items);
9192  RNA_def_property_ui_text(prop, "Distribution Method", "Method to use for scattering points");
9193  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9194 }
9195 
9197 {
9198  PropertyRNA *prop;
9199 
9200  RNA_def_struct_sdna_from(srna, "NodeAttributeColorRamp", "storage");
9201 
9202  prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
9203  RNA_def_property_struct_type(prop, "ColorRamp");
9204  RNA_def_property_ui_text(prop, "Color Ramp", "");
9205  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9206 }
9207 
9209 {
9210  static const EnumPropertyItem type_items[] = {
9212  "AXIS_ANGLE",
9213  ICON_NONE,
9214  "Axis Angle",
9215  "Rotate around an axis by an angle"},
9217  "EULER",
9218  ICON_NONE,
9219  "Euler",
9220  "Rotate around the X, Y, and Z axes"},
9221  {0, NULL, 0, NULL, NULL},
9222  };
9223 
9224  static const EnumPropertyItem space_items[] = {
9226  "OBJECT",
9227  ICON_NONE,
9228  "Object",
9229  "Rotate points in the local space of the object"},
9231  "POINT",
9232  ICON_NONE,
9233  "Point",
9234  "Rotate every point in its local space (as defined by the 'rotation' attribute)"},
9235  {0, NULL, 0, NULL, NULL},
9236  };
9237 
9238  PropertyRNA *prop;
9239 
9240  RNA_def_struct_sdna_from(srna, "NodeGeometryRotatePoints", "storage");
9241 
9242  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
9243  RNA_def_property_enum_items(prop, type_items);
9244  RNA_def_property_ui_text(prop, "Type", "Method used to describe the rotation");
9245  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9246 
9247  prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
9249  RNA_def_property_ui_text(prop, "Space", "Base orientation of the points");
9250  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9251 
9252  prop = RNA_def_property(srna, "input_type_axis", PROP_ENUM, PROP_NONE);
9254  RNA_def_property_ui_text(prop, "Input Type Axis", "");
9255  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9256 
9257  prop = RNA_def_property(srna, "input_type_angle", PROP_ENUM, PROP_NONE);
9259  RNA_def_property_ui_text(prop, "Input Type Angle", "");
9260  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9261 
9262  prop = RNA_def_property(srna, "input_type_rotation", PROP_ENUM, PROP_NONE);
9264  RNA_def_property_ui_text(prop, "Input Type Rotation", "");
9265  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9266 }
9267 
9269 {
9270  static const EnumPropertyItem axis_items[] = {
9272  "X",
9273  ICON_NONE,
9274  "X",
9275  "Align the X axis with the vector"},
9277  "Y",
9278  ICON_NONE,
9279  "Y",
9280  "Align the Y axis with the vector"},
9282  "Z",
9283  ICON_NONE,
9284  "Z",
9285  "Align the Z axis with the vector"},
9286  {0, NULL, 0, NULL, NULL},
9287  };
9288 
9289  static const EnumPropertyItem pivot_axis_items[] = {
9291  "AUTO",
9292  ICON_NONE,
9293  "Auto",
9294  "Automatically detect the best rotation axis to rotate towards the vector"},
9296  "X",
9297  ICON_NONE,
9298  "X",
9299  "Rotate around the local X axis"},
9301  "Y",
9302  ICON_NONE,
9303  "Y",
9304  "Rotate around the local Y axis"},
9306  "Z",
9307  ICON_NONE,
9308  "Z",
9309  "Rotate around the local Z axis"},
9310  {0, NULL, 0, NULL, NULL},
9311  };
9312 
9313  PropertyRNA *prop;
9314 
9315  RNA_def_struct_sdna_from(srna, "NodeGeometryAlignRotationToVector", "storage");
9316 
9317  prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
9318  RNA_def_property_enum_items(prop, axis_items);
9319  RNA_def_property_ui_text(prop, "Axis", "Axis to align to the vector");
9320  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9321 
9322  prop = RNA_def_property(srna, "pivot_axis", PROP_ENUM, PROP_NONE);
9323  RNA_def_property_enum_items(prop, pivot_axis_items);
9324  RNA_def_property_ui_text(prop, "Pivot Axis", "Axis to rotate around");
9325  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9326 
9327  prop = RNA_def_property(srna, "input_type_factor", PROP_ENUM, PROP_NONE);
9329  RNA_def_property_ui_text(prop, "Input Type Factor", "");
9330  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9331 
9332  prop = RNA_def_property(srna, "input_type_vector", PROP_ENUM, PROP_NONE);
9334  RNA_def_property_ui_text(prop, "Input Type Vector", "");
9335  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9336 }
9337 
9338 static void def_geo_point_scale(StructRNA *srna)
9339 {
9340  PropertyRNA *prop;
9341 
9342  RNA_def_struct_sdna_from(srna, "NodeGeometryPointScale", "storage");
9343 
9344  prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE);
9346  RNA_def_property_ui_text(prop, "Input Type", "");
9347  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9348 }
9349 
9351 {
9352  PropertyRNA *prop;
9353 
9354  RNA_def_struct_sdna_from(srna, "NodeGeometryPointTranslate", "storage");
9355 
9356  prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE);
9358  RNA_def_property_ui_text(prop, "Input Type", "");
9359  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9360 }
9361 
9363 {
9364  PropertyRNA *prop;
9365 
9366  prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
9367  RNA_def_property_pointer_sdna(prop, NULL, "id");
9368  RNA_def_property_struct_type(prop, "Texture");
9371  RNA_def_property_ui_text(prop, "Texture", "Texture to sample values from");
9372  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
9373 }
9374 
9375 static void def_geo_object_info(StructRNA *srna)
9376 {
9377  PropertyRNA *prop;
9378 
9379  static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = {
9381  "ORIGINAL",
9382  0,
9383  "Original",
9384  "Output the geometry relative to the input object transform, and the location, rotation "
9385  "and "
9386  "scale relative to the world origin"},
9388  "RELATIVE",
9389  0,
9390  "Relative",
9391  "Bring the input object geometry, location, rotation and scale into the modified object, "
9392  "maintaining the relative position between the two objects in the scene"},
9393  {0, NULL, 0, NULL, NULL},
9394  };
9395 
9396  RNA_def_struct_sdna_from(srna, "NodeGeometryObjectInfo", "storage");
9397 
9398  prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
9399  RNA_def_property_enum_items(prop, rna_node_geometry_object_info_transform_space_items);
9401  prop, "Transform Space", "The transformation of the vector and geometry outputs");
9402  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9403 }
9404 
9406 {
9407  PropertyRNA *prop;
9408 
9409  static EnumPropertyItem resolution_mode_items[] = {
9411  "VOXEL_AMOUNT",
9412  0,
9413  "Amount",
9414  "Specify the approximate number of voxels along the diagonal"},
9416  "VOXEL_SIZE",
9417  0,
9418  "Size",
9419  "Specify the voxel side length"},
9420  {0, NULL, 0, NULL, NULL},
9421  };
9422 
9423  RNA_def_struct_sdna_from(srna, "NodeGeometryPointsToVolume", "storage");
9424 
9425  prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE);
9426  RNA_def_property_enum_items(prop, resolution_mode_items);
9427  RNA_def_property_ui_text(prop, "Resolution Mode", "How the voxel size is specified");
9428  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9429 
9430  prop = RNA_def_property(srna, "input_type_radius", PROP_ENUM, PROP_NONE);
9432  RNA_def_property_ui_text(prop, "Radius Input Type", "");
9433  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9434 }
9435 
9437 {
9438  PropertyRNA *prop;
9439 
9440  static const EnumPropertyItem rna_node_geometry_collection_info_transform_space_items[] = {
9442  "ORIGINAL",
9443  0,
9444  "Original",
9445  "Output the geometry relative to the collection offset"},
9447  "RELATIVE",
9448  0,
9449  "Relative",
9450  "Bring the input collection geometry into the modified object, maintaining the relative "
9451  "position between the objects in the scene"},
9452  {0, NULL, 0, NULL, NULL},
9453  };
9454 
9455  RNA_def_struct_sdna_from(srna, "NodeGeometryCollectionInfo", "storage");
9456 
9457  prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
9458  RNA_def_property_enum_items(prop, rna_node_geometry_collection_info_transform_space_items);
9459  RNA_def_property_ui_text(prop, "Transform Space", "The transformation of the geometry output");
9460  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9461 }
9462 
9464 {
9465  static const EnumPropertyItem target_geometry_element[] = {
9467  "POINTS",
9468  ICON_NONE,
9469  "Points",
9470  "Calculate proximity to the target's points (usually faster than the other two modes)"},
9472  "EDGES",
9473  ICON_NONE,
9474  "Edges",
9475  "Calculate proximity to the target's edges"},
9477  "FACES",
9478  ICON_NONE,
9479  "Faces",
9480  "Calculate proximity to the target's faces"},
9481  {0, NULL, 0, NULL, NULL},
9482  };
9483 
9484  PropertyRNA *prop;
9485 
9486  RNA_def_struct_sdna_from(srna, "NodeGeometryAttributeProximity", "storage");
9487 
9488  prop = RNA_def_property(srna, "target_geometry_element", PROP_ENUM, PROP_NONE);
9489  RNA_def_property_enum_items(prop, target_geometry_element);
9492  prop, "Target Geometry", "Element of the target geometry to calculate the distance from");
9493  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9494 }
9495 
9497 {
9498  PropertyRNA *prop;
9499 
9500  static EnumPropertyItem resolution_mode_items[] = {
9502  "GRID",
9503  0,
9504  "Grid",
9505  "Use resolution of the volume grid"},
9507  "VOXEL_AMOUNT",
9508  0,
9509  "Voxel Amount",
9510  "Desired number of voxels along one axis"},
9512  "VOXEL_SIZE",
9513  0,
9514  "Voxel Size",
9515  "Desired voxel side length"},
9516  {0, NULL, 0, NULL, NULL},
9517  };
9518 
9519  RNA_def_struct_sdna_from(srna, "NodeGeometryVolumeToMesh", "storage");
9520 
9521  prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE);
9522  RNA_def_property_enum_items(prop, resolution_mode_items);
9523  RNA_def_property_ui_text(prop, "Resolution Mode", "How the voxel size is specified");
9524  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9525 }
9526 
9528 {
9529  PropertyRNA *prop;
9530 
9531  RNA_def_struct_sdna_from(srna, "NodeAttributeCombineXYZ", "storage");
9532 
9533  prop = RNA_def_property(srna, "input_type_x", PROP_ENUM, PROP_NONE);
9535  RNA_def_property_ui_text(prop, "Input Type X", "");
9536  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9537 
9538  prop = RNA_def_property(srna, "input_type_y", PROP_ENUM, PROP_NONE);
9540  RNA_def_property_ui_text(prop, "Input Type Y", "");
9541  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9542 
9543  prop = RNA_def_property(srna, "input_type_z", PROP_ENUM, PROP_NONE);
9545  RNA_def_property_ui_text(prop, "Input Type Z", "");
9546  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9547 }
9548 
9550 {
9551  PropertyRNA *prop;
9552 
9553  RNA_def_struct_sdna_from(srna, "NodeAttributeSeparateXYZ", "storage");
9554 
9555  prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE);
9557  RNA_def_property_ui_text(prop, "Input Type", "");
9558  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9559 }
9560 
9561 static void def_geo_mesh_circle(StructRNA *srna)
9562 {
9563  PropertyRNA *prop;
9564 
9565  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshCircle", "storage");
9566 
9567  prop = RNA_def_property(srna, "fill_type", PROP_ENUM, PROP_NONE);
9569  RNA_def_property_ui_text(prop, "Fill Type", "");
9570  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9571 }
9572 
9574 {
9575  PropertyRNA *prop;
9576 
9577  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshCylinder", "storage");
9578 
9579  prop = RNA_def_property(srna, "fill_type", PROP_ENUM, PROP_NONE);
9581  RNA_def_property_ui_text(prop, "Fill Type", "");
9582  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9583 }
9584 
9585 static void def_geo_mesh_cone(StructRNA *srna)
9586 {
9587  PropertyRNA *prop;
9588 
9589  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshCone", "storage");
9590 
9591  prop = RNA_def_property(srna, "fill_type", PROP_ENUM, PROP_NONE);
9593  RNA_def_property_ui_text(prop, "Fill Type", "");
9594  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
9595 }
9596 
9597 static void def_geo_mesh_line(StructRNA *srna)
9598 {
9599  PropertyRNA *prop;
9600 
9601  static EnumPropertyItem mode_items[] = {
9603  "OFFSET",
9604  0,
9605  "Offset",
9606  "Specify the offset from one vertex to the next"},
9608  "END_POINTS",
9609  0,
9610  "End Points",
9611  "Specify the line's start and end points"},
9612  {0, NULL, 0, NULL, NULL},
9613  };
9614 
9615  static EnumPropertyItem count_mode_items[] = {
9617  "TOTAL",
9618  0,
9619  "Count",
9620  "Specify the total number of vertices"},
9622  "RESOLUTION",
9623  0,
9624  "Resolution",
9625  "Specify the distance between vertices"},
9626  {0, NULL, 0, NULL, NULL},
9627  };
9628 
9629  RNA_def_struct_sdna_from(srna, "NodeGeometryMeshLine", "storage");
9630 
9631  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
9633  RNA_def_property_ui_text(prop, "Mode", "");
9634  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9635 
9636  prop = RNA_def_property(srna, "count_mode", PROP_ENUM, PROP_NONE);
9637  RNA_def_property_enum_items(prop, count_mode_items);
9638  RNA_def_property_ui_text(prop, "Count Mode", "");
9639  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
9640 }
9641 
9642 /* -------------------------------------------------------------------------- */
9643 
9645 {
9646  StructRNA *srna;
9647 
9648  srna = RNA_def_struct(brna, "ShaderNode", "NodeInternal");
9649  RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node");
9650  RNA_def_struct_sdna(srna, "bNode");
9651  RNA_def_struct_register_funcs(srna, "rna_ShaderNode_register", "rna_Node_unregister", NULL);
9652 }
9653 
9655 {
9656  StructRNA *srna;
9657  FunctionRNA *func;
9658 
9659  srna = RNA_def_struct(brna, "CompositorNode", "NodeInternal");
9660  RNA_def_struct_ui_text(srna, "Compositor Node", "");
9661  RNA_def_struct_sdna(srna, "bNode");
9662  RNA_def_struct_register_funcs(srna, "rna_CompositorNode_register", "rna_Node_unregister", NULL);
9663 
9664  /* compositor node need_exec flag */
9665  func = RNA_def_function(srna, "tag_need_exec", "rna_CompositorNode_tag_need_exec");
9666  RNA_def_function_ui_description(func, "Tag the node for compositor update");
9667 
9669 }
9670 
9672 {
9673  StructRNA *srna;
9674 
9675  srna = RNA_def_struct(brna, "TextureNode", "NodeInternal");
9676  RNA_def_struct_ui_text(srna, "Texture Node", "");
9677  RNA_def_struct_sdna(srna, "bNode");
9678  RNA_def_struct_register_funcs(srna, "rna_TextureNode_register", "rna_Node_unregister", NULL);
9679 }
9680 
9682 {
9683  StructRNA *srna;
9684 
9685  srna = RNA_def_struct(brna, "GeometryNode", "NodeInternal");
9686  RNA_def_struct_ui_text(srna, "Geometry Node", "");
9687  RNA_def_struct_sdna(srna, "bNode");
9688  RNA_def_struct_register_funcs(srna, "rna_GeometryNode_register", "rna_Node_unregister", NULL);
9689 }
9690 
9692 {
9693  StructRNA *srna;
9694 
9695  srna = RNA_def_struct(brna, "FunctionNode", "NodeInternal");
9696  RNA_def_struct_ui_text(srna, "Function Node", "");
9697  RNA_def_struct_sdna(srna, "bNode");
9698  RNA_def_struct_register_funcs(srna, "rna_FunctionNode_register", "rna_Node_unregister", NULL);
9699 }
9700 
9701 /* -------------------------------------------------------------------------- */
9702 
9704 {
9705  StructRNA *srna;
9706  PropertyRNA *prop;
9707  PropertyRNA *parm;
9708  FunctionRNA *func;
9709 
9710  static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
9711 
9712  srna = RNA_def_struct(brna, "NodeSocket", NULL);
9713  RNA_def_struct_ui_text(srna, "Node Socket", "Input or output socket of a node");
9714  RNA_def_struct_sdna(srna, "bNodeSocket");
9715  RNA_def_struct_refine_func(srna, "rna_NodeSocket_refine");
9716  RNA_def_struct_ui_icon(srna, ICON_PLUGIN);
9717  RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
9719  srna, "rna_NodeSocket_register", "rna_NodeSocket_unregister", NULL);
9720  RNA_def_struct_idprops_func(srna, "rna_NodeSocket_idprops");
9721 
9722  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
9723  RNA_def_property_ui_text(prop, "Name", "Socket name");
9724  RNA_def_struct_name_property(srna, prop);
9725  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
9726 
9727  prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
9728  RNA_def_property_string_sdna(prop, NULL, "label");
9730  RNA_def_property_ui_text(prop, "Label", "Custom dynamic defined socket label");
9731 
9732  prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
9733  RNA_def_property_string_sdna(prop, NULL, "identifier");
9735  RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets");
9736 
9737  prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
9738  RNA_def_property_string_sdna(prop, NULL, "description");
9739  RNA_def_property_ui_text(prop, "Tooltip", "Socket tooltip");
9740  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
9741 
9742  prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
9743  RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL);
9745  RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input");
9746 
9747  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
9749  RNA_def_property_boolean_funcs(prop, NULL, "rna_NodeSocket_hide_set");
9750  RNA_def_property_ui_text(prop, "Hide", "Hide the socket");
9752 
9753  prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
9755  RNA_def_property_ui_text(prop, "Enabled", "Enable the socket");
9757 
9758  prop = RNA_def_property(srna, "link_limit", PROP_INT, PROP_NONE);
9759  RNA_def_property_int_sdna(prop, NULL, "limit");
9760  RNA_def_property_int_funcs(prop, NULL, "rna_NodeSocket_link_limit_set", NULL);
9761  RNA_def_property_range(prop, 1, 0xFFF);
9762  RNA_def_property_ui_text(prop, "Link Limit", "Max number of links allowed for this socket");
9764 
9765  prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE);
9768  RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected");
9769 
9770  prop = RNA_def_property(srna, "is_multi_input", PROP_BOOLEAN, PROP_NONE);
9774  prop, "Multi Input", "True if the socket can accept multiple ordered input links");
9775 
9776  prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
9779  RNA_def_property_ui_text(prop, "Expanded", "Socket links are expanded in the user interface");
9781 
9782  prop = RNA_def_property(srna, "hide_value", PROP_BOOLEAN, PROP_NONE);
9784  RNA_def_property_ui_text(prop, "Hide Value", "Hide the socket input value");
9786 
9787  prop = RNA_def_property(srna, "node", PROP_POINTER, PROP_NONE);
9788  RNA_def_property_pointer_funcs(prop, "rna_NodeSocket_node_get", NULL, NULL, NULL);
9789  RNA_def_property_struct_type(prop, "Node");
9793  RNA_def_property_ui_text(prop, "Node", "Node owning this socket");
9794 
9795  /* NB: the type property is used by standard sockets.
9796  * Ideally should be defined only for the registered subclass,
9797  * but to use the existing DNA is added in the base type here.
9798  * Future socket types can ignore or override this if needed.
9799  */
9800  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
9801  RNA_def_property_enum_sdna(prop, NULL, "type");
9804  RNA_def_property_enum_funcs(prop, NULL, "rna_NodeSocket_type_set", NULL);
9805  RNA_def_property_ui_text(prop, "Type", "Data type");
9806  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
9807 
9808  prop = RNA_def_property(srna, "display_shape", PROP_ENUM, PROP_NONE);
9809  RNA_def_property_enum_sdna(prop, NULL, "display_shape");
9812  RNA_def_property_ui_text(prop, "Shape", "Socket shape");
9813  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
9814 
9815  /* registration */
9816  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
9817  RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
9819  RNA_def_property_ui_text(prop, "ID Name", "");
9820 
9821  /* draw socket */
9822  func = RNA_def_function(srna, "draw", NULL);
9823  RNA_def_function_ui_description(func, "Draw socket");
9825  parm = RNA_def_pointer(func, "context", "Context", "", "");
9827  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
9828  RNA_def_property_struct_type(parm, "UILayout");
9829  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
9831  parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
9832  RNA_def_property_struct_type(parm, "Node");
9833  RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
9835  parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
9836  RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
9837  // RNA_def_property_string_default(parm, "");
9839 
9840  func = RNA_def_function(srna, "draw_color", NULL);
9841  RNA_def_function_ui_description(func, "Color of the socket icon");
9843  parm = RNA_def_pointer(func, "context", "Context", "", "");
9845  parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
9846  RNA_def_property_struct_type(parm, "Node");
9847  RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
9849  parm = RNA_def_float_array(
9850  func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
9851  RNA_def_function_output(func, parm);
9852 }
9853 
9855 {
9856  StructRNA *srna;
9857  PropertyRNA *prop;
9858  PropertyRNA *parm;
9859  FunctionRNA *func;
9860 
9861  static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
9862 
9863  srna = RNA_def_struct(brna, "NodeSocketInterface", NULL);
9864  RNA_def_struct_ui_text(srna, "Node Socket Template", "Parameters to define node sockets");
9865  /* XXX Using bNodeSocket DNA for templates is a compatibility hack.
9866  * This allows to keep the inputs/outputs lists in bNodeTree working for earlier versions
9867  * and at the same time use them for socket templates in groups.
9868  */
9869  RNA_def_struct_sdna(srna, "bNodeSocket");
9870  RNA_def_struct_refine_func(srna, "rna_NodeSocketInterface_refine");
9871  RNA_def_struct_path_func(srna, "rna_NodeSocketInterface_path");
9872  RNA_def_struct_idprops_func(srna, "rna_NodeSocketInterface_idprops");
9874  srna, "rna_NodeSocketInterface_register", "rna_NodeSocketInterface_unregister", NULL);
9875 
9876  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
9877  RNA_def_property_ui_text(prop, "Name", "Socket name");
9878  RNA_def_struct_name_property(srna, prop);
9879  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
9880 
9881  prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
9882  RNA_def_property_string_sdna(prop, NULL, "identifier");
9884  RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets");
9885 
9886  prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
9887  RNA_def_property_string_sdna(prop, NULL, "description");
9888  RNA_def_property_ui_text(prop, "Tooltip", "Socket tooltip");
9889  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
9890 
9891  prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
9892  RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL);
9894  RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input");
9895 
9896  prop = RNA_def_property(srna, "hide_value", PROP_BOOLEAN, PROP_NONE);
9900  prop, "Hide Value", "Hide the socket input value even when the socket is not connected");
9901  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
9902 
9903  /* registration */
9904  prop = RNA_def_property(srna, "bl_socket_idname", PROP_STRING, PROP_NONE);
9905  RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
9907  RNA_def_property_ui_text(prop, "ID Name", "");
9908 
9909  func = RNA_def_function(srna, "draw", NULL);
9910  RNA_def_function_ui_description(func, "Draw template settings");
9912  parm = RNA_def_pointer(func, "context", "Context", "", "");
9914  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
9915  RNA_def_property_struct_type(parm, "UILayout");
9916  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
9918 
9919  func = RNA_def_function(srna, "draw_color", NULL);
9920  RNA_def_function_ui_description(func, "Color of the socket icon");
9922  parm = RNA_def_pointer(func, "context", "Context", "", "");
9924  parm = RNA_def_float_array(
9925  func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
9926  RNA_def_function_output(func, parm);
9927 
9928  func = RNA_def_function(srna, "register_properties", NULL);
9929  RNA_def_function_ui_description(func, "Define RNA properties of a socket");
9931  parm = RNA_def_pointer(
9932  func, "data_rna_type", "Struct", "Data RNA Type", "RNA type for special socket properties");
9934 
9935  func = RNA_def_function(srna, "init_socket", NULL);
9936  RNA_def_function_ui_description(func, "Initialize a node socket instance");
9938  parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the socket to initialize");
9940  parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Socket to initialize");
9942  parm = RNA_def_string(
9943  func, "data_path", NULL, 0, "Data Path", "Path to specialized socket data");
9945 
9946  func = RNA_def_function(srna, "from_socket", NULL);
9947  RNA_def_function_ui_description(func, "Setup template parameters from an existing socket");
9949  parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the original socket");
9951  parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Original socket");
9953 }
9954 
9956  const char *idname,
9957  const char *interface_idname,
9958  PropertySubType subtype)
9959 {
9960  StructRNA *srna;
9961  PropertyRNA *prop;
9962  float value_default;
9963 
9964  /* choose sensible common default based on subtype */
9965  switch (subtype) {
9966  case PROP_FACTOR:
9967  value_default = 1.0f;
9968  break;
9969  case PROP_PERCENTAGE:
9970  value_default = 100.0f;
9971  break;
9972  default:
9973  value_default = 0.0f;
9974  break;
9975  }
9976 
9977  srna = RNA_def_struct(brna, idname, "NodeSocketStandard");
9978  RNA_def_struct_ui_text(srna, "Float Node Socket", "Floating-point number socket of a node");
9979  RNA_def_struct_sdna(srna, "bNodeSocket");
9980 
9981  RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "default_value");
9982 
9983  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
9984  RNA_def_property_float_sdna(prop, NULL, "value");
9985  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_float_range");
9986  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
9987  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
9989 
9990  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
9991 
9992  /* socket interface */
9993  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
9995  srna, "Float Node Socket Interface", "Floating-point number socket of a node");
9996  RNA_def_struct_sdna(srna, "bNodeSocket");
9997 
9998  RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "default_value");
9999 
10000  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
10001  RNA_def_property_float_sdna(prop, NULL, "value");
10002  RNA_def_property_float_default(prop, value_default);
10004  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_float_range");
10005  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10006  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10007 
10008  prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
10009  RNA_def_property_float_sdna(prop, NULL, "min");
10011  RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
10012  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10013 
10014  prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
10015  RNA_def_property_float_sdna(prop, NULL, "max");
10017  RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
10018  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10019 
10020  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10021 }
10022 
10024  const char *identifier,
10025  const char *interface_idname,
10026  PropertySubType subtype)
10027 {
10028  StructRNA *srna;
10029  PropertyRNA *prop;
10030  int value_default;
10031 
10032  /* choose sensible common default based on subtype */
10033  switch (subtype) {
10034  case PROP_FACTOR:
10035  value_default = 1;
10036  break;
10037  case PROP_PERCENTAGE:
10038  value_default = 100;
10039  break;
10040  default:
10041  value_default = 0;
10042  break;
10043  }
10044 
10045  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10046  RNA_def_struct_ui_text(srna, "Integer Node Socket", "Integer number socket of a node");
10047  RNA_def_struct_sdna(srna, "bNodeSocket");
10048 
10049  RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "default_value");
10050 
10051  prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
10052  RNA_def_property_int_sdna(prop, NULL, "value");
10053  RNA_def_property_int_default(prop, value_default);
10054  RNA_def_property_int_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_int_range");
10055  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10056  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
10058 
10059  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10060 
10061  /* socket interface */
10062  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10063  RNA_def_struct_ui_text(srna, "Integer Node Socket Interface", "Integer number socket of a node");
10064  RNA_def_struct_sdna(srna, "bNodeSocket");
10065 
10066  RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "default_value");
10067 
10068  prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
10069  RNA_def_property_int_sdna(prop, NULL, "value");
10071  RNA_def_property_int_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_int_range");
10072  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10073  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10074 
10075  prop = RNA_def_property(srna, "min_value", PROP_INT, PROP_NONE);
10076  RNA_def_property_int_sdna(prop, NULL, "min");
10078  RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
10079  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10080 
10081  prop = RNA_def_property(srna, "max_value", PROP_INT, PROP_NONE);
10082  RNA_def_property_int_sdna(prop, NULL, "max");
10084  RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
10085  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10086 
10087  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10088 }
10089 
10091  const char *identifier,
10092  const char *interface_idname)
10093 {
10094  StructRNA *srna;
10095  PropertyRNA *prop;
10096 
10097  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10098  RNA_def_struct_ui_text(srna, "Boolean Node Socket", "Boolean value socket of a node");
10099  RNA_def_struct_sdna(srna, "bNodeSocket");
10100 
10101  RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "default_value");
10102 
10103  prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
10104  RNA_def_property_boolean_sdna(prop, NULL, "value", 1);
10105  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10106  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
10108 
10109  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10110 
10111  /* socket interface */
10112  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10113  RNA_def_struct_ui_text(srna, "Boolean Node Socket Interface", "Boolean value socket of a node");
10114  RNA_def_struct_sdna(srna, "bNodeSocket");
10115 
10116  RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "default_value");
10117 
10118  prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
10119  RNA_def_property_boolean_sdna(prop, NULL, "value", 1);
10121  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10122  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10123 
10124  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10125 }
10126 
10128  const char *identifier,
10129  const char *interface_idname,
10130  PropertySubType subtype)
10131 {
10132  StructRNA *srna;
10133  PropertyRNA *prop;
10134  const float *value_default;
10135 
10136  /* choose sensible common default based on subtype */
10137  switch (subtype) {
10138  case PROP_DIRECTION: {
10139  static const float default_direction[3] = {0.0f, 0.0f, 1.0f};
10140  value_default = default_direction;
10141  break;
10142  }
10143  default: {
10144  static const float default_vector[3] = {0.0f, 0.0f, 0.0f};
10145  value_default = default_vector;
10146  break;
10147  }
10148  }
10149 
10150  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10151  RNA_def_struct_ui_text(srna, "Vector Node Socket", "3D vector socket of a node");
10152  RNA_def_struct_sdna(srna, "bNodeSocket");
10153 
10154  RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "default_value");
10155 
10156  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
10157  RNA_def_property_float_sdna(prop, NULL, "value");
10158  RNA_def_property_float_array_default(prop, value_default);
10159  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_vector_range");
10160  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10161  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
10163 
10164  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10165 
10166  /* socket interface */
10167  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10168  RNA_def_struct_ui_text(srna, "Vector Node Socket Interface", "3D vector socket of a node");
10169  RNA_def_struct_sdna(srna, "bNodeSocket");
10170 
10171  RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "default_value");
10172 
10173  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
10174  RNA_def_property_float_sdna(prop, NULL, "value");
10176  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_vector_range");
10177  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10178  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10179 
10180  prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
10181  RNA_def_property_float_sdna(prop, NULL, "min");
10183  RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
10184  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10185 
10186  prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
10187  RNA_def_property_float_sdna(prop, NULL, "max");
10189  RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
10190  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10191 
10192  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10193 }
10194 
10196  const char *identifier,
10197  const char *interface_idname)
10198 {
10199  StructRNA *srna;
10200  PropertyRNA *prop;
10201 
10202  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10203  RNA_def_struct_ui_text(srna, "Color Node Socket", "RGBA color socket of a node");
10204  RNA_def_struct_sdna(srna, "bNodeSocket");
10205 
10206  RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "default_value");
10207 
10208  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
10209  RNA_def_property_float_sdna(prop, NULL, "value");
10210  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10211  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
10213 
10214  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10215 
10216  /* socket interface */
10217  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10218  RNA_def_struct_ui_text(srna, "Color Node Socket Interface", "RGBA color socket of a node");
10219  RNA_def_struct_sdna(srna, "bNodeSocket");
10220 
10221  RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "default_value");
10222 
10223  prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
10224  RNA_def_property_float_sdna(prop, NULL, "value");
10226  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10227  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10228 
10229  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10230 }
10231 
10233  const char *identifier,
10234  const char *interface_idname)
10235 {
10236  StructRNA *srna;
10237  PropertyRNA *prop;
10238 
10239  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10240  RNA_def_struct_ui_text(srna, "String Node Socket", "String socket of a node");
10241  RNA_def_struct_sdna(srna, "bNodeSocket");
10242 
10243  RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
10244 
10245  prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
10246  RNA_def_property_string_sdna(prop, NULL, "value");
10247  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10248  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
10250 
10251  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10252 
10253  /* socket interface */
10254  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10255  RNA_def_struct_ui_text(srna, "String Node Socket Interface", "String socket of a node");
10256  RNA_def_struct_sdna(srna, "bNodeSocket");
10257 
10258  RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
10259 
10260  prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
10261  RNA_def_property_string_sdna(prop, NULL, "value");
10263  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10264  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10265 
10266  RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
10267 }
10268 
10270  const char *identifier,
10271  const char *interface_idname)
10272 {
10273  StructRNA *srna;
10274 
10275  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10276  RNA_def_struct_ui_text(srna, "Shader Node Socket", "Shader socket of a node");
10277  RNA_def_struct_sdna(srna, "bNodeSocket");
10278 
10279  /* socket interface */
10280  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10281  RNA_def_struct_ui_text(srna, "Shader Node Socket Interface", "Shader socket of a node");
10282  RNA_def_struct_sdna(srna, "bNodeSocket");
10283 }
10284 
10285 static void rna_def_node_socket_virtual(BlenderRNA *brna, const char *identifier)
10286 {
10287  StructRNA *srna;
10288 
10289  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10290  RNA_def_struct_ui_text(srna, "Virtual Node Socket", "Virtual socket of a node");
10291  RNA_def_struct_sdna(srna, "bNodeSocket");
10292 }
10293 
10295  const char *identifier,
10296  const char *interface_idname)
10297 {
10298  StructRNA *srna;
10299  PropertyRNA *prop;
10300 
10301  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10302  RNA_def_struct_ui_text(srna, "Object Node Socket", "Object socket of a node");
10303  RNA_def_struct_sdna(srna, "bNodeSocket");
10304 
10305  RNA_def_struct_sdna_from(srna, "bNodeSocketValueObject", "default_value");
10306 
10307  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
10308  RNA_def_property_pointer_sdna(prop, NULL, "value");
10309  RNA_def_property_struct_type(prop, "Object");
10310  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10312  prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update");
10314 
10315  /* socket interface */
10316  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10317  RNA_def_struct_ui_text(srna, "Object Node Socket Interface", "Object socket of a node");
10318  RNA_def_struct_sdna(srna, "bNodeSocket");
10319 
10320  RNA_def_struct_sdna_from(srna, "bNodeSocketValueObject", "default_value");
10321 
10322  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
10323  RNA_def_property_pointer_sdna(prop, NULL, "value");
10324  RNA_def_property_struct_type(prop, "Object");
10325  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10326  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10327 }
10328 
10330  const char *identifier,
10331  const char *interface_idname)
10332 {
10333  StructRNA *srna;
10334  PropertyRNA *prop;
10335 
10336  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10337  RNA_def_struct_ui_text(srna, "Image Node Socket", "Image socket of a node");
10338  RNA_def_struct_sdna(srna, "bNodeSocket");
10339 
10340  RNA_def_struct_sdna_from(srna, "bNodeSocketValueImage", "default_value");
10341 
10342  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
10343  RNA_def_property_pointer_sdna(prop, NULL, "value");
10344  RNA_def_property_struct_type(prop, "Image");
10345  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10347  prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update");
10349 
10350  /* socket interface */
10351  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10352  RNA_def_struct_ui_text(srna, "Image Node Socket Interface", "Image socket of a node");
10353  RNA_def_struct_sdna(srna, "bNodeSocket");
10354 
10355  RNA_def_struct_sdna_from(srna, "bNodeSocketValueImage", "default_value");
10356 
10357  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
10358  RNA_def_property_pointer_sdna(prop, NULL, "value");
10359  RNA_def_property_struct_type(prop, "Image");
10360  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10361  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10362 }
10363 
10365  const char *identifier,
10366  const char *interface_idname)
10367 {
10368  StructRNA *srna;
10369 
10370  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10371  RNA_def_struct_ui_text(srna, "Geometry Node Socket", "Geometry socket of a node");
10372  RNA_def_struct_sdna(srna, "bNodeSocket");
10373 
10374  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10375  RNA_def_struct_ui_text(srna, "Geometry Node Socket Interface", "Geometry socket of a node");
10376  RNA_def_struct_sdna(srna, "bNodeSocket");
10377 }
10378 
10380  const char *identifier,
10381  const char *interface_idname)
10382 {
10383  StructRNA *srna;
10384  PropertyRNA *prop;
10385 
10386  srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
10387  RNA_def_struct_ui_text(srna, "Collection Node Socket", "Collection socket of a node");
10388  RNA_def_struct_sdna(srna, "bNodeSocket");
10389 
10390  RNA_def_struct_sdna_from(srna, "bNodeSocketValueCollection", "default_value");
10391 
10392  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
10393  RNA_def_property_pointer_sdna(prop, NULL, "value");
10394  RNA_def_property_struct_type(prop, "Collection");
10395  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10397  prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update");
10399 
10400  /* socket interface */
10401  srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
10402  RNA_def_struct_ui_text(srna, "Collection Node Socket Interface", "Collection socket of a node");
10403  RNA_def_struct_sdna(srna, "bNodeSocket");
10404 
10405  RNA_def_struct_sdna_from(srna, "bNodeSocketValueCollection", "default_value");
10406 
10407  prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
10408  RNA_def_property_pointer_sdna(prop, NULL, "value");
10409  RNA_def_property_struct_type(prop, "Collection");
10410  RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
10411  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
10412 }
10413 
10415 {
10416  /* XXX Workaround: Registered functions are not exposed in python by bpy,
10417  * it expects them to be registered from python and use the native implementation.
10418  * However, the standard socket types below are not registering these functions from python,
10419  * so in order to call them in py scripts we need to overload and
10420  * replace them with plain C callbacks.
10421  * These types provide a usable basis for socket types defined in C.
10422  */
10423 
10424  StructRNA *srna;
10425  PropertyRNA *parm, *prop;
10426  FunctionRNA *func;
10427 
10428  static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
10429 
10430  srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket");
10431  RNA_def_struct_sdna(srna, "bNodeSocket");
10432 
10433  /* draw socket */
10434  func = RNA_def_function(srna, "draw", "rna_NodeSocketStandard_draw");
10436  RNA_def_function_ui_description(func, "Draw socket");
10437  parm = RNA_def_pointer(func, "context", "Context", "", "");
10439  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10440  RNA_def_property_struct_type(parm, "UILayout");
10441  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10443  parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
10444  RNA_def_property_struct_type(parm, "Node");
10445  RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
10447  parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
10448  RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
10449  // RNA_def_property_string_default(parm, "");
10451 
10452  func = RNA_def_function(srna, "draw_color", "rna_NodeSocketStandard_draw_color");
10454  RNA_def_function_ui_description(func, "Color of the socket icon");
10455  parm = RNA_def_pointer(func, "context", "Context", "", "");
10457  parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
10458  RNA_def_property_struct_type(parm, "Node");
10459  RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
10461  parm = RNA_def_float_array(
10462  func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
10463  RNA_def_function_output(func, parm);
10464 
10465  srna = RNA_def_struct(brna, "NodeSocketInterfaceStandard", "NodeSocketInterface");
10466  RNA_def_struct_sdna(srna, "bNodeSocket");
10467 
10468  /* for easier type comparison in python */
10469  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
10470  RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type");
10474  RNA_def_property_ui_text(prop, "Type", "Data type");
10475 
10476  func = RNA_def_function(srna, "draw", "rna_NodeSocketInterfaceStandard_draw");
10478  RNA_def_function_ui_description(func, "Draw template settings");
10479  parm = RNA_def_pointer(func, "context", "Context", "", "");
10481  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10482  RNA_def_property_struct_type(parm, "UILayout");
10483  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10485 
10486  func = RNA_def_function(srna, "draw_color", "rna_NodeSocketInterfaceStandard_draw_color");
10488  RNA_def_function_ui_description(func, "Color of the socket icon");
10489  parm = RNA_def_pointer(func, "context", "Context", "", "");
10491  parm = RNA_def_float_array(
10492  func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
10493  RNA_def_function_output(func, parm);
10494 
10495  /* XXX These types should eventually be registered at runtime.
10496  * Then use the nodeStaticSocketType and nodeStaticSocketInterfaceType functions
10497  * to get the idname strings from int type and subtype
10498  * (see node_socket.cc, register_standard_node_socket_types).
10499  */
10500 
10501  rna_def_node_socket_float(brna, "NodeSocketFloat", "NodeSocketInterfaceFloat", PROP_NONE);
10503  brna, "NodeSocketFloatUnsigned", "NodeSocketInterfaceFloatUnsigned", PROP_UNSIGNED);
10505  brna, "NodeSocketFloatPercentage", "NodeSocketInterfaceFloatPercentage", PROP_PERCENTAGE);
10507  brna, "NodeSocketFloatFactor", "NodeSocketInterfaceFloatFactor", PROP_FACTOR);
10509  brna, "NodeSocketFloatAngle", "NodeSocketInterfaceFloatAngle", PROP_ANGLE);
10511  brna, "NodeSocketFloatTime", "NodeSocketInterfaceFloatTime", PROP_TIME);
10513  brna, "NodeSocketFloatDistance", "NodeSocketInterfaceFloatDistance", PROP_DISTANCE);
10514 
10515  rna_def_node_socket_int(brna, "NodeSocketInt", "NodeSocketInterfaceInt", PROP_NONE);
10517  brna, "NodeSocketIntUnsigned", "NodeSocketInterfaceIntUnsigned", PROP_UNSIGNED);
10519  brna, "NodeSocketIntPercentage", "NodeSocketInterfaceIntPercentage", PROP_PERCENTAGE);
10521  brna, "NodeSocketIntFactor", "NodeSocketInterfaceIntFactor", PROP_FACTOR);
10522 
10523  rna_def_node_socket_bool(brna, "NodeSocketBool", "NodeSocketInterfaceBool");
10524 
10525  rna_def_node_socket_vector(brna, "NodeSocketVector", "NodeSocketInterfaceVector", PROP_NONE);
10527  "NodeSocketVectorTranslation",
10528  "NodeSocketInterfaceVectorTranslation",
10531  brna, "NodeSocketVectorDirection", "NodeSocketInterfaceVectorDirection", PROP_DIRECTION);
10533  brna, "NodeSocketVectorVelocity", "NodeSocketInterfaceVectorVelocity", PROP_VELOCITY);
10535  "NodeSocketVectorAcceleration",
10536  "NodeSocketInterfaceVectorAcceleration",
10539  brna, "NodeSocketVectorEuler", "NodeSocketInterfaceVectorEuler", PROP_EULER);
10541  brna, "NodeSocketVectorXYZ", "NodeSocketInterfaceVectorXYZ", PROP_XYZ);
10542 
10543  rna_def_node_socket_color(brna, "NodeSocketColor", "NodeSocketInterfaceColor");
10544 
10545  rna_def_node_socket_string(brna, "NodeSocketString", "NodeSocketInterfaceString");
10546 
10547  rna_def_node_socket_shader(brna, "NodeSocketShader", "NodeSocketInterfaceShader");
10548 
10549  rna_def_node_socket_virtual(brna, "NodeSocketVirtual");
10550 
10551  rna_def_node_socket_object(brna, "NodeSocketObject", "NodeSocketInterfaceObject");
10552 
10553  rna_def_node_socket_image(brna, "NodeSocketImage", "NodeSocketInterfaceImage");
10554 
10555  rna_def_node_socket_geometry(brna, "NodeSocketGeometry", "NodeSocketInterfaceGeometry");
10556 
10557  rna_def_node_socket_collection(brna, "NodeSocketCollection", "NodeSocketInterfaceCollection");
10558 }
10559 
10561 {
10562  StructRNA *srna;
10563  PropertyRNA *prop, *parm;
10564  FunctionRNA *func;
10565 
10566  srna = RNA_def_struct(brna, "NodeInternalSocketTemplate", NULL);
10567  RNA_def_struct_ui_text(srna, "Socket Template", "Type and default value of a node socket");
10568 
10569  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
10571  "rna_NodeInternalSocketTemplate_name_get",
10572  "rna_NodeInternalSocketTemplate_name_length",
10573  NULL);
10574  RNA_def_property_ui_text(prop, "Name", "Name of the socket");
10576 
10577  prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
10579  "rna_NodeInternalSocketTemplate_identifier_get",
10580  "rna_NodeInternalSocketTemplate_identifier_length",
10581  NULL);
10582  RNA_def_property_ui_text(prop, "Identifier", "Identifier of the socket");
10584 
10585  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
10586  RNA_def_property_enum_funcs(prop, "rna_NodeInternalSocketTemplate_type_get", NULL, NULL);
10588  RNA_def_property_ui_text(prop, "Type", "Data type of the socket");
10590 
10591  /* XXX Workaround: Registered functions are not exposed in python by bpy,
10592  * it expects them to be registered from python and use the native implementation.
10593  *
10594  * However, the standard node types are not registering these functions from python,
10595  * so in order to call them in py scripts we need to overload and
10596  * replace them with plain C callbacks.
10597  * This type provides a usable basis for node types defined in C.
10598  */
10599 
10600  srna = RNA_def_struct(brna, "NodeInternal", "Node");
10601  RNA_def_struct_sdna(srna, "bNode");
10602 
10603  /* poll */
10604  func = RNA_def_function(srna, "poll", "rna_NodeInternal_poll");
10606  func, "If non-null output is returned, the node type can be added to the tree");
10608  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
10609  parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
10611 
10612  func = RNA_def_function(srna, "poll_instance", "rna_NodeInternal_poll_instance");
10614  func, "If non-null output is returned, the node can be added to the tree");
10615  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
10616  parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
10618 
10619  /* update */
10620  func = RNA_def_function(srna, "update", "rna_NodeInternal_update");
10622  func, "Update on node graph topology changes (adding or removing nodes and links)");
10624 
10625  /* draw buttons */
10626  func = RNA_def_function(srna, "draw_buttons", "rna_NodeInternal_draw_buttons");
10627  RNA_def_function_ui_description(func, "Draw node buttons");
10629  parm = RNA_def_pointer(func, "context", "Context", "", "");
10631  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10632  RNA_def_property_struct_type(parm, "UILayout");
10633  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10635 
10636  /* draw buttons extended */
10637  func = RNA_def_function(srna, "draw_buttons_ext", "rna_NodeInternal_draw_buttons_ext");
10638  RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
10640  parm = RNA_def_pointer(func, "context", "Context", "", "");
10642  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10643  RNA_def_property_struct_type(parm, "UILayout");
10644  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10646 }
10647 
10648 static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
10649 {
10650  StructRNA *srna;
10651  PropertyRNA *parm;
10652  FunctionRNA *func;
10653  const char *structtype = (in_out == SOCK_IN ? "NodeInputs" : "NodeOutputs");
10654  const char *uiname = (in_out == SOCK_IN ? "Node Inputs" : "Node Outputs");
10655  const char *newfunc = (in_out == SOCK_IN ? "rna_Node_inputs_new" : "rna_Node_outputs_new");
10656  const char *clearfunc = (in_out == SOCK_IN ? "rna_Node_inputs_clear" : "rna_Node_outputs_clear");
10657  const char *movefunc = (in_out == SOCK_IN ? "rna_Node_inputs_move" : "rna_Node_outputs_move");
10658 
10659  RNA_def_property_srna(cprop, structtype);
10660  srna = RNA_def_struct(brna, structtype, NULL);
10661  RNA_def_struct_sdna(srna, "bNode");
10662  RNA_def_struct_ui_text(srna, uiname, "Collection of Node Sockets");
10663 
10664  func = RNA_def_function(srna, "new", newfunc);
10665  RNA_def_function_ui_description(func, "Add a socket to this node");
10667  parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
10669  parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
10671  RNA_def_string(func, "identifier", NULL, MAX_NAME, "Identifier", "Unique socket identifier");
10672  /* return value */
10673  parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
10674  RNA_def_function_return(func, parm);
10675 
10676  func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
10677  RNA_def_function_ui_description(func, "Remove a socket from this node");
10679  parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
10681 
10682  func = RNA_def_function(srna, "clear", clearfunc);
10683  RNA_def_function_ui_description(func, "Remove all sockets from this node");
10685 
10686  func = RNA_def_function(srna, "move", movefunc);
10687  RNA_def_function_ui_description(func, "Move a socket to another position");
10689  parm = RNA_def_int(
10690  func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
10692  parm = RNA_def_int(
10693  func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
10695 }
10696 
10697 static void rna_def_node(BlenderRNA *brna)
10698 {
10699  StructRNA *srna;
10700  PropertyRNA *prop;
10701  FunctionRNA *func;
10702  PropertyRNA *parm;
10703 
10704  static const EnumPropertyItem dummy_static_type_items[] = {
10705  {NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"},
10706  {0, NULL, 0, NULL, NULL},
10707  };
10708 
10709  srna = RNA_def_struct(brna, "Node", NULL);
10710  RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
10711  RNA_def_struct_sdna(srna, "bNode");
10712  RNA_def_struct_ui_icon(srna, ICON_NODE);
10713  RNA_def_struct_refine_func(srna, "rna_Node_refine");
10714  RNA_def_struct_path_func(srna, "rna_Node_path");
10715  RNA_def_struct_register_funcs(srna, "rna_Node_register", "rna_Node_unregister", NULL);
10716  RNA_def_struct_idprops_func(srna, "rna_Node_idprops");
10717 
10718  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
10719  RNA_def_property_enum_sdna(prop, NULL, "type");
10720  RNA_def_property_enum_items(prop, dummy_static_type_items);
10721  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_node_static_type_itemf");
10725  prop,
10726  "Type",
10727  "Node type (deprecated, use bl_static_type or bl_idname for the actual identifier string)");
10728 
10729  prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
10730  RNA_def_property_float_sdna(prop, NULL, "locx");
10731  RNA_def_property_array(prop, 2);
10732  RNA_def_property_range(prop, -100000.0f, 100000.0f);
10733  RNA_def_property_ui_text(prop, "Location", "");
10734  RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
10735 
10736  prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_XYZ);
10737  RNA_def_property_float_sdna(prop, NULL, "width");
10738  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
10739  RNA_def_property_ui_text(prop, "Width", "Width of the node");
10741 
10742  prop = RNA_def_property(srna, "width_hidden", PROP_FLOAT, PROP_XYZ);
10743  RNA_def_property_float_sdna(prop, NULL, "miniwidth");
10744  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
10745  RNA_def_property_ui_text(prop, "Width Hidden", "Width of the node in hidden state");
10747 
10748  prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_XYZ);
10749  RNA_def_property_float_sdna(prop, NULL, "height");
10750  RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_height_range");
10751  RNA_def_property_ui_text(prop, "Height", "Height of the node");
10753 
10754  prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
10755  RNA_def_property_array(prop, 2);
10756  RNA_def_property_float_funcs(prop, "rna_Node_dimensions_get", NULL, NULL);
10757  RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the node");
10759 
10760  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
10761  RNA_def_property_ui_text(prop, "Name", "Unique node identifier");
10762  RNA_def_struct_name_property(srna, prop);
10763  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set");
10764  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
10765 
10766  prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
10767  RNA_def_property_string_sdna(prop, NULL, "label");
10768  RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
10770 
10771  prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
10772  RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
10773  RNA_def_property_struct_type(prop, "NodeSocket");
10774  RNA_def_property_ui_text(prop, "Inputs", "");
10775  rna_def_node_sockets_api(brna, prop, SOCK_IN);
10776 
10777  prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
10778  RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
10779  RNA_def_property_struct_type(prop, "NodeSocket");
10780  RNA_def_property_ui_text(prop, "Outputs", "");
10781  rna_def_node_sockets_api(brna, prop, SOCK_OUT);
10782 
10783  prop = RNA_def_property(srna, "internal_links", PROP_COLLECTION, PROP_NONE);
10784  RNA_def_property_collection_sdna(prop, NULL, "internal_links", NULL);
10785  RNA_def_property_struct_type(prop, "NodeLink");
10787  prop, "Internal Links", "Internal input-to-output connections for muting");
10788 
10789  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
10790  RNA_def_property_pointer_sdna(prop, NULL, "parent");
10791  RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_parent_set", NULL, "rna_Node_parent_poll");
10795  RNA_def_property_struct_type(prop, "Node");
10796  RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to");
10797 
10798  prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
10801  RNA_def_property_ui_text(prop, "Custom Color", "Use custom color for the node");
10803 
10804  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
10805  RNA_def_property_array(prop, 3);
10806  RNA_def_property_range(prop, 0.0f, 1.0f);
10807  RNA_def_property_ui_text(prop, "Color", "Custom color of the node body");
10809 
10810  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
10811  RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
10812  RNA_def_property_boolean_funcs(prop, NULL, "rna_Node_select_set");
10813  RNA_def_property_ui_text(prop, "Select", "Node selection state");
10815 
10816  prop = RNA_def_property(srna, "show_options", PROP_BOOLEAN, PROP_NONE);
10818  RNA_def_property_ui_text(prop, "Show Options", "");
10820 
10821  prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
10823  RNA_def_property_ui_text(prop, "Show Preview", "");
10825 
10826  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
10828  RNA_def_property_ui_text(prop, "Hide", "");
10830 
10831  prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
10833  RNA_def_property_ui_text(prop, "Mute", "");
10834  RNA_def_property_update(prop, 0, "rna_Node_update");
10835 
10836  prop = RNA_def_property(srna, "show_texture", PROP_BOOLEAN, PROP_NONE);
10838  RNA_def_property_ui_text(prop, "Show Texture", "Display node in viewport textured shading mode");
10839  RNA_def_property_update(prop, 0, "rna_Node_update");
10840 
10841  prop = RNA_def_property(srna, "active_preview", PROP_BOOLEAN, PROP_NONE);
10843  RNA_def_property_ui_text(prop, "Active Preview", "Node is previewed in other editor");
10846 
10847  /* generic property update function */
10848  func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update");
10849  RNA_def_function_ui_description(func, "Update after property changes");
10851  parm = RNA_def_pointer(func, "context", "Context", "", "");
10853 
10854  func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
10855  RNA_def_function_ui_description(func, "True if a registered node type");
10857  parm = RNA_def_boolean(func, "result", false, "Result", "");
10858  RNA_def_function_return(func, parm);
10859 
10860  /* registration */
10861  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
10862  RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
10864  RNA_def_property_ui_text(prop, "ID Name", "");
10865 
10866  prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
10867  RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name");
10869  RNA_def_property_ui_text(prop, "Label", "The node label");
10870 
10871  prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
10872  RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_description");
10874 
10875  prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
10876  RNA_def_property_enum_sdna(prop, NULL, "typeinfo->ui_icon");
10878  RNA_def_property_enum_default(prop, ICON_NODE);
10880  RNA_def_property_ui_text(prop, "Icon", "The node icon");
10881 
10882  prop = RNA_def_property(srna, "bl_static_type", PROP_ENUM, PROP_NONE);
10883  RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type");
10884  RNA_def_property_enum_items(prop, dummy_static_type_items);
10885  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_node_static_type_itemf");
10888  RNA_def_property_ui_text(prop, "Static Type", "Node type (deprecated, use with care)");
10889 
10890  /* type-based size properties */
10891  prop = RNA_def_property(srna, "bl_width_default", PROP_FLOAT, PROP_UNSIGNED);
10892  RNA_def_property_float_sdna(prop, NULL, "typeinfo->width");
10894 
10895  prop = RNA_def_property(srna, "bl_width_min", PROP_FLOAT, PROP_UNSIGNED);
10896  RNA_def_property_float_sdna(prop, NULL, "typeinfo->minwidth");
10898 
10899  prop = RNA_def_property(srna, "bl_width_max", PROP_FLOAT, PROP_UNSIGNED);
10900  RNA_def_property_float_sdna(prop, NULL, "typeinfo->maxwidth");
10902 
10903  prop = RNA_def_property(srna, "bl_height_default", PROP_FLOAT, PROP_UNSIGNED);
10904  RNA_def_property_float_sdna(prop, NULL, "typeinfo->height");
10906 
10907  prop = RNA_def_property(srna, "bl_height_min", PROP_FLOAT, PROP_UNSIGNED);
10908  RNA_def_property_float_sdna(prop, NULL, "typeinfo->minheight");
10910 
10911  prop = RNA_def_property(srna, "bl_height_max", PROP_FLOAT, PROP_UNSIGNED);
10912  RNA_def_property_float_sdna(prop, NULL, "typeinfo->minheight");
10914 
10915  /* poll */
10916  func = RNA_def_function(srna, "poll", NULL);
10918  func, "If non-null output is returned, the node type can be added to the tree");
10920  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
10921  parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
10923 
10924  func = RNA_def_function(srna, "poll_instance", NULL);
10926  func, "If non-null output is returned, the node can be added to the tree");
10928  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
10929  parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
10931 
10932  /* update */
10933  func = RNA_def_function(srna, "update", NULL);
10935  func, "Update on node graph topology changes (adding or removing nodes and links)");
10937 
10938  /* insert_link */
10939  func = RNA_def_function(srna, "insert_link", NULL);
10940  RNA_def_function_ui_description(func, "Handle creation of a link to or from the node");
10942  parm = RNA_def_pointer(func, "link", "NodeLink", "Link", "Node link that will be inserted");
10944 
10945  /* init */
10946  func = RNA_def_function(srna, "init", NULL);
10947  RNA_def_function_ui_description(func, "Initialize a new instance of this node");
10949  parm = RNA_def_pointer(func, "context", "Context", "", "");
10951 
10952  /* copy */
10953  func = RNA_def_function(srna, "copy", NULL);
10955  "Initialize a new instance of this node from an existing node");
10957  parm = RNA_def_pointer(func, "node", "Node", "Node", "Existing node to copy");
10959 
10960  /* free */
10961  func = RNA_def_function(srna, "free", NULL);
10962  RNA_def_function_ui_description(func, "Clean up node on removal");
10964 
10965  /* draw buttons */
10966  func = RNA_def_function(srna, "draw_buttons", NULL);
10967  RNA_def_function_ui_description(func, "Draw node buttons");
10969  parm = RNA_def_pointer(func, "context", "Context", "", "");
10971  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10972  RNA_def_property_struct_type(parm, "UILayout");
10973  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10975 
10976  /* draw buttons extended */
10977  func = RNA_def_function(srna, "draw_buttons_ext", NULL);
10978  RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
10980  parm = RNA_def_pointer(func, "context", "Context", "", "");
10982  parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
10983  RNA_def_property_struct_type(parm, "UILayout");
10984  RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
10986 
10987  /* dynamic label */
10988  func = RNA_def_function(srna, "draw_label", NULL);
10989  RNA_def_function_ui_description(func, "Returns a dynamic label string");
10991  parm = RNA_def_string(func, "label", NULL, MAX_NAME, "Label", "");
10992  RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
10993  RNA_def_function_output(func, parm);
10994 }
10995 
10996 static void rna_def_node_link(BlenderRNA *brna)
10997 {
10998  StructRNA *srna;
10999  PropertyRNA *prop;
11000 
11001  srna = RNA_def_struct(brna, "NodeLink", NULL);
11002  RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree");
11003  RNA_def_struct_sdna(srna, "bNodeLink");
11004  RNA_def_struct_ui_icon(srna, ICON_NODE);
11005 
11006  prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
11008  RNA_def_struct_ui_text(srna, "Valid", "Link is valid");
11010 
11011  prop = RNA_def_property(srna, "is_muted", PROP_BOOLEAN, PROP_NONE);
11013  RNA_def_struct_ui_text(srna, "Muted", "Link is muted and can be ignored");
11015 
11016  prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE);
11017  RNA_def_property_pointer_sdna(prop, NULL, "fromnode");
11018  RNA_def_property_struct_type(prop, "Node");
11022  RNA_def_property_ui_text(prop, "From node", "");
11023 
11024  prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE);
11025  RNA_def_property_pointer_sdna(prop, NULL, "tonode");
11026  RNA_def_property_struct_type(prop, "Node");
11030  RNA_def_property_ui_text(prop, "To node", "");
11031 
11032  prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE);
11033  RNA_def_property_pointer_sdna(prop, NULL, "fromsock");
11034  RNA_def_property_struct_type(prop, "NodeSocket");
11038  RNA_def_property_ui_text(prop, "From socket", "");
11039 
11040  prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE);
11041  RNA_def_property_pointer_sdna(prop, NULL, "tosock");
11042  RNA_def_property_struct_type(prop, "NodeSocket");
11046  RNA_def_property_ui_text(prop, "To socket", "");
11047 
11048  prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
11049  RNA_def_property_boolean_funcs(prop, "rna_NodeLink_is_hidden_get", NULL);
11053  RNA_def_property_ui_text(prop, "Is Hidden", "Link is hidden due to invisible sockets");
11054 }
11055 
11057 {
11058  StructRNA *srna;
11059  PropertyRNA *parm, *prop;
11060  FunctionRNA *func;
11061 
11062  RNA_def_property_srna(cprop, "Nodes");
11063  srna = RNA_def_struct(brna, "Nodes", NULL);
11064  RNA_def_struct_sdna(srna, "bNodeTree");
11065  RNA_def_struct_ui_text(srna, "Nodes", "Collection of Nodes");
11066 
11067  func = RNA_def_function(srna, "new", "rna_NodeTree_node_new");
11068  RNA_def_function_ui_description(func, "Add a node to this node tree");
11070  /* XXX warning note should eventually be removed,
11071  * added this here to avoid frequent confusion with API changes from "type" to "bl_idname"
11072  */
11073  parm = RNA_def_string(
11074  func,
11075  "type",
11076  NULL,
11077  MAX_NAME,
11078  "Type",
11079  "Type of node to add (Warning: should be same as node.bl_idname, not node.type!)");
11081  /* return value */
11082  parm = RNA_def_pointer(func, "node", "Node", "", "New node");
11083  RNA_def_function_return(func, parm);
11084 
11085  func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
11086  RNA_def_function_ui_description(func, "Remove a node from this node tree");
11088  parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
11091 
11092  func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
11093  RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
11095 
11096  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
11097  RNA_def_property_struct_type(prop, "Node");
11099  prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", NULL, NULL);
11101  RNA_def_property_ui_text(prop, "Active Node", "Active node in this tree");
11103 }
11104 
11106 {
11107  StructRNA *srna;
11108  PropertyRNA *parm;
11109  FunctionRNA *func;
11110 
11111  RNA_def_property_srna(cprop, "NodeLinks");
11112  srna = RNA_def_struct(brna, "NodeLinks", NULL);
11113  RNA_def_struct_sdna(srna, "bNodeTree");
11114  RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links");
11115 
11116  func = RNA_def_function(srna, "new", "rna_NodeTree_link_new");
11117  RNA_def_function_ui_description(func, "Add a node link to this node tree");
11119  parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
11121  parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
11123  RNA_def_boolean(func,
11124  "verify_limits",
11125  true,
11126  "Verify Limits",
11127  "Remove existing links if connection limit is exceeded");
11128  /* return */
11129  parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link");
11130  RNA_def_function_return(func, parm);
11131 
11132  func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
11133  RNA_def_function_ui_description(func, "remove a node link from the node tree");
11135  parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
11138 
11139  func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
11140  RNA_def_function_ui_description(func, "remove all node links from the node tree");
11142 }
11143 
11144 static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
11145 {
11146  StructRNA *srna;
11147  PropertyRNA *parm;
11148  FunctionRNA *func;
11149  const char *structtype = (in_out == SOCK_IN ? "NodeTreeInputs" : "NodeTreeOutputs");
11150  const char *uiname = (in_out == SOCK_IN ? "Node Tree Inputs" : "Node Tree Outputs");
11151  const char *newfunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_new" :
11152  "rna_NodeTree_outputs_new");
11153  const char *clearfunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_clear" :
11154  "rna_NodeTree_outputs_clear");
11155  const char *movefunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_move" :
11156  "rna_NodeTree_outputs_move");
11157 
11158  RNA_def_property_srna(cprop, structtype);
11159  srna = RNA_def_struct(brna, structtype, NULL);
11160  RNA_def_struct_sdna(srna, "bNodeTree");
11161  RNA_def_struct_ui_text(srna, uiname, "Collection of Node Tree Sockets");
11162 
11163  func = RNA_def_function(srna, "new", newfunc);
11164  RNA_def_function_ui_description(func, "Add a socket to this node tree");
11166  parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
11168  parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
11170  /* return value */
11171  parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "New socket");
11172  RNA_def_function_return(func, parm);
11173 
11174  func = RNA_def_function(srna, "remove", "rna_NodeTree_socket_remove");
11175  RNA_def_function_ui_description(func, "Remove a socket from this node tree");
11177  parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "The socket to remove");
11179 
11180  func = RNA_def_function(srna, "clear", clearfunc);
11181  RNA_def_function_ui_description(func, "Remove all sockets from this node tree");
11183 
11184  func = RNA_def_function(srna, "move", movefunc);
11185  RNA_def_function_ui_description(func, "Move a socket to another position");
11187  parm = RNA_def_int(
11188  func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
11190  parm = RNA_def_int(
11191  func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
11193 }
11194 
11195 static void rna_def_nodetree(BlenderRNA *brna)
11196 {
11197  StructRNA *srna;
11198  PropertyRNA *prop;
11199  FunctionRNA *func;
11200  PropertyRNA *parm;
11201 
11202  static const EnumPropertyItem static_type_items[] = {
11203  {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
11204  {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
11205  {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
11206  {NTREE_GEOMETRY, "GEOMETRY", ICON_NODETREE, "Geometry", "Geometry nodes"},
11207  {0, NULL, 0, NULL, NULL},
11208  };
11209 
11210  srna = RNA_def_struct(brna, "NodeTree", "ID");
11212  srna,
11213  "Node Tree",
11214  "Node tree consisting of linked nodes used for shading, textures and compositing");
11215  RNA_def_struct_sdna(srna, "bNodeTree");
11216  RNA_def_struct_ui_icon(srna, ICON_NODETREE);
11217  RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
11218  RNA_def_struct_register_funcs(srna, "rna_NodeTree_register", "rna_NodeTree_unregister", NULL);
11219 
11220  prop = RNA_def_property(srna, "view_center", PROP_FLOAT, PROP_XYZ);
11221  RNA_def_property_array(prop, 2);
11222  RNA_def_property_float_sdna(prop, NULL, "view_center");
11224 
11225  /* AnimData */
11227 
11228  /* Nodes Collection */
11229  prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
11230  RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
11231  RNA_def_property_struct_type(prop, "Node");
11232  RNA_def_property_ui_text(prop, "Nodes", "");
11233  rna_def_nodetree_nodes_api(brna, prop);
11234 
11235  /* NodeLinks Collection */
11236  prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE);
11237  RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
11238  RNA_def_property_struct_type(prop, "NodeLink");
11239  RNA_def_property_ui_text(prop, "Links", "");
11240  rna_def_nodetree_link_api(brna, prop);
11241 
11242  /* Grease Pencil */
11243  prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
11244  RNA_def_property_pointer_sdna(prop, NULL, "gpd");
11245  RNA_def_property_struct_type(prop, "GreasePencil");
11247  prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
11249  RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block");
11251 
11252  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
11254  RNA_def_property_enum_items(prop, static_type_items);
11256  prop,
11257  "Type",
11258  "Node Tree type (deprecated, bl_idname is the actual node tree type identifier)");
11259 
11260  prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
11261  RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
11262  RNA_def_property_struct_type(prop, "NodeSocketInterface");
11264  RNA_def_property_ui_text(prop, "Inputs", "Node tree inputs");
11266 
11267  prop = RNA_def_property(srna, "active_input", PROP_INT, PROP_UNSIGNED);
11269  prop, "rna_NodeTree_active_input_get", "rna_NodeTree_active_input_set", NULL);
11270  RNA_def_property_ui_text(prop, "Active Input", "Index of the active input");
11272 
11273  prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
11274  RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
11275  RNA_def_property_struct_type(prop, "NodeSocketInterface");
11277  RNA_def_property_ui_text(prop, "Outputs", "Node tree outputs");
11279 
11280  prop = RNA_def_property(srna, "active_output", PROP_INT, PROP_UNSIGNED);
11282  prop, "rna_NodeTree_active_output_get", "rna_NodeTree_active_output_set", NULL);
11283  RNA_def_property_ui_text(prop, "Active Output", "Index of the active output");
11285 
11286  /* exposed as a function for runtime interface type properties */
11287  func = RNA_def_function(srna, "interface_update", "rna_NodeTree_interface_update");
11288  RNA_def_function_ui_description(func, "Updated node group interface");
11289  parm = RNA_def_pointer(func, "context", "Context", "", "");
11291 
11292  /* registration */
11293  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
11294  RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
11296  RNA_def_property_ui_text(prop, "ID Name", "");
11297 
11298  prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
11299  RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name");
11301  RNA_def_property_ui_text(prop, "Label", "The node tree label");
11302 
11303  prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
11304  RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_description");
11306 
11307  prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
11308  RNA_def_property_enum_sdna(prop, NULL, "typeinfo->ui_icon");
11310  RNA_def_property_enum_default(prop, ICON_NODETREE);
11312  RNA_def_property_ui_text(prop, "Icon", "The node tree icon");
11313 
11314  /* poll */
11315  func = RNA_def_function(srna, "poll", NULL);
11316  RNA_def_function_ui_description(func, "Check visibility in the editor");
11318  parm = RNA_def_pointer(func, "context", "Context", "", "");
11320  RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
11321 
11322  /* update */
11323  func = RNA_def_function(srna, "update", NULL);
11324  RNA_def_function_ui_description(func, "Update on editor changes");
11326 
11327  /* get a node tree from context */
11328  func = RNA_def_function(srna, "get_from_context", NULL);
11329  RNA_def_function_ui_description(func, "Get a node tree from the context");
11331  parm = RNA_def_pointer(func, "context", "Context", "", "");
11333  parm = RNA_def_pointer(
11334  func, "result_1", "NodeTree", "Node Tree", "Active node tree from context");
11335  RNA_def_function_output(func, parm);
11336  parm = RNA_def_pointer(
11337  func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree");
11338  RNA_def_function_output(func, parm);
11339  parm = RNA_def_pointer(
11340  func, "result_3", "ID", "From ID", "Original ID data-block selected from the context");
11341  RNA_def_function_output(func, parm);
11342 }
11343 
11345 {
11346  StructRNA *srna;
11347  PropertyRNA *prop;
11348 
11349  srna = RNA_def_struct(brna, "CompositorNodeTree", "NodeTree");
11351  srna, "Compositor Node Tree", "Node tree consisting of linked nodes used for compositing");
11352  RNA_def_struct_sdna(srna, "bNodeTree");
11353  RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
11354 
11355  prop = RNA_def_property(srna, "render_quality", PROP_ENUM, PROP_NONE);
11356  RNA_def_property_enum_sdna(prop, NULL, "render_quality");
11358  RNA_def_property_ui_text(prop, "Render Quality", "Quality when rendering");
11359 
11360  prop = RNA_def_property(srna, "edit_quality", PROP_ENUM, PROP_NONE);
11361  RNA_def_property_enum_sdna(prop, NULL, "edit_quality");
11363  RNA_def_property_ui_text(prop, "Edit Quality", "Quality when editing");
11364 
11365  prop = RNA_def_property(srna, "chunk_size", PROP_ENUM, PROP_NONE);
11366  RNA_def_property_enum_sdna(prop, NULL, "chunksize");
11369  "Chunksize",
11370  "Max size of a tile (smaller values gives better distribution "
11371  "of multiple threads, but more overhead)");
11372 
11373  prop = RNA_def_property(srna, "use_opencl", PROP_BOOLEAN, PROP_NONE);
11375  RNA_def_property_ui_text(prop, "OpenCL", "Enable GPU calculations");
11376 
11377  prop = RNA_def_property(srna, "use_groupnode_buffer", PROP_BOOLEAN, PROP_NONE);
11379  RNA_def_property_ui_text(prop, "Buffer Groups", "Enable buffering of group nodes");
11380 
11381  prop = RNA_def_property(srna, "use_two_pass", PROP_BOOLEAN, PROP_NONE);
11384  "Two Pass",
11385  "Use two pass execution during editing: first calculate fast nodes, "
11386  "second pass calculate all nodes");
11387 
11388  prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE);
11391  prop, "Viewer Region", "Use boundaries for viewer nodes and composite backdrop");
11392  RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update");
11393 }
11394 
11396 {
11397  StructRNA *srna;
11398  FunctionRNA *func;
11399  PropertyRNA *parm;
11400 
11401  srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
11403  srna,
11404  "Shader Node Tree",
11405  "Node tree consisting of linked nodes used for materials (and other shading data-blocks)");
11406  RNA_def_struct_sdna(srna, "bNodeTree");
11407  RNA_def_struct_ui_icon(srna, ICON_MATERIAL);
11408 
11409  func = RNA_def_function(srna, "get_output_node", "ntreeShaderOutputNode");
11411  "Return active shader output node for the specified target");
11412  parm = RNA_def_enum(
11413  func, "target", prop_shader_output_target_items, SHD_OUTPUT_ALL, "Target", "");
11415  parm = RNA_def_pointer(func, "node", "ShaderNode", "Node", "");
11416  RNA_def_function_return(func, parm);
11417 }
11418 
11420 {
11421  StructRNA *srna;
11422 
11423  srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree");
11425  srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures");
11426  RNA_def_struct_sdna(srna, "bNodeTree");
11427  RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
11428 }
11429 
11431 {
11432  StructRNA *srna;
11433 
11434  srna = RNA_def_struct(brna, "GeometryNodeTree", "NodeTree");
11436  srna, "Geometry Node Tree", "Node tree consisting of linked nodes used for geometries");
11437  RNA_def_struct_sdna(srna, "bNodeTree");
11438  RNA_def_struct_ui_icon(srna, ICON_NODETREE);
11439 }
11440 
11442  const char *struct_name,
11443  const char *base_name,
11444  const char *ui_name,
11445  const char *ui_desc,
11446  void (*def_func)(StructRNA *))
11447 {
11448  StructRNA *srna;
11449  FunctionRNA *func;
11450  PropertyRNA *parm;
11451 
11452  /* XXX hack, want to avoid "NodeInternal" prefix,
11453  * so use "Node" in NOD_static_types.h and replace here */
11454  if (STREQ(base_name, "Node")) {
11455  base_name = "NodeInternal";
11456  }
11457 
11458  srna = RNA_def_struct(brna, struct_name, base_name);
11459  RNA_def_struct_ui_text(srna, ui_name, ui_desc);
11460  RNA_def_struct_sdna(srna, "bNode");
11461 
11462  func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
11463  RNA_def_function_ui_description(func, "True if a registered node type");
11465  parm = RNA_def_boolean(func, "result", false, "Result", "");
11466  RNA_def_function_return(func, parm);
11467 
11468  /* Exposes the socket template type lists in RNA for use in scripts
11469  * Only used in the C nodes and not exposed in the base class to
11470  * keep the namespace clean for py-nodes. */
11471  func = RNA_def_function(srna, "input_template", "rna_NodeInternal_input_template");
11472  RNA_def_function_ui_description(func, "Input socket template");
11474  parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
11475  RNA_def_property_ui_text(parm, "Index", "");
11477  parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
11478  RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
11480  RNA_def_function_return(func, parm);
11481 
11482  func = RNA_def_function(srna, "output_template", "rna_NodeInternal_output_template");
11483  RNA_def_function_ui_description(func, "Output socket template");
11485  parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
11486  RNA_def_property_ui_text(parm, "Index", "");
11488  parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
11489  RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
11491  RNA_def_function_return(func, parm);
11492 
11493  if (def_func) {
11494  def_func(srna);
11495  }
11496 
11497  return srna;
11498 }
11499 
11501 {
11502  StructRNA *srna;
11503 
11504  srna = RNA_def_struct(brna, "NodeInstanceHash", NULL);
11505  RNA_def_struct_ui_text(srna, "Node Instance Hash", "Hash table containing node instance data");
11506 
11507  /* XXX This type is a stub for now, only used to store instance hash in the context.
11508  * Eventually could use a StructRNA pointer to define a specific data type
11509  * and expose lookup functions.
11510  */
11511 }
11512 
11514 {
11515  StructRNA *srna;
11516 
11517  rna_def_node_socket(brna);
11519 
11520  rna_def_node(brna);
11521  rna_def_node_link(brna);
11522 
11523  rna_def_internal_node(brna);
11524  rna_def_shader_node(brna);
11526  rna_def_texture_node(brna);
11527  rna_def_geometry_node(brna);
11528  rna_def_function_node(brna);
11529 
11530  rna_def_nodetree(brna);
11531 
11533 
11538 
11539 # define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
11540  { \
11541  srna = define_specific_node( \
11542  brna, #Category #StructName, #Category, UIName, UIDesc, DefFunc); \
11543  if (ID == CMP_NODE_OUTPUT_FILE) { \
11544  /* needs brna argument, can't use NOD_static_types.h */ \
11545  def_cmp_output_file(brna, srna); \
11546  } \
11547  }
11548 
11549  /* hack, don't want to add include path to RNA just for this, since in the future RNA types
11550  * for nodes should be defined locally at runtime anyway ...
11551  */
11552 # include "../../nodes/NOD_static_types.h"
11553 
11554  /* Node group types need to be defined for shader, compositor, texture, geometry nodes
11555  * individually. Cannot use the static types header for this, since they share the same int id.
11556  */
11557  define_specific_node(brna, "ShaderNodeGroup", "ShaderNode", "Group", "", def_group);
11558  define_specific_node(brna, "CompositorNodeGroup", "CompositorNode", "Group", "", def_group);
11559  define_specific_node(brna, "TextureNodeGroup", "TextureNode", "Group", "", def_group);
11560  define_specific_node(brna, "GeometryNodeGroup", "GeometryNode", "Group", "", def_group);
11561  def_custom_group(brna,
11562  "ShaderNodeCustomGroup",
11563  "ShaderNode",
11564  "Shader Custom Group",
11565  "Custom Shader Group Node for Python nodes",
11566  "rna_ShaderNodeCustomGroup_register");
11567  def_custom_group(brna,
11568  "CompositorNodeCustomGroup",
11569  "CompositorNode",
11570  "Compositor Custom Group",
11571  "Custom Compositor Group Node for Python nodes",
11572  "rna_CompositorNodeCustomGroup_register");
11573  def_custom_group(brna,
11574  "NodeCustomGroup",
11575  "Node",
11576  "Custom Group",
11577  "Base node type for custom registered node group types",
11578  "rna_NodeCustomGroup_register");
11579  def_custom_group(brna,
11580  "GeometryNodeCustomGroup",
11581  "GeometryNode",
11582  "Geometry Custom Group",
11583  "Custom Geometry Group Node for Python nodes",
11584  "rna_GeometryNodeCustomGroup_register");
11585 
11586  /* special socket types */
11589 
11591 }
11592 
11593 /* clean up macro definition */
11594 # undef NODE_DEFINE_SUBTYPES
11595 
11596 #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:1414
Generic geometry attributes built on CustomData.
@ ATTR_DOMAIN_AUTO
Definition: BKE_attribute.h:42
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
PointerRNA CTX_data_pointer_get(const bContext *C, const char *member)
Definition: context.c:445
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
void BKE_cryptomatte_matte_id_to_entries(struct NodeCryptomatte *node_storage, const char *matte_id)
Definition: cryptomatte.cc:251
char * BKE_cryptomatte_entries_to_matte_id(struct NodeCryptomatte *node_storage)
Definition: cryptomatte.cc:230
struct IDProperty * IDP_New(const char type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: idprop.c:907
struct RenderPass * BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser)
Definition: image.c:3813
#define IMA_SIGNAL_SRC_CHANGE
Definition: BKE_image.h:165
void BKE_image_signal(struct Main *bmain, struct Image *ima, struct ImageUser *iuser, int signal)
Definition: image.c:3499
void id_us_min(struct ID *id)
Definition: lib_id.c:297
void id_us_plus(struct ID *id)
Definition: lib_id.c:288
const char * BKE_main_blendfile_path_from_global(void)
Definition: main.c:439
#define CMP_SCALE_ABSOLUTE
Definition: BKE_node.h:1245
void ntreeTypeAdd(struct bNodeTreeType *nt)
Definition: node.cc:1219
#define NODE_TYPES_BEGIN(ntype)
Definition: BKE_node.h:535
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:1985
#define CMP_SCALE_SCENEPERCENT
Definition: BKE_node.h:1246
#define NODE_UNDEFINED
Definition: BKE_node.h:867
void nodeRegisterSocketType(struct bNodeSocketType *stype)
Definition: node.cc:1352
#define CMP_TRACKPOS_ABSOLUTE_FRAME
Definition: BKE_node.h:1256
#define CMP_CHAN_RGB
Definition: BKE_node.h:1231
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:1533
bool nodeGroupPoll(struct bNodeTree *nodetree, struct bNodeTree *grouptree, const char **r_disabled_hint)
Definition: node_common.c:96
#define CMP_SCALE_RENDERSIZE_FRAME_CROP
Definition: BKE_node.h:1250
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock)
Definition: node.cc:2348
#define NODE_CUSTOM_GROUP
Definition: BKE_node.h:876
void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node)
struct bNodeTreeType * ntreeTypeFind(const char *idname)
Definition: node.cc:1207
#define CMP_TRACKPOS_RELATIVE_START
Definition: BKE_node.h:1254
#define CMP_TRACKPOS_RELATIVE_FRAME
Definition: BKE_node.h:1255
struct StructRNA * ntreeInterfaceTypeGet(struct bNodeTree *ntree, bool create)
Definition: node.cc:3450
void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node)
void node_type_base_custom(struct bNodeType *ntype, const char *idname, const char *name, short nclass, short flag)
Definition: node.cc:4478
void ntreeCompositUpdateRLayers(struct bNodeTree *ntree)
#define SH_NODE_TEX_ENVIRONMENT
Definition: BKE_node.h:1022
void nodeUpdate(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:4326
void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *sock)
Definition: node.cc:3370
#define NODE_CUSTOM
Definition: BKE_node.h:868
void nodeAttachNode(struct bNode *node, struct bNode *parent)
Definition: node.cc:2449
struct bNode * nodeGetActive(struct bNodeTree *ntree)
Definition: node.cc:3561
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link)
Definition: node.cc:2231
#define CMP_SCALE_RENDERSIZE_FRAME_ASPECT
Definition: BKE_node.h:1249
#define CMP_SCALE_RENDERPERCENT
Definition: BKE_node.h:1247
void nodeRemoveNode(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node, bool do_id_user)
Definition: node.cc:2932
struct bNodeSocket * ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, struct bNode *node, const char *name, struct ImageFormatData *im_format)
void ntreeUpdateTree(struct Main *main, struct bNodeTree *ntree)
Definition: node.cc:4262
#define CMP_SCALE_RELATIVE
Definition: BKE_node.h:1244
void ntreeCompositCryptomatteSyncFromRemove(bNode *node)
void ntreeCompositOutputFileSetPath(struct bNode *node, struct bNodeSocket *sock, const char *name)
int nodeSocketLinkLimit(const struct bNodeSocket *sock)
void ntreeTexCheckCyclics(struct bNodeTree *ntree)
struct bNodeType * nodeTypeFind(const char *idname)
Definition: node.cc:1254
#define NODE_TREE_TYPES_BEGIN(ntype)
Definition: BKE_node.h:430
struct bNodeLink * nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock)
Definition: node.cc:2189
void nodeClearActive(struct bNodeTree *ntree)
Definition: node.cc:3682
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock)
Definition: node.cc:1775
#define NODE_SOCKET_TYPES_BEGIN(stype)
Definition: BKE_node.h:557
void ntreeCompositCryptomatteSyncFromAdd(const Scene *scene, bNode *node)
struct bNode * nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname)
Definition: node.cc:1991
void ntreeTypeFreeLink(const struct bNodeTreeType *nt)
bool ntreeIsRegistered(struct bNodeTree *ntree)
Definition: node.cc:1244
void nodeSetSelected(struct bNode *node, bool select)
Definition: node.cc:3664
#define CMP_CRYPTOMATTE_SRC_RENDER
Definition: BKE_node.h:1259
#define NODE_TREE_TYPES_END
Definition: BKE_node.h:437
void ntreeCompositOutputFileSetLayer(struct bNode *node, struct bNodeSocket *sock, const char *name)
bool nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **r_node, int *r_sockindex)
Definition: node.cc:1823
#define NODE_FRAME
Definition: BKE_node.h:872
void nodeUnregisterSocketType(struct bNodeSocketType *stype)
Definition: node.cc:1361
struct bNodeSocket * ntreeAddSocketInterface(struct bNodeTree *ntree, eNodeSocketInOut in_out, const char *idname, const char *name)
Definition: node.cc:3302
#define NODE_SOCKET_TYPES_END
Definition: BKE_node.h:565
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock)
#define NODE_GROUP_INPUT
Definition: BKE_node.h:874
#define NODE_TYPES_END
Definition: BKE_node.h:542
void nodeDetachNode(struct bNode *node)
Definition: node.cc:2462
#define CMP_CRYPTOMATTE_SRC_IMAGE
Definition: BKE_node.h:1260
struct bNodeSocketType * nodeSocketTypeFind(const char *idname)
Definition: node.cc:1328
void nodeUnregisterType(struct bNodeType *ntype)
Definition: node.cc:1311
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1298
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:3694
#define CMP_TRACKPOS_ABSOLUTE
Definition: BKE_node.h:1253
void nodeModifySocketType(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype)
#define CMP_CHAN_A
Definition: BKE_node.h:1232
void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node)
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_texture_pointdensity_init_data(struct PointDensity *pd)
Definition: texture.c:606
void BKE_texture_pointdensity_free_data(struct PointDensity *pd)
Definition: texture.c:657
#define BLI_assert(a)
Definition: BLI_assert.h:58
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:116
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:188
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:352
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
Definition: BLI_listbase.h:180
int BLI_listbase_count_at_most(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
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:395
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:41
#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:519
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:163
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, const size_t dst_maxncpy) ATTR_NONNULL()
Definition: string.c:333
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:70
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string_utf8.c:258
#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_CURVE
#define BLT_I18NCONTEXT_ID_NODETREE
#define N_(msgid)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ IDP_GROUP
Definition: DNA_ID.h:101
CustomDataType
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
@ CD_PROP_COLOR
@ CD_PROP_INT32
@ CD_PROP_FLOAT2
@ CD_PROP_BOOL
#define MAX_NAME
Definition: DNA_defs.h:62
#define IMA_ANIM_ALWAYS
@ IMA_TYPE_MULTILAYER
@ IMA_SRC_FILE
@ IMA_SRC_MOVIE
@ IMA_SRC_GENERATED
@ IMA_SRC_SEQUENCE
#define MA_RAMP_BLEND
@ VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE
@ VOLUME_TO_MESH_RESOLUTION_MODE_GRID
@ VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT
#define SHD_HAIR_TRANSMISSION
NodeVectorMathOperation
@ 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_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_FIXED
#define SHD_GLOSSY_ASHIKHMIN_SHIRLEY
#define SHD_BLEND_DIAGONAL
#define CMP_NODE_WRAP_X
#define NTREE_QUALITY_LOW
#define CMP_NODE_PLANETRACKDEFORM_MBLUR_SAMPLES_MAX
#define SHD_GLOSSY_SHARP
#define NODE_ACTIVE_PREVIEW
#define SHD_BLEND_LINEAR
#define SHD_TOON_DIFFUSE
@ GEO_NODE_ATTRIBUTE_RANDOMIZE_MULTIPLY
@ GEO_NODE_ATTRIBUTE_RANDOMIZE_SUBTRACT
@ GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE
@ GEO_NODE_ATTRIBUTE_RANDOMIZE_ADD
@ SHD_POINTDENSITY_COLOR_VERTNOR
@ SHD_POINTDENSITY_COLOR_VERTWEIGHT
@ SHD_POINTDENSITY_COLOR_VERTCOL
#define SHD_PROJ_EQUIRECTANGULAR
#define SHD_SKY_NISHITA
@ 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
@ GEO_NODE_POINT_INSTANCE_WHOLE_COLLECTION
@ CMP_NODEFLAG_BLUR_VARIABLE_SIZE
@ CMP_NODEFLAG_BLUR_EXTEND_BOUNDS
#define SHD_PROJ_SPHERE
#define CMP_NODE_CHANNEL_MATTE_CS_HSV
#define NODE_LINK_VALID
#define NODE_CUSTOM_COLOR
#define NTREE_TEXTURE
#define NTREE_CHUNKSIZE_512
#define SHD_VECT_TRANSFORM_TYPE_VECTOR
#define NTREE_CHUNKSIZE_128
#define SHD_VECT_TRANSFORM_TYPE_NORMAL
@ NODE_BOOLEAN_MATH_AND
@ NODE_BOOLEAN_MATH_NOT
@ NODE_BOOLEAN_MATH_OR
#define SHD_HAIR_REFLECTION
#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
@ GEO_NODE_POINT_DISTRIBUTE_POISSON
@ GEO_NODE_POINT_DISTRIBUTE_RANDOM
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_TEXTURE
@ NODE_MAPPING_TYPE_NORMAL
@ SHD_WAVE_RINGS_DIRECTION_Z
@ SHD_WAVE_RINGS_DIRECTION_Y
@ SHD_WAVE_RINGS_DIRECTION_X
@ SHD_WAVE_RINGS_DIRECTION_SPHERICAL
#define CMP_NODE_CHANNEL_MATTE_CS_YUV
@ GEO_NODE_POINT_ROTATE_SPACE_POINT
@ GEO_NODE_POINT_ROTATE_SPACE_OBJECT
#define SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION
#define NODE_SCRIPT_EXTERNAL
@ GEO_NODE_TRIANGULATE_NGON_EARCLIP
@ GEO_NODE_TRIANGULATE_NGON_BEAUTY
#define NTREE_TWO_PASS
#define NODE_DO_OUTPUT
@ CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR
#define NTREE_GEOMETRY
#define NTREE_CUSTOM
#define SHD_WAVE_RINGS
@ 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 CMP_NODE_BLUR_ASPECT_Y
#define CMP_NODE_CHANNEL_MATTE_CS_RGB
#define NODE_MUTED
@ CMP_NODEFLAG_STABILIZE_INVERSE
#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
#define NODE_ACTIVE_TEXTURE
#define SHD_VECT_TRANSFORM_TYPE_POINT
#define SHD_MIXRGB_USE_ALPHA
@ NODE_CLAMP_RANGE
@ NODE_CLAMP_MINMAX
@ GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_X
@ GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_Z
@ GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_AUTO
@ GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_Y
#define NODE_UPDATE_ID
@ CMP_NODE_DILATEERODE_STEP
@ CMP_NODE_DILATEERODE_DISTANCE_THRESH
@ CMP_NODE_DILATEERODE_DISTANCE_FEATHER
@ CMP_NODE_DILATEERODE_DISTANCE
#define SHD_IMAGE_EXTENSION_CLIP
#define NTREE_VIEWER_BORDER
@ SHD_ATTRIBUTE_OBJECT
@ SHD_ATTRIBUTE_GEOMETRY
@ SHD_ATTRIBUTE_INSTANCER
#define SHD_VECT_TRANSFORM_SPACE_OBJECT
#define SHD_IMAGE_EXTENSION_EXTEND
#define SHD_INTERP_SMART
#define NTREE_COM_GROUPNODE_BUFFER
#define CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT
#define CMP_NODE_WRAP_NONE
#define SHD_IMAGE_EXTENSION_REPEAT
#define CMP_NODE_BLUR_ASPECT_NONE
#define SHD_PRINCIPLED_HAIR_REFLECTANCE
@ SHD_WAVE_BANDS_DIRECTION_Y
@ SHD_WAVE_BANDS_DIRECTION_X
@ SHD_WAVE_BANDS_DIRECTION_Z
@ SHD_WAVE_BANDS_DIRECTION_DIAGONAL
@ GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES
@ GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS
@ GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_EDGES
@ SHD_VORONOI_F2
@ SHD_VORONOI_SMOOTH_F1
@ SHD_VORONOI_DISTANCE_TO_EDGE
@ SHD_VORONOI_F1
@ SHD_VORONOI_N_SPHERE_RADIUS
#define SHD_PROJ_FLAT
#define SHD_SPACE_TANGENT
#define NODE_HIDDEN
@ SOCK_OUT
@ SOCK_IN
#define NTREE_QUALITY_HIGH
@ SHD_SUBSURFACE_BURLEY
@ SHD_SUBSURFACE_CUBIC
@ SHD_SUBSURFACE_GAUSSIAN
@ SHD_SUBSURFACE_RANDOM_WALK
@ SHD_POINTDENSITY_SOURCE_PSYS
@ SHD_POINTDENSITY_SOURCE_OBJECT
#define SHD_VECT_TRANSFORM_SPACE_CAMERA
@ CMP_NODE_SETALPHA_MODE_REPLACE_ALPHA
@ CMP_NODE_SETALPHA_MODE_APPLY
@ GEO_NODE_POINT_ROTATE_TYPE_EULER
@ GEO_NODE_POINT_ROTATE_TYPE_AXIS_ANGLE
@ SHD_POINTDENSITY_SPACE_WORLD
@ SHD_POINTDENSITY_SPACE_OBJECT
#define NODE_PREVIEW
#define SHD_MATH_CLAMP
#define CMP_NODE_MASK_MBLUR_SAMPLES_MAX
@ NODE_MAP_RANGE_STEPPED
@ NODE_MAP_RANGE_SMOOTHERSTEP
@ NODE_MAP_RANGE_SMOOTHSTEP
@ NODE_MAP_RANGE_LINEAR
@ 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
@ CMP_NODEFLAG_MASK_FIXED_SCENE
@ CMP_NODEFLAG_MASK_NO_FEATHER
@ CMP_NODEFLAG_MASK_FIXED
@ CMP_NODEFLAG_MASK_MOTION_BLUR
#define SHD_GLOSSY_BECKMANN
#define SHD_BLEND_EASING
@ GEO_NODE_POINT_INSTANCE_TYPE_OBJECT
@ GEO_NODE_POINT_INSTANCE_TYPE_COLLECTION
@ GEO_NODE_ALIGN_ROTATION_TO_VECTOR_AXIS_Y
@ GEO_NODE_ALIGN_ROTATION_TO_VECTOR_AXIS_Z
@ GEO_NODE_ALIGN_ROTATION_TO_VECTOR_AXIS_X
@ 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_VECTOR
@ SOCK_BOOLEAN
@ SOCK_SHADER
@ SOCK_FLOAT
@ SOCK_IMAGE
@ SOCK_COLLECTION
@ SOCK_CUSTOM
@ SOCK_GEOMETRY
@ SOCK_OBJECT
@ SOCK_STRING
@ SOCK_RGBA
#define SHD_MUSGRAVE_FBM
@ SHD_VORONOI_EUCLIDEAN
@ SHD_VORONOI_CHEBYCHEV
@ SHD_VORONOI_MANHATTAN
@ SHD_VORONOI_MINKOWSKI
#define SHD_TANGENT_UVMAP
@ GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_AMOUNT
@ GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_SIZE
#define CMP_NODE_WRAP_XY
@ NODE_FLOAT_COMPARE_GREATER_THAN
@ NODE_FLOAT_COMPARE_GREATER_EQUAL
@ NODE_FLOAT_COMPARE_EQUAL
@ NODE_FLOAT_COMPARE_LESS_EQUAL
@ NODE_FLOAT_COMPARE_LESS_THAN
@ NODE_FLOAT_COMPARE_NOT_EQUAL
#define SHD_TOON_GLOSSY
#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
#define CMP_NODE_WRAP_Y
#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
#define SHD_AO_INSIDE
@ SHD_POINTDENSITY_COLOR_PARTSPEED
@ SHD_POINTDENSITY_COLOR_PARTVEL
@ SHD_POINTDENSITY_COLOR_PARTAGE
#define SHD_VECT_TRANSFORM_SPACE_WORLD
#define SHD_GLOSSY_MULTI_GGX
#define SHD_PROJ_TUBE
#define SHD_INTERP_CLOSEST
#define NODE_SCRIPT_INTERNAL
#define NTREE_SHADER
@ NTREE_UPDATE_GROUP_OUT
@ NTREE_UPDATE_GROUP
@ NTREE_UPDATE_GROUP_IN
@ GEO_NODE_TRANSFORM_SPACE_RELATIVE
@ GEO_NODE_TRANSFORM_SPACE_ORIGINAL
#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
@ SHD_WAVE_PROFILE_SIN
@ SHD_WAVE_PROFILE_TRI
@ SHD_WAVE_PROFILE_SAW
#define NTREE_CHUNKSIZE_64
#define NTREE_COM_OPENCL
#define NODE_IES_INTERNAL
@ GEO_NODE_ATTRIBUTE_INPUT_VECTOR
@ GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE
@ GEO_NODE_ATTRIBUTE_INPUT_FLOAT
#define SHD_BLEND_RADIAL
#define SHD_SPACE_OBJECT
#define CMP_NODE_OUTPUT_IGNORE_ALPHA
#define SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION
#define SHD_INTERP_LINEAR
#define SHD_SKY_HOSEK
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.c:3318
void ED_node_tag_update_nodetree(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node)
Definition: node_draw.cc:164
void ED_init_custom_node_type(struct bNodeType *ntype)
Definition: drawnode.c:3308
_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
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
void register_node_type_sh_custom_group(bNodeType *ntype)
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance Directional Alpha Distance Hue Movie Ellipse Bokeh View Corner CMP_NODE_CRYPTOMATTE
Group RGB to Bright Vector Camera CLAMP
NODE_GROUP_OUTPUT
NODE_GROUP
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume SH_NODE_TEX_IMAGE
StructRNA RNA_Node
StructRNA RNA_Scene
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:1425
StructRNA RNA_NodeOutputFileSlotFile
StructRNA RNA_ShaderNode
StructRNA RNA_NodeOutputFileSlotLayer
StructRNA RNA_GeometryNode
StructRNA RNA_ParticleSystem
StructRNA RNA_CompositorNode
StructRNA RNA_NodeSocket
StructRNA RNA_FunctionNode
StructRNA RNA_NodeTree
StructRNA RNA_TextureNode
StructRNA RNA_NodeSocketInterface
StructRNA RNA_Image
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:339
@ PARM_REQUIRED
Definition: RNA_types.h:337
void(* StructFreeFunc)(void *data)
Definition: RNA_types.h:652
int(* StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function)
Definition: RNA_types.h:647
@ FUNC_USE_REPORTS
Definition: RNA_types.h:578
@ FUNC_USE_SELF_TYPE
Definition: RNA_types.h:573
@ FUNC_NO_SELF
Definition: RNA_types.h:571
@ FUNC_REGISTER
Definition: RNA_types.h:585
@ FUNC_USE_MAIN
Definition: RNA_types.h:576
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:577
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:565
@ FUNC_REGISTER_OPTIONAL
Definition: RNA_types.h:587
@ FUNC_ALLOW_WRITE
Definition: RNA_types.h:593
int(* StructCallbackFunc)(struct bContext *C, struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list)
Definition: RNA_types.h:648
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_COLLECTION
Definition: RNA_types.h:79
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:297
@ PROPOVERRIDE_NO_COMPARISON
Definition: RNA_types.h:305
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
@ PROP_DYNAMIC
Definition: RNA_types.h:275
@ PROP_CONTEXT_UPDATE
Definition: RNA_types.h:254
@ PROP_ANIMATABLE
Definition: RNA_types.h:188
@ PROP_NEVER_UNLINK
Definition: RNA_types.h:232
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_REGISTER_OPTIONAL
Definition: RNA_types.h:259
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
@ PROP_NO_DEG_UPDATE
Definition: RNA_types.h:286
@ PROP_ENUM_NO_TRANSLATE
Definition: RNA_types.h:279
@ PROP_REGISTER
Definition: RNA_types.h:258
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:242
@ PROP_ID_REFCOUNT
Definition: RNA_types.h:212
@ PROP_IDPROPERTY
Definition: RNA_types.h:273
PropertySubType
Definition: RNA_types.h:112
@ PROP_TIME
Definition: RNA_types.h:133
@ PROP_DIRECTION
Definition: RNA_types.h:141
@ PROP_XYZ
Definition: RNA_types.h:148
@ PROP_DISTANCE
Definition: RNA_types.h:135
@ PROP_ACCELERATION
Definition: RNA_types.h:143
@ PROP_COLOR
Definition: RNA_types.h:139
@ PROP_ANGLE
Definition: RNA_types.h:132
@ PROP_EULER
Definition: RNA_types.h:145
@ PROP_COORDS
Definition: RNA_types.h:153
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_PERCENTAGE
Definition: RNA_types.h:130
@ PROP_FACTOR
Definition: RNA_types.h:131
@ PROP_COLOR_GAMMA
Definition: RNA_types.h:151
@ PROP_TRANSLATION
Definition: RNA_types.h:140
@ PROP_XYZ_LENGTH
Definition: RNA_types.h:149
@ PROP_UNSIGNED
Definition: RNA_types.h:129
@ PROP_FILEPATH
Definition: RNA_types.h:116
@ PROP_VELOCITY
Definition: RNA_types.h:142
#define C
Definition: RandGen.cpp:39
#define NC_NODE
Definition: WM_types.h:295
#define ND_OB_ACTIVE
Definition: WM_types.h:340
#define ND_DISPLAY
Definition: WM_types.h:391
#define NC_SCENE
Definition: WM_types.h:279
#define ND_NODES
Definition: WM_types.h:336
#define NA_EDITED
Definition: WM_types.h:462
#define NC_IMAGE
Definition: WM_types.h:285
#define NA_SELECTED
Definition: WM_types.h:467
return(oflags[bm->toolflag_index].f &oflag) !=0
PyObject * self
Definition: bpy_driver.c:185
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
Definition: btQuaternion.h:895
short type
#define SELECT
OperationNode * node
const char * label
Scene scene
const Depsgraph * depsgraph
bNodeTree * ntree
RenderEngine * RE_engine_create(RenderEngineType *type)
Definition: engine.c:133
RenderEngineType * RE_engines_find(const char *idname)
Definition: engine.c:108
void RE_engine_free(RenderEngine *engine)
Definition: engine.c:161
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
void node_group_update(struct bNodeTree *ntree, struct bNode *node)
Definition: node_common.c:187
void register_node_type_cmp_custom_group(bNodeType *ntype)
void register_node_type_geo_custom_group(bNodeType *ntype)
static const EnumPropertyItem mode_items[]
Definition: paint_mask.c:75
bool RE_layers_have_name(struct RenderResult *rr)
Definition: pipeline.c:2740
return ret
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
Definition: rna_access.c:844
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void **value)
Definition: rna_access.c:7407
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:122
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
Definition: rna_access.c:1044
ParameterList * RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSED(ptr), FunctionRNA *func)
Definition: rna_access.c:7207
const char * RNA_struct_ui_description(const StructRNA *type)
Definition: rna_access.c:746
const char * RNA_struct_ui_name(const StructRNA *type)
Definition: rna_access.c:728
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:71
void * RNA_struct_blender_type_get(StructRNA *srna)
Definition: rna_access.c:1039
void RNA_parameter_list_free(ParameterList *parms)
Definition: rna_access.c:7303
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
Definition: rna_access.c:4823
int RNA_struct_ui_icon(const StructRNA *type)
Definition: rna_access.c:738
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value)
Definition: rna_access.c:7469
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:196
void * rna_iterator_listbase_get(CollectionPropertyIterator *iter)
Definition: rna_access.c:4855
void rna_def_animdata_common(StructRNA *srna)
const EnumPropertyItem rna_enum_attribute_domain_with_auto_items[]
Definition: rna_attribute.c:65
const EnumPropertyItem rna_enum_attribute_type_items[]
Definition: rna_attribute.c:40
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
Definition: rna_define.c:1167
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2762
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1212
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4159
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1555
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3312
void RNA_def_property_float_default(PropertyRNA *prop, float value)
Definition: rna_define.c:2042
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
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:4065
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
Definition: rna_define.c:2127
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3153
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2717
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3462
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:3408
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
Definition: rna_define.c:4327
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
Definition: rna_define.c:1957
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2971
void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
Definition: rna_define.c:1191
void RNA_def_property_int_default(PropertyRNA *prop, int value)
Definition: rna_define.c:1998
StructRNA * RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
Definition: rna_define.c:919
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1568
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1757
void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname)
Definition: rna_define.c:1094
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2791
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3251
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2691
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4470
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1122
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *rna_ext)
Definition: rna_define.c:780
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:3373
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4416
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3055
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1267
FunctionRNA * RNA_def_function_runtime(StructRNA *srna, const char *identifier, CallFunc call)
Definition: rna_define.c:4285
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
Definition: rna_define.c:795
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:3675
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
Definition: rna_define.c:1179
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2870
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
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:3585
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2515
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1706
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:3771
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2364
void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
Definition: rna_define.c:1272
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
Definition: rna_define.c:2064
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2348
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1525
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
char * rna_Node_ImageUser_path(struct PointerRNA *ptr)
BlenderRNA BLENDER_RNA
StructRNA RNA_PropertyGroup
const EnumPropertyItem rna_enum_ramp_blend_items[]
Definition: rna_material.c:37
const EnumPropertyItem rna_enum_axis_xy_items[]
Definition: rna_modifier.c:578
static const EnumPropertyItem sh_tex_prop_interpolation_items[]
static void def_tex_output(StructRNA *srna)
static void def_geo_attribute_fill(StructRNA *srna)
static void def_custom_group(BlenderRNA *brna, const char *struct_name, const char *base_name, const char *ui_name, const char *ui_desc, const char *reg_func)
static const EnumPropertyItem node_glossy_items[]
static void def_cmp_filter(StructRNA *srna)
static void def_principled(StructRNA *srna)
static 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_node_image_user(StructRNA *srna)
static void def_cmp_double_edge_mask(StructRNA *srna)
static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_any[]
Definition: rna_nodetree.c:440
static void def_cmp_flip(StructRNA *srna)
static EnumPropertyItem node_ies_mode_items[]
static void def_geo_attribute_randomize(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_geo_attribute_mix(StructRNA *srna)
static void def_rgb_curve(StructRNA *srna)
static void def_sh_tex_image(StructRNA *srna)
static void def_geo_point_scale(StructRNA *srna)
static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_float[]
Definition: rna_nodetree.c:462
static const EnumPropertyItem prop_view_layer_items[]
#define ITEM_COLOR
Definition: rna_nodetree.c:430
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 rna_def_node_link(BlenderRNA *brna)
static void def_sh_tex_checker(StructRNA *srna)
static void def_geo_align_rotation_to_vector(StructRNA *srna)
static const EnumPropertyItem prop_image_view_items[]
static void def_geo_attribute_combine_xyz(StructRNA *srna)
static void rna_def_nodetree(BlenderRNA *brna)
static void def_geo_attribute_clamp(StructRNA *srna)
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:385
static void def_float_compare(StructRNA *srna)
#define ITEM_FLOAT
Definition: rna_nodetree.c:422
static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_float_vector[]
Definition: rna_nodetree.c:456
static void def_sh_uvalongstroke(StructRNA *srna)
static const EnumPropertyItem prop_shader_output_target_items[]
Definition: rna_nodetree.c:392
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_time(StructRNA *srna)
static void def_sh_tex_gradient(StructRNA *srna)
static void def_cmp_brightcontrast(StructRNA *srna)
static void def_geo_attribute_sample_texture(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_cmp_denoise(StructRNA *srna)
static void def_geo_point_rotate(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 const EnumPropertyItem rna_node_geometry_attribute_input_type_items_vector[]
Definition: rna_nodetree.c:451
static void def_sh_vertex_color(StructRNA *srna)
static void def_geo_point_translate(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:341
static void def_group_input(StructRNA *srna)
static void def_sh_tex_magic(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_sh_tangent(StructRNA *srna)
static void def_mix_rgb(StructRNA *srna)
static void rna_def_node_socket_color(BlenderRNA *brna, const char *identifier, const char *interface_idname)
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:69
static void def_geo_attribute_map_range(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:94
static void def_cmp_sunbeams(StructRNA *srna)
static void def_cmp_levels(StructRNA *srna)
static void def_frame(StructRNA *srna)
const EnumPropertyItem rna_enum_mapping_type_items[]
Definition: rna_nodetree.c:112
static void def_sh_attribute(StructRNA *srna)
static const EnumPropertyItem rna_enum_vector_rotate_type_items[]
Definition: rna_nodetree.c:132
static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
static void def_cmp_blur(StructRNA *srna)
static void def_cmp_composite(StructRNA *srna)
static void def_geo_attribute_attribute_compare(StructRNA *srna)
static void def_sh_tex_voronoi(StructRNA *srna)
static void def_fn_input_string(StructRNA *srna)
static const EnumPropertyItem node_cryptomatte_layer_name_items[]
Definition: rna_nodetree.c:403
static const EnumPropertyItem node_ycc_items[]
static void def_cmp_lensdist(StructRNA *srna)
static void def_cmp_color_matte(StructRNA *srna)
static void def_toon(StructRNA *srna)
static void def_sh_subsurface(StructRNA *srna)
static const EnumPropertyItem node_refraction_items[]
static void def_cmp_map_range(StructRNA *srna)
static void def_cmp_cryptomatte(StructRNA *srna)
static void def_texture(StructRNA *srna)
static void rna_def_function_node(BlenderRNA *brna)
static void def_cmp_defocus(StructRNA *srna)
static void def_cmp_invert(StructRNA *srna)
static EnumPropertyItem rna_node_geometry_mesh_circle_fill_type_items[]
Definition: rna_nodetree.c:410
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_sh_ambient_occlusion(StructRNA *srna)
static void rna_def_node_socket_string(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static const EnumPropertyItem rna_node_geometry_attribute_randomize_operation_items[]
Definition: rna_nodetree.c:360
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_cmp_render_layers(StructRNA *srna)
static void def_geo_attribute_separate_xyz(StructRNA *srna)
static void def_glossy(StructRNA *srna)
static void rna_def_cmp_output_file_slot_file(BlenderRNA *brna)
#define ITEM_BOOLEAN
Definition: rna_nodetree.c:434
static void def_cmp_inpaint(StructRNA *srna)
static void def_geo_mesh_cone(StructRNA *srna)
static void def_geo_point_distribute(StructRNA *srna)
static void def_clamp(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)
const EnumPropertyItem rna_enum_node_socket_in_out_items[]
Definition: rna_nodetree.c:65
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 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_cmp_vector_blur(StructRNA *srna)
const EnumPropertyItem rna_enum_node_math_items[]
Definition: rna_nodetree.c:145
static void rna_def_shader_nodetree(BlenderRNA *brna)
static void def_boolean_math(StructRNA *srna)
static void def_cmp_huecorrect(StructRNA *srna)
static void def_cmp_channel_matte(StructRNA *srna)
const EnumPropertyItem rna_enum_node_vec_math_items[]
Definition: rna_nodetree.c:214
static void def_sh_displacement(StructRNA *srna)
static void def_geo_volume_to_mesh(StructRNA *srna)
static void def_cmp_glare(StructRNA *srna)
#define ITEM_ATTRIBUTE
Definition: rna_nodetree.c:418
static void def_sh_tex_sky(StructRNA *srna)
static void def_geo_attribute_math(StructRNA *srna)
static void def_cmp_splitviewer(StructRNA *srna)
static void def_geo_attribute_vector_math(StructRNA *srna)
static void def_cmp_crop(StructRNA *srna)
static void def_map_range(StructRNA *srna)
static void def_hair(StructRNA *srna)
static void rna_def_geometry_nodetree(BlenderRNA *brna)
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 def_geo_attribute_convert(StructRNA *srna)
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 const EnumPropertyItem node_glass_items[]
static void rna_def_node_socket_shader(BlenderRNA *brna, const char *identifier, const char *interface_idname)
static void def_cmp_bokehimage(StructRNA *srna)
static void def_geo_attribute_proximity(StructRNA *srna)
static void def_cmp_moviedistortion(StructRNA *srna)
const EnumPropertyItem rna_enum_node_boolean_math_items[]
Definition: rna_nodetree.c:266
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:307
const EnumPropertyItem rna_enum_node_float_compare_items[]
Definition: rna_nodetree.c:273
static void def_sh_vect_transform(StructRNA *srna)
const EnumPropertyItem rna_enum_node_filter_items[]
Definition: rna_nodetree.c:349
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 const EnumPropertyItem rna_node_geometry_attribute_input_type_items_no_boolean[]
Definition: rna_nodetree.c:467
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 rna_def_composite_nodetree(BlenderRNA *brna)
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:331
static void def_geo_object_info(StructRNA *srna)
static void def_geo_attribute_color_ramp(StructRNA *srna)
static void def_geo_point_instance(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:101
static void def_sh_tex_wave(StructRNA *srna)
static void def_cmp_output_file(BlenderRNA *brna, StructRNA *srna)
static void def_sh_tex_pointdensity(StructRNA *srna)
static const EnumPropertyItem node_socket_type_items[]
Definition: rna_nodetree.c:78
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 rna_def_nodetree_nodes_api(BlenderRNA *brna, PropertyRNA *cprop)
static const EnumPropertyItem node_toon_items[]
static void def_glass(StructRNA *srna)
static void def_cmp_cryptomatte_common(StructRNA *srna)
static void rna_def_node_socket_float(BlenderRNA *brna, const char *idname, const char *interface_idname, PropertySubType subtype)
#define ITEM_VECTOR
Definition: rna_nodetree.c:426
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:40
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
Definition: rna_scene.c:132
const EnumPropertyItem rna_enum_icon_items[]
Definition: rna_ui_api.c:46
#define min(a, b)
Definition: sort.c:51
const char * identifier
Definition: RNA_types.h:446
const char * name
Definition: RNA_types.h:450
const char * description
Definition: RNA_types.h:452
StructRNA * srna
Definition: RNA_types.h:681
StructCallbackFunc call
Definition: RNA_types.h:682
void * data
Definition: RNA_types.h:680
StructFreeFunc free
Definition: RNA_types.h:683
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
ListBase particlesystem
char vertex_attribute_name[64]
struct Object * object
struct StructRNA * type
Definition: RNA_types.h:51
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
char engine[32]
struct ImageFormatData im_format
void(* update_script_node)(struct RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node)
Definition: RE_engine.h:104
char name[RE_MAXNAME]
Definition: RE_pipeline.h:100
struct RenderLayer * next
Definition: RE_pipeline.h:97
struct RenderView * next
Definition: RE_pipeline.h:65
char name[64]
Definition: RE_pipeline.h:66
struct bNodeTree * nodetree
struct RenderData r
char * filepath
Compact definition of a node socket.
Definition: BKE_node.h:95
char identifier[64]
Definition: BKE_node.h:105
Defines a socket type.
Definition: BKE_node.h:143
void(* interface_init_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock, const char *data_path)
Definition: BKE_node.h:161
void(* draw_color)(struct bContext *C, struct PointerRNA *ptr, struct PointerRNA *node_ptr, float *r_color)
Definition: BKE_node.h:151
ExtensionRNA ext_interface
Definition: BKE_node.h:178
void(* interface_register_properties)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct StructRNA *data_srna)
Definition: BKE_node.h:158
ExtensionRNA ext_socket
Definition: BKE_node.h:177
void(* interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color)
Definition: BKE_node.h:157
void(* draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr, struct PointerRNA *node_ptr, const char *text)
Definition: BKE_node.h:146
void(* free_self)(struct bNodeSocketType *stype)
Definition: BKE_node.h:189
void(* interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr)
Definition: BKE_node.h:156
char idname[64]
Definition: BKE_node.h:144
void(* interface_from_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock)
Definition: BKE_node.h:171
IDProperty * prop
void * storage
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:393
char idname[64]
Definition: BKE_node.h:381
void(* update)(struct bNodeTree *ntree)
Definition: BKE_node.h:407
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:395
char ui_name[64]
Definition: BKE_node.h:383
char ui_description[256]
Definition: BKE_node.h:384
ExtensionRNA rna_ext
Definition: BKE_node.h:414
char idname[64]
struct bNodeTreeType * typeinfo
ListBase nodes
ListBase inputs
ListBase links
ListBase outputs
Defines a node type.
Definition: BKE_node.h:221
float minwidth
Definition: BKE_node.h:231
void(* group_update_func)(struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:276
float width
Definition: BKE_node.h:231
char ui_name[64]
Definition: BKE_node.h:227
bool(* poll)(struct bNodeType *ntype, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:301
float maxwidth
Definition: BKE_node.h:231
ExtensionRNA rna_ext
Definition: BKE_node.h:330
int type
Definition: BKE_node.h:225
void(* updatefunc)(struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:274
bNodeSocketTemplate * outputs
Definition: BKE_node.h:236
void(* initfunc_api)(const struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:288
void(* free_self)(struct bNodeType *ntype)
Definition: BKE_node.h:314
char ui_description[256]
Definition: BKE_node.h:228
void(* insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link)
Definition: BKE_node.h:310
void(* draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:255
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:253
float minheight
Definition: BKE_node.h:232
void(* freefunc_api)(struct PointerRNA *ptr)
Definition: BKE_node.h:289
float height
Definition: BKE_node.h:232
void(* labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen)
Definition: BKE_node.h:265
bNodeSocketTemplate * inputs
Definition: BKE_node.h:236
float maxheight
Definition: BKE_node.h:232
bool(* poll_instance)(struct bNode *node, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:305
char idname[64]
Definition: BKE_node.h:224
void(* copyfunc_api)(struct PointerRNA *ptr, const struct bNode *src_node)
Definition: BKE_node.h:290
int ui_icon
Definition: BKE_node.h:229
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
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157